sipp压测fresswitch之呼叫篇

根据之前写的一篇微博关于sipp压测fresswitch之账号注册的后续

在用户注册完成后,此时uac和uas都有了自己账号,流程类似(uac是小明)(uas是小红),现在小明给小红拨打电话需要进行几个步骤
在这里插入图片描述
大概流程是这样,现在需要两个脚本(呼叫+接听)和两个csv文件(呼叫手机号+接听手机号)
例如:1000—2000是呼叫手机号,3000—4000是接听手机号,那么就是1000呼叫3000这么对应着来。
用上之前注册的csv对应上就可以了

uac.csv
SEQUENTIAL
1000;3000;[authentication username=1000 password=1000]
1001;3001;[authentication username=1001 password=1001]
1002;3002;[authentication username=1002 password=1002]
1003;3003;[authentication username=1003 password=1003]

uas.csv
SEQUENTIAL
3000;3000;[authentication username=3000 password=3000]
3001;3001;[authentication username=3001 password=3001]
3002;3002;[authentication username=3002 password=3002]
3003;3003;[authentication username=3003 password=3003]

呼叫call_uac.xml

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

<scenario name="UAC with media">
  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
  <!-- generated by sipp. To do so, use [call_id] keyword.                -->
  <send retrans="500">
    <![CDATA[

        INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
        Via: SIP/2.0/[transport] [local_ip]:[local_port];received=192.168.149.47:7160;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=FreeSWITCH 1574118064 1574118065 IN IP4 47.100.53.252
        s=FreeSWITCH
        c=IN IP4 47.100.53.252
        t=0 0
        m=audio 24714 RTP/AVP 18 101
        7a=rtpmap:18 G729/8000
        a=rtpmap:101 telephone-event/8000
        a=fmtp:101 0-16
        a=ptime:20
        a=sendrecv



    ]]>
  </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" crlf="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: 1 ACK
        Contact: sip:[field0]@[local_ip]:[local_port]
        Max-Forwards: 70
        Subject: Performance Test
        Content-Length: 0


    ]]>
  </send>

  <!-- pause milliseconds="10000"/  -- >


  <!-- The 'crlf' option inserts a blank line in the statistics report. -->

  <pause milliseconds="60000"/>

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

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

接听:call_uas.xml

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

<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Basic UAS responder">

<recv request="INVITE" crlf="true">
</recv>
<send>
    <![CDATA[
      SIP/2.0 180 Ringing
      [last_Via:]
      [last_From:]
      [last_To:];tag=[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
      Content-Length: 0
    ]]>
</send>
<send retrans="500">
    <![CDATA[
      SIP/2.0 200 OK
      [last_Via:]
      [last_From:]
      [last_To:];tag=[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
      Content-Type: application/sdp
      Content-Length: [len]

	v=0
	o=FreeSWITCH 1574118064 1574118065 IN IP4 47.100.53.252
	s=FreeSWITCH
	c=IN IP4 47.100.53.252
	t=0 0
	m=audio 24714 RTP/AVP 18 101
	7a=rtpmap:18 G729/8000
	a=rtpmap:101 telephone-event/8000
	a=fmtp:101 0-16
	a=ptime:20
	a=sendrecv
    ]]>
</send>
<recv request="ACK" optional="true" rtd="true" 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:]
      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
      Content-Length: 0
    ]]>
</send>
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>

<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>

先启动uas
命令行:uas
sipp -sf call_uas.xml -inf uas_reg.csv 192.168.149**** -m 100000 -i 192.168.149.**** -aa -l 400
命令行:uac
sipp -sf call_uac.xml -inf uac_reg.csv 192.168.149.**** -m 100000 -i 192.168.149.**** -aa -l 400

前面的ip是fresswitch所在ip,后面-i的是本机sipp所在ip

注:如有错误不足地方还请指点修改。

																		2020/3/27
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面是freeswitch压测sipp的具体步骤和命令: 1. 安装sipp: 可以使用以下命令安装sipp: ``` sudo apt-get update sudo apt-get install -y sipp ``` 2. 配置sipp: 使用以下命令创建一个sipp配置文件: ``` nano sipp_scenario.xml ``` 在文件中添加以下内容: ``` <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <!DOCTYPE scenario SYSTEM "sipp.dtd"> <scenario name="SIPp UAS"> <send> <![CDATA[ SIP/2.0 200 OK Via: SIP/2.0/UDP 127.0.0.1; From: <sip:[email protected]>;tag=1 To: <sip:[email protected]>;tag=2 Call-ID: 1 CSeq: 2 INVITE Content-Length: 0 ]]> </send> </scenario> ``` 该配置文件会发送一个200 OK响应,表示呼叫已经成功接通。 3. 配置freeswitch: 使用以下命令编辑sip_profile.xml文件: ``` nano /usr/local/freeswitch/conf/sip_profiles/internal.xml ``` 在文件中添加以下内容: ``` <param name="ping" value="true"/> ``` 该配置会启用ping功能,用于测试freeswitch的响应时间。 4. 启动sipp: 使用以下命令启动sipp: ``` sipp -sf sipp_scenario.xml -s tester -l 10 -m 10 -p 5060 127.0.0.1:5080 ``` 上述命令的参数含义如下: - `-sf`: 指定sipp的配置文件。 - `-s`: 指定sipp发送的SIP消息中的用户名。 - `-l`: 指定sipp启动的并发流量数。 - `-m`: 指定sipp发送的呼叫总数。 - `-p`: 指定sipp发送的SIP消息中的端口号。 - `127.0.0.1:5080`: 指定freeswitch的IP地址和端口号。 5. 运行测试: 运行上述命令后,sipp将会向freeswitch发送呼叫请求。测试结果会被记录在控制台输出中。可以根据测试结果进行调整和优化。 需要注意的是,上述命令中的参数需要根据具体情况进行调整,以使测试结果最佳。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值