1、sipp的安装

1) 在centos 7.2下安装

yum install make gcc gcc-c++ ncurses ncurses.x86_64 ncurses-devel ncurses-devel.x86_64 openssl lksctp-tools libnet libpcap libpcap-devel libpcap.x86_64 libpcap-devel.x86_64 gsl gsl-devel
cd /root/
wget http://sourceforge.net/projects/sipp/files/sipp/3.4/sipp-3.3.990.tar.gz/download
tar -zxvf sipp-3.3.990.tar.gz
cd sipp-3.3.990/
./configure --with-sctp --with-pcap --with-openssl make && sudo make install
sipp -v

2) 在ubuntu14.04 下有些差异

http://sipp.sourceforge.net/doc3.3/reference.html

http://sipp.sourceforge.net/doc/reference.html

https://github.com/SIPp

tar xvf sipp-3.5.2.tar.gz
cd sipp-3.5.2
sudo apt-get install libsctp-dev lksctp-tools
sudo apt-get install libncurses5-dev
sudo apt-get install libpcap-dev libssl-dev
sudo apt-get install build-essential
./build.sh --with-pcap --with-sctp --with-openssl
make
make install

2、sipp拨号测试

先在freepbx上创建好两个分机103和104

最好是在linux下创建xml脚本文件,因为windows操作之后文档的编码格式可能会改变,xml对编码格式非常敏感。在windows和linux两边编辑容易出问题。

1) 主叫账户

vi caller.csv

SEQUENTIAL
103;104;[authentication username=103 password=103]

2) 被叫账号

vi callee.csv

SEQUENTIAL
104;;[authentication username=104 password=104]

3) 注册脚本

vi regclient_set_c_port.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<scenario name="regclient">
<!--本脚本特为持续性测试使用,如单次使用,建议-p 与-set c_port的端口设为相同-->
<!--执行命令样例:sipp -sf regc_set_c_port.xml 172.31.231.220:5060 -i 172.31.231.23 -p 5077 -inf caller.csv -m 1 -set c_port 5066-->
<Global variables="c_port" /> <nop hide="true">
<action>
<!--设置EXP的值为3600-->
<assignstr assign_to="EXP" value="3600" />
</action>
</nop> <send>
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: <sip:[field0]@[remote_ip]>;tag=acknnkkg.[call_number]
To: <sip:[field0]@[remote_ip]>
Call-ID: [call_id]
CSeq: 1 REGISTER
Contact: <sip:[field0]@[local_ip]:[$c_port]>
Max-Forwards: 70
Subject: Reg Performance Test made by wangwei
user-agent: SIPp client
Expires: [$EXP]
Content-Length: 0
]]>
</send> <recv response="401" optional="true" auth="true" next="auth" >
</recv> <recv response="403" optional="true" next="END">
</recv> <recv response="404" optional="true" next="END">
</recv> <recv response="200" next="END" timeout="5000">
</recv> <label id="auth" />
<send>
<![CDATA[
REGISTER sip:[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[field0]@[local_ip]:[$c_port]>
Max-Forwards: 70
Subject: Reg Performance Test made by wangwei
user-agent: SIPp client
Expires: [$EXP]
[field2]
Content-Length: 0 ]]>
</send> <recv response="200" next="END" timeout="5000">
</recv> <label id="END"/>
<nop hide="true">
</nop> <!--<Reference variables="microseconds,seconds" />--> <!-- Definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="50, 200"/> <!-- Definition of the call length repartition table (unit is ms) -->
<CallLengthRepartition value="500, 5000"/> </scenario>

4) 被叫脚本

