SIP调试之SIPP测试工具

这篇具有很好参考价值的文章主要介绍了SIP调试之SIPP测试工具。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

  SIPP是针对SIP协议的一个性能测试的命令行工具,可以动态显示测试的统计信息(如呼叫速率、延时、消息统计等)。用户可以通过XML场景配置文件,自定义模拟各种UAC/UAS测试场景的信令交互流程,可以被用来测试IP话机、SIP代理、SIP PBX等SIP设备。

一、参考资料

官方网站:https://sipp.sourceforge.net/
参考文档:https://sipp.sourceforge.net/doc/reference.pdf

二、安装

linux平台:

sudo apt install sip-tester

注:也可以下载源码编译安装

三、使用

3.1 查看用法

# sipp -h

Usage:

  sipp remote_host[:remote_port] [options]

Example:

   Run SIPp with embedded server (uas) scenario:
     ./sipp -sn uas
   On the same host, run SIPp with embedded client (uac) scenario:
     ./sipp -sn uac 127.0.0.1

  Available options:


*** Scenario file options:
 -sd  : Dumps a default scenario (embedded in the SIPp executable)
 -sf  : Loads an alternate XML scenario file.  To learn more about XML scenario
                      syntax, use the -sd option to dump embedded scenarios.
                       They contain all the necessary help.
.................................
..................................

3.2 常用参数说明

-v

作用:显示版本信息

-bg

作用:后台模式运行

-sd

作用:输出SIPP内嵌的默认场景

sipp -sd <uac/uas/uac_pcap>

部分参数说明:

  1. uac: uac场景
  2. uas: uas场景
  3. uac_pcap: uac带媒体场景

将场景内容重定向到文件

sipp -sd uas > uas.xml

-sf

作用:加载指定的场景文件

sipp -sf uas.xml

-sn <uac/uas>

作用:使用默认的内置场景文件

# sipp -sn uas
# sipp -sn uac

-t <u1/un/t1/tn>

作用:设置传输方式
部分参数说明:

  u1: 使用一个UDP
  un: 一个呼叫用一个UDP
  t1: 使用一个TCP
  tn: 一个呼叫使用一个TCP

-i

作用:设置本地的IP地址,如contact,via,from

sip -i 192.168.1.100

-p

作用:设置本地的端口

sip -p 5060

-bind_local

作用:绑定本地IP地址

-ci

作用:本地控制IP

-cp

作用:本地控制PORT

3.3 场景文件

  可以从在线参考文档(https://sipp.sourceforge.net/doc/reference.pdf) 中的链接获取一些内置的测试场景的xml模板,手动改变其中的一些参数或流程形成目标场景文件。

uac.xml:

<scenario name="Basic Sipstone UAC">
  <!-- 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:[service]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
      To: [service] <sip:[service]@[remote_ip]:[remote_port]>
      Call-ID: [call_id]
      CSeq: 1 INVITE
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Subject: Performance Test
      Content-Type: application/sdp
      Content-Length: [len]

      v=0
      o=user1 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">
  </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 sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
      To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
      Call-ID: [call_id]
      CSeq: 1 ACK
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Subject: 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/>

  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
  <send retrans="500">
    <![CDATA[

      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
      To: [service] <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
      Call-ID: [call_id]
      CSeq: 2 BYE
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Subject: Performance Test
      Content-Length: 0

    ]]>
  </send>

  <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>

uas.xml:

<scenario name="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.                             -->
  <!-- Adding ignoresdp="true" here would ignore the SDP data: that     -->
  <!-- can be useful if you want to reject reINVITEs and keep the       -->
  <!-- media stream flowing.                                            -->
  <recv request="INVITE" crlf="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 occurrences are concatenated (CRLF separated)       -->
  <!-- to be used in place of the '[last_*]' keyword.                   -->

  <send>
    <![CDATA[

      SIP/2.0 180 Ringing
      [last_Via:]
      [last_From:]
      [last_To:];tag=[pid]SIPpTag01[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
      Content-Length: 0

    ]]>
  </send>

  <send retrans="500">
    <![CDATA[

      SIP/2.0 200 OK
      [last_Via:]
      [last_From:]
      [last_To:];tag=[pid]SIPpTag01[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=user1 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 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:]
      [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.               -->
  <timewait 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>

3.4 示例

3.4.1 运行内置UAS/UAC

# sipp -sn uas
# sipp -sn uac

3.4.2 指定自定义场景文件

sipp  -sf my_uas.xml

3.4.3 指定本地IP/端口

sipp  -sf uas.xml -i 192.168.1.200 5060

3.5 测试

192.168.1.16终端呼叫192.168.1.200

测试结果:

# sipp -sn uas 192.168.1.200
Resolving remote host '192.168.1.200'... Done.
------------------------------ Scenario Screen -------- [1-9]: Change Screen --
  Port   Total-time  Total-calls  Transport
  5060      30.29 s            1  UDP

  0 new calls during 0.172 s period       1 ms scheduler resolution            
  0 calls                                 Peak was 1 calls, after 10 s
  0 Running, 3 Paused, 0 Woken up
  0 dead call msg (discarded)           
  3 open sockets                          0/0/0 UDP errors (send/recv/cong)
  0 Total RTP pckts sent                  0.000 last period RTP rate (kB/s)

                                 Messages  Retrans   Timeout   Unexpected-Msg
  ----------> INVITE             1         0         0         0               

  <---------- 180                1         0                                   
  <---------- 200                1         0         0                         
  ----------> ACK         E-RTD1 1         0         0         0               

  ----------> BYE                1         0         0         0               
  <---------- 200                1         0                                   
  [   4000ms] Pause              1                             0        

点击ctrl+C结束sipp,打印结果:

------------------------------ Test Terminated --------------------------------
----------------------------- Statistics Screen ------- [1-9]: Change Screen --
  Start Time             | 2024-03-15	15:01:44.429203	1710486104.429203         
  Last Reset Time        | 2024-03-15	15:02:14.553107	1710486134.553107         
  Current Time           | 2024-03-15	15:02:14.731231	1710486134.731231         
-------------------------+---------------------------+--------------------------
  Counter Name           | Periodic value            | Cumulative value
-------------------------+---------------------------+--------------------------
  Elapsed Time           | 00:00:00:178000           | 00:00:00:178000          
  Call Rate              |    0.000 cps              |    0.033 cps             
-------------------------+---------------------------+--------------------------
  Incoming calls created |        0                  |        1                 
  Outgoing calls created |        0                  |        0                 
  Total Calls created    |                           |        1                 
  Current Calls          |        0                  |                          
-------------------------+---------------------------+--------------------------
  Successful call        |        0                  |        1                 
  Failed call            |        0                  |        0                 
-------------------------+---------------------------+--------------------------
  Response Time 1        | 00:00:00:000000           | 00:00:00:000000          
  Call Length            | 00:00:00:000000           | 00:00:00:000000          
------------------------------ Test Terminated --------------------------------

网络抓包:
sipp,SIP/VOIP,sipp,sip,uas.xml,sf,sn文章来源地址https://www.toymoban.com/news/detail-855956.html

四、关键说明

  1. 一般用于性能、压力、稳定性测试
  2. 可以模拟一些异常或客户现场的信令交互流程,用于复现分析问题
  3. 场景文件编写人员既要熟悉SIP协议,又要熟悉SIPP的相关参数应用,因此实际上很少使用SIPP作为日常测试手段

到了这里,关于SIP调试之SIPP测试工具的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 猿创征文|【FreeSwitch开发实践】使用sipp对FreeSwitch进行压力测试

    ✨ 博客主页:小小马车夫的主页 ✨ 所属专栏:FreeSwitch开发实践 ✨ 专栏介绍:主要介绍博主在实际项目中使用FreeSwitch开发外呼类项目的一些经验心得,主要涉及FreeSwitch的基本安装编译、基本配置、ESL、WSS、录音、自定义模块、media bug、语音播放、MRCP及对接AI机器人等内容

    2024年02月03日
    浏览(29)
  • linux 安装sipp

    从 sipp - Browse /sipp/3.2 at SourceForge.net 下载最新版的sipp.svn.tar.gz,解压之后就得到一个rpm文件

    2024年01月24日
    浏览(20)
  • sipp压测freeswitch第2篇Fs配置

    当安装编译好SIPp后并不能马上进入压测环节,还需要对freeswitch进行一定的配置才可以正式进入压测环节;这篇主要是将Fs的配置修改 编码 当你使用pcag压音测视频时 拨号计划修改 ACL 放开呼叫鉴权 外呼数量限制修改

    2024年04月15日
    浏览(28)
  • Sip - Ubuntu 配置 miniSIPServer 服务器(测试用)

    客户提供的账号过期了,简单搭建 SIP 服务器,以便测试使用。个人认为这个配置起来最为简单,且测试功能足够。 官网miniSIPServer - 基于 Windows 以及 Linux 平台的 VoIP (SIP) 服务器软件. miniSIPServer 可能是最容易使用的 VoIP(SIP) 服务器软件,VoIP 领域专家可以轻松部署丰富的企业通

    2024年02月02日
    浏览(33)
  • python3使用ESL和sipp自动多轮压测FreeSWITCH

    环境:CentOS 7.6_x64   FreeSWITCH版本 :1.10.9   sipp版本:3.6.1   python版本:3.9.12 日常工作中,有时会遇到批量自动压测FreeSWITCH的需求,sipp是一个非常好的VoIP压测工具,python是个很好用的脚本语言,今天记录下CentOS 7环境下python3如何借助ESL使用sipp自动压测FreeSWITCH服务器。 sipp的

    2024年02月15日
    浏览(20)
  • 猿创征文|工具百宝箱-数据库连接工具-接口调试与测试工具-抓包工具

    工具没有绝对意义上的好坏之分,只有需求适合与否,这些需求可能包括:功能、价格、安全、服务、技术等诸多方面。 技术在更新迭代,开发者工具也在更新迭代。一个高效趁手的工具在工作上锦上添花。给大家分享一下我平时用的一部分工具。 官方活动入口:「猿创征

    2023年04月27日
    浏览(28)
  • Fidder抓包工具基础+postman调试测试

    保存一个文件,选择格式 保存文件 自定义名称 将har 包托人 postman 即可 ; 找到请求 直接点击send 。 全部已经配置好了,不需要改动。 执行 完毕~ 撒花 结果如下

    2024年02月03日
    浏览(39)
  • 13款强大的开源API测试工具,不容错过!_开源api调试工具

    Apickli是一个基于Cucumber的开源REST API集成测试框架。它提供了一个Gherkin框架和一系列实用函数,使API测试变得简单且耗时更少。Apickli也可以作为NPM包提供。 网站:https://github.com/apickli/apickli 4. Dredd Dredd是一种与语言无关的命令行工具,用于根据API的后端实现来验证API描述文档

    2024年04月25日
    浏览(28)
  • 有哪些前端调试和测试工具? - 易智编译EaseEditing

    前端开发调试和测试工具帮助开发人员在开发过程中发现和修复问题,确保网站或应用的稳定性和性能。以下是一些常用的前端调试和测试工具: 调试工具: 浏览器开发者工具: 现代浏览器(如Chrome、Firefox、Safari等)都内置了开发者工具,可以用于检查网页的HTML、CSS、J

    2024年02月11日
    浏览(35)
  • 一文详解接口测试(调试)工具postman的安装(完全卸载)和使用以及接口管理

    今天在开发项目时,需要使用 postman 来调试部分接口,那么,便利用这个时间来解说 postman 这款优秀的接口调试工具。他不

    2024年02月03日
    浏览(58)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包