Issue
I have set up a little Raspberry Pi (with Debian 8) behind a router (Fritz!Box), which does check/analyse the connectivity or rather quality of service of a certain phone line per SIP calls. My phone line on the other side has an answering machine. Basically, I need to know, at which times the phone line is not reachable.
In detail, the Raspberry calls said number three times a day, using the programme Sipcmd (https://github.com/tmakkonen/sipcmd) - see code below.
Cronjob:
0 8,14,20 * * * /usr/bin/sipcmd -P sip -u abc -c cba -w 192.168.8.10 -x "c010101010101;ws45000;h"
Now the calls work fine, but I need something like a logging into a text file, when a call did not work or rather, when the phone number was not reachable, so that it works like an alert system showing me only the failures.
Anyone has got a solution for this? Thanks a lot, guys.
Solution
Alright, I found a solution for my issue. The programme Sipcmd has the following feature:
-o --opallog enable extra opal library logging to file
So, I changed my cronjob to this:
0 8,14,20 * * * /usr/bin/sipcmd -o ~/call.log -P sip -u abc -c cba -w 192.168.8.10 -x "c010101010101;ws45000;h"
Now with the existing log file I could use a function which greps for the SIP status code, which tells me a call got through (or not).
Here are the SIP status codes, if anyone is interested:
https://de.wikipedia.org/wiki/SIP-Status-Codes
Much success to everybody.
Answered By - vega Answer Checked By - Mildred Charles (WPSolving Admin)