[asterisk-commits] jbigelow: testsuite/asterisk/trunk r4832 - in /asterisk/trunk/tests/channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 11 11:04:31 CDT 2014


Author: jbigelow
Date: Tue Mar 11 11:04:22 2014
New Revision: 4832

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4832
Log:
Add tests for PJSIP presence un-subscribe & re-subscribe

This adds basic nominal tests for presence un-subscribe and re-subscribe using
PJSIP. This also re-organizes existing tests.

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

(closes issue ASTERISK-23344)


Added:
    asterisk/trunk/tests/channels/pjsip/subscriptions/
    asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/
    asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/missing_aor/
      - copied from r4765, asterisk/trunk/tests/channels/pjsip/subscribe/missing_aor/
    asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/mwi_aggregate/
      - copied from r4799, asterisk/trunk/tests/channels/pjsip/mwi_aggregate/
    asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/unsolicited/
      - copied from r4765, asterisk/trunk/tests/channels/pjsip/mwi/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/digium_presence/
      - copied from r4765, asterisk/trunk/tests/channels/pjsip/subscribe/digium_presence/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/presence_pidf/
      - copied from r4765, asterisk/trunk/tests/channels/pjsip/presence_pidf/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/presence_xpidf/
      - copied from r4765, asterisk/trunk/tests/channels/pjsip/presence_xpidf/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/modules.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/modules.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/tests.yaml   (with props)
Removed:
    asterisk/trunk/tests/channels/pjsip/mwi/
    asterisk/trunk/tests/channels/pjsip/mwi_aggregate/
    asterisk/trunk/tests/channels/pjsip/presence_pidf/
    asterisk/trunk/tests/channels/pjsip/presence_xpidf/
    asterisk/trunk/tests/channels/pjsip/subscribe/
