SIPp: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
You can set it to pound away at a remote SIP server to see how it performs.
You can set it to pound away at a remote SIP server to see how it performs.


Installed from apt package 'sip-tester' onto Bellman.
== How to install ==


Hit the server with one request and repeat every 1000 milliseconds.
Set up a Debian server and install the 'sip-tester' package. I used [[Bellman]].
Use 192.168.1.2 as the source IP address (bellman) and send from port 5123.


sipp -sn uac -r 1 -rp 1000 cds.wildsong.biz:5060 -p 5123 -i 192.168.1.2
== Initial tests ==


On the asterisk console,
=== Basic ommand line ===
 
This command will hit the server with one request (-r 1) at a time and repeat every second (-rp 1000).
Use 192.168.1.2 as the source IP address (bellman).
 
sipp -sn uac -r 1 -rp 1000 cds.wildsong.biz:5060 -i 192.168.1.2
 
=== Asterisk test ===
 
On the asterisk console, so I can see what happens, I turn on debug.


  core set debug 10
  core set debug 10
  sip set debug on
  sip set debug on


Then I can see
Then I can see requests coming in,


  Sending to 192.168.1.2:5123 (no NAT)
  Sending to 192.168.1.2:5123 (no NAT)
Line 35: Line 43:
  Content-Length: 0
  Content-Length: 0


So I add a peer called 'sipp' in sip.conf:
=== Add peer to sip.conf ===
 
It is not authorized,
so I add a peer called 'sipp' in sip.conf:


  [sipp]
  [sipp]
Line 46: Line 57:
  allow=ulaw
  allow=ulaw


Progress: now I get this:
Making progress: now I get this error:


  SIP/2.0 404 Not Found
  SIP/2.0 404 Not Found
Line 74: Line 85:
  Subject: Performance Test
  Subject: Performance Test
  Content-Length: 0
  Content-Length: 0
=== Add extension to asterisk ===


So I add the context and the extension to 'extensions.conf' and do 'dialplan reload'.
So I add the context and the extension to 'extensions.conf' and do 'dialplan reload'.
Line 108: Line 121:
     -- Executing [service@testing:2] Answer("SIP/sipp-0000029b", "") in new stack
     -- Executing [service@testing:2] Answer("SIP/sipp-0000029b", "") in new stack
   == Spawn extension (testing, service, 2) exited non-zero on 'SIP/sipp-0000029b'
   == Spawn extension (testing, service, 2) exited non-zero on 'SIP/sipp-0000029b'
== More settings and tests ==
=== Stop test after 100 calls ===
sipp -sn uac -r 5 -rp 500 cds.wildsong.biz:5060 -i 192.168.1.2 -m 100
=== Send audio over a channel ===
See http://lists.digium.com/pipermail/asterisk-dev/2006-June/021166.html
Download the sources. Put a copy of the 'pcap' folder in the local directory. Run this:
sudo sipp -trace_err -sn uac_pcap -r 1 -rp 10000 cds.wildsong.biz:5060 -i 192.168.1.2 -m 1 -d 50000
This will send the pcap/g711a.pcap file over the RTP channel.
You can capture other pcap files using tcpdump. For example set up a call and
use tcpdump to record some audio:
tcpdump -T rtp -vvv host 192.168.1.123 -w g711u.pcap
You can tell sipp to play other pcap files by creating a new xml file,
first make a copy of the existing one:
sipp -sd uac_pcap > my_uac.xml
Edit it to put a reference to your own pcap file, then use it to play the file.
I had to change the RTP payload type from ALAW to ULAW, so I edited the rtpmap line to use type '0' and PCMU instead of '8 PCMA'.
The list of payload type codes is here: https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml
sudo sipp -sf my_uac.xml -r 1 -rp 10000 cds.wildsong.biz:5060 -i 192.168.1.2 -m 1 -d 50000
== What can I do with it? ==
=== Load test ===
Of course I'd like to get a sense of what a given hardware set up can do by load testing it.
=== Functionality test ===
I'd like to be able to build a suite of tests that I can run after I make any change to an Asterisk server,
to confirm the server is still doing everything it needs to do.
I think SIPp might play a big role in this.
=== Reachability tests ===
I'd like to be able to do
* LAN test
* VPN test (no NAT)
* WAN test (via NAT)

Latest revision as of 02:26, 20 June 2016

SIPp SIP testing program.

You can set it to pound away at a remote SIP server to see how it performs.

How to install

Set up a Debian server and install the 'sip-tester' package. I used Bellman.

Initial tests

Basic ommand line

This command will hit the server with one request (-r 1) at a time and repeat every second (-rp 1000). Use 192.168.1.2 as the source IP address (bellman).

sipp -sn uac -r 1 -rp 1000 cds.wildsong.biz:5060 -i 192.168.1.2

Asterisk test

On the asterisk console, so I can see what happens, I turn on debug.

core set debug 10
sip set debug on

Then I can see requests coming in,

Sending to 192.168.1.2:5123 (no NAT)
Sending to 192.168.1.2:5123 (no NAT)
Using INVITE request as basis request - [email protected]
No matching peer for 'sipp' from '192.168.1.2:5123'

