[asterisk-commits] pjsip/rtp/asymmetric rtp codec: Add tests for local format b... (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 14 15:00:53 CDT 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/5773 )

Change subject: pjsip/rtp/asymmetric_rtp_codec: Add tests for local format behavior.
......................................................................

pjsip/rtp/asymmetric_rtp_codec: Add tests for local format behavior.

This adds two tests which confirm the behavior of the
'asymmetric_rtp_codec' option for local formats.

One test confirms that when set to 'no' the resulting formats
on the channel contains only one format.

The other test confirms that when set to 'yes' the resulting
formats on the channel contain all negotiated formats.

ASTERISK-26996

Change-Id: I52c84ec317d8b4ead82d5974227a3d5c15f83808
---
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/extensions.conf
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/rtp.conf
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/sipp/bob.xml
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/test-config.yaml
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/extensions.conf
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/pjsip.conf
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/rtp.conf
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/sipp/bob.xml
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/test-config.yaml
A tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml
M tests/channels/pjsip/rtp/tests.yaml
12 files changed, 327 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



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
new file mode 100644
index 0000000..080601d
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten => tacos,1,Answer()
+same => n,UserEvent(${CHANNEL(audionativeformat)})
+same => n,Hangup()
+
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
new file mode 100644
index 0000000..54ae503
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/pjsip.conf
@@ -0,0 +1,21 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,g722,gsm,ulaw,alaw
+asymmetric_rtp_codec=yes
+
+;== IPv4 & UDP ==
+[bob-ipv4-udp](endpoint-template-ipv4)
+aors=bob-ipv4-udp
+from_user=uut-ipv4-udp
+
+[bob-ipv4-udp]
+type=aor
+contact=sip:bob-ipv4-udp at 127.0.0.1:5062\;transport=udp
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
new file mode 100644
index 0000000..c62eb86
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/configs/ast1/rtp.conf
@@ -0,0 +1,4 @@
+[general]
+rtpstart=55220
+rtpend=55221
+;
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
new file mode 100644
index 0000000..c22d020
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/sipp/bob.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Just answer and wait for BYE">
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <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 55225 RTP/AVP 9 0 3
+      a=rtpmap:9 G722/8000
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:3 GSM/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK">
+  </recv>
+
+  <recv request="BYE">
+  </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]
+
+    ]]>
+  </send>
+
+</scenario>
+
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
new file mode 100644
index 0000000..dea8d1e
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/off/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary:     'Tests that when asymmetric_rtp_codec is set to yes multiple formats are on the channel'
+    description: |
+        'Asterisk calls bob with the asymmetric_rtp_codec option set to
+         yes. The test confirms that the format on the resulting channel
+         contains multiple formats.'
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: sipp-config
+        typename: sipp.SIPpTestCase
+    modules:
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+        -
+            config-section: originator-config-ipv4-udp
+            typename: 'pluggable_modules.Originator'
+
+test-object-config:
+    connect-ami: True
+    asterisk-instances: 1
+
+sipp-config:
+    fail-on-any: True
+    stop-after-scenarios: false
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-i': '127.0.0.1', '-p': '5062'}}
+
+ami-config:
+    -
+        ami-events:
+            id: '0'
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: '\(g722\|gsm\|ulaw\)'
+            count: 1
+        stop_test:
+
+originator-config-ipv4-udp:
+    trigger: 'scenario_start'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'PJSIP/bob-ipv4-udp'
+    context: 'default'
+    exten: 'tacos'
+    priority: '1'
+    async: 'True'
+
+properties:
+    minversion: '13.17.0'
+    dependencies:
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
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
new file mode 100644
index 0000000..080601d
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten => tacos,1,Answer()
+same => n,UserEvent(${CHANNEL(audionativeformat)})
+same => n,Hangup()
+
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
new file mode 100644
index 0000000..619a0a7
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/pjsip.conf
@@ -0,0 +1,21 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1:5060
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,g722,gsm,ulaw,alaw
+asymmetric_rtp_codec=no
+
+;== IPv4 & UDP ==
+[bob-ipv4-udp](endpoint-template-ipv4)
+aors=bob-ipv4-udp
+from_user=uut-ipv4-udp
+
+[bob-ipv4-udp]
+type=aor
+contact=sip:bob-ipv4-udp at 127.0.0.1:5062\;transport=udp
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
new file mode 100644
index 0000000..c62eb86
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/configs/ast1/rtp.conf
@@ -0,0 +1,4 @@
+[general]
+rtpstart=55220
+rtpend=55221
+;
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
new file mode 100644
index 0000000..c22d020
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/sipp/bob.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Just answer and wait for BYE">
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <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 55225 RTP/AVP 9 0 3
+      a=rtpmap:9 G722/8000
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:3 GSM/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK">
+  </recv>
+
+  <recv request="BYE">
+  </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]
+
+    ]]>
+  </send>
+
+</scenario>
+
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
new file mode 100644
index 0000000..9c2902b
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/on/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary:     'Tests that when asymmetric_rtp_codec is set to no only one format is on the channel'
+    description: |
+        'Asterisk calls bob with the asymmetric_rtp_codec option set to
+         no. The test confirms that the format on the resulting channel
+         contains only one format and not multiple.'
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: sipp-config
+        typename: sipp.SIPpTestCase
+    modules:
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+        -
+            config-section: originator-config-ipv4-udp
+            typename: 'pluggable_modules.Originator'
+
+test-object-config:
+    connect-ami: True
+    asterisk-instances: 1
+
+sipp-config:
+    fail-on-any: True
+    stop-after-scenarios: false
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'bob.xml', '-i': '127.0.0.1', '-p': '5062'}}
+
+ami-config:
+    -
+        ami-events:
+            id: '0'
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: '\(g722\)'
+            count: 1
+        stop_test:
+
+originator-config-ipv4-udp:
+    trigger: 'scenario_start'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'PJSIP/bob-ipv4-udp'
+    context: 'default'
+    exten: 'tacos'
+    priority: '1'
+    async: 'True'
+
+properties:
+    minversion: '13.17.0'
+    dependencies:
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml
new file mode 100644
index 0000000..bf5cfd7
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'on'
+    - test: 'off'
diff --git a/tests/channels/pjsip/rtp/tests.yaml b/tests/channels/pjsip/rtp/tests.yaml
index 872daa9..ad7042d 100644
--- a/tests/channels/pjsip/rtp/tests.yaml
+++ b/tests/channels/pjsip/rtp/tests.yaml
@@ -4,3 +4,4 @@
     - test: 'timeout'
     - test: 'timeout_hold'
     - test: 'bind_rtp_to_media_address'
+    - dir: 'asymmetric_rtp_codec'

-- 
To view, visit https://gerrit.asterisk.org/5773
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I52c84ec317d8b4ead82d5974227a3d5c15f83808
Gerrit-Change-Number: 5773
Gerrit-PatchSet: 3
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170614/58ba5a21/attachment-0001.html>


More information about the asterisk-commits mailing list