How to create a cron to test all internal extensions

Hello Everybody,

I would like to test every morning a list of extension to check it they are working correctly.

I would like to know if someone has already done that or where i could find info about how to make call in a script

Thanks a lot

Pierre

Hi Pierre,

I am relatively new to FreePBX, so until the real help comes along: I am not sure what “working correctly” may mean to you. If you know the IP addresses of the phone and want to see if they are reachable, you could write a script to ping each one and send you an alert if no response. Just because they are pingable, doesn’t necessarily mean they are ready to take/make calls.

If you can log into the FreePBX GUI, you could bring up the Asterisk Info page (under Reports) which would give you a snapshot of extensions status.

HTH
Paul

Thanks for your idea but I want to test extension on android phones. They have dynamic ip.
The idea is also to get a report about extensions working and extensions not working.

Depending on driver being used, you could return the status of all or just one extension with:

Asterisk -rx"sip show peers"
Asterisk -rx"sip show peer 1000"

Asterisk -rx"PJSIP show aors"
Asterisk -rx"PJSIP show aor 1000"

You could then slice up the output to get what you need then email yourself or whatever

Fraser.

I think you need to take a step back and evaluate what you mean by a working extension. If you dial 100 and it rings for a bit or ends up in voicemail, it works. The extension works because nothing states an extension has to be connected to a device.

What does calling the extension get you really? If no one answers, how do you know they didn’t answer because they just didn’t or they didn’t answer because they never saw the call hit their device? So how do you validate your results? Are you going to have every user report back? Are you going to make every user answer these test calls for verification that it was answered?

I use :-

rasterisk -x 'sip show peers like ^[0-9]'|awk '{print "SIP Extension:\t"$1"@"$2"\t"$8}'|sed 's|/[0-9]*||'|grep -v line
rasterisk -x 'pjsip show endpoints' |grep Contact:|grep -v Hash|tr ':' ' ' |awk '{print "PJSIP Endpoint:\t"$3"\t"$6}'
1 Like

Thanks a lot, I ll try…

Is it to abuse to ask if I want to send the results by mail, how to do it?

Is there a way to call each extension from a Cron and play a recorded file?

You can pretty much script up anything, just need to decide what is a good enough indication that an extension is “working”.
I myself just check in asterisk that extensions are shown as OK from the SIP qualify as others have indicated previously. That shows the device is still able to connect to asterisk regularly.

Not sure what benefits actually calling the device would get you unless the call is actually picked up and then one could do call quality analysis I suppose.

I use this

1 Like

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