[Asterisk-code-review] pjsip/rtp/asymmetric rtp codec: Add test for local format be... (testsuite[master])

Joshua Colp asteriskteam at digium.com
Wed Jun 7 11:48:13 CDT 2017


Joshua Colp has uploaded a new change for review. ( https://gerrit.asterisk.org/5773 )

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

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

This adds a test that explicitly sets the 'asymmetric_rtp_codec'
option to no on an endpoint and places a call with multiple negotiated
codecs. With the option set to no only one codec should be present
as the audio native format.

ASTERISK-26996

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


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/73/5773/1

diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/configs/ast1/extensions.conf
new file mode 100644
index 0000000..080601d
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/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/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..619a0a7
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/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/configs/ast1/rtp.conf b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/configs/ast1/rtp.conf
new file mode 100644
index 0000000..c62eb86
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/configs/ast1/rtp.conf
@@ -0,0 +1,4 @@
+[general]
+rtpstart=55220
+rtpend=55221
+;
diff --git a/tests/channels/pjsip/rtp/asymmetric_rtp_codec/sipp/bob.xml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/sipp/bob.xml
new file mode 100644
index 0000000..c22d020
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/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/test-config.yaml b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/test-config.yaml
new file mode 100644
index 0000000..9c2902b
--- /dev/null
+++ b/tests/channels/pjsip/rtp/asymmetric_rtp_codec/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/tests.yaml b/tests/channels/pjsip/rtp/tests.yaml
index 872daa9..76a640e 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'
+    - test: 'asymmetric_rtp_codec'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52c84ec317d8b4ead82d5974227a3d5c15f83808
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list