SIPp常用脚本之三:UAC

UAC是作为SIP消息的发起端,可以控制消息速率什么的,方便极了。

一、uac.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Basic Sipstone UAC">
  <send retrans="500">
    <![CDATA[
      INVITE sip:[field1]@10.130.16.42:5060 SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: [field0] <sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]
      To: <sip:[field1]@[remote_ip]:5060>
      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=HuaweiFlexit1.0 20004 20004 IN IP4 10.130.30.7
      s=A call
      c=IN IP4 10.130.30.7
      t=1228447938 1228451538
      m=audio 10500 RTP/AVP 18 4 8 0 97
      a=rtpmap:18 G729/8000
      a=fmtp:18 annexb=no
      a=rtpmap:4 G723/8000
      a=rtpmap:8 PCMA/8000
      a=rtpmap:0 PCMU/8000
      a=rtpmap:97 telephone-event/8000
      a=fmtp:97 0-15
      a=sendrecv
      m=video 10510 RTP/AVP 34 98
      b=AS:376
      a=rtpmap:34 H263/90000
      a=fmtp:34 QCIF=1 CIF=4 MaxBR=3760
      a=rtpmap:98 MP4V-ES/90000
      a=fmtp:98 profile-level-id=2
      a=sendrecv
    ]]>
  </send>

  <recv response="100" >
  </recv>
  <recv response="180" >
  </recv>

  <recv response="200" >
  </recv>

   <send>
    <![CDATA[
      ACK sip:mod_sofia@10.130.16.42:5060;transport=udp SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: [field0] <sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]
      To: <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
      Call-ID: [call_id]
      CSeq: 1 ACK
      Max-Forwards: 70
      Subject: Performance Test
      Content-Length: 0
    ]]>
  </send>
  <pause milliseconds="5000"/>
  <send retrans="500">
    <![CDATA[
      BYE sip:[field0]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: [field0] <sip:[field0]@[remote_ip]:[remote_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>
  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>

 

二、uac.sh

1. TCP方式启动

./sipp -sf uac.xml -i 本地服务器地址 -p 本地服务器端口 业务服务器地址:端口 -r 50 -t tn -max_socket 1024

2. UDP方式启动

./sipp -sf uac.xml -i 本地服务器地址 -p 本地服务器端口 业务服务器地址:端口 -r 50

 

三、一点说明

-r 50 是每秒发送50条SIP消息。

 

posted @ 2017-08-15 12:13  一沙世界  阅读(4655)  评论(0编辑  收藏  举报