[Asterisk-code-review] testsuite: Added tests for correct packetization (testsuite[13])
Robert Cripps
asteriskteam at digium.com
Mon Oct 29 04:23:47 CDT 2018
Robert Cripps has uploaded this change for review. ( https://gerrit.asterisk.org/10557
Change subject: testsuite: Added tests for correct packetization
......................................................................
testsuite: Added tests for correct packetization
Added tests for transcode and a non transcode plus contrib/scripts
for verification
Also added the test directory to the pjsip tests.yaml
ASTERISK-28110 #close
Change-Id: I16cfb5805d2b96fdf5cdbc8f53a86522d1d251a7
---
A contrib/scripts/verify_codecs.pl
A contrib/scripts/verify_rtp_len.pl
A tests/channels/pjsip/rtp_ptime/non-transcode/ast1/extensions.conf
A tests/channels/pjsip/rtp_ptime/non-transcode/ast1/pjsip.conf
A tests/channels/pjsip/rtp_ptime/non-transcode/configs/ast1/extensions.conf
A tests/channels/pjsip/rtp_ptime/non-transcode/configs/ast1/pjsip.conf
A tests/channels/pjsip/rtp_ptime/non-transcode/run-test
A tests/channels/pjsip/rtp_ptime/non-transcode/sipp/40msalaw.pcap
A tests/channels/pjsip/rtp_ptime/non-transcode/sipp/uac_asterisk.xml
A tests/channels/pjsip/rtp_ptime/non-transcode/sipp/uas_asterisk.xml
A tests/channels/pjsip/rtp_ptime/non-transcode/test-config.yaml
A tests/channels/pjsip/rtp_ptime/tests.yaml
A tests/channels/pjsip/rtp_ptime/transcode/configs/ast1/extensions.conf
A tests/channels/pjsip/rtp_ptime/transcode/configs/ast1/pjsip.conf
A tests/channels/pjsip/rtp_ptime/transcode/run-test
A tests/channels/pjsip/rtp_ptime/transcode/sipp/40msalaw.pcap
A tests/channels/pjsip/rtp_ptime/transcode/sipp/uac_asterisk.xml
A tests/channels/pjsip/rtp_ptime/transcode/sipp/uas_asterisk.xml
A tests/channels/pjsip/rtp_ptime/transcode/test-config.yaml
M tests/channels/pjsip/tests.yaml
20 files changed, 1,044 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/57/10557/1
diff --git a/contrib/scripts/verify_codecs.pl b/contrib/scripts/verify_codecs.pl
new file mode 100644
index 0000000..5c00e60
--- /dev/null
+++ b/contrib/scripts/verify_codecs.pl
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+
+use strict;
+
+# This perl program parses an RTP dump file and looks for the codec
+# names provided on the command line in the RTM DUMP file, if none
+# of the pref_codecs are found in RTP dump file, it exits with a status
+# code of 99 otherwise it will exit with a status code of 0
+
+# This perl program expects minium of two arguments on command line,
+# First argument is the name of RTP dump, second argument and so on
+# are the codec names to be searched in RTP dump file
+
+# Check the number of command lines arguments
+
+my $num_args = @ARGV;
+if ($num_args < 2)
+{
+ print "[VERIFY CODECS]Insufficient arguments\n";
+ exit(99);
+}
+else
+{
+ my $FILE_PTR;
+ my $bad_codec = 0;
+ my $lock_codec = 0;
+ my @pref_codecs = @ARGV[1..$num_args];
+ my $dump_file = $ARGV[0];
+ if (open(FILE_PTR,$dump_file))
+ {
+ my $count=0;
+ my $line;
+ my @lines;
+ my $dump_length=0;
+
+ # Read the dump file into arrat @lines
+ @lines = <FILE_PTR>;
+ close FILE_PTR;
+ $dump_length = @lines;
+
+ # Process the dump file
+ for ($count=0;$count<$dump_length;$count++)
+ {
+ $line = @lines[$count];
+ #Check for the payload type
+ if ($line =~ /.*pt=([0-9]+).*/)
+ {
+ my $match=0;
+ #Check the payload type matched any of the expected
+ #payload types
+ if($lock_codec == 0)
+ {
+ #system settled down on desired codec
+ #make sure it keeps on that codec
+ if ($pref_codecs[0] eq $1)
+ {
+ $lock_codec=1;
+ $match=1;
+ }
+ else
+ {
+ foreach my $pref_codec (@pref_codecs)
+ {
+ if ($pref_codec eq $1)
+ {
+ $match=1;
+ }
+ }
+ }
+ }
+ elsif ($pref_codecs[0] eq $1)
+ {
+ $match=1;
+ }
+
+ if ($match == 0)
+ {
+ $bad_codec = 1;
+ last;
+ }
+
+
+ }
+
+ }
+
+
+ if ($bad_codec eq 1)
+ {
+ print "[VERIFY_CODECS] Unsupported codecs in dump file [$dump_file]\n";
+ exit(99);
+ }
+ elsif($lock_codec == 0)
+ {
+ print "[VERIFY_CODECS] Call never switched to preferred codec [$dump_file]\n";
+ exit(99);
+ }
+ else
+ {
+ exit(0);
+ }
+ }
+ else
+ {
+ print "[VERIFY_CODECS] Unable to open the dump file [$dump_file]\n";
+ exit(99);
+ }
+
+}
diff --git a/contrib/scripts/verify_rtp_len.pl b/contrib/scripts/verify_rtp_len.pl
new file mode 100755
index 0000000..50a45f3
--- /dev/null
+++ b/contrib/scripts/verify_rtp_len.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use strict;
+
+# This perl program parses an RTP dump file and looks for and verifies the RTP frame length len=xxx
+
+# Check the number of command lines arguments
+
+my $num_args = @ARGV;
+if ($num_args ne 2)
+{
+ print "[VERIFY RTP LEN] needs 2 arguments\n";
+ exit(99);
+}
+else
+{
+ my $ret=99;
+ my $dump_file = $ARGV[0];
+ my $len = $ARGV[1];
+ if (open(FILE_PTR,$dump_file)) {
+ my $count = 0;
+ my $line;
+ my @lines;
+ my $dump_length = 0;
+
+ # Read the dump file into array @lines
+ @lines = <FILE_PTR>;
+ close FILE_PTR;
+ $dump_length = @lines;
+
+ # Process the dump file
+ for ($count = 0; $count < $dump_length; $count++) {
+ $line = @lines[$count];
+ #Check for the payload type
+ if ($line =~ /.*len=([0-9]+).*/) {
+ if($1 ne $len) {
+ $ret = 99;
+ last;
+ } else {
+ $ret=0;
+ }
+ }
+ }
+ } else {
+ print("Failed to open dump file = $dump_file\n");
+ exit(99);
+ }
+ exit($ret);
+}
diff --git a/tests/channels/pjsip/rtp_ptime/non-transcode/ast1/extensions.conf b/tests/channels/pjsip/rtp_ptime/non-transcode/ast1/extensions.conf
new file mode 100644
index 0000000..ad7b155
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/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/rtp_ptime/non-transcode/ast1/pjsip.conf b/tests/channels/pjsip/rtp_ptime/non-transcode/ast1/pjsip.conf
new file mode 100644
index 0000000..f0c1a63
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/ast1/pjsip.conf
@@ -0,0 +1,76 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+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
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = PEER_A
+t38_udptl = yes
+t38_udptl_ec = redundancy
+use_ptime=yes
+
+[sbc]
+type = aor
+contact = sip:127.0.0.1:5700
+
+[sbc]
+type = endpoint
+context = callcontrol
+dtmf_mode = rfc4733
+disallow = all
+allow = alaw
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = sbc
+t38_udptl = yes
+t38_udptl_ec = redundancy
+use_ptime=yes
+
diff --git a/tests/channels/pjsip/rtp_ptime/non-transcode/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp_ptime/non-transcode/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ad7b155
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/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/rtp_ptime/non-transcode/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp_ptime/non-transcode/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f0c1a63
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/configs/ast1/pjsip.conf
@@ -0,0 +1,76 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+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
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = PEER_A
+t38_udptl = yes
+t38_udptl_ec = redundancy
+use_ptime=yes
+
+[sbc]
+type = aor
+contact = sip:127.0.0.1:5700
+
+[sbc]
+type = endpoint
+context = callcontrol
+dtmf_mode = rfc4733
+disallow = all
+allow = alaw
+direct_media = no
+send_rpid = yes
+sdp_session = session
+aors = sbc
+t38_udptl = yes
+t38_udptl_ec = redundancy
+use_ptime=yes
+
diff --git a/tests/channels/pjsip/rtp_ptime/non-transcode/run-test b/tests/channels/pjsip/rtp_ptime/non-transcode/run-test
new file mode 100755
index 0000000..604f0ae
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/run-test
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+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' : 'uas_asterisk.xml',
+ '-i' : '127.0.0.1',
+ '-p' : '5700',
+ '-mp' : '6300',
+ '-message_file' : sippB_logfile,
+ '-error_file' : sippB_errfile,
+ '-trace_msg' : '-trace_err',
+ },
+ {
+ 'scenario' : 'uac_asterisk.xml',
+ '-i' : '127.0.0.1',
+ '-p' : '5061',
+ '-s' : e164,
+ '-d' : '5000',
+ '-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 = 55;
+
+ # Run the RTPDUMP tool to capture the logs on B side
+ dump_B = WORKING_DIR + "/codec_B.log"
+ rtpdump = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-o",dump_B, "127.0.0.1/8000"])
+
+ reactor.run()
+
+ # Kill the RTPDUMP, pass it the signal"
+ rtpdump.send_signal(signal.SIGINT)
+ rtpdump.wait()
+
+ ret_B = subprocess.call(["perl","contrib/scripts/verify_codecs.pl",dump_B ,"8"])
+ if (ret_B == 99):
+ return 1
+ ret_B = subprocess.call(["perl","contrib/scripts/verify_rtp_len.pl",dump_B ,"172"])
+ if (ret_B == 99):
+ return 1
+
+ return 0;
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
diff --git a/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/40msalaw.pcap b/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/40msalaw.pcap
new file mode 100644
index 0000000..67356c5
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/40msalaw.pcap
Binary files differ
diff --git a/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/uac_asterisk.xml b/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/uac_asterisk.xml
new file mode 100644
index 0000000..4612603
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/uac_asterisk.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE scenario SYSTEM "bansallaptop.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 (bansallaptop placing calls), the Call-ID MUST be -->
+ <!-- generated by bansallaptop. 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:bansallaptop@[local_ip]:[local_port]>;tag=[call_number]
+ To: bansalphone <sip:[service]@[remote_ip]>
+ Call-ID: [call_id]
+ X-VCC-UUID: [pid][clock_tick][call_number]
+ X-VCC-Provider: 61 [local_ip] BEL
+ CSeq: 1 INVITE
+ Contact: sip:bansallaptop@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=bansallaptop 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP4 127.0.0.1
+ t=0 0
+ m=audio 9000 RTP/AVP 8
+ a=rtpmap:8 PCMA/8000 101
+ a=rtpmap:101 telephone-event/8000
+ a=ptime:40
+
+ ]]>
+ </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>
+
+
+ <!-- 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 [next_url] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: bansallaptop <sip:bansallaptop@[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:bansallaptop@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ [routes]
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <nop>
+ <action>
+ <exec play_pcap_audio="./tests/channels/pjsip/rtp_ptime/non-transcode/sipp/40msalaw.pcap"/>
+ </action>
+ </nop>
+
+
+ <!-- This delay can be customized by the -d command-line option -->
+ <!-- or by adding a 'milliseconds = "value"' option here. -->
+ <pause milliseconds="5000" />
+
+
+ <!-- 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: bansallaptop <sip:bansallaptop@[local_ip]:[local_port]>;tag=[call_number]
+ To: bansalphone <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Contact: sip:bansallaptop@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+ [routes]
+
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true">
+ </recv>
+
+ <!-- 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/rtp_ptime/non-transcode/sipp/uas_asterisk.xml b/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/uas_asterisk.xml
new file mode 100644
index 0000000..90a326f
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/sipp/uas_asterisk.xml
@@ -0,0 +1,90 @@
+<?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">
+</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 IP4 127.0.0.1
+t=0 0
+m=audio 8000 RTP/AVP 8 103
+a=rtpmap:8 PCMA/8000
+a=rtpmap:103 telephone-event/8000
+a=ptime:20
+
+]]>
+</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/channels/pjsip/rtp_ptime/non-transcode/test-config.yaml b/tests/channels/pjsip/rtp_ptime/non-transcode/test-config.yaml
new file mode 100644
index 0000000..6bde774
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/non-transcode/test-config.yaml
@@ -0,0 +1,11 @@
+testinfo:
+ summary: 'Test that asterisk can convert 40ms audio in 20ms'
+ description: |
+ 'When receiving 40ms audio verify that asterisk can convert it to 20m if customer requested'
+
+properties:
+ dependencies:
+ - app : 'sipp'
+ - app : 'rtpdump'
+ tags:
+ - PJSIP
diff --git a/tests/channels/pjsip/rtp_ptime/tests.yaml b/tests/channels/pjsip/rtp_ptime/tests.yaml
new file mode 100644
index 0000000..1186e84
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+ - test: 'transcode'
+ - test: 'non-transcode'
diff --git a/tests/channels/pjsip/rtp_ptime/transcode/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp_ptime/transcode/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ad7b155
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/transcode/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/rtp_ptime/transcode/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp_ptime/transcode/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..ebcb595
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/transcode/configs/ast1/pjsip.conf
@@ -0,0 +1,86 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+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
+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 = redundancy
+use_ptime=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
+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 = redundancy
+use_ptime=yes
+
diff --git a/tests/channels/pjsip/rtp_ptime/transcode/run-test b/tests/channels/pjsip/rtp_ptime/transcode/run-test
new file mode 100755
index 0000000..8ec678e
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/transcode/run-test
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+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' : 'uas_asterisk.xml',
+ '-i' : '127.0.0.1',
+ '-p' : '5700',
+ '-mp' : '6300',
+ '-message_file' : sippB_logfile,
+ '-error_file' : sippB_errfile,
+ '-trace_msg' : '-trace_err',
+ },
+ {
+ 'scenario' : 'uac_asterisk.xml',
+ '-i' : '127.0.0.1',
+ '-p' : '5061',
+ '-s' : e164,
+ '-d' : '5000',
+ '-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 = 55;
+
+ # Run the RTPDUMP tool to capture the logs on B side
+ dump_B = WORKING_DIR + "/codec_B.log"
+ rtpdump = subprocess.Popen(["rtpdump", "-t","5", "-F","ascii","-o",dump_B, "127.0.0.1/8000"])
+
+ reactor.run()
+
+ # Kill the RTPDUMP, pass it the signal"
+ rtpdump.send_signal(signal.SIGINT)
+ rtpdump.wait()
+
+
+ ret_B = subprocess.call(["perl","contrib/scripts/verify_codecs.pl",dump_B ,"0"])
+ if (ret_B == 99):
+ return 1
+ ret_B = subprocess.call(["perl","contrib/scripts/verify_rtp_len.pl",dump_B ,"172"])
+ if (ret_B == 99):
+ return 1
+
+ return 0;
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
diff --git a/tests/channels/pjsip/rtp_ptime/transcode/sipp/40msalaw.pcap b/tests/channels/pjsip/rtp_ptime/transcode/sipp/40msalaw.pcap
new file mode 100644
index 0000000..67356c5
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/transcode/sipp/40msalaw.pcap
Binary files differ
diff --git a/tests/channels/pjsip/rtp_ptime/transcode/sipp/uac_asterisk.xml b/tests/channels/pjsip/rtp_ptime/transcode/sipp/uac_asterisk.xml
new file mode 100644
index 0000000..00ec688
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/transcode/sipp/uac_asterisk.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE scenario SYSTEM "bansallaptop.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 (bansallaptop placing calls), the Call-ID MUST be -->
+ <!-- generated by bansallaptop. 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:bansallaptop@[local_ip]:[local_port]>;tag=[call_number]
+ To: bansalphone <sip:[service]@[remote_ip]>
+ Call-ID: [call_id]
+ X-VCC-UUID: [pid][clock_tick][call_number]
+ X-VCC-Provider: 61 [local_ip] BEL
+ CSeq: 1 INVITE
+ Contact: sip:bansallaptop@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ v=0
+ o=bansallaptop 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+ s=-
+ c=IN IP4 127.0.0.1
+ t=0 0
+ m=audio 9000 RTP/AVP 8
+ a=rtpmap:8 PCMA/8000 101
+ a=rtpmap:101 telephone-event/8000
+ a=ptime:40
+
+ ]]>
+ </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>
+
+
+ <!-- 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 [next_url] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: bansallaptop <sip:bansallaptop@[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:bansallaptop@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ [routes]
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <nop>
+ <action>
+ <exec play_pcap_audio="./tests/channels/pjsip/rtp_ptime/transcode/sipp/40msalaw.pcap"/>
+ </action>
+ </nop>
+
+
+ <!-- This delay can be customized by the -d command-line option -->
+ <!-- or by adding a 'milliseconds = "value"' option here. -->
+ <pause milliseconds="5000" />
+
+
+ <!-- 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: bansallaptop <sip:bansallaptop@[local_ip]:[local_port]>;tag=[call_number]
+ To: bansalphone <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Contact: sip:bansallaptop@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+ [routes]
+
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true">
+ </recv>
+
+ <!-- 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/rtp_ptime/transcode/sipp/uas_asterisk.xml b/tests/channels/pjsip/rtp_ptime/transcode/sipp/uas_asterisk.xml
new file mode 100644
index 0000000..e3764e7
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/transcode/sipp/uas_asterisk.xml
@@ -0,0 +1,90 @@
+<?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">
+</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 IP4 127.0.0.1
+t=0 0
+m=audio 8000 RTP/AVP 8 103
+a=rtpmap:0 PCMU/8000
+a=rtpmap:103 telephone-event/8000
+a=ptime:20
+
+]]>
+</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/channels/pjsip/rtp_ptime/transcode/test-config.yaml b/tests/channels/pjsip/rtp_ptime/transcode/test-config.yaml
new file mode 100644
index 0000000..d623716
--- /dev/null
+++ b/tests/channels/pjsip/rtp_ptime/transcode/test-config.yaml
@@ -0,0 +1,12 @@
+testinfo:
+ summary: 'Test that asterisk can convert 40ms audio in 20ms'
+ description: |
+ 'When receiving 40ms audio verify that asterisk can convert it to 20m if customer requested'
+
+properties:
+ minversion: '1.4'
+ dependencies:
+ - app : 'sipp'
+ - app : 'rtpdump'
+ tags:
+ - SIP
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index c6be41c..1149cd1 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -24,6 +24,7 @@
- dir: 'transport'
- dir: 'video_calls'
- dir: 'ice'
+ - dir: 'rtp_ptime'
- test: 'accountcode'
- test: 'acl_call'
- test: 'allow_overlap'
--
To view, visit https://gerrit.asterisk.org/10557
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I16cfb5805d2b96fdf5cdbc8f53a86522d1d251a7
Gerrit-Change-Number: 10557
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Cripps <rcripps at voxbone.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181029/92f8fb41/attachment-0001.html>
More information about the asterisk-code-review
mailing list