This is a simple Slack notifier that can send information about missed calls to tech support, for example.
At first you shoud create the app for your Slack space. Also, you should give him rights for incoming webhooks and permissions for sending message to some channel, where you want to get statistics. It's simple.
The script (mcnotifier.py) can be run as an asterisk post call script, but first you need to export environment variables to the user on whose behalf the asterisk is running.
For example, you can add below lines to his .bashrc
export SLACK_API_TOKEN=<API_TOKEN>
export SLACK_CHANNEL_ID=<CHANNEL_ID>
The script takes 5 arguments:
- Asterisk CDR database name;
- User with access to the database;
- His password;
- The first asterisk ring group;
- The call group answering after the first group.
Also, you can add dailyreport.py to cron for the daily full reports.
Just an example:
00 18 * * * . ~/.bash_profile ; cd /opt/mcnotifier && ./dailyreport.py 666 >/tmp/amcnotifier.log 2>&1