You are on page 1of 21

Ti liu hng dn ci t v s dng SIPp

Thc hin performance testing, load testing, stress test.


I. Ci t SIPp :
ci th vin v sipp
apt-get install openssl libpcap-dev libnet-dev libsctp-dev
lksctp-tools
cd /usr/local/src/
wget https://github.com/SIPp/sipp/archive/v3.4.1.tar.gz
tar -xvzf v3.4.1.tar.gz
cd sipp-3.4.1/
./configure --with-pcap --with-sctp --with-openssl
Make all
Make install

II. Hng dn s dng SIPp :


Chc nng Sipp :
Sipp c dng to ra mt hay nhiu cuc gi SIP n mt h thng . Cc lnh ca sip
c thc hin bng cc dng lnh trn command line, cc kch bn c lu trong file
xml. Cc kch bn ca sip c th chia ra hai phn : UAC ( user agent client : bn gi ) v
UAS ( user agent server : bn nhn ).
Kch bn mc nh ca UAC :
SIPp UAC
Remote
|(1) INVITE
|
|------------------>|
|(2) 100 (optional) |
|<------------------|
|(3) 180 (optional) |
|<------------------|
|(4) 200
|
|<------------------|
|(5) ACK
|
|------------------>|
|
|
|(6) PAUSE
|
|
|
|(7) BYE
|
|------------------>|
|(8) 200
|
|<------------------|
Test th bng cu lnh: ./sipp -sn uac 127.0.0.1

Kch bn mc nh ca UAC c media ( RTP ) :


SIPp UAC
Remote
|(1) INVITE
|
|------------------>|
|(2) 100 (optional) |
|<------------------|
|(3) 180 (optional) |
|<------------------|
|(4) 200
|
|<------------------|
|(5) ACK
|
|------------------>|
|
|
|(6) RTP send (8s) |

|==================>|
|
|
|(7) RFC2833 DIGIT 1|
|==================>|
|
|
|(8) BYE
|
|------------------>|
|(9) 200
|
|<------------------|

Kch bn mc nh ca UAS :
Remote
SIPp UAS
|(1) INVITE
|
|------------------>|
|(2) 180
|
|<------------------|
|(3) 200
|
|<------------------|
|(4) ACK
|
|------------------>|
|
|
|(5) PAUSE
|
|
|
|(6) BYE
|
|------------------>|
|(7) 200
|
|<------------------|

Test th bng cu lnh : ./sipp -sn uas


iu khin Sipp :

+ tng 1 ln, * tng 10 ln


Gim tc cuc gi : - gim 1 ln, / gim 10 ln
Vo ch command : C
Thot sip : q thot sau khi kt thc hoc nhp s giy thot lun, Q thot ngay lp tc
Ghi mn hnh ra file log : S
Tm dng : P
Tng tc cuc gi :

Thay i mn hnh hin th :

1-9

Cc cu lnh s dng trong ch command :


Dump tasks : thng k cc cuc gi ang hot ng ra file error log
set hide <true|false> : n hin cc gi tr trong XML
set index <true|false> : n hin s th t qu trnh test

Cc tham s s dng trong cu lnh sip :


Tham s v kch bn :
-sf : s dng mt kch bn xml (phi truy cp vo ng dn cha file xml thc hin )
-sn : s dng cc kch bn mc nh ( UAC, UAS )
Tham s v IP, Port, Protocol :
-t : phng thc truyn
-i : local IP address cho contact:, Via:, From: header ( mc nh l a ch IP ca
my )
-p : local port
-max_socket : s lng socket ti a cho kt ni
-rsa :
-bg : chy ngm sip
-buff_size
-lost : s lng gi tin b mt
-d : thi gian cuc gi ( tnh theo ms )
-inf : thm cc tham s t file csv
Tham s v RTP :

-mi : local media IP address


