zoukankan      html  css  js  c++  java
  • SIPp常用脚本之一:register注册

    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
  • 相关阅读:
    电商交易背景知识合集第二季
    技术高手如何炼成
    #研发解决方案#基于Apriori算法的Nginx+Lua+ELK异常流量拦截方案
    电商交易背景知识合集第一季
    真刀真枪压测:基于TCPCopy的仿真压测方案
    安全基础教育第二季第1集:屡战屡败的找回密码
    #研发解决方案#从宏观到微观——天机与鹰眼联手
    挖坑和踩雷
    我们过去几年做对了哪些事
    小伙伴们手滑集
  • 原文地址:https://www.cnblogs.com/yoyotl/p/7359430.html
Copyright © 2011-2022 走看看