[Asterisk-code-review] testsuite: 488 of T38 reinvite falls back to G711 (testsuite[16])

Robert Cripps asteriskteam at digium.com
Tue Dec 22 07:06:03 CST 2020


Robert Cripps has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/15231 )


Change subject: testsuite: 488 of T38 reinvite falls back to G711
......................................................................

testsuite: 488 of T38 reinvite falls back to G711

Test that a 488 to a T38 reinvite followed by a
G711 reinvite results in a G711 call. This is
for either leg of the call and the subsequent
G711 reinvite is 200 OK'd by astrerisk.

ASTERISK-29220 #close

Change-Id: I5d26b17c5c712a800c14264fd72da6e3564dee8a
---
A tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/extensions.conf
A tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/pjsip.conf
A tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/sip.conf
A tests/t38_enabled_two_reinvite_on_a_leg/run-test
A tests/t38_enabled_two_reinvite_on_a_leg/sipp/A_PARTY.xml
A tests/t38_enabled_two_reinvite_on_a_leg/sipp/B_PARTY.xml
A tests/t38_enabled_two_reinvite_on_a_leg/sipp/CARRIER_G711U.pcap
A tests/t38_enabled_two_reinvite_on_a_leg/sipp/CUSTOMER_G711U.pcap
A tests/t38_enabled_two_reinvite_on_a_leg/test-config.yaml
A tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/extensions.conf
A tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/pjsip.conf
A tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/sip.conf
A tests/t38_enabled_two_reinvite_on_b_leg/run-test
A tests/t38_enabled_two_reinvite_on_b_leg/sipp/A_PARTY.xml
A tests/t38_enabled_two_reinvite_on_b_leg/sipp/B_PARTY.xml
A tests/t38_enabled_two_reinvite_on_b_leg/sipp/CARRIER_G711U.pcap
A tests/t38_enabled_two_reinvite_on_b_leg/sipp/CUSTOMER_G711U.pcap
A tests/t38_enabled_two_reinvite_on_b_leg/test-config.yaml
M tests/tests.yaml
19 files changed, 1,175 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/31/15231/1

diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/extensions.conf b/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b29ad89
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[general]
+
+[default]
+exten => 3200000000,1,Dial(PJSIP/sbc)
+exten => 3200000000,2,Hangup()
diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/pjsip.conf b/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..7db6e53
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/pjsip.conf
@@ -0,0 +1,53 @@
+[global]
+type = global
+user_agent = 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;g729
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = PEER_A
+t38_udptl = yes
+t38_udptl_ec = none
+
+[sbc]
+type = aor
+contact = sip:127.0.0.1:5700
+
+[sbc]
+type = endpoint
+context = callcontrol
+dtmf_mode = rfc4733
+disallow = all
+allow = ulaw;g729
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = sbc
+t38_udptl = yes 
+t38_udptl_ec = none
diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/sip.conf b/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/sip.conf
new file mode 100644
index 0000000..85f3d79
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/configs/ast1/sip.conf
@@ -0,0 +1,59 @@
+[general]
+sipdebug=yes
+udpbindaddr=[::]:5060
+tcpenable=no
+tlsenable=no
+transport=udp
+canreinvite=no
+nat=no
+srvlookup=yes
+context=block
+pedantic=yes
+dtmfmode=rfc2833
+realm=voxbone.com
+useragent=Vox Callcontrol
+promiscredir=yes
+disallow=all
+allow=alaw
+allow=ulaw
+allow=g729
+allow=h263p
+allow=h264
+rtcachefriends=yes
+rtautoclear=86400
+sendrpid=yes
+videosupport=yes
+maxcallbitrate=20
+relaxdtmf=yes
+t38pt_udptl=yes,redundancy
+sdpsession=session
+ignoresdpversion=yes
+use_q850_reason=yes
+dtlsverify= no
+dtlsrekey= 300
+dtlscipher=ALL
+dtlscertfile= /etc/asterisk/keys/asterisk.crt
+dtlsprivatekey= /etc/asterisk/keys/asterisk.key
+
+[PEER_A]
+type = peer
+host = 127.0.0.1
+port=5061
+context=default
+t38pt_udptl = yes
+allow = ulaw
+allow = g729
+dtmfmode = rfc2833
+insecure = invite
+
+[sbc]
+host=127.0.0.1
+port=5700
+type=peer
+insecure=invite
+context=callcontrol
+canreinvite=no
+allow = ulaw
+allow = g729
+dtmfmode = rfc2833
+t38pt_udptl = no
diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/run-test b/tests/t38_enabled_two_reinvite_on_a_leg/run-test
new file mode 100755
index 0000000..8651d94
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/run-test
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+# vim: sw=3 et:
+'''
+Copyright (C) 2011, Digium, Inc.
+Matthew Nicholson <mnicholson 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 re
+import shutil
+import logging
+import signal
+import subprocess
+import time
+
+from twisted.internet import reactor
+
+sys.path.append("lib/python")
+sys.path.append("utils")
+from asterisk.asterisk import Asterisk
+from asterisk.sipp import SIPpTest
+
+logger = logging.getLogger(__name__)
+WORKING_DIR = os.path.abspath(os.path.dirname(__file__))
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+
+e164 = "3200000000"
+sippA_logfile = WORKING_DIR + "/A_PARTY.log"
+sippA_errfile = WORKING_DIR + "/A_PARTY_ERR.log"
+sippA_statfile = WORKING_DIR + "/A_PARTY_STAT.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',
+        '-message_file' : sippB_logfile,
+        '-error_file' : sippB_errfile,
+        '-trace_msg' : '-trace_err',
+    },
+    {
+        'scenario' : 'A_PARTY.xml',
+        '-i' : '127.0.0.1',
+        '-p' : '5061',
+        '-s' : e164,
+        '-message_file' : sippA_logfile,
+        '-error_file' : sippA_errfile,
+        '-trace_msg' : '-trace_err',
+        '-trace_stat' : '-trace_stat',
+        '-stf' : sippA_statfile,
+    }
+]
+
+def main():
+    test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
+    logger.info ("Running against asterisk version %s" %test.ast_version)
+		   
+    test.reactor_timeout = 100;
+
+    dump_A = WORKING_DIR + "/carrier_rtp.log"
+    dump_B = WORKING_DIR + "/customer_rtp.log"
+    rtpdump_A = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-d","101","-o",dump_A, "127.0.0.1/9000"])
+    rtpdump_B = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-d","101","-o",dump_B, "127.0.0.1/8000"])
+
+    #Run the agi_load_balance_emulator
+    agiLoadBalancer = subprocess.Popen(["perl","utils/agi_load_balance_emulator.pl"])
+
+    #Run the vcc_emulator
+    vcc_emulator = voxcallcontrol.start_emulator(WORKING_DIR, "sbc")
+
+    time.sleep(10) #Wait 10 seconds to ensure that all the sockets are open before running the test	
+
+    reactor.run()
+
+    # Kill the RTPDUMP, pass it the signal"
+    rtpdump_A.send_signal(signal.SIGINT)	
+    rtpdump_A.wait()
+    rtpdump_B.send_signal(signal.SIGINT)	
+    rtpdump_B.wait()
+
+    #Verify that audio packets were routed in both directions after G711 fallback
+    if (os.path.getsize(dump_B) == 0):
+        logger.error("No RTP routed towards customer ...failing the test")
+        return 1
+    if (os.path.getsize(dump_A) == 0):
+        logger.error("No RTP routed towards carrier ...failing the test")
+        return 1
+
+    if not test.passed:
+        return 1
+
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main() or 0)
+
diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/sipp/A_PARTY.xml b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/A_PARTY.xml
new file mode 100644
index 0000000..12b0d8f
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/A_PARTY.xml
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="T38 REINVTE">
+<send retrans="500">
+<![CDATA[
+
+INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+From: <sip:390415094280@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+To: <sip:[service]@[remote_ip]:[remote_port]>
+Call-ID: [call_id]
+X-VCC-UUID: [pid][clock_tick][call_number]
+X-VCC-Provider: 61 [local_ip] BEL
+Supported: rel1xx,timer,replaces
+Min-SE:  181
+User-Agent: Cisco-SIPGateway/IOS-12.x
+Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
+CSeq: 101 INVITE
+Max-Forwards: 69
+Contact: <sip:390415094280@[local_ip]:[local_port]>
+Expires: 180
+Allow-Events: telephone-event
+Content-Type: application/sdp
+Content-Length: [len]
+      
+v=0
+o=CiscoSystemsSIP-GW-UserAgent 9624 5279 IN IP4 [local_ip]
+s=SIP Call
+c=IN IP4 [media_ip]
+t=0 0
+m=audio 9000 RTP/AVP 0 18 101
+c=IN IP[local_ip_type] [local_ip]
+a=rtpmap:101 telephone-event/101
+
+]]>
+</send>
+
+<recv response="100">
+</recv>
+
+<recv response="100" optional="true">
+</recv>
+
+<recv response="100" optional="true">
+</recv>
+
+<recv response="180" optional="true">
+</recv>
+<recv response="183" optional="true">
+</recv>
+
+<recv response="200" 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" />
+    	<log message="Log to avoid the problem of not using $6 [$6]"/>
+   </action>
+</recv>
+
+<send>
+<![CDATA[
+
+ACK [next_url] SIP/2.0
+[routes]
+Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+From: [$2]
+To: [$3]
+Call-ID: [call_id]
+Max-Forwards: 69
+CSeq: 101 ACK
+Content-Length: [len]
+
+]]>
+</send>
+
+
+<pause milliseconds="2000"/>
+
+<send retrans="500">
+
+<![CDATA[
+
+INVITE [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+From: [$2]
+To: [$3]
+Call-ID: [call_id]
+CSeq: 102 INVITE
+Contact: <sip:[local_ip]:[local_port]>
+Max-Forwards: 70
+Content-Type: application/sdp
+[routes]
+Allow-Events: telephone-event
+Content-Length: [len] 
+
+v=0
+o=CiscoSystemsSIP-GW-UserAgent 9624 5280 IN IP4 [local_ip]
+s=Asterisk PBX 1.6.2.0
+c=IN IP[local_ip_type] [local_ip]
+t=0 0
+m=image 4389 udptl t38
+a=T38FaxVersion:0
+a=T38MaxBitRate:14400
+a=T38FaxRateManagement:transferredTCF
+a=T38FaxMaxDatagram:1400
+a=T38FaxUdpEC:t38UDPRedundancy
+
+]]>
+
+</send>
+
+<recv response="100" optional="true">
+</recv>
+  
+<recv response="488" rrs="true">
+</recv>
+
+
+<send>
+<![CDATA[
+
+ACK [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+[last_Call-ID:]
+[last_From]
+[last_To]
+CSeq: 102 ACK
+Max-Forwards: 70
+[routes]
+Content-Length: 0
+
+
+]]>
+</send>
+
+<pause milliseconds="2000"/>
+
+<send retrans="500">
+
+<![CDATA[
+
+INVITE [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+[last_Call-ID:]
+From: [$2]
+To: [$3]
+CSeq: 103 INVITE
+Contact: <sip:[local_ip]:[local_port]>
+Max-Forwards: 70
+Content-Type: application/sdp
+[routes]
+Allow-Events: telephone-event
+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 9000 RTP/AVP 0 18 101
+c=IN IP[local_ip_type] [local_ip]
+a=rtpmap:101 telephone-event/101
+
+
+]]>
+
+</send>
+
+<recv response="100" optional="true">
+</recv>
+  
+<recv response="200" rrs="true">
+</recv>
+
+<send>
+<![CDATA[
+
+ACK [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+[last_Call-ID:]
+[last_From]
+[last_To]
+CSeq: 103 ACK
+Max-Forwards: 70
+[routes]
+Content-Length: 0
+
+
+]]>
+
+</send>
+
+<pause milliseconds="2000" />
+
+<nop>
+  <action>
+    <exec play_pcap_audio="./tests/channels/SIP/ASTERISK_T38_ENABLED_TWO_REINVITE_FROM_CARRIER/sipp/CARRIER_G711U.pcap"/>
+  </action>
+</nop>
+
+<pause milliseconds="50000" />
+  
+<send retrans="500">
+<![CDATA[
+
+BYE [$1] SIP/2.0
+Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+To: [$3]
+From: [$2]
+[last_Call-ID:]
+User-Agent: Cisco-SIPGateway/IOS-12.x
+Max-Forwards: 69
+CSeq: 104 BYE
+Content-Length: 0
+
+]]>
+</send>
+
+<recv response="200">
+</recv>
+
+
+</scenario>
+
diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/sipp/B_PARTY.xml b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/B_PARTY.xml
new file mode 100644
index 0000000..432bb74
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/B_PARTY.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="T38 REINVITE">
+
+<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" />
+  <log message="Log to avoid the problem of not using $3 [$3]"/>
+  <log message="Log to avoid the problem of not using $1 [$1]"/>
+  <log message="Log to avoid the problem of not using $2 [$2]"/>
+  <log message="Log to avoid the problem of not using $6 [$6]"/>
+</action>
+</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:]
+[last_Record-Route]
+Contact: <sip:bansallaptop@[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[media_ip_type] [media_ip]
+t=0 0
+m=audio 8000 RTP/AVP 0 100 101
+a=rtpmap:0 PCMU/8000
+a=rtpmap:100 NSE/8000
+a=rtpmap:101 telephone-event/101
+
+]]>
+</send>
+
+<recv request="ACK"
+      rtd="true"
+      crlf="true">
+</recv>
+
+<pause milliseconds="500" />
+
+<!-- play the pcap now as packets will get through before the reinvite
+     After the reinvite B leg sending fails because sipp changes destination port to suit the reinvite port which is incorrect
+     for the original call that was negotiated
+     After the reinvite the packets get destination port unreachable.
+     All the A leg packets get through because asterisk behave correctly
+     -->
+<nop>
+  <action>
+    <exec play_pcap_audio="./tests/channels/SIP/ASTERISK_T38_ENABLED_TWO_REINVITE_FROM_CARRIER/sipp/CUSTOMER_G711U.pcap"/>
+  </action>
+</nop>
+
+<recv request="INVITE" crlf="true"  rrs="true">
+</recv>
+
+<pause milliseconds="200" />
+
+<send retrans="500">
+<![CDATA[
+
+SIP/2.0 488 Not Acceptable Here
+[last_Via:]
+[last_To:]
+[last_From:]
+[last_Call-ID:]
+[last_Cseq:] 
+Contact: <sip:390415094280@[local_ip]:[local_port]>
+User-Agent: Cisco-SIPGateway/IOS-12.x
+Max-Forwards: 69
+Content-Length: 0
+
+]]>
+</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:]
+Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+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"/>
+
+
+<!-- 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/t38_enabled_two_reinvite_on_a_leg/sipp/CARRIER_G711U.pcap b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/CARRIER_G711U.pcap
new file mode 100644
index 0000000..986a449
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/CARRIER_G711U.pcap
Binary files differ
diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/sipp/CUSTOMER_G711U.pcap b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/CUSTOMER_G711U.pcap
new file mode 100644
index 0000000..464426f
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/sipp/CUSTOMER_G711U.pcap
Binary files differ
diff --git a/tests/t38_enabled_two_reinvite_on_a_leg/test-config.yaml b/tests/t38_enabled_two_reinvite_on_a_leg/test-config.yaml
new file mode 100644
index 0000000..abd9400
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_a_leg/test-config.yaml
@@ -0,0 +1,13 @@
+testinfo:
+    summary: 'Test that asterisk does not drop the call after it rejects the T38 reinvite from the carrier side because customer does not suport it and and continues to forward the audio packets after fallback to G711'
+    description: |
+        'Test that asterisk does not drop the call after it rejects the T38 reinvite from the carrier side because customer does not suport it and and continues to forward the audio packets after fallback to G711'
+
+properties:
+    minversion: '1.4'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+
+    tags:
+        - SIP
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/extensions.conf b/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b29ad89
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[general]
+
+[default]
+exten => 3200000000,1,Dial(PJSIP/sbc)
+exten => 3200000000,2,Hangup()
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/pjsip.conf b/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..7db6e53
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/pjsip.conf
@@ -0,0 +1,53 @@
+[global]
+type = global
+user_agent = 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;g729
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = PEER_A
+t38_udptl = yes
+t38_udptl_ec = none
+
+[sbc]
+type = aor
+contact = sip:127.0.0.1:5700
+
+[sbc]
+type = endpoint
+context = callcontrol
+dtmf_mode = rfc4733
+disallow = all
+allow = ulaw;g729
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = sbc
+t38_udptl = yes 
+t38_udptl_ec = none
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/sip.conf b/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/sip.conf
new file mode 100644
index 0000000..85f3d79
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/configs/ast1/sip.conf
@@ -0,0 +1,59 @@
+[general]
+sipdebug=yes
+udpbindaddr=[::]:5060
+tcpenable=no
+tlsenable=no
+transport=udp
+canreinvite=no
+nat=no
+srvlookup=yes
+context=block
+pedantic=yes
+dtmfmode=rfc2833
+realm=voxbone.com
+useragent=Vox Callcontrol
+promiscredir=yes
+disallow=all
+allow=alaw
+allow=ulaw
+allow=g729
+allow=h263p
+allow=h264
+rtcachefriends=yes
+rtautoclear=86400
+sendrpid=yes
+videosupport=yes
+maxcallbitrate=20
+relaxdtmf=yes
+t38pt_udptl=yes,redundancy
+sdpsession=session
+ignoresdpversion=yes
+use_q850_reason=yes
+dtlsverify= no
+dtlsrekey= 300
+dtlscipher=ALL
+dtlscertfile= /etc/asterisk/keys/asterisk.crt
+dtlsprivatekey= /etc/asterisk/keys/asterisk.key
+
+[PEER_A]
+type = peer
+host = 127.0.0.1
+port=5061
+context=default
+t38pt_udptl = yes
+allow = ulaw
+allow = g729
+dtmfmode = rfc2833
+insecure = invite
+
+[sbc]
+host=127.0.0.1
+port=5700
+type=peer
+insecure=invite
+context=callcontrol
+canreinvite=no
+allow = ulaw
+allow = g729
+dtmfmode = rfc2833
+t38pt_udptl = no
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/run-test b/tests/t38_enabled_two_reinvite_on_b_leg/run-test
new file mode 100755
index 0000000..204c99b
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/run-test
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# vim: sw=3 et:
+'''
+Copyright (C) 2011, Digium, Inc.
+Matthew Nicholson <mnicholson 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 re
+import shutil
+import logging
+import signal
+import subprocess
+import time
+
+from twisted.internet import reactor
+
+sys.path.append("lib/python")
+sys.path.append("utils")
+from asterisk.asterisk import Asterisk
+from asterisk.sipp import SIPpTest
+
+logger = logging.getLogger(__name__)
+WORKING_DIR = os.path.abspath(os.path.dirname(__file__))
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+
+e164 = "3200000000"
+sippA_logfile = WORKING_DIR + "/A_PARTY.log"
+sippA_errfile = WORKING_DIR + "/A_PARTY_ERR.log"
+sippA_statfile = WORKING_DIR + "/A_PARTY_STAT.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',
+        '-message_file' : sippB_logfile,
+        '-error_file' : sippB_errfile,
+        '-trace_msg' : '-trace_err',
+    },
+    {
+        'scenario' : 'A_PARTY.xml',
+        '-i' : '127.0.0.1',
+        '-p' : '5061',
+        '-s' : e164,
+        '-message_file' : sippA_logfile,
+        '-error_file' : sippA_errfile,
+        '-trace_msg' : '-trace_err',
+        '-trace_stat' : '-trace_stat',
+        '-stf' : sippA_statfile,
+    }
+]
+
+def main():
+    test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
+    logger.info ("Running against asterisk version %s" %test.ast_version)
+		   
+    test.reactor_timeout = 100;
+
+    dump_A = WORKING_DIR + "/carrier_rtp.log"
+    dump_B = WORKING_DIR + "/customer_rtp.log"
+    rtpdump_A = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-d","101","-o",dump_A, "127.0.0.1/9000"])
+    rtpdump_B = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-d","101","-o",dump_B, "127.0.0.1/8000"])
+
+    time.sleep(10) #Wait 10 seconds to ensure that all the sockets are open before running the test	
+
+    reactor.run()
+
+    # Kill the RTPDUMP, pass it the signal"
+    rtpdump_A.send_signal(signal.SIGINT)	
+    rtpdump_A.wait()
+    rtpdump_B.send_signal(signal.SIGINT)	
+    rtpdump_B.wait()
+
+    #Verify that audio packets were routed in both directions after G711 fallback
+    if (os.path.getsize(dump_B) == 0):
+        logger.error("No RTP routed towards customer ...failing the test")
+        return 1
+    if (os.path.getsize(dump_A) == 0):
+        logger.error("No RTP routed towards carrier ...failing the test")
+        return 1
+
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main() or 0)
+
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/sipp/A_PARTY.xml b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/A_PARTY.xml
new file mode 100644
index 0000000..98e6afb
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/A_PARTY.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="T38 REINVTE">
+<send retrans="500">
+<![CDATA[
+
+INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+From: <sip:390415094280@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+To: <sip:[service]@[remote_ip]:[remote_port]>
+Call-ID: [call_id]
+X-VCC-UUID: [pid][clock_tick][call_number]
+X-VCC-Provider: 61 [local_ip] BEL
+Supported: rel1xx,timer,replaces
+Min-SE:  181
+User-Agent: Cisco-SIPGateway/IOS-12.x
+Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
+CSeq: 101 INVITE
+Max-Forwards: 69
+Contact: <sip:390415094280@[local_ip]:[local_port]>
+Expires: 180
+Allow-Events: telephone-event
+Content-Type: application/sdp
+Content-Length: [len]
+      
+v=0
+o=CiscoSystemsSIP-GW-UserAgent 9624 5279 IN IP4 [local_ip]
+s=SIP Call
+c=IN IP4 [media_ip]
+t=0 0
+m=audio 9000 RTP/AVP 0 101
+c=IN IP[local_ip_type] [local_ip]
+a=rtpmap:101 telephone-event/101
+a=rtpmap:8 PCMU/8000
+
+
+]]>
+</send>
+
+<recv response="100">
+</recv>
+
+<recv response="100" optional="true">
+</recv>
+
+<recv response="100" optional="true">
+</recv>
+
+<recv response="180" optional="true">
+</recv>
+<recv response="183" optional="true">
+</recv>
+
+<recv response="200" 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" />
+   	<log message="Log to avoid the problem of not using $6 [$6]"/>
+   </action>
+</recv>
+
+<send>
+<![CDATA[
+
+ACK [next_url] SIP/2.0
+[routes]
+Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+From: [$2]
+To: [$3]
+Call-ID: [call_id]
+Max-Forwards: 69
+CSeq: 101 ACK
+Content-Length: [len]
+
+]]>
+</send>
+
+  <!-- play the pcap now as some of it will get through before sipp screws up and takes the media port from the reinvite which this leg 488's -->  
+<nop>
+  <action>
+    <exec play_pcap_audio="./tests/channels/SIP/ASTERISK_T38_ENABLED_TWO_REINVITE_FROM_CUSTOMER/sipp/CARRIER_G711U.pcap"/>
+  </action>
+</nop>
+
+<recv request="INVITE" crlf="true"  rrs="true">
+</recv>
+
+<pause milliseconds="200" />
+
+<send retrans="500">
+<![CDATA[
+
+SIP/2.0 488 Not Acceptable Here
+[last_Via:]
+[last_To:]
+[last_From:]
+[last_Call-ID:]
+[last_Cseq:] 
+Contact: <sip:390415094280@[local_ip]:[local_port]>
+User-Agent: Cisco-SIPGateway/IOS-12.x
+Max-Forwards: 69
+Content-Length: 0
+
+]]>
+</send>
+
+<recv request="ACK"
+      rtd="true"
+      crlf="true">
+</recv>
+
+<!-- allow data from B Leg to play-->
+<pause milliseconds="50000" />
+
+<send retrans="500">
+<![CDATA[
+
+BYE [$1] SIP/2.0
+Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+To: [$3]
+From: [$2]
+[last_Call-ID:]
+User-Agent: Cisco-SIPGateway/IOS-12.x
+Max-Forwards: 69
+CSeq: 102 BYE
+Content-Length: 0
+
+]]>
+</send>
+
+<recv response="200">
+</recv>
+
+</scenario>
+
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/sipp/B_PARTY.xml b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/B_PARTY.xml
new file mode 100644
index 0000000..cd0696f
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/B_PARTY.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="T38 REINVITE">
+
+<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" />
+  <log message="Log to avoid the problem of not using $3 [$3]"/>
+  <log message="Log to avoid the problem of not using $1 [$1]"/>
+  <log message="Log to avoid the problem of not using $2 [$2]"/>
+  <log message="Log to avoid the problem of not using $6 [$6]"/>
+</action>
+</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:]
+[last_Record-Route]
+Contact: <sip:bansallaptop@[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[media_ip_type] [media_ip]
+t=0 0
+m=audio 8000 RTP/AVP 0 100 101
+a=rtpmap:0 PCMU/8000
+a=rtpmap:100 NSE/8000
+a=rtpmap:101 telephone-event/101
+
+]]>
+</send>
+
+<recv request="ACK"
+      rtd="true"
+      crlf="true">
+</recv>
+
+<!-- REINVITE sequence -->
+
+<pause milliseconds="2000"/>
+
+<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=1
+To: [$2]
+CSeq: 1 INVITE
+Contact: <sip:[local_ip]:[local_port]>
+Max-Forwards: 70
+Content-Type: application/sdp
+[routes]
+Allow-Events: telephone-event
+Content-Length: [len] 
+
+v=0
+o=CiscoSystemsSIP-GW-UserAgent 9624 5280 IN IP4 [local_ip]
+s=Asterisk PBX 1.6.2.0
+c=IN IP[local_ip_type] [local_ip]
+t=0 0
+m=image 4389 udptl t38
+a=T38FaxVersion:0
+a=T38MaxBitRate:14400
+a=T38FaxRateManagement:transferredTCF
+a=T38FaxMaxDatagram:1400
+a=T38FaxUdpEC:t38UDPRedundancy
+
+]]>
+</send>
+
+<recv response="100" optional="true">
+</recv>
+  
+<recv response="488" rrs="true">
+</recv>
+
+<send>
+<![CDATA[
+
+ACK [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+[last_Call-ID:]
+[last_From]
+[last_To]
+CSeq: 1 ACK
+Max-Forwards: 70
+[routes]
+Content-Length: 0
+
+
+]]>
+</send>
+
+<pause milliseconds="2000"/>
+
+<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=1
+To: [$2]
+CSeq: 2 INVITE
+Contact: <sip:[local_ip]:[local_port]>
+Max-Forwards: 70
+Content-Type: application/sdp
+[routes]
+Allow-Events: telephone-event
+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 8000 RTP/AVP 0 100 101
+a=rtpmap:0 PCMU/8000
+a=rtpmap:100 NSE/8000
+a=rtpmap:101 telephone-event/101
+
+
+]]>
+</send>
+
+<recv response="100" optional="true">
+</recv>
+  
+<recv response="200" rrs="true">
+</recv>
+
+<send>
+<![CDATA[
+
+ACK [$1] SIP/2.0
+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+[last_Call-ID:]
+[last_From]
+[last_To]
+CSeq: 2 ACK
+Max-Forwards: 70
+[routes]
+Content-Length: 0
+
+
+]]>
+</send>
+
+<!-- Play a pre-recorded PCAP file (RTP stream)                       -->
+<nop>
+    <action>
+      <exec play_pcap_audio="./tests/channels/SIP/ASTERISK_T38_ENABLED_TWO_REINVITE_FROM_CUSTOMER/sipp/CUSTOMER_G711U.pcap"/>
+    </action>
+</nop>
+
+
+<recv request="BYE">
+</recv>
+
+<send>
+<![CDATA[
+
+SIP/2.0 200 OK
+[last_Via:]
+[last_From:]
+[last_To:]
+[last_Call-ID:]
+[last_CSeq:]
+Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+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"/>
+
+
+<!-- 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/t38_enabled_two_reinvite_on_b_leg/sipp/CARRIER_G711U.pcap b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/CARRIER_G711U.pcap
new file mode 100644
index 0000000..986a449
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/CARRIER_G711U.pcap
Binary files differ
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/sipp/CUSTOMER_G711U.pcap b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/CUSTOMER_G711U.pcap
new file mode 100644
index 0000000..464426f
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/sipp/CUSTOMER_G711U.pcap
Binary files differ
diff --git a/tests/t38_enabled_two_reinvite_on_b_leg/test-config.yaml b/tests/t38_enabled_two_reinvite_on_b_leg/test-config.yaml
new file mode 100644
index 0000000..abd9400
--- /dev/null
+++ b/tests/t38_enabled_two_reinvite_on_b_leg/test-config.yaml
@@ -0,0 +1,13 @@
+testinfo:
+    summary: 'Test that asterisk does not drop the call after it rejects the T38 reinvite from the carrier side because customer does not suport it and and continues to forward the audio packets after fallback to G711'
+    description: |
+        'Test that asterisk does not drop the call after it rejects the T38 reinvite from the carrier side because customer does not suport it and and continues to forward the audio packets after fallback to G711'
+
+properties:
+    minversion: '1.4'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+
+    tags:
+        - SIP
diff --git a/tests/tests.yaml b/tests/tests.yaml
index fc5321a..c162f9b 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -37,3 +37,5 @@
     - test: 'remote-test'
     - dir: 'codecs'
     - dir: 'rtp'
+    - test: 't38_enabled_two_reinvite_on_a_leg'
+    - test: 't38_enabled_two_reinvite_on_b_leg'

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

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I5d26b17c5c712a800c14264fd72da6e3564dee8a
Gerrit-Change-Number: 15231
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Cripps <rcripps at voxbone.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201222/1a3936bd/attachment-0001.html>


More information about the asterisk-code-review mailing list