[svn-commits] kharwell: testsuite/asterisk/trunk r4635 - in /asterisk/trunk/tests/channels/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jan 31 16:11:54 CST 2014


Author: kharwell
Date: Fri Jan 31 16:11:51 2014
New Revision: 4635

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4635
Log:
res_pjsip_mwi: Subscribe fails when missing aor name

Test subscribing to all aors on an endpoint when the aor name is missing
from the sip uri.

(issue ASTERISK-23072)
Reported by: Bob M
Review: https://reviewboard.asterisk.org/r/3165/

Added:
    asterisk/trunk/tests/channels/pjsip/subscribe/
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test   (with props)
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/pjsip/tests.yaml

Added: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf?view=auto&rev=4635
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf Fri Jan 31 16:11:51 2014
@@ -1,0 +1,11 @@
+[modules]
+autoload=yes
+
+noload => pbx_gtkconsole.so
+noload => chan_alsa.so
+noload => chan_oss.so
+noload => chan_console.so
+
+noload => chan_sip.so
+noload => app_voicemail.so
+

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/modules.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf?view=auto&rev=4635
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf Fri Jan 31 16:11:51 2014
@@ -1,0 +1,33 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[endpoint_t](!)
+type=endpoint
+transport=local
+context=default
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_t](!)
+type=aor
+max_contacts=1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; alice
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[alice0](aor_t)
+contact=sip:alice at 127.0.0.1:5061
+mailboxes=alice0
+
+[alice1](aor_t)
+contact=sip:alice at 127.0.0.1:5061
+mailboxes=alice1
+
+[alice](endpoint_t)
+aors=alice0,alice1

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test?view=auto&rev=4635
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test (added)
+++ asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test Fri Jan 31 16:11:51 2014
@@ -1,0 +1,77 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2014, Digium, Inc.
+Kevin Harwell <kharwell at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+
+sys.path.append("lib/python/asterisk")
+
+from twisted.internet import reactor
+from sipp import SIPpScenario
+from test_case import TestCase
+
+class MissingAor(TestCase):
+    """Test case for subscribing to MWI without an aor/name in the sip uri"""
+
+    def __init__(self):
+        """Create a new instance of the MissingAor test case."""
+
+        super(MissingAor, self).__init__()
+        self.create_asterisk()
+
+    def run(self):
+        """Test execution method.  Connect to AMI."""
+
+        super(MissingAor, self).run()
+        self.create_ami_factory()
+
+    def ami_connect(self, ami):
+        """Add a single message to two separate mailboxes via external MWI.
+        Once added subscribe to both mailboxes at once by issuing a subscribe
+        without an aor/name in the sip uri.
+        """
+        def _mwi_update(num):
+            """Create an external MWI update action."""
+            return {
+                'Action': 'MWIUpdate',
+                'Mailbox': 'alice' + str(num),
+                'NewMessages': 1,
+                'OldMessages': 0}
+
+        def _on_scenario(obj):
+            """Callback handler for when the sipp scenario runs successfully."""
+            # the scenario checks for the proper count
+            # so if we get here the test passed
+            self.set_passed(True)
+            self.stop_reactor()
+            return obj
+
+        def _on_alice1(dummy):
+            """Callback handler for when external MWI updated mailbox alice1."""
+            # the two separate mailboxes should now have
+            # messages waiting so subscribe to them
+            sipp = SIPpScenario(self.test_name,
+                                {'scenario':'subscribe.xml', '-p':'5061'})
+            sipp.run(self).addCallback(_on_scenario)
+
+        def _on_alice0(dummy):
+            """Callback handler for when external MWI updated mailbox alice0."""
+            # add a message to alice1 via external mwi
+            ami.sendDeferred(_mwi_update(1)).addCallback(_on_alice1)
+
+        # add a message to alice0 via external mwi
+        ami.sendDeferred(_mwi_update(0)).addCallback(_on_alice0)
+
+def main():
+    """Main entry point for test."""
+    test = MissingAor()
+    reactor.run()
+    return not test.passed
+
+if __name__ == "__main__":
+    sys.exit(main())

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml?view=auto&rev=4635
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml Fri Jan 31 16:11:51 2014
@@ -1,0 +1,47 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Subscribe">
+  <send retrans="500">
+    <![CDATA[
+      SUBSCRIBE sip:[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 SUBSCRIBE
+      Contact: "alice" <sip:alice@[local_ip]:[local_port]>
+      Expires: 3600
+      Max-Forwards: 70
+      Event: message-summary
+      User-Agent: Cisco/SPA504G-7.5.5
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" rtd="true" />
+
+  <recv request="NOTIFY" crlf="true">
+    <action>
+      <ereg regexp=".*\sVoice-Message: 2/0" check_it="true" search_in="body" assign_to="body" />
+    </action>
+  </recv>
+
+  <Reference variables="body" />
+
+  <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>
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml?view=auto&rev=4635
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml Fri Jan 31 16:11:51 2014
@@ -1,0 +1,16 @@
+testinfo:
+    summary:     'Test subscribe without a name in the URI'
+    description: |
+        'Some devices (Cisco SPA 504G) may send a subscribe request with a SIP
+         URI that does not contain a name.  In this case res_pjsip_mwi will
+         subscribe to all aors on the endpoint.  This tests that.'
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_mwi'
+    tags:
+        - pjsip

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml?view=auto&rev=4635
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml Fri Jan 31 16:11:51 2014
@@ -1,0 +1,3 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'missing_aor'

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/subscribe/tests.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/pjsip/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/tests.yaml?view=diff&rev=4635&r1=4634&r2=4635
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/tests.yaml Fri Jan 31 16:11:51 2014
@@ -7,6 +7,7 @@
     - test: 'auth_security_events'
     - dir: 'one_touch_recording'
     - dir: 'registration'
+    - dir: 'subscribe'
     - dir: 'diversion'
     - dir: 'message'
     - dir: 'dialplan_functions'




More information about the svn-commits mailing list