Wednesday, October 19, 2011

Asterisk Stress testing (with Media) Using SIPp


Today I was required to stress test a client setup with media.
Signalling only can make us feel that our server is capable of handle call volume greater than even 2000 calls per asterisk server. This may not be the case when Media is involved in the call.

Using SIPp with some media file was causing me way too much troubling setting up. So what I did is, use Asterisk Servers as source for Media stream and trigger Bulk of Calls using SIPp. This Asterisk server then start a new call to Client's SBC.

The Dialplan of the originator Asterisk Servers was written such that whenever the call is answered by remote end it transfer the call flow control to another macro "play-media" where I waited for some time and then SendDTMF (required by the remote end) as Extension where I need call to be forwarded and then Start Playing MusicOnHold there.

This simple setup enabled me to load-test the deployment within minutes.

Following are the configurations and steps I took on Originator Asterisk Servers.

1- Install SIPp

#cd /usr/src
#wget http://sourceforge.net/projects/sipp/files/sipp/3.2/sipp.svn.tar.gz
#tar zxvf sipp.svn.tar.gz
#cd sipp.svn
#make

This installed SIPP on my machine. then I made its link to sbin directory so sipp be used anywhere from the shell.

#ln -s /usr/src/sipp.svn/sipp /usr/sbin

2- Add sipp user in sip.conf

#vim /etc/asterisk/sip.conf
Add these
[sipp]
type=friend
context=sipp
host=dynamic
port=7000
user=sipp
canreinvite=no
disallow=all
allow=ulaw

[CLIENTSBCPEER]
host=XX.XX.XX.XX
type=friend
port=5060
disallow=all
allow=alaw
allow=ulaw
allow=g729
dtmfmode=info
context=incoming
nat=yes
insecure=port,invite
qualify=yes
canreinvite=no

Save and quit.

2- Add Dialplan for use with sipp.

#vim /etc/asterisk/extensions.conf

Add these lines.
[sipp]
;include => default

exten => service,1,SET(count=1)
same => n,SET(CALLEER=${RAND(0,9999)})
same => n,SET(CALLERID(num)=$[4130000000 + ${CALLEER}])
same => n,DIAL(SIP/5609871234@CLIENTSBCPEER,,M(play-media))
same => n,hangup()

[macro-play-media]
exten => s,1,Wait(2)
same => n,SendDTMF(879123455232#) ; Destination Extension with indefinite MusicOnHold
same => n,Musiconhold(); Transmit Music from my side to remote server/extension
same => n,Hangup()

Save and exit to linux console.

3- Start sending Calls from sipps - I know its a long command

#sipp -pause_msg_ign -trace_err -users 1 -t u1 -watchdog_minor_maxtriggers 12000 -watchdog_major_maxtriggers 1000 -i [current.asterisk.server.ip] -p 7000 -aa -default_behaviors pingreply -sleep 1 -mp 10000 [current.asterisk.server.ip]:[asterisk_sip_port]


Finally you'll see calls starting in Originator Asterisk console and soon will be reaching destination machine.
Make sure your destination machine knows your Call attack is coming and the destination where you need calls be terminating could be an infinite MusiconHold() command so all the calls stay established while you keep in increasing the call volume.


1 comment:

  1. is there any way to make SIPp media port different for all calls.

    ReplyDelete