Friday, February 25, 2011

Stress testing Asterisk with Sipp

Firstly, I had problems with running sipp in client mode from Ubuntu 10.10. The UDP packets were leaving my machine, but never gettting to the remote machine. I have no idea why, but I suggest you build sipp from scrach (its pretty easy), and use that.

There is heaps of documentation on sipp's website, but it assumes you have a decent knowledge of sip, in which case you probably won't be reading this anyway.

For a start, you need to understand that sipp can run in a client and server mode. This means, it can act as caller, or a reciever of calls. Thus, in order for you to be able to record statistics, you need to setup your asterisk box so there is a loop; the client creates calls, which end calling the server. Both the client and server display statistics about the calls being made, and from that you can see how your box is handling it.

To setup asterisk, you need to edit the sip.conf and extensions.conf.

------------ sip.conf --------------

[sippuac]
type=friend
username=sippuac
host=
port=5060
context=default
dtmfmode=rfc2833
insecure=very
canreinvite=no
nat=yes

[sippuas]
type=friend
username=sippuas
host=
port=5061
context=default
dtmfmode=rfc2833
insecure=very
canreinvite=no
nat=yes
------------ sip.conf --------------
There are two extensions setup in this example, one is for client(sippuac), and one is outbound to the server(sippuas). The client will connect on the default sip port 5060 in this example, and the server connection will be made to 5061. I have disabled security in this example just to make things simple, as thats all the default senario can handle. You need to change the host for each to wherever each sipp client and server is running. You cannot set the host to dynamic, as asterisk needs to make the connection (I could be wrong here, but dynamic did not work for me).

Next is extensions.conf.
---------- extensions.conf ---------

[default]
exten=>testing,1,Dial(SIP/sippuas,20)
---------- extensions.conf ---------
In the default context I put an extension called "testing", which then calls the server. Reload asterisks using the cli, so all we have to do is setup sipp to call this extension, and listen using sippuas.

To run sipp in server mode, you need to specify something like this:

sipp -sn uas -p 5061

The -sn flag specifies a seneriao. UAS is a built in scenario, which just receives a call and hangs up. the -p flag is the UDP port that it will listen for incoming calls on (this port must match whats in sippuas).

To run sipp in client mode, you need to specify something like this:

sipp -sn uac 127.0.0.1 -s testing

The scenario uac now specifys a built in client scenario. 127.0.0.1 is the IP address of the asterisk box (Im running it from the asterisk server itself, but you don't need to), and -s testing specifies the extension to call. The default port is 5060 which we are using anyway.

So, hopefully now, you should see stats appear on your screen!

0 comments: