SIPP UAC and asterisk

From open-voip.org

Jump to: navigation, search

Let's make our first setup to test basic flow with asterisk. We need two servers:

  • SIPP client (UAC) to genrate the calls (192.168.0.148 in this example)
  • Asterisk server. We will test the performance of this server. (192.168.0.149 in this example)

Contents

Configure the asterisk server

In order to start we will use the Asterisk Simple example. make sure you have a working asterisk with 2 users (1000,2000) and no authentication. Asterisk should answer, wait 1 second and disconnect the call.

Let's create the users first, replace the sip.conf with:

[general]
context=default                 ; Default context for incoming calls
bindport=5060                   ; bindport is the local UDP port that Asterisk will listen on
bindaddr=0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)
;
disallow=all                    ; First disallow all codecs
allow=gsm                       ; Allow default codec
allow=ulaw                      ; 
;
; *** configure the users: ***
;
[1000]
secret=2000
context=from-sip                ; the context of this setup
type=friend                     ; Can make inbound and outbound calls
callerid="User-A"               ; Set your Caller-id
host=dynamic                    ; This device needs to register
nat=yes                         ; user is behind a NAT router
;
[2000]
secret=2000
context=from-sip                ; the context of this setup
type=friend                     ; Can make inbound and outbound calls
callerid="User-B"               ; Set your Caller-id
host=dynamic                    ; This device needs to register
nat=yes                         ; user is behind a NAT router

Make dial plan that asnswers the call, wait one sec and disconnect.Replace extensions.conf with:

[general]
[globals]
;
[from-sip]
exten => _X.,1,Answer()           ; Answer the call
exten => _X.,2,wait(1)
exten => _X.,3,hangup()


Configure the Sipp xml file for authenticated registration

In this example we will makte XML senario that sends authenticated registration to the asterisk we configured above:

  • (do no not copy-paste the code below but downlod from here, save as /opt/reg_uac.xml )
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<--                                                                  -->
<--                 Sipp Rgistration scenario.                       -->
<--                                                                  -->
<scenario name="Basic Sipstone UAC">
 <--               *********************************                  -->
 <--               ***** Send Register packet ******                  -->
 <--               *********************************                  -->
 <send retrans="500">
   <![CDATA[

     REGISTER sip:[remote_ip] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port]
     To: <sip:[service]@sip.com:[remote_port]>
     From: <sip:[service]@[remote_ip]:[remote_port]>
     Contact: <sip:[service]@[local_ip]:[local_port]>;transport=[transport]
     Expires: 300
     Call-ID: [call_id]
     CSeq: 2 REGISTER
     Content-Length: 0

   ]]>
 </send>
<--               ********************************************       -->
<--               ***** Getting 100 message is optional ******       -->
<--               ********************************************       -->
 <recv response="100"
       optional="true">
<--               ***** Must get 401. auth="true" to take the challenge into account ****** -->
 </recv>
   <recv response="401" auth="true">
 </recv>
<--               *********************       -->
<--               ***** Send Ack ******       -->
<--               *********************       -->
 <send>
   <![CDATA[

     ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port]
     From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
     To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
     Call-ID: [call_id]
     CSeq: 1 ACK
     Contact: sip:[service]@[local_ip]:[local_port]
     Max-Forwards: 70
     Subject: Performance Test
     Content-Length: 0

   ]]>
 </send>
<-- **********************************************************************************    -->
<-- ***** Send Registration with the authentication, note the user and password ******    -->
<-- **********************************************************************************    -->
 <send retrans="500">
   <![CDATA[

     REGISTER sip:[remote_ip] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port]
     To: <sip:[service]@sip.com:[remote_port]>
     From: <sip:[service]@[remote_ip]:[remote_port]>
     Contact: <sip:[service]@[local_ip]:[local_port]>;transport=[transport]
     [authentication username=1000 password=1000]
     Expires: 300
     Call-ID: [call_id]
     CSeq: 2 REGISTER
     Content-Length: 0

   ]]>
 </send>
<--               ********************************************       -->
<--               ***** Getting 100 message is optional ******       -->
<--               ********************************************       -->
 <recv response="100"
       optional="true">
 </recv>
<--               ******************************                     -->
<--               ***** Should get 200 Ok ******                     -->
<--               ******************************                     -->
 <recv response="200" rtd="true">
 </recv>
</scenario>

Runing the SipP XML registration UAC scenario

in order to test the scenario use the following line:

 ./sipp -s 1000 -ap 1000 -r 1 192.168.0.149:5060 -sf /opt/register_uac.xml
 -s 1000            - use 1000 user
 -ap 1000           - use 1000 password
 -r 1               - one flow per second
 192.168.0.149:5060 - The asterisk IP:port (UAS)
 -sf /opt/sipp/sipp-3.0.src/uac_register.xml - The XMl flow

Configure the Sipp xml file for authenticated outgoind call

now that we are registered, let's add outbound call.

  • (do no not copy-paste the code below but downlod from here, save as /opt/inv_uac.xml )
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<--                                                                    -->
<--                 Sipp authenticated invit scenario.                 -->
<--                                                                    -->
<scenario name="Basic Sipstone UAC">
 <send retrans="500">
   <![CDATA[

     INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
     From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
     To: sut <sip:[service]@[remote_ip]:[remote_port]>
     Call-ID: [call_id]
     CSeq: 1 INVITE
     Contact: sip:[service]@[local_ip]:[local_port]
     Max-Forwards: 70
     Subject: Performance Test
     Content-Type: application/sdp
     Content-Length: [len]

     v=0
     o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
     s=-
     c=IN IP[media_ip_type] [media_ip]
     t=0 0
     m=audio [media_port] RTP/AVP 0
     a=rtpmap:0 PCMU/8000

   ]]>
 </send>

 <recv response="100"
       optional="true">
 </recv>
   <recv response="401" auth="true">
 </recv>

 <send>
   <![CDATA[

     ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port]
     From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
     To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
     Call-ID: [call_id]
     CSeq: 1 ACK
     Contact: sip:[service]@[local_ip]:[local_port]
     Max-Forwards: 70
     Subject: Performance Test
     Content-Length: 0

   ]]>
 </send>

 <send retrans="500">
   <![CDATA[

     INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port]
     From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
     To: sut <sip:[service]@[remote_ip]:[remote_port]>
     Call-ID: [call_id]
     CSeq: 2 INVITE
     Contact: sip:[service]@[local_ip]:[local_port]
     [authentication ]
     Max-Forwards: 70
     Subject: Performance Test
     Content-Type: application/sdp
     Content-Length: [len]

     v=0
     o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
     s=-
     t=0 0
     c=IN IP[media_ip_type] [media_ip]
     m=audio [media_port] RTP/AVP 0
     a=rtpmap:0 PCMU/8000

   ]]>
 </send>

 <recv response="100"
       optional="true">
 </recv>

 <recv response="180" optional="true">
 </recv>

 <recv response="183" optional="true">
 </recv>
 <recv response="200" rtd="true">
 </recv>

 <-- Packet lost can be simulated in any send/recv message by         -->
 <-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
 <send>
   <![CDATA[

     ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
     From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
     To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
     Call-ID: [call_id]
     CSeq: 1 ACK
     Contact: sip:sipp@[local_ip]:[local_port]
     Max-Forwards: 70
     Subject: Performance Test
     Content-Length: 0

   ]]>
 </send>

 <-- This delay can be customized by the -d command-line option       -->
 <-- or by adding a 'milliseconds = "value"' option here.             -->
 <pause/>

 <-- The 'crlf' option inserts a blank line in the statistics report. -->
 <send retrans="500">
   <![CDATA[

     BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
     Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
     From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
     To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
     Call-ID: [call_id]
     CSeq: 2 BYE
     Contact: sip:sipp@[local_ip]:[local_port]
     Max-Forwards: 70
     Subject: Performance Test
     Content-Length: 0

   ]]>
 </send>

 <recv response="200" crlf="true">
 </recv>

 <-- definition of the response time repartition table (unit is ms)   -->
 <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>

 <-- definition of the call length repartition table (unit is ms)     -->
 <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>

</scenario>

Runing the XML authenticated outbound call UAC scenario

in order to test the scenario use the following line:

 ./sipp -s 1000 -ap 1000 -r 1 192.168.0.149:5060 -sf /opt/inv_uac.xml -i 192.168.0.147 -m 1 -d 10000
 -s 1000            - use 1000 user
 -ap 1000           - use 1000 password
 -r 1               - one flow per second
 192.168.0.149:5060 - The asterisk IP:port (UAS)
 -sf /opt/inv_uac.xml  - The XMl flow
 -i 192.168.0.147   - the source IP
 -m 1               - exit after one call 
 -d 10000           - at the xml there is "pause" command brfore sending the "BYE". set to 10 sec now


Screenshuts

File:sipp_screen.JPG

Personal tools