[Asterisk-code-review] testsuite: test fast T.38 reinvite behaviour (testsuite[master])
Torrey Searle
asteriskteam at digium.com
Wed Apr 5 07:35:31 CDT 2017
Torrey Searle has uploaded a new change for review. ( https://gerrit.asterisk.org/5410 )
Change subject: testsuite: test fast T.38 reinvite behaviour
......................................................................
testsuite: test fast T.38 reinvite behaviour
ASTERISK-26923 #close
Change-Id: Icb2d124958dd2b273ca91a771b1e667992e2c103
---
A tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extconfig.conf
A tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extensions.conf
A tests/channels/pjsip/fast_t38_reinvite/configs/ast1/pjsip.conf
A tests/channels/pjsip/fast_t38_reinvite/run-test
A tests/channels/pjsip/fast_t38_reinvite/sipp/A_PARTY.xml
A tests/channels/pjsip/fast_t38_reinvite/sipp/B_PARTY.xml
A tests/channels/pjsip/fast_t38_reinvite/test-config.yaml
M tests/channels/pjsip/tests.yaml
8 files changed, 546 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/10/5410/1
diff --git a/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extconfig.conf b/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extconfig.conf
new file mode 100644
index 0000000..dd6b520
--- /dev/null
+++ b/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extconfig.conf
@@ -0,0 +1 @@
+[settings]
diff --git a/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extensions.conf b/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extensions.conf
new file mode 100644
index 0000000..2f39dbd
--- /dev/null
+++ b/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[general]
+static=yes
+writeprotect=yes
+autofallthrough=yes
+clearglobalvars=no
+priorityjumping=yes
+
+[globals]
+
+[default]
+exten => _X.,1,Dial(PJSIP/${EXTEN}@sbc)
+exten => _X.,n,Hangup()
+
diff --git a/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/pjsip.conf b/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..47c0a80
--- /dev/null
+++ b/tests/channels/pjsip/fast_t38_reinvite/configs/ast1/pjsip.conf
@@ -0,0 +1,92 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+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 = alaw
+allow = ulaw
+allow = g729
+allow = h263p
+allow = h264
+direct_media = no
+send_rpid = yes
+sdp_session = session
+dtls_verify = no
+dtls_rekey = 300
+dtls_cert_file = /etc/asterisk/keys/asterisk.crt
+dtls_private_key = /etc/asterisk/keys/asterisk.key
+dtls_cipher = ALL
+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 = alaw
+allow = ulaw
+allow = g729
+allow = h263p
+allow = h264
+direct_media = no
+send_rpid = yes
+sdp_session = session
+dtls_verify = no
+dtls_rekey = 300
+dtls_cert_file = /etc/asterisk/keys/asterisk.crt
+dtls_private_key = /etc/asterisk/keys/asterisk.key
+dtls_cipher = ALL
+aors = sbc
+t38_udptl = yes
+t38_udptl_ec = none
+
diff --git a/tests/channels/pjsip/fast_t38_reinvite/run-test b/tests/channels/pjsip/fast_t38_reinvite/run-test
new file mode 100755
index 0000000..bd4e80f
--- /dev/null
+++ b/tests/channels/pjsip/fast_t38_reinvite/run-test
@@ -0,0 +1,73 @@
+#!/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 logging
+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__))
+
+logger = logging.getLogger(__name__)
+e164 = "3200000000"
+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',
+ '-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',
+ '-recv_timeout' : '30000',
+ }
+]
+
+def main():
+ test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
+ test.reactor_timeout = 60;
+
+ time.sleep(10) #Wait 10 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/fast_t38_reinvite/sipp/A_PARTY.xml b/tests/channels/pjsip/fast_t38_reinvite/sipp/A_PARTY.xml
new file mode 100644
index 0000000..1edf09a
--- /dev/null
+++ b/tests/channels/pjsip/fast_t38_reinvite/sipp/A_PARTY.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Generated Scenario for 81.201.82.19:5060.xml">
+ <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]
+ Supported: rel1xx,timer,replaces
+ Min-SE: 181
+ Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
+ CSeq: 101 INVITE
+ Max-Forwards: 69
+ Timestamp: 1269264504
+ Contact: <sip:390415094280@[local_ip]:[local_port]>
+ Expires: 180
+ 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 18 8 101
+ c=IN IP[local_ip_type] [local_ip]
+ a=rtpmap:18 G729/8000
+ a=fmtp:18 annexb=yes
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:101 telephone-event/8000
+ a=fmtp:101 0-16
+
+ ]]>
+ </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" rtd="true">
+ </recv>
+
+ <pause milliseconds="3000" />
+
+ <send>
+ <![CDATA[
+
+ ACK [next_url] SIP/2.0
+ [routes]
+ 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]>[peer_tag_param]
+ Call-ID: [call_id]
+ Max-Forwards: 69
+ CSeq: 101 ACK
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <recv request="INVITE" crlf="true">
+ <action>
+ <ereg regexp=".*(m=image).*" search_in="body" check_it="true" assign_to = "6,1" />
+ <log message="Log to avoid the problem of not using $1 [$1]"/>
+ <log message="Log to avoid the problem of not using $6 [$6]"/>
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 100 Giving a try
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Server: OpenSER (1.2.2-notls (x86_64/linux))
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ Server: Cisco-SIPGateway/IOS-12.x
+ [last_CSeq:]
+ Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
+ Supported: replaces
+ Allow-Events: telephone-event
+ Remote-Party-ID: <sip:390415094280 at 83.211.3.171>;party=called;screen=yes;privacy=off
+ Contact: <sip:390415094280@[local_ip]:[local_port]>
+ Record-Route: <sip:81.201.82.19:5060;ftag=as1af3dd89;lr>
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=CiscoSystemsSIP-GW-UserAgent 9624 5279 IN IP4 [local_ip]
+ s=SIP Call
+ c=IN IP[local_ip_type] [local_ip]
+ t=0 0
+ m=image 5555 udptl t38
+ a=T38FaxVersion:0
+ a=T38MaxBitRate:14400
+ a=T38FaxRateManagement:transferredTCF
+ a=T38FaxMaxDatagram:1400
+ a=T38FaxUdpEC:t38UDPRedundancy
+
+ ]]>
+ </send>
+
+ <recv request="ACK" crlf="true">
+ </recv>
+
+ <pause milliseconds="5000" />
+
+ <send retrans="500">
+ <![CDATA[
+
+ BYE [next_url] SIP/2.0
+ [routes]
+ Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]2
+ From: <sip:390415094280@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Call-ID: [call_id]
+ User-Agent: Cisco-SIPGateway/IOS-12.x
+ Max-Forwards: 69
+ Timestamp: 1269264583
+ CSeq: 102 BYE
+ Reason: Q.850;cause=16
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+
+ <recv response="200">
+ </recv>
+
+
+</scenario>
diff --git a/tests/channels/pjsip/fast_t38_reinvite/sipp/B_PARTY.xml b/tests/channels/pjsip/fast_t38_reinvite/sipp/B_PARTY.xml
new file mode 100644
index 0000000..150009b
--- /dev/null
+++ b/tests/channels/pjsip/fast_t38_reinvite/sipp/B_PARTY.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Generated Scenario for 81.201.82.45:5060.xml">
+ <recv request="INVITE" crlf="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[
+
+ SIP/2.0 100 Trying
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Content-Length: [len]
+
+ ]]>
+ </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:]
+ Content-Type: application/sdp
+ Contact: <sip:390418628834@[local_ip]:[local_port]>
+ Content-Length: [len]
+
+ v=0
+ o=root 818062879 818062879 IN IP4 [local_ip]
+ s=Asterisk PBX 1.6.2.0
+ c=IN IP[local_ip_type] [local_ip]
+ t=0 0
+ m=audio 8000 RTP/AVP 8 18 101
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:18 G729/8000
+ a=fmtp:18 annexb=no
+ a=rtpmap:101 telephone-event/8000
+ a=fmtp:101 0-16
+ a=silenceSupp:off - - - -
+ a=ptime:20
+ a=sendrecv
+
+ ]]>
+ </send>
+
+ <recv request="ACK" crlf="true">
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+
+ INVITE [$1] SIP/2.0
+ [last_Call-ID:]
+ CSeq: 1 INVITE
+ From: [$3];tag=[pid]SIPpTag01[call_number]
+ To: [$2]
+ Via: SIP/2.0/UDP [local_ip]:[local_port];branch=[branch]
+ Max-Forwards: 69
+ Content-Type: application/sdp
+ Contact: <sip:390418628834@[local_ip]:[local_port]>
+ User-Agent: Vox Callcontrol
+ Content-Length: [len]
+
+ v=0
+ o=root 818062879 818062880 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="180" optional="true">
+ </recv>
+
+ <recv response="200" rtd="true" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ ACK [$1] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ CSeq: 1 ACK
+ [last_Call-ID:]
+ From: [$3];tag=[pid]SIPpTag01[call_number]
+ To: [$2]
+ CSeq: 1 ACK
+ Max-Forwards: 70
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="INVITE" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 100 Trying
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Content-Length: [len]
+
+ ]]>
+ </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:]
+ Content-Type: application/sdp
+ Contact: <sip:390418628834@[local_ip]:[local_port]>
+ Content-Length: [len]
+
+ v=0
+ o=root 818062879 818062879 IN IP4 [local_ip]
+ s=Asterisk PBX 1.6.2.0
+ c=IN IP[local_ip_type] [local_ip]
+ t=0 0
+ m=audio 8000 RTP/AVP 8 18 101
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:18 G729/8000
+ a=fmtp:18 annexb=no
+ a=rtpmap:101 telephone-event/8000
+ a=fmtp:101 0-16
+ a=silenceSupp:off - - - -
+ a=ptime:20
+ a=sendrecv
+
+ ]]>
+ </send>
+
+ <recv request="ACK" 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>
+
+
+
+
+</scenario>
diff --git a/tests/channels/pjsip/fast_t38_reinvite/test-config.yaml b/tests/channels/pjsip/fast_t38_reinvite/test-config.yaml
new file mode 100644
index 0000000..ba10335
--- /dev/null
+++ b/tests/channels/pjsip/fast_t38_reinvite/test-config.yaml
@@ -0,0 +1,17 @@
+testinfo:
+ summary: 'This test case verifies that fast T38 reinvites are handled'
+ description: |
+ 'A and B set up a basic audio call, call flow between B and asterisk is complete,
+ but before asterisk has forwarded 200 OK to A party, B party sends T_38 REINVITE.
+ In the version 1.4 of asterisk, it has been seen that such fast T_38 REINVITEs are not
+ handled properly by the asterisk. Below was the observation on Asterisk 1.4:
+ When such quick T_38 reinvite is received, asterisk thinks that there is no peer because
+ it has not done the channel bridging yet and hence does not forward the T_38 REINVITE
+ to A'
+
+properties:
+ minversion: '13'
+ dependencies:
+ - app : 'sipp'
+ tags:
+ - SIP
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 086a61a..74162d3 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -48,3 +48,4 @@
- test: 'srtp_negotiation'
- test: 'srtp_not_loaded'
- test: 'user_eq_phone'
+ - test: 'fast_t38_reinvite'
--
To view, visit https://gerrit.asterisk.org/5410
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb2d124958dd2b273ca91a771b1e667992e2c103
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
More information about the asterisk-code-review
mailing list