<--- Reliably Transmitting (no NAT) to 192.168.1.2:5123 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.2:5123;branch=z9hG4bK-9441-25-0;received=192.168.1.2
From: sipp <sip:[email protected]:5123>;tag=9441SIPpTag0025
To: sut <sip:[email protected]:5060>;tag=as58ab0f52
Call-ID: [email protected]
CSeq: 1 INVITE
Server: Asterisk PBX 13.9.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="14229989"
Content-Length: 0

Add peer to sip.conf

It is not authorized, so I add a peer called 'sipp' in sip.conf:

[sipp]
type=friend
context=testing
host=192.168.1.2
user=sipp
canreinvite=no
disallow=all
allow=ulaw

Making progress: now I get this error:

SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.1.2:5123;branch=z9hG4bK-9453-11-0;received=192.168.1.2
From: sipp <sip:[email protected]:5123>;tag=9453SIPpTag0011
To: sut <sip:[email protected]:5060>;tag=as3d8a6110
Call-ID: [email protected]
CSeq: 1 INVITE
Server: Asterisk PBX 13.9.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------>
[2016-06-19 12:18:27] NOTICE[25269][C-000000f1]: chan_sip.c:26219 handle_request_invite: Call from 'sipp' (192.168.1.2:5123) to extension 'service' rejected because extension not found in context 'testing'.
Scheduling destruction of SIP dialog '[email protected]' in 32000 ms (Method: INVITE)

<--- SIP read from UDP:192.168.1.2:5123 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.2:5123;branch=z9hG4bK-9453-11-0;received=192.168.1.2
From: sipp <sip:[email protected]:5123>;tag=9453SIPpTag0011
To: sut <sip:[email protected]:5060>;tag=as3d8a6110
Call-ID: [email protected]
CSeq: 1 ACK
Contact: <sip:[email protected]:5123;transport=UDP>
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0

Add extension to asterisk

So I add the context and the extension to 'extensions.conf' and do 'dialplan reload'.

[testing]
exten => service,1,Verbose(1,SIP test)
 same => n,Answer()
 same => n,Playback(SIP_Test_Success)
 same => n,Hangup()

And it works! I turn off SIP debug and I can see this in the asterisk console.

sip set debug off
== Using SIP RTP CoS mark 5
   -- Executing [service@testing:1] Verbose("SIP/sipp-00000298", "1,SIP test") in new stack
SIP test
   -- Executing [service@testing:2] Answer("SIP/sipp-00000298", "") in new stack
 == Spawn extension (testing, service, 2) exited non-zero on 'SIP/sipp-00000298'
 == Using SIP RTP CoS mark 5
   -- Executing [service@testing:1] Verbose("SIP/sipp-00000299", "1,SIP test") in new stack
SIP test
   -- Executing [service@testing:2] Answer("SIP/sipp-00000299", "") in new stack
 == Spawn extension (testing, service, 2) exited non-zero on 'SIP/sipp-00000299'
 == Using SIP RTP CoS mark 5
   -- Executing [service@testing:1] Verbose("SIP/sipp-0000029a", "1,SIP test") in new stack
SIP test
   -- Executing [service@testing:2] Answer("SIP/sipp-0000029a", "") in new stack
 == Spawn extension (testing, service, 2) exited non-zero on 'SIP/sipp-0000029a'
 == Using SIP RTP CoS mark 5
   -- Executing [service@testing:1] Verbose("SIP/sipp-0000029b", "1,SIP test") in new stack
SIP test
   -- Executing [service@testing:2] Answer("SIP/sipp-0000029b", "") in new stack
 == Spawn extension (testing, service, 2) exited non-zero on 'SIP/sipp-0000029b'

More settings and tests

Stop test after 100 calls

sipp -sn uac -r 5 -rp 500 cds.wildsong.biz:5060 -i 192.168.1.2 -m 100

Send audio over a channel

See http://lists.digium.com/pipermail/asterisk-dev/2006-June/021166.html

Download the sources. Put a copy of the 'pcap' folder in the local directory. Run this:

sudo sipp -trace_err -sn uac_pcap -r 1 -rp 10000 cds.wildsong.biz:5060 -i 192.168.1.2 -m 1 -d 50000

This will send the pcap/g711a.pcap file over the RTP channel. You can capture other pcap files using tcpdump. For example set up a call and use tcpdump to record some audio:

tcpdump -T rtp -vvv host 192.168.1.123 -w g711u.pcap

You can tell sipp to play other pcap files by creating a new xml file, first make a copy of the existing one:

sipp -sd uac_pcap > my_uac.xml

Edit it to put a reference to your own pcap file, then use it to play the file. I had to change the RTP payload type from ALAW to ULAW, so I edited the rtpmap line to use type '0' and PCMU instead of '8 PCMA'. The list of payload type codes is here: https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml

sudo sipp -sf my_uac.xml -r 1 -rp 10000 cds.wildsong.biz:5060 -i 192.168.1.2 -m 1 -d 50000

What can I do with it?

Load test

Of course I'd like to get a sense of what a given hardware set up can do by load testing it.

Functionality test

I'd like to be able to build a suite of tests that I can run after I make any change to an Asterisk server, to confirm the server is still doing everything it needs to do.

I think SIPp might play a big role in this.

Reachability tests

I'd like to be able to do

* LAN test
* VPN test (no NAT)
* WAN test (via NAT)