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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 20 13:43:38 CST 2012


Author: wdoekes
Date: Mon Feb 20 13:43:34 2012
New Revision: 3056

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3056
Log:
Add regression test for issue ASTERISK-19358.

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

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

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=3056&r1=3055&r2=3056
==============================================================================
--- asterisk/trunk/tests/channels/SIP/tests.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/tests.yaml Mon Feb 20 13:43:34 2012
@@ -37,3 +37,4 @@
     - test: 'pcap_demo'
     - test: 'sip_hold'
     - test: 'header_parsing'
+    - test: 'use_contact_from_200'

Added: asterisk/trunk/tests/channels/SIP/use_contact_from_200/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/use_contact_from_200/configs/ast1/sip.conf?view=auto&rev=3056
==============================================================================
--- asterisk/trunk/tests/channels/SIP/use_contact_from_200/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/use_contact_from_200/configs/ast1/sip.conf Mon Feb 20 13:43:34 2012
@@ -1,0 +1,4 @@
+[general]
+udpbindaddr=127.0.0.1
+; disable force_rport, or the test succeeds when it shouldn't
+nat=no

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

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

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

Added: asterisk/trunk/tests/channels/SIP/use_contact_from_200/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/use_contact_from_200/run-test?view=auto&rev=3056
==============================================================================
--- asterisk/trunk/tests/channels/SIP/use_contact_from_200/run-test (added)
+++ asterisk/trunk/tests/channels/SIP/use_contact_from_200/run-test Mon Feb 20 13:43:34 2012
@@ -1,0 +1,70 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2012, Digium, Inc.
+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")
+
+from asterisk.TestCase import TestCase
+from asterisk.sipp import SIPpScenario
+from twisted.internet import reactor
+
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+logger = logging.getLogger(__name__)
+
+class UseContactFrom200Test(TestCase):
+    def __init__(self):
+        super(UseContactFrom200Test, self).__init__()
+        self.passed = False
+        self.create_asterisk()
+
+    def run(self):
+        super(UseContactFrom200Test, self).run()
+        self.create_ami_factory()
+
+    def ami_connect(self, ami):
+        super(UseContactFrom200Test, self).ami_connect(ami)
+        logger.debug("Connected to AMI")
+
+        self.start_listening()
+        self.ast[0].cli_exec("channel originate "
+                             "SIP/test at 127.0.0.1:5062 "
+                             "application Wait 1")
+        self.passed = self.finish_listening()
+        self.stop_reactor()
+
+    def start_listening(self):
+        self.scenario = SIPpScenario(TEST_DIR, {
+            'scenario': 'proxy_fork_invite_no_rr.xml',
+            '-p': '5062',
+            '-timeout': '8s',
+        })
+        self.scenario.run()
+
+    def finish_listening(self):
+        return self.scenario.waitAndEvaluate()
+
+
+def main():
+    test = UseContactFrom200Test()
+    test.start_asterisk()
+    reactor.run()
+    test.stop_asterisk()
+    if test.passed:
+        return 0
+    return 1
+
+
+if __name__ == "__main__":
+    sys.exit(main())
+
+
+# vim:ts=8:sw=4:sts=4:expandtab:textwidth=79

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

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

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

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

Added: asterisk/trunk/tests/channels/SIP/use_contact_from_200/sipp/proxy_fork_invite_no_rr.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/use_contact_from_200/sipp/proxy_fork_invite_no_rr.xml?view=auto&rev=3056
==============================================================================
--- asterisk/trunk/tests/channels/SIP/use_contact_from_200/sipp/proxy_fork_invite_no_rr.xml (added)
+++ asterisk/trunk/tests/channels/SIP/use_contact_from_200/sipp/proxy_fork_invite_no_rr.xml Mon Feb 20 13:43:34 2012
@@ -1,0 +1,109 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Asterisk bug A19358, Walter Doekes 2012">
+  <!-- We pretend to be a proxy without RR. -->
+
+  <!-- Wait for request from asterisk -->
+  <recv request="INVITE" rrs="true"/>
+
+  <!-- Response from proxy -->
+  <send>
+    <![CDATA[
+
+      SIP/2.0 100 Got it
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Response from phone A with bad IP/port -->
+  <pause milliseconds="200"/>
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:1.2.3.4:5;transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Response from phone B with bad IP/port -->
+  <pause milliseconds="200"/>
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:1.2.3.4:6;transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Response 200 from phone C with we should get ACKed to. This happens
+       to be our port. -->
+  <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:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 8 0
+      a=rtpmap:8 PCMA/8000
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK" rrs="true"/>
+
+  <!-- We wait for the caller to hang up -->
+
+  <recv request="BYE"/>
+
+  <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 call open to be able to retransmit 200's -->
+  <timewait milliseconds="2000"/>
+
+</scenario><!-- vim: set ts=8 sw=2 sts=2 et ai: -->

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

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

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

Added: asterisk/trunk/tests/channels/SIP/use_contact_from_200/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/use_contact_from_200/test-config.yaml?view=auto&rev=3056
==============================================================================
--- asterisk/trunk/tests/channels/SIP/use_contact_from_200/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/use_contact_from_200/test-config.yaml Mon Feb 20 13:43:34 2012
@@ -1,0 +1,16 @@
+testinfo:
+    summary:    'Test that the Contact from the 200 is final'
+    description: |
+        'When a call is forked by a proxy, asterisk may receive provisional
+        responses from more than one phone. It may remember/store the Contact,
+        but it must use the final contact from the 200 for the ACK, not an old
+        one.'
+    issues:
+        - jira: 'ASTERISK-19358'
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python: 'twisted'
+        - sipp:
+            version: 'v3.1'

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

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

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




More information about the asterisk-commits mailing list