https://blog.csdn.net/szkbsgy/article/details/136746831
https://www.cnblogs.com/timmy6688/archive/2013/04/17/3026687.html
SIPP是针对SIP协议 的一个性能测试的命令行工具,可以动态显示测试的统计信息(如呼叫速率、延时、消息统计等)。用户可以通过XML场景配置文件,自定义模拟各种UAC/UAS测试场景的信令交互流程,可以被用来测试IP话机、SIP代理、SIP PBX等SIP设备。
官方网站:https://sipp.sourceforge.net/
英文参考文档:https://sipp.sourceforge.net/doc/reference.pdf
1Usage:
2
3 sipp remote_host[:remote_port] [options]
4
5Example:
6
7 Run SIPp with embedded server (uas) scenario:
8 ./sipp -sn uas
9 On the same host, run SIPp with embedded client (uac) scenario:
10 ./sipp -sn uac 127.0.0.1
参数
-
-v
显示版本信息
-
-bg
后台模式运行
-
-sd
输出SIPP内嵌的默认场景
1sipp -sd <uac/uas/uac_pcap> 2 3 uac: uac场景 4 uas: uas场景 5 uac_pcap: uac带媒体场景
将场景内容重定向到文件
1sipp -sd uas > uas.xml
-
-sf
加载指定的场景文件
1sipp -sf uas.xml
-
-sn <uac/uas>
使用默认的内置场景文件
1sipp -sn uas 2sipp -sn uac
-
-t <u1/un/t1/tn>
设置传输方式
1u1: 使用一个UDP 2un: 一个呼叫用一个UDP 3t1: 使用一个TCP 4tn: 一个呼叫使用一个TCP
-
-i
设置本地的IP地址,如contact,via,from
1sip -i 192.168.1.100
-
-p
设置本地的端口
1sip -p 5060
-
-bind_local
绑定本地IP地址
-
-ci
本地控制IP
-
-cp
本地控制PORT
-
-m
您可以拨打指定数量的呼叫,并在完成此操作后退出SIPp。在命令行中使用-m选项
比如 -m 1就是只打一个。
场景
可以从在线参考文档(https://sipp.sourceforge.net/doc/reference.pdf) 中的链接获取一些内置的测试场景的xml模板,手动改变其中的一些参数或流程形成目标场景文件。
1.uac发送音频:还可以发rtp,具体看文档。
1<nop>
2 <action>
3 <exec play_pcap_audio="pcap/g711a.pcap"/>
4 </action>
5</nop>
2.测试样例
这里面invite中的sdp的c字段负责了收音地址,说实话我学sdp的时候不晓得有这回事。
1<?xml version="1.0" encoding="ISO-8859-1" ?>
2<!DOCTYPE scenario SYSTEM "sipp.dtd">
3
4
5<scenario name="Basic Sipstone UAC">
6
7<!-------------------------------------------------------------->
8<!-- Start Conversation -->
9<!-------------------------------------------------------------->
10
11<send retrans="500">
12 <![CDATA[
13
14 INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
15 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
16 From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
17 To: sut <sip:[service]@[remote_ip]:[remote_port]>
18 Call-ID: [call_id]
19 CSeq: 1 INVITE
20 Contact: sip:sipp@[local_ip]:[local_port]
21 Max-Forwards: 70
22 Subject: Performance Test
23 Content-Type: application/sdp
24 Content-Length: [len]
25
26v=0
27o=caller 0 0 IN IP4 10.1.93.116
28s=MobileVrbt_UEA_User_Caller_18500000000_18600000000
29i=-
30c=IN IP4 10.1.68.48
31t=0 0
32m=audio 5002 RTP/AVP 8
33 ]]>
34</send>
35
36<recv response="100" optional="true">
37</recv>
38
39<recv response="200" rtd="true">
40</recv>
41
42<!-------------------------------------------------------------->
43<!-- Start Pa -->
44<!-------------------------------------------------------------->
45<send>
46 <![CDATA[
47
48 ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
49 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
50 From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
51 To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
52 Call-ID: [call_id]
53 CSeq: 1 ACK
54 Contact: sip:sipp@[local_ip]:[local_port]
55 Max-Forwards: 70
56 Subject: Performance Test
57 Content-Length: 0
58
59 ]]>
60</send>
61
62<pause milliseconds="1000" />
63
64<send retrans="500">
65 <![CDATA[
66
67 INFO sip:[service]@[remote_ip]:[remote_port] SIP/2.0
68 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
69 From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
70 To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
71 Call-ID: [call_id]
72 CSeq: 2 INFO
73 Contact: sip:sipp@[local_ip]:[local_port]
74 Max-Forwards: 70
75 Subject: Performance Test
76 Content-Type: application/msml+xml
77 Content-Length: [len]
78
79 <?xml version="1.0" encoding="UTF-8"?>
80 <msml version="1.1">
81 <dialogstart target="conn:12345" name="12345">
82 <play barge="true" iterate="1" interval="1" maxtime="5" id="play">
83 <audio uri="audio.wav" />
84 <playexit>
85 <send target="source" event="done" valuelist="play.end play.amt"/>
86 </playexit>
87 </play>
88 </dialogstart>
89 </msml>]]>
90</send>
91
92<recv response="200" crlf="true">
93</recv>
94
95<recv request="INFO" crlf="true">
96</recv>
97
98<send>
99 <![CDATA[
100
101 SIP/2.0 200 OK
102 [last_Via:]
103 [last_From:]
104 [last_To:]
105 [last_Call-ID:]
106 [last_CSeq:]
107 Contact: <sip:[local_ip]:[local_port];transport=[transport]>
108 Content-Length: 0
109
110 ]]>
111 </send>
112
113<!-------------------------------------------------------------->
114<!-- End Conversation -->
115<!-------------------------------------------------------------->
116<send retrans="500">
117 <![CDATA[
118
119 BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
120 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
121 From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
122 To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
123 Call-ID: [call_id]
124 CSeq: 10 BYE
125 Contact: sip:sipp@[local_ip]:[local_port]
126 Max-Forwards: 70
127 Subject: Performance Test
128 Content-Length: 0
129
130 ]]>
131</send>
132
133<recv response="500" crlf="true" optional="true">
134</recv>
135
136<recv response="200" crlf="true" timeout="2000">
137</recv>
138
139<!-- definition of the response time repartition table (unit is ms) -->
140<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
141
142<!-- definition of the call length repartition table (unit is ms) -->
143<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
144
145</scenario>
示例
-
运行内置uac,uas
1sipp -sn uas 2sipp -sn uac
-
指定自定义场景
1sipp -sf my_uas.xml 2sipp -sf uas.xml -i 192.168.1.200 5060
-
自己测试自己
1sipp -sn uas -i 127.0.0.1 -p 5060
1sipp -sn uac 127.0. 0.1:5060
-
打一个电话
1sipp -sf uac.xml 10.1.1.1:5060 -i 10.1.1.2 -m 1
wireshark抓包过滤,直接抓服务器的ip:
ip.dst == 10.1.68.48 || ip.src == 10.1.68.48