您当前的位置是:  首页 > 资讯 > 国内 >
 首页 > 资讯 > 国内 >

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

2019-06-27 13:45:02   作者:james.zhu   来源:Asterisk开源派   评论: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
  1. <scenario name="Options">
  2. <send>
  3. <![CDATA[
  4. 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
  5. ]]>
  6. </send>
  7. <recv response="200" timeout="200"> </recv>
  8. </scenario>
  测试示例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配置文件:
  1. <!--
  2. Use with CSV file struct like: 3000;192.168.1.106;[authentication username=3000 password=3000];
  3. (user part of uri, server address, auth tag in each line)
  4. -->
  5. <scenario name="register_client">
  6. <send retrans="500">
  7. <![CDATA[
  8. 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
  9. ]]>
  10. </send>
  11. <!--  asterisk  -->
  12. <recv response="100" optional="true"> </recv>
  13. <recv response="401" auth="true"> </recv>
  14. <send retrans="500">
  15. <![CDATA[
  16. 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
  17. ]]>
  18. </send>
  19. <!--  asterisk  -->
  20. <recv response="100" optional="true"> </recv>
  21. <recv response="200"> </recv>
  22. <!--  response time repartition table (ms)    -->
  23. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  24. <!--  call length repartition table (ms)      -->
  25. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  26. </scenario>
  CVS文件:
  测试示例3- REGISTER + SUBSCRIBE application/dialog-info+xml (BLF)
  注册到192.168.1.211地址,同时在CVS文件中的参数支持了dialog-info subscription (RFC4235)订阅。
  XML配置文件:
  1. <scenario name="UAC REGISTER + SUBSCRIBE dialog-info">
  2. <!--
  3. Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
  4. (user part of uri, server address, auth tag, subscribed user in each line)
  5. -->
  6. <send retrans="500">
  7. <![CDATA[
  8. 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
  9. ]]>
  10. </send>
  11. <!--  asterisk  -->
  12. <recv response="100" optional="true"> </recv>
  13. <recv response="401" auth="true"> </recv>
  14. <send retrans="500">
  15. <![CDATA[
  16. 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
  17. ]]>
  18. </send>
  19. <!--  asterisk  -->
  20. <recv response="100" optional="true"> </recv>
  21. <recv response="200"> </recv>
  22. <send retrans="500">
  23. <![CDATA[
  24. 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
  25. ]]>
  26. </send>
  27. <recv response="200" rtd="true"> </recv>
  28. <recv request="NOTIFY" crlf="true"> </recv>
  29. <send>
  30. <![CDATA[
  31. SIP/2.0 200 OK [last_Via:] [last_From:] [last_To:] [last_Call-ID:] [last_CSeq:] Content-Length: 0
  32. ]]>
  33. </send>
  34. <!--
  35. definition of the response time repartition table (unit is ms)
  36. -->
  37. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  38. <!--
  39. definition of the call length repartition table (unit is ms)
  40. ->
  41. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  42. </scenario>
  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
  配置文件:
  1. <scenario name="UAC REGISTER + INVITE + call">
  2. <!--
  3. Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
  4. (user part of uri, server address, auth tag, call target)
  5.  ->
  6. <send retrans="500">
  7. <![CDATA[
  8. 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
  9. ]]>
  10. </send>
  11. <!--  asterisk  -->
  12. <recv response="100" optional="true"> </recv>
  13. <recv response="401" auth="true"> </recv>
  14. <send retrans="500">
  15. <![CDATA[
  16. 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
  17. ]]>
  18. </send>
  19. <!--  asterisk  -->
  20. <recv response="100" optional="true"> </recv>
  21. <recv response="200"> </recv>
  22. <send retrans="500">
  23. <![CDATA[
  24. 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
  25. ]]>
  26. </send>
  27. <recv response="100" optional="true"> </recv>
  28. <recv response="180" optional="true"> </recv>
  29. <recv response="183" optional="true"> </recv>
  30. <recv response="200"> </recv>
  31. <send>
  32. <![CDATA[
  33. 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
  34. ]]>
  35. </send>
  36. <pause milliseconds="30000"/>
  37. <send retrans="500">
  38. <![CDATA[
  39. 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
  40. ]]>
  41. </send>
  42. <!--
  43. The 'crlf' option inserts a blank line in the statistics report.
  44. -->
  45. <recv response="200" crlf="true"> </recv>
  46. <!--
  47. definition of the response time repartition table (unit is ms)
  48. -->
  49. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  50. <!--
  51. definition of the call length repartition table (unit is ms)
  52. -->
  53. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  54. </scenario>
  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文件:
  1. <scenario name="UAC REGISTER + INVITE + call">
  2. <!--
  3. Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
  4. (user part of uri, server address, auth tag, call target)
  5. -->
  6. <send retrans="500">
  7. <![CDATA[
  8. 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
  9. ]]>
  10. </send>
  11. <!--  asterisk  -->
  12. <recv response="100" optional="true"> </recv>
  13. <recv response="401" auth="true"> </recv>
  14. <send retrans="500">
  15. <![CDATA[
  16. 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
  17. ]]>
  18. </send>
  19. <!--  asterisk  -->
  20. <recv response="100" optional="true"> </recv>
  21. <recv response="200"> </recv>
  22. <send retrans="500">
  23. <![CDATA[
  24. 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
  25. ]]>
  26. </send>
  27. <recv response="100" optional="true"> </recv>
  28. <recv response="407" auth="true"> </recv>
  29. <send>
  30. <![CDATA[
  31. 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
  32. ]]>
  33. </send>
  34. <send retrans="500">
  35. <![CDATA[
  36. 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
  37. ]]>
  38. </send>
  39. <recv response="100" optional="true"> </recv>
  40. <recv response="180" optional="true"> </recv>
  41. <recv response="183" optional="true"> </recv>
  42. <recv response="200" rrs="true"> </recv>
  43. <send>
  44. <![CDATA[
  45. 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
  46. ]]>
  47. </send>
  48. <!--  Play a pre-recorded PCAP file (RTP stream)                        -->
  49. <nop>
  50. <action>
  51. <exec play_pcap_audio="pcap/g711a.pcap"/>
  52. </action>
  53. </nop>
  54. <!--
  55. Pause 60 seconds, which is less than the duration of the
  56. -->
  57. <pause milliseconds="60000"/>
  58. <send retrans="500">
  59. <![CDATA[
  60. 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
  61. ]]>
  62. </send>
  63. <!--
  64. The 'crlf' option inserts a blank line in the statistics report.
  65. -->
  66. <recv response="200" crlf="true"> </recv>
  67. <!--
  68. definition of the response time repartition table (unit is ms)
  69. -->
  70. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  71. <!--
  72. definition of the call length repartition table (unit is ms)
  73. -->
  74. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  75. </scenario>
  CVS文件:
  测试示例6-INVITE + CANCEL immediately after SIP/100
  命令:
  sipp 192.168.1.211 -sf INVITE_CANCEL.xml -recv_timeout 10000 -m 1 -l 1
  1. <scenario name="UAC INVITE + call">
  2. <!--
  3. Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
  4. (user part of uri, server address, auth tag, call target)
  5. -->
  6. <send retrans="500">
  7. <![CDATA[
  8. 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
  9. ]]>
  10. </send>
  11. <recv response="100">
  12. <action>
  13. <ereg regexp=";branch=[^;]*" search_in="hdr" header="Via" check_it="false" assign_to="1"/>
  14. </action>
  15. </recv>
  16. <send retrans="500">
  17. <![CDATA[
  18. 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
  19. ]]>
  20. </send>
  21. <recv response="200"/>
  22. <recv response="487"/>
  23. <send>
  24. <![CDATA[
  25. 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
  26. ]]>
  27. </send>
  28. <pause milliseconds="3000"/>
  29. <!--
  30. definition of the response time repartition table (unit is ms)
  31. -->
  32. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  33. <!--
  34. definition of the call length repartition table (unit is ms)
  35. -->
  36. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  37. </scenario>
  测试示例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文件:
  1. <scenario name="UAC INVITE with video SDP + call">
  2. <send retrans="500">
  3. <![CDATA[
  4. 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
  5. ]]>
  6. </send>
  7. <recv response="100" optional="true"> </recv>
  8. <recv response="180" optional="true"> </recv>
  9. <recv response="183" optional="true"> </recv>
  10. <recv response="200"> </recv>
  11. <send>
  12. <![CDATA[
  13. 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
  14. ]]>
  15. </send>
  16. <pause milliseconds="30000"/>
  17. <send retrans="500">
  18. <![CDATA[
  19. 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
  20. ]]>
  21. </send>
  22. <!--
  23. The 'crlf' option inserts a blank line in the statistics report.
  24. -->
  25. <recv response="200" crlf="true"> </recv>
  26. <pause milliseconds="1500"/>
  27. <!--
  28. definition of the response time repartition table (unit is ms)
  29. -->
  30. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  31. <!--
  32. definition of the call length repartition table (unit is ms)
  33. -->
  34. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  35. </scenario>
  测试示例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文件:
  1. <scenario name="UAC INVITE + call">
  2. <!--
  3. sipp 192.168.1.211 -sf invite_T38_reINVITE.xml -s 30 -r 1 -l 12 -m 1
  4. -->
  5. <send retrans="500">
  6. <![CDATA[
  7. 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
  8. ]]>
  9. </send>
  10. <recv response="100" optional="true"> </recv>
  11. <recv response="180" optional="true"> </recv>
  12. <recv response="183" optional="true"> </recv>
  13. <recv response="200"> </recv>
  14. <send>
  15. <![CDATA[
  16. 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
  17. ]]>
  18. </send>
  19. <pause milliseconds="5000"/>
  20. <send retrans="500">
  21. <![CDATA[
  22. 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
  23. ]]>
  24. </send>
  25. <recv response="488"> </recv>
  26. <send>
  27. <![CDATA[
  28. 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
  29. ]]>
  30. </send>
  31. <pause milliseconds="5000"/>
  32.   
  33. <!--
  34. <send retrans="500">
  35. <![CDATA[
  36.   
  37. BYE sip:[remote_ip]:[remote_port] SIP/2.0
  38. Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
  39. From: <sip:[local_ip]>;tag=[call_number]
  40. [last_To:]
  41. Call-ID: [call_id]
  42. CSeq: [cseq] BYE
  43. Contact: sip:sipp@[local_ip]:[local_port]
  44. Max-Forwards: 10
  45. Content-Length: 0
  46. ]]>
  47.   
  48. </send>
  49. -->
  50. <!--
  51. The 'crlf' option inserts a blank line in the statistics report.
  52. -->
  53. <recv response="200" crlf="true"> </recv>
  54. <pause milliseconds="1500"/>
  55. <!--
  56. definition of the response time repartition table (unit is ms)
  57. -->
  58. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  59. <!--
  60. definition of the call length repartition table (unit is ms)
  61. -->
  62. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  63. </scenario>
  测试示例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):
  1. <scenario name="UAS REGISTER + SUBSCRIBE/noresource">
  2. <!--
  3. By adding rrs="true" (Record Route Sets), the route sets
  4. -->
  5. <!--
  6. are saved and used for following messages sent. Useful to test
  7. -->
  8. <!--  against stateful SIP proxies/B2BUAs.                              -->
  9. <recv request="REGISTER" crlf="true"> </recv>
  10. <!--
  11. The '[last_*]' keyword is replaced automatically by the
  12. -->
  13. <!--
  14. specified header if it was present in the last message received
  15. -->
  16. <!--
  17. (except if it was a retransmission). If the header was not
  18. -->
  19. <!--
  20. present or if no message has been received, the '[last_*]'
  21. -->
  22. <!--
  23. keyword is discarded, and all bytes until the end of the line
  24. -->
  25. <!--  are also discarded.                                               -->
  26. <!--                                                                    -->
  27. <!--
  28. If the specified header was present several times in the
  29. -->
  30. <!--
  31. message, all occurences are concatenated (CRLF seperated)
  32. -->
  33. <!--  to be used in place of the '[last_*]' keyword.                    -->
  34. <send>
  35. <![CDATA[
  36. 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
  37. ]]>
  38. </send>
  39. </scenario>
  XML配置文件(uas_subscribe):
  1. <scenario name="UAS SUBSCRIBE/noresource">
  2. <recv request="SUBSCRIBE" crlf="true"> </recv>
  3. <send>
  4. <![CDATA[
  5. 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
  6. ]]>
  7. </send>
  8. <send>
  9. <![CDATA[
  10. 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
  11. ]]>
  12. </send>
  13. <recv response="200" rtd="true"> </recv>
  14. </scenario>
  测试示例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配置文件:
  1. <scenario name="Unsolicited NOTIFY with MWI (message-summary Event)">
  2. <!--
  3. Respond to registration request. Tested phone seems to do not
  4. react to NOTIFY sent from other host than registration server
  5. -->
  6. <recv request="REGISTER" crlf="true"> </recv>
  7. <send>
  8. <![CDATA[
  9. 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
  10. ]]>
  11. </send>
  12. <!--
  13. Send unsolicited NOTIFY with MWI info (2 new/8 old messages, 0 new urgent/ 2 old urgent )
  14. -->
  15. <send retrans="500">
  16. <![CDATA[
  17. 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)
  18. ]]>
  19. </send>
  20. <recv response="200"> </recv>
  21. <pause milliseconds="10000"/>
  22. <!--  Send unsolicited NOTIFY with MWI info: no messages     -->
  23. <send retrans="500">
  24. <![CDATA[
  25. 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)
  26. ]]>
  27. </send>
  28. <recv response="200"> </recv>
  29. <pause milliseconds="10000"/>
  30. <!--
  31. Send unsolicited NOTIFY with MWI info (3 new/9 old messages, 1 new urgent/ 1 old urgent )
  32. -->
  33. <send retrans="500">
  34. <![CDATA[
  35. 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)
  36. ]]>
  37. </send>
  38. <recv response="200"> </recv>
  39. <pause milliseconds="10000"/>
  40. <!--  Send unsolicited NOTIFY with MWI info: no messages     -->
  41. <send retrans="500">
  42. <![CDATA[
  43. 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)
  44. ]]>
  45. </send>
  46. <recv response="200"> </recv>
  47.   <!--
  48. definition of the response time repartition table (unit is ms)
  49. -->
  50. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  51. <!--
  52. definition of the call length repartition table (unit is ms)
  53. -->
  54. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  55. </scenario>
  测试示例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配置文件:
  1. <!--
  2.  
  3. NOTIFY with Event: talk can trigger accepting incoming call on supporting phone
  4. (e.g. Yealink, Polycom).
  5. Note: this scenario does not handle authentification.
  6. -->
  7. <scenario name="Unsolicited NOTIFY with Event: talk">
  8. <send retrans="500">
  9. <![CDATA[
  10. 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]
  11. ]]>
  12. </send>
  13. <recv response="200"> </recv>
  14. </scenario>
  测试示例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配置:
  1. <!--
  2.   
  3. Testing: device response to UPDATE message with no body
  4. (aka session audit).
  5. Usage: sipp-win32 ip_address -sf invite_update.xml -m 1
  6. -->
  7. <scenario name="UAC INVITE + call">
  8. <send retrans="500">
  9. <![CDATA[
  10. 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
  11. ]]>
  12. </send>
  13. <recv response="100" optional="true"> </recv>
  14. <recv response="180" optional="true"> </recv>
  15. <recv response="183" optional="true"> </recv>
  16. <recv response="200"> </recv>
  17. <send>
  18. <![CDATA[
  19. 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
  20. ]]>
  21. </send>
  22. <pause milliseconds="5000"/>
  23. <send retrans="500">
  24. <![CDATA[
  25. 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
  26. ]]>
  27. </send>
  28. <recv response="200"> </recv>
  29. <send retrans="500">
  30. <![CDATA[
  31. 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
  32. ]]>
  33. </send>
  34. <!--
  35. The 'crlf' option inserts a blank line in the statistics report.
  36. -->
  37. <recv response="200" crlf="true"> </recv>
  38. <pause milliseconds="1500"/>
  39. <!--
  40. definition of the response time repartition table (unit is ms)
  41. -->
  42. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  43. <!--
  44. definition of the call length repartition table (unit is ms)
  45. -->
  46. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  47. </scenario>
  测试示例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配置文件:
  1. <scenario name="UAC REGISTER + INVITE + INFO">
  2. <!--
  3. Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;1;0;9
  4. (user part of uri, server address, auth tag, call target | dtmf digit1, digit2, digit3).
  5. In my test call target is actually FXS routed back to FXO that picks calls
  6. automatically and switches them to DISA. Caller dials then another subscriber
  7. number using SIP INFO messages.
  8. -->
  9. <send retrans="500">
  10. <![CDATA[
  11. 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
  12. ]]>
  13. </send>
  14. <!--  asterisk  -->
  15. <recv response="100" optional="true"> </recv>
  16. <recv response="401" auth="true"> </recv>
  17. <send retrans="500">
  18. <![CDATA[
  19. 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
  20. ]]>
  21. </send>
  22. <!--  asterisk  -->
  23. <recv response="100" optional="true"> </recv>
  24. <recv response="200"> </recv>
  25. <send retrans="500">
  26. <![CDATA[
  27. 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
  28. ]]>
  29. </send>
  30. <recv response="100" optional="true"> </recv>
  31. <recv response="180" optional="true"> </recv>
  32. <recv response="183" optional="true"> </recv>
  33. <recv response="200"> </recv>
  34. <send>
  35. <![CDATA[
  36. 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
  37. ]]>
  38. </send>
  39. <!--  "Listening to DISA announcement"  -->
  40. <!--  <pause milliseconds="3000" />  -->
  41. <pause distribution="uniform" min="1000" max="10000"/>
  42. <!--  Dial first digit  -->
  43. <send retrans="500">
  44. <![CDATA[
  45. 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
  46. ]]>
  47. </send>
  48. <recv response="200"> </recv>
  49. <!--  Dial second digit  -->
  50. <send retrans="500">
  51. <![CDATA[
  52. 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
  53. ]]>
  54. </send>
  55. <recv response="200"> </recv>
  56. <!--  Dial third digit  -->
  57. <send retrans="500">
  58. <![CDATA[
  59. 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
  60. ]]>
  61. </send>
  62. <recv response="200"> </recv>
  63. <!--  Number dialed, wait for a moment  -->
  64. <pause distribution="uniform" min="1000" max="8000"/>
  65. <send retrans="500">
  66. <![CDATA[
  67. 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
  68. ]]>
  69. </send>
  70. <!--
  71. The 'crlf' option inserts a blank line in the statistics report.
  72. -->
  73. <recv response="200" crlf="true"> </recv>
  74. <!--
  75. The purpose of this pause is to give some time for FXO/FXS lines to
  76. detect disconnection.
  77.   
  78. -->
  79. <pause milliseconds="5000"/>
  80. <!--
  81. definition of the response time repartition table (unit is ms)
  82. -->
  83. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  84. <!--
  85. definition of the call length repartition table (unit is ms)
  86. -->
  87. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  88. </scenario>
  CVS配置文件:
  测试示例14- SIP digest 漏洞测试
  通过此命令检测IPPBX分机号码的漏洞。
  命令:
  sipp 192.168.1.211 -sf uac_digest_leak.xml -s 30 -m 1
  XML配置:
  1. his XML file does not appear to have any style information associated with it. The document tree is shown below.
  2. <!--  SIP digest leak test scenario  -->
  3. <!--
  4. Note: realm at WWW-Authenticate may have to be changed if phone realm configuration is not empty
  5. -->
  6. <!--
  7. (empty realm at phone configuration = auth against any realm)
  8. -->
  9. <!--  http://tomeko.net  -->
  10. <scenario name="SIP digest leak test">
  11. <!--
  12. In client mode (sipp placing calls), the Call-ID MUST be
  13. -->
  14. <!--
  15. generated by sipp. To do so, use [call_id] keyword.
  16. -->
  17. <send retrans="500">
  18. <![CDATA[
  19. 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
  20. ]]>
  21. </send>
  22. <recv response="100" optional="true"> </recv>
  23. <recv response="180" optional="true"> </recv>
  24. <!--
  25. By adding rrs="true" (Record Route Sets), the route sets
  26. -->
  27. <!--
  28. are saved and used for following messages sent. Useful to test
  29. -->
  30. <!--  against stateful SIP proxies/B2BUAs.                              -->
  31. <recv response="200" rtd="true"> </recv>
  32. <!--
  33. Packet lost can be simulated in any send/recv message by
  34. -->
  35. <!--
  36. by adding the 'lost = "10"'. Value can be [1-100] percent.
  37. -->
  38. <send>
  39. <![CDATA[
  40. 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
  41. ]]>
  42. </send>
  43. <!--
  44. At this moment second party is hanging up call (no audio there)
  45. -->
  46. <recv request="BYE"/>
  47. <!--
  48. Test with SIP hardware phone: must use WWW-Authenticate instead of Proxy-Authenticate.
  49. You could also try with SIP/2.0 401 Unauthorized.
  50. -->
  51. <send>
  52. <![CDATA[
  53. 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
  54. ]]>
  55. </send>
  56. <recv request="BYE"/>
  57. </scenario>
  测试示例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配置:
  1. <!--
  2. This program is free software; you can redistribute it and/or
  3. -->
  4. <!--
  5. modify it under the terms of the GNU General Public License as
  6. -->
  7. <!--
  8. published by the Free Software Foundation; either version 2 of the
  9. -->
  10. <!--  License, or (at your option) any later version.                     -->
  11. <!--                                                                      -->
  12. <!--
  13. This program is distributed in the hope that it will be useful,
  14. -->
  15. <!--
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. -->
  18. <!--
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. -->
  21. <!--  GNU General Public License for more details.                        -->
  22. <!--                                                                      -->
  23. <!--
  24. You should have received a copy of the GNU General Public License
  25. -->
  26. <!--  along with this program; if not, write to the                       -->
  27. <!--  Free Software Foundation, Inc.,                                     -->
  28. <!--
  29. 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  30. -->
  31. <!--                                                                      -->
  32. <!--                  Sipp 'uac' scenario with pcap (rtp) play            -->
  33. <!--                                                                      -->
  34. <scenario name="UAC with media">
  35. <!--
  36. In client mode (sipp placing calls), the Call-ID MUST be
  37. -->
  38. <!--
  39. generated by sipp. To do so, use [call_id] keyword.
  40. -->
  41. <send retrans="500">
  42. <![CDATA[
  43. 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
  44. ]]>
  45. </send>
  46. <recv response="100" optional="true"> </recv>
  47. <recv response="180" optional="true"> </recv>
  48. <!--
  49. By adding rrs="true" (Record Route Sets), the route sets
  50. -->
  51. <!--
  52. are saved and used for following messages sent. Useful to test
  53. -->
  54. <!--  against stateful SIP proxies/B2BUAs.                              -->
  55. <recv response="200" rtd="true" crlf="true"> </recv>
  56. <!--
  57. Packet lost can be simulated in any send/recv message by
  58. -->
  59. <!--
  60. by adding the 'lost = "10"'. Value can be [1-100] percent.
  61. -->
  62. <send>
  63. <![CDATA[
  64. 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
  65. ]]>
  66. </send>
  67. <!--  Play a pre-recorded PCAP file (RTP stream)                        -->
  68. <nop>
  69. <action>
  70. <exec play_pcap_audio="pcap/g729.pcap"/> // 文件存放地址
  71. </action>
  72. </nop>
  73. <!--
  74. Pause 60 seconds, which is less than the duration of the
  75. -->
  76. <!--  PCAP file                                                         -->
  77. <pause milliseconds="60000"/>
  78. <!--  Play an out of band DTMF '1'                                      -->
  79. <nop>
  80. <action>
  81. <exec play_pcap_audio="pcap/dtmf_2833_1.pcap"/>
  82. </action>
  83. </nop>
  84. <pause milliseconds="1000"/>
  85. <!--
  86. The 'crlf' option inserts a blank line in the statistics report.
  87. -->
  88. <send retrans="500">
  89. <![CDATA[
  90. 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
  91. ]]>
  92. </send>
  93. <recv response="200" crlf="true"> </recv>
  94. <!--
  95. definition of the response time repartition table (unit is ms)
  96. -->
  97. <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  98. <!--
  99. definition of the call length repartition table (unit is ms)
  100. -->
  101. <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
  102. </scenario>
  测试示例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
  测试示例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配置文件:
  配置文件
  http://tomeko.net/other/sipp/scenarios/REGISTER_INVITE_REFER.xml
  测试示例18-UAS with T38 reinvite
  检测到传真音时,模拟UAS发送re-INVITE,携带image/t38。涉及测试需要根据官方文档
  做进一步配置说明。
  命令:
  sipp -sf uas_T38_reinvite.xml
  XML配置文件
  配置文件
  http://tomeko.net/other/sipp/scenarios/uas_T38_reinvite.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
  配置文件
  配置文件
  http://tomeko.net/other/sipp/sipsak/reboot_yealink.sipfile
  总结:
  以上19个SIPp测试示例是第三方测试人员的测试文档,笔者在前几年仅测试过几个示例,基本上都
  可以工作。需要强调的是,用户需要安装自己的IPPBX,软交换或者其他媒体服务器,
  并且需要有针对性的配置。然后根据XML配置文件和预设的默认支持文件来实现测试。
  笔者仅是共享此文档,如果测试人员需要进一步获取完整的测试XML文件,到参考链接的官方获取。
  参考资料:
  http://tomeko.net/other/sipp/sipp_cheatsheet.php?lang=en
 
   
  FreeSBC/ProSBC 免费边界会话控制器, 下载ISO:https://freesbc.telcobridges.com/
  关注微信公众号:asterisk-cn,获得有价值的Asterisk行业分享
  Asterisk freepbx 中文官方论坛:http://bbs.freepbx.cn/forum.php
  Asterisk freepbx技术文档: www.freepbx.org.cn
  融合通信商业解决方案,协同解决方案首选产品:www.hiastar.com
  Asterisk/FreePBX中国合作伙伴,官方qq技术分享群(3000千人):589995817
 

【免责声明】本文仅代表作者本人观点,与CTI论坛无关。CTI论坛对文中陈述、观点判断保持中立,不对所包含内容的准确性、可靠性或完整性提供任何明示或暗示的保证。请读者仅作参考,并请自行承担全部责任。

专题

CTI论坛会员企业