From 0723dbc601c74330f792db67ad75f6d580c30d8b Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Mon, 22 Dec 2008 18:54:58 +0000 Subject: Created top-level directory tests and moved test-pjsua there. This will be the placeholder for future developed tests git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2392 74dad513-b988-da41-8d7b-12977e46ad98 --- tests/pjsua/scripts-sendto/100_simplecall.py | 20 ++++++++++ .../scripts-sendto/120_sdp_with_video_dynamic_1.py | 28 ++++++++++++++ .../scripts-sendto/120_sdp_with_video_dynamic_2.py | 28 ++++++++++++++ .../scripts-sendto/121_sdp_with_video_static_1.py | 28 ++++++++++++++ .../scripts-sendto/121_sdp_with_video_static_2.py | 28 ++++++++++++++ .../122_sdp_with_unknown_dynamic_1.py | 27 +++++++++++++ .../122_sdp_with_unknown_dynamic_2.py | 27 +++++++++++++ .../123_sdp_with_unknown_static_1.py | 27 +++++++++++++ .../123_sdp_with_unknown_static_2.py | 27 +++++++++++++ ...24_sdp_with_unknown_static_unknown_transport.py | 27 +++++++++++++ .../scripts-sendto/125_sdp_with_multi_audio_0.py | 30 +++++++++++++++ .../scripts-sendto/125_sdp_with_multi_audio_1.py | 27 +++++++++++++ .../scripts-sendto/125_sdp_with_multi_audio_2.py | 27 +++++++++++++ .../scripts-sendto/125_sdp_with_multi_audio_3.py | 28 ++++++++++++++ .../scripts-sendto/125_sdp_with_multi_audio_4.py | 27 +++++++++++++ tests/pjsua/scripts-sendto/150_err_extension.py | 27 +++++++++++++ tests/pjsua/scripts-sendto/151_err_sdp_video.py | 23 +++++++++++ tests/pjsua/scripts-sendto/152_err_sdp_no_media.py | 22 +++++++++++ .../153_err_sdp_unsupported_codec.py | 24 ++++++++++++ .../pjsua/scripts-sendto/155_err_sdp_bad_syntax.py | 23 +++++++++++ .../scripts-sendto/156_err_sdp_bad_net_type.py | 27 +++++++++++++ .../scripts-sendto/157_err_sdp_bad_addr_type.py | 27 +++++++++++++ .../158_err_sdp_bad_transport_type.py | 27 +++++++++++++ .../scripts-sendto/160_err_duplicate_replaces.py | 23 +++++++++++ .../161_err_replaces_dlg_not_found.py | 23 +++++++++++ tests/pjsua/scripts-sendto/200_ice_no_ice.py | 26 +++++++++++++ tests/pjsua/scripts-sendto/200_ice_success_1.py | 31 +++++++++++++++ tests/pjsua/scripts-sendto/200_ice_success_2.py | 36 +++++++++++++++++ tests/pjsua/scripts-sendto/200_ice_success_3.py | 35 +++++++++++++++++ tests/pjsua/scripts-sendto/200_ice_success_4.py | 35 +++++++++++++++++ tests/pjsua/scripts-sendto/201_ice_mismatch_1.py | 29 ++++++++++++++ tests/pjsua/scripts-sendto/201_ice_mismatch_2.py | 31 +++++++++++++++ tests/pjsua/scripts-sendto/201_ice_mismatch_3.py | 30 +++++++++++++++ .../300_srtp_crypto_case_insensitive.py | 27 +++++++++++++ .../300_srtp_duplicated_crypto_tag.py | 27 +++++++++++++ .../300_srtp_invalid_crypto_tag_non_numeric.py | 27 +++++++++++++ .../300_srtp_invalid_crypto_tag_zero.py | 26 +++++++++++++ .../scripts-sendto/300_srtp_receive_no_key_1.py | 26 +++++++++++++ .../scripts-sendto/300_srtp_receive_no_key_2.py | 26 +++++++++++++ .../scripts-sendto/300_srtp_receive_no_key_3.py | 26 +++++++++++++ tests/pjsua/scripts-sendto/301_srtp0_recv_avp.py | 28 ++++++++++++++ tests/pjsua/scripts-sendto/301_srtp0_recv_savp.py | 28 ++++++++++++++ tests/pjsua/scripts-sendto/310_srtp1_no_crypto.py | 26 +++++++++++++ tests/pjsua/scripts-sendto/311_srtp1_recv_avp.py | 28 ++++++++++++++ tests/pjsua/scripts-sendto/312_srtp1_recv_savp.py | 28 ++++++++++++++ .../scripts-sendto/313_srtp1_unsupported_crypto.py | 26 +++++++++++++ tests/pjsua/scripts-sendto/320_srtp2_no_crypto.py | 26 +++++++++++++ .../320_srtp_with_unknown_media_1.py | 28 ++++++++++++++ .../320_srtp_with_unknown_media_2.py | 28 ++++++++++++++ .../320_srtp_with_unknown_transport_1.py | 27 +++++++++++++ .../320_srtp_with_unknown_transport_2.py | 27 +++++++++++++ tests/pjsua/scripts-sendto/321_srtp2_recv_avp.py | 28 ++++++++++++++ tests/pjsua/scripts-sendto/322_srtp2_recv_savp.py | 28 ++++++++++++++ .../scripts-sendto/323_srtp2_unsupported_crypto.py | 26 +++++++++++++ .../scripts-sendto/330_srtp_prefer_rtp_savp.py | 30 +++++++++++++++ .../scripts-sendto/331_srtp_prefer_rtp_avp.py | 29 ++++++++++++++ tests/pjsua/scripts-sendto/360_non_sip_uri.py | 27 +++++++++++++ tests/pjsua/scripts-sendto/361_non_sip_uri.py | 26 +++++++++++++ tests/pjsua/scripts-sendto/362_non_sip_uri.py | 27 +++++++++++++ .../scripts-sendto/363_non_sip_uri_subscribe.py | 31 +++++++++++++++ .../scripts-sendto/364_non_sip_uri_subscribe.py | 30 +++++++++++++++ .../scripts-sendto/400_fmtp_g7221_with_bitrate.py | 34 ++++++++++++++++ .../401_fmtp_g7221_with_bitrate_24000.py | 35 +++++++++++++++++ .../401_fmtp_g7221_with_bitrate_32000.py | 35 +++++++++++++++++ .../410_fmtp_amrnb_offer_octet_align.py | 32 +++++++++++++++ .../411_fmtp_amrnb_offer_band_eff.py | 31 +++++++++++++++ .../412_fmtp_amrnb_offer_band_eff2.py | 32 +++++++++++++++ .../500_pres_subscribe_with_bad_event.py | 28 ++++++++++++++ tests/pjsua/scripts-sendto/999_asterisk_err.py | 45 ++++++++++++++++++++++ tests/pjsua/scripts-sendto/999_message_no_body.py | 24 ++++++++++++ 70 files changed, 1968 insertions(+) create mode 100644 tests/pjsua/scripts-sendto/100_simplecall.py create mode 100644 tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_1.py create mode 100644 tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_2.py create mode 100644 tests/pjsua/scripts-sendto/121_sdp_with_video_static_1.py create mode 100644 tests/pjsua/scripts-sendto/121_sdp_with_video_static_2.py create mode 100644 tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_1.py create mode 100644 tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_2.py create mode 100644 tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_1.py create mode 100644 tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_2.py create mode 100644 tests/pjsua/scripts-sendto/124_sdp_with_unknown_static_unknown_transport.py create mode 100644 tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_0.py create mode 100644 tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_1.py create mode 100644 tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_2.py create mode 100644 tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_3.py create mode 100644 tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_4.py create mode 100644 tests/pjsua/scripts-sendto/150_err_extension.py create mode 100644 tests/pjsua/scripts-sendto/151_err_sdp_video.py create mode 100644 tests/pjsua/scripts-sendto/152_err_sdp_no_media.py create mode 100644 tests/pjsua/scripts-sendto/153_err_sdp_unsupported_codec.py create mode 100644 tests/pjsua/scripts-sendto/155_err_sdp_bad_syntax.py create mode 100644 tests/pjsua/scripts-sendto/156_err_sdp_bad_net_type.py create mode 100644 tests/pjsua/scripts-sendto/157_err_sdp_bad_addr_type.py create mode 100644 tests/pjsua/scripts-sendto/158_err_sdp_bad_transport_type.py create mode 100644 tests/pjsua/scripts-sendto/160_err_duplicate_replaces.py create mode 100644 tests/pjsua/scripts-sendto/161_err_replaces_dlg_not_found.py create mode 100644 tests/pjsua/scripts-sendto/200_ice_no_ice.py create mode 100644 tests/pjsua/scripts-sendto/200_ice_success_1.py create mode 100644 tests/pjsua/scripts-sendto/200_ice_success_2.py create mode 100644 tests/pjsua/scripts-sendto/200_ice_success_3.py create mode 100644 tests/pjsua/scripts-sendto/200_ice_success_4.py create mode 100644 tests/pjsua/scripts-sendto/201_ice_mismatch_1.py create mode 100644 tests/pjsua/scripts-sendto/201_ice_mismatch_2.py create mode 100644 tests/pjsua/scripts-sendto/201_ice_mismatch_3.py create mode 100644 tests/pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py create mode 100644 tests/pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py create mode 100644 tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py create mode 100644 tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py create mode 100644 tests/pjsua/scripts-sendto/300_srtp_receive_no_key_1.py create mode 100644 tests/pjsua/scripts-sendto/300_srtp_receive_no_key_2.py create mode 100644 tests/pjsua/scripts-sendto/300_srtp_receive_no_key_3.py create mode 100644 tests/pjsua/scripts-sendto/301_srtp0_recv_avp.py create mode 100644 tests/pjsua/scripts-sendto/301_srtp0_recv_savp.py create mode 100644 tests/pjsua/scripts-sendto/310_srtp1_no_crypto.py create mode 100644 tests/pjsua/scripts-sendto/311_srtp1_recv_avp.py create mode 100644 tests/pjsua/scripts-sendto/312_srtp1_recv_savp.py create mode 100644 tests/pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py create mode 100644 tests/pjsua/scripts-sendto/320_srtp2_no_crypto.py create mode 100644 tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_1.py create mode 100644 tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_2.py create mode 100644 tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_1.py create mode 100644 tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_2.py create mode 100644 tests/pjsua/scripts-sendto/321_srtp2_recv_avp.py create mode 100644 tests/pjsua/scripts-sendto/322_srtp2_recv_savp.py create mode 100644 tests/pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py create mode 100644 tests/pjsua/scripts-sendto/330_srtp_prefer_rtp_savp.py create mode 100644 tests/pjsua/scripts-sendto/331_srtp_prefer_rtp_avp.py create mode 100644 tests/pjsua/scripts-sendto/360_non_sip_uri.py create mode 100644 tests/pjsua/scripts-sendto/361_non_sip_uri.py create mode 100644 tests/pjsua/scripts-sendto/362_non_sip_uri.py create mode 100644 tests/pjsua/scripts-sendto/363_non_sip_uri_subscribe.py create mode 100644 tests/pjsua/scripts-sendto/364_non_sip_uri_subscribe.py create mode 100644 tests/pjsua/scripts-sendto/400_fmtp_g7221_with_bitrate.py create mode 100644 tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_24000.py create mode 100644 tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_32000.py create mode 100644 tests/pjsua/scripts-sendto/410_fmtp_amrnb_offer_octet_align.py create mode 100644 tests/pjsua/scripts-sendto/411_fmtp_amrnb_offer_band_eff.py create mode 100644 tests/pjsua/scripts-sendto/412_fmtp_amrnb_offer_band_eff2.py create mode 100644 tests/pjsua/scripts-sendto/500_pres_subscribe_with_bad_event.py create mode 100644 tests/pjsua/scripts-sendto/999_asterisk_err.py create mode 100644 tests/pjsua/scripts-sendto/999_message_no_body.py (limited to 'tests/pjsua/scripts-sendto') diff --git a/tests/pjsua/scripts-sendto/100_simplecall.py b/tests/pjsua/scripts-sendto/100_simplecall.py new file mode 100644 index 00000000..3fc52dff --- /dev/null +++ b/tests/pjsua/scripts-sendto/100_simplecall.py @@ -0,0 +1,20 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +sendto_cfg = sip.SendtoCfg( "simple call", "--null-audio --auto-answer 200", sdp, 200) + diff --git a/tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_1.py b/tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_1.py new file mode 100644 index 00000000..e96919f3 --- /dev/null +++ b/tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_1.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Video uses dynamic payload type +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +m=video 4000 RTP/AVP 100 +a=rtpmap:100 myvideo/80000 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=video 0 RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_2.py b/tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_2.py new file mode 100644 index 00000000..6bdda923 --- /dev/null +++ b/tests/pjsua/scripts-sendto/120_sdp_with_video_dynamic_2.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# In this case the video codec uses dynamic payload type +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=video 4000 RTP/AVP 100 +a=rtpmap:100 myvideo/96000 +m=audio 5000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=video 0 RTP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/121_sdp_with_video_static_1.py b/tests/pjsua/scripts-sendto/121_sdp_with_video_static_1.py new file mode 100644 index 00000000..f05da5db --- /dev/null +++ b/tests/pjsua/scripts-sendto/121_sdp_with_video_static_1.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Video uses static payload type which will cause failure +# when session.c looks-up the codec in codec manager +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +m=video 4000 RTP/AVP 54 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=video 0 RTP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/121_sdp_with_video_static_2.py b/tests/pjsua/scripts-sendto/121_sdp_with_video_static_2.py new file mode 100644 index 00000000..67e01321 --- /dev/null +++ b/tests/pjsua/scripts-sendto/121_sdp_with_video_static_2.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Video uses static payload type which will cause failure +# when session.c looks-up the codec in codec manager +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=video 4000 RTP/AVP 54 +m=audio 5000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=video 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and video", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_1.py b/tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_1.py new file mode 100644 index 00000000..0e7ced75 --- /dev/null +++ b/tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_1.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +m=xapplicationx 4000 RTP/AVP 100 +a=rtpmap:100 myapp/80000 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=xapplicationx 0 RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_2.py b/tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_2.py new file mode 100644 index 00000000..7bdb14ee --- /dev/null +++ b/tests/pjsua/scripts-sendto/122_sdp_with_unknown_dynamic_2.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=xapplicationx 4000 RTP/AVP 100 +a=rtpmap:100 myapp/80000 +m=audio 5000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=xapplicationx 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_1.py b/tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_1.py new file mode 100644 index 00000000..3da14409 --- /dev/null +++ b/tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_1.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# The unknown media uses static payload type +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +m=xapplicationx 4000 RTP/AVP 54 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=xapplicationx 0 RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_2.py b/tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_2.py new file mode 100644 index 00000000..76ff13be --- /dev/null +++ b/tests/pjsua/scripts-sendto/123_sdp_with_unknown_static_2.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# The unknown media uses static payload type +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=xapplicationx 4000 RTP/AVP 54 +m=audio 5000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=xapplicationx 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and unknown", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/124_sdp_with_unknown_static_unknown_transport.py b/tests/pjsua/scripts-sendto/124_sdp_with_unknown_static_unknown_transport.py new file mode 100644 index 00000000..5d1b7d3f --- /dev/null +++ b/tests/pjsua/scripts-sendto/124_sdp_with_unknown_static_unknown_transport.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +m=xapplicationx 4000 XRTPX/XAVPX 54 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=xapplicationx 0 XRTPX/XAVPX " + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mixed audio and unknown and with unknown transport", + pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_0.py b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_0.py new file mode 100644 index 00000000..dbbedfff --- /dev/null +++ b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_0.py @@ -0,0 +1,30 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Multiple good m=audio lines! The current algorithm in pjsua-lib will +# select the last audio (which should be okay, as we're entitled to +# select any of them) +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +m=audio 4000 RTP/AVP 0 +m=audio 3000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio 0 RTP/AVP[\\s\\S]+m=audio 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Mutiple good m=audio lines", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_1.py b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_1.py new file mode 100644 index 00000000..3cfc6116 --- /dev/null +++ b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_1.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Multiple m=audio, one of them is bad +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +m=audio 4000 UNKNOWN 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+m=audio 0 UNKNOWN" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Audio and bad audio", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_2.py b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_2.py new file mode 100644 index 00000000..80cbf4b5 --- /dev/null +++ b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_2.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Multiple m=audio, one of them is bad +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 UNKNOWN 0 +m=audio 5000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio 0 UNKNOWN[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Audio and bad audio", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_3.py b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_3.py new file mode 100644 index 00000000..a0397c59 --- /dev/null +++ b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_3.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Multiple m=audio, one of them has dynamic PT codec that we don't support +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 100 +a=rtpmap:100 someunknowncodec/8000 +m=audio 4000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio 0 RTP/AVP[\s\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Multiple audio lines", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_4.py b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_4.py new file mode 100644 index 00000000..814de0d9 --- /dev/null +++ b/tests/pjsua/scripts-sendto/125_sdp_with_multi_audio_4.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Multiple m=audio, one of them has static PT codec that we don't support +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 80 +m=audio 4000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio 0 RTP/AVP[\s\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Multiple audio lines", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/150_err_extension.py b/tests/pjsua/scripts-sendto/150_err_extension.py new file mode 100644 index 00000000..cb46d1f4 --- /dev/null +++ b/tests/pjsua/scripts-sendto/150_err_extension.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "Require: xxx-my-extension\n" +include = ["Unsupported: xxx-my-extension"] +exclude = [] +sendto_cfg = sip.SendtoCfg("Bad extension", pjsua_args, sdp, 420, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + + diff --git a/tests/pjsua/scripts-sendto/151_err_sdp_video.py b/tests/pjsua/scripts-sendto/151_err_sdp_video.py new file mode 100644 index 00000000..1dc8422b --- /dev/null +++ b/tests/pjsua/scripts-sendto/151_err_sdp_video.py @@ -0,0 +1,23 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=video 4000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Video not acceptable", pjsua_args, sdp, 488, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/152_err_sdp_no_media.py b/tests/pjsua/scripts-sendto/152_err_sdp_no_media.py new file mode 100644 index 00000000..4e7465a2 --- /dev/null +++ b/tests/pjsua/scripts-sendto/152_err_sdp_no_media.py @@ -0,0 +1,22 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg("No media in SDP", pjsua_args, sdp, 400, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/153_err_sdp_unsupported_codec.py b/tests/pjsua/scripts-sendto/153_err_sdp_unsupported_codec.py new file mode 100644 index 00000000..1d6da2a8 --- /dev/null +++ b/tests/pjsua/scripts-sendto/153_err_sdp_unsupported_codec.py @@ -0,0 +1,24 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=video 4000 RTP/AVP 101 +a=rtpmap:101 my-proprietary-codec +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Unsupported codec", pjsua_args, sdp, 488, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/155_err_sdp_bad_syntax.py b/tests/pjsua/scripts-sendto/155_err_sdp_bad_syntax.py new file mode 100644 index 00000000..d32ef3d6 --- /dev/null +++ b/tests/pjsua/scripts-sendto/155_err_sdp_bad_syntax.py @@ -0,0 +1,23 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v= +o= +s= +c= +t= +a= +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = [ "Warning: " ] # better have Warning header +exclude = [] + +sendto_cfg = sip.SendtoCfg("Bad SDP syntax", pjsua_args, sdp, 400, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/156_err_sdp_bad_net_type.py b/tests/pjsua/scripts-sendto/156_err_sdp_bad_net_type.py new file mode 100644 index 00000000..7c1536b7 --- /dev/null +++ b/tests/pjsua/scripts-sendto/156_err_sdp_bad_net_type.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=AF IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = [ "Warning: " ] # better have Warning header +exclude = [] +sendto_cfg = sip.SendtoCfg("Bad SDP network type", pjsua_args, sdp, 400, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + + diff --git a/tests/pjsua/scripts-sendto/157_err_sdp_bad_addr_type.py b/tests/pjsua/scripts-sendto/157_err_sdp_bad_addr_type.py new file mode 100644 index 00000000..cac5c988 --- /dev/null +++ b/tests/pjsua/scripts-sendto/157_err_sdp_bad_addr_type.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP7 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = [ "Warning: " ] # better have Warning header +exclude = [] +sendto_cfg = sip.SendtoCfg("Bad SDP address type", pjsua_args, sdp, 400, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + + diff --git a/tests/pjsua/scripts-sendto/158_err_sdp_bad_transport_type.py b/tests/pjsua/scripts-sendto/158_err_sdp_bad_transport_type.py new file mode 100644 index 00000000..63dd811a --- /dev/null +++ b/tests/pjsua/scripts-sendto/158_err_sdp_bad_transport_type.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/XAVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "" +include = [] +exclude = [] +sendto_cfg = sip.SendtoCfg("Unsupported transport type", pjsua_args, sdp, 488, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + + diff --git a/tests/pjsua/scripts-sendto/160_err_duplicate_replaces.py b/tests/pjsua/scripts-sendto/160_err_duplicate_replaces.py new file mode 100644 index 00000000..ec4b0fdf --- /dev/null +++ b/tests/pjsua/scripts-sendto/160_err_duplicate_replaces.py @@ -0,0 +1,23 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "Replaces: abcd;from_tag=1\r\nReplaces: efgh;from_tag=2\r\n" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Duplicate replaces header", pjsua_args, sdp, 400, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/161_err_replaces_dlg_not_found.py b/tests/pjsua/scripts-sendto/161_err_replaces_dlg_not_found.py new file mode 100644 index 00000000..863a1a57 --- /dev/null +++ b/tests/pjsua/scripts-sendto/161_err_replaces_dlg_not_found.py @@ -0,0 +1,23 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200" +extra_headers = "Replaces: abcd;from_tag=1\r\n" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Replaced dialog not found", pjsua_args, sdp, 481, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/200_ice_no_ice.py b/tests/pjsua/scripts-sendto/200_ice_no_ice.py new file mode 100644 index 00000000..07a08f2a --- /dev/null +++ b/tests/pjsua/scripts-sendto/200_ice_no_ice.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1" +include = [] +exclude = ["a=ice", "a=candidate"] + +sendto_cfg = sip.SendtoCfg( "caller has no ice, answer must not have ICE", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/200_ice_success_1.py b/tests/pjsua/scripts-sendto/200_ice_success_1.py new file mode 100644 index 00000000..a2ff50d4 --- /dev/null +++ b/tests/pjsua/scripts-sendto/200_ice_success_1.py @@ -0,0 +1,31 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=ice-ufrag:1234 +a=ice-pwd:5678 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1" +include = ["a=ice-ufrag"] # must have ICE +exclude = ["a=candidate:[0-9a-zA-Z]+ 2 UDP", # must not answer with 2 components + "ice-mismatch" # must not mismatch + ] + +sendto_cfg = sip.SendtoCfg( "caller sends only one component", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/200_ice_success_2.py b/tests/pjsua/scripts-sendto/200_ice_success_2.py new file mode 100644 index 00000000..caf64b91 --- /dev/null +++ b/tests/pjsua/scripts-sendto/200_ice_success_2.py @@ -0,0 +1,36 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtcp:4382 IN IP4 192.168.0.4 +a=ice-ufrag:1234 +a=ice-pwd:5678 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host +a=candidate:YY 2 UDP 1234 192.168.0.4 4382 typ host +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1" +include = ["a=ice-ufrag", # must have ICE + "a=candidate:[0-9a-zA-Z]+ 2 UDP" # must have RTCP component + ] +exclude = [ + "ice-mismatch" # must not mismatch + ] + +sendto_cfg = sip.SendtoCfg( "caller sends only one component", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude, + enable_buffer = True) + diff --git a/tests/pjsua/scripts-sendto/200_ice_success_3.py b/tests/pjsua/scripts-sendto/200_ice_success_3.py new file mode 100644 index 00000000..2c741e44 --- /dev/null +++ b/tests/pjsua/scripts-sendto/200_ice_success_3.py @@ -0,0 +1,35 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=ice-ufrag:1234 +a=ice-pwd:5678 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host +a=candidate:YY 2 UDP 1234 127.0.0.1 4001 typ host +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1" +include = ["a=ice-ufrag", # must have ICE + "a=candidate:[0-9a-zA-Z]+ 2 UDP" # must have RTCP component + ] +exclude = [ + "ice-mismatch" # must not mismatch + ] + +sendto_cfg = sip.SendtoCfg( "caller sends two components without a=rtcp line", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude, + enable_buffer = True) + diff --git a/tests/pjsua/scripts-sendto/200_ice_success_4.py b/tests/pjsua/scripts-sendto/200_ice_success_4.py new file mode 100644 index 00000000..0ec3849c --- /dev/null +++ b/tests/pjsua/scripts-sendto/200_ice_success_4.py @@ -0,0 +1,35 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtcp:4382 IN IP4 192.168.0.4 +a=ice-ufrag:1234 +a=ice-pwd:5678 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host +a=candidate:YY 2 UDP 1234 127.0.0.2 4002 typ host +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1 --ice-no-rtcp" +include = ["a=ice-ufrag"] # must have ICE +exclude = [ + "ice-mismatch", # must not mismatch + "a=candidate:[0-9a-zA-Z]+ 2 UDP" # must not have RTCP component + ] + +sendto_cfg = sip.SendtoCfg( "pjsua with --ice-no-rtcp ignores RTCP things in the SDP", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude, + enable_buffer = True) + diff --git a/tests/pjsua/scripts-sendto/201_ice_mismatch_1.py b/tests/pjsua/scripts-sendto/201_ice_mismatch_1.py new file mode 100644 index 00000000..11b09336 --- /dev/null +++ b/tests/pjsua/scripts-sendto/201_ice_mismatch_1.py @@ -0,0 +1,29 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=ice-ufrag:1234 +a=ice-pwd:5678 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=candidate:XX 1 UDP 1 1.1.1.1 2222 typ host +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1" +include = ["a=ice-mismatch"] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller sends mismatched offer for comp 1", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/201_ice_mismatch_2.py b/tests/pjsua/scripts-sendto/201_ice_mismatch_2.py new file mode 100644 index 00000000..73710922 --- /dev/null +++ b/tests/pjsua/scripts-sendto/201_ice_mismatch_2.py @@ -0,0 +1,31 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtcp:4382 IN IP4 192.168.0.4 +a=ice-ufrag:1234 +a=ice-pwd:5678 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host +a=candidate:XX 2 UDP 1234 127.0.0.1 4000 typ host +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1" +include = ["a=ice-mismatch"] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller sends mismatched offer for comp 2", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/201_ice_mismatch_3.py b/tests/pjsua/scripts-sendto/201_ice_mismatch_3.py new file mode 100644 index 00000000..7706a159 --- /dev/null +++ b/tests/pjsua/scripts-sendto/201_ice_mismatch_3.py @@ -0,0 +1,30 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=pjmedia +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtcp:4382 IN IP4 192.168.0.4 +a=ice-ufrag:1234 +a=ice-pwd:5678 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=candidate:XX 1 UDP 1234 127.0.0.1 4000 typ host +""" + +args = "--null-audio --use-ice --auto-answer 200 --max-calls 1" +include = ["a=ice-mismatch"] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller sends mismatched offer for comp 2", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py b/tests/pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py new file mode 100644 index 00000000..2e3923e6 --- /dev/null +++ b/tests/pjsua/scripts-sendto/300_srtp_crypto_case_insensitive.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/SAVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AeS_Cm_128_HmAC_shA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:2 aEs_cM_128_HMaC_ShA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0" +include = ["m=audio \d+ RTP/SAVP", "a=crypto"] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller has used mixed case in crypto attr, callee must process that normally", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py b/tests/pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py new file mode 100644 index 00000000..d9228c82 --- /dev/null +++ b/tests/pjsua/scripts-sendto/300_srtp_duplicated_crypto_tag.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag, callee must not accept the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py b/tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py new file mode 100644 index 00000000..e1b05355 --- /dev/null +++ b/tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_non_numeric.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:x AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag (non-numeric), callee must not accept the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py b/tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py new file mode 100644 index 00000000..51e95d68 --- /dev/null +++ b/tests/pjsua/scripts-sendto/300_srtp_invalid_crypto_tag_zero.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller has used invalid crypto tag (zero), callee must not accept the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_1.py b/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_1.py new file mode 100644 index 00000000..7cc91a73 --- /dev/null +++ b/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_1.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:0 AES_CM_128_HMAC_SHA1_80 +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_2.py b/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_2.py new file mode 100644 index 00000000..0e347004 --- /dev/null +++ b/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_2.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_3.py b/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_3.py new file mode 100644 index 00000000..2849f713 --- /dev/null +++ b/tests/pjsua/scripts-sendto/300_srtp_receive_no_key_3.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline: +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller send crypto attr without key, callee must not accept the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/301_srtp0_recv_avp.py b/tests/pjsua/scripts-sendto/301_srtp0_recv_avp.py new file mode 100644 index 00000000..2ef19f33 --- /dev/null +++ b/tests/pjsua/scripts-sendto/301_srtp0_recv_avp.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 0 --srtp-secure 0" +include = [] +exclude = ["a=crypto"] + +sendto_cfg = sip.SendtoCfg( "Callee has SRTP disabled but receive RTP/AVP with crypto, should accept without crypto", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/301_srtp0_recv_savp.py b/tests/pjsua/scripts-sendto/301_srtp0_recv_savp.py new file mode 100644 index 00000000..d8a1ade9 --- /dev/null +++ b/tests/pjsua/scripts-sendto/301_srtp0_recv_savp.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/SAVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 0 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "Callee has SRTP disabled but receive RTP/SAVP, should reject the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/310_srtp1_no_crypto.py b/tests/pjsua/scripts-sendto/310_srtp1_no_crypto.py new file mode 100644 index 00000000..5bfb92e5 --- /dev/null +++ b/tests/pjsua/scripts-sendto/310_srtp1_no_crypto.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = ["m=audio \d+ RTP/AVP"] +exclude = ["a=crypto"] + +sendto_cfg = sip.SendtoCfg( "caller has no crypto attr, answer must accept without crypto attr", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/311_srtp1_recv_avp.py b/tests/pjsua/scripts-sendto/311_srtp1_recv_avp.py new file mode 100644 index 00000000..8b173f26 --- /dev/null +++ b/tests/pjsua/scripts-sendto/311_srtp1_recv_avp.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = ["m=audio \d+ RTP/AVP", "a=crypto"] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "Callee has SRTP optional and receive RTP/AVP with crypto, should accept with RTP/AVP & crypto", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/312_srtp1_recv_savp.py b/tests/pjsua/scripts-sendto/312_srtp1_recv_savp.py new file mode 100644 index 00000000..a3b30218 --- /dev/null +++ b/tests/pjsua/scripts-sendto/312_srtp1_recv_savp.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/SAVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = ["m=audio \d+ RTP/SAVP", "a=crypto"] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "Callee has SRTP optional receive RTP/SAVP, should answer RTP/SAVP too", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py b/tests/pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py new file mode 100644 index 00000000..7b457555 --- /dev/null +++ b/tests/pjsua/scripts-sendto/313_srtp1_unsupported_crypto.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 CRYPTO_X inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 1 --srtp-secure 0" +include = [] +exclude = ["a=crypto"] + +sendto_cfg = sip.SendtoCfg( "caller has used unsupported crypto, callee (SRTP optional) accept the call without crypto", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/320_srtp2_no_crypto.py b/tests/pjsua/scripts-sendto/320_srtp2_no_crypto.py new file mode 100644 index 00000000..6613b741 --- /dev/null +++ b/tests/pjsua/scripts-sendto/320_srtp2_no_crypto.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/SAVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller has no crypto attr on RTP/SAVP, callee must not accept the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_1.py b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_1.py new file mode 100644 index 00000000..4ee7bfea --- /dev/null +++ b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_1.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +m=xapplicationx 4000 RTP/AVP 100 +a=rtpmap:100 myapp/80000 +""" + +pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto[\\s\\S]+m=xapplicationx 0 RTP/AVP" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("SRTP audio and unknown media", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_2.py b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_2.py new file mode 100644 index 00000000..8536f1a2 --- /dev/null +++ b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_media_2.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=xapplicationx 4000 RTP/AVP 100 +a=rtpmap:100 myapp/80000 +m=audio 5000 RTP/AVP 0 +a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +""" + +pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=xapplicationx 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Unknown media and SRTP audio", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_1.py b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_1.py new file mode 100644 index 00000000..12aa61cb --- /dev/null +++ b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_1.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/AVP 0 +a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +m=audio 4000 UNKNOWN 0 +""" + +pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto[\\s\\S]+m=audio 0 UNKNOWN" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("SRTP audio and unknown media", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_2.py b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_2.py new file mode 100644 index 00000000..a1ac6ce0 --- /dev/null +++ b/tests/pjsua/scripts-sendto/320_srtp_with_unknown_transport_2.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 UNKNOWN 0 +m=audio 5000 RTP/AVP 0 +a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +""" + +pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio 0 UNKNOWN[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP[\\s\\S]+a=crypto" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("SRTP audio and unknown media", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/321_srtp2_recv_avp.py b/tests/pjsua/scripts-sendto/321_srtp2_recv_avp.py new file mode 100644 index 00000000..75c02453 --- /dev/null +++ b/tests/pjsua/scripts-sendto/321_srtp2_recv_avp.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "Callee has SRTP mandatory and receive RTP/AVP with crypto, should reject the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/322_srtp2_recv_savp.py b/tests/pjsua/scripts-sendto/322_srtp2_recv_savp.py new file mode 100644 index 00000000..5d5d53de --- /dev/null +++ b/tests/pjsua/scripts-sendto/322_srtp2_recv_savp.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/SAVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:t0r0/apkukU7JjjfR0mY8GEimBq4OiPEm9eKSFOx +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0" +include = ["m=audio \d+ RTP/SAVP", "a=crypto"] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "Callee has SRTP mandatory receive RTP/SAVP, should answer RTP/SAVP too", + pjsua_args=args, sdp=sdp, resp_code=200, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py b/tests/pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py new file mode 100644 index 00000000..782beba9 --- /dev/null +++ b/tests/pjsua/scripts-sendto/323_srtp2_unsupported_crypto.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=tester +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/SAVP 0 101 +a=rtpmap:0 PCMU/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +a=crypto:1 CRYPTO_X inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +""" + +args = "--null-audio --auto-answer 200 --max-calls 1 --use-srtp 2 --srtp-secure 0" +include = [] +exclude = [] + +sendto_cfg = sip.SendtoCfg( "caller has used unsupported crypto, callee (SRTP mandatory) must reject the call", + pjsua_args=args, sdp=sdp, resp_code=406, + resp_inc=include, resp_exc=exclude) diff --git a/tests/pjsua/scripts-sendto/330_srtp_prefer_rtp_savp.py b/tests/pjsua/scripts-sendto/330_srtp_prefer_rtp_savp.py new file mode 100644 index 00000000..e8097367 --- /dev/null +++ b/tests/pjsua/scripts-sendto/330_srtp_prefer_rtp_savp.py @@ -0,0 +1,30 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# When SRTP is enabled in pjsua, it should prefer to use +# RTP/SAVP media line if there are multiple m=audio lines +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 4000 RTP/AVP 0 +a=rtpmap:0 pcmu/8000 +m=audio 5000 RTP/SAVP 0 +a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +""" + +pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio 0 RTP/AVP[\\s\\S]+a=rtpmap:0[\\s\\S]+m=audio [1-9]+[0-9]* RTP/SAVP[\\s\\S]+a=crypto" + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Prefer RTP/SAVP", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/331_srtp_prefer_rtp_avp.py b/tests/pjsua/scripts-sendto/331_srtp_prefer_rtp_avp.py new file mode 100644 index 00000000..e42d20bd --- /dev/null +++ b/tests/pjsua/scripts-sendto/331_srtp_prefer_rtp_avp.py @@ -0,0 +1,29 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# When SRTP is NOT enabled in pjsua, it should prefer to use +# RTP/AVP media line if there are multiple m=audio lines +sdp = \ +""" +v=0 +o=- 0 0 IN IP4 127.0.0.1 +s=- +c=IN IP4 127.0.0.1 +t=0 0 +m=audio 5000 RTP/SAVP 0 +a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ +m=audio 4000 RTP/AVP 0 +""" + +pjsua_args = "--null-audio --auto-answer 200 --use-srtp 0" +extra_headers = "" +include = ["Content-Type: application/sdp", # response must include SDP + "m=audio 0 RTP/SAVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/AVP" + ] +exclude = ["a=crypto"] + +sendto_cfg = sip.SendtoCfg("Prefer RTP/SAVP", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/360_non_sip_uri.py b/tests/pjsua/scripts-sendto/360_non_sip_uri.py new file mode 100644 index 00000000..c4861aa3 --- /dev/null +++ b/tests/pjsua/scripts-sendto/360_non_sip_uri.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Some non-SIP URI's in Contact header +# +complete_msg = \ +"""INVITE sip:localhost SIP/2.0 +Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9 +Max-Forwards: 70 +From: ;tag=08cd5bfc2d8a4fddb1f5e59c6961d298 +To: +Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7 +CSeq: 0 INVITE +Contact: mailto:dontspam@pjsip.org +Contact: +Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue +Contact: +User-Agent: PJSUA v0.9.0-trunk/win32 +Content-Length: 0 +""" + + +sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact", + "--null-audio --auto-answer 200", + "", 200, complete_msg=complete_msg) + diff --git a/tests/pjsua/scripts-sendto/361_non_sip_uri.py b/tests/pjsua/scripts-sendto/361_non_sip_uri.py new file mode 100644 index 00000000..d24685d5 --- /dev/null +++ b/tests/pjsua/scripts-sendto/361_non_sip_uri.py @@ -0,0 +1,26 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# No SIP URI in Contact header +# +complete_msg = \ +"""INVITE sip:localhost SIP/2.0 +Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9 +Max-Forwards: 70 +From: ;tag=08cd5bfc2d8a4fddb1f5e59c6961d298 +To: +Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7 +CSeq: 0 INVITE +Contact: mailto:dontspam@pjsip.org +Contact: +Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue +User-Agent: PJSUA v0.9.0-trunk/win32 +Content-Length: 0 +""" + + +sendto_cfg = sip.SendtoCfg( "No SIP URI in Contact", + "--null-audio --auto-answer 200", + "", 500, complete_msg=complete_msg) + diff --git a/tests/pjsua/scripts-sendto/362_non_sip_uri.py b/tests/pjsua/scripts-sendto/362_non_sip_uri.py new file mode 100644 index 00000000..0c4b002a --- /dev/null +++ b/tests/pjsua/scripts-sendto/362_non_sip_uri.py @@ -0,0 +1,27 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Some non-SIP URI's in Contact header +# +complete_msg = \ +"""INVITE sip:localhost SIP/2.0 +Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9 +Max-Forwards: 70 +From: ;tag=08cd5bfc2d8a4fddb1f5e59c6961d298 +To: +Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7 +CSeq: 0 INVITE +Contact: +Contact: mailto:dontspam@pjsip.org +Contact: +Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue +User-Agent: PJSUA v0.9.0-trunk/win32 +Content-Length: 0 +""" + + +sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact", + "--null-audio --auto-answer 200", + "", 200, complete_msg=complete_msg) + diff --git a/tests/pjsua/scripts-sendto/363_non_sip_uri_subscribe.py b/tests/pjsua/scripts-sendto/363_non_sip_uri_subscribe.py new file mode 100644 index 00000000..5d3d42de --- /dev/null +++ b/tests/pjsua/scripts-sendto/363_non_sip_uri_subscribe.py @@ -0,0 +1,31 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Some non-SIP URI's in Contact header +# +complete_msg = \ +"""SUBSCRIBE sip:localhost SIP/2.0 +Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9 +Max-Forwards: 70 +From: ;tag=08cd5bfc2d8a4fddb1f5e59c6961d298 +To: +Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7 +CSeq: 0 SUBSCRIBE +Contact: mailto:dontspam@pjsip.org +Contact: +Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue +Contact: +Event: presence +Expires: 600 +Accept: application/pidf+xml, application/xpidf+xml +Allow-Events: presence, refer +User-Agent: PJSUA v0.9.0-trunk/win32 +Content-Length: 0 +""" + + +sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact", + "--null-audio --auto-answer 200", + "", 200, complete_msg=complete_msg) + diff --git a/tests/pjsua/scripts-sendto/364_non_sip_uri_subscribe.py b/tests/pjsua/scripts-sendto/364_non_sip_uri_subscribe.py new file mode 100644 index 00000000..f9beb05e --- /dev/null +++ b/tests/pjsua/scripts-sendto/364_non_sip_uri_subscribe.py @@ -0,0 +1,30 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Some non-SIP URI's in Contact header +# +complete_msg = \ +"""SUBSCRIBE sip:localhost SIP/2.0 +Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9 +Max-Forwards: 70 +From: ;tag=08cd5bfc2d8a4fddb1f5e59c6961d298 +To: +Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7 +CSeq: 0 SUBSCRIBE +Contact: mailto:dontspam@pjsip.org +Contact: +Contact: http://www.pjsip.org/the%20path.cgi?pname=pvalue +Event: presence +Expires: 600 +Accept: application/pidf+xml, application/xpidf+xml +Allow-Events: presence, refer +User-Agent: PJSUA v0.9.0-trunk/win32 +Content-Length: 0 +""" + + +sendto_cfg = sip.SendtoCfg( "Non SIP URI in Contact", + "--null-audio --auto-answer 200", + "", 400, complete_msg=complete_msg) + diff --git a/tests/pjsua/scripts-sendto/400_fmtp_g7221_with_bitrate.py b/tests/pjsua/scripts-sendto/400_fmtp_g7221_with_bitrate.py new file mode 100644 index 00000000..f21b4e7c --- /dev/null +++ b/tests/pjsua/scripts-sendto/400_fmtp_g7221_with_bitrate.py @@ -0,0 +1,34 @@ +# $Id $ +import inc_sip as sip +import inc_sdp as sdp + +# Answer for codec G722.1 should contain fmtp bitrate + +sdp = \ +""" +v=0 +o=- 3428650655 3428650655 IN IP4 192.168.1.9 +s=pjmedia +c=IN IP4 192.168.1.9 +t=0 0 +a=X-nat:0 +m=audio 4000 RTP/AVP 99 100 101 +a=rtcp:4001 IN IP4 192.168.1.9 +a=rtpmap:99 G7221/16000 +a=fmtp:99 bitrate=24000 +a=rtpmap:100 G7221/16000 +a=fmtp:100 bitrate=32000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200 --add-codec G7221" +extra_headers = "" +include = ["fmtp:[\d]+ bitrate="] # response must include fmtp bitrate +exclude = [] + +sendto_cfg = sip.SendtoCfg("Answer should contain fmtp bitrate for codec G722.1", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_24000.py b/tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_24000.py new file mode 100644 index 00000000..53064ff1 --- /dev/null +++ b/tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_24000.py @@ -0,0 +1,35 @@ +# $Id $ +import inc_sip as sip +import inc_sdp as sdp + +# Answer with codec G722.1 should choose the same bitrate +# which in this test is 24000 + +sdp = \ +""" +v=0 +o=- 3428650655 3428650655 IN IP4 192.168.1.9 +s=pjmedia +c=IN IP4 192.168.1.9 +t=0 0 +a=X-nat:0 +m=audio 4000 RTP/AVP 100 101 +a=rtcp:4001 IN IP4 192.168.1.9 +a=rtpmap:100 G7221/16000 +a=fmtp:100 bitrate=24000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200 --add-codec G7221" +extra_headers = "" +include = ["a=rtpmap:[\d]+ G7221/16000", # response must choose G722.1 + "fmtp:[\d]+ bitrate=24000" # response must choose the same bitrate + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Answer with G722.1 should choose bitrate 24000", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_32000.py b/tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_32000.py new file mode 100644 index 00000000..d60a4a44 --- /dev/null +++ b/tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_32000.py @@ -0,0 +1,35 @@ +# $Id $ +import inc_sip as sip +import inc_sdp as sdp + +# Answer with codec G722.1 should choose the same bitrate +# which in this test is 32000 + +sdp = \ +""" +v=0 +o=- 3428650655 3428650655 IN IP4 192.168.1.9 +s=pjmedia +c=IN IP4 192.168.1.9 +t=0 0 +a=X-nat:0 +m=audio 4000 RTP/AVP 100 101 +a=rtcp:4001 IN IP4 192.168.1.9 +a=rtpmap:100 G7221/16000 +a=fmtp:100 bitrate=32000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200 --add-codec G7221" +extra_headers = "" +include = ["a=rtpmap:[\d]+ G7221/16000", # response must choose G722.1 + "fmtp:[\d]+ bitrate=32000" # response must choose the same bitrate + ] +exclude = [] + +sendto_cfg = sip.SendtoCfg("Answer with G722.1 should choose bitrate 32000", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/410_fmtp_amrnb_offer_octet_align.py b/tests/pjsua/scripts-sendto/410_fmtp_amrnb_offer_octet_align.py new file mode 100644 index 00000000..87a2dfaf --- /dev/null +++ b/tests/pjsua/scripts-sendto/410_fmtp_amrnb_offer_octet_align.py @@ -0,0 +1,32 @@ +# $Id $ +import inc_sip as sip +import inc_sdp as sdp + +# Answer for codec AMR should contain fmtp octet-align=1 + +sdp = \ +""" +v=0 +o=- 3428650655 3428650655 IN IP4 192.168.1.9 +s=pjmedia +c=IN IP4 192.168.1.9 +t=0 0 +a=X-nat:0 +m=audio 4000 RTP/AVP 99 101 +a=rtcp:4001 IN IP4 192.168.1.9 +a=rtpmap:99 AMR/8000 +a=fmtp:99 octet-align=1 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200 --add-codec AMR" +extra_headers = "" +include = ["octet-align=1"] # response must include 'octet-align=1' +exclude = [] + +sendto_cfg = sip.SendtoCfg("AMR negotiation should response with fmtp 'octet-align=1'", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/411_fmtp_amrnb_offer_band_eff.py b/tests/pjsua/scripts-sendto/411_fmtp_amrnb_offer_band_eff.py new file mode 100644 index 00000000..44a2c306 --- /dev/null +++ b/tests/pjsua/scripts-sendto/411_fmtp_amrnb_offer_band_eff.py @@ -0,0 +1,31 @@ +# $Id $ +import inc_sip as sip +import inc_sdp as sdp + +# Answer for codec AMR should not contain fmtp octet-align=1 + +sdp = \ +""" +v=0 +o=- 3428650655 3428650655 IN IP4 192.168.1.9 +s=pjmedia +c=IN IP4 192.168.1.9 +t=0 0 +a=X-nat:0 +m=audio 4000 RTP/AVP 99 101 +a=rtcp:4001 IN IP4 192.168.1.9 +a=rtpmap:99 AMR/8000 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200 --add-codec AMR" +extra_headers = "" +include = [""] +exclude = ["octet-align=1"] # response must not include fmtp 'octet-align=1' + +sendto_cfg = sip.SendtoCfg("AMR negotiation should not contain 'octet-align=1'", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/412_fmtp_amrnb_offer_band_eff2.py b/tests/pjsua/scripts-sendto/412_fmtp_amrnb_offer_band_eff2.py new file mode 100644 index 00000000..e69102c1 --- /dev/null +++ b/tests/pjsua/scripts-sendto/412_fmtp_amrnb_offer_band_eff2.py @@ -0,0 +1,32 @@ +# $Id $ +import inc_sip as sip +import inc_sdp as sdp + +# Answer for codec AMR should not contain fmtp octet-align=1 + +sdp = \ +""" +v=0 +o=- 3428650655 3428650655 IN IP4 192.168.1.9 +s=pjmedia +c=IN IP4 192.168.1.9 +t=0 0 +a=X-nat:0 +m=audio 4000 RTP/AVP 99 101 +a=rtcp:4001 IN IP4 192.168.1.9 +a=rtpmap:99 AMR/8000 +a=fmtp:99 octet-align=0 +a=sendrecv +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-15 +""" + +pjsua_args = "--null-audio --auto-answer 200 --add-codec AMR" +extra_headers = "" +include = [""] +exclude = ["octet-align=1"] # response must not include fmtp 'octet-align=1' + +sendto_cfg = sip.SendtoCfg("AMR negotiation should not contain 'octet-align=1'", pjsua_args, sdp, 200, + extra_headers=extra_headers, + resp_inc=include, resp_exc=exclude) + diff --git a/tests/pjsua/scripts-sendto/500_pres_subscribe_with_bad_event.py b/tests/pjsua/scripts-sendto/500_pres_subscribe_with_bad_event.py new file mode 100644 index 00000000..70f5ab94 --- /dev/null +++ b/tests/pjsua/scripts-sendto/500_pres_subscribe_with_bad_event.py @@ -0,0 +1,28 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# Ticket http://trac.pjsip.org/repos/ticket/623, based on +# http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-September/004709.html: +# +# Assertion when receiving SUBSCRIBE with non-presence Event. +complete_msg = \ +"""SUBSCRIBE sip:localhost;transport=UDP SIP/2.0 +Call-ID: f20e8783e764cae325dba17be4b8fe19@10.0.2.15 +CSeq: 1 SUBSCRIBE +From: ;tag=1710895 +To: +Via: SIP/2.0/UDP localhost;rport;branch=z9hG4bKd88a.18c427d2.0 +Max-Forwards: 69 +Event: message-summary +Contact: +Allow: NOTIFY, SUBSCRIBE +Content-Length: 0 + +""" + + +sendto_cfg = sip.SendtoCfg( "Incoming SUBSCRIBE with non presence", + "--null-audio", + "", 489, complete_msg=complete_msg) + diff --git a/tests/pjsua/scripts-sendto/999_asterisk_err.py b/tests/pjsua/scripts-sendto/999_asterisk_err.py new file mode 100644 index 00000000..580b46de --- /dev/null +++ b/tests/pjsua/scripts-sendto/999_asterisk_err.py @@ -0,0 +1,45 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-June/003426.html: +# +# Report in pjsip mailing list on 27/6/2008 that this message will +# cause pjsip to respond with 500 and then second request will cause +# segfault. +complete_msg = \ +"""INVITE sip:5001@192.168.1.200:5060;transport=UDP SIP/2.0 +Via: SIP/2.0/UDP 192.168.1.11:5060;branch=z9hG4bK74a60ee5;rport +From: \"A user\" ;tag=as2858a32c +To: +Contact: +Call-ID: 0bc7612c665e875a4a46411442b930a6@192.168.1.11 +CSeq: 102 INVITE +User-Agent: Asterisk PBX +Max-Forwards: 70 +Date: Fri, 27 Jun 2008 08:46:47 GMT +Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY +Supported: replaces +Content-Type: application/sdp +Content-Length: 285 + +v=0 +o=root 4236 4236 IN IP4 192.168.1.11 +s=session +c=IN IP4 192.168.1.11 +t=0 0 +m=audio 14390 RTP/AVP 0 3 8 101 +a=rtpmap:0 PCMU/8000 +a=rtpmap:3 GSM/8000 +a=rtpmap:8 PCMA/8000 +a=rtpmap:101 telephone-event/8000 +a=fmtp:101 0-16 +a=silenceSupp:off - - - - +a=ptime:20 +a=sendrecv +""" + + +sendto_cfg = sip.SendtoCfg( "Asterisk 500", "--null-audio --auto-answer 200", + "", 200, complete_msg=complete_msg) + diff --git a/tests/pjsua/scripts-sendto/999_message_no_body.py b/tests/pjsua/scripts-sendto/999_message_no_body.py new file mode 100644 index 00000000..2e369edb --- /dev/null +++ b/tests/pjsua/scripts-sendto/999_message_no_body.py @@ -0,0 +1,24 @@ +# $Id$ +import inc_sip as sip +import inc_sdp as sdp + +# There's some report that incoming MESSAGE without body will crash pjsua +# +complete_msg = \ +"""MESSAGE sip:localhost SIP/2.0 +Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9 +Max-Forwards: 70 +From: ;tag=08cd5bfc2d8a4fddb1f5e59c6961d298 +To: +Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7 +CSeq: 23809 MESSAGE +Contact: +User-Agent: PJSUA v0.8.0-trunk/win32 +Content-Type: text/plain +Content-Length: 50 +""" + + +sendto_cfg = sip.SendtoCfg( "empty MESSAGE", "--null-audio --auto-answer 200", + "", 488, complete_msg=complete_msg) + -- cgit v1.2.3