美文网首页
完整SIPp测试环境下各种SIP场景测试和配置文件

完整SIPp测试环境下各种SIP场景测试和配置文件

作者: Asterisk开源派 | 来源:发表于2019-06-27 14:58 被阅读0次

    ​SIPp是一个免费的SIP压力测试比较好的工具。我们在部署SIP语音网络中可能需要测试不同的服务器端的兼容性或者其他终端的兼容性问题,处理能力等问题。笔者大概在2008年使用此工具进行了关于编码转换压力的测试,之后,使用SIPp也做过多种场景的测试。

    但是,因为SIPp使用过程中,测试人员需要根据不同的场景来编写自己的XML文件,测试人员需要首先学习这些XML语法,所以,通常在测试过程中,编写XML文件耗费很多的精力。今天,我们帮助SIP软交换/媒体服务器开发和测试人员快速了解SIPp的压力测试,笔者推荐一个比较完整全面的网站,这个网站汇集了很多SIP的功能测试场景的XML和其语法。

    说明:笔者不再这里进一步介绍关于SIPp的安装和使用语法,笔者不再这里介绍如何安装服务器端的应用和其呼叫规则。用户可以安装Asterisk/FreeSWITCH,添加相应的分机进行测试。具体安装文档,网络有很多资料。笔者这里仅分享官方使用场景,命令和其测试项目说明。

    测试示例1- OPTIONS

    对目的地地址发送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

    <![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]]>

    测试示例2-REGISTER

    通过CVS的配置账号对服务器进行注册 192.168.1.106。用户可以在CVS文件中添加多个文件,通过 -I 选项增加呼叫限制.

    命令:

    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)--><![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 ]]><!--  asterisk  --><![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 ]]><!--  asterisk  --><!--  response time repartition table (ms)    --><!--  call length repartition table (ms)      -->

    CVS文件:

    测试示例3- REGISTER + SUBSCRIBE application/dialog-info+xml (BLF)

    注册到192.168.1.211地址,同时在CVS文件中的参数支持了dialog-info subscription (RFC4235)订阅。

    XML配置文件:

    <!--  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)--><![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 ]]><!--  asterisk  --><![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 ]]><!--  asterisk  --><![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 ]]><![CDATA[  SIP/2.0 200 OK [last_Via:] [last_From:] [last_To:] [last_Call-ID:] [last_CSeq:] Content-Length: 0 ]]><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    CVS文件:

    测试示例4-REGISTER + INVITE

    SIPp 模拟3个UACs, 每个UAC执行呼出流程。对方进行应答,然后进行语音播放(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

    配置文件:

    <!--  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)--><![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 ]]><!--  asterisk  --><![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 ]]><!--  asterisk  --><![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 ]]><![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 ]]><![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 ]]><!-- The 'crlf' option inserts a blank line in the statistics report. --><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    CVS文件:

    测试示例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文件:

    <!--  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)--><![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 ]]><!--  asterisk  --><![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 ]]><!--  asterisk  --><![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 ]]><![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 ]]><![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 ]]><![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 ]]><!--  Play a pre-recorded PCAP file (RTP stream)                        --><!-- Pause 60 seconds, which is less than the duration of the      --><![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 ]]><!-- The 'crlf' option inserts a blank line in the statistics report. --><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    CVS文件:

    测试示例6-INVITE + CANCEL immediately after SIP/100

    命令:

    sipp 192.168.1.211 -sf INVITE_CANCEL.xml -recv_timeout 10000 -m 1 -l 1

    <!--  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)--><![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 ]]><![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 ]]><![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 ]]><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    测试示例7-INVITE with video stream SDP (H.263, H.264, AS/TIAS bandwidth modifiers)

    命令:

    sipp 192.168.1.211 -sf INVITE_SDP_video.xml -recv_timeout 30000 -m 1 -l 1

    XML文件:

    <![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 ]]><![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 ]]><![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 ]]><!-- The 'crlf' option inserts a blank line in the statistics report. --><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    测试示例8-INVITE + re-INVITE with T38 offer

    但检测到传真音时,第一个终端发送re-INVITE携带T38/image offer。第二个终端拒绝了这个re-INVITE, 并且回复了488/Not Acceptable。但是,呼叫不能挂机。

    命令:

    sipp 192.168.0.192 -sf INVITE_T38_reINVITE.xml -s 30 -r 1 -l 12 -m 1

    XML文件:

    <!--  sipp 192.168.1.211 -sf invite_T38_reINVITE.xml -s 30 -r 1 -l 12 -m 1--><![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 ]]><![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 ]]><![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 ]]><![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 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. --><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    测试示例9- REGISTER UAS + SUBSCRIBE application/dialog-info+xml (BLF) UAS

    这里要求两个实际的处理流程来模拟此环境。SIPp同时发送注册信息和BLF订阅消息,对方快速回复结束订阅的响应,回复结果携带 reason=noresource。

    1) 首先进行注册: 30@your_pc_ip_address,无密码,创建dialog-info+xml subscription支持108@your_pc_ip_address。

    2) 然后执行UAS REGISTER scenario ,等待电话登录。

    3)使用热键组合打断注册流程Ctrl+C,然后运行UAS SUBSCRIBE 流程。

    命令:

    sipp -sf uas_register.xml

    sipp -sf uas_subscribe.xml

    XML配置文件(uas_register):

    <!-- 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.                              --><!-- 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.                    --><![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 ]]>

    XML配置文件(uas_subscribe):

    <![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 ]]><![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 ]]>

    测试示例10-REGISTER UAS 发送 unsolicited MWI NOTIFY 信息

    对已注册的终端发送unsolicited message-summary 事件,终端为 (31@192.168.0.228)。MWI是终端经常使用的功能,简单来说,就是对终端发送提示指示,例如有语音影响留言,BLF等。用户可以测试很多品牌的SIP终端话机。

    命令:

    sipp 192.168.0.228 -s 31

    -sf NOTIFY_MWI_unsolicited.xml -m 1 -l 1 -r 1 -rp 1000

    XML配置文件:

    <!--  Respond to registration request. Tested phone seems to do not        react to NOTIFY sent from other host than registration server    --><![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 unsolicited NOTIFY with MWI info (2 new/8 old messages, 0 new urgent/ 2 old urgent )        --><![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 unsolicited NOTIFY with MWI info: no messages    --><![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 unsolicited NOTIFY with MWI info (3 new/9 old messages, 1 new urgent/ 1 old urgent )        --><![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 unsolicited NOTIFY with MWI info: no messages    --><![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)  ]]><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    测试示例11-Unsolicited NOTIFY with Event: talk

    发送Unsolicited talk event (如果支持的话,终端可呼叫应答-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.--><![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] ]]>

    测试示例12-Session audit using UPDATE message

    终端发送200/OK携带一个SDP offer,但是没有修改会话参数。

    命令:

    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--><![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 ]]><![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 ]]><![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]]><![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 ]]><!-- The 'crlf' option inserts a blank line in the statistics report. --><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    测试示例13-REGISTER UAC + INVITE + DTMF INFO

    1) SIP 注册和认证。

    2) 呼叫110. 这里的测试110是一个FXS分机,然后通过FXS再呼叫到FXO端口,呼叫通过DISA应答。这种方式可以通过Asterisk加语音板卡(FXS/FXO实现)。

    3) 呼叫其他的3位数号码,使用的是SIP INFO DTMF (Content-Type: application/dtmf-relay in this scenario)。呼叫没有被应答。

    4) 挂机流程。

    注意,"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配置文件:

    <!--  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. --><![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 ]]><!--  asterisk  --><![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 ]]><!--  asterisk  --><![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 ]]><![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 ]]><!--  "Listening to DISA announcement"  --><!--  <pause milliseconds="3000" />  --><!--  Dial first digit  --><![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]]><!--  Dial second digit  --><![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]]><!--  Dial third digit  --><![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]]><!--  Number dialed, wait for a moment  --><![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 ]]><!-- The 'crlf' option inserts a blank line in the statistics report. --><!-- The purpose of this pause is to give some time for FXO/FXS lines to      detect disconnection.  --><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    CVS配置文件:

    测试示例14- SIP digest 漏洞测试

    通过此命令检测IPPBX分机号码的漏洞。

    命令:

    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  --><!-- In client mode (sipp placing calls), the Call-ID MUST be        --><!-- generated by sipp. To do so, use [call_id] keyword.                --><![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 ]]><!-- 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.                              --><!-- Packet lost can be simulated in any send/recv message by        --><!-- by adding the 'lost = "10"'. Value can be [1-100] percent.      --><![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 ]]><!-- At this moment second party is hanging up call (no audio there) --><!-- Test with SIP hardware phone: must use WWW-Authenticate instead of Proxy-Authenticate.      You could also try with SIP/2.0 401 Unauthorized. --><![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 ]]>

    测试示例15-生成带G.729 编码的呼叫

    在很多呼叫中心的呼叫过程中,为了节省带宽资源,很多运营商可能提供带G.729的编码。

    这里,我们可以通过SIPp测试携带G.729编码的呼叫。

    当然,用户需要使用此默认配置文件 SIPp. Here is .pcap file,此配置文件携带了

    2分钟的语音流支持了G.729 编码。配置时需要保存到默认路径。

    命令:

    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            --><!--                                                                      --><!-- In client mode (sipp placing calls), the Call-ID MUST be        --><!-- generated by sipp. To do so, use [call_id] keyword.                --><![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]]><!-- 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.                              --><!-- Packet lost can be simulated in any send/recv message by        --><!-- by adding the 'lost = "10"'. Value can be [1-100] percent.      --><![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]]><!--  Play a pre-recorded PCAP file (RTP stream)                        -->// 文件存放地址<!-- Pause 60 seconds, which is less than the duration of the      --><!--  PCAP file                                                        --><!--  Play an out of band DTMF '1'                                      --><!-- The 'crlf' option inserts a blank line in the statistics report. --><![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]]><!-- definition of the response time repartition table (unit is ms)  --><!-- definition of the call length repartition table (unit is ms)    -->

    测试示例16-视频呼叫支持的RTP (H.264)

    命令:

    sipp 127.0.0.1 -sf uac_pcap_H264.xml -l 1 -m 1

    XML配置文件:

    H264配置文件

    测试示例17-Blind transfer 电话盲转

    注册分机,进行呼叫,然后执行电话盲转。

    命令:

    sipp 192.168.1.211 -sf REGISTER_INVITE_REFER.xml

    -inf REGISTER_INVITE_REFER.csv -m 1 -l 1 -r 1 -rp 10000

    XML配置文件:

    配置文件

    测试示例18-UAS with T38 reinvite

    检测到传真音时,模拟UAS发送re-INVITE,携带image/t38。涉及测试需要根据官方文档

    做进一步配置说明。

    命令:

    sipp -sf uas_T38_reinvite.xml

    XML配置文件:

    配置文件

    模拟测试的话: 需要配置rtp_pcma_fax_cng.pcap -这是一个CNG 录音文件来检测CNG detection。

    测试示例19-Sipsak 命令重新启动yealink 话机

    用户首先需要下载Sipsak工具,配置执行文件,通过Sipsak对yealink 话机发送自定义的消息(NOTIFY Event: check-sync;reboot=true

    重新启动Yealink话机。

    命令:

    sipsak -f reboot_yealink.sipfile -s sip:1234@192.168.0.195 

    配置文件:

    配置文件

    总结:

    以上19个SIPp测试示例是第三方测试人员的测试文档,笔者在前几年仅测试过几个示例,基本上都

    可以工作。需要强调的是,用户需要安装自己的IPPBX,软交换或者其他媒体服务器,

    并且需要有针对性的配置。然后根据XML配置文件和预设的默认支持文件来实现测试。

    笔者仅是共享此文档,如果测试人员需要进一步获取完整的测试XML文件,到参考链接的官方获取。

    参考资料:

    http://tomeko.net/other/sipp/sipp_cheatsheet.php?lang=en

    关注微信公众号:asterisk-cn,获得有价值的Asterisk行业分享Asterisk freepbx 中文官方论坛:http://bbs.freepbx.cn/forum.phpAsterisk freepbx,FreeSBC技术文档: www.freepbx.org.cn融合通信商业解决方案,协同解决方案首选产品:www.hiastar.comAsterisk/FreePBX中国合作伙伴,官方qq技术分享群(3000人):589995817

    相关文章

      网友评论

          本文标题:完整SIPp测试环境下各种SIP场景测试和配置文件

          本文链接:https://www.haomeiwen.com/subject/bjlrcctx.html