SIPp,VOIP并发测试、性能测试的神器。
本文记录一下常用的脚本文件。
一、reg.xml
此文件是sipp的执行的脚本流程。
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- Temple Place, Suite , Boston, MA - USA -->
<!-- -->
<!-- Sipp default 'branchc' scenario. -->
<!-- -->
<scenario name="branch_client">
<send retrans="">
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]
To: [field0] <sip:[field0]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
Content-Length:
Expires:
]]>
</send> <recv response="" auth="true" next="">
</recv> <!-- send invite with authentication messages -->
<label id=""/>
<send retrans="">
<![CDATA[
REGISTER sip:[field0]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port]
From: [field0] <sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]
To: [field0] <sip:[field0]@[remote_ip]:[remote_port]>
Call-ID: [call_id]
CSeq: REGISTER
Contact: sip:[field0]@[local_ip]:[local_port]
[field1]
Content-Length: [len]
Expires:
]]>
</send> <recv response="" >
</recv>
<pause milliseconds=""/> <!-- 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>
二、reg.csv
此文件是模拟注册的号码信息文件。
SEQUENTIAL
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
;[authentication username= password=]
三、reg.sh
这是linux下的执行sipp的脚本文件。
./sipp -i 本地服务器地址 -sf reg.xml -inf reg.csv 注册服务器地址:端口 -l -trace_msg -trace_screen -trace_err -p 本地服务器端口 -m -aa
附、批量注册信息文件生成脚本
reg.csv的生成脚本
#!/bin/bash
i=
while [ $i != ]
do
i=$(($i+))
#echo “SEQUENTIAL” >test.csv
echo "$i;[authentication username=$i password=1234]" >>reg.csv
done