[Asterisk-code-review] res/pjsip Add test for 'auto info' (testsuite[master])

Torrey Searle asteriskteam at digium.com
Mon Jun 19 08:05:16 CDT 2017


Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/5878


Change subject: res/pjsip  Add test for 'auto_info'
......................................................................

res/pjsip  Add test for 'auto_info'

test to validate new dtmf mode 'auto_info'

ASTERISK-27066 #close

Change-Id: I674d3a6dc678f275bb39738505ee032dd86dbb37
---
A tests/channels/pjsip/dtmf_info_fallback/configs/ast1/extensions.conf
A tests/channels/pjsip/dtmf_info_fallback/configs/ast1/pjsip.conf
A tests/channels/pjsip/dtmf_info_fallback/run-test
A tests/channels/pjsip/dtmf_info_fallback/sipp/A_PARTY.xml
A tests/channels/pjsip/dtmf_info_fallback/sipp/B_PARTY.xml
A tests/channels/pjsip/dtmf_info_fallback/sipp/dtmf_2833_4.pcap
A tests/channels/pjsip/dtmf_info_fallback/test-config.yaml
M tests/channels/pjsip/tests.yaml
8 files changed, 407 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/78/5878/1

diff --git a/tests/channels/pjsip/dtmf_info_fallback/configs/ast1/extensions.conf b/tests/channels/pjsip/dtmf_info_fallback/configs/ast1/extensions.conf
new file mode 100644
index 0000000..35c0a08
--- /dev/null
+++ b/tests/channels/pjsip/dtmf_info_fallback/configs/ast1/extensions.conf
@@ -0,0 +1,12 @@
+[general]
+static=yes
+writeprotect=yes
+autofallthrough=yes
+clearglobalvars=no
+priorityjumping=yes
+
+[globals]
+
+[default]
+exten => s,n,Dial(pjsip/sbc,180)
+
diff --git a/tests/channels/pjsip/dtmf_info_fallback/configs/ast1/pjsip.conf b/tests/channels/pjsip/dtmf_info_fallback/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..025b2a9
--- /dev/null
+++ b/tests/channels/pjsip/dtmf_info_fallback/configs/ast1/pjsip.conf
@@ -0,0 +1,80 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements start
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[general]
+sipdebug = yes
+
+[PEER_A]
+port = 6060
+
+[sbc]
+port = 5700
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements end
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+--;
+
+
+[global]
+type = global
+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:6060
+
+[PEER_A]
+type = identify
+endpoint = PEER_A
+match = 127.0.0.1
+
+[PEER_A]
+type = endpoint
+context = default
+dtmf_mode = auto_info
+disallow = all
+allow = alaw
+allow = ulaw
+allow = g729
+allow = h263p
+allow = h264
+direct_media = no
+send_rpid = yes
+sdp_session = session
+t38_udptl = yes
+t38_udptl_ec = redundancy
+
+[sbc]
+type = aor
+contact = sip:127.0.0.1:5700
+
+[sbc]
+type = endpoint
+context = callcontrol
+dtmf_mode = auto_info
+disallow = all
+allow = alaw
+allow = ulaw
+allow = g729
+allow = h263p
+allow = h264
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = sbc
+t38_udptl = yes
+t38_udptl_ec = redundancy
+
diff --git a/tests/channels/pjsip/dtmf_info_fallback/run-test b/tests/channels/pjsip/dtmf_info_fallback/run-test
new file mode 100755
index 0000000..241bd58
--- /dev/null
+++ b/tests/channels/pjsip/dtmf_info_fallback/run-test
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+Russell Bryant <russell at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import signal
+import  subprocess
+import time
+
+sys.path.append("lib/python")
+sys.path.append("utils")
+
+from twisted.internet import reactor
+from asterisk.sipp import SIPpTest
+
+WORKING_DIR = os.path.abspath(os.path.dirname(__file__))
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+
+sippA_logfile = WORKING_DIR + "/A_PARTY.log"
+sippA_errfile = WORKING_DIR + "/A_PARTY_ERR.log"
+sippB_logfile = WORKING_DIR + "/B_PARTY.log"
+sippB_errfile = WORKING_DIR + "/B_PARTY_ERR.log"
+SIPP_SCENARIOS = [
+    {
+        'scenario' : 'B_PARTY.xml',
+        '-i' : '127.0.0.1',
+        '-p' : '5700',
+        '-mp' : '6300',
+        '-message_file' : sippB_logfile,
+        '-error_file' : sippB_errfile,
+        '-trace_msg' : '-trace_err',
+    },
+    {
+        'scenario' : 'A_PARTY.xml',
+        '-i' : '127.0.0.1',
+        '-p' : '6060',
+        '-s' : '3228080970',
+        '-d' : '35000',
+        '-message_file' : sippA_logfile,
+        '-error_file' : sippA_errfile,
+        '-trace_msg' : '-trace_err',
+    }
+]
+
+
+def main():
+    test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
+    test.reactor_timeout = 70;
+
+    time.sleep(10) #Wait 5 seconds to ensure that all the sockets are open before running the test	
+
+    reactor.run()
+
+    if not test.passed:
+        return 1
+
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
diff --git a/tests/channels/pjsip/dtmf_info_fallback/sipp/A_PARTY.xml b/tests/channels/pjsip/dtmf_info_fallback/sipp/A_PARTY.xml
new file mode 100644
index 0000000..ada8590
--- /dev/null
+++ b/tests/channels/pjsip/dtmf_info_fallback/sipp/A_PARTY.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE scenario SYSTEM "sipp.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 'uac' scenario with pcap (rtp) play           -->
+<!--                                                                    -->
+<scenario name="DTMF_INFO_FALLBACK">
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] keyword.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@voxbone.com SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:test at voxbone.com>;tag=[call_number]
+      To: sut <sip:[service]@voxbone.com:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[local_ip_type] [local_ip]
+      t=0 0
+      m=audio 9000 RTP/AVP 0 101
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+      a=fmtp:101 0-15
+
+    ]]>
+  </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" crlf="true">
+  </recv>
+
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@voxbone.com SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:test@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@voxbone.com>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Play a PCAP which sends the RTPEVENT packet containing DTMF 4 -->
+  <nop>
+    <action>
+	    <exec play_pcap_audio="./tests/channels/pjsip/dtmf_info_fallback/sipp/dtmf_2833_4.pcap"/>
+    </action>
+  </nop>
+
+  <pause milliseconds="7000"/>
+
+  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@voxbone.com SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:test@[local_ip]:[local_port]>;tag=[call_number]
+      To: sut <sip:[service]@voxbone.com>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- 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="3000"/>
+
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/dtmf_info_fallback/sipp/B_PARTY.xml b/tests/channels/pjsip/dtmf_info_fallback/sipp/B_PARTY.xml
new file mode 100644
index 0000000..a8a3d92
--- /dev/null
+++ b/tests/channels/pjsip/dtmf_info_fallback/sipp/B_PARTY.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="DTMF Handling">
+
+<recv request="INVITE" crlf="true">
+</recv>
+
+
+
+<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
+Content-Length: [len]
+
+v=0
+o=HuaweiSoftX3000 6644052 6644052 IN IP[local_ip_type] [local_ip]
+s=Sip Call
+c=IN IP[local_ip_type] [local_ip]
+t=0 0
+m=audio 8000 RTP/AVP 0
+a=rtpmap:0 PCMU/8000
+
+]]>
+</send>
+
+
+<recv request="ACK"
+      rtd="true"
+      crlf="true">
+
+</recv>
+
+<!-- Receive the DIGIT 4-->
+<recv request="INFO"> 
+  <action>
+	  <ereg regexp="(Signal=4)" search_in="body" check_it="true" assign_to = "1" />
+    	  <log message="---DTMF--- [$1]"/>
+  </action>
+</recv> 
+ 
+<send> 
+<![CDATA[ 
+  
+SIP/2.0 200 OK 
+[last_Via:] 
+[last_From:] 
+[last_To:] 
+[last_Call-ID:] 
+[last_CSeq:] 
+Content-Length: 0 
+ 
+]]> 
+</send> 
+
+<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="3000"/>
+
+
+<!-- definition of the response time repartition table (unit is ms)   -->
+<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+<!-- definition of the call length repartition table (unit is ms)     -->
+<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/dtmf_info_fallback/sipp/dtmf_2833_4.pcap b/tests/channels/pjsip/dtmf_info_fallback/sipp/dtmf_2833_4.pcap
new file mode 100644
index 0000000..b3bd1ef
--- /dev/null
+++ b/tests/channels/pjsip/dtmf_info_fallback/sipp/dtmf_2833_4.pcap
Binary files differ
diff --git a/tests/channels/pjsip/dtmf_info_fallback/test-config.yaml b/tests/channels/pjsip/dtmf_info_fallback/test-config.yaml
new file mode 100644
index 0000000..e0c5c52
--- /dev/null
+++ b/tests/channels/pjsip/dtmf_info_fallback/test-config.yaml
@@ -0,0 +1,11 @@
+testinfo:
+    summary: 'This test case verifies the DTMF INFO FALLBACK i.e fallback tO INFO instead of INBAND'
+    description: |
+        'This test case verifies the DTMF INFO FALLBACK i.e fallback tO INFO instead of INBAND'
+
+properties:
+    minversion: '13'
+    dependencies:
+        - app : 'sipp'
+    tags:
+        - SIP
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 59f5f1c..54ff285 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -53,3 +53,4 @@
     - test: 'user_eq_phone'
     - test: 'cseq_method'
     - test: 'multipart_empty_part'
+    - test: 'dtmf_info_fallback'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I674d3a6dc678f275bb39738505ee032dd86dbb37
Gerrit-Change-Number: 5878
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170619/063776bb/attachment-0001.html>


More information about the asterisk-code-review mailing list