Modified:
    asterisk/trunk/tests/channels/pjsip/tests.yaml

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/tests.yaml?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/tests.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/tests.yaml Tue Mar 11 11:04:22 2014
@@ -1,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'missing_aor'
+    - test: 'unsolicited'
+    - test: 'mwi_aggregate'

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

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/mwi/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf Tue Mar 11 11:04:22 2014
@@ -1,0 +1,3 @@
+[default]
+
+exten => bob,hint,Custom:bob

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/modules.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/modules.conf?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/modules.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/modules.conf Tue Mar 11 11:04:22 2014
@@ -1,0 +1,9 @@
+[modules]
+autoload=yes
+
+noload => chan_alsa.so
+noload => chan_oss.so
+noload => chan_console.so
+noload => chan_sip.so
+
+noload => res_pjsip_xpidf_body_generator.so

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/modules.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/modules.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf Tue Mar 11 11:04:22 2014
@@ -1,0 +1,16 @@
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+transport=local-transport
+context=default
+aors=alice
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061
+max_contacts=1
+

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/sipp/subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/sipp/subscribe.xml?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/sipp/subscribe.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/sipp/subscribe.xml Tue Mar 11 11:04:22 2014
@@ -1,0 +1,91 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Subscribe">
+  <send retrans="500">
+    <![CDATA[
+      SUBSCRIBE sip:[service]@[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:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 SUBSCRIBE
+      Contact: "alice" <sip:alice@[local_ip]:[local_port]>
+      Expires: 300
+      Max-Forwards: 70
+      Event: presence
+      Accept: application/pidf+xml
+      User-Agent: SIPp
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" rtd="true" />
+
+  <recv request="NOTIFY" crlf="true">
+    <action>
+      <ereg regexp="active;expires=[2,3][0,9][0,5-9]" check_it="true" search_in="hdr" header="Subscription-State" assign_to="substate" />
+    </action>
+  </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>
+
+  <send retrans="500">
+    <![CDATA[
+      SUBSCRIBE sip:[service]@[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:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 2 SUBSCRIBE
+      Contact: "alice" <sip:alice@[local_ip]:[local_port]>
+      Expires: 600
+      Max-Forwards: 70
+      Event: presence
+      Accept: application/pidf+xml
+      User-Agent: SIPp
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" rtd="true" />
+
+  <recv request="NOTIFY" crlf="true">
+    <action>
+      <ereg regexp="active;expires=[5,6][0,9][0,5-9]" check_it="true" search_in="hdr" header="Subscription-State" assign_to="resubstate" />
+    </action>
+  </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>
+
+  <Reference variables="substate,resubstate" />
+
+</scenario>

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

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml Tue Mar 11 11:04:22 2014
@@ -1,0 +1,34 @@
+testinfo:
+    summary:     'Test PJSIP presence re-subscribe'
+    description: |
+        'This test instructs "alice" to subscribe to buddy "bob" using SIPp
+        with an expiration of 300. Upon successfully subscribing it will then
+        re-subscribe with an expiration of 600. This ensures that alice
+        successfully re-subscribes to bob with an expiration of 600.'
+
+properties:
+    minversion: '13.0.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_exten_state'
+        - sipp:
+            version: 'v3.0'
+    tags:
+        - pjsip
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-case-config
+        typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+    reactor-timeout: 10
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'subscribe.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'bob'} }
+

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/resubscribe/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml Tue Mar 11 11:04:22 2014
@@ -1,0 +1,7 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'digium_presence'
+    - test: 'presence_pidf'
+    - test: 'presence_xpidf'
+    - test: 'resubscribe'
+    - test: 'unsubscribe'

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

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf Tue Mar 11 11:04:22 2014
@@ -1,0 +1,3 @@
+[default]
+
+exten => bob,hint,Custom:bob

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/modules.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/modules.conf?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/modules.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/modules.conf Tue Mar 11 11:04:22 2014
@@ -1,0 +1,9 @@
+[modules]
+autoload=yes
+
+noload => chan_alsa.so
+noload => chan_oss.so
+noload => chan_console.so
+noload => chan_sip.so
+
+noload => res_pjsip_xpidf_body_generator.so

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/modules.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/modules.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf Tue Mar 11 11:04:22 2014
@@ -1,0 +1,13 @@
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+aors=alice
+
+[alice]
+type=aor
+max_contacts=1

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml Tue Mar 11 11:04:22 2014
@@ -1,0 +1,51 @@
+testinfo:
+    summary:     'Test PJSIP presence un-subscribe.'
+    description: |
+        'This test creates a PJSUA account, "alice", that subscribes to buddy
+        "bob". Upon successfully subscribing it will then un-subscribe. This
+        ensures that alice successfully un-subscribed from bob.'
+
+properties:
+    minversion: '13.0.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - python: 'pjsua'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_exten_state'
+    tags:
+        - pjsip
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-case-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: 'pjsua-config'
+            typename: 'pjsua_mod.PJsua'
+
+test-case-config:
+    reactor-timeout: 15
+    connect-ami: 'True'
+
+pjsua-config:
+    callback_module: 'unsubscribe'
+    callback_method: 'buddy_subscribe'
+    transports:
+        -
+            name: 'local-ipv4'
+            bind: '127.0.0.1'
+            bindport: '5061'
+    accounts:
+        -
+            name: 'alice'
+            username: 'alice'
+            password: 'alice'
+            domain: '127.0.0.1'
+            buddies:
+                -
+                    name: 'bob'
+                    uri: 'sip:bob at 127.0.0.1'
+

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py Tue Mar 11 11:04:22 2014
@@ -1,0 +1,67 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2014, Digium, Inc.
+John Bigelow <jbigelow at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import logging
+import pjsua as pj
+
+LOGGER = logging.getLogger(__name__)
+
+class BobCallback(pj.BuddyCallback):
+    """Derived class for buddy presence status changes."""
+
+    def __init__(self, bob, test_object):
+        """Constructor
+
+        Keyword Arguments:
+        bob The buddy object
+        test_object The test object
+        """
+        pj.BuddyCallback.__init__(self, bob)
+        self.bob = bob
+        self.sub_cnt = 0
+        self.test_object = test_object
+        self.ami = self.test_object.ami[0]
+
+    def on_state(self):
+        info = self.buddy.info()
+
+        LOGGER.info("Bob status to follow")
+        LOGGER.info("Online status: %d" % info.online_status)
+        LOGGER.info("Online text: %s" % info.online_text)
+        LOGGER.info("Activity: %d" % info.activity)
+        LOGGER.info("Sub state: %d" % info.sub_state)
+
+        if info.online_status == 1 and info.sub_state == 4:
+            LOGGER.info("Successfully subscribed.")
+            self.sub_cnt += 1
+            self.bob.unsubscribe()
+        elif self.sub_cnt == 1:
+            if info.online_status == 1 and info.sub_state == 5:
+                LOGGER.info("Successfully un-subscribed.")
+                self.test_object.set_passed(True)
+                self.test_object.stop_reactor()
+            else:
+                LOGGER.info("Failed to un-subscribed.")
+                self.test_object.set_passed(False)
+                self.test_object.stop_reactor()
+
+
+def buddy_subscribe(test_object, accounts):
+    """The test's callback method.
+
+    Keyword Arguments:
+    test_object The test object
+    accounts Configured accounts
+    """
+    alice = accounts.get('alice')
+    bob = alice.buddies.get('bob')
+    bob.set_callback(BobCallback(bob, test_object))
+    bob.subscribe()
+
+# vim:sw=4:ts=4:expandtab:textwidth=79

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/unsubscribe/unsubscribe.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/tests.yaml?view=auto&rev=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/tests.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/tests.yaml Tue Mar 11 11:04:22 2014
@@ -1,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - dir: 'mwi'
+    - dir: 'presence'

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

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/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=4832&r1=4831&r2=4832
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/tests.yaml Tue Mar 11 11:04:22 2014
@@ -8,18 +8,14 @@
     - test: 'auth_security_events'
     - dir: 'one_touch_recording'
     - dir: 'registration'
-    - dir: 'subscribe'
     - dir: 'diversion'
     - dir: 'message'
     - dir: 'dialplan_functions'
     - dir: 'ami'
     - test: 'set_var'
     - test: 'hold'
+    - dir: 'subscriptions'
     - test: 'hold_ice'
-    - test: 'presence_pidf'
-    - test: 'presence_xpidf'
-    - test: 'mwi'
-    - test: 'mwi_aggregate'
     - test: 'refer_send_to_vm'
     - test: 'qualify'
 




More information about the asterisk-commits mailing list