[asterisk-commits] res_pjsip_sdp_rtp: implement full state machine for MOH_PASSTHROUGH (testsuite[16])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 5 09:53:47 CST 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/13878 )

Change subject: res_pjsip_sdp_rtp: implement full state machine for MOH_PASSTHROUGH
......................................................................

res_pjsip_sdp_rtp: implement full state machine for MOH_PASSTHROUGH

This test verifies that asterisk will correctly generate SDP with
sendonly, recvonly, and inactive depending on the state of local
and remote on hold

ASTERISK-23738 #close

Change-Id: I8b22fe78f5cc02c2b0b888d51df296c4509b1563
---
A tests/channels/pjsip/moh_passthru_inactive/configs/ast1/extensions.conf
A tests/channels/pjsip/moh_passthru_inactive/configs/ast1/pjsip.conf
A tests/channels/pjsip/moh_passthru_inactive/sipp/uac_cluster_hold_reinvite.xml
A tests/channels/pjsip/moh_passthru_inactive/sipp/uas_hold_reinvite.xml
A tests/channels/pjsip/moh_passthru_inactive/test-config.yaml
M tests/channels/pjsip/tests.yaml
6 files changed, 622 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/channels/pjsip/moh_passthru_inactive/configs/ast1/extensions.conf b/tests/channels/pjsip/moh_passthru_inactive/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ad7b155
--- /dev/null
+++ b/tests/channels/pjsip/moh_passthru_inactive/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[general]
+static=yes
+writeprotect=yes
+autofallthrough=yes
+clearglobalvars=no
+priorityjumping=yes
+
+[globals]
+
+[default]
+exten => _X.,1,Dial(pjsip/sbc,180)
diff --git a/tests/channels/pjsip/moh_passthru_inactive/configs/ast1/pjsip.conf b/tests/channels/pjsip/moh_passthru_inactive/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..adfa87b
--- /dev/null
+++ b/tests/channels/pjsip/moh_passthru_inactive/configs/ast1/pjsip.conf
@@ -0,0 +1,78 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements start
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[general]
+sipdebug = yes
+
+[PEER_A]
+port = 5061
+
+[sbc]
+port = 5700
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements end
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+--;
+
+
+[global]
+type = global
+user_agent = Vox Callcontrol
+debug = yes
+
+[transport-udp6]
+type = transport
+protocol = udp
+bind = [::]:5060
+
+[transport-udp]
+type = transport
+protocol = udp
+bind = 0.0.0.0:5060
+
+[PEER_A]
+type = aor
+contact = sip:127.0.0.1:5061
+
+[PEER_A]
+type = identify
+endpoint = PEER_A
+match = 127.0.0.1
+
+[PEER_A]
+type = endpoint
+context = default
+dtmf_mode = rfc4733
+disallow = all
+allow = ulaw
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = PEER_A
+t38_udptl = yes
+t38_udptl_ec = redundancy
+asymmetric_rtp_codec = no
+moh_passthrough = yes
+
+[sbc]
+type = aor
+contact = sip:127.0.0.1:5700
+
+[sbc]
+type = endpoint
+context = callcontrol
+dtmf_mode = rfc4733
+disallow = all
+allow = ulaw
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = sbc
+t38_udptl = yes
+t38_udptl_ec = redundancy
+asymmetric_rtp_codec = no
+moh_passthrough = yes
+
diff --git a/tests/channels/pjsip/moh_passthru_inactive/sipp/uac_cluster_hold_reinvite.xml b/tests/channels/pjsip/moh_passthru_inactive/sipp/uac_cluster_hold_reinvite.xml
new file mode 100644
index 0000000..1062bcb
--- /dev/null
+++ b/tests/channels/pjsip/moh_passthru_inactive/sipp/uac_cluster_hold_reinvite.xml
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE scenario SYSTEM "pvicentini.dtd">
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uac' scenario.                       -->
+<!--                                                                    -->
+<scenario name="Basic Sipstone UAC">
+  <!-- In client mode (pvicentini placing calls), the Call-ID MUST be         -->
+  <!-- generated by pvicentini. To do so, use [call_id] keyword.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From:  <sip:pvicentini@[local_ip]:[local_port]>;tag=[call_number]
+      To: bansalphone <sip:[service]@[remote_ip]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:pvicentini@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=pvicentini 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
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true" rrs="true">
+  </recv>
+
+
+  <send>
+    <![CDATA[
+
+      ACK [next_url] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: pvicentini <sip:pvicentini@[local_ip]:[local_port]>;tag=[call_number]
+      To: bansalphone <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:pvicentini@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      [routes]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="INVITE" crlf="true">
+    <action>
+      <ereg regexp="a=sendonly" search_in="body" check_it="true" assign_to="9"/>
+      <ereg regexp="[[:punct:]](.*)[[:punct:]]" search_in="hdr" header="Contact:" check_it="true" assign_to="6,1" />
+      <ereg regexp=".*" search_in="hdr" header="From:" check_it="true" assign_to="2" />
+      <ereg regexp=".*" search_in="hdr" header="To:" check_it="true" assign_to="3" />
+    </action>
+  </recv>
+  <Reference variables="9"/>
+  <Reference variables="6"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      [last_Record-Route]
+      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=fmtp:101 0-16
+      a=recvonly
+
+
+    ]]>
+  </send>
+
+  <recv request="ACK" rtd="true" crlf="true">
+  </recv>
+
+  <pause milliseconds="500"/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE [$1] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      [last_Call-ID:]
+      From: [$3];tag=[call_number]
+      To: [$2]
+      CSeq: 2 INVITE
+      Contact: <sip:[local_ip]:[local_port]>
+      Max-Forwards: 70
+      Content-Type: application/sdp
+      [routes]
+      Content-Length: [len]
+
+      v=0
+      o=HuaweiSoftX3000 6644052 6644052 IN IP[local_ip_type] [local_ip]
+      s=Sip Call
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 8 0 18 101
+      a=rtpmap:8 PCMA/8000
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:18 G729/8000
+      a=rtpmap:101 telephone-event/8000
+      a=fmtp:101 0-15
+      a=inactive
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true" crlf="true">
+    <action>
+      <ereg regexp="a=inactive" search_in="body" check_it="true" assign_to="10"/>
+    </action>
+  </recv>
+  <Reference variables="10"/>
+
+
+  <send>
+  <![CDATA[
+
+      ACK [$1] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      [last_Call-ID:]
+      From: [$3];tag=[call_number]
+      To: [$2]
+      CSeq: 2 ACK
+      Max-Forwards: 70
+      Content-Length: 0
+      [routes]
+
+  ]]>
+  </send>
+
+  <pause milliseconds="500"/>
+
+  <send retrans="500">
+  <![CDATA[
+
+      INVITE [$1] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      [last_Call-ID:]
+      From: [$3];tag=[call_number]
+      To: [$2]
+      CSeq: 3 INVITE
+      Contact: <sip:[local_ip]:[local_port]>
+      Max-Forwards: 70
+      Content-Type: application/sdp
+      [routes]
+      Content-Length: [len]
+
+      v=0
+      o=HuaweiSoftX3000 6644052 6644052 IN IP[local_ip_type] [local_ip]
+      s=Sip Call
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 8 0 18 101
+      a=rtpmap:8 PCMA/8000
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:18 G729/8000
+      a=rtpmap:101 telephone-event/8000
+      a=fmtp:101 0-15
+      a=recvonly
+
+  ]]>
+  </send>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true" crlf="true">
+    <action>
+      <ereg regexp="a=sendonly" search_in="body" check_it="true" assign_to="11"/>
+    </action>
+  </recv>
+  <Reference variables="11"/>
+
+
+  <send>
+    <![CDATA[
+
+      ACK [$1] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      [last_Call-ID:]
+      From: [$3];tag=[call_number]
+      To: [$2]
+      CSeq: 3 ACK
+      Max-Forwards: 70
+      Content-Length: 0
+      [routes]
+
+    ]]>
+  </send>
+
+
+  <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE [next_url] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: pvicentini <sip:pvicentini@[local_ip]:[local_port]>;tag=[call_number]
+      To: bansalphone <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 4 BYE
+      Contact: sip:pvicentini@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+      [routes]
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/moh_passthru_inactive/sipp/uas_hold_reinvite.xml b/tests/channels/pjsip/moh_passthru_inactive/sipp/uas_hold_reinvite.xml
new file mode 100644
index 0000000..1d4fb93
--- /dev/null
+++ b/tests/channels/pjsip/moh_passthru_inactive/sipp/uas_hold_reinvite.xml
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Re-Invite problem 1">
+
+<recv request="INVITE" crlf="true"  rrs="true">
+  <action>
+    <ereg regexp="[[:punct:]](.*)[[:punct:]]" search_in="hdr" header="Contact:" check_it="true" assign_to="6,1" />
+    <ereg regexp=".*" search_in="hdr" header="From:" check_it="true" assign_to="2" />
+    <ereg regexp=".*" search_in="hdr" header="To:" check_it="true" assign_to="3" />
+  </action>
+</recv>
+<Reference variables="9"/>
+
+
+<send>
+<![CDATA[
+
+SIP/2.0 100 Trying
+[last_Via:]
+[last_Call-ID:]
+[last_From:]
+[last_To:]
+[last_CSeq:]
+Content-Length: 0
+
+]]>
+</send>
+
+<send retrans="500">
+<![CDATA[
+
+SIP/2.0 200 OK
+[last_Via:]
+[last_Call-ID:]
+[last_From:]
+[last_To:];tag=[call_number]
+[last_CSeq:]
+Contact: <sip:736596371553211257@[local_ip]:[local_port];user=phone>
+Content-Type: application/sdp
+[last_Record-Route]
+Content-Length: [len]
+
+v=0
+o=HuaweiSoftX3000 6644052 6644052 IN IP[local_ip_type] [local_ip]
+s=Sip Call
+c=IN IP[media_ip_type] [media_ip]
+t=0 0
+m=audio [media_port] RTP/AVP 8 0 18 101
+a=rtpmap:8 PCMA/8000
+a=rtpmap:0 PCMU/8000
+a=rtpmap:18 G729/8000
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+
+]]>
+</send>
+
+<recv request="ACK"
+      rtd="true"
+      crlf="true">
+</recv>
+
+<pause milliseconds="500"/>
+
+<send retrans="500">
+<![CDATA[
+
+INVITE [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+[last_Call-ID:]
+From: [$3];tag=[call_number]
+To: [$2]
+CSeq: 1 INVITE
+Contact: <sip:[local_ip]:[local_port]>
+Max-Forwards: 70
+Content-Type: application/sdp
+[routes]
+Content-Length: [len] 
+
+v=0
+o=HuaweiSoftX3000 6644052 6644052 IN IP[local_ip_type] [local_ip]
+s=Sip Call
+c=IN IP[media_ip_type] 0.0.0.0
+t=0 0
+m=audio [media_port] RTP/AVP 8 0 18 101
+a=rtpmap:8 PCMA/8000
+a=rtpmap:0 PCMU/8000
+a=rtpmap:18 G729/8000
+a=rtpmap:101 telephone-event/8000
+a=fmtp:101 0-15
+a=sendonly
+
+]]>
+</send>
+
+<recv response="100" optional="true">
+</recv>
+
+<recv response="100" optional="true">
+</recv>
+
+<recv response="200" rtd="true" crlf="true">
+  <action>
+    <ereg regexp="a=recvonly" search_in="body" check_it="true" assign_to="9"/>
+  </action>
+</recv>
+<Reference variables="9"/>
+
+
+<send>
+<![CDATA[
+
+ACK [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+[last_Call-ID:]
+From: [$3];tag=[call_number]
+To: [$2]
+CSeq: 1 ACK
+Max-Forwards: 70
+Content-Length: 0
+[routes]
+
+]]>
+</send>
+
+<recv request="INVITE" crlf="true">
+  <action>
+    <ereg regexp="a=inactive" search_in="body" check_it="true" assign_to="10"/>
+  </action>
+</recv>
+<Reference variables="10"/>
+
+<send retrans="500">
+<![CDATA[
+
+SIP/2.0 200 OK
+[last_Via:]
+[last_From:]
+[last_To:];tag=[call_number]
+[last_Call-ID:]
+[last_CSeq:]
+Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+[last_Record-Route]
+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=fmtp:101 0-16
+a=inactive
+
+]]>
+</send>
+
+<recv request="ACK" rtd="true" crlf="true">
+</recv>
+
+<recv request="INVITE" crlf="true">
+  <action>
+    <ereg regexp="a=recvonly" search_in="body" check_it="true" assign_to="11"/>
+  </action>
+</recv>
+<Reference variables="11"/>
+
+<send retrans="500">
+<![CDATA[
+
+SIP/2.0 200 OK
+[last_Via:]
+[last_From:]
+[last_To:];tag=[call_number]
+[last_Call-ID:]
+[last_CSeq:]
+Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+[last_Record-Route]
+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=fmtp:101 0-16
+a=sendonly
+
+]]>
+</send>
+
+<recv request="ACK" rtd="true" crlf="true">
+</recv>
+
+<recv request="BYE">
+</recv>
+
+<send>
+<![CDATA[
+
+SIP/2.0 200 OK
+[last_Via:]
+[last_From:]
+[last_To:]
+[last_Call-ID:]
+[last_CSeq:]
+Content-Length: 0
+
+]]>
+</send>
+
+
+<!-- Keep the call open for a while in case the 200 is lost to be     -->
+<!-- able to retransmit it if we receive the BYE again.               -->
+<pause milliseconds="4000"/>
+
+
+</scenario>
+
diff --git a/tests/channels/pjsip/moh_passthru_inactive/test-config.yaml b/tests/channels/pjsip/moh_passthru_inactive/test-config.yaml
new file mode 100644
index 0000000..0d622fa
--- /dev/null
+++ b/tests/channels/pjsip/moh_passthru_inactive/test-config.yaml
@@ -0,0 +1,28 @@
+testinfo:
+    summary: 'Test Asterisk generates the correct held state for MOH Passthru'
+    description: |
+         'Asterisk if both ends have request to be on hold, then the sdp should
+          say inactive instead or recvonly'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uac_cluster_hold_reinvite.xml', '-i': '127.0.0.1', '-p': '5061', '-s': '3200000000', '-d': '4000'} }
+                - { 'key-args': {'scenario': 'uas_hold_reinvite.xml', '-i': '127.0.0.1', '-p': '5700'} }
+
+
+properties:
+    dependencies:
+        - sipp :
+             version : 'v3.0'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 4fa8f51..0635552 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -58,3 +58,4 @@
     - test: 'multipart_empty_part'
     - test: 'dtmf_info_fallback'
     - test: 'invalid_uris'
+    - test: 'moh_passthru_inactive'

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

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I8b22fe78f5cc02c2b0b888d51df296c4509b1563
Gerrit-Change-Number: 13878
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Torrey Searle <tsearle at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20200305/9a6f1f2c/attachment-0001.html>


More information about the asterisk-commits mailing list