本文更新于2022-05-14,使用SIPp v3.5.3。
官网:http://sipp.sourceforge.net/。
(资料图)
中文文档:http://sipp.sourceforge.net/doc/cn-reference.pdf。
安装
其它版本请于官网下载。
wget https://github.com/SIPp/sipp/releases/download/v3.5.3/sipp-3.5.3.tar.gztar -xzf sipp-3.5.3.tar.gzcd sipp-3.5.3/./build.shsudo cp sipp /usr/local/bin/sipp
使用
sipp HOST[:PORT] [OPTIONS]
OPTIONS可为:
- -aa:对INFO、NOTIFY、OPTIONS、UPDATE自动回复200 OK。
- -d:每个呼叫的持续时间,单位为毫秒。
- -inf CSVFILENAME:CSV数据文件。
- -p PORT:sipp监听的端口。默认为5060(与freeswitch默认的internal Profile端口相同)。
- -r N:每秒发起的请求数。
- -rtp_echo:将收到的RTP流原样返回。
- -s USERNAME:被呼方用户名。默认为service。
- -sf XMLFILENAME:XML场景文件。
- -sn SCENARIO:使用默认的场景文件。uac作为UAC(即SIP客户端)。
运行时可使用1、2、3、4按键切换界面的显示信息。
示例
注册测试
sipp 192.168.1.1:5060 -aa -sf reg.xml -inf users.csv -r 10 -p 6060
reg.xml场景文件的内容如下(官网有示例文件http://sipp.sourceforge.net/doc/branchc.xml,不过需修改才能使用):
From: [field0] ;tag=[call_number] Call-ID: [call_id] CSeq: 1 REGISTER Expires: 3600 User-Agent: SIPp Content-Length: 0 ]]> From: [field0] ;tag=[call_number] Call-ID: [call_id] CSeq: 2 REGISTER Expires: 3600 User-Agent: SIPp Content-Length: [len] ]]>
users.csv数据文件的内容如下(该文件提供注册用户的用户名和密码,SEQUENTIAL
表示顺序执行):
SEQUENTIAL1001;[authentication username=1001 password=1234]1002;[authentication username=1002 password=1234]1003;[authentication username=1003 password=1234]
呼叫测试(使用默认场景)
sipp 192.168.1.1:5080 -sn uac -r 1 -d 10000 -rtp_echo -s 9664
需先在public Dialplan中为9664添加相应的路由。
呼叫测试(使用场景文件)
sipp 192.168.1.1:5080 -sf uac.xml -r 1 -d 10000 -rtp_echo -s 9664
需先在public Dialplan中为9664添加相应的路由。
uac.xml场景文件可以在官网查看:http://sipp.sourceforge.net/doc/uac.xml.html。文件内容如下:
;tag=[call_number] To: sut 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 0 a=rtpmap:0 PCMU/8000 ]]> ;tag=[call_number] To: sut [peer_tag_param] Call-ID: [call_id] CSeq: 1 ACK Contact: sip:sipp@[local_ip]:[local_port] Max-Forwards: 70 Subject: Performance Test Content-Length: 0 ]]> ;tag=[call_number] To: sut [peer_tag_param] Call-ID: [call_id] CSeq: 2 BYE Contact: sip:sipp@[local_ip]:[local_port] Max-Forwards: 70 Subject: Performance Test Content-Length: 0 ]]>