vi callee_with_bye.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd"> <scenario name="callee_with_bye">
<!--用于模拟局内被叫侧用户的正常业务流程
媒体类型:PCMU
呼叫挂机:主叫方(60秒超时后主动发BYE拆话)--> <!--执行命令样例:sipp -sf callee_with_bye.xml -p 5068--> <!--定义全局状态机,如果收到OPTIONS消息,则跳转至options标签处-->
<recv request="OPTIONS" optional="global" next="options">
</recv> <recv request="INVITE">
<!--参数caller_num、callee_num和caller_tag用于主叫未挂机,BYE接收超时主动发BYE的流程-->
<action>
<ereg regexp="<sip:(.*)@(.*)>;tag=(.*)"
search_in="hdr"
header="From: "
check_it="true"
assign_to="junk,caller_num,domain,caller_tag" />
<ereg regexp="<sip:(.*)@.*>"
search_in="hdr"
header="To: "
check_it="true"
assign_to="junk,callee_num" />
</action>
</recv> <!--增加间隔20ms,避免偶现系统不发送100响应的问题-->
<pause hide="true" milliseconds="20"/> <send>
<![CDATA[
SIP/2.0 100 Trying
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send> <!--增加间隔20ms,避免偶现系统不发送180响应的问题-->
<pause hide="true" milliseconds="20"/> <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> <!--设置发送200后等待ACK的重传周期为1秒,如果1秒内收不到ACK则进行200的重传-->
<send retrans="1000" start_rtd="ack">
<![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=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 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=ptime:20
]]>
</send> <!--设置等待ACK的超时定时器为30秒,如果30秒内收不到ACK则呼叫超时失败而结束-->
<recv request="ACK" rtd="ack" timeout="30000" /> <!--使用rtp_stream循环播放PCMA音频
<nop hide="true">
<action>
<exec rtp_stream="pcap/g711a.pcap,-1,0"/>
</action>
</nop>
-->
<!--使用rtp_stream循环播放PCMU音频
<nop hide="true">
<action>
<exec rtp_stream="pcap/g711u.pcap,-1,0"/>
</action>
</nop>
--> <!--使用play_pcap单次播放PCMA音频-->
<nop hide="true">
<action>
<exec play_pcap_audio="pcap/g711a.pcap"/>
</action>
</nop>
<!--使用play_pcap单次播放PCMU音频
<nop hide="true">
<action>
<exec play_pcap_audio="pcap/g711u.pcap"/>
</action>
</nop>
--> <recv request="BYE" timeout="60000" ontimeout="send_bye"/>
<send next="END">
<![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> <label id="options"/>
<send next="END" >
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_Call-ID:]
[last_From:]
[last_To:];tag=telpo-options[call_number]
[last_CSeq:]
[last_Contact:]
user-agent: SIPP version [sipp_version]
subject: reg performance test made by wangwei
link-status: I am alive
Content-Length: 0 ]]>
</send> <!--主叫未挂机,BYE接收超时,被叫主动发BYE-->
<label id="send_bye"/>
<send start_rtd="bye">
<![CDATA[
BYE sip:[$caller_num]@[local_ip]:[local_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: "[$caller_num]" <sip:[$caller_num]@[local_ip]>;tag=[call_number]
To: "[$callee_num]"<sip:[$callee_num]@[local_ip]>;tag=[$caller_tag]
Call-ID: [call_id]
CSeq: 2 BYE
Max-Forwards: 70
Subject: normal call scenario by wangwei
Content-Length: 0
]]>
</send> <recv response="200" rtd="bye">
</recv> <label id="END"/> <Reference variables="junk,domain" /> <!-- definition of the response time repartition table (unit is ms)-->
<ResponseTimeRepartition value="50, 200"/> <!-- definition of the call length repartition table (unit is ms)-->
<CallLengthRepartition value="500, 1000, 10000"/> </scenario>

5) 主叫脚本

