但是,因?yàn)镾IPp使用過程中,測(cè)試人員需要根據(jù)不同的場(chǎng)景來編寫自己的XML文件,測(cè)試人員需要首先學(xué)習(xí)這些XML語法,所以,通常在測(cè)試過程中,編寫XML文件耗費(fèi)很多的精力。今天,我們幫助SIP軟交換/媒體服務(wù)器開發(fā)和測(cè)試人員快速了解SIPp的壓力測(cè)試,筆者推薦一個(gè)比較完整全面的網(wǎng)站,這個(gè)網(wǎng)站匯集了很多SIP的功能測(cè)試場(chǎng)景的XML和其語法。
說明:筆者不再這里進(jìn)一步介紹關(guān)于SIPp的安裝和使用語法,筆者不再這里介紹如何安裝服務(wù)器端的應(yīng)用和其呼叫規(guī)則。用戶可以安裝Asterisk/FreeSWITCH,添加相應(yīng)的分機(jī)進(jìn)行測(cè)試。具體安裝文檔,網(wǎng)絡(luò)有很多資料。筆者這里僅分享官方使用場(chǎng)景,命令和其測(cè)試項(xiàng)目說明。
測(cè)試示例1- OPTIONS
對(duì)目的地地址發(fā)送5次 OPTIONS 消息-30@192.168.1.211。
sipp 192.168.1.211 -sf OPTIONS.xml -m 5 -s 30
Send OPTIONS message 30 times to 30@192.168.1.211 waiting 200 ms for 200/OK reply each time.
sipp 192.168.1.211 -sf OPTIONS_recv_200.xml -m 30 -s 30
- <scenario name="Options">
- <send>
- <![CDATA[
- OPTIONS sip:[service]@[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] Max-Forwards: 70 To: <sip:[service]@[remote_ip]> From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] Call-ID: [call_id] CSeq: 1 OPTIONS Contact: <sip:sipp@[local_ip]:[local_port]> Accept: application/sdp Content-Length: 0
- ]]>
- </send>
- <recv response="200" timeout="200"> </recv>
- </scenario>
測(cè)試示例2-REGISTER
通過CVS的配置賬號(hào)對(duì)服務(wù)器進(jìn)行注冊(cè) 192.168.1.106。用戶可以在CVS文件中添加多個(gè)文件,通過 -I 選項(xiàng)增加呼叫限制。
命令:
sipp 192.168.1.106 -sf REGISTER_client.xml-inf REGISTER_client.csv -m 1 -l 1 -trace_msg -trace_err
XML配置文件:
- <!--
- Use with CSV file struct like: 3000;192.168.1.106;[authentication username=3000 password=3000];
- (user part of uri, server address, auth tag in each line)
- -->
- <scenario name="register_client">
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="401" auth="true"> </recv>
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] [field2] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="200"> </recv>
- <!-- response time repartition table (ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
- <!-- call length repartition table (ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
- </scenario>
CVS文件:
測(cè)試示例3- REGISTER + SUBSCRIBE application/dialog-info+xml (BLF)
注冊(cè)到192.168.1.211地址,同時(shí)在CVS文件中的參數(shù)支持了dialog-info subscription (RFC4235)訂閱。
XML配置文件:
- <scenario name="UAC REGISTER + SUBSCRIBE dialog-info">
- <!--
- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
- (user part of uri, server address, auth tag, subscribed user in each line)
- -->
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="401" auth="true"> </recv>
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] [field2] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="200"> </recv>
- <send retrans="500">
- <![CDATA[
- SUBSCRIBE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field3]@[field1]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] SUBSCRIBE Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Event: dialog Expires: 120 User-Agent: SIPp/Win32 Accept: application/dialog-info+xml, multipart/related, application/rlmi+xml Content-Length: 0
- ]]>
- </send>
- <recv response="200" rtd="true"> </recv>
- <recv request="NOTIFY" crlf="true"> </recv>
- <send>
- <![CDATA[
- SIP/2.0 200 OK [last_Via:] [last_From:] [last_To:] [last_Call-ID:] [last_CSeq:] Content-Length: 0
- ]]>
- </send>
- <!--
- 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>
CVS文件:
測(cè)試示例4-REGISTER + INVITE
SIPp 模擬3個(gè)UACs, 每個(gè)UAC執(zhí)行呼出流程。對(duì)方進(jìn)行應(yīng)答,然后進(jìn)行語音播放(single pjsua instance with 3 accounts)。注意,這里的被呼叫方是PJSUA終端。
命令:
pjsua_vc6d --local-port=5068
--id sip:33@192.168.1.211 --registrar sip:192.168.1.211
--proxy sip:192.168.1.211 --realm * --username 33 --password 33
--next-account --id sip:34@192.168.1.211 --registrar sip:192.168.1.211
--proxy sip:192.168.1.211 --realm * --username 34 --password 34
--next-account --id sip:35@192.168.1.211 --registrar sip:192.168.1.211
--proxy sip:192.168.1.211 --realm * --username 35 --password 35
--play-file file.wav --auto-answer 200 --auto-play
配置文件:
- <scenario name="UAC REGISTER + INVITE + call">
- <!--
- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
- (user part of uri, server address, auth tag, call target)
- ->
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="401" auth="true"> </recv>
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] [field2] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="200"> </recv>
- <send retrans="500">
- <![CDATA[
- INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field3]@[field1]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 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>
- <recv response="200"> </recv>
- <send>
- <![CDATA[
- ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <pause milliseconds="30000"/>
- <send retrans="500">
- <![CDATA[
- BYE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] BYE Contact: sip:sipp@[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <!--
- The 'crlf' option inserts a blank line in the statistics report.
- -->
- <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>
CVS文件:
測(cè)試示例5-REGISTER + INVITE (2)
1)INVITE以后,首先處理。
2) 使用rrs="true" 和 [routes] 保存 Record-Route header 頭。
3) 在ACK和BYE消息中使用 [next_url] 。
命令:
sipp 192.168.1.211 -sf REGISTER_INVITE_client2.xml
-inf REGISTER_INVITE_client.csv -recv_timeout 10000 -m 1 -l 1
XML文件:
- <scenario name="UAC REGISTER + INVITE + call">
- <!--
- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
- (user part of uri, server address, auth tag, call target)
- -->
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 100 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="401" auth="true"> </recv>
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] [field2] Max-Forwards: 100 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="200"> </recv>
- <send retrans="500">
- <![CDATA[
- INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field3]@[field1]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 100 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 a=rtpmap:8 PCMA/8000
- ]]>
- </send>
- <recv response="100" optional="true"> </recv>
- <recv response="407" auth="true"> </recv>
- <send>
- <![CDATA[
- ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 100 Content-Length: 0
- ]]>
- </send>
- <send retrans="500">
- <![CDATA[
- INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field3]@[field1]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:[field0]@[local_ip]:[local_port] [field2] Max-Forwards: 100 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 a=rtpmap:8 PCMA/8000
- ]]>
- </send>
- <recv response="100" optional="true"> </recv>
- <recv response="180" optional="true"> </recv>
- <recv response="183" optional="true"> </recv>
- <recv response="200" rrs="true"> </recv>
- <send>
- <![CDATA[
- ACK [next_url] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] [last_To:] [routes] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 100 Content-Length: 0
- ]]>
- </send>
- <!-- Play a pre-recorded PCAP file (RTP stream) -->
- <nop>
- <action>
- <exec play_pcap_audio="pcap/g711a.pcap"/>
- </action>
- </nop>
- <!--
- Pause 60 seconds, which is less than the duration of the
- -->
- <pause milliseconds="60000"/>
- <send retrans="500">
- <![CDATA[
- BYE [next_url] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] [last_To:] [routes] Call-ID: [call_id] CSeq: [cseq] BYE Contact: sip:sipp@[local_ip]:[local_port] Max-Forwards: 100 Content-Length: 0
- ]]>
- </send>
- <!--
- The 'crlf' option inserts a blank line in the statistics report.
- -->
- <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>
CVS文件:
測(cè)試示例6-INVITE + CANCEL immediately after SIP/100
命令:
sipp 192.168.1.211 -sf INVITE_CANCEL.xml -recv_timeout 10000 -m 1 -l 1- <scenario name="UAC INVITE + call">
- <!--
- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
- (user part of uri, server address, auth tag, call target)
- -->
- <send retrans="500">
- <![CDATA[
- INVITE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: "98765432" <sip:32@[local_ip]>;tag=[call_number] To: <sip:[remote_ip]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 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 8 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000
- ]]>
- </send>
- <recv response="100">
- <action>
- <ereg regexp=";branch=[^;]*" search_in="hdr" header="Via" check_it="false" assign_to="1"/>
- </action>
- </recv>
- <send retrans="500">
- <![CDATA[
- CANCEL sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port][$1] [last_From:] [last_To:] Call-ID: [call_id] CSeq: [cseq] CANCEL Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <recv response="200"/>
- <recv response="487"/>
- <send>
- <![CDATA[
- ACK sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port][$1] [last_From:] [last_To:] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <pause milliseconds="3000"/>
- <!--
- 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>
命令:
sipp 192.168.1.211 -sf INVITE_SDP_video.xml -recv_timeout 30000 -m 1 -l 1
XML文件:
- <scenario name="UAC INVITE with video SDP + call">
- <send retrans="500">
- <![CDATA[
- INVITE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: "98765432" <sip:32@[local_ip]>;tag=[call_number] To: <sip:[remote_ip]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 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] b=AS:352 t=0 0 m=audio [media_port] RTP/AVP 0 8 b=TIAS:64000 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 m=video 40012 RTP/AVP 97 96 c=IN IP4 [media_ip] b=TIAS:128000 a=rtcp:40013 IN IP4 [media_ip] a=sendrecv a=rtpmap:97 H264/90000 a=fmtp:97 profile-level-id=42e01e; packetization-mode=1 a=rtpmap:96 H263-1998/90000 a=fmtp:96 CIF=1;QCIF=1
- ]]>
- </send>
- <recv response="100" optional="true"> </recv>
- <recv response="180" optional="true"> </recv>
- <recv response="183" optional="true"> </recv>
- <recv response="200"> </recv>
- <send>
- <![CDATA[
- ACK sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <pause milliseconds="30000"/>
- <send retrans="500">
- <![CDATA[
- BYE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] BYE Contact: sip:sipp@[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <!--
- The 'crlf' option inserts a blank line in the statistics report.
- -->
- <recv response="200" crlf="true"> </recv>
- <pause milliseconds="1500"/>
- <!--
- 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>
但檢測(cè)到傳真音時(shí),第一個(gè)終端發(fā)送re-INVITE攜帶T38/image offer。第二個(gè)終端拒絕了這個(gè)re-INVITE, 并且回復(fù)了488/Not Acceptable。但是,呼叫不能掛機(jī)。
命令:
sipp 192.168.0.192 -sf INVITE_T38_reINVITE.xml -s 30 -r 1 -l 12 -m 1
XML文件:
- <scenario name="UAC INVITE + call">
- <!--
- sipp 192.168.1.211 -sf invite_T38_reINVITE.xml -s 30 -r 1 -l 12 -m 1
- -->
- <send retrans="500">
- <![CDATA[
- INVITE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: "98765432" <sip:98765432@[local_ip]>;tag=[call_number] To: <sip:[remote_ip]:[remote_port]> Call-ID: [call_id] CSeq: 1 INVITE Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 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 8 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000
- ]]>
- </send>
- <recv response="100" optional="true"> </recv>
- <recv response="180" optional="true"> </recv>
- <recv response="183" optional="true"> </recv>
- <recv response="200"> </recv>
- <send>
- <![CDATA[
- ACK sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: 1 ACK Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <pause milliseconds="5000"/>
- <send retrans="500">
- <![CDATA[
- INVITE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: "98765432" <sip:98765432@[local_ip]>;tag=[call_number] To: <sip:[remote_ip]:[remote_port]>[peer_tag_param] Call-ID: [call_id] CSeq: 2 INVITE Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Content-Type: application/sdp Content-Length: [len] v=0 o=BroadWorks 65527945 2 IN IP4 78.8.190.36 s=- c=IN IP4 78.8.190.36 t=0 0 m=image 27914 udptl t38 a=sendrecv a=T38FaxVersion:0 a=T38MaxBitRate:9600 a=T38FaxRateManagement:transferredTCF a=T38FaxMaxBuffer:1000 a=T38FaxMaxDatagram:200 a=T38FaxUdpEC:t38UDPRedundancy
- ]]>
- </send>
- <recv response="488"> </recv>
- <send>
- <![CDATA[
- ACK sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <pause milliseconds="5000"/>
- <!--
- <send retrans="500">
- <![CDATA[
- BYE sip:[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: <sip:[local_ip]>;tag=[call_number]
- [last_To:]
- Call-ID: [call_id]
- CSeq: [cseq] BYE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 10
- Content-Length: 0
- ]]>
- </send>
- -->
- <!--
- The 'crlf' option inserts a blank line in the statistics report.
- -->
- <recv response="200" crlf="true"> </recv>
- <pause milliseconds="1500"/>
- <!--
- 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>
測(cè)試示例9- REGISTER UAS + SUBSCRIBE application/dialog-info+xml (BLF) UAS
這里要求兩個(gè)實(shí)際的處理流程來模擬此環(huán)境。SIPp同時(shí)發(fā)送注冊(cè)信息和BLF訂閱消息,對(duì)方快速回復(fù)結(jié)束訂閱的響應(yīng),回復(fù)結(jié)果攜帶 reason=noresource。
1) 首先進(jìn)行注冊(cè): 30@your_pc_ip_address,無密碼,創(chuàng)建dialog-info+xml subscription支持108@your_pc_ip_address。
2) 然后執(zhí)行UAS REGISTER scenario ,等待電話登錄。
3)使用熱鍵組合打斷注冊(cè)流程Ctrl+C,然后運(yùn)行UAS SUBSCRIBE 流程。
命令:
sipp -sf uas_register.xmlsipp -sf uas_subscribe.xml
XML配置文件(uas_register):
- <scenario name="UAS REGISTER + SUBSCRIBE/noresource">
- <!--
- 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 request="REGISTER" crlf="true"> </recv>
- <!--
- The '[last_*]' keyword is replaced automatically by the
- -->
- <!--
- specified header if it was present in the last message received
- -->
- <!--
- (except if it was a retransmission). If the header was not
- -->
- <!--
- present or if no message has been received, the '[last_*]'
- -->
- <!--
- keyword is discarded, and all bytes until the end of the line
- -->
- <!-- are also discarded. -->
- <!-- -->
- <!--
- If the specified header was present several times in the
- -->
- <!--
- message, all occurences are concatenated (CRLF seperated)
- -->
- <!-- to be used in place of the '[last_*]' keyword. -->
- <send>
- <![CDATA[
- SIP/2.0 200 OK [last_Via:] [last_From:] [last_To:];tag=[call_number] [last_Call-ID:] [last_CSeq:] Contact: <sip:[local_ip]:[local_port];transport=[transport]> Content-Length: 0
- ]]>
- </send>
- </scenario>
- <scenario name="UAS SUBSCRIBE/noresource">
- <recv request="SUBSCRIBE" crlf="true"> </recv>
- <send>
- <![CDATA[
- SIP/2.0 200 OK [last_Via:] [last_Call-ID:] [last_From:] [last_To:];tag=[call_number] [last_CSeq:] Expires: 120 Contact: <sip:30@[local_ip]:[local_port];transport=[transport]> Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, REFER, MESSAGE, OPTIONS Supported: 100rel, norefersub Content-Length: 0
- ]]>
- </send>
- <send>
- <![CDATA[
- NOTIFY sip:30@prima SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] Max-Forwards: 70 From: <sip:108@[local_ip]:[local_port]>;tag=[call_number] To: "30" <sip:30@[local_ip]>;tag=1 Contact: <sip:30@[local_ip]:[local_port];transport=[transport]> [last_Call-ID:] CSeq: 15540 NOTIFY Event: dialog Subscription-State: terminated;reason=noresource Allow-Events: dialog, refer User-Agent: Prima 2.00.00 Content-Length: 0
- ]]>
- </send>
- <recv response="200" rtd="true"> </recv>
- </scenario>
測(cè)試示例10-REGISTER UAS 發(fā)送 unsolicited MWI NOTIFY 信息
對(duì)已注冊(cè)的終端發(fā)送unsolicited message-summary 事件,終端為 (31@192.168.0.228)。MWI是終端經(jīng)常使用的功能,簡(jiǎn)單來說,就是對(duì)終端發(fā)送提示指示,例如有語音影響留言,BLF等。用戶可以測(cè)試很多品牌的SIP終端話機(jī)。
命令:
sipp 192.168.0.228 -s 31
-sf NOTIFY_MWI_unsolicited.xml -m 1 -l 1 -r 1 -rp 1000
XML配置文件:
- <scenario name="Unsolicited NOTIFY with MWI (message-summary Event)">
- <!--
- Respond to registration request. Tested phone seems to do not
- react to NOTIFY sent from other host than registration server
- -->
- <recv request="REGISTER" crlf="true"> </recv>
- <send>
- <![CDATA[
- SIP/2.0 200 OK [last_Via:] [last_From:] [last_To:];tag=[call_number] [last_Call-ID:] [last_CSeq:] Contact: <sip:[local_ip]:[local_port];transport=[transport]> Expires: 120 Content-Length: 0
- ]]>
- </send>
- <!--
- Send unsolicited NOTIFY with MWI info (2 new/8 old messages, 0 new urgent/ 2 old urgent )
- -->
- <send retrans="500">
- <![CDATA[
- NOTIFY sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[service]@[local_ip]>;tag=[call_number] To: <sip:[service]@[local_ip]> Call-ID: [call_id] CSeq: [cseq] NOTIFY Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Event: message-summary Subscription-State: active Content-Type: application/simple-message-summary Content-Length: [len] Messages-Waiting: yes Message-Account: sip:[service]@[local_ip] Voice-Message: 2/8 (0/2)
- ]]>
- </send>
- <recv response="200"> </recv>
- <pause milliseconds="10000"/>
- <!-- Send unsolicited NOTIFY with MWI info: no messages -->
- <send retrans="500">
- <![CDATA[
- NOTIFY sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[service]@[local_ip]>;tag=[call_number] To: <sip:[service]@[local_ip]> Call-ID: [call_id] CSeq: [cseq] NOTIFY Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Event: message-summary Subscription-State: active Content-Type: application/simple-message-summary Content-Length: [len] Messages-Waiting: no Message-Account: sip:[service]@[local_ip] Voice-Message: 0/0 (0/0)
- ]]>
- </send>
- <recv response="200"> </recv>
- <pause milliseconds="10000"/>
- <!--
- Send unsolicited NOTIFY with MWI info (3 new/9 old messages, 1 new urgent/ 1 old urgent )
- -->
- <send retrans="500">
- <![CDATA[
- NOTIFY sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[service]@[local_ip]>;tag=[call_number] To: <sip:[service]@[local_ip]> Call-ID: [call_id] CSeq: [cseq] NOTIFY Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Event: message-summary Subscription-State: active Content-Type: application/simple-message-summary Content-Length: [len] Messages-Waiting: yes Message-Account: sip:[service]@[local_ip] Voice-Message: 3/9 (1/1)
- ]]>
- </send>
- <recv response="200"> </recv>
- <pause milliseconds="10000"/>
- <!-- Send unsolicited NOTIFY with MWI info: no messages -->
- <send retrans="500">
- <![CDATA[
- NOTIFY sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[service]@[local_ip]>;tag=[call_number] To: <sip:[service]@[local_ip]> Call-ID: [call_id] CSeq: [cseq] NOTIFY Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Event: message-summary Subscription-State: active Content-Type: application/simple-message-summary Content-Length: [len] Messages-Waiting: no Message-Account: sip:[service]@[local_ip] Voice-Message: 0/0 (0/0)
- ]]>
- </send>
- <recv response="200"> </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>
測(cè)試示例11-Unsolicited NOTIFY with Event: talk
發(fā)送Unsolicited talk event (如果支持的話,終端可呼叫應(yīng)答-31@192.168.0.228。
命令:
sipp 192.168.0.228 -s 31
-sf NOTIFY_talk_unsolicited.xml -m 1 -l 1 -r 1 -rp 1000
XML配置文件:
- <!--
- NOTIFY with Event: talk can trigger accepting incoming call on supporting phone
- (e.g. Yealink, Polycom).
- Note: this scenario does not handle authentification.
- -->
- <scenario name="Unsolicited NOTIFY with Event: talk">
- <send retrans="500">
- <![CDATA[
- NOTIFY sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[service]@[local_ip]>;tag=[call_number] To: <sip:[service]@[local_ip]> Call-ID: [call_id] CSeq: [cseq] NOTIFY Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Event: talk Subscription-State: terminated Content-Length: [len]
- ]]>
- </send>
- <recv response="200"> </recv>
- </scenario>
測(cè)試示例12-Session audit using UPDATE message
終端發(fā)送200/OK攜帶一個(gè)SDP offer,但是沒有修改會(huì)話參數(shù)。
命令:
sipp 192.168.0.228
-sf INVITE_UPDATE_session_audit.xml -m 1 -l 1
XML配置:
- <!--
- Testing: device response to UPDATE message with no body
- (aka session audit).
- Usage: sipp-win32 ip_address -sf invite_update.xml -m 1
- -->
- <scenario name="UAC INVITE + call">
- <send retrans="500">
- <![CDATA[
- INVITE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: "9876" <sip:1234@[local_ip]>;tag=[call_number] To: <sip:[remote_ip]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 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 8 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000
- ]]>
- </send>
- <recv response="100" optional="true"> </recv>
- <recv response="180" optional="true"> </recv>
- <recv response="183" optional="true"> </recv>
- <recv response="200"> </recv>
- <send>
- <![CDATA[
- ACK sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <pause milliseconds="5000"/>
- <send retrans="500">
- <![CDATA[
- UPDATE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/UDP [local_ip]:[local_port];branch=z9hG4bK1489807744192936848 [last_From:] [last_To:] [last_Call-ID:] CSeq: [cseq] UPDATE Contact: <sip:[local_ip]:[local_port];transport=[transport]> Max-Forwards: 70 User-Agent: SIPp/WinXP Content-Type: application/sdp Content-Length: 0
- ]]>
- </send>
- <recv response="200"> </recv>
- <send retrans="500">
- <![CDATA[
- BYE sip:[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] BYE Contact: sip:sipp@[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <!--
- The 'crlf' option inserts a blank line in the statistics report.
- -->
- <recv response="200" crlf="true"> </recv>
- <pause milliseconds="1500"/>
- <!--
- 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>
測(cè)試示例13-REGISTER UAC + INVITE + DTMF INFO
1) SIP 注冊(cè)和認(rèn)證。
2) 呼叫110. 這里的測(cè)試110是一個(gè)FXS分機(jī),然后通過FXS再呼叫到FXO端口,呼叫通過DISA應(yīng)答。這種方式可以通過Asterisk加語音板卡(FXS/FXO實(shí)現(xiàn))。
3) 呼叫其他的3位數(shù)號(hào)碼,使用的是SIP INFO DTMF (Content-Type: application/dtmf-relay in this scenario)。呼叫沒有被應(yīng)答。
4) 掛機(jī)流程。
注意,"application/dtmf" Content-Type 的DTMF“*”解析為10,#解析為11.
命令:
sipp 192.168.1.211 -sf REGC_INVITE_INFO.xml
-inf REGC_INVITE_INFO.csv -m 5 -l 1 -r 1 -rp 10000
XML配置文件:
- <scenario name="UAC REGISTER + INVITE + INFO">
- <!--
- Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;1;0;9
- (user part of uri, server address, auth tag, call target | dtmf digit1, digit2, digit3).
- In my test call target is actually FXS routed back to FXO that picks calls
- automatically and switches them to DISA. Caller dials then another subscriber
- number using SIP INFO messages.
- -->
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="401" auth="true"> </recv>
- <send retrans="500">
- <![CDATA[
- REGISTER sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field0]@[field1]> Call-ID: [call_id] CSeq: [cseq] REGISTER Contact: sip:[field0]@[local_ip]:[local_port] [field2] Max-Forwards: 10 Expires: 120 User-Agent: SIPp/Win32 Content-Length: 0
- ]]>
- </send>
- <!-- asterisk -->
- <recv response="100" optional="true"> </recv>
- <recv response="200"> </recv>
- <send retrans="500">
- <![CDATA[
- INVITE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] To: <sip:[field3]@[field1]:[remote_port]> Call-ID: [call_id] CSeq: [cseq] INVITE Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 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>
- <recv response="200"> </recv>
- <send>
- <![CDATA[
- ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] ACK Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <!-- "Listening to DISA announcement" -->
- <!-- <pause milliseconds="3000" /> -->
- <pause distribution="uniform" min="1000" max="10000"/>
- <!-- Dial first digit -->
- <send retrans="500">
- <![CDATA[
- INFO sip:[remote_ip]:[remote_port];[transport] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] INFO Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Content-Type: application/dtmf-relay Content-Length: [len] Signal=[field4] Duration=300
- ]]>
- </send>
- <recv response="200"> </recv>
- <!-- Dial second digit -->
- <send retrans="500">
- <![CDATA[
- INFO sip:[remote_ip]:[remote_port];[transport] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] INFO Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Content-Type: application/dtmf-relay Content-Length: [len] Signal=[field5] Duration=300
- ]]>
- </send>
- <recv response="200"> </recv>
- <!-- Dial third digit -->
- <send retrans="500">
- <![CDATA[
- INFO sip:[remote_ip]:[remote_port];[transport] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] INFO Contact: sip:[field0]@[local_ip]:[local_port] Max-Forwards: 10 Content-Type: application/dtmf-relay Content-Length: [len] Signal=[field6] Duration=300
- ]]>
- </send>
- <recv response="200"> </recv>
- <!-- Number dialed, wait for a moment -->
- <pause distribution="uniform" min="1000" max="8000"/>
- <send retrans="500">
- <![CDATA[
- BYE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[field0]@[field1]>;tag=[call_number] [last_To:] Call-ID: [call_id] CSeq: [cseq] BYE Contact: sip:sipp@[local_ip]:[local_port] Max-Forwards: 10 Content-Length: 0
- ]]>
- </send>
- <!--
- The 'crlf' option inserts a blank line in the statistics report.
- -->
- <recv response="200" crlf="true"> </recv>
- <!--
- The purpose of this pause is to give some time for FXO/FXS lines to
- detect disconnection.
- -->
- <pause milliseconds="5000"/>
- <!--
- 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>
CVS配置文件:
測(cè)試示例14- SIP digest 漏洞測(cè)試
通過此命令檢測(cè)IPPBX分機(jī)號(hào)碼的漏洞。
命令:
sipp 192.168.1.211 -sf uac_digest_leak.xml -s 30 -m 1
XML配置:
- his XML file does not appear to have any style information associated with it. The document tree is shown below.
- <!-- SIP digest leak test scenario -->
- <!--
- Note: realm at WWW-Authenticate may have to be changed if phone realm configuration is not empty
- -->
- <!--
- (empty realm at phone configuration = auth against any realm)
- -->
- <!-- http://tomeko.net -->
- <scenario name="SIP digest leak test">
- <!--
- In client mode (sipp placing calls), the Call-ID MUST be
- -->
- <!--
- generated by sipp. To do so, use [call_id] keyword.
- -->
- <send retrans="500">
- <![CDATA[
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] To: sut <sip:[service]@[remote_ip]:[remote_port]> 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
- ]]>
- </send>
- <recv response="100" optional="true"> </recv>
- <recv response="180" 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:[service]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] To: sut <sip:[service]@[remote_ip]:[remote_port]>[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
- ]]>
- </send>
- <!--
- At this moment second party is hanging up call (no audio there)
- -->
- <recv request="BYE"/>
- <!--
- Test with SIP hardware phone: must use WWW-Authenticate instead of Proxy-Authenticate.
- You could also try with SIP/2.0 401 Unauthorized.
- -->
- <send>
- <![CDATA[
- SIP/2.0 407 Proxy Authentication Required [last_Via:] [last_From:] [last_To:] [last_Call-ID:] [last_CSeq:] WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="69d327e5" Content-Length: 0
- ]]>
- </send>
- <recv request="BYE"/>
- </scenario>
測(cè)試示例15-生成帶G.729 編碼的呼叫
在很多呼叫中心的呼叫過程中,為了節(jié)省帶寬資源,很多運(yùn)營(yíng)商可能提供帶G.729的編碼。
這里,我們可以通過SIPp測(cè)試攜帶G.729編碼的呼叫。
當(dāng)然,用戶需要使用此默認(rèn)配置文件 SIPp. Here is .pcap file,此配置文件攜帶了
2分鐘的語音流支持了G.729 編碼。配置時(shí)需要保存到默認(rèn)路徑。
命令:
sipp 192.168.1.211 -sf uac_pcap_G729.xml -l 1 -m 10
XML配置:
- <!--
- This program is free software; you can redistribute it and/or
- -->
- <!--
- modify it under the terms of the GNU General Public License as
- -->
- <!--
- published by the Free Software Foundation; either version 2 of the
- -->
- <!-- License, or (at your option) any later version. -->
- <!-- -->
- <!--
- This program is distributed in the hope that it will be useful,
- -->
- <!--
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- -->
- <!--
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -->
- <!-- GNU General Public License for more details. -->
- <!-- -->
- <!--
- You should have received a copy of the GNU General Public License
- -->
- <!-- along with this program; if not, write to the -->
- <!-- Free Software Foundation, Inc., -->
- <!--
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- -->
- <!-- -->
- <!-- Sipp 'uac' scenario with pcap (rtp) play -->
- <!-- -->
- <scenario name="UAC with media">
- <!--
- In client mode (sipp placing calls), the Call-ID MUST be
- -->
- <!--
- generated by sipp. To do so, use [call_id] keyword.
- -->
- <send retrans="500">
- <![CDATA[
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] To: sut <sip:[service]@[remote_ip]:[remote_port]> 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[local_ip_type] [local_ip] t=0 0 m=audio [auto_media_port] RTP/AVP 18 101 a=rtpmap:18 G729/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-11,16
- ]]>
- </send>
- <recv response="100" optional="true"> </recv>
- <recv response="180" 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" crlf="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:[service]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] To: sut <sip:[service]@[remote_ip]:[remote_port]>[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
- ]]>
- </send>
- <!-- Play a pre-recorded PCAP file (RTP stream) -->
- <nop>
- <action>
- <exec play_pcap_audio="pcap/g729.pcap"/> // 文件存放地址
- </action>
- </nop>
- <!--
- Pause 60 seconds, which is less than the duration of the
- -->
- <!-- PCAP file -->
- <pause milliseconds="60000"/>
- <!-- Play an out of band DTMF '1' -->
- <nop>
- <action>
- <exec play_pcap_audio="pcap/dtmf_2833_1.pcap"/>
- </action>
- </nop>
- <pause milliseconds="1000"/>
- <!--
- The 'crlf' option inserts a blank line in the statistics report.
- -->
- <send retrans="500">
- <![CDATA[
- BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number] To: sut <sip:[service]@[remote_ip]:[remote_port]>[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
- ]]>
- </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>
測(cè)試示例16-視頻呼叫支持的RTP (H.264)
命令:
sipp 127.0.0.1 -sf uac_pcap_H264.xml -l 1 -m 1
XML配置文件:
H264配置文件
http://tomeko.net/other/sipp/scenarios/uac_pcap_H264.xml
測(cè)試示例17-Blind transfer 電話盲轉(zhuǎn)
注冊(cè)分機(jī),進(jìn)行呼叫,然后執(zhí)行電話盲轉(zhuǎn)。
命令:
sipp 192.168.1.211 -sf REGISTER_INVITE_REFER.xml
-inf REGISTER_INVITE_REFER.csv -m 1 -l 1 -r 1 -rp 10000
XML配置文件:
配置文件
http://tomeko.net/other/sipp/scenarios/REGISTER_INVITE_REFER.xml
測(cè)試示例18-UAS with T38 reinvite
檢測(cè)到傳真音時(shí),模擬UAS發(fā)送re-INVITE,攜帶image/t38。涉及測(cè)試需要根據(jù)官方文檔
做進(jìn)一步配置說明。
命令:
sipp -sf uas_T38_reinvite.xml
XML配置文件:
配置文件
http://tomeko.net/other/sipp/scenarios/uas_T38_reinvite.xml
模擬測(cè)試的話: 需要配置rtp_pcma_fax_cng.pcap -這是一個(gè)CNG 錄音文件來檢測(cè)CNG detection。
測(cè)試示例19-Sipsak 命令重新啟動(dòng)yealink 話機(jī)
用戶首先需要下載Sipsak工具,配置執(zhí)行文件,通過Sipsak對(duì)yealink 話機(jī)發(fā)送自定義的消息(NOTIFY Event: check-sync;reboot=true
重新啟動(dòng)Yealink話機(jī)。
命令:
sipsak -f reboot_yealink.sipfile -s sip:1234@192.168.0.195
配置文件:
配置文件
http://tomeko.net/other/sipp/sipsak/reboot_yealink.sipfile
總結(jié):
以上19個(gè)SIPp測(cè)試示例是第三方測(cè)試人員的測(cè)試文檔,筆者在前幾年僅測(cè)試過幾個(gè)示例,基本上都
可以工作。需要強(qiáng)調(diào)的是,用戶需要安裝自己的IPPBX,軟交換或者其他媒體服務(wù)器,
并且需要有針對(duì)性的配置。然后根據(jù)XML配置文件和預(yù)設(shè)的默認(rèn)支持文件來實(shí)現(xiàn)測(cè)試。
筆者僅是共享此文檔,如果測(cè)試人員需要進(jìn)一步獲取完整的測(cè)試XML文件,到參考鏈接的官方獲取。
參考資料:
http://tomeko.net/other/sipp/sipp_cheatsheet.php?lang=en
FreeSBC/ProSBC 免費(fèi)邊界會(huì)話控制器, 下載ISO:https://freesbc.telcobridges.com/
關(guān)注微信公眾號(hào):asterisk-cn,獲得有價(jià)值的Asterisk行業(yè)分享
Asterisk freepbx 中文官方論壇:http://bbs.freepbx.cn/forum.php
Asterisk freepbx技術(shù)文檔: www.freepbx.org.cn
融合通信商業(yè)解決方案,協(xié)同解決方案首選產(chǎn)品:www.hiastar.com
Asterisk/FreePBX中國(guó)合作伙伴,官方qq技術(shù)分享群(3000千人):589995817
Asterisk freepbx 中文官方論壇:http://bbs.freepbx.cn/forum.php
Asterisk freepbx技術(shù)文檔: www.freepbx.org.cn
融合通信商業(yè)解決方案,協(xié)同解決方案首選產(chǎn)品:www.hiastar.com
Asterisk/FreePBX中國(guó)合作伙伴,官方qq技術(shù)分享群(3000千人):589995817