SIPp常用脚本之三:UAC

时间:2024-12-26 16:33:26

UAC是作为SIP消息的发起端,可以控制消息速率什么的,方便极了。

一、uac.xml

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

<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="Basic Sipstone UAC">
<send retrans="">
<![CDATA[
INVITE sip:[field1]@10.130.16.42: SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]
To: <sip:[field1]@[remote_ip]:>
Call-ID: [call_id]
CSeq: INVITE
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards:
Subject: Performance Test
Content-Type: application/sdp
Content-Length: [len] v=
o=HuaweiFlexit1. IN IP4 10.130.30.7
s=A call
c=IN IP4 10.130.30.7
t=
m=audio RTP/AVP
a=rtpmap: G729/
a=fmtp: annexb=no
a=rtpmap: G723/
a=rtpmap: PCMA/
a=rtpmap: PCMU/
a=rtpmap: telephone-event/
a=fmtp: -
a=sendrecv
m=video RTP/AVP
b=AS:
a=rtpmap: H263/
a=fmtp: QCIF= CIF= MaxBR=
a=rtpmap: MP4V-ES/
a=fmtp: profile-level-id=
a=sendrecv
]]>
</send> <recv response="" >
</recv>
<recv response="" >
</recv> <recv response="" >
</recv> <send>
<![CDATA[
ACK sip:mod_sofia@10.130.16.42:;transport=udp SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]
To: <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: ACK
Max-Forwards:
Subject: Performance Test
Content-Length:
]]>
</send>
<pause milliseconds=""/>
<send retrans="">
<![CDATA[
BYE sip:[field0]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: [field0] <sip:[field0]@[remote_ip]:[remote_port]>;tag=[call_number]
To: [field1] <sip:[field1]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
CSeq: BYE
Contact: sip:[field0]@[local_ip]:[local_port]
Max-Forwards:
Subject: Performance Test
Content-Length:
]]>
</send>
<recv response="" crlf="true">
</recv>
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>

二、uac.sh

1. TCP方式启动

./sipp -sf uac.xml -i 本地服务器地址 -p 本地服务器端口 业务服务器地址:端口 -r  -t tn -max_socket 

2. UDP方式启动

./sipp -sf uac.xml -i 本地服务器地址 -p 本地服务器端口 业务服务器地址:端口 -r 

三、一点说明

-r 50 是每秒发送50条SIP消息。