Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Asterisk script for test call

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.

like image 875
Kerby82 Avatar asked Apr 13 '15 15:04

Kerby82


2 Answers

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.

like image 194
dougBTV Avatar answered Nov 02 '22 11:11

dougBTV


You can also use the originate command, such as:

ast*CLI> channel originate SIP/755XXXXX@sip-outbound extension s@context_name

Which can also be issued from a shell as:

[user@host]$ asterisk -rx 'channel originate SIP/755XXXXX@sip-outbound extension s@context_name'

SIP/755XXXXX@sip-outbound = Is what device to use when dialing out so this could be IAX.,SIP,DAHDI following a slash and phone number

extension = Is required for the command. You may also use application followed by an Asterisk application, a la channel originate SIP/device/1234 application playback tt-monkeys which would playback a sound file.

s = This is what extension to send to within the context specified below

@context_name = Which context to send to in extensions.conf

More information available in this Asterisk guide

like image 44
Vivek Raj Avatar answered Nov 02 '22 09:11

Vivek Raj