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