diff --git a/tests/channels/pjsip/all_codecs_on_empty_reinvite/early-offer/configs/ast1/pjsip.conf b/tests/channels/pjsip/all_codecs_on_empty_reinvite/early-offer/configs/ast1/pjsip.conf
index 603ccda0b..092f51afe 100644
--- a/tests/channels/pjsip/all_codecs_on_empty_reinvite/early-offer/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/all_codecs_on_empty_reinvite/early-offer/configs/ast1/pjsip.conf
@@ -5,6 +5,7 @@ timer_b=6400
[global]
all_codecs_on_empty_reinvite=yes
+debug=yes
[local-transport-udp]
type=transport
@@ -16,3 +17,4 @@ type=endpoint
context=default
media_address=127.0.0.1
allow=!all,g722,alaw,ulaw,ilbc,opus
+codec_prefs_incoming_offer = prefer: configured, operation: intersect, keep: all, transcode: allow
diff --git a/tests/channels/pjsip/all_codecs_on_empty_reinvite/late-offer/configs/ast1/pjsip.conf b/tests/channels/pjsip/all_codecs_on_empty_reinvite/late-offer/configs/ast1/pjsip.conf
index 603ccda0b..092f51afe 100644
--- a/tests/channels/pjsip/all_codecs_on_empty_reinvite/late-offer/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/all_codecs_on_empty_reinvite/late-offer/configs/ast1/pjsip.conf
@@ -5,6 +5,7 @@ timer_b=6400
[global]
all_codecs_on_empty_reinvite=yes
+debug=yes
[local-transport-udp]
type=transport
@@ -16,3 +17,4 @@ type=endpoint
context=default
media_address=127.0.0.1
allow=!all,g722,alaw,ulaw,ilbc,opus
+codec_prefs_incoming_offer = prefer: configured, operation: intersect, keep: all, transcode: allow
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..1a41890c1
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/configs/ast1/pjsip.conf
@@ -0,0 +1,38 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/alice.xml
new file mode 100644
index 000000000..99a8b6ebd
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/alice.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/bob.xml
new file mode 100644
index 000000000..6f1a0558b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/sipp/bob.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/test-config.yaml
new file mode 100644
index 000000000..18f7d50f5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_default/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs '
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..ebcad7a7a
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/configs/ast1/pjsip.conf
@@ -0,0 +1,39 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+codec_prefs_outgoing_answer = prefer: pending, operation: union, keep: all, transcode: allow
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/sipp/alice.xml
new file mode 100644
index 000000000..f5e6baed6
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/sipp/alice.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/sipp/bob.xml
new file mode 100644
index 000000000..6f1a0558b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/sipp/bob.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/test-config.yaml
new file mode 100644
index 000000000..e11d394b7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/common_codecs_union/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs and add the missing configured codecs to the end of the list'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ For this teste codec_prefs_outgoing_answer = prefer: pending, operation: union
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu. Opus is appended to the list.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..d72d2821f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/sipp/alice.xml
new file mode 100644
index 000000000..571be697b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/sipp/alice.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/sipp/bob.xml
new file mode 100644
index 000000000..d978387a5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/sipp/bob.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/test-config.yaml
new file mode 100644
index 000000000..009cf16e4
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_progress/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation configs in a call between two parties
+ with a late SDP offer and early media'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer in the 183 and
+ 200 responses he only provides one codec. The SDP from Asterisk to Alice
+ may only contain this one codec because Alice's
+ codec_prefs_outgoing_offer settings are overwritten to use
+ operation:intersect.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..d72d2821f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/sipp/alice.xml
new file mode 100644
index 000000000..d96d0e4a4
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/sipp/alice.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/sipp/bob.xml
new file mode 100644
index 000000000..ba3d78078
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/test-config.yaml
new file mode 100644
index 000000000..32c69245e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/late_offer_ringing/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation configs in a call between two parties
+ with a late SDP offer'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer he only provides
+ one codec. The SDP from Asterisk to Alice may only contain this one
+ codec because Alice's codec_prefs_outgoing_offer settings are
+ overwritten to use operation:intersect.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..1a41890c1
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/configs/ast1/pjsip.conf
@@ -0,0 +1,38 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/sipp/alice.xml
new file mode 100644
index 000000000..99a8b6ebd
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/sipp/alice.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/sipp/bob.xml
new file mode 100644
index 000000000..6f1a0558b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/sipp/bob.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/test-config.yaml
new file mode 100644
index 000000000..18f7d50f5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_default/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs '
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..ebcad7a7a
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/configs/ast1/pjsip.conf
@@ -0,0 +1,39 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+codec_prefs_outgoing_answer = prefer: pending, operation: union, keep: all, transcode: allow
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/sipp/alice.xml
new file mode 100644
index 000000000..f5e6baed6
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/sipp/alice.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/sipp/bob.xml
new file mode 100644
index 000000000..6f1a0558b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/sipp/bob.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/test-config.yaml
new file mode 100644
index 000000000..e11d394b7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/common_codecs_union/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs and add the missing configured codecs to the end of the list'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ For this teste codec_prefs_outgoing_answer = prefer: pending, operation: union
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu. Opus is appended to the list.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..d72d2821f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/sipp/alice.xml
new file mode 100644
index 000000000..571be697b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/sipp/alice.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/sipp/bob.xml
new file mode 100644
index 000000000..d978387a5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/sipp/bob.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/test-config.yaml
new file mode 100644
index 000000000..44d1da683
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_progress/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation configs in a call between two parties
+ with a late SDP offer, early media, and a local channel'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer in the 183 and
+ 200 responses he only provides one codec. The SDP from Asterisk to Alice
+ may only contain this one codec because Alice's
+ codec_prefs_outgoing_offer settings are overwritten to use
+ operation:intersect. In the dialplan a local channel is used.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..d72d2821f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/sipp/alice.xml
new file mode 100644
index 000000000..d96d0e4a4
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/sipp/alice.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/sipp/bob.xml
new file mode 100644
index 000000000..ba3d78078
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/test-config.yaml
new file mode 100644
index 000000000..6fd1fe43d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/late_offer_ringing/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation configs in a call between two parties
+ with a late SDP offer and a local channel'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer he only provides
+ one codec. The SDP from Asterisk to Alice may only contain this one
+ codec because Alice's codec_prefs_outgoing_offer settings are
+ overwritten to use operation:intersect. In the dialplan, a local channel
+ is used.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/sipp/alice.xml
new file mode 100644
index 000000000..7b3a9b1c2
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/sipp/alice.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/sipp/bob.xml
new file mode 100644
index 000000000..5c68a7150
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/test-config.yaml
new file mode 100644
index 000000000..cfffe1d3c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs/test-config.yaml
@@ -0,0 +1,49 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties
+ with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Asterisk must transcode in this case.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/sipp/alice.xml
new file mode 100644
index 000000000..169ee9bb1
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/sipp/alice.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/sipp/bob.xml
new file mode 100644
index 000000000..9411f5ce7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/sipp/bob.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/test-config.yaml
new file mode 100644
index 000000000..2790159e5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_early/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties
+ with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answers in the 183 and 200 responses he only
+ provides one codec that Alice didn't offer. Asterisk must transcode in
+ this case.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/sipp/alice.xml
new file mode 100644
index 000000000..42f3aa028
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/sipp/alice.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/sipp/bob.xml
new file mode 100644
index 000000000..5c68a7150
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/test-config.yaml
new file mode 100644
index 000000000..84b9254ce
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in a call between
+ two parties with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/sipp/alice.xml
new file mode 100644
index 000000000..ef7ce3114
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/sipp/alice.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/sipp/bob.xml
new file mode 100644
index 000000000..b32e99527
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/sipp/bob.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/test-config.yaml
new file mode 100644
index 000000000..d07288738
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/no_common_codecs_prevent_early/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in a call between
+ two parties with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer in the 183 response he only provides one
+ codec that Alice didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..0915ae492
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+allow_sending_180_after_183=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/sipp/alice.xml
new file mode 100644
index 000000000..94451e05c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/sipp/alice.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/sipp/bob.xml
new file mode 100644
index 000000000..d978387a5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/sipp/bob.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/test-config.yaml
new file mode 100644
index 000000000..7a110c43e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in a call between two parties
+ using inband_progress and a local channel'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.
+ Further, allow_sending_180_after_183 must be enabled, otherwise the 180
+ by Bob would result in Asterisk sending a 183 with SDP without knowing
+ Bob's SDP answer.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..cc7761bfb
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/configs/ast1/pjsip.conf
@@ -0,0 +1,36 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/sipp/alice.xml
new file mode 100644
index 000000000..56b76d433
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/sipp/alice.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/sipp/bob.xml
new file mode 100644
index 000000000..edda4b680
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/sipp/bob.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/test-config.yaml
new file mode 100644
index 000000000..a406aaf1c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/progress_no_180/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in a call between two parties
+ using inband_progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..cb7c5596c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/sipp/alice.xml
new file mode 100644
index 000000000..0289bcc68
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/sipp/alice.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/sipp/bob.xml
new file mode 100644
index 000000000..6f1a0558b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/sipp/bob.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/test-config.yaml
new file mode 100644
index 000000000..365204079
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/reverse_order/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs but the order is chosen from the SDP'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf, but the order is different from Alice's INVITE
+ Alice calls Bob with g722,alaw,ulaw. In pjsip.conf the order is g722,ulaw,alaw.
+ The common codecs are g722,pcma,pcmu in that order.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/sipp/alice.xml
new file mode 100644
index 000000000..7a0d8469c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/sipp/alice.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/sipp/bob.xml
new file mode 100644
index 000000000..ba3d78078
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/test-config.yaml
new file mode 100644
index 000000000..13d2a14f1
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/ringing/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties
+ using a local channel in between.'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec. In the
+ dialplan a local channel is used. The SDP from Asterisk to Alice may
+ only contain this one codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/local_channels/tests.yaml b/tests/channels/pjsip/codec_negotiation/audio/local_channels/tests.yaml
new file mode 100644
index 000000000..ad7803b07
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/local_channels/tests.yaml
@@ -0,0 +1,15 @@
+# Enter tests here in the order they should be considered for execution:
+---
+tests:
+ - test: 'common_codecs_default'
+ - test: 'common_codecs_union'
+ - test: 'late_offer_progress'
+ - test: 'late_offer_ringing'
+ - test: 'no_common_codecs'
+ - test: 'no_common_codecs_early'
+ - test: 'no_common_codecs_prevent'
+ - test: 'no_common_codecs_prevent_early'
+ - test: 'progress'
+ - test: 'progress_no_180'
+ - test: 'reverse_order'
+ - test: 'ringing'
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/sipp/alice.xml
new file mode 100644
index 000000000..7b3a9b1c2
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/sipp/alice.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/sipp/bob.xml
new file mode 100644
index 000000000..5c68a7150
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/test-config.yaml
new file mode 100644
index 000000000..cfffe1d3c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs/test-config.yaml
@@ -0,0 +1,49 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties
+ with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Asterisk must transcode in this case.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/sipp/alice.xml
new file mode 100644
index 000000000..169ee9bb1
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/sipp/alice.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/sipp/bob.xml
new file mode 100644
index 000000000..9411f5ce7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/sipp/bob.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/test-config.yaml
new file mode 100644
index 000000000..2790159e5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_early/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties
+ with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answers in the 183 and 200 responses he only
+ provides one codec that Alice didn't offer. Asterisk must transcode in
+ this case.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/sipp/alice.xml
new file mode 100644
index 000000000..42f3aa028
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/sipp/alice.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/sipp/bob.xml
new file mode 100644
index 000000000..5c68a7150
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/test-config.yaml
new file mode 100644
index 000000000..84b9254ce
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in a call between
+ two parties with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/sipp/alice.xml
new file mode 100644
index 000000000..ef7ce3114
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/sipp/alice.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/sipp/bob.xml
new file mode 100644
index 000000000..b32e99527
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/sipp/bob.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/test-config.yaml
new file mode 100644
index 000000000..d07288738
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/no_common_codecs_prevent_early/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in a call between
+ two parties with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer in the 183 response he only provides one
+ codec that Alice didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..0915ae492
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+allow_sending_180_after_183=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/progress/sipp/alice.xml
new file mode 100644
index 000000000..94451e05c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress/sipp/alice.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/progress/sipp/bob.xml
new file mode 100644
index 000000000..d978387a5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress/sipp/bob.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/progress/test-config.yaml
new file mode 100644
index 000000000..1b12de030
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in a call between two parties
+ using inband_progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.
+ Further, allow_sending_180_after_183 must be enabled, otherwise the 180
+ by Bob would result in Asterisk sending a 183 with SDP without knowing
+ Bob's SDP answer.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..cc7761bfb
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/configs/ast1/pjsip.conf
@@ -0,0 +1,36 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/sipp/alice.xml
new file mode 100644
index 000000000..56b76d433
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/sipp/alice.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/sipp/bob.xml
new file mode 100644
index 000000000..edda4b680
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/sipp/bob.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/test-config.yaml
new file mode 100644
index 000000000..a406aaf1c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/progress_no_180/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in a call between two parties
+ using inband_progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/reverse_order/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/reverse_order/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..cb7c5596c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/reverse_order/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/sipp/alice.xml
new file mode 100644
index 000000000..0289bcc68
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/sipp/alice.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/reverse_order/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/sipp/bob.xml
new file mode 100644
index 000000000..6f1a0558b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/sipp/bob.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/reverse_order/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/test-config.yaml
new file mode 100644
index 000000000..365204079
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/reverse_order/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs but the order is chosen from the SDP'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf, but the order is different from Alice's INVITE
+ Alice calls Bob with g722,alaw,ulaw. In pjsip.conf the order is g722,ulaw,alaw.
+ The common codecs are g722,pcma,pcmu in that order.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio/ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/ringing/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio/ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio/ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio/ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio/ringing/sipp/alice.xml
new file mode 100644
index 000000000..7a0d8469c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/ringing/sipp/alice.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio/ringing/sipp/bob.xml
new file mode 100644
index 000000000..ba3d78078
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/ringing/sipp/bob.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio/ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio/ringing/test-config.yaml
new file mode 100644
index 000000000..ed4f59ff2
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/ringing/test-config.yaml
@@ -0,0 +1,48 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec. The SDP from
+ Asterisk to Alice may only contain this one codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio/tests.yaml b/tests/channels/pjsip/codec_negotiation/audio/tests.yaml
new file mode 100644
index 000000000..1d3ce768c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio/tests.yaml
@@ -0,0 +1,16 @@
+# Enter tests here in the order they should be considered for execution:
+---
+tests:
+ - test: 'common_codecs_default'
+ - test: 'common_codecs_union'
+ - test: 'late_offer_progress'
+ - test: 'late_offer_ringing'
+ - test: 'no_common_codecs'
+ - test: 'no_common_codecs_early'
+ - test: 'no_common_codecs_prevent'
+ - test: 'no_common_codecs_prevent_early'
+ - test: 'progress'
+ - test: 'progress_no_180'
+ - test: 'reverse_order'
+ - test: 'ringing'
+ - dir: 'local_channels'
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..1a41890c1
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/configs/ast1/pjsip.conf
@@ -0,0 +1,38 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/sipp/alice.xml
new file mode 100644
index 000000000..8f7a3220e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/sipp/alice.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/sipp/bob.xml
new file mode 100644
index 000000000..62f56d66c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/sipp/bob.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/test-config.yaml
new file mode 100644
index 000000000..18f7d50f5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_default/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs '
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..ebcad7a7a
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/configs/ast1/pjsip.conf
@@ -0,0 +1,39 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+codec_prefs_outgoing_answer = prefer: pending, operation: union, keep: all, transcode: allow
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/sipp/alice.xml
new file mode 100644
index 000000000..148806f24
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/sipp/alice.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/sipp/bob.xml
new file mode 100644
index 000000000..7c005373b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/sipp/bob.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/test-config.yaml
new file mode 100644
index 000000000..e11d394b7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/common_codecs_union/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs and add the missing configured codecs to the end of the list'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ For this teste codec_prefs_outgoing_answer = prefer: pending, operation: union
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu. Opus is appended to the list.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..7d798d71e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/sipp/alice.xml
new file mode 100644
index 000000000..37f0de5d6
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/sipp/alice.xml
@@ -0,0 +1,126 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/sipp/bob.xml
new file mode 100644
index 000000000..4af8f7316
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/sipp/bob.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/test-config.yaml
new file mode 100644
index 000000000..ab1566838
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_progress/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation configs in an audio+video call between
+ with a late SDP offer and early media'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer in the 183 and
+ 200 responses he only provides one codec. The SDP from Asterisk to Alice
+ may only contain this one codec because Alice's
+ codec_prefs_outgoing_offer settings are overwritten to use
+ operation:intersect.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..7d798d71e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/sipp/alice.xml
new file mode 100644
index 000000000..af6013949
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/sipp/alice.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/sipp/bob.xml
new file mode 100644
index 000000000..b8aff9169
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/test-config.yaml
new file mode 100644
index 000000000..706ae0f85
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/late_offer_ringing/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties
+ with a late SDP offer'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer he only provides
+ one codec. The SDP from Asterisk to Alice may only contain this one
+ codec because Alice's codec_prefs_outgoing_offer settings are
+ overwritten to use operation:intersect.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..1a41890c1
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/configs/ast1/pjsip.conf
@@ -0,0 +1,38 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/sipp/alice.xml
new file mode 100644
index 000000000..8f7a3220e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/sipp/alice.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/sipp/bob.xml
new file mode 100644
index 000000000..62f56d66c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/sipp/bob.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/test-config.yaml
new file mode 100644
index 000000000..18f7d50f5
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_default/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs '
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..ebcad7a7a
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/configs/ast1/pjsip.conf
@@ -0,0 +1,39 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+
+[endpoint-template](!)
+codec_prefs_outgoing_answer = prefer: pending, operation: union, keep: all, transcode: allow
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/sipp/alice.xml
new file mode 100644
index 000000000..148806f24
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/sipp/alice.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 107 9 8 0
+ a=rtpmap:107 opus/48000/2
+ a=fmtp:107 maxaveragebitrate=64000;sprop-stereo=1
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/sipp/bob.xml
new file mode 100644
index 000000000..7c005373b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/sipp/bob.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/test-config.yaml
new file mode 100644
index 000000000..e11d394b7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/common_codecs_union/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs and add the missing configured codecs to the end of the list'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf
+ For this teste codec_prefs_outgoing_answer = prefer: pending, operation: union
+ Alice calls Bob and in Bob\'s SDP answer he provides 3 codecs that Alice except Opus.
+ The common codecs are g722,pcma,pcmu. Opus is appended to the list.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..7d798d71e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/sipp/alice.xml
new file mode 100644
index 000000000..37f0de5d6
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/sipp/alice.xml
@@ -0,0 +1,126 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/sipp/bob.xml
new file mode 100644
index 000000000..4af8f7316
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/sipp/bob.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/test-config.yaml
new file mode 100644
index 000000000..ab1566838
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_progress/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation configs in an audio+video call between
+ with a late SDP offer and early media'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer in the 183 and
+ 200 responses he only provides one codec. The SDP from Asterisk to Alice
+ may only contain this one codec because Alice's
+ codec_prefs_outgoing_offer settings are overwritten to use
+ operation:intersect.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..7d798d71e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+codec_prefs_outgoing_offer=prefer:pending,operation:intersect,keep:all,transcode:allow
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/sipp/alice.xml
new file mode 100644
index 000000000..af6013949
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/sipp/alice.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/sipp/bob.xml
new file mode 100644
index 000000000..b8aff9169
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/test-config.yaml
new file mode 100644
index 000000000..706ae0f85
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/late_offer_ringing/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a call between two parties
+ with a late SDP offer'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob with no SDP in the INVITE and in Bob\'s SDP answer he only provides
+ one codec. The SDP from Asterisk to Alice may only contain this one
+ codec because Alice's codec_prefs_outgoing_offer settings are
+ overwritten to use operation:intersect.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/sipp/alice.xml
new file mode 100644
index 000000000..6f39fad2b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/sipp/alice.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/sipp/bob.xml
new file mode 100644
index 000000000..466e45d13
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/test-config.yaml
new file mode 100644
index 000000000..1517ec255
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs/test-config.yaml
@@ -0,0 +1,49 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in an audio+vodep call between
+ two parties with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Asterisk must transcode in this case.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/sipp/alice.xml
new file mode 100644
index 000000000..8c05f1d75
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/sipp/alice.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/sipp/bob.xml
new file mode 100644
index 000000000..8ff6b6dc9
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/sipp/bob.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/test-config.yaml
new file mode 100644
index 000000000..996a23751
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_early/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in an audio+vodep call between
+ two parties with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answers in the 183 and 200 responses he only
+ provides one codec that Alice didn't offer.. Asterisk must transcode in this case.'
+
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/sipp/alice.xml
new file mode 100644
index 000000000..1be06196c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/sipp/alice.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/sipp/bob.xml
new file mode 100644
index 000000000..466e45d13
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/test-config.yaml
new file mode 100644
index 000000000..e9d351604
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in an audio+video
+ call between two parties with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/sipp/alice.xml
new file mode 100644
index 000000000..1be06196c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/sipp/alice.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/sipp/bob.xml
new file mode 100644
index 000000000..7e02500a3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/sipp/bob.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/test-config.yaml
new file mode 100644
index 000000000..004504bd6
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/no_common_codecs_prevent_early/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in an audio+video
+ call between two parties with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer in the 183 response he only provides one
+ codec that Alice didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..ac3aacc6f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+allow_sending_180_after_183=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/sipp/alice.xml
new file mode 100644
index 000000000..012813b54
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/sipp/alice.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99 34
+ a=rtpmap:99 H264/90000
+ a=rtpmap:34 H263/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/sipp/bob.xml
new file mode 100644
index 000000000..4af8f7316
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/sipp/bob.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/test-config.yaml
new file mode 100644
index 000000000..88d3cac43
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in an audio+video call between
+ two parties using inband_progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.
+ Further, allow_sending_180_after_183 must be enabled, otherwise the 180
+ by Bob would result in Asterisk sending a 183 with SDP without knowing
+ Bob's SDP answer.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..b33164647
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/configs/ast1/pjsip.conf
@@ -0,0 +1,36 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/sipp/alice.xml
new file mode 100644
index 000000000..cb430d249
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/sipp/alice.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99 34
+ a=rtpmap:99 H264/90000
+ a=rtpmap:34 H263/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/sipp/bob.xml
new file mode 100644
index 000000000..6b8f46d4f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/sipp/bob.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/test-config.yaml
new file mode 100644
index 000000000..f63b7af75
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/progress_no_180/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in an audio+video call between
+ two parties using inband_progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..cb7c5596c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/sipp/alice.xml
new file mode 100644
index 000000000..d0252084e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/sipp/alice.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/sipp/bob.xml
new file mode 100644
index 000000000..7c005373b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/sipp/bob.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/test-config.yaml
new file mode 100644
index 000000000..365204079
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/reverse_order/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs but the order is chosen from the SDP'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf, but the order is different from Alice's INVITE
+ Alice calls Bob with g722,alaw,ulaw. In pjsip.conf the order is g722,ulaw,alaw.
+ The common codecs are g722,pcma,pcmu in that order.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..6fb134f9e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(Local/bob@internal)
+ same => n,Hangup()
+
+[internal]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..bf066cba7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/sipp/alice.xml
new file mode 100644
index 000000000..4833abaf0
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/sipp/alice.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99 34
+ a=rtpmap:99 H264/90000
+ a=rtpmap:34 H263/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/sipp/bob.xml
new file mode 100644
index 000000000..b8aff9169
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/test-config.yaml
new file mode 100644
index 000000000..c94c6c5e0
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/ringing/test-config.yaml
@@ -0,0 +1,49 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a audio+video call between
+ two parties'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec. The SDP from
+ Asterisk to Alice may only contain this one codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/tests.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/tests.yaml
new file mode 100644
index 000000000..ad7803b07
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/local_channels/tests.yaml
@@ -0,0 +1,15 @@
+# Enter tests here in the order they should be considered for execution:
+---
+tests:
+ - test: 'common_codecs_default'
+ - test: 'common_codecs_union'
+ - test: 'late_offer_progress'
+ - test: 'late_offer_ringing'
+ - test: 'no_common_codecs'
+ - test: 'no_common_codecs_early'
+ - test: 'no_common_codecs_prevent'
+ - test: 'no_common_codecs_prevent_early'
+ - test: 'progress'
+ - test: 'progress_no_180'
+ - test: 'reverse_order'
+ - test: 'ringing'
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/sipp/alice.xml
new file mode 100644
index 000000000..6f39fad2b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/sipp/alice.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/sipp/bob.xml
new file mode 100644
index 000000000..466e45d13
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/test-config.yaml
new file mode 100644
index 000000000..1517ec255
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs/test-config.yaml
@@ -0,0 +1,49 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in an audio+vodep call between
+ two parties with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Asterisk must transcode in this case.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..c82ab09e3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/sipp/alice.xml
new file mode 100644
index 000000000..8c05f1d75
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/sipp/alice.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/sipp/bob.xml
new file mode 100644
index 000000000..8ff6b6dc9
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/sipp/bob.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=rtpmap:9 G722/8000
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/test-config.yaml
new file mode 100644
index 000000000..996a23751
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_early/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in an audio+vodep call between
+ two parties with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answers in the 183 and 200 responses he only
+ provides one codec that Alice didn't offer.. Asterisk must transcode in this case.'
+
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/sipp/alice.xml
new file mode 100644
index 000000000..1be06196c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/sipp/alice.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/sipp/bob.xml
new file mode 100644
index 000000000..466e45d13
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/test-config.yaml
new file mode 100644
index 000000000..e9d351604
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in an audio+video
+ call between two parties with no common codecs'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec that Alice
+ didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..183079e56
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/sipp/alice.xml
new file mode 100644
index 000000000..1be06196c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/sipp/alice.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/sipp/bob.xml
new file mode 100644
index 000000000..7e02500a3
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/sipp/bob.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/test-config.yaml
new file mode 100644
index 000000000..004504bd6
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/no_common_codecs_prevent_early/test-config.yaml
@@ -0,0 +1,51 @@
+---
+testinfo:
+ summary:
+ 'Test "transcode: prevent" codec negotiation configs in an audio+video
+ call between two parties with no common codecs and session progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer in the 183 response he only provides one
+ codec that Alice didn't offer. Alice's endpoint is configured with
+ codec_prefs_outgoing_answer = prefer: pending, operation: intersect, keep: all, transcode: prevent
+ to prevent transcoding and therefore Asterisk must reject the call.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/progress/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/progress/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..ac3aacc6f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+allow_sending_180_after_183=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/progress/sipp/alice.xml
new file mode 100644
index 000000000..012813b54
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress/sipp/alice.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99 34
+ a=rtpmap:99 H264/90000
+ a=rtpmap:34 H263/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/progress/sipp/bob.xml
new file mode 100644
index 000000000..4af8f7316
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress/sipp/bob.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/progress/test-config.yaml
new file mode 100644
index 000000000..88d3cac43
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress/test-config.yaml
@@ -0,0 +1,53 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in an audio+video call between
+ two parties using inband_progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.
+ Further, allow_sending_180_after_183 must be enabled, otherwise the 180
+ by Bob would result in Asterisk sending a 183 with SDP without knowing
+ Bob's SDP answer.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..b33164647
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/configs/ast1/pjsip.conf
@@ -0,0 +1,36 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+inband_progress=yes
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/sipp/alice.xml
new file mode 100644
index 000000000..cb430d249
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/sipp/alice.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99 34
+ a=rtpmap:99 H264/90000
+ a=rtpmap:34 H263/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/sipp/bob.xml
new file mode 100644
index 000000000..6b8f46d4f
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/sipp/bob.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/test-config.yaml
new file mode 100644
index 000000000..f63b7af75
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/progress_no_180/test-config.yaml
@@ -0,0 +1,50 @@
+---
+testinfo:
+ summary: |
+ 'Test default codec negotiation configs in an audio+video call between
+ two parties using inband_progress'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec in his 183 and
+ 200 responses. The SDP from Asterisk to Alice may only contain this one
+ codec. Both PJSIP endpoints are configured to allow inband_progress.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..cb7c5596c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+
+[endpoint-template](!)
+
+[alice](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob](endpoint-template)
+type=endpoint
+allow=opus,g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/sipp/alice.xml
new file mode 100644
index 000000000..d0252084e
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/sipp/alice.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ a=rtcp-mux
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/sipp/bob.xml
new file mode 100644
index 000000000..7c005373b
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/sipp/bob.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 9 8 0
+ a=rtpmap:9 G722/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=ptime:20
+ a=maxptime:20
+ a=sendrecv
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/test-config.yaml
new file mode 100644
index 000000000..365204079
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/reverse_order/test-config.yaml
@@ -0,0 +1,52 @@
+---
+testinfo:
+ summary:
+ 'Test advanced codec negotiation in a call between two parties
+ with 3 common codecs but the order is chosen from the SDP'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs.
+ Alice client is configured with Opus as additional codec.
+ All endpoints share the same codec settings in pjsip.conf, but the order is different from Alice's INVITE
+ Alice calls Bob with g722,alaw,ulaw. In pjsip.conf the order is g722,ulaw,alaw.
+ The common codecs are g722,pcma,pcmu in that order.
+ Asterisk should not transcode in this case as the parties share at least one common codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/ringing/configs/ast1/extensions.conf b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/configs/ast1/extensions.conf
new file mode 100644
index 000000000..aa80d3c7d
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+ same => n,Dial(PJSIP/bob)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/ringing/configs/ast1/pjsip.conf b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/configs/ast1/pjsip.conf
new file mode 100644
index 000000000..bf066cba7
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264,h263
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob@127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/ringing/sipp/alice.xml b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/sipp/alice.xml
new file mode 100644
index 000000000..4833abaf0
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/sipp/alice.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To:
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact:
+ Max-Forwards: 70
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [custom_media_port] RTP/AVP 9 0 8
+ a=rtpmap:0 PCMU/8000
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:9 G722/8000
+ m=video 6000 RTP/AVP 99 34
+ a=rtpmap:99 H264/90000
+ a=rtpmap:34 H263/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+ ;tag=[pid]SIPpTag[call_number]
+ To: [$remote_tag]
+ Call-ID: [call_id]
+ CSeq: [cseq] BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Codec Negotiation Test
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/ringing/sipp/bob.xml b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/sipp/bob.xml
new file mode 100644
index 000000000..b8aff9169
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/sipp/bob.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ Content-Length: 0
+
+ ]]>
+
+
+
+
+
+
+ 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 [custom_media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ m=video 6000 RTP/AVP 99
+ a=rtpmap:99 H264/90000
+ a=sendrecv
+
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/ringing/test-config.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/test-config.yaml
new file mode 100644
index 000000000..c94c6c5e0
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/ringing/test-config.yaml
@@ -0,0 +1,49 @@
+---
+testinfo:
+ summary:
+ 'Test default codec negotiation configs in a audio+video call between
+ two parties'
+ description: |
+ 'Two PJSIP endpoints are configured to support many codecs. Alice calls
+ Bob and in Bob\'s SDP answer he only provides one codec. The SDP from
+ Asterisk to Alice may only contain this one codec.'
+
+properties:
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'app_dial'
+ - asterisk: 'res_pjsip'
+ - sipp:
+ version: 'v3.6.0'
+ tags:
+ - pjsip
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-case-config
+ typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+ memcheck-delay-stop: 7
+ # connect-ami: 'False'
+ fail-on-any: false
+ test-iterations:
+ # First iteration
+ -
+ scenarios:
+ # Bob receives call from Alice
+ - {'key-args':
+ {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3',
+ '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'
+ },
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
+ # Alice calls Bob
+ - {'key-args':
+ {'scenario': 'alice.xml', '-p': '5060',
+ '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s',
+ '-mi': '127.0.0.2'},
+ 'ordered-args':
+ ['-timeout_error', '-key', 'custom_media_port', '6004']}
diff --git a/tests/channels/pjsip/codec_negotiation/audio_video/tests.yaml b/tests/channels/pjsip/codec_negotiation/audio_video/tests.yaml
new file mode 100644
index 000000000..1d3ce768c
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/audio_video/tests.yaml
@@ -0,0 +1,16 @@
+# Enter tests here in the order they should be considered for execution:
+---
+tests:
+ - test: 'common_codecs_default'
+ - test: 'common_codecs_union'
+ - test: 'late_offer_progress'
+ - test: 'late_offer_ringing'
+ - test: 'no_common_codecs'
+ - test: 'no_common_codecs_early'
+ - test: 'no_common_codecs_prevent'
+ - test: 'no_common_codecs_prevent_early'
+ - test: 'progress'
+ - test: 'progress_no_180'
+ - test: 'reverse_order'
+ - test: 'ringing'
+ - dir: 'local_channels'
diff --git a/tests/channels/pjsip/codec_negotiation/tests.yaml b/tests/channels/pjsip/codec_negotiation/tests.yaml
new file mode 100644
index 000000000..882249c52
--- /dev/null
+++ b/tests/channels/pjsip/codec_negotiation/tests.yaml
@@ -0,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+---
+tests:
+ - dir: 'audio'
+ - dir: 'audio_video'
diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf
index 9009f2cac..25b164f48 100644
--- a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf
@@ -3,6 +3,9 @@ type=system
timer_t1=100
timer_b=6400
+[global]
+debug=yes
+
[local-transport-template](!)
type=transport
bind=127.0.0.1:5060
@@ -15,6 +18,7 @@ type=endpoint
context=default
allow=!all,g722,gsm,ulaw,alaw
asymmetric_rtp_codec=yes
+codec_prefs_incoming_answer=prefer:configured,operation:intersect,keep:all,transcode:allow
;== IPv4 & UDP ==
[bob-ipv4-udp](endpoint-template-ipv4)
diff --git a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video-app/decline/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video-app/decline/configs/ast1/pjsip.conf
index c4383ca8e..e3ef8cea6 100644
--- a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video-app/decline/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video-app/decline/configs/ast1/pjsip.conf
@@ -15,3 +15,4 @@ media_address=127.0.0.1
[alice](endpoint-template)
allow=!all,g722,ulaw,alaw,h264,h263
+codec_prefs_incoming_offer = prefer: configured, operation: intersect, keep: all, transcode: allow
diff --git a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video/decline/basic/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video/decline/basic/configs/ast1/pjsip.conf
index afedbcad0..db360d7fd 100644
--- a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video/decline/basic/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/multiple-media-stream/audio-video/decline/basic/configs/ast1/pjsip.conf
@@ -3,6 +3,9 @@ type=system
timer_t1=100
timer_b=6400
+[global]
+debug = yes
+
[local-transport-udp]
type=transport
bind=127.0.0.1
@@ -12,6 +15,7 @@ protocol=udp
type=endpoint
context=default
media_address=127.0.0.1
+codec_prefs_incoming_offer = prefer: configured, operation: intersect, keep: all, transcode: allow
[alice-codec-match](endpoint-template)
allow=!all,g722,ulaw,alaw,h264,h263
diff --git a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/basic/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/basic/configs/ast1/pjsip.conf
index f03904b31..e2bd9f6bc 100644
--- a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/basic/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/basic/configs/ast1/pjsip.conf
@@ -3,6 +3,9 @@ type=system
timer_t1=100
timer_b=6400
+[global]
+debug=yes
+
[local-transport-udp]
type=transport
bind=127.0.0.1
@@ -12,6 +15,7 @@ protocol=udp
type=endpoint
context=default
media_address=127.0.0.1
+codec_prefs_incoming_offer = prefer: configured, operation: intersect, keep: all, transcode: allow
[alice-codec-match](endpoint-template)
allow=!all,g722,ulaw,alaw
diff --git a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/packetization/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/packetization/configs/ast1/pjsip.conf
index cf9a5f8fd..48ddca26b 100644
--- a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/packetization/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/packetization/configs/ast1/pjsip.conf
@@ -3,6 +3,9 @@ type=system
timer_t1=100
timer_b=6400
+[global]
+debug=yes
+
[local-transport-udp]
type=transport
bind=127.0.0.1
@@ -12,6 +15,7 @@ protocol=udp
type=endpoint
context=default
media_address=127.0.0.1
+codec_prefs_incoming_offer=prefer:configured,operation:intersect,keep:all,transcode:allow
[alice-accept-ptime](endpoint-template)
allow=!all,g722,ulaw,alaw
diff --git a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/video/basic/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/video/basic/configs/ast1/pjsip.conf
index 91208580e..9a513f90f 100644
--- a/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/video/basic/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/video/basic/configs/ast1/pjsip.conf
@@ -12,6 +12,7 @@ protocol=udp
type=endpoint
context=default
media_address=127.0.0.1
+codec_prefs_incoming_offer = prefer: configured, operation: intersect, keep: all, transcode: allow
[alice-codec-match](endpoint-template)
allow=!all,h264,h263
diff --git a/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/codec-mismatch/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/codec-mismatch/configs/ast1/pjsip.conf
index dbe3e3cd0..cb95e5a70 100644
--- a/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/codec-mismatch/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/codec-mismatch/configs/ast1/pjsip.conf
@@ -3,6 +3,9 @@ type=transport
bind=127.0.0.1
protocol=udp
+[global]
+debug=yes
+
[endpoint-template](!)
type=endpoint
context=default
diff --git a/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/hold-declined/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/hold-declined/configs/ast1/pjsip.conf
index 732b7e8e3..112ade024 100644
--- a/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/hold-declined/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/sdp_offer_answer/incoming/off-nominal/multiple-media-stream/audio-video/hold-declined/configs/ast1/pjsip.conf
@@ -3,6 +3,9 @@ type=system
timer_t1=100
timer_b=6400
+[global]
+debug=yes
+
[local-transport-udp]
type=transport
bind=127.0.0.1
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 7df01f944..43ea71111 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -5,6 +5,7 @@ tests:
- dir: 'aoc'
- dir: 'auth'
- dir: 'basic_calls'
+ - dir: 'codec_negotiation'
- dir: 'config_wizard'
- dir: 'configuration'
- dir: 'dialplan_functions'