SIP压测工具sipp,免费,开源,功能足够强大,配置灵活,优点多。
本文档介绍sipp工具如何带媒体测试,并介绍如何制作可用的媒体文件(G729和PCMA)。
centos7.9
freeswitch1.10.7
sipp v3.6.2_rc1
sipp支持通过exec调用play_pcap_audio来发送媒体流,但是要求媒体流是pcap格式。
sipp中自带的只有G711a的媒体流文件,只有8秒长度,并且媒体包抖动过大,不好用。
我们可以通过freeswitch + sngrep抓包自己制作两个媒体流文件。
修改freeswitch注册号码的拨号计划,找一个好听的音乐传到sounds目录。
打开sngrep抓包(信令+媒体)
sudo sngrep -c -r
通话30秒后挂断电话,在sngrep中保存抓包,选择“(*) .pcap (SIP + RTP)”模式。
将pcap文件下载到本地,使用wireshark打开。
在wireshark中选择“电话”->“RTP”->“RTP流”,选中fs发送的媒体流,点击“play streams”。
试听抓包的媒体流复合要求。
点击“RTP流”页面上的“prepare filter”按钮过滤当前媒体流的数据包。
选择“文件”->“导出特定分组”,保存到文件“sipp-PCMA-30s.pcap”。
一个符合sipp要求的G711的媒体流文件就制作好了。
G729的媒体流文件的制作过程基本一致,只需要在sipua上修改codec为G729,再通过sngrep抓包,和wireshark过滤G729媒体包并保存即可。
在sipp.3.6.2/docs目录下有常用的默认脚本,参考“sippdocsuac_pcap.xml”修改自己的带媒体脚本。
在收到200 OK应答之后,播放“sipp-PCMA-30s.pcap”文件。
vi uac-test-pcap.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
INVITE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0]
To: [field1]
Call-ID: [call_id]
CSeq: 1 INVITE
Contact: sip:sipp@[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 8 18
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=ptime:20
]]>
ACK sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0]
To: [field1]
Call-ID: [call_id]
CSeq: 1 ACK
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0
]]>
BYE sip:[field1]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0]
To: [field1]
Call-ID: [call_id]
CSeq: 2 BYE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
Content-Length: 0
]]>
UAS脚本不需要修改,略过
服务端uas,带参数“-rtp_echo”使得UAS自动echo媒体流。
sudo sipp -i 10.55.55.138 -p 5555 -sf uas-test.xml -rtp_echo
客户端uac,从uac的显示中可以看到是有正常发包。
sudo sipp -i 10.55.55.138 -p 6666 -inf call-test.csv -sf uac-test-pcap.xml 10.55.55.137:3060 -rp 1000 -r 25 -l 8192 -m 9999
sipp的github地址:https://github.com/SIPp/sipp
后续会有更多的压测方案和脚本慢慢写。
空空如常
求真得真
页面更新:2024-05-11
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2008-2024 All Rights Reserved. Powered By bs178.com 闽ICP备11008920号-3
闽公网安备35020302034844号