sipp register 脚本

3 篇文章 0 订阅

 1 <?xml version="1.0" encoding="ISO-8859-1" ?>
  2 <!DOCTYPE scenario SYSTEM "sipp.dtd">
  3 <!-- This program is free software; you can redistribute it and/or      -->
  4 <!-- modify it under the terms of the GNU General Public License as     -->
  5 <!-- published by the Free Software Foundation; either version 2 of the -->
  6 <!-- License, or (at your option) any later version.                    -->
  7 <!--                                                                    -->
  8 <!--                                                                    -->
  9 <scenario name="reg">
 10   <label id="1"/>
 11   <send retrans="500">
 12     <![CDATA[
 13       REGISTER sip:[field1] SIP/2.0
 14       Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch];rport
 15       From:<sip:[field0]@[field1]>;tag=[call_number]
 16       To:<sip:[field0]@[field1]>
 17       Max-Forwards: 7
 18       Call-ID: [call_id]
 19       CSeq: 1 REGISTER
 20       Contact: sip:[field0]@[local_ip]:[local_port]
 21       User-Agent: Sipp
 22       X-cid: [call_id]
 23       Content-Length: 0
 24       Expires: 3600
 25     ]]>
 26   </send>
 27 
 28   <recv response="401" auth="true" next="2">
 29   </recv>
 30 
 31  <label id="2"/>
 32   <send retrans="500">
 33     <![CDATA[
 34  
 35       REGISTER sip:[field1] SIP/2.0
 36       Via: SIP/2.0/[transport] [local_ip]:[local_port]; branch=[branch];rport
 37       From: <sip:[field0]@[field1]>;tag=[call_number]
 38       To: <sip:[field0]@[field1]>
 39       Max-Forwards: 7
 40       Call-ID: [call_id]
 41       CSeq: 2 REGISTER
 42       Contact: sip:[field0]@[local_ip]:[local_port]
 43       User-Agent: Sipp
 44       X-cid: [call_id]
 45       [field2]
 46       Content-Length: 0
 47       Expires: 3600
 48     ]]>
 49 
 50   </send>
 51 
 52   <recv response="200" >
 53   </recv>
 54 
 55   <!-- definition of the response time repartition table (unit is ms)   -->

 56   <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
 57   <!-- definition of the call length repartition table (unit is ms)     -->
 58   <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
 59 </scenario>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SIPp可以使用XML脚本来描述SIP会话。盲转是一种SIP功能,允许用户在不知道目标URI的情况下将呼叫转移到其他URI。下面是一个基本的SIPp盲转脚本示例: ```xml <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE scenario SYSTEM "sipp.dtd"> <!-- 定义变量 --> <scenario name="Blind Transfer" description="Blind Transfer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <send retrans="500" trcount="1"> <![CDATA[ INVITE sip:user1@192.168.1.1 SIP/2.0 Via: SIP/2.0/UDP 192.168.1.2:5060;branch=z9hG4bK12345 From: sip:user2@192.168.1.2;tag=12345 To: sip:user1@192.168.1.1 Call-ID: 12345@192.168.1.2 CSeq: 1 INVITE Contact: sip:user2@192.168.1.2:5060 Content-Type: application/sdp Content-Length: 0 ]]> </send> <!-- 等待100 Trying响应 --> <recv response="100" optional="true"> </recv> <!-- 等待200 OK响应 --> <recv response="200"> <!-- 提取From标头 --> <check_from uri="sip:user2@192.168.1.2" /> <!-- 提取To标头 --> <check_to uri="sip:user1@192.168.1.1" /> <!-- 提取Contact标头 --> <check_contact /> <!-- 提取SDP信息 --> <check_body content="audio" /> </recv> <!-- 发送盲转请求 --> <send retrans="500" trcount="1"> <![CDATA[ REFER sip:user3@192.168.1.3 SIP/2.0 Via: SIP/2.0/UDP 192.168.1.2:5060;branch=z9hG4bK12346 From: sip:user2@192.168.1.2;tag=12345 To: sip:user1@192.168.1.1 Call-ID: 12345@192.168.1.2 CSeq: 2 REFER Contact: sip:user2@192.168.1.2:5060 Refer-To: <sip:user3@192.168.1.3> ]]> </send> <!-- 等待202 Accepted响应 --> <recv response="202"> </recv> <!-- 等待BYE请求 --> <recv request="BYE"> <!-- 提取From标头 --> <check_from uri="sip:user2@192.168.1.2" /> <!-- 提取To标头 --> <check_to uri="sip:user3@192.168.1.3" /> </recv> <!-- 发送200 OK响应 --> <send> <![CDATA[ SIP/2.0 200 OK Via: SIP/2.0/UDP 192.168.1.2:5060;branch=z9hG4bK12347 From: sip:user2@192.168.1.2;tag=12345 To: sip:user3@192.168.1.3 Call-ID: 12345@192.168.1.2 CSeq: 3 BYE Contact: sip:user2@192.168.1.2:5060 Content-Length: 0 ]]> </send> </scenario> ``` 如上所示,该脚本首先发送一个INVITE请求,等待100 Trying响应和200 OK响应。然后,发送一个REFER请求,将呼叫转移给URI为`<sip:user3@192.168.1.3>`的用户。最后,等待BYE请求和200 OK响应。在发送和接收消息时,可以使用`<check_*>`元素从SIP消息中提取信息,以便进行后续处理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值