sipp单机压测freeswitch第4篇压测点对点呼叫

SIPp压测点对点呼叫,主要是使用官方提供的g711a.pcap模拟语音发起,在呼叫成功后Freeswitch播放一个音频文件可以是wav,SIPp后续开启Rtp回显功能,模拟双方相互发言

audioCall脚本xml

脚本大概意思是:发起成功后执行5分钟后自己挂断

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Loop Audio 10">
  <send retrans="500">
    <![CDATA[

      INVITE sip:00001234@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[field0]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
      To:  <sip:00001234@[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=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>

  <recv response="100"
        optional="true">
  </recv>

  <recv response="180" optional="true">
  </recv>

  <recv response="183" optional="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.                             -->
  <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:00001234@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[field0]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
      To: <sip:00001234@[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>
    <!--   最好Freeswitch设置播放视频,SIPp回显,注释掉这段代码  --> 
    <!--
  <nop>
    <action>
      <exec play_pcap_audio="/root/sip_test/pcap/g711a.pcap"/>
    </action>
  </nop>
-->

  <pause milliseconds="300000"/>

  <send retrans="500">
    <![CDATA[

      BYE sip:00001234@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[field0]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
      To:  <sip:00001234@[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>

  <!-- definition of the response time repartition table (unit is ms)   -->
  <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>
账号csv
SEQUENTIAL
yyh0001;[authentication username=yyh0001 password=123456]
yyh0002;[authentication username=yyh0002 password=123456]
压测指令解析
# -t tn:  每个呼叫是一个tcp(建议开启,这样模拟起来相对真实)
# -rtp_echo:  启用 RTP 回显
# -r 20 -rp 1000: 每秒注册20个账号
# -m 5000: 注册到达5000后停止脚本
# -trace_msg: 开启后打印所有过程中的消息(如果有错误建议开启,只能看到交互的消息,无法看到rtp传输)
# -trace_screen: 结束后吧结果打印到屏幕上
# -trace_err: 开启后打印错误消息
# remote_ip: 被压测Fs地址
# remote_port: 被压测Fs端口
sipp [remote_ip]:[remote_port] -inf [csv] -sf [xml]  -m [Number] -r [Number] -rp [Number] -t tn -rtp_echo -trace_screen -trace_err
使用
# 使用account.csv,按照每秒20个并发发起呼叫,呼叫执行40次
sipp 102.95.28:5060 -inf account.csv -sf audioCall.xml  -m 40 -r 20 -rp 1000 -t tn -rtp_echo -trace_screen -trace_err
  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
为了编写一个SIP压测FreeSWITCH的脚本,您可以使用SIPp工具。SIPp是一个开源的SIP协议测试和性能评估工具,它可以模拟SIP终端和服务器,生成和接收SIP请求,以及对SIP网络进行压力测试。 下面是一个简单的SIPp脚本示例,用于模拟SIP终端向FreeSWITCH服务器发送呼叫请求: ``` <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE scenario SYSTEM "sipp.dtd"> <scenario name="SIPp Scenario"> <send retrans="500"> <![CDATA[ INVITE sip:test@freeswitch-server SIP/2.0 Via: SIP/2.0/UDP 192.168.0.1:5060;branch=z9hG4bK-1234 From: <sip:caller@test.com>;tag=1234 To: <sip:test@freeswitch-server> Call-ID: call-1234@192.168.0.1 CSeq: 1 INVITE Contact: <sip:caller@192.168.0.1:5060> Content-Type: application/sdp Content-Length: 150 v=0 o=- 1234 5678 IN IP4 192.168.0.1 s=Test call c=IN IP4 192.168.0.1 t=0 0 m=audio 10000 RTP/AVP 0 a=rtpmap:0 PCMU/8000 ]]> </send> <recv response="100" optional="true"/> <recv response="180" optional="true"/> <recv response="183" optional="true"/> <recv response="200"/> <send> <![CDATA[ ACK sip:test@freeswitch-server SIP/2.0 Via: SIP/2.0/UDP 192.168.0.1:5060;branch=z9hG4bK-5678 From: <sip:caller@test.com>;tag=1234 To: <sip:test@freeswitch-server>;tag=5678 Call-ID: call-1234@192.168.0.1 CSeq: 1 ACK Contact: <sip:caller@192.168.0.1:5060> Content-Length: 0 ]]> </send> <pause milliseconds="5000"/> <send> <![CDATA[ BYE sip:test@freeswitch-server SIP/2.0 Via: SIP/2.0/UDP 192.168.0.1:5060;branch=z9hG4bK-4321 From: <sip:caller@test.com>;tag=1234 To: <sip:test@freeswitch-server>;tag=5678 Call-ID: call-1234@192.168.0.1 CSeq: 2 BYE Contact: <sip:caller@192.168.0.1:5060> Content-Length: 0 ]]> </send> <recv response="200"/> </scenario> ``` 该脚本使用SIPp模拟一个基本的SIP呼叫流程,包括发送INVITE请求、接收100、180、183和200响应、发送ACK请求、等待5秒钟
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值