sipp 工具使用

来源:互联网 发布:淘宝客怎么推广如意投 编辑:程序博客网 时间:2024/06/01 09:28

SIPp是sip协议栈的一个免费开源的测试工具, 它模拟了一些基本的uac和uas功能,并建立和释放多个调用的INVITE和BYE的方法,可以读取xml和csv文件生成注册或呼叫流程,可以动态显示统计信息和动态调整呼叫速率

一、安装

1. 下载地址:http://sipp.sourceforge.net/

2. 编译sipp-3.3

a) # tar xzvf sipp-3.3.tar.gz

b) # cd sipp-3.3

c) # make    //没有TLS支持与密码验证支持

   make ossl     //拥有TLS支持与密码验证支持,但是不支PCAP语音播放

   # make pcapplay//支持PCAP Play,但是没有密码验证支持

#make pcapplay_ossl//支持PCAP 声音文件播放,而且支持密码验证支持

  可能需要依赖的库:libpcap、libpcap-devel、ncurses-devel、ncurses


二、使用

sipp模拟uas

./sipp -sn uas -i 192.168.1.249 -p 5077

sipp模拟uac

./sipp -sn uac 192.168.1.249:5077 -i 192.168.1.249 -p 5078 -r 50 -rp 1000      // 每1000ms发送50个呼叫

./sipp -sn uac 192.168.1.249:5077 -i 192.168.1.249 -p 5078 -r 50   // 每1s发送50个呼叫


使用文件测试asterisk

1. 注册脚本文件csv

reg.csv内容如下:

SEQUENTIAL
901;901;[authentication username=901 password=901]
902;902;[authentication username=902 password=902]
903;903;[authentication username=903 password=903]
904;904;[authentication username=904 password=904]
905;905;[authentication username=905 password=905]
906;906;[authentication username=906 password=906]

2. 注册描述文件xml

reg.xml内容如下:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!-- This program is free software; you can redistribute it and/or      -->
<!-- modify it under the terms of the GNU General Public License as     -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version.                    -->
<!--                                                                    -->
<!-- This program is distributed in the hope that it will be useful,    -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
<!-- GNU General Public License for more details.                       -->
<!--                                                                    -->
<!-- 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
      Expires: 3600
      Contact: sip:[field0]@[local_ip]:[local_port]
      [field2]
      Content-Length: [len]
    ]]>
  </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>

./sipp -sf reg.xml -inf reg.csv -p 6067 -i 192.168.1.249 -r 20 -m 1600 192.168.1.250:5060 -trace_msg -trace_screen -trace_err -aa

原创粉丝点击