Linux Asterisk script for test call

Kerby82 picture Kerby82 · Apr 13, 2015 · Viewed 16.1k times · Source

I need to measure the MOS and quality of the VOIP service in a network. I want to create a script that simulates calls and then measure the networks metrics.

I'm using asterisk.

Do you have any suggestion about how to script and schedulate test calls with asterisk?

I would like to make calls of different duration maybe using some avi files.

Obviously I need to automate both outgoing call and automatic answer to that outgoing calls.

Answer

dougBTV picture dougBTV · Apr 14, 2015

I would suggest using Asterisk Call Files

Create a file name /tmp/example.call such as:

Channel: SIP/peerdevice/1234
Application: Playback
Data: silence/1&tt-weasels 

And then copy that file and move it into the asterisk outgoing spool, such as:

cp /tmp/example.call /tmp/example.call.new
mv /tmp/example.call.new /var/spool/asterisk/outgoing

You'll notice at the Asterisk CLI it will originate a new call.

You can make another asterisk box answer the call automatically by saying to answer it in the dialplan, e.g. If you have another device SIP/peerdevice, and you're dialing 1234 per my example, in your dialplan:

[somecontext]
exten => 1234,1,Answer()
same =>       n,Noop(Example call inbound)
same =>       n,Playback(hello-world)
same =>       n,Hangup()

And you could create multiple extensions to do what you like to vary the behavior of the call.