1. 程式人生 > >SIPP常用腳本之register註冊(一)

SIPP常用腳本之register註冊(一)

general sof pub -m part cse have lin ica

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., -->
<!-- 59 Temple Place, Suite 330
, Boston, MA 02111-1307 USA --> <!-- --> <!-- Sipp default branchc scenario. --> <!-- --> <scenario name="branch_client"> <send retrans="500"> <![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: 1 REGISTER Contact: sip:[field0]@[local_ip]:[local_port] Content-Length: 0 Expires: 3600 ]]> </send> <recv response="401" auth="true" next="1"> </recv> <!-- send invite with authentication messages --> <label id="
1"/> <send retrans="500"> <![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: 2 REGISTER Contact: sip:[field0]@[local_ip]:[local_port] [field1] Content-Length: [len] Expires: 3600 ]]> </send> <recv response="200" > </recv> <pause milliseconds="1000"/> <!-- 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
1001;[authentication username=1001 password=1234]
1002;[authentication username=1002 password=1234]
1003;[authentication username=1003 password=1234]
1004;[authentication username=1004 password=1234]
1005;[authentication username=1005 password=1234]
1006;[authentication username=1006 password=1234]
1007;[authentication username=1007 password=1234]
1008;[authentication username=1008 password=1234]
1009;[authentication username=1009 password=1234]
1010;[authentication username=1010 password=1234]
1011;[authentication username=1011 password=1234]
1012;[authentication username=1012 password=1234]
1013;[authentication username=1013 password=1234]
1014;[authentication username=1014 password=1234]
1015;[authentication username=1015 password=1234]
1016;[authentication username=1016 password=1234]
1017;[authentication username=1017 password=1234]
1018;[authentication username=1018 password=1234]
1019;[authentication username=1019 password=1234]
1020;[authentication username=1020 password=1234]

三、reg.sh

這是linux下的執行sipp的腳本文件。

./sipp -i 本地服務器地址 -sf reg.xml -inf reg.csv 註冊服務器地址:端口 -l 10 -trace_msg -trace_screen -trace_err -p 本地服務器端口 -m 10 -aa

附、批量註冊信息文件生成腳本

reg.csv的生成腳本
#!/bin/bash
i=1000
while [ $i != 1020 ]
do
i=$(($i+1))
#echo “SEQUENTIAL” >test.csv
echo "$i;[authentication username=$i password=1234]" >>reg.csv
done

SIPP常用腳本之register註冊(一)