Making a Test Outgoing Call and another Incoming Test Call


#1

We’re using Zabbix to monitor our network, and would like to use it to monitor Asterisk as well but I’m stuck on one of the things that’s been asked of me. I think this might be getting to be a bit too specific to Asterisk to get help on the Zabbix forums, so I thought I’d ask here and see if anyone had some pointers for me. We’re already monitoring our asterisk server in a few different ways, we’re using the standard Linux template as well as a few user parameters.

For those of you unfamiliar with Zabbix when using UserParameters we can execute almost any command that you could use asterisk -rvvvvvvx ‘insert command here’ and we’re using the following commands to monitor our sip and iax2 trunks as well as monitoring the number of active calls.

Registered SIP Trunks:

Registered IAX2 Trunks:

Active Calls:

But we’d also like to put something together that could automate making a test call every 10 minutes and be notified if the call fails as well as call one of our own numbers and ensure that we can receive incoming calls as well and using something like DTMF ensure that we’re getting an accurate response. I can grep, awk, wc, etc. and do what I need to do to make that code acceptable by Zabbix, but I’m not familiar enough with Asterisk to put something together.

I’ve read about the originate and dial commands but am a bit confused and unable to successfully make a call to an outside number, any help/tips/tricks/advice would be greatly appreciated.


#2

I’ve made some progress and am now able to call from my extension out to my cell phone, but I have to answer the call on my extension in order for the call to ring my cellphone. Is there a way to get it to try to call my cellphone without ringing my extension? I’d rather not have to answer a test call every 10 minutes.

For anyone that’s curious, this is what I’ve got so far which was modified a bit from this source

[code]#!/bin/bash

DATE=date +%d%m%Y-%H%M
FILENAME="$DATE".call

echo “Channel: SIP/12345” >> /tmp/$FILENAME
echo “MaxRetries: 2” >> /tmp/$FILENAME
echo “RetryTime: 30” >> /tmp/$FILENAME
echo “Context: from-internal” >> /tmp/$FILENAME
echo “Extension: 1234567890” >> /tmp/$FILENAME
echo “Priority: 1” >> /tmp/$FILENAME
echo “Archive: Yes” >> /tmp/$FILENAME

chown asterisk:asterisk /tmp/$FILENAME
mv /tmp/$FILENAME /var/spool/asterisk/outgoing/[/code]


#3

Make the channel be the / string for the cellphone and run an application as the B side.

You can also make the Channel be Local/1234567890@from-internal but that is an overkill, which I’d have to use because I don’t know what the Dial parameters for 1234567890@from-internal are.,


#4

[quote=“david55”]Make the channel be the / string for the cellphone and run an application as the B side.

You can also make the Channel be Local/1234567890@from-internal but that is an overkill, which I’d have to use because I don’t know what the Dial parameters for 1234567890@from-internal are.,[/quote]

Thank you, that worked beautifully, do you have any hints for testing the incoming?

[code]#!/bin/bash

DATE=date +%d%m%Y-%H%M
FILENAME="$DATE".call

echo “Channel: Local/1234567890@from-internal” >> /tmp/$FILENAME

Change Number before putting into production.

echo “Application: Playback” >> /tmp/$FILENAME
echo “Data: hello-world” >> /tmp/$FILENAME
echo “MaxRetries: 2” >> /tmp/$FILENAME
echo “RetryTime: 30” >> /tmp/$FILENAME
echo “Priority: 1” >> /tmp/$FILENAME
echo “Archive: Yes” >> /tmp/$FILENAME
chown asterisk:asterisk /tmp/$FILENAME
mv /tmp/$FILENAME /var/spool/asterisk/outgoing/
sleep 45
cat /var/spool/asterisk/outgoing_done/$FILENAME |grep Status:|awk ‘{print $2}’> testcall.log
[/code]

This just puts “Success” if the call was succesful and “Expired” or “Failed” if there was a problem.