欢迎大家转载,为保留作者成果,转载请注明出处,http://blog.csdn.net/netluoriver,有些文件在资源中也可以下载!如果你没有积分,可以联系我!
经过多天的努力,用脚本呼叫eyebeem电话,在电话端终于听到录制的语音包了,费话不多说,描述环境:
192.168.0.20是一个有注册认证的SIP服务器,服务器端口为5060;
192.168.0.101是我在windows安装的cygwin软件后
测试机器;
branchc1.xml 中的50000 呼叫 eyebeem号码50010
sipp版本: SIPp v3.2-TLS-PCAP, version unknown, built Jul 17 2013, 21:50:11
user.csv脚本:
- SEQUENTIAL
- 50000;50010;[authentication username=50000 password=50000]
流程如下:
REGISTER ----------> SIP_server
401 <---------- SIP_server
REGISTER ----------> SIP_server
200 <---------- SIP_server
INVITE ----------> SIP_server
407 <---------- SIP_server
ACK ----------> SIP_server
INVITE ----------> SIP_server -- INVITE--------->50010(eyebeem)
100 <---------- SIP_server---100 <---------- 50010(eyebeem)
180 <---------- SIP_server---180 <---------- 50010(eyebeem)
200 <---------- SIP_server---200 <---------- 50010(eyebeem)
ACK ----------> SIP_server---ACK ---------->50010(eyebeem)
-----------RTP语音流(wireshark抓的语音包G711u.pcap)-----------
Pause [ 50.0s]
BYE ---------->
200 <----------
脚本如下:
- <?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. -->
- <!-- -->
- <!-- 首先发送SIP注册消息,Register。里面的From与To是注册的号码 -->
- <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]@[local_ip]:[local_port]>;tag=[call_number];rport
- 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: 300
- ]]>
- </send>
- <recv response="100" ptional="true">
- </recv>
- <!-- SIPp会收到来自AST要求验证的401 消息体,Recv意思为Receive,接收到来自AST的401要求验证的消息,Next为如果收到401,那么转至Label为1的地方进行操作 -->
- <recv response="401" auth="true" next="1">
- </recv>
- <!-- send invite with authentication messages -->
- <!-- 开始发送Register消息,里面将把验证的密码消息发送给对方,在消息体里面是抓不到密码消息的,而且已经被md5方式加密过。-->
- <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]@[local_ip]:[local_port]>;tag=[call_number];rport
- To: [field0] <sip:[field0]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 2 REGISTER
- Contact: sip:[field0]@[local_ip]:[local_port]
- [field2]
- Content-Length: [len]
- Expires: 3600
- ]]>
- </send>
- <recv response="100" ptional="true">
- </recv>
- <!-- 收到来自AST的200 ACK消息后,系统转至等待1000ms,或者可以直接去掉该设置 -->
- <recv response="200" next="2">
- </recv>
- <label id="2"/>
- <pause milliseconds="1000"/>
- <send retrans="500">
- <![CDATA[
- INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
- To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 1 INVITE
- Contact: sip:[field0]@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
- v=0
- o=[local_ip] 53655765 2353687637 IN IP[local_ip_type] [local_ip]
- s=-
- c=IN IP[local_ip_type] [local_ip]
- t=0 0
- m=audio [auto_media_port] RTP/AVP 8 0 101
- a=rtpmap:8 PCMA/8000
- a=rtpmap:0 PCMU/8000
- a=rtpmap:101 telephone-event/8000
- a=fmtp:101 0-16
- a=recvonly
- ]]>
- </send>
- <recv response="407" auth="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. -->
- <!-- 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:[field1]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
- To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 1 ACK
- Contact: sip:[field0]@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
- ]]>
- </send>
- <send retrans="500">
- <![CDATA[
- INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port]
- From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
- To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 2 INVITE
- Contact: sip:[field0]@[local_ip]:[local_port]
- [field2]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
- v=0
- o=[local_ip] 53655765 2353687637 IN IP[local_ip_type] [local_ip]
- s=-
- c=IN IP[local_ip_type] [local_ip]
- t=0 0
- m=audio [auto_media_port] RTP/AVP 8 0 101
- a=rtpmap:8 PCMA/8000
- a=rtpmap:0 PCMU/8000
- a=rtpmap:101 telephone-event/8000
- a=fmtp:101 0-16
- a=recvonly
- ]]>
- </send>
- <recv response="100" ptional="true">
- </recv>
- <recv response="183" ptional="true">
- </recv>
- <recv response="180" ptional="true">
- </recv>
- <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:[field1]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
- To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 ACK
- Contact: sip:[field0]@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
- ]]>
- </send>
- <!-- Play a pre-recorded PCAP file (RTP stream) -->
- <nop>
- <action>
- <exec play_pcap_audio="pcap/G711u.pcap"/>
- </action>
- </nop>
- <!-- Pause 8 seconds, which is approximately the duration of the-->
- <!-- PCAP file -->
- <pause milliseconds="50000"/>
- <!-- The 'crlf' option inserts a blank line in the statistics report.-->
- <send retrans="500">
- <![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]@[local_ip]:[local_port]>;tag=[call_number]
- To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 BYE
- Contact: sip:[field0]@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
- ]]>
- </send>
- <recv response="200" crlf="true">
- </recv>
- <pause milliseconds="5000"/>
- <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 -r 1 -i 192.168.0.102 -l 1 -sf branchc1.xml -inf user.csv 192.168.0.20
- prepare_pcap.c: Ignoring non UDP packet!
- In pcap pcap/G711u.pcap, npkts 3789
- max pkt length 180
- base port 10546
- Warning: open file limit > FD_SETSIZE; limiting max.
- # of open files to FD_SETSIZE = 64
- Resolving remote host '192.168.0.20'... Done.
- ----------------------- Scenario Screen -------- [1-9]: Change Screen --
- Call-rate(length) Port Total-time Total-calls Remote-host
- 1.0(0 ms)/1.000s 5060 144.66 s 3 192.168.0.20:5060(UDP)
- 0 new calls during 21.408 s period 1 ms scheduler resolution
- 1 calls (limit 1) Peak was 1 calls, after 1 s
- 0 Running, 0 Paused, 0 Woken up
- 0 dead call msg (discarded) 1 out-of-call msg (discarded)
- 3 open sockets
- 7809 Total RTP pckts sent 0.000 last period RTP rate (kB/s)
- Messages Retrans Timeout Unexpected-Msg
- REGISTER ----------> 3 0 0
- 100 <---------- 0 0 0 0
- 401 <---------- 3 0 0 0
- REGISTER ----------> 3 0 0
- 100 <---------- 0 0 0 0
- 200 <---------- 3 0 0 0
- Pause [ 1000ms] 3 0
- INVITE ----------> 3 0 0
- 407 <---------- 3 0 0 0
- ACK ----------> 3 0
- INVITE ----------> 3 0 0
- 100 <---------- 3 0 0 0
- 183 <---------- 0 0 0 0
- 180 <---------- 3 0 0 0
- 200 <---------- E-RTD1 3 0 0 0
- ACK ----------> 3 0
- [ NOP ]
- Pause [ 50.0s] 3 0
- BYE ----------> 2 0 0
- 200 <---------- 2 0 0 0
- Pause [ 5000ms] 2 0
- --------------------------- Test Terminated -----------------
- ------------- Statistics Screen ------- [1-9]: Change Screen--
- Start Time | 2013-07-25 20:20:35:856 1374754835.856243
- Last Reset Time | 2013-07-25 20:22:39:148 1374754959.148399
- Current Time | 2013-07-25 20:23:00:557 1374754980.557117
- -------------------------+---------------------------+--------
- Counter Name | Periodic value | Cumulative value
- -------------------------+---------------------------+---------
- Elapsed Time | 00:00:21:408 | 00:02:24:700
- Call Rate | 0.000 cps | 0.021 cps
- -------------------------+---------------------------+-------
- Incoming call created | 0 | 0
- OutGoing call created | 0 | 3
- Total Call created | | 3
- Current Call | 1 |
- -------------------------+---------------------------+----------
- Successful call | 0 | 2
- Failed call | 0 | 0
- -------------------------+---------------------------+---------
- Response Time 1 | 00:00:00:000 | 00:00:03:336
- Call Length | 00:00:05:113 | 00:00:40:770
- ------------------------------ Test Terminated ----------------