sipp uas 脚本

这是一个SIPP(Simple Internet Protocol Performance Tester)的基本UAS(User Agent Server)响应场景脚本。脚本详细定义了如何响应INVITE请求,包括发送100 Trying、180 Ringing和200 OK消息。它还处理ACK和BYE请求,并包含了INFO消息来启动呼叫记录。

<?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 'uas' scenario.                       -->
<!--                                                                    -->

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


  <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 occurences are concatenated (CRLF seperated)        -->
  <!-- to be used in place of the '[last_*]' keyword.                   -->

  <send>
    <![CDATA[
      SIP/2.0 100 Trying
      [last_Via:]
      [last_From:]
      [last_To:];tag=[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      [last_Record-Route:]
      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
      Content-Length: 0
    ]]>
  </send>
  <send>
    <![CDATA[
      SIP/2.0 180 Ringing
      [last_Via:]
      [last_From:]
      [last_To:];tag=[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      [last_Record-Route:]
      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
      Content-Length: 0
    ]]>
  </send>
 
  <!-- ring tone time  -->
  <pause milliseconds="1000"/>

  <send retrans="2000">
    <![CDATA[
      SIP/2.0 200 OK
      [last_Via:]
      [last_From:]
      [last_To:];tag=[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      [last_Record-Route:]
      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>

<!--
      m=audio [media_port] RTP/AVP 102
      a=rtpmap:102 opus/48000/2
      a=fmtp:102 useinbandfec=1; usedtx=1; maxaveragebitrate=64000 
-->
  <recv request="ACK"
        rtd="true"
        crlf="true">
    <action>
        <ereg regexp="sip:(.*)@(.*)>"
              search_in="hdr"
              header="From: "
              assign_to="1,2,3"/>
        <ereg regexp="sip:(.*)@"
              search_in="hdr"
              header="To: "
              assign_to="4,5"/>
        <ereg regexp="(.*)"
              search_in="hdr"
              header="Call-ID: "
              assign_to="6"/>
        <ereg regexp="tag=(.*)"
              search_in="hdr"
              header="From: "
              assign_to="7"/>
        <ereg regexp="tag=(.*)"
              search_in="hdr"
              header="To: "
              assign_to="8"/>
        <ereg regexp="@(.*)>"
              search_in="hdr"
              header="Contact: "
              assign_to="9,10"/>
       <log message="1 is [$1], 4 is [$4], [$9]"/>
    </action>
  </recv>

  <send retrans="500">
    <![CDATA[
      INFO sip:[$10] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[$5]@[$3]>;[$8]
      To: <sip:[$2]@[$3]>;[$7]
      Call-ID: [$6]
      CSeq: 1 INFO
      Contact: <sip:[$5]@[local_ip]:[local_port]>
      Max-Forwards: 7
      Subject: Performance Test
      Route: <sip:10.100.125.17;lr>
      User-Agent: Sipp
      Content-Type: application/json
      Content-Length: [len]

      {
       "request" : {
                   "command" : "startcallrecord",
                   "reqid" : 1
                   }
      }
    ]]>
  </send>

  <recv response="200" 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:]
      [last_Record-Route:]
      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.               -->
  <!--<pause milliseconds="1000"/>-->


  <!-- definition of the response time repartition table (unit is ms)   -->
  <ResponseTimeRepartition value="1000, 2000, 3000, 5000, 10000,32000"/>

  <!-- definition of the call length repartition table (unit is ms)     -->
  <CallLengthRepartition value="1000, 5000, 10000, 15000, 20000, 25000, 30000"/>

</scenario>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值