<p>Torrey Searle has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/5910">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">testsuite: add a test for PJSIPDtmfMode<br><br>this adds a test for the new function PJSIPDtmfMode<br><br>Change-Id: I8ae7d73aedc42533512adf7b96ed0eab8e09ad8c<br>---<br>A tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/extensions.conf<br>A tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/run-test<br>A tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/A_PARTY.xml<br>A tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/B_PARTY.xml<br>A tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/test-config.yaml<br>M tests/channels/pjsip/dialplan_functions/tests.yaml<br>7 files changed, 406 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/10/5910/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/extensions.conf b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..8577a8a<br>--- /dev/null<br>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/extensions.conf<br>@@ -0,0 +1,12 @@<br>+[general]<br>+static=yes<br>+writeprotect=yes<br>+autofallthrough=yes<br>+clearglobalvars=no<br>+priorityjumping=yes<br>+<br>+[globals]<br>+<br>+[default]<br>+exten => s,1,PJSIPDtmfMode(info)<br>+exten => s,n,Dial(pjsip/sbc,180)<br>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/pjsip.conf b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..b8aff59<br>--- /dev/null<br>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/configs/ast1/pjsip.conf<br>@@ -0,0 +1,79 @@<br>+;--<br>+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>+Non mapped elements start<br>+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>+<br>+[general]<br>+sipdebug = yes<br>+<br>+[PEER_A]<br>+port = 6060<br>+<br>+[sbc]<br>+port = 5700<br>+<br>+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>+Non mapped elements end<br>+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>+--;<br>+<br>+<br>+[global]<br>+type = global<br>+debug = yes<br>+<br>+[transport-udp6]<br>+type = transport<br>+protocol = udp<br>+bind = [::]:5060<br>+<br>+[transport-udp]<br>+type = transport<br>+protocol = udp<br>+bind = 0.0.0.0:5060<br>+<br>+[PEER_A]<br>+type = aor<br>+contact = sip:127.0.0.1:6060<br>+<br>+[PEER_A]<br>+type = identify<br>+endpoint = PEER_A<br>+match = 127.0.0.1<br>+<br>+[PEER_A]<br>+type = endpoint<br>+context = default<br>+disallow = all<br>+allow = alaw<br>+allow = ulaw<br>+allow = g729<br>+allow = h263p<br>+allow = h264<br>+direct_media = no<br>+send_rpid = yes<br>+sdp_session = session<br>+aors = PEER_A<br>+t38_udptl = yes<br>+t38_udptl_ec = redundancy<br>+<br>+[sbc]<br>+type = aor<br>+contact = sip:127.0.0.1:5700<br>+<br>+[sbc]<br>+type = endpoint<br>+context = callcontrol<br>+disallow = all<br>+allow = alaw<br>+allow = ulaw<br>+allow = g729<br>+allow = h263p<br>+allow = h264<br>+direct_media = no<br>+send_rpid = yes<br>+sdp_session = session<br>+aors = sbc<br>+t38_udptl = yes<br>+t38_udptl_ec = redundancy<br>+<br>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/run-test b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/run-test<br>new file mode 100644<br>index 0000000..bed5d4c<br>--- /dev/null<br>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/run-test<br>@@ -0,0 +1,68 @@<br>+#!/usr/bin/env python<br>+'''<br>+Copyright (C) 2010, Digium, Inc.<br>+Russell Bryant <russell@digium.com><br>+<br>+This program is free software, distributed under the terms of<br>+the GNU General Public License Version 2.<br>+'''<br>+<br>+import sys<br>+import os<br>+import signal<br>+import subprocess<br>+import time<br>+<br>+sys.path.append("lib/python")<br>+sys.path.append("utils")<br>+<br>+from twisted.internet import reactor<br>+from asterisk.sipp import SIPpTest<br>+<br>+WORKING_DIR = os.path.abspath(os.path.dirname(__file__))<br>+TEST_DIR = os.path.dirname(os.path.realpath(__file__))<br>+<br>+sippA_logfile = WORKING_DIR + "/A_PARTY.log"<br>+sippA_errfile = WORKING_DIR + "/A_PARTY_ERR.log"<br>+sippB_logfile = WORKING_DIR + "/B_PARTY.log"<br>+sippB_errfile = WORKING_DIR + "/B_PARTY_ERR.log"<br>+SIPP_SCENARIOS = [<br>+ {<br>+ 'scenario' : 'B_PARTY.xml',<br>+ '-i' : '127.0.0.1',<br>+ '-p' : '5700',<br>+ '-mp' : '6300',<br>+ '-message_file' : sippB_logfile,<br>+ '-error_file' : sippB_errfile,<br>+ '-trace_msg' : '-trace_err',<br>+ },<br>+ {<br>+ 'scenario' : 'A_PARTY.xml',<br>+ '-i' : '127.0.0.1',<br>+ '-p' : '6060',<br>+ '-s' : '3228080970',<br>+ '-d' : '35000',<br>+ '-message_file' : sippA_logfile,<br>+ '-error_file' : sippA_errfile,<br>+ '-trace_msg' : '-trace_err',<br>+ }<br>+]<br>+<br>+<br>+def main():<br>+ test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)<br>+ test.reactor_timeout = 70;<br>+<br>+ reactor.run()<br>+<br>+ if not test.passed:<br>+ return 1<br>+<br>+ return 0<br>+<br>+<br>+if __name__ == "__main__":<br>+ sys.exit(main())<br>+<br>+<br>+# vim:sw=4:ts=4:expandtab:textwidth=79<br>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/A_PARTY.xml b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/A_PARTY.xml<br>new file mode 100644<br>index 0000000..c77cfe1<br>--- /dev/null<br>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/A_PARTY.xml<br>@@ -0,0 +1,141 @@<br>+<?xml version="1.0" encoding="ISO-8859-1"?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<!-- This program is free software; you can redistribute it and/or --><br>+<!-- modify it under the terms of the GNU General Public License as --><br>+<!-- published by the Free Software Foundation; either version 2 of the --><br>+<!-- License, or (at your option) any later version. --><br>+<!-- --><br>+<!-- This program is distributed in the hope that it will be useful, --><br>+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of --><br>+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --><br>+<!-- GNU General Public License for more details. --><br>+<!-- --><br>+<!-- You should have received a copy of the GNU General Public License --><br>+<!-- along with this program; if not, write to the --><br>+<!-- Free Software Foundation, Inc., --><br>+<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --><br>+<!-- --><br>+<!-- Sipp 'uac' scenario with pcap (rtp) play --><br>+<!-- --><br>+<scenario name="DTMF_INFO_FORCE"><br>+ <!-- In client mode (sipp placing calls), the Call-ID MUST be --><br>+ <!-- generated by sipp. To do so, use [call_id] keyword. --><br>+ <send retrans="500"><br>+ <![CDATA[<br>+<br>+ INVITE sip:[service]@voxbone.com SIP/2.0<br>+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+ From: sipp <sip:test@voxbone.com>;tag=[call_number]<br>+ To: sut <sip:[service]@voxbone.com:[remote_port]><br>+ Call-ID: [call_id]<br>+ CSeq: 1 INVITE<br>+ Contact: sip:sipp@[local_ip]:[local_port]<br>+ Max-Forwards: 70<br>+ Subject: Performance Test<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[local_ip_type] [local_ip]<br>+ t=0 0<br>+ m=audio 9000 RTP/AVP 0 101<br>+ a=rtpmap:0 PCMU/8000<br>+ a=rtpmap:101 telephone-event/8000<br>+ a=fmtp:101 0-15<br>+<br>+ ]]><br>+ </send><br>+<br>+ <recv response="100" optional="true"><br>+ </recv><br>+<br>+ <recv response="180" optional="true"><br>+ </recv><br>+<br>+ <!-- By adding rrs="true" (Record Route Sets), the route sets --><br>+ <!-- are saved and used for following messages sent. Useful to test --><br>+ <!-- against stateful SIP proxies/B2BUAs. --><br>+ <recv response="200" rtd="true" crlf="true"><br>+ </recv><br>+<br>+<br>+ <!-- Packet lost can be simulated in any send/recv message by --><br>+ <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. --><br>+ <send><br>+ <![CDATA[<br>+<br>+ ACK sip:[service]@voxbone.com SIP/2.0<br>+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+ From: sipp <sip:test@[local_ip]:[local_port]>;tag=[call_number]<br>+ To: sut <sip:[service]@voxbone.com>[peer_tag_param]<br>+ Call-ID: [call_id]<br>+ CSeq: 1 ACK<br>+ Contact: sip:sipp@[local_ip]:[local_port]<br>+ Max-Forwards: 70<br>+ Subject: Performance Test<br>+ Content-Length: 0<br>+<br>+ ]]><br>+ </send><br>+<br>+<!-- Receive the DIGIT 4--><br>+<recv request="INFO"> <br>+ <action><br>+ <ereg regexp="(Signal=4)" search_in="body" check_it="true" assign_to = "1" /><br>+ <log message="---DTMF--- [$1]"/><br>+ </action><br>+</recv> <br>+ <br>+<br>+<send> <br>+<![CDATA[ <br>+ <br>+SIP/2.0 200 OK <br>+[last_Via:] <br>+[last_From:] <br>+[last_To:] <br>+[last_Call-ID:] <br>+[last_CSeq:] <br>+Content-Length: 0 <br>+ <br>+]]> <br>+</send> <br>+<br>+<br>+ <pause milliseconds="7000"/><br>+<br>+ <!-- The 'crlf' option inserts a blank line in the statistics report. --><br>+ <send retrans="500"><br>+ <![CDATA[<br>+<br>+ BYE sip:[service]@voxbone.com SIP/2.0<br>+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+ From: sipp <sip:test@[local_ip]:[local_port]>;tag=[call_number]<br>+ To: sut <sip:[service]@voxbone.com>[peer_tag_param]<br>+ Call-ID: [call_id]<br>+ CSeq: 2 BYE<br>+ Contact: sip:sipp@[local_ip]:[local_port]<br>+ Max-Forwards: 70<br>+ Subject: Performance Test<br>+ Content-Length: 0<br>+<br>+ ]]><br>+ </send><br>+<br>+ <recv response="200" crlf="true"><br>+ </recv><br>+<br>+ <!-- Keep the call open for a while in case the 200 is lost to be --><br>+ <!-- able to retransmit it if we receive the BYE again. --><br>+ <pause milliseconds="3000"/><br>+<br>+<br>+ <!-- definition of the response time repartition table (unit is ms) --><br>+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/><br>+<br>+ <!-- definition of the call length repartition table (unit is ms) --><br>+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/><br>+<br>+</scenario><br>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/B_PARTY.xml b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/B_PARTY.xml<br>new file mode 100644<br>index 0000000..829efbd<br>--- /dev/null<br>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/B_PARTY.xml<br>@@ -0,0 +1,94 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="DTMF Handling"><br>+<br>+<recv request="INVITE" crlf="true"><br>+</recv><br>+<br>+<br>+<br>+<send><br>+<![CDATA[<br>+<br>+SIP/2.0 100 Trying<br>+[last_Via:]<br>+[last_Call-ID:]<br>+[last_From:]<br>+[last_To:]<br>+[last_CSeq:]<br>+Content-Length: 0<br>+<br>+]]><br>+</send><br>+<br>+<br>+<send retrans="500"><br>+<![CDATA[<br>+<br>+SIP/2.0 200 OK<br>+[last_Via:]<br>+[last_Call-ID:]<br>+[last_From:]<br>+[last_To:];tag=[call_number]<br>+[last_CSeq:]<br>+Contact: <sip:736596371553211257@[local_ip]:[local_port];user=phone><br>+Content-Type: application/sdp<br>+Content-Length: [len]<br>+<br>+v=0<br>+o=HuaweiSoftX3000 6644052 6644052 IN IP[local_ip_type] [local_ip]<br>+s=Sip Call<br>+c=IN IP[local_ip_type] [local_ip]<br>+t=0 0<br>+m=audio 8000 RTP/AVP 0<br>+a=rtpmap:0 PCMU/8000<br>+<br>+]]><br>+</send><br>+<br>+<br>+<recv request="ACK"<br>+ rtd="true"<br>+ crlf="true"><br>+<br>+</recv><br>+<br>+ <!-- Play a PCAP which sends the RTPEVENT packet containing DTMF 4 --><br>+ <nop><br>+ <action><br>+ <exec play_pcap_audio="./tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/sipp/dtmf_2833_4.pcap"/><br>+ </action><br>+ </nop><br>+<br>+<recv request="BYE"> <br>+</recv> <br>+ <br>+<send> <br>+<![CDATA[ <br>+ <br>+SIP/2.0 200 OK <br>+[last_Via:] <br>+[last_From:] <br>+[last_To:] <br>+[last_Call-ID:] <br>+[last_CSeq:] <br>+Content-Length: 0 <br>+ <br>+]]> <br>+</send> <br>+<br>+<br>+<!-- Keep the call open for a while in case the 200 is lost to be --><br>+<!-- able to retransmit it if we receive the BYE again. --><br>+<pause milliseconds="3000"/><br>+<br>+<br>+<!-- definition of the response time repartition table (unit is ms) --><br>+<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/><br>+<br>+<!-- definition of the call length repartition table (unit is ms) --><br>+<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/><br>+<br>+</scenario><br>+<br>diff --git a/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/test-config.yaml b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/test-config.yaml<br>new file mode 100644<br>index 0000000..2e33c94<br>--- /dev/null<br>+++ b/tests/channels/pjsip/dialplan_functions/pjsip_dtmfmode/test-config.yaml<br>@@ -0,0 +1,11 @@<br>+testinfo:<br>+ summary: 'This test case verifies the DTMF INFO is useds used if requested by the dialplan with PJSIPDtmfMode'<br>+ description: |<br>+ 'The carrier leg is AUTO & negotiates RFC2833. Dialplan switches the dtmf mode to INFO, verify that carrier leg receives DTMF Info'<br>+<br>+properties:<br>+ minversion: '13'<br>+ dependencies:<br>+ - app : 'sipp'<br>+ tags:<br>+ - SIP<br>diff --git a/tests/channels/pjsip/dialplan_functions/tests.yaml b/tests/channels/pjsip/dialplan_functions/tests.yaml<br>index 1aed251..f653aa8 100644<br>--- a/tests/channels/pjsip/dialplan_functions/tests.yaml<br>+++ b/tests/channels/pjsip/dialplan_functions/tests.yaml<br>@@ -7,3 +7,4 @@<br> - test: 'pjsip_session_refresh'<br> - test: 'chan_is_avail'<br> - test: 'pjsip_header'<br>+ - test: 'pjsip_dtmfmode'<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5910">change 5910</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/5910"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8ae7d73aedc42533512adf7b96ed0eab8e09ad8c </div>
<div style="display:none"> Gerrit-Change-Number: 5910 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Torrey Searle <tsearle@gmail.com> </div>