<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/5773">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip/rtp/asymmetric_rtp_codec: Add tests for local format behavior.<br><br>This adds two tests which confirm the behavior of the<br>'asymmetric_rtp_codec' option for local formats.<br><br>One test confirms that when set to 'no' the resulting formats<br>on the channel contains only one format.<br><br>The other test confirms that when set to 'yes' the resulting<br>formats on the channel contain all negotiated formats.<br><br>ASTERISK-26996<br><br>Change-Id: I52c84ec317d8b4ead82d5974227a3d5c15f83808<br>---<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/extensions.conf<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/rtp.conf<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/sipp/bob.xml<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/test-config.yaml<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/extensions.conf<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/rtp.conf<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/sipp/bob.xml<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/test-config.yaml<br>A tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml<br>M tests/channels/pjsip/rtp/tests.yaml<br>12 files changed, 327 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..080601d<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/extensions.conf<br>@@ -0,0 +1,5 @@<br>+[default]<br>+exten => tacos,1,Answer()<br>+same => n,UserEvent(${CHANNEL(audionativeformat)})<br>+same => n,Hangup()<br>+<br>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<br>new file mode 100644<br>index 0000000..54ae503<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf<br>@@ -0,0 +1,21 @@<br>+[local-transport-template](!)<br>+type=transport<br>+bind=127.0.0.1:5060<br>+<br>+[local-transport-udp](local-transport-template)<br>+protocol=udp<br>+<br>+[endpoint-template-ipv4](!)<br>+type=endpoint<br>+context=default<br>+allow=!all,g722,gsm,ulaw,alaw<br>+asymmetric_rtp_codec=yes<br>+<br>+;== IPv4 & UDP ==<br>+[bob-ipv4-udp](endpoint-template-ipv4)<br>+aors=bob-ipv4-udp<br>+from_user=uut-ipv4-udp<br>+<br>+[bob-ipv4-udp]<br>+type=aor<br>+contact=sip:bob-ipv4-udp@127.0.0.1:5062\;transport=udp<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/rtp.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/rtp.conf<br>new file mode 100644<br>index 0000000..c62eb86<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/rtp.conf<br>@@ -0,0 +1,4 @@<br>+[general]<br>+rtpstart=55220<br>+rtpend=55221<br>+;<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/sipp/bob.xml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/sipp/bob.xml<br>new file mode 100644<br>index 0000000..c22d020<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/sipp/bob.xml<br>@@ -0,0 +1,72 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="Just answer and wait for BYE"><br>+  <recv request="INVITE" crlf="true"><br>+  </recv><br>+<br>+  <send><br>+    <![CDATA[<br>+<br>+      SIP/2.0 180 Ringing<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:];tag=[pid]SIPpTag01[call_number]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Length: 0<br>+<br>+    ]]><br>+  </send><br>+<br>+  <send retrans="500"><br>+    <![CDATA[<br>+<br>+      SIP/2.0 200 OK<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:];tag=[pid]SIPpTag01[call_number]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+      v=0<br>+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]<br>+      s=-<br>+      c=IN IP[media_ip_type] [media_ip]<br>+      t=0 0<br>+      m=audio 55225 RTP/AVP 9 0 3<br>+      a=rtpmap:9 G722/8000<br>+      a=rtpmap:0 PCMU/8000<br>+      a=rtpmap:3 GSM/8000<br>+<br>+    ]]><br>+  </send><br>+<br>+  <recv request="ACK"><br>+  </recv><br>+<br>+  <recv request="BYE"><br>+  </recv><br>+<br>+  <send retrans="500"><br>+    <![CDATA[<br>+<br>+      SIP/2.0 200 OK<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:];tag=[pid]SIPpTag01[call_number]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+    ]]><br>+  </send><br>+<br>+</scenario><br>+<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/test-config.yaml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/test-config.yaml<br>new file mode 100644<br>index 0000000..dea8d1e<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/test-config.yaml<br>@@ -0,0 +1,59 @@<br>+testinfo:<br>+    summary:     'Tests that when asymmetric_rtp_codec is set to yes multiple formats are on the channel'<br>+    description: |<br>+        'Asterisk calls bob with the asymmetric_rtp_codec option set to<br>+         yes. The test confirms that the format on the resulting channel<br>+         contains multiple formats.'<br>+<br>+test-modules:<br>+    add-test-to-search-path: True<br>+    test-object:<br>+        config-section: sipp-config<br>+        typename: sipp.SIPpTestCase<br>+    modules:<br>+        -<br>+            config-section: ami-config<br>+            typename: 'pluggable_modules.EventActionModule'<br>+        -<br>+            config-section: originator-config-ipv4-udp<br>+            typename: 'pluggable_modules.Originator'<br>+<br>+test-object-config:<br>+    connect-ami: True<br>+    asterisk-instances: 1<br>+<br>+sipp-config:<br>+    fail-on-any: True<br>+    stop-after-scenarios: false<br>+    test-iterations:<br>+        -<br>+            scenarios:<br>+                - { 'key-args': {'scenario': 'bob.xml', '-i': '127.0.0.1', '-p': '5062'}}<br>+<br>+ami-config:<br>+    -<br>+        ami-events:<br>+            id: '0'<br>+            conditions:<br>+                match:<br>+                    Event: 'UserEvent'<br>+                    UserEvent: '\(g722\|gsm\|ulaw\)'<br>+            count: 1<br>+        stop_test:<br>+<br>+originator-config-ipv4-udp:<br>+    trigger: 'scenario_start'<br>+    ignore-originate-failure: 'no'<br>+    id: '0'<br>+    channel: 'PJSIP/bob-ipv4-udp'<br>+    context: 'default'<br>+    exten: 'tacos'<br>+    priority: '1'<br>+    async: 'True'<br>+<br>+properties:<br>+    minversion: '13.17.0'<br>+    dependencies:<br>+        - asterisk : 'res_pjsip'<br>+    tags:<br>+        - pjsip<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..080601d<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/extensions.conf<br>@@ -0,0 +1,5 @@<br>+[default]<br>+exten => tacos,1,Answer()<br>+same => n,UserEvent(${CHANNEL(audionativeformat)})<br>+same => n,Hangup()<br>+<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..619a0a7<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/pjsip.conf<br>@@ -0,0 +1,21 @@<br>+[local-transport-template](!)<br>+type=transport<br>+bind=127.0.0.1:5060<br>+<br>+[local-transport-udp](local-transport-template)<br>+protocol=udp<br>+<br>+[endpoint-template-ipv4](!)<br>+type=endpoint<br>+context=default<br>+allow=!all,g722,gsm,ulaw,alaw<br>+asymmetric_rtp_codec=no<br>+<br>+;== IPv4 & UDP ==<br>+[bob-ipv4-udp](endpoint-template-ipv4)<br>+aors=bob-ipv4-udp<br>+from_user=uut-ipv4-udp<br>+<br>+[bob-ipv4-udp]<br>+type=aor<br>+contact=sip:bob-ipv4-udp@127.0.0.1:5062\;transport=udp<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/rtp.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/rtp.conf<br>new file mode 100644<br>index 0000000..c62eb86<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/rtp.conf<br>@@ -0,0 +1,4 @@<br>+[general]<br>+rtpstart=55220<br>+rtpend=55221<br>+;<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/sipp/bob.xml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/sipp/bob.xml<br>new file mode 100644<br>index 0000000..c22d020<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/sipp/bob.xml<br>@@ -0,0 +1,72 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="Just answer and wait for BYE"><br>+  <recv request="INVITE" crlf="true"><br>+  </recv><br>+<br>+  <send><br>+    <![CDATA[<br>+<br>+      SIP/2.0 180 Ringing<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:];tag=[pid]SIPpTag01[call_number]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Length: 0<br>+<br>+    ]]><br>+  </send><br>+<br>+  <send retrans="500"><br>+    <![CDATA[<br>+<br>+      SIP/2.0 200 OK<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:];tag=[pid]SIPpTag01[call_number]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+      v=0<br>+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]<br>+      s=-<br>+      c=IN IP[media_ip_type] [media_ip]<br>+      t=0 0<br>+      m=audio 55225 RTP/AVP 9 0 3<br>+      a=rtpmap:9 G722/8000<br>+      a=rtpmap:0 PCMU/8000<br>+      a=rtpmap:3 GSM/8000<br>+<br>+    ]]><br>+  </send><br>+<br>+  <recv request="ACK"><br>+  </recv><br>+<br>+  <recv request="BYE"><br>+  </recv><br>+<br>+  <send retrans="500"><br>+    <![CDATA[<br>+<br>+      SIP/2.0 200 OK<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:];tag=[pid]SIPpTag01[call_number]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Contact: <sip:[local_ip]:[local_port];transport=[transport]><br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+    ]]><br>+  </send><br>+<br>+</scenario><br>+<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/test-config.yaml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/test-config.yaml<br>new file mode 100644<br>index 0000000..9c2902b<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/test-config.yaml<br>@@ -0,0 +1,59 @@<br>+testinfo:<br>+    summary:     'Tests that when asymmetric_rtp_codec is set to no only one format is on the channel'<br>+    description: |<br>+        'Asterisk calls bob with the asymmetric_rtp_codec option set to<br>+         no. The test confirms that the format on the resulting channel<br>+         contains only one format and not multiple.'<br>+<br>+test-modules:<br>+    add-test-to-search-path: True<br>+    test-object:<br>+        config-section: sipp-config<br>+        typename: sipp.SIPpTestCase<br>+    modules:<br>+        -<br>+            config-section: ami-config<br>+            typename: 'pluggable_modules.EventActionModule'<br>+        -<br>+            config-section: originator-config-ipv4-udp<br>+            typename: 'pluggable_modules.Originator'<br>+<br>+test-object-config:<br>+    connect-ami: True<br>+    asterisk-instances: 1<br>+<br>+sipp-config:<br>+    fail-on-any: True<br>+    stop-after-scenarios: false<br>+    test-iterations:<br>+        -<br>+            scenarios:<br>+                - { 'key-args': {'scenario': 'bob.xml', '-i': '127.0.0.1', '-p': '5062'}}<br>+<br>+ami-config:<br>+    -<br>+        ami-events:<br>+            id: '0'<br>+            conditions:<br>+                match:<br>+                    Event: 'UserEvent'<br>+                    UserEvent: '\(g722\)'<br>+            count: 1<br>+        stop_test:<br>+<br>+originator-config-ipv4-udp:<br>+    trigger: 'scenario_start'<br>+    ignore-originate-failure: 'no'<br>+    id: '0'<br>+    channel: 'PJSIP/bob-ipv4-udp'<br>+    context: 'default'<br>+    exten: 'tacos'<br>+    priority: '1'<br>+    async: 'True'<br>+<br>+properties:<br>+    minversion: '13.17.0'<br>+    dependencies:<br>+        - asterisk : 'res_pjsip'<br>+    tags:<br>+        - pjsip<br>diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml<br>new file mode 100644<br>index 0000000..bf5cfd7<br>--- /dev/null<br>+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml<br>@@ -0,0 +1,4 @@<br>+# Enter tests here in the order they should be considered for execution:<br>+tests:<br>+    - test: 'on'<br>+    - test: 'off'<br>diff --git a/tests/channels/pjsip/rtp/tests.yaml b/tests/channels/pjsip/rtp/tests.yaml<br>index 872daa9..ad7042d 100644<br>--- a/tests/channels/pjsip/rtp/tests.yaml<br>+++ b/tests/channels/pjsip/rtp/tests.yaml<br>@@ -4,3 +4,4 @@<br>     - test: 'timeout'<br>     - test: 'timeout_hold'<br>     - test: 'bind_rtp_to_media_address'<br>+    - dir: 'asymmetric_rtp_codec'<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5773">change 5773</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/5773"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I52c84ec317d8b4ead82d5974227a3d5c15f83808 </div>
<div style="display:none"> Gerrit-Change-Number: 5773 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>