Paw is an application which calculate duration and cost of a phone call based on call events. It provides an API to send the start and end events of a call.
Using a simple admin you can configure the rate minute and standing costs based on range of times.
The API also has an endpoint which returns the phone bill for a given period.
Full documention at: http://paw.readthedocs.io/
This project was built on linux Ubuntu 18.04. I used pyenv to control virtual environments and neovim to code.