手机软件测试 嵌入式系统 嵌入式Linux 通信 开源 测试认证 集成测试 外场测试
用sipp进行sip业务测试(转)
上一篇 /
下一篇 2007-09-30 00:07:19
/ 个人分类:通信
sipp.sourceforge.net现在已经很不错了,可以用来进行sip平台的测试工作。
在我的测试中,sipp两个,一个模拟中继节点送呼叫到sip平台,一个模拟中继节点
接受来自sip平台的呼叫,主要考察正常呼叫流程下,sip平台对于大话务的承受能力。
1:下载 http://sipp.sourceforge.net/snapshots/sipp.2006-08-18.tar.gz
apt-get install libssl-dev openssl libncurses5-dev libpcap0.8-dev
tar xzvf sipp.2006-08-18.tar.gz
源码中有一个bug: call.cpp, line:242 ,
if ( use_tdmmap ) // -- add check, <<-- 添加这行
tdm_map[call_ptr->tdm_map_number] = false
编译 make pcapplay_ossl
2:编写自己的测试脚本
3:运行命令:
外呼:
./sipp 168.168.10.9:2018 -i 168.168.10.7 -p 5060 -s 168.168.10.9 -inf data_04.csv -d 10 -r 1 -rp 1000 -m 100000 -sf 04_trunk_in_test.xml
接受:
./sipp 168.168.10.9:5090 -i 168.168.10.8 -p 5060 -s 168.168.10.9 -mi 168.168.10.8 -mp 8000 -sf 03_trunk_out_test.xml
附件:
$ cat 03_trunk_out_test.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!--
./sipp 168.168.10.246:5090 -i 168.168.10.188 -p 5060 -s 168.168.10.246 -mi 168.168.10.188 -mp 8000 -sf 03_trunk_out_test.xml
-i local_ip
-p local_port
-s service_name
-ap password
-rsa host:port
-inf file_name
-d duration
-r rate (cps)
-rp period : Example: -r 7 -rp 2000 ==> 7 calls every 2 seconds.
-m calls : Stop the test and exit when 'calls' calls are processed.
-l calls_limit: Set the maximum number of simultaneous calls. Once this limit is reached, traffic
is decreased until the number of open calls goes down. Default:(3 * call_duration (s) * rate)
-mp local_port: Set the local RTP echo port number
-mi local_rtp_ip : Set the local IP address for RTP echo.
-nr : Disable retransmission in UDP mode.
-->
<scenario name="Trunk out -- Basic UAS responder">
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
<!-- are saved and used for following messages sent. Useful to test -->
<!-- against stateful SIP proxies/B2BUAs. -->
<recv request="INVITE" crlf="true" rrs="true">
</recv>
<!-- The '[last_*]' keyword is replaced automatically by the -->
<!-- specified header if it was present in the last message received -->
<!-- (except if it was a retransmission). If the header was not -->
<!-- present or if no message has been received, the '[last_*]' -->
<!-- keyword is discarded, and all bytes until the end of the line -->
<!-- are also discarded. -->
<!-- -->
<!-- If the specified header was present several times in the -->
<!-- message, all occurences are concatenated (CRLF seperated) -->
<!-- to be used in place of the '[last_*]' keyword. -->
<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>
<pause milliseconds="5000"/>
<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=xyhe 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 request="ACK"
optional="true"
rtd="true"
crlf="true">
</recv>
<recv request="BYE">
</recv>
<send>
<![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-Length: 0
]]>
</send>
<!-- Keep the call open for a while in case the 200 is lost to be -->
<!-- able to retransmit it if we receive the BYE again. -->
<pause milliseconds="4000"/>
<!-- 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>
<!-- vim: set ts=4 sw=4 sts=4 et: ->
$ cat 04_trunk_in_test.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!--
## simple one call test
./sipp 168.168.10.242:5090 -i 168.168.10.7 -p 5060 -s 168.168.10.242 -inf data_04.csv -d 10 -r 1 -rp 1000 -m 1 -sf 04_trunk_in_test.xml
## 5cps+20s - 2000 calls => 400s
./sipp 168.168.10.242:5090 -i 168.168.10.7 -p 5060 -s 168.168.10.242 -inf data_04.csv -d 10 -r 5 -rp 1000 -m 2000 -sf 04_trunk_in_test.xml
## 5cps+120s - 5000 calls => 1000s
./sipp 168.168.10.242:5090 -i 168.168.10.7 -p 5060 -s 168.168.10.242 -inf data_04.csv -d 10 -r 5 -rp 1000 -m 5000 -sf 04_trunk_in_test.xml
-i local_ip
-p local_port
-s service_name
-ap password
-rsa host:port
-inf file_name
-d duration
-r rate (cps)
-rp period : Example: -r 7 -rp 2000 ==> 7 calls every 2 seconds.
-m calls : Stop the test and exit when 'calls' calls are processed.
-l calls_limit: Set the maximum number of simultaneous calls. Once this limit is reached, traffic
is decreased until the number of open calls goes down. Default:(3 * call_duration (s) * rate)
file data_04.csv as:
==== cut here ====
EQUENTIAL
#user_num;callee_num
85010000;88010000
85010001;88010001
85010002;88010002
==== cut end ====
-->
<scenario name="trunk in -- bulkcall generator">
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
<!-- generated by sipp. To do so, use [call_id] keyword. -->
<send retrans="500">
<![CDATA[
INVITE sip:[field1]@[service] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[service]>;tag=[call_number]
To: [field1] <sip:[field1]@[service]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: <sip:[field0]@[local_ip]:[local_port]>
Max-Forwards: 70
Subject: Bulk Call Performance Test
Content-Type: application/sdp
Content-Length: [len]
v=0
o=[field0] 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="180" optional="true"> </recv>
<recv response="183" optional="true"> </recv>
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
<!-- are saved and used for following messages sent. Useful to test -->
<!-- against stateful SIP proxies/B2BUAs. -->
<recv response="200" rtd="true" rrs="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 [next_url] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[service]>;tag=[call_number]
To: [field1] <sip:[field1]@[service]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: <sip:[field0]@[local_ip]:[local_port]>
Max-Forwards: 70
Subject: Bulk Call 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 milliseconds="10000"/>
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
<send retrans="500">
<![CDATA[
BYE [next_url] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[service]>;tag=[call_number]
To: [field1] <sip:[field1]@[service]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 2 BYE
Contact: <sip:[field0]@[local_ip]:[local_port]>
Max-Forwards: 70
Subject: Bulk Call Performance Test
Content-Length: 0
]]>
</send>
<recv response="100" optional="true"> </recv>
<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>
<!-- vim: set ts=4 sw=4 sts=4 et: ->
收藏
举报
TAG:
asterisk
sipp
sip
通信