sipp使用秘笈v12Word文件下载.docx
《sipp使用秘笈v12Word文件下载.docx》由会员分享,可在线阅读,更多相关《sipp使用秘笈v12Word文件下载.docx(26页珍藏版)》请在冰豆网上搜索。
uac后面的参数次序不能有错,必须按照此顺序进行)
3.4.程序启动后的常用操作
‘+’呼叫速率加1
‘-‘呼叫速率减1
‘*’呼叫速率加10
‘/‘呼叫速率减10
暂停呼叫:
按键盘上的p键来暂停呼叫,再次按p键则重新开始。
停止呼叫:
按键盘上的q键来停止呼叫。
注意千万不要用Ctrl+c来强行终止程序,应该使用q键来停止程序,用q键停止程序后程序会发送bye消息来释放呼叫。
如果强行停止会导致呼叫被吊死在设备上。
高级进阶
4.命令修改
4.1.uas命令修改方法
在弹出的dos命令行中输入uas即可。
这样就启动了uas
这是启动了uas.bat批处理文档
实际启动命令如下:
sipp-snuas-p5090-sfuas.xml-infcall.csv-trace_err-trace_screen
rem-s2000
可以看到监听端口为5090因此在TG的配置中对局端口应该填写为此端口,如果用户需要修改端口则修改uas.bat文件即可。
-sn指定sipp启动的是uas服务既服务器端。
-sf指定使用的场景文件为uas.xml.
call.csv这个主要是呼叫号码的文件,下文将会详细介绍。
-trace_err跟踪所有错误消息,并把错误消息保存到文件场景文件描述的<
file_name>
_<
pid>
_errors.log文件中
-trace_screen当程序结束时候打印统计信息并弹出屏幕(如果在后台运行的话)
4.2.uac命令修改方法
uac启动启动方式同uas
在dos中输入uachostiphostport每秒呼叫个数总呼叫个数
比如uac172.16.55.2045060410000
表示呼叫的目标主机是172.16.55.204对方端口是5060每秒发起4个呼叫,总呼叫数目为10000
注:
对本公司的TG测试中hostip就是指TG产品中配置的对局地址是本机IP地址的TG产品。
如下为TG1000配置sip中继的窗口
对局就是您现在所用电脑的ip地址。
0如果作为呼出端也就是您启用uac这个命令,那么该TG配置端口为5060,或者5070都可以。
但是如果您电脑作为呼叫接收端也就是启动uas命令,那么这里的ip地址填您自己的主机地址,端口需要填uas默认端口(5090),具体参考uas命令修改。
实际启动文件为uac.bat这个批处理文档(注:
rem后面内容表示注释)
实际启动命令为:
sipp%1:
%2-sfuac.xml-infcall.csv-p5070-r%3-rp1s-m%4-trace_err-trace_screen
其中%1,%2为传递命令行参数第一个和第二个即uac172.16.55.204
-sf,-inf,-p同上
-r指定每秒发起呼叫数(如果指定参数-rp则即为-rp所指定的时间内发起的呼叫数)
–rp表示频率周期,即-r的周期。
后面详述
上例指定-rp为1s则-r就表示1s内发起的呼叫数目
-m指定测试的呼叫总数,当达到m指定的数目时候停止呼叫,程序结束
5.配置文件修改
5.1.被叫号码的修改
主被叫号码放在文件xxx.csv文件中,从3.1节我们看到实际启动时候指定了-inf参数都默认指向了call.csv文件因此需要修改call.csv文件。
call.csv文件第一行需要说明数据读取方式,SEQUENTIAL为顺序读取,RANDOM为随机读取,USER为用户习惯,#后面的内容为注释
例如下面是截取一个call.csv文件的内容
SEQUENTIAL
81000;
9129;
10000;
81001;
10001;
81011;
10011;
我们看到除了第一行,每一行都有三个字段。
这就对应了场景文件中的field0,field1,field2
如下截取uac.xml场景文件,假如是第一个呼叫,使用第二行
<
sendretrans="
500"
>
!
[CDATA[
INVITEsip:
[field1]@[remote_ip]:
[remote_port]SIP/2.0
Via:
SIP/2.0/[transport][local_ip]:
[local_port];
branch=[branch]
From:
sipp<
sip:
[field0]@[local_ip]:
[local_port]>
;
tag=[call_number]
To:
sut<
[remote_port]>
Call-ID:
[call_id]
CSeq:
1INVITE
Contact:
sip:
sipp@[local_ip]:
[local_port]
Max-Forwards:
70
Subject:
PerformanceTest
Content-Type:
application/sdp
Content-Length:
[len]
v=0
o=user1536557652353687637INIP[local_ip_type][local_ip]
s=-
c=INIP[local_ip_type][local_ip]
t=00
m=audio[field2]RTP/AVP8
a=rtpmap:
8PCMA/8000
101telephone-event/8000
a=fmtp:
1010-11,16
]]>
<
/send>
从上可以看出,call.csv文件定义了sip协议中呼叫的号码和主叫号码,因此这个文件的配置相当重要,否则电话有可能拨不通,我们看field1字段,是填充在to中的,是要拨出去的电话号码,因此TG上的字冠设置应该与此字段项匹配。
使用多个.csv文件
如果你想使用几个文件配合使用,比如你想让field0的名字是顺序的,而field1得名字是随机的。
使用两个文件就可以,你可能需要一个文件caller.csv使用SEQUENTIAL作为第一行,还需要一个callee.csv使用RANDOM作为第一行。
在场景文件中用file=xxx.csv来指定所使用的文件
如:
INVITEsip:
[field0file="
callee.csv"
]SIP/2.0
From:
sippuser<
caller.csv"
]>
tag=[pid]SIPpTag00[call_number]
To:
sutuser<
...
这样就从callee中选取目标用户,而从caller中选取发送用户。
5.2.呼叫过程使用RTP流
uac.xml:
(不传rtp流就注释下面这段)
nop>
action>
execplay_pcap_audio="
pcap/g711u_30s.pcap"
/>
/action>
/nop>
其中g711u_30s.pcap保存在同目录下的pcap文件夹下,可以修改指定的rtp流文件。
这个是一个30s时间的rtp流。
注:
xml的注释方法<
--要注释的内容-->
5.3.呼叫保持时间修改
Uac.xml:
pausemilliseconds="
5000"
//单位为ms
5.4.并发呼叫的最大次数修改
使用-l选项设定同时呼叫的最大次数,能够对sip中继产生脉冲式压力测试。
在uac.bat文件中添加此选项如下:
未添加:
%2-sfuac.xml-infcall.csv-p5070-r%3-rp1s-m%4-trace_err-trace_screen
添加后:
%2-sfuac.xml-infcall.csv-p5070-l120-r%3-rp1s-m%4-trace_err-trace_screen
(可以添加在任何合适的位置)
限制同时呼叫最大次数为120,当呼叫次数达到120的时候,新的呼叫不会继续。
只有当呼叫降下来后才会开始新的呼叫。
因此如果需要产生强烈的脉冲信号,必须让呼叫保持时间足够,并且每秒呼叫次数要提高,这样才能“瞬间达到最大值”。
6.呼叫结果分析
上图显示了sip呼叫过程中的各个流程
最上面的为统计消息,call-reate是呼叫的速率。
Port为使用的端口
Total-time为使用的时间
Total-calls为呼叫的总数
Remote-host
为远程主机ip地址
112calls<
limit330>
表示当前保持呼叫数目为1120,最大允许并发呼叫数目为330
Peakwas117calls,after81s表示81s内的峰值为30
Unexpected-msg为不正常消息,也就是呼损发生了我们看到
100-----那一行Unexpected-msg数值为20则说明有呼损
呼叫结束后,按q键退出。
出现统计信息如下图:
可以观察到成功呼叫个数和失败个数
7.其他帮助
7.1.RTP流文件修改制作
在测试过程中常常需要携带RTP流,此时需要有相应的RTP流文件。
RTP流文件存放在sipp根目录下的pcap目录下。
实际使用中需要不同时长的RTP文件,此时就需要修改时长。
这里提供一种方法
比如我们需要5s时长的RTP文件
操作如下:
使用wireshark打开一个已经存在的rtp流文件\
可以看到如下界面
第一列是No,表示序号
第二列是Time是时间标签
我们现在需要5s的RTP流
找到时间标签为4.9.xxxx的时间标签对应的NO,要记住
现在选择文件->
saveas弹出如下对话框
选择左下角选项,range在里面输入0-250
输入文件名,保存就可以使用了
(注:
rtp流文件在sipp中被执行(只执行一次,文件传输完毕,除非sipp呼叫截止),并不包含在sip流程中,也就是说对pause呼叫保持时间不会产生任何的影响。
而且实际传输中这个时间并不能保证精确。
请测试时候注意)
8.Sipp参数列表
Usage:
sippremote_host[:
remote_port][options]
Availableoptions:
-v:
Displayversionandcopyrightinformation.
-aa:
Enableautomatic200OKanswerforINFO,UPDATEand
NOTIFYmessages.
-auth_uri:
ForcethevalueoftheURIforauthentication.
Bydefault,theURIiscomposedof
remote_ip:
remote_port.
-base_cseq:
Startvalueof[cseq]foreachcall.
-bg:
LaunchSIPpinbackgroundmode.
-bind_local:
BindsockettolocalIPaddress,i.e.thelocalIP
addressisusedasthesourceIPaddress.IfSIPpruns
inservermodeitwillonlylistenonthelocalIP
addressinsteadofallIPaddresses.
-buff_size:
Setthesendandreceivebuffersize.
-calldebug_file:
Setthenameofthecalldebugfile.
-calldebug_overwrite:
Overwritethecalldebugfile(defaulttrue).
-cid_str:
CallIDstring(default%u-%p@%s).%u=call_number,
%s=ip_address,%p=process_number,%%=%(inanyorder).
-ci:
SetthelocalcontrolIPaddress
-cp:
Setthelocalcontrolportnumber.Defaultis8888.
-d:
Controlsthelengthofcalls.Moreprecisely,this
controlsthedurationof'
pause'
instructionsinthe
scenario,iftheydonothavea'
milliseconds'
section.
Defaultvalueis0anddefaultunitismilliseconds.
-deadcall_wait:
HowlongtheCall-IDandfinalstatusofcallsshouldbe
kepttoimprovemessageanderrorlogs(defaultunitis
ms).
-default_behaviors:
SetthedefaultbehaviorsthatSIPpwilluse.Possbile
valuesare:
-allUsealldefaultbehaviors
-noneUsenodefaultbehaviors
-byeSendbyesforabortedcalls
-abortunexpAbortcallsonunexpectedmessages
-pingreplyReplytopingrequests
Ifabehaviorisprefacedwitha-,thenitisturned
off.Example:
all,-bye
-error_file:
Setthenameoftheerrorlogfile.
-error_overwrite:
Overwritetheerrorlogfile(defaulttrue).
-f:
Setthestatisticsreportfrequencyonscreen.Defaultis
1anddefaultunitisseconds.
-fd:
Setthestatisticsdumplogreportfrequency.Defaultis
60anddefaultunitisseconds.
-i:
SetthelocalIPaddressfor'
Contact:
'
'
Via:
and
'
headers.DefaultisprimaryhostIPaddress.
-inf:
InjectvaluesfromanexternalCSVfileduringcallsinto
thescenarios.
Firstlineofthisfilesaywhetherthedataistobe
readinsequence(SEQUENTIAL),random(RANDOM),oruser
(USER)order.
Eachlinecorrespondstoonecallandhasoneormore
delimiteddatafields.Thosefieldscanbereferred
as[field0],[field1],...inthexmlscenariofile.
SeveralCSVfilescanbeusedsimultaneously(syntax:
-inff1.csv-inff2.csv...)
-infindex:
filefield
Createanindexoffileusingfield.Forexample-inf
users.csv-infindexusers.csv0createsanindexonthe
firstkey.
-ip_field:
SetwhichfieldfromtheinjectionfilecontainstheIP
addressfromwhichtheclientwillsenditsmessages.
Ifthisoptionisomittedandthe'
-tui'
optionis
present,thenfield0isassumed.
Usethisoptiontogetherwith'
-l:
Setthemaximumnumberofsimultaneouscalls.Oncethis
limitisreached,trafficisdecreaseduntilthenumber
ofopencallsgoesdown.Default:
(3*call_duration(s)*rate).
-log_file:
Setthenameofthelogactionslogfile.
-log_overwrite:
Overwritethelogactionslogfile(defaulttrue).
-lost:
Setthenumberofpacketstolosebydefault(scenario
specificationsoverridethisvalue).
-rtcheck:
Selecttheretransmisisondetectionmethod:
full
(default)orloose.
-m:
Stopthetestandexitwhen'
calls'
callsareprocessed
-mi:
SetthelocalmediaIPaddress(default:
localprimary
hostIPaddress)
-master:
3pccextendedmode:
indicatesthemasternumber
-max_recv_loops:
Setthemaximumnumberofmessagesreceivedreadper
cycle.Increasethisvalueforhightrafficlevel.The
defaultvalueis1000.
-max_sched_loops:
Setthemaximumnumberofcalslrunpereventloop.
Increasethisvalueforhightrafficlevel.Thedefault
valueis1000.
-max_reconnect:
Setthethemaximumnumberofreconnection.
-max_retrans:
MaximumnumberofUDPretransmissionsbeforecallendson
timeout.Defaultis5forINVITEtransactionsand7for
others.
-max_invite_retrans:
MaximumnumberofUDPretransmissionsforinvite
transactionsbeforecallendsontimeout.
-max_non_invite_retrans:
MaximumnumberofUDPretransmissionsfornon-invite
-max_log_size:
Whatisthelimitforerrorandmessagelogfilesizes.
-max_socket:
Setthemaxnumberofs