[Asterisk-code-review] PJSIP_MEDIA_OFFER: Add tests to ensure the function works correctly (testsuite[13])

Kevin Harwell asteriskteam at digium.com
Tue Jun 30 11:46:21 CDT 2020


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/14625 )


Change subject: PJSIP_MEDIA_OFFER: Add tests to ensure the function works correctly
......................................................................

PJSIP_MEDIA_OFFER: Add tests to ensure the function works correctly

ASTERISK-28878

Change-Id: I7a16df487650b580795a455b0421734e8b8d657c
---
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/extensions.conf
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/pjsip.conf
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite.xml
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite_recv.xml
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/test-config.yaml
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/extensions.conf
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/pjsip.conf
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/sipp/invite.xml
A tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/test-config.yaml
A tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/extensions.conf
A tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/pjsip.conf
A tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/sipp/invite_recv.xml
A tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/test-config.yaml
A tests/channels/pjsip/sdp_offer_answer/media_offer/tests.yaml
M tests/channels/pjsip/sdp_offer_answer/tests.yaml
15 files changed, 563 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/25/14625/1

diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/extensions.conf b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/extensions.conf
new file mode 100644
index 0000000..300dc38
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+TECH=PJSIP
+
+[default]
+exten => predial_outbound,1,NoOp()
+	same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
+	same => n,Return()
+
+exten => bob,1,NoOp()
+	same => n,Dial(${TECH}/${EXTEN},,b(default^predial_outbound^1))
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..d2a3632
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/configs/ast1/pjsip.conf
@@ -0,0 +1,30 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+direct_media=no
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+allow=!all,alaw,ulaw
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+allow=!all,ulaw
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite.xml b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite.xml
new file mode 100644
index 0000000..d5a0f86
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to callee">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[callee]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: [callee] <sip:[callee]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0 101
+      a=sendrecv
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+  <recv response="180" optional="true" />
+
+  <recv response="200" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[callee]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: [callee] <sip:[callee]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE" />
+
+  <send retrans="500">
+      <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Content-Length: [len]
+
+      ]]>
+  </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite_recv.xml b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite_recv.xml
new file mode 100644
index 0000000..2c35a9e
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/sipp/invite_recv.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Check from user">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+         <ereg regexp="m=audio [0-9]{1,5} RTP/AVP 9 101+..*"
+              search_in="body" check_it="true" assign_to="1"/>
+          <ereg regexp="a=rtpmap:9 G722/8000"
+              search_in="body" check_it="true" assign_to="1"/>
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0 101
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+      a=sendrecv
+
+    ]]>
+  </send>
+
+  <recv request="ACK" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/test-config.yaml b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/test-config.yaml
new file mode 100644
index 0000000..f8cedf0
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_outgoing/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Test that PJSIP_MEDIA_OFFER overrides joint in/out codecs'
+    description: |
+        This tests that Asterisk can receive an incoming call that has joint
+        codec capabilities with the outgoing call, but are overridden in the
+        dialplan using PJSIP_MEDIA_OFFER.
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'invite_recv.xml', '-s': 'bob', '-p': '5062'} }
+                - { 'key-args': {'scenario': 'invite.xml', '-s': 'alice', '-p': '5061'},
+                    'ordered-args': ['-key', 'callee', 'bob'] }
+
+properties:
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/extensions.conf b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/extensions.conf
new file mode 100644
index 0000000..3c0e143
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[general]
+
+[globals]
+TECH=PJSIP
+
+[default]
+exten => bob,1,NoOp()
+	same => n,Answer()
+	same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
+	same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..dc0d8b9
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/configs/ast1/pjsip.conf
@@ -0,0 +1,23 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+direct_media=no
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
+allow=!all,ulaw
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/sipp/invite.xml b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/sipp/invite.xml
new file mode 100644
index 0000000..69ae371
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/sipp/invite.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to callee">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[callee]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: [callee] <sip:[callee]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0 101
+      a=sendrecv
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+  <recv response="180" optional="true" />
+
+  <recv response="200" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[callee]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: [service] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: [callee] <sip:[callee]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+         <ereg regexp="m=audio [0-9]{1,5} RTP/AVP 9 101+..*"
+              search_in="body" check_it="true" assign_to="1"/>
+          <ereg regexp="a=rtpmap:9 G722/8000"
+              search_in="body" check_it="true" assign_to="1"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0an
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0 101
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+      a=sendrecv
+
+    ]]>
+  </send>
+
+  <recv request="ACK" />
+
+  <recv request="BYE" />
+
+  <send retrans="500">
+      <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Content-Length: [len]
+
+      ]]>
+  </send>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/test-config.yaml b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/test-config.yaml
new file mode 100644
index 0000000..00ef4da
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/incoming_refresh/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Test PJSIP_MEDIA_OFFER overrides an endpoint config on refresh'
+    description: |
+        Using a local channel, this test originates an outgoing call to an
+        endpoint configured to allow 'ulaw'. However before dialing this is
+        overridden in the dialplan to only allow 'g722'. A refresh is also
+        sent, and checked to ensure the specified codec(s) are received.
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'invite.xml', '-s': 'alice', '-p': '5061'},
+                    'ordered-args': ['-key', 'callee', 'bob'] }
+
+properties:
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/extensions.conf b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/extensions.conf
new file mode 100644
index 0000000..300dc38
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+
+[globals]
+TECH=PJSIP
+
+[default]
+exten => predial_outbound,1,NoOp()
+	same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
+	same => n,Return()
+
+exten => bob,1,NoOp()
+	same => n,Dial(${TECH}/${EXTEN},,b(default^predial_outbound^1))
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/pjsip.conf b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..31f19d9
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/configs/ast1/pjsip.conf
@@ -0,0 +1,23 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+direct_media=no
+
+[bob](aor-template)
+contact=sip:bob at 127.0.0.1:5062
+
+[bob](endpoint-template)
+aors=bob
+allow=!all,ulaw
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/sipp/invite_recv.xml b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/sipp/invite_recv.xml
new file mode 100644
index 0000000..2c35a9e
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/sipp/invite_recv.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Check from user">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+         <ereg regexp="m=audio [0-9]{1,5} RTP/AVP 9 101+..*"
+              search_in="body" check_it="true" assign_to="1"/>
+          <ereg regexp="a=rtpmap:9 G722/8000"
+              search_in="body" check_it="true" assign_to="1"/>
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0 101
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+      a=sendrecv
+
+    ]]>
+  </send>
+
+  <recv request="ACK" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/test-config.yaml b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/test-config.yaml
new file mode 100644
index 0000000..3e61662
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/outgoing/test-config.yaml
@@ -0,0 +1,35 @@
+testinfo:
+    summary: 'Test that PJSIP_MEDIA_OFFER overrides an endpoint config'
+    description: |
+        Using a local channel, this test originates an outgoing call to an
+        endpoint configured to allow 'ulaw'. However before dialing this is
+        overridden in the dialplan to only allow 'g722'. The test then
+        ensures the expected media is received.
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: orig-config
+            typename: 'pluggable_modules.Originator'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'invite_recv.xml', '-s': 'bob', '-p': '5062'} }
+
+orig-config:
+    channel: 'Local/bob'
+
+properties:
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/sdp_offer_answer/media_offer/tests.yaml b/tests/channels/pjsip/sdp_offer_answer/media_offer/tests.yaml
new file mode 100644
index 0000000..85a3b20
--- /dev/null
+++ b/tests/channels/pjsip/sdp_offer_answer/media_offer/tests.yaml
@@ -0,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'outgoing'
+    - test: 'incoming_outgoing'
+    - test: 'incoming_refresh'
diff --git a/tests/channels/pjsip/sdp_offer_answer/tests.yaml b/tests/channels/pjsip/sdp_offer_answer/tests.yaml
index b0e0de9..0859923 100644
--- a/tests/channels/pjsip/sdp_offer_answer/tests.yaml
+++ b/tests/channels/pjsip/sdp_offer_answer/tests.yaml
@@ -2,3 +2,4 @@
 tests:
     - dir: 'incoming'
     - dir: 'attribute_passthrough'
+    - dir: 'media_offer'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/14625
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-Change-Id: I7a16df487650b580795a455b0421734e8b8d657c
Gerrit-Change-Number: 14625
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200630/a6caf12b/attachment-0001.html>


More information about the asterisk-code-review mailing list