-rtp_echo : bt RTP echo
-mb : RTP echo buffer size
-mp : local RTP echo port
-r : tc cuc gi ( mc nh trn 1 giy )
-rp : thi gian tnh cho tc cuc gi
-l : s lng cuc gi ti a
-recv_timeout : thi gian bn tin n
-trace_msg : log bn tin messages
-trace_err : log bn tin li
-trace_screen : log thng tin hin trn mn hnh
-trace_counts : m s lng bn tin ra file csv
-trace_error_codes : log SIP response codes of unexpected messages
-trace_calldebug : log thng tin v aborted calls
-trace_rtt : log thi gian p ng

III. Kch bn TEST

SIPp UAC <------------>SIP proxy <-------------->SIPp UAS


Yu cu:
-

1 User agent lm client pha gi.


1 User agent lm server pha b gi.
1 Sip proxy server x l cc bn tin sip.
Cc Scenario file chy trn cc UAC,UAS test cc trng hp c th.
Cc username/password c khai bo trn SIP server
Topology phi c thng, gia cc UA vi SIPserver

Kch bn 1: UAC gi bn tin REGISTER n SIP SERVER

M t: Trn UAC chy kch bn file REGISTER_client.xml v s dng cc tham s


trong file REGISTER_client.csv ng k ti SIP SERVER

Trn UAC:
Bc 1:
-

Di chuyn n th mc SIPp v load cc file kch bn:

cd /usr/local/src/sipp-3.4.1/
./sipp 10.84.8.45 -sf REGISTER_client.xml -inf REGISTER_client.csv -m 10 -l 1 -r 1

Trong :
./sip : l cu lnh chy SIPp test tool
10.84.8.45 : l sip server ip address
-sf REGISTER_client.xml : chy file kch bn xml
-inf REGISTER_client.csv : load cc gi tr trong file csv vo file xml
-m ; -l ; -r : l cc behavior options dng iu khin cuc gi
Options:
- C th thm cc trng sau:
- Trace_msg trace_err
to ra cc file log sau mi ln thc hin lnh SIPp

Bc 2: Kt qu: Scenario Screen ----- [1-9] to change screen

Kch bn 2: UAC gi bn tin REGISTER v INVITE n SIP SERVER


TRN UAC
SIPp UAC
Remote
|(1) REGISTER
|
|------------------>|
|(2) 100 (optional) |
|<------------------|
|(3) 401
|
|<------------------|
|(4) REGISTER
|
|------------------>|
|(5) 100
|
|<------------------|
|(6) INVITE
|
|------------------>|
|(7) 100 (optional) |
|<------------------|
|(8) 407
|
|<------------------|
|(9) ACK
|
|------------------>|
|(10)INVITE
|
|------------------>|
|(8) 100
|
|<------------------|

Bc 1: chy file xml v load file csv


./sipp 10.84.8.45 -sf REGISTER_INVITE_client.xml -inf REGISTER_INVITE_client.csv -m 10 -l 1 -r 1

Bc 2: kt qu

Kch bn 3: UAC thc hin cuc gi n UAS

Bc 1: thc hin 1 cuc gi hon chnh c MEDIA


./sipp 10.84.8.45 -sf REGISTER_INVITE_CALL.xml -inf REGISTER_REGISTER_CALL.csv -m 100 -l 1 -r 2

Bc 2: Kt qu

File: REGISTER_client.xml
<?xml version="1.0" encoding="ISO-8859-2" ?>
<!-- Use with CSV file struct like: 3000;192.168.1.106;[authentication username=3000 password=3000];
(user part of uri, server address, auth tag in each line)
-->
<scenario name="register_client">
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 10
Expires: 120
User-Agent: SIPp/Win32
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>
<recv response="401" auth="true">
</recv>
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 10
Expires: 120
User-Agent: SIPp/Win32
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>

<recv response="200">
</recv>
<!-- response time repartition table (ms) -->
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<!-- call length repartition table (ms) -->
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>

File: REGISTER_client.csv
SEQUENTIAL
1112;10.84.8.45;[authentication username=1112 password=test];
1113;10.84.8.45;[authentication username=1113 password=test];

File: REGISTER_INVITE_client.xml
<?xml version="1.0" encoding="iso-8859-2" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="UAC REGISTER + INVITE + call">
<!-- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
(user part of uri, server address, auth tag, call target)
-->
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 100
Expires: 120
User-Agent: SIPp/Win32
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>
<recv response="401" auth="true">
</recv>

<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 100
Expires: 120
User-Agent: SIPp/Win32
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>
<recv response="200">
</recv>

<send retrans="500">
<![CDATA[
INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field3]@[field1]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq] INVITE
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 100
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 8
a=rtpmap:8 PCMA/8000
]]>
</send>
<recv response="100" optional="true">
</recv>

<recv response="407" auth="true">


</recv>
<send>
<![CDATA[
ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
[last_To:]
Call-ID: [call_id]
CSeq: [cseq] ACK
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 100
Content-Length: 0
]]>
</send>
<send retrans="500">
<![CDATA[
INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field3]@[field1]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq] INVITE
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 100
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 8
a=rtpmap:8 PCMA/8000
]]>
</send>
<recv response="100" optional="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>

FILE: REGISTER_INVITE_client.xml
SEQUENTIAL
1112;10.84.8.45;[authentication username=1112 password=test];1112;
1113;10.84.8.45;[authentication username=1113 password=test];1113;

FILE: REGISTER_INVITE_CALL.xml
<?xml version="1.0" encoding="iso-8859-2" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="UAC REGISTER + INVITE + call">
<!-- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
(user part of uri, server address, auth tag, call target)
-->
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>
Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 100
Expires: 120
User-Agent: SIPp/Win32
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>
<recv response="401" auth="true">
</recv>
<send retrans="500">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field0]@[field1]>

Call-ID: [call_id]
CSeq: [cseq] REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 100
Expires: 120
User-Agent: SIPp/Win32
Content-Length: 0
]]>
</send>
<!-- asterisk -->
<recv response="100" optional="true">
</recv>
<recv response="200">
</recv>
<send retrans="500">
<![CDATA[
INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field3]@[field1]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq] INVITE
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 100
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 8
a=rtpmap:8 PCMA/8000
]]>
</send>
<recv response="100" optional="true">
</recv>
<recv response="407" auth="true">
</recv>
<send>
<![CDATA[
ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]

[last_To:]
Call-ID: [call_id]
CSeq: [cseq] ACK
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 100
Content-Length: 0
]]>
</send>
<send retrans="500">
<![CDATA[
INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[field0]@[field1]>;tag=[call_number]
To: <sip:[field3]@[field1]:[remote_port]>
Call-ID: [call_id]
CSeq: [cseq] INVITE
Contact: sip:[field0]@[local_ip]:[local_port]
[field2]
Max-Forwards: 100
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 8
a=rtpmap:8 PCMA/8000
]]>
</send>
<recv response="100" optional="true"></recv>
<recv request="INVITE" crlf="true"></recv>
<send>
<![CDATA[
SIP/2.0 180 Ringing
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]

[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
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="180" optional="true">


</recv>
<recv response="183" optional="true">
</recv>
<recv response="200" rrs="true">
</recv>
<send>
<![CDATA[
ACK [next_url] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
[last_To:]
[routes]
Call-ID: [call_id]
CSeq: [cseq] ACK
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards: 100
Content-Length: 0
]]>
</send>
<nop>
<action>
<exec play_pcap_audio="pcap/g711a.pcap"/>
</action>
</nop>
<!-Pause 8 seconds, which is less than the duration of the
-->
<!-- PCAP file
-->
<pause milliseconds="8000"/>

<send retrans="500">
<![CDATA[
BYE [next_url] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[field1]>;tag=[call_number]
[last_To:]
[routes]
Call-ID: [call_id]
CSeq: [cseq] BYE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 100
Content-Length: 0
]]>
</send>

<recv request="BYE"></recv>

<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>

<!-- The 'crlf' option inserts a blank line in the statistics report. -->
<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>

FILE: REGISTER_INVITE_CALL.csv
SEQUENTIAL
1112;10.84.8.45;[authentication username=1112 password=test];1112;
1113;10.84.8.45;[authentication username=1113 password=test];1113;

You might also like