vi caller_with_auth.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd"> <scenario name="caller_with_auth">
<!--执行命令样例:sipp -sf caller_with_auth.xml 47.106.93.236:5060 -p 5066 -inf caller.csv -m 1 -d 10000 -oocsn ooc_default-->
<!--发送INVITE消息,设定重传定时器为1000ms,同时启动定时器invite-->
<send retrans="1000" start_rtd="invite">
<![CDATA[
INVITE sip:[field1]@[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: "[field0]" <sip:[field0]@[remote_ip]>;tag=[call_number]zhg8
To: "[field1]"<sip:[field1]@[remote_ip]>
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: <sip:[field0]@[local_ip]:[local_port]>
User-Agent: SIPp client mode version [sipp_version]
Allow: INVITE,PRACK,ACK,UPDATE,CANCEL,BYE,OPTIONS,INFO,SUBSCRIBE,REFER,NOTIFY
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: [len] v=0
o=SIPp [pid][call_number] 8[pid][call_number]8 IN IP[local_ip_type] [local_ip]
s=SIPp Normal Call Test
t=0 0
m=audio [media_port] RTP/AVP 0 8
c=IN IP[media_ip_type] [media_ip]
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=ptime:20
a=sendrecv
]]>
</send> <recv response="100" optional="true">
</recv> <recv response="401" auth="true">
</recv> <!--部分呼叫鉴权可能为407
<recv response="401" auth="true">
</recv>--> <send>
<![CDATA[
ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch-3]
From: "[field0]" <sip:[field0]@[remote_ip]>;tag=[call_number]zhg8
To: "[field1]"<sip:[field1]@[remote_ip]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: <sip:[field0]@[local_ip]:[local_port]>
Max-Forwards: 70
Subject: normal call scenario by wangwei
user-agent: SIPp client mode version [sipp_version]
Content-Length: 0
]]>
</send> <send retrans="1000" start_rtd="invite">
<![CDATA[
INVITE sip:[field1]@[remote_ip] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: "[field0]" <sip:[field0]@[remote_ip]>;tag=[call_number]zhg8
To: "[field1]"<sip:[field1]@[remote_ip]>
Call-ID: [call_id]
CSeq: 2 INVITE
[field2]
Contact: <sip:[field0]@[local_ip]:[local_port]>
User-Agent: SIPp client mode version [sipp_version]
Allow: INVITE,PRACK,ACK,UPDATE,CANCEL,BYE,OPTIONS,INFO,SUBSCRIBE,REFER,NOTIFY
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: [len] v=0
o=SIPp [pid][call_number] 8[pid][call_number]8 IN IP[local_ip_type] [local_ip]
s=SIPp Normal Call Test
t=0 0
m=audio [media_port] RTP/AVP 0 8
c=IN IP[media_ip_type] [media_ip]
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=ptime:20
]]>
</send> <!--1xx响应均为可选接收消息,且接收到临时响应后,即可停止invite定时器的计时-->
<!--收到4xx/5xx错误响应后,直接进入呼叫失败-->
<recv response="100" optional="true" rtd="invite">
</recv> <recv response="183" optional="true" rtd="invite" next="normal">
</recv> <recv response="403" optional="true" rtd="invite" next="err_ack">
</recv> <recv response="480" optional="true" rtd="invite" next="err_ack">
</recv> <recv response="486" optional="true" rtd="invite" next="err_ack">
</recv> <recv response="500" optional="true" rtd="invite" next="err_ack">
</recv> <recv response="503" optional="true" rtd="invite" next="err_ack">
</recv> <recv response="180" optional="true" rtd="invite" next="normal">
</recv> <label id="normal"/>
<recv response="200" rtd="invite">
<action>
<ereg regexp="m=audio ([0-9]*)"
search_in="msg"
check_it="true"
assign_to="junk,callee_media_port" />
</action>
</recv> <nop hide="true"> </nop> <send>
<![CDATA[
ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: "[field0]" <sip:[field0]@[remote_ip]>;tag=[call_number]zhg8
To: "[field1]"<sip:[field1]@[remote_ip]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 2 ACK
Contact: <sip:[field0]@[local_ip]:[local_port]>
Max-Forwards: 70
Subject: normal call scenario by wangwei
user-agent: SIPp client mode version [sipp_version]
Content-Length: 0
]]>
</send> <!--使用rtp_stream循环播放PCMA音频
<nop hide="true">
<action>
<exec rtp_stream="pcap/g711a.pcap,-1,0"/>
</action>
</nop>
-->
<!--使用rtp_stream循环播放PCMU音频
<nop hide="true">
<action>
<exec rtp_stream="pcap/g711u.pcap,-1,0"/>
</action>
</nop>
--> <!--使用play_pcap单次播放PCMA音频-->
<nop hide="true">
<action>
<exec play_pcap_audio="pcap/g711a.pcap"/>
</action>
</nop>
<!--使用play_pcap单次播放PCMU音频
<nop hide="true">
<action>
<exec play_pcap_audio="pcap/g711u.pcap"/>
</action>
</nop>
--> <!--媒体流传输完毕后,暂停发送BYE结束呼叫,在执行命令中增加参数-d 指定暂停时间:如-d 10000暂停10秒-->
<pause /> <send start_rtd="bye">
<![CDATA[
BYE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: "[field0]" <sip:[field0]@[remote_ip]>;tag=[call_number]zhg8
To: "[field1]"<sip:[field1]@[remote_ip]>[peer_tag_param]
Call-ID: [call_id]
CSeq: 3 BYE
Max-Forwards: 70
Subject: normal call scenario by wangwei
Content-Length: 0
]]>
</send> <recv response="200" rtd="bye" next="END">
</recv> <!--异常结束,复用err_ack流程-->
<label id="err_ack"/> <send>
<![CDATA[
ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
[last_Via:]
From: "[field0]" <sip:[field0]@[remote_ip]>;tag=[call_number]zhg8
To: "[field1]"<sip:[field1]@[remote_ip]>[peer_tag_param]
[last_Call-ID:]
CSeq: 2 ACK
Max-Forwards: 70
Subject: normal call scenario by wangwei
user-agent: SIPp client mode version [sipp_version]
Content-Length: 0
]]>
</send> <!--正常结束-->
<label id="END"/>
<nop hide="true">
</nop> <!--如果存在定义了但未被使用的变量,可以在下面语句的双引号中增加,避免运行时报错-->
<Reference variables="junk,callee_media_port" /> <!--definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="50, 200,1000,2000,4000,10000"/> <!--definition of the call length repartition table (unit is ms) -->
<CallLengthRepartition value="500, 1000, 10000"/> </scenario>

6) 按以下步骤运行

#主叫注册
sipp -sf regclient_set_c_port.xml 47.106.xx.xxx:5060 -i 192.168.247.152 -p 5066 -inf caller.csv -set c_port 5066 -m 1

#被叫注册
sipp -sf regclient_set_c_port.xml 47.106.xx.xxx:5060 -i 192.168.247.152 -p 5088 -inf callee.csv -set c_port 5088 -m 1

#被叫
sipp -sf callee_with_bye.xml -i 192.168.247.152 -p 5088 -trace_err

#主叫
sudo sipp -sf caller_with_auth.xml 47.106.xx.xxx:5060 -i 192.168.247.152 -p 5066 -inf caller.csv -m 1 -d 10000 -oocsn ooc_default -trace_err

7) 登陆会议室

我在freepbx上创建的会议室号是2018,没有密码,直接拨号就能登进去

所以将主叫账户caller.csv改成登陆会议室就行

SEQUENTIAL
103;2018;[authentication username=103 password=103]

3、其他拓展应用

具体应用看手册 SIPp3.4中文参考手册.pdf https://files.cnblogs.com/files/dong1/SIPp3.4%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C.pdf

1) SIPP通过next指定id实现循环

https://blog.csdn.net/voip3261/article/details/10335925

参考 https://blog.csdn.net/netluoriver/article/details/21786301

sipp模拟freepbx分机测试(SIP协议调试)的更多相关文章

  1. sipp模拟freeswitch分机测试(SIP协议调试)

    1.freeswitch安装 1) 网上很多安装方法都不靠谱,系统版本,各种依赖库一堆问题,下面是验证的可行的. yum install -y http://files.freeswitch.org/ ...

  2. sipp模拟电信运营商VoIP终端测试(SIP协议调试)

    三大运营商都有SIP服务器,用来支持语音对讲,多媒体调度等功能,他们的平台可能不是标准的SIP协议会话. 为了应对没完没了的对接各个厂商的平台,这里再整理了一套协议脚本,毕竟全都是没有意义的无用功,标 ...

  3. 【测试工具】http协议调试利器fiddler使用教程

    转自:http协议调试利器fiddler使用教程http://bbs.phpchina.com/thread-207418-1-1.html Fiddler真乃神器!它和市面上常见的很多web调试器. ...

  4. SIP协议简单介绍

    sip协议是由IETF提出的IP电话信令协议,主要目的是为了解决ip网络中的信令控制,以及同软交换通信. sip协议类似http协议: 报文结构: start-line message-header ...

  5. 基于GBT28181:SIP协议组件开发-----------第三篇SIP注册流程分析实现

    原创文章,引用请保证原文完整性,尊重作者劳动,原文地址http://www.cnblogs.com/qq1269122125/p/3941172.html,qq:1269122125. 上两章节简要的 ...

  6. 基于GBT28181:SIP协议组件开发-----------第四篇SIP注册流程eXosip2实现(一)

    原创文章,引用请保证原文完整性,尊重作者劳动,原文地址http://www.cnblogs.com/qq1269122125/p/3945294.html. 上章节讲解了利用自主开发的组件SIP组件l ...

  7. 基于GBT28181:SIP协议组件开发-----------第一篇环境搭建

    原创文章,引用请保证原文完整性,尊重作者劳动,原文地址http://www.cnblogs.com/qq1269122125/p/3930018.html,qq:1269122125. SIP协议在安 ...

  8. 阐述:SIP协议是什么

    sip协议是什么?可能刚刚接触这个协议的朋友会掌握不好它的定义.那么首先我们要了解一下,目前企业中大多数VoIP应用都使用H.323协议,但是,随着越来越多的企业研究SIP协议,不久的将来基于SIP协 ...

  9. SIP协议整理

    本文记录开发.实现IMS项目时,整理的SIP协议基础知识:若有侵权,请告之. SIP协议 1.      SIP协议简介 SIP是一个应用层的控制协议,可以用来建立.修改.和终止多媒体会话(或者会议) ...

随机推荐

  1. C/C++中printf和C++中cout的输出格式

    一. Printf 输出格式 C中格式字符串的一般形式为: %[标志][输出最小宽度][.精度][长度]类型,其中方括号[]中的项为可选项.各项的意义介绍如下:1.类型类型字符用以表示输出数据的类型, ...

  2. 【cf492】E. Vanya and Field(拓展欧几里得)

    http://codeforces.com/contest/492/problem/E 一开始没时间想,,诶真是.. 挺水的一道题.. 将每个点的横坐标都转换成0,然后找纵坐标有多少即可..即解方程 ...

  3. LoadRunner压力测试心得总结

    一.虚拟用户迭代一次的时间对整个压力场景的影响. 1.虚拟用户迭代一次的时间大于等于压力场景的上行周期. 此种情况,在压力场景的上行周期中,所有虚拟用户根据压力场景设置的策略全部依次运行.压力场景的上 ...

  4. 漫游Kafka设计篇之消息传输的事务定义(5)

    之前讨论了consumer和producer是怎么工作的,现在来讨论一下数据传输方面.数据传输的事务定义通常有以下三种级别: 最多一次: 消息不会被重复发送,最多被传输一次,但也有可能一次不传输. 最 ...

  5. Scilab 的画图函数(3)

    我们在做数据画图或函数图像时常常须要使用对数坐标系.尤其是数据的范围跨越非常多个数量级时.通常的线性坐标系下无法表现出数据特征. Scilab 中Plot函数无法画出对数坐标.须要使用 plot2d  ...

  6. 编程之美 set 15 高效率地安排见面会

    题目 有 n 个学生分别对 m 个见面会感兴趣, 为了满足所有学生的要求, HR 希望每个学生都能参加自己感兴趣的所有见面会 思路 1. 假设某一个同学同时对k个小组感兴趣, 那么这k个小组两两之间都 ...

  7. __del__()

    __del__() 是类的内置函数,用于定义在脚本退出之前要执行的代码,因为有这个特性,通常被用来在脚本退出前关闭文件.关闭数据库连接.关闭网络连接等操作 [root@localhost ~]$ ca ...

  8. 第十三篇:带缓冲的IO( 标准IO库 )

    前言 在之前,学习了 read write 这样的不带缓冲IO函数. 而本文将讲解标准IO库中,带缓冲的IO函数. 为什么要有带缓冲IO函数 标准库提供的带缓冲IO函数是为了减少 read 和 wri ...

  9. oracle修改用户密码

    1.使用oracle用户登录,连接数据库 [oracle@wuzj ~]$ sqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on Th ...

  10. php事件钩子

    PHP中钩子函数的实现与认识:  http://rmingwang.com/set-php-hooks.html 1.钩子函数是预设并在特定的条件下触发的. 2.钩子函数接管程序后可以影响到程序的走向 ...