Tool:
SIPp is performance testing tool for SIP based protocol. It's open source and quite easy to start with.
Detailed documentation from SIPp: http://sipp.sourceforge.net/doc1.1/reference.htm
SIPp Installation
on SuSE Linux:
(This installation process should work with other linux flavors too)
Option1: Install SIPp standard using available SIPp RPM
package
Option2 (Preferred): Install SIPp from source
- Go to http://sipp.sourceforge.net/index.html
- Go to Download & then to Stable
- Browse SIPP folder
- Browse the latest SIPP version; You will see various installation files.
- Download sip.svn.tar.gz (source) file: preferably download at /opt/SIPp folder
- Unzip it #tar xvzf sipp.svn.tar.gz : Say it is unzipped in sipp.svn folder
Note: Before installing it, check
the dependencies. You can try to install without checking the dependencies.
It’s all up to you
- C++ compiler
- Curses or ncurses library (for graphics in text mode)
- OpenSSL , OpenSSL-devel : For authentication and TLS support
- Libpcap, libpcap-devel (don’t confuse it with libcap-devel), libnet : For pcap play support
(you might have to install
libnet-devel, if you run across an error while installing SIPp)
- Go to sip.svn folder where you extracted the tar file.
Application:
Test Scenario:
SIPp will make test calls to Asterisk. Asterisk will answer
the call and play an audio file/MOH back to the SIPp
Step1:Asterisk server configuration to allow calls from SIPp
- Write an appropriate dialplan to handle calls from SIPp. Dialplan for Asterisk resides at /etc/asterisk/extensions.conf
Let’s configure extension 44444 in
our dialplan to play 30 seconds audio file and extension 55555 to play music on
hold.
[for_everyone]
exten => 44444,1,Answer
same => n,Verbose(1,### PERFORMING
SIPP TEST #######)
same => n,SetMusicOnHold(default)
same => n,WaitMusicOnHold(30)
same => n,Hangup
exten => 55555,1,Answer
same => n,Verbose(1,### PERFORMING
SIPP TEST #######)
same =>
n,Background(en/audiofile-20-sec)
same => n,Hangup
- In sip.conf define the host of SIPp as a peer OR you can simply define default context for any unknown peers/users. In my case it is [for_everyone]
- Increase the number of file descriptors (FDs) ie. “Max number of open files” using ulimit command to allow asterisk to handle more than 200 concurrent calls
#ulimit –n
(default value is 1024)
#ulimit –n 20000
#ulimit –n
20000
(Warning! This is a temporary way to
increase the number of FDs and it is local to individual session. ulimit command
only affects the current shell environment.)
To increase FDs
permanently, go to /etc/security/limits.conf
root soft nofile
20000
root hard nofile 25000
Reboot your system and
check the limits
#ulimit –n It returns SOFT limit
#ulimit –n –H It return HARD limit
- You also have to use ‘ulimit –n <number of FDs>’ in asterisk startup script
#vi /etc/init.d/asterisk
-------
---------
ulimit –n 20000
/usr/sbin/asterisk
It is always
a good idea to check if your asterisk process is really using the ulimit
specified by you or not. You can check that by looking into the process itself.
Check the field ‘Max Open Files’.
#cat /proc/`pidof
asterisk`/limits
Note: `pidof asterisk` returns PID(Process ID) of
asterisk
Step2: Stress Test using SIPp
- Go to the installation folder: In my case /opt/SIPp/sipp.svn
- Run an appropriate command that meets your test requirement
- SIPp command line help
#./sipp –h |less
Handy
switches of SIPp command line:
-sn :
Scenario e.g uac, uas
-sf :
Open customized scenario; usually XML file
-d :
Duration of each call (in milliseconds)
-s :
Extension to dial
-l :
Call limit (Maximum concurrent calls)
-r :
Calling rate (calls/sec)
-trace_err : Enable error
tracing
-error_file filename :
Dump error in specified file
- Run SIPp as a UAC to make a stress test on SIP/Asterisk server with IP 192.168.1.10. Set calling rate of 10 calls/sec with call limit 100. Also enable error trace and log the error
#./sipp -sn uac -d 20000 -s 44444 asteriskserverIPaddres -l 100 -r 10 -trace_err
-error_file sipperror
Note: If you perform packet
capture on SIP/Asterisk server, you will not see RTP traffic. It’s because
Asterisk doesn’t send one way RTP traffic. Asterisk RTP stack requires
bidirectional traffic to send traffic back. (Some people say that there is a
patch for Asterisk to support asynchronous RTP. But I didn’t bother to look for
it as SIPp supports RTP echo and PCAP play. You can use either one for
establishing two ways RTP. I am going to use PCAP play)
- Run SIPp as a UAC to make a stress test on SIP/Asterisk server with IP 192.168.1.10. Set calling rate of 10 calls/sec with call limit 100. Also enable error trace and log the error. Please make sure that RTP traffic is flowing.
For RTP traffic, I am going to use
uac_pcap.xml scenario file provided in SIPp documentation.
I have downloaded the xml file at
/opt/SIPp/SIPpscenario
#./sipp -sf /opt/SIPp/SIPpscenario uac_pcap.xml -d 20000
-s 44444 asteriskserverIPaddress -l 100 -r 10
-trace_err -error_file sipperror
Good luck!
Great write up, thanks for the How-To.
ReplyDeleteI plan to use this test in various virtual environments to test the viability of dahdi timing for MeetMe conferences particularly for Vicidial VMs in OpenVZ or KVM VMs.
Thank you Vincent. Good Luck with your test!
DeleteHello :) Your blog looks like a wealth of information! I am definitely bookmarking ;) I'm trying to set up a SIPp test for OpenSIPs -> Asterisk. Have you ever come across a situation where Asterisk sends an unexpected BYE to the UAS? I can't see a reason for it in the scenarios or log files.
ReplyDeleteThanks Niki
ReplyDeleteI think Asterisk sends an unexpected BYE if it doesn't receive RTP stream after 200 0K. I hope this answers your question.
I am seeing the same thing in SIPp.
Delete[Sep 16 00:08:47] WARNING[27987][C-00001073]: pbx.c:2903 pbx_extension_helper: No application 'SetMusicOnHold' for extension (for_everyone, 44444, 3)
== Spawn extension (for_everyone, 44444, 3) exited non-zero on 'SIP/127.0.1.1-00001072'
I assume Music on Hold module is not loading
the module res_musiconhold.so is loaded.
DeleteI see now. Your gude is very outdated, even though from 2013:
Delete"New in Asterisk 1.6
SetMusicOnHold is now deprecated. You should use Set(CHANNEL(musicclass)=...) instead."
Hi,
ReplyDeleteIn case, I've 2 Sipp server and 1 PBX server (like Asterisk). If I want to test performance for PBX,
which command line will I execute in Sipp server.
One more question, because your Sipp and Asterisk are deployed into PC, so almost of command line which you use to test are "#./sipp -sn uac ...", the question is for you :
whether we can run command line, like "#./sipp -sn uas " in your case, and in case ?
Thanks,
To stress test PBX, you need clients/call initiators. SIPp is flexible enough and you can run it as client to run load test on your PBX. In my scenario, SIPp runs on different server and PBX runs on different server.
DeleteYou want to run SIPp in server mode(uas) only when you want to test phones(clients) or if you want to run PBX in client mode.
Hi,
ReplyDeleteyou have done great work.I am working final year voip project and for performance testing started using sipp.but it doesn't work..only calls are generated and zero calls are completed i.e 200 (o.k)=0.please help and reply
I know it is kind of late to respond. There could be various reasons behind not getting 200OK. For clear picture, I will need the call flow diagram or packet capture on your asterisk or SIPp server.You can use utilities like Wireshark, tcpdump, etc to perform packet capture.
DeleteCan you post examples of SIPp being a peer, or a default context?
ReplyDeleteThanks
Hi Trent...so is there any Work around you found for your query...as i'm also stuck at this point.
DeleteNot able to Implement below part...kindly suggest
ReplyDelete"In sip.conf define the host of SIPp as a peer OR you can simply define default context for any unknown peers/users. In my case it is [for_everyone]"