[Asterisk-code-review] Non negotiated rtp frame causes call disconnection when there is a SS... (testsuite[master])

Paulo Vicentini asteriskteam at digium.com
Tue Feb 25 19:17:03 CST 2020


Paulo Vicentini has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/13847 )


Change subject: Non negotiated rtp frame causes call disconnection when there is a SSRC change
......................................................................

Non negotiated rtp frame causes call disconnection when there is a SSRC change

For a non negotiated rtp frame, when there was a SSRC change, the frame
would be marked as a control frame and it would be queued to be written
and then leading to a disconnection
(ast_channel_softhangup_internal_flag_add)
The associated patch prevents processing of a non negotiated rtp frame
considering also when SSRC changes

ASTERISK-28759

Change-Id: If3e760a7bb94c9bfc1ee24aff7f5fd7a3cbd33ed
---
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/configs/ast1/extensions.conf
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/configs/ast1/pjsip.conf
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/run-test
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/A_party_g711a.pcap
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/g711a.pcap
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc1.pcap
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc2.pcap
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/uac_g719_g711.xml
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/uas_asterisk.xml
A tests/channels/pjsip/non_negotiated_frame_SSRC_change/test-config.yaml
M tests/channels/pjsip/tests.yaml
11 files changed, 429 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/47/13847/1

diff --git a/tests/channels/pjsip/non_negotiated_frame_SSRC_change/configs/ast1/extensions.conf b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ad7b155
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/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/non_negotiated_frame_SSRC_change/configs/ast1/pjsip.conf b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..6ef2143
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/configs/ast1/pjsip.conf
@@ -0,0 +1,80 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements start
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[general]
+sipdebug = yes
+
+[PEER_A]
+port = 5061
+
+[sbc]
+port = 5700
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements end
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+--;
+
+
+[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 = alaw
+direct_media = no
+send_rpid = yes
+sdp_session = session
+dtls_verify = no
+aors = PEER_A
+t38_udptl = yes
+t38_udptl_ec = redundancy
+asymmetric_rtp_codec = no
+
+[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
+dtls_verify = no
+dtls_rekey = 300
+dtls_cipher = ALL
+aors = sbc
+t38_udptl = yes
+t38_udptl_ec = redundancy
+asymmetric_rtp_codec = no
+
diff --git a/tests/channels/pjsip/non_negotiated_frame_SSRC_change/run-test b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/run-test
new file mode 100755
index 0000000..72db0a7
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/run-test
@@ -0,0 +1,71 @@
+#!/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' : 'uas_asterisk.xml',
+        '-i' : '127.0.0.1',
+        '-p' : '5700',
+        '-message_file' : sippB_logfile,
+        '-error_file' : sippB_errfile,
+        '-trace_msg' : '-trace_err',
+    },
+    {
+        'scenario' : 'uac_g719_g711.xml',
+        '-i' : '127.0.0.1',
+        '-p' : '5061',
+        '-s' : e164,
+        '-d' : '20000',
+        '-mp': '6000',
+        '-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;
+    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/non_negotiated_frame_SSRC_change/sipp/A_party_g711a.pcap b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/A_party_g711a.pcap
new file mode 100644
index 0000000..ba96dc6
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/A_party_g711a.pcap
Binary files differ
diff --git a/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/g711a.pcap b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/g711a.pcap
new file mode 100644
index 0000000..bafea38
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/g711a.pcap
Binary files differ
diff --git a/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc1.pcap b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc1.pcap
new file mode 100644
index 0000000..913dc79
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc1.pcap
Binary files differ
diff --git a/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc2.pcap b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc2.pcap
new file mode 100644
index 0000000..b248f20
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc2.pcap
Binary files differ
diff --git a/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/uac_g719_g711.xml b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/uac_g719_g711.xml
new file mode 100644
index 0000000..b819563
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/uac_g719_g711.xml
@@ -0,0 +1,150 @@
+<?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]
+      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 [media_port] RTP/AVP 116 107 8 111 110 13
+      a=sendrecv
+      a=ptime:20
+      a=rtpmap:116 AMR-WB/16000/1
+      a=fmtp:116 mode-change-capability=2
+      a=rtpmap:107 AMR-WB/16000/1
+      a=fmtp:107 octet-align=1; mode-change-capability=2
+      a=rtpmap:8 PCMA/8000
+      a=rtpmap:111 telephone-event/16000
+      a=rtpmap:110 telephone-event/8000
+      a=rtpmap:13 CN/8000
+      a=fmtp:111 0-15
+      a=fmtp:111 0-15
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="200" rtd="true" 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>
+
+  <pause milliseconds="40"/>
+
+  <nop>
+    <action>
+	    <exec play_pcap_audio="tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc1.pcap"/>
+    </action>
+  </nop>
+  <pause milliseconds="40"/>
+  <nop>
+    <action>
+	    <exec play_pcap_audio="tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/ssrc2.pcap"/>
+    </action>
+  </nop>
+  <pause milliseconds="40"/>
+
+ <nop>
+    <action>
+	    <exec play_pcap_audio="tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/A_party_g711a.pcap"/>
+    </action>
+  </nop>
+
+  <pause milliseconds="3000"/>
+
+    <!-- This delay can be customized by the -d command-line option       -->
+  <!-- or by adding a 'milliseconds = "value"' option here.             -->
+  <pause/>
+
+  <!-- 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/non_negotiated_frame_SSRC_change/sipp/uas_asterisk.xml b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/uas_asterisk.xml
new file mode 100644
index 0000000..657bcbb
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/uas_asterisk.xml
@@ -0,0 +1,95 @@
+<?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 9000 RTP/AVP 8 103
+a=rtpmap:8 PCMA/8000
+a=rtpmap:103 telephone-event/8000
+
+]]>
+</send>
+
+<recv request="ACK"
+      rtd="true"
+      crlf="true">
+</recv>
+
+<pause milliseconds="40"/>
+
+  <nop>
+    <action>
+	    <exec play_pcap_audio="tests/channels/pjsip/non_negotiated_frame_SSRC_change/sipp/g711a.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/channels/pjsip/non_negotiated_frame_SSRC_change/test-config.yaml b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/test-config.yaml
new file mode 100644
index 0000000..87892e4
--- /dev/null
+++ b/tests/channels/pjsip/non_negotiated_frame_SSRC_change/test-config.yaml
@@ -0,0 +1,21 @@
+testinfo:
+    summary: 'It prevents processing of a non negotiated rtp frame considering also when SSRC changes'
+    description: |
+         'When there was a SSRC change, the frame would be marked as a control frame and it would be queued to be written and then leading to a disconnection (ast_channel_softhangup_internal_flag_add).'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+
+properties:
+    dependencies:
+        - sipp :
+             version : 'v3.0'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 4fa8f51..9b419ac 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -58,3 +58,4 @@
     - test: 'multipart_empty_part'
     - test: 'dtmf_info_fallback'
     - test: 'invalid_uris'
+    - test: 'non_negotiated_frame_SSRC_change'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: If3e760a7bb94c9bfc1ee24aff7f5fd7a3cbd33ed
Gerrit-Change-Number: 13847
Gerrit-PatchSet: 1
Gerrit-Owner: Paulo Vicentini <paulo.vicentini at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200225/f2dfe9e9/attachment-0001.html>


More information about the asterisk-code-review mailing list