[asterisk-commits] wdoekes: testsuite/asterisk/trunk r5633 - in /asterisk/trunk/tests/channels/S...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 22 14:38:50 CDT 2014


Author: wdoekes
Date: Mon Sep 22 14:38:42 2014
New Revision: 5633

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5633
Log:
Regression test for ASTERISK-24335: 503 after INVITE retransmit.

Thanks to Torrey Searle for providing a working test case!

Patches:
  invite_retransmit.tgz uploaded by Torrey Searle (License 5334)
  tmp.diff uploaded by Walter Doekes (License 5674)

Review: https://reviewboard.asterisk.org/r/4006/

Added:
    asterisk/trunk/tests/channels/SIP/invite_retransmit/
    asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/
    asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/
    asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test   (with props)
    asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/
    asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml   (with props)
    asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/SIP/tests.yaml

Added: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf?view=auto&rev=5633
==============================================================================
--- asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf Mon Sep 22 14:38:42 2014
@@ -1,0 +1,5 @@
+[default]
+exten => 3200000000,1,NoOp
+exten => 3200000000,n,Busy()
+exten => h,1,NoOp
+exten => h,n,Hangup()

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf?view=auto&rev=5633
==============================================================================
--- asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf Mon Sep 22 14:38:42 2014
@@ -1,0 +1,15 @@
+[general]
+sipdebug=yes
+context=default			; Default context for incoming calls
+allowoverlap=no			; Disable overlap dialing support. (Default is yes)
+bindport=5060			; UDP Port to bind to (SIP standard port is 5060)
+bindaddr=0.0.0.0		; IP address to bind to (0.0.0.0 binds to all)
+srvlookup=yes			; Enable DNS SRV lookups on outbound calls
+
+[alice]
+host=127.0.0.1
+port=5061
+type=peer
+insecure=invite
+context=default
+nat=no

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test?view=auto&rev=5633
==============================================================================
--- asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test (added)
+++ asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test Mon Sep 22 14:38:42 2014
@@ -1,0 +1,76 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2014, Digium, Inc.
+Torrey Searle <torrey at voxbone.com>,
+Walter Doekes <walter+asterisk at wjd.nu>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import logging
+
+sys.path.append("lib/python")
+sys.path.append("utils")
+
+from tempfile import NamedTemporaryFile
+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__)
+
+
+def main():
+    sipplog = NamedTemporaryFile(delete=True)
+
+    SIPP_SCENARIOS = [
+        {
+            'scenario': 'invite.xml',
+            '-i': '127.0.0.1',
+            '-p': '5061',
+            '-s': '3200000000',
+            '-message_file': sipplog.name,
+            # Cheat and pass two argumentless options as key and value
+            # because the SIPpTest doesn't allow us to pass ordered-args.
+            # We use -pause_msg_ign to ignore messages while being paused
+            # and then check the log (from -trace_msg) for those messages.
+            '-trace_msg': '-pause_msg_ign',
+        }
+    ]
+
+    test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
+    test.reactor_timeout = 10
+
+    reactor.run()
+
+    # If it failed, bail.
+    if not test.passed:
+        return 1
+
+    # If it succeeded, check if any 503 errors snuck into the log while
+    # we were on pause.
+    sipplog.seek(0)
+    for line in sipplog:
+        if 'SIP/2.0 5' in line:
+            # Collect entire message for debugging purposes.
+            debug = [line]
+            for line in sipplog:
+                if not line.strip():
+                    break
+                debug.append(line)
+            logger.warn('Got unexpected SIP message:\n' + ''.join(debug))
+            # Bail.
+            return 1
+
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
+
+# vim:sw=4:ts=4:expandtab:textwidth=79

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml?view=auto&rev=5633
==============================================================================
--- asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml (added)
+++ asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml Mon Sep 22 14:38:42 2014
@@ -1,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="ASTERISK-24335">
+  <!--
+
+  This scenario needs to get called with -pause_msg_ign to ignore both
+  the valid 486 and the invalid 503 during the pause.
+
+  If we retransmit the INVITE manually (using a second send), sipp will
+  keep matching the 486 to the first 486 and we get stuck in an endless
+  loop. Instead, we silently ignore the first 486 (and 503) and check
+  the logs later to see if the 503 was received.
+
+  -->
+
+  <send retrans="500" start_txn="invite">
+    <![CDATA[
+
+      INVITE sip:[service]@voxbone.com SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:test at voxbone.com>;tag=[call_number]
+      To: sut <sip:[service]@voxbone.com:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[local_ip_type] [local_ip]
+      t=0 0
+      m=audio 9000 RTP/AVP 8
+      a=rtpmap:8 PCMU/8000
+
+    ]]>
+  </send>
+
+  <!-- Ensure at least one retransmit, which causes a 503 in broken
+       asterisk. See: ASTERISK-24335. -->
+  <pause milliseconds="550"/>
+  
+  <recv response="100" response_txn="invite" optional="true"></recv>
+
+  <recv response="486" response_txn="invite"></recv>
+
+  <!-- Properly shut down the transaction. -->
+  <send ack_txn="invite">
+    <![CDATA[
+
+      ACK sip:[service]@voxbone.com SIP/2.0
+      [last_Via:]   
+      From: sipp <sip:test at voxbone.com>;tag=[call_number]
+      To: sut <sip:[service]@voxbone.com:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <timewait milliseconds="1000"/>
+</scenario>

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/sipp/invite.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml?view=auto&rev=5633
==============================================================================
--- asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml Mon Sep 22 14:38:42 2014
@@ -1,0 +1,17 @@
+testinfo:
+    summary: 'Test the behaviour of retransmitted invite'
+    description: |
+        'In a busy callflow make sure that only 486 and not 503 is '
+        'generated on a busy callflow case. Tests the fix of '
+        'ASTERISK-24335.'
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - asterisk: 'chan_sip'
+        - python: 'twisted'
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.0'
+    tags:
+        - SIP

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/SIP/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/tests.yaml?view=diff&rev=5633&r1=5632&r2=5633
==============================================================================
--- asterisk/trunk/tests/channels/SIP/tests.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/tests.yaml Mon Sep 22 14:38:42 2014
@@ -69,3 +69,4 @@
     - dir: 'sendrpid'
     - test: 'tel_uri'
     - dir: 'ami'
+    - test: 'invite_retransmit'




More information about the asterisk-commits mailing list