手机软件测试 嵌入式系统 嵌入式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 通信

引用 删除 freedom1221   /   2010-12-29 17:37:41
这样也不行:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="branch_client">
  <send retrans="500">
      <![CDATA[
        REGISTER sip:msn_res@msn.cu.com.cn SIP/2.0
        Via: SIP/2.0/UDP 192.168.3.107;rport;branch=z9hG4bkXvmyej953
        Route: <sip:192.168.3.107:5060>
        Max-Forwards: 70
        From: <sip:777@192.168.3.107:5063>;tag=XN2UX6F
        To: <sip:777@192.168.3.107>
        Call-ID: 966d6f14-8db7-122e-1a81-0021700deb66
        CSeq: 100001 REGISTER
        Contact: <sip:777@192.168.3.107:5063>
        Content-Length: 0
        Expires: 30
        x-msn-service-index: msn_res
        ]]>
      
  </send>

  <send retrans="500">
      <![CDATA[
        REGISTER sip:msn_res@msn SIP/2.0
        Via: SIP/2.0/UDP 192.168.3.111;rport;branch=z9hG4bkXvmyej953j0Kg
        Route: <sip:192.168.3.107:5060>
        Max-Forwards: 70
        From: <sip:777@192.168.3.104:5063>;tag=XN2UX6F3321212
        To: <sip:777@192.168.3.104>
        Call-ID: 966d6f14-8db7-122e-1a81-0021700deb67
        CSeq: 100002 REGISTER
        Contact: <sip:777@192.168.3.104:5063>
        User-Agent: sofia-sip/1.12.10
        Allow:INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,MESSAGE,SUBSCREIBE,NOTIFY,REFER,UPDATE
        Supported: timer
        Content-Type: text/plain
        Content-Length: 393
        x-msn-service-index: msn_res
        
        x-msn-session-id;x-msn-register-messageDigestigest=5c0ba5d8078da8b1332326f403979bc3,Algorithm=MD5;x-msn-register-authenticate:02103532;x-msn-register-challengeDigest:905823a194840d6cfeb959b7d4642fcb;3294f9bc9c3b5d1751a5ce0d6c2e5cf16476729c423957d2c2ace703fdd7d95318df0a952b4eb37afb2e03ca6ac4df427526e27ce057d2825911bd53962f162ea013fb9d2a755f0e71e5c2f3fde8ce0d3aea79472bb173946f2dd738c3fe2544
        
      ]]>
  </send>
  <recv response="100" optional="true"/>
  <recv response="200"  next="2"/>
  <label id="2"/>
  <pause milliseconds="1000"/>
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
引用 删除 freedom1221   /   2010-12-29 17:36:27
请教一个问题,非常郁闷,我的脚步不能执行第二个send块儿,怎么回事?急,求高人指教!不胜感谢!邮箱:zhangjincheng122112@126.com

脚本:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="branch_client">
  <send retrans="500">
      <![CDATA[
        REGISTER sip:msn_res@msn.cu.com.cn SIP/2.0
        Via: SIP/2.0/UDP 192.168.3.107;rport;branch=z9hG4bkXvmyej953
        Route: <sip:192.168.3.107:5060>
        Max-Forwards: 70
        From: <sip:777@192.168.3.107:5063>;tag=XN2UX6F
        To: <sip:777@192.168.3.107>
        Call-ID: 966d6f14-8db7-122e-1a81-0021700deb66
        CSeq: 100001 REGISTER
        Contact: <sip:777@192.168.3.107:5063>
        Content-Length: 0
        Expires: 30
        x-msn-service-index: msn_res
        ]]>
      
  </send>
  <recv response="401" auth="true" next="11"/>
  <label id="11">
  <send retrans="500">
      <![CDATA[
        REGISTER sip:msn_res@msn SIP/2.0
        Via: SIP/2.0/UDP 192.168.3.111;rport;branch=z9hG4bkXvmyej953j0Kg
        Route: <sip:192.168.3.107:5060>
        Max-Forwards: 70
        From: <sip:777@192.168.3.104:5063>;tag=XN2UX6F3321212
        To: <sip:777@192.168.3.104>
        Call-ID: 966d6f14-8db7-122e-1a81-0021700deb67
        CSeq: 100002 REGISTER
        Contact: <sip:777@192.168.3.104:5063>
        User-Agent: sofia-sip/1.12.10
        Allow:INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,MESSAGE,SUBSCREIBE,NOTIFY,REFER,UPDATE
        Supported: timer
        Content-Type: text/plain
        Content-Length: 393
        x-msn-service-index: msn_res
        
        x-msn-session-id;x-msn-register-messageDigestigest=5c0ba5d8078da8b1332326f403979bc3,Algorithm=MD5;x-msn-register-authenticate:02103532;x-msn-register-challengeDigest:905823a194840d6cfeb959b7d4642fcb;3294f9bc9c3b5d1751a5ce0d6c2e5cf16476729c423957d2c2ace703fdd7d95318df0a952b4eb37afb2e03ca6ac4df427526e27ce057d2825911bd53962f162ea013fb9d2a755f0e71e5c2f3fde8ce0d3aea79472bb173946f2dd738c3fe2544
        
      ]]>
  </send>
  <recv response="100" optional="true"/>
  <recv response="200"  next="2"/>
  <label id="2"/>
  <pause milliseconds="1000"/>
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
 

评分:0

我来说两句

我的栏目

日历

« 2024-04-19  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 25135
  • 日志数: 23
  • 建立时间: 2007-01-25
  • 更新时间: 2008-02-13

RSS订阅

Open Toolbar