Logging for Grafana

hello, with the help of an extension I manage to run a script that counts how many people call during the day and what is the hourly load. How can I get to the information about the outgoing connection and its duration (ending the connection) in the script. Here is my plugin:

[afyalog]
exten => s,1,Set(TIMEOUT(digit)=5)
exten => s,4,TrySystem(/var/spool/afya/log.py ${CALLERID(num)})
exten => s,5,GoToIfTime(9:00-16:00|mon-fri?app-announcement-3,s,1)
exten => s,6,Goto(app-announcement-4,s,1)

Looks like you’re using FreePBX, in which case you will want to use a dialplan hook probably with a hangup handler as described in this thread:

I collect this information with an external shell script:

COUNT=$(sudo /usr/sbin/asterisk -C /etc/asterisk/@PROJECT@/asterisk.conf -x "core show channels" | awk '/active call/ {print $1}')

gives me the count and then I insert it into a MySQL database with:

--execute="insert into channel_counts set count='${COUNT}', host='${HOSTNAME}';"\

This script runs on each Asterisk host every minute via cron and then my web page shows the counts per host.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.