[Asterisk-code-review] pjsip: Refactor out various AMISendTest implementations (testsuite[master])

George Joseph asteriskteam at digium.com
Sun Apr 19 15:54:23 CDT 2015


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/153

Change subject: pjsip:  Refactor out various AMISendTest implementations
......................................................................

pjsip:  Refactor out various AMISendTest implementations

There were several different versions of AMISendTest scattered throughout
test/channels/pjsip.  They've all bene refactored out by converting them
to either SIPpAMIActionTestCase or EventActionModule.

Change-Id: I0d3e5298114bd4eb676537a816bc6e437036642b
---
M lib/python/asterisk/ami.py
D tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py
M tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
D tests/channels/pjsip/ami/show_endpoint/AMISendTest.py
M tests/channels/pjsip/ami/show_endpoint/test-config.yaml
D tests/channels/pjsip/ami/show_endpoints/AMISendTest.py
M tests/channels/pjsip/ami/show_endpoints/test-config.yaml
D tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py
M tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml
D tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py
M tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml
D tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py
M tests/channels/pjsip/ami/show_subscriptions/configs/ast1/extensions.conf
M tests/channels/pjsip/ami/show_subscriptions/configs/ast1/pjsip.conf
M tests/channels/pjsip/ami/show_subscriptions/configs/ast1/voicemail.conf
M tests/channels/pjsip/ami/show_subscriptions/sipp/subscribe.xml
M tests/channels/pjsip/ami/show_subscriptions/test-config.yaml
D tests/channels/pjsip/config_wizard/AMISendTest.py
M tests/channels/pjsip/config_wizard/hints/test-config.yaml
M tests/channels/pjsip/config_wizard/phone/test-config.yaml
M tests/channels/pjsip/config_wizard/registration/test-config.yaml
M tests/channels/pjsip/config_wizard/trunk/test-config.yaml
D tests/channels/pjsip/qualify/AMISendTest.py
M tests/channels/pjsip/qualify/no_qualify/test-config.yaml
24 files changed, 496 insertions(+), 505 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/53/153/1

diff --git a/lib/python/asterisk/ami.py b/lib/python/asterisk/ami.py
index 3cbeeaf..fadbc0a 100644
--- a/lib/python/asterisk/ami.py
+++ b/lib/python/asterisk/ami.py
@@ -15,6 +15,7 @@
 import json
 from pluggable_registry import PLUGGABLE_EVENT_REGISTRY,\
     PLUGGABLE_ACTION_REGISTRY, var_replace
+from test_case import TestCase
 
 LOGGER = logging.getLogger(__name__)
 
@@ -321,6 +322,25 @@
         self.test_object.set_passed(self.passed)
         return callback_param
 
+class AMISendAction(TestCase):
+    def __init__(self, path=None, config=None):
+        super(AMISendAction, self).__init__(path, config)
+        self.config = config
+        self.action = config.get('ACTION')
+        if not self.action:
+            raise Exception('"ACTION" was not defined in test-config.yaml')
+        self.create_asterisk()
+
+    def run(self):
+        super(AMISendAction, self).run()
+        self.create_ami_factory()
+
+    def ami_connect(self, ami):
+        ami.sendDeferred(self.action).addCallback(self.__on_response)
+
+    def __on_response(self, result):
+        # stop test since done
+        self.stop_reactor()
 
 class CelRequirement(object):
     """A particular set of requirements that should be matched on for CEL
diff --git a/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py b/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py
deleted file mode 100644
index 5498ea2..0000000
--- a/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013-2014, Digium, Inc.
-Kevin Harwell <kharwell at digium.com>
-Modified by Scott Emidy <jemidy at digium.com>
-
-This program is free software, distributed under the terms of
-the GNU General Public License Version 2.
-'''
-
-import sys
-import logging
-
-sys.path.append("lib/python/asterisk")
-
-from twisted.internet import reactor
-from test_case import TestCase
-from sipp import SIPpScenario
-
-LOGGER = logging.getLogger(__name__)
-
-ACTION = {
-    "Action": "PJSIPQualify",
-    "Endpoint": "user1"
-}
-
-
-class AMISendTest(TestCase):
-    """Sends the AMI Action PJSIPQualify"""
-    def __init__(self, path=None, config=None):
-        """Constructor """
-        super(AMISendTest, self).__init__(path, config)
-        self.create_asterisk()
-        self.passed = False  #This is default but it doesn't hurt to be explicit
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        """Starts the PJSIPQualify scenario and Runs Through the XML"""
-        super(AMISendTest, self).ami_connect(ami)
-
-        def _ami_action():
-            """ This Sends the PJSIPQualify Action """
-            LOGGER.info('Sending PJSIPQualify Action...')
-            ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
-
-        LOGGER.info('Starting PJSIPQualify scenario')
-
-        sipp_options = (SIPpScenario(self.test_name,
-                        {'scenario': 'options.xml', '-p': '5062'}))
-        sipp_options.run(self).addCallback(self.__on_return)
-        reactor.callLater(1,_ami_action)
-
-    def __on_return(self, result):
-        """Stops and Passes the Test if it Ran Successfully"""
-        self.passed = result.passed
-        self.stop_reactor()
diff --git a/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml b/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
index 70b6cc0..6869d3a 100644
--- a/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
+++ b/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
@@ -14,11 +14,19 @@
         - pjsip
 
 test-modules:
-    # allow test_runner to find and run the local test
-    add-test-to-search-path: 'True'
     test-object:
-        config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        config-section: sipp-config
+        typename: 'sipp.SIPpAMIActionTestCase'
 
-object-config:
+sipp-config:
     reactor-timeout: 15
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'options.xml', '-p': '5062'} }
+    ami-action:
+        delay: 1
+        args:
+            Action: "PJSIPQualify"
+            Endpoint: "user1"
diff --git a/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py b/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py
deleted file mode 100755
index 84a1c21..0000000
--- a/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013, 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 test_case import TestCase
-
-ACTION = {
-    "Action": "PJSIPShowEndpoint",
-    "ActionID": "12345",
-    "Endpoint": "user1"
-}
-
-class AMISendTest(TestCase):
-    def __init__(self, path=None, config=None):
-        super(AMISendTest, self).__init__(path, config)
-        self.create_asterisk()
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        ami.sendDeferred(ACTION).addCallback(self.__on_response)
-
-    def __on_response(self, result):
-        # stop test since done
-        self.stop_reactor()
-
diff --git a/tests/channels/pjsip/ami/show_endpoint/test-config.yaml b/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
index 122e40b..317e3fc 100644
--- a/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
+++ b/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
@@ -19,24 +19,39 @@
     add-test-to-search-path: 'True'
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
             minversion: '12.0.0'
             maxversion: '13.0.0'
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
         -
             minversion: '13.0.0'
             config-section: 'ami-config-13'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowEndpoint'
+                ActionID: '12345'
+                Endpoint: 'user1'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetail'
@@ -124,8 +139,8 @@
                     DeviceState: 'Invalid|Not in use|Unavailable'
                     ActiveChannels: ''
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AorDetail'
@@ -147,8 +162,8 @@
                     ContactsRegistered: '0'
                     EndpointName: 'user1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AuthDetail'
@@ -165,8 +180,8 @@
                     Username: 'user1'
                     EndpointName: 'user1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'TransportDetail'
@@ -196,8 +211,8 @@
                     Protocol: 'udp'
                     EndpointName: 'user1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'IdentifyDetail'
@@ -209,8 +224,8 @@
                     Endpoint: 'user1'
                     Match: '127.0.0.1/255.255.255.255'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetailComplete'
@@ -222,8 +237,22 @@
             count: 1
 
 ami-config-13:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowEndpoint'
+                ActionID: '12345'
+                Endpoint: 'user1'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetail'
@@ -311,8 +340,8 @@
                     DeviceState: 'Invalid|Not in use|Unavailable'
                     ActiveChannels: ''
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AorDetail'
@@ -334,8 +363,8 @@
                     ContactsRegistered: '0'
                     EndpointName: 'user1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AuthDetail'
@@ -352,8 +381,8 @@
                     Username: 'user1'
                     EndpointName: 'user1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'TransportDetail'
@@ -383,8 +412,8 @@
                     Protocol: 'udp'
                     EndpointName: 'user1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'IdentifyDetail'
@@ -396,8 +425,8 @@
                     Endpoint: 'user1'
                     Match: '127.0.0.1/255.255.255.255'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'ContactStatusDetail'
@@ -409,8 +438,8 @@
                     RoundtripUsec: '(N/A|0)'
                     EndpointName: 'user1'
             count: 2
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetailComplete'
@@ -420,3 +449,4 @@
                     EventList: 'Complete'
                     ListItems: '7'
             count: 1
+        stop_test:
diff --git a/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py b/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py
deleted file mode 100755
index 5a8c102..0000000
--- a/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013, 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 test_case import TestCase
-
-ACTION = {
-    "Action":"PJSIPShowEndpoints",
-    "ActionID": "12345",
-}
-
-class AMISendTest(TestCase):
-    def __init__(self, path=None, config=None):
-        super(AMISendTest, self).__init__(path, config)
-        self.create_asterisk()
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        ami.sendDeferred(ACTION).addCallback(self.__on_response)
-
-    def __on_response(self, result):
-        # stop test since done
-        self.stop_reactor()
-
diff --git a/tests/channels/pjsip/ami/show_endpoints/test-config.yaml b/tests/channels/pjsip/ami/show_endpoints/test-config.yaml
index 6870373..4ba976e 100644
--- a/tests/channels/pjsip/ami/show_endpoints/test-config.yaml
+++ b/tests/channels/pjsip/ami/show_endpoints/test-config.yaml
@@ -19,22 +19,37 @@
     add-test-to-search-path: 'True'
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
             minversion: '12.0.0'
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowEndpoints'
+                ActionID: '12345'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointList'
+                    Contacts: user1/sip:user1 at 127.0.0.1:5062
             requirements:
                 match:
                     ActionID: '12345'
@@ -44,12 +59,29 @@
                     Aor: 'user.*'
                     Auths: 'user.*'
                     OutboundAuths: ''
-                    Contacts: user1/sip:user1 at 127.0.0.1:5062|user2/sip:user2 at 127.0.0.1:5063
                     DeviceState: 'Invalid|Not in use|Unavailable'
                     ActiveChannels: ''
-            count: 2
-        -
-            type: 'headermatch'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'EndpointList'
+                    Contacts: user2/sip:user2 at 127.0.0.1:5063
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'endpoint'
+                    ObjectName: 'user.*'
+                    Transport: 'local'
+                    Aor: 'user.*'
+                    Auths: 'user.*'
+                    OutboundAuths: ''
+                    DeviceState: 'Invalid|Not in use|Unavailable'
+                    ActiveChannels: ''
+            count: 1
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointListComplete'
@@ -59,4 +91,4 @@
                     EventList: 'Complete'
                     ListItems: '2'
             count: 1
-
+        stop_test:
diff --git a/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py b/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py
deleted file mode 100755
index e953238..0000000
--- a/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013, 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
-import logging
-
-sys.path.append("lib/python/asterisk")
-
-from test_case import TestCase
-from sipp import SIPpScenario
-
-LOGGER = logging.getLogger(__name__)
-
-ACTION = {
-    "Action": "PJSIPShowRegistrationsInbound",
-    "ActionID": "12345",
-}
-
-class AMISendTest(TestCase):
-    def __init__(self, path=None, config=None):
-        super(AMISendTest, self).__init__(path, config)
-        self.create_asterisk()
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        super(AMISendTest, self).ami_connect(ami)
-
-        def _on_register(obj):
-            LOGGER.info('Getting inbound registrations...')
-            ami.sendDeferred(ACTION).addCallback(self.__on_response)
-            return obj
-
-        LOGGER.info('Starting inbound registration scenario')
-
-        sipp = SIPpScenario(self.test_name,
-            {'scenario':'register.xml', '-p':'5061' })
-        sipp.run(self).addCallback(_on_register)
-
-    def __on_response(self, result):
-        # stop test since done
-        self.stop_reactor()
diff --git a/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml b/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml
index aadfa55..28fa47c 100644
--- a/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml
+++ b/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml
@@ -18,20 +18,39 @@
     # allow test_runner to find and run the local test
     add-test-to-search-path: 'True'
     test-object:
-        config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
     modules:
         -
             minversion: '12.0.0'
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
-object-config:
+sipp-config:
+    connect-ami: True
     reactor-timeout: 15
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'register.xml', '-p': '5061'} }
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'DeviceStateChange'
+            requirements:
+                match:
+                    Device: 'PJSIP/user1'
+                    State: 'NOT_INUSE'
+        ami-actions:
+            action:
+                Action: 'PJSIPShowRegistrationsInbound'
+                ActionID: '12345'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'InboundRegistrationDetail'
@@ -50,16 +69,4 @@
                     MinimumExpiration: '60'
                     Contacts: user1/sip:user1 at 127.0.0.1:5061|user2/sip:user2 at 127.0.0.1:5062
             count: 2
-        -
-            type: 'headermatch'
-            conditions:
-                match:
-                    Event: 'InboundRegistrationDetailComplete'
-            requirements:
-                match:
-                    ActionID: '12345'
-                    EventList: 'Complete'
-                    ListItems: '2'
-            count: 1
-
-
+        stop_test:
diff --git a/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py b/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py
deleted file mode 100755
index e705d2d..0000000
--- a/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013, 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 test_case import TestCase
-
-ACTION = {
-    "Action": "PJSIPShowRegistrationsOutbound",
-    "ActionID": "12345",
-}
-
-class AMISendTest(TestCase):
-    def __init__(self, path=None, config=None):
-        super(AMISendTest, self).__init__(path, config)
-        self.create_asterisk()
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        # wait for asterisk to attempt registration
-        ami.registerEvent('Registry', self.__on_registry)
-
-    def __on_registry(self, ami, event):
-        # asterisk attempted registration, so check details
-        ami.deregisterEvent('Registry', None)
-        ami.sendDeferred(ACTION).addCallback(self.__on_response)
-
-    def __on_response(self, result):
-        # stop test since done
-        self.stop_reactor()
diff --git a/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml b/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml
index 6f160ee..ea47684 100644
--- a/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml
+++ b/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml
@@ -19,27 +19,41 @@
     add-test-to-search-path: 'True'
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
             minversion: '12.0.0'
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowRegistrationsOutbound'
+                ActionID: '12345'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'OutboundRegistrationDetail'
+                    ObjectName: 'user0'
             requirements:
                 match:
                     ActionID: '12345'
                     ObjectType: 'registration'
-                    ObjectName: 'user.*'
                     OutboundAuth: 'reg-auth'
                     AuthRejectionPermanent: 'true'
                     MaxRetries: '10'
@@ -49,13 +63,109 @@
                     OutboundProxy: ''
                     Transport: 'local'
                     ContactUser: ''
-                    ClientUri: 'sip:user.*'
+                    ClientUri: 'sip:user0'
                     ServerUri: 'sip:localhost'
                     Status: 'Unregistered|Rejected'
                     NextReg: '0'
-            count: 5
-        -
-            type: 'headermatch'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'OutboundRegistrationDetail'
+                    ObjectName: 'user1'
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'registration'
+                    OutboundAuth: 'reg-auth'
+                    AuthRejectionPermanent: 'true'
+                    MaxRetries: '10'
+                    ForbiddenRetryInterval: '0'
+                    RetryInterval: '60'
+                    Expiration: '3600'
+                    OutboundProxy: ''
+                    Transport: 'local'
+                    ContactUser: ''
+                    ClientUri: 'sip:user1'
+                    ServerUri: 'sip:localhost'
+                    Status: 'Unregistered|Rejected'
+                    NextReg: '0'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'OutboundRegistrationDetail'
+                    ObjectName: 'user2'
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'registration'
+                    OutboundAuth: 'reg-auth'
+                    AuthRejectionPermanent: 'true'
+                    MaxRetries: '10'
+                    ForbiddenRetryInterval: '0'
+                    RetryInterval: '60'
+                    Expiration: '3600'
+                    OutboundProxy: ''
+                    Transport: 'local'
+                    ContactUser: ''
+                    ClientUri: 'sip:user2'
+                    ServerUri: 'sip:localhost'
+                    Status: 'Unregistered|Rejected'
+                    NextReg: '0'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'OutboundRegistrationDetail'
+                    ObjectName: 'user3'
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'registration'
+                    OutboundAuth: 'reg-auth'
+                    AuthRejectionPermanent: 'true'
+                    MaxRetries: '10'
+                    ForbiddenRetryInterval: '0'
+                    RetryInterval: '60'
+                    Expiration: '3600'
+                    OutboundProxy: ''
+                    Transport: 'local'
+                    ContactUser: ''
+                    ClientUri: 'sip:user3'
+                    ServerUri: 'sip:localhost'
+                    Status: 'Unregistered|Rejected'
+                    NextReg: '0'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'OutboundRegistrationDetail'
+                    ObjectName: 'user4'
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'registration'
+                    OutboundAuth: 'reg-auth'
+                    AuthRejectionPermanent: 'true'
+                    MaxRetries: '10'
+                    ForbiddenRetryInterval: '0'
+                    RetryInterval: '60'
+                    Expiration: '3600'
+                    OutboundProxy: ''
+                    Transport: 'local'
+                    ContactUser: ''
+                    ClientUri: 'sip:user4'
+                    ServerUri: 'sip:localhost'
+                    Status: 'Unregistered|Rejected'
+                    NextReg: '0'
+            count: 1
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AuthDetail'
@@ -72,8 +182,8 @@
                     Username: 'xxx'
 
             count: 5
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'OutboundRegistrationDetailComplete'
@@ -84,3 +194,4 @@
                     Registered: '0'
                     NotRegistered: '5'
             count: 1
+        stop_test:
diff --git a/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py b/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py
deleted file mode 100755
index d3a4b8c..0000000
--- a/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013, 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
-import logging
-
-sys.path.append("lib/python/asterisk")
-
-from sipp import SIPpScenario
-from test_case import TestCase
-
-from twisted.internet import reactor
-
-LOGGER = logging.getLogger(__name__)
-
-ACTION = {
-    "Action": "PJSIPShowSubscriptionsInbound",
-    "ActionID": "12345",
-}
-
-class AMISendTest(TestCase):
-    def __init__(self, path=None, config=None):
-        self.updates_received = 0
-        super(AMISendTest, self).__init__(path, config)
-        self.create_asterisk()
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        super(AMISendTest, self).ami_connect(ami)
-
-	ami.registerEvent("TestEvent", self.test_event)
-        LOGGER.info('Starting subscription scenario')
-        sipp = SIPpScenario(self.test_name,
-            {'scenario':'subscribe.xml', '-p':'5061' })
-        sipp.run(self)
-
-    def test_event(self, ami, event):
-        if event['state'] != "SUBSCRIPTION_STATE_SET" \
-            or event['statetext'] != "ACTIVE" \
-            or event['endpoint'] != "user1":
-            return
-
-        self.updates_received += 1
-        if self.updates_received != 2:
-            return
-
-        LOGGER.info('Getting inbound subscriptions...')
-        ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
-        reactor.callLater(2, self.stop_reactor)
diff --git a/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/extensions.conf b/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/extensions.conf
index 9fde2d9..a660990 100644
--- a/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/extensions.conf
+++ b/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/extensions.conf
@@ -4,3 +4,5 @@
 
 exten => user1,hint,PJSIP/user1
 exten => user1,1,Noop
+exten => user2,hint,PJSIP/user2
+exten => user2,1,Noop
diff --git a/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/pjsip.conf b/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/pjsip.conf
index fd465b4..e36819c 100644
--- a/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/pjsip.conf
+++ b/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/pjsip.conf
@@ -26,3 +26,10 @@
 
 [user1](endpoint_t)
 aors=user1
+
+[user2](aor_t)
+contact=sip:user1 at 127.0.0.1:5061
+mailboxes=user2
+
+[user2](endpoint_t)
+aors=user2
diff --git a/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/voicemail.conf b/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/voicemail.conf
index 29cbe7d..ea9cc1f 100644
--- a/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/voicemail.conf
+++ b/tests/channels/pjsip/ami/show_subscriptions/configs/ast1/voicemail.conf
@@ -10,3 +10,4 @@
 
 [default]
 user1 => 123,mailbox,user1 at user1.com
+user2 => 123,mailbox,user2 at user2.com
diff --git a/tests/channels/pjsip/ami/show_subscriptions/sipp/subscribe.xml b/tests/channels/pjsip/ami/show_subscriptions/sipp/subscribe.xml
index 2124588..c2ef4a6 100644
--- a/tests/channels/pjsip/ami/show_subscriptions/sipp/subscribe.xml
+++ b/tests/channels/pjsip/ami/show_subscriptions/sipp/subscribe.xml
@@ -42,13 +42,13 @@
   <send retrans="500">
     <![CDATA[
 
-      SUBSCRIBE sip:user1@[remote_ip]:[remote_port] SIP/2.0
+      SUBSCRIBE sip:user2@[remote_ip]:[remote_port] SIP/2.0
       Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
-      From: user1 <sip:user1@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
-      To: user1 <sip:user1@[remote_ip]:[remote_port]>
+      From: user2 <sip:user2@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: user2 <sip:user2@[remote_ip]:[remote_port]>
       Call-ID: [call_id]
       CSeq: 1 SUBSCRIBE
-      Contact: sip:user1@[local_ip]:[local_port]
+      Contact: sip:user2@[local_ip]:[local_port]
       Event: presence
       Accept: application/pidf+xml
       Expires: 3600
diff --git a/tests/channels/pjsip/ami/show_subscriptions/test-config.yaml b/tests/channels/pjsip/ami/show_subscriptions/test-config.yaml
index bac1942..96d6e68 100644
--- a/tests/channels/pjsip/ami/show_subscriptions/test-config.yaml
+++ b/tests/channels/pjsip/ami/show_subscriptions/test-config.yaml
@@ -18,45 +18,78 @@
     # allow test_runner to find and run the local test
     add-test-to-search-path: 'True'
     test-object:
-        config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
     modules:
         -
             minversion: '12.0.0'
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
-object-config:
+sipp-config:
+    connect-ami: True
     reactor-timeout: 15
+    fail-on-any: True
     test-iterations:
         -
-             scenarios:
+            scenarios:
                 - { 'key-args': { 'scenario':'subscribe.xml', '-p':'5061' } }
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'TestEvent'
+                    State: 'SUBSCRIPTION_STATE_SET'
+                    Endpoint: 'user1'
+            requirements:
+                match:
+                    StateText: 'ACTIVE'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'TestEvent'
+                    State: 'SUBSCRIPTION_STATE_SET'
+                    Endpoint: 'user2'
+            requirements:
+                match:
+                    StateText: 'ACTIVE'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowSubscriptionsInbound'
+                ActionID: '12345'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'InboundSubscriptionDetail'
+                    Endpoint: 'user1'
             requirements:
                 match:
                     ActionID: '12345'
                     Role: Notifier
-                    Endpoint: 'user.*'
                     Callid: '.*'
                     State: 'ACTIVE'
                     Callerid: 'Unknown'
-                    SubscriptionType: mwi|extension_state
-            count: 2
-        -
-            type: 'headermatch'
+                    SubscriptionType: mwi
+            count: 1
+    -
+        ami-events:
             conditions:
                 match:
-                    Event: 'InboundSubscriptionDetailComplete'
+                    Event: 'InboundSubscriptionDetail'
+                    Endpoint: 'user2'
             requirements:
                 match:
                     ActionID: '12345'
-                    EventList: 'Complete'
-                    ListItems: '2'
+                    Role: Notifier
+                    Callid: '.*'
+                    State: 'ACTIVE'
+                    Callerid: 'Unknown'
+                    SubscriptionType: extension_state
             count: 1
+        stop_test:
diff --git a/tests/channels/pjsip/config_wizard/AMISendTest.py b/tests/channels/pjsip/config_wizard/AMISendTest.py
deleted file mode 100644
index ead830c..0000000
--- a/tests/channels/pjsip/config_wizard/AMISendTest.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013, Digium, Inc.
-Kevin Harwell <kharwell at digium.com>
-George Joseph <george.joseph at fairview5.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 test_case import TestCase
-
-class AMISendTest(TestCase):
-    def __init__(self, path=None, config=None):
-        super(AMISendTest, self).__init__(path, config)
-        self.config = config
-        self.action = config.get('ACTION')
-        if not self.action:
-            raise Exception('"ACTION" was not defined in test-config.yaml')
-        self.create_asterisk()
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        ami.sendDeferred(self.action).addCallback(self.__on_response)
-
-    def __on_response(self, result):
-        # stop test since done
-        self.stop_reactor()
-
diff --git a/tests/channels/pjsip/config_wizard/hints/test-config.yaml b/tests/channels/pjsip/config_wizard/hints/test-config.yaml
index 7c76cba..eff569a 100644
--- a/tests/channels/pjsip/config_wizard/hints/test-config.yaml
+++ b/tests/channels/pjsip/config_wizard/hints/test-config.yaml
@@ -16,22 +16,36 @@
 test-modules:
     # allow test_runner to find and run the local test
     add-test-to-search-path: 'True'
-    add-relative-to-search-path: ['../']
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
-    ACTION: { "Action": "ShowDialPlan", "ActionID": "12345", "Context": "default_hints", "Extension": "9090" }
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'ShowDialPlan'
+                ActionID: '12345'
+                Context: 'default_hints'
+                Extenxion: '9090'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'ListDialplan'
@@ -45,8 +59,8 @@
                     Application: 'PJSIP/phone1'
                     Registrar: 'res_pjsip_config_wizard'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'ListDialplan'
@@ -61,3 +75,4 @@
                     AppData: '\${HINT}/0000'
                     Registrar: 'res_pjsip_config_wizard'
             count: 1
+        stop_test:
diff --git a/tests/channels/pjsip/config_wizard/phone/test-config.yaml b/tests/channels/pjsip/config_wizard/phone/test-config.yaml
index 848214e..06de910 100644
--- a/tests/channels/pjsip/config_wizard/phone/test-config.yaml
+++ b/tests/channels/pjsip/config_wizard/phone/test-config.yaml
@@ -16,22 +16,35 @@
 test-modules:
     # allow test_runner to find and run the local test
     add-test-to-search-path: 'True'
-    add-relative-to-search-path: ['../']
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
-    ACTION: { "Action": "PJSIPShowEndpoint", "ActionID": "12345", "Endpoint": "phone1" }
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowEndpoint'
+                ActionID: '12345'
+                Endpoint: 'phone1'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetail'
@@ -119,8 +132,8 @@
                     DeviceState: 'Invalid|Not in use|Unavailable'
                     ActiveChannels: ''
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AorDetail'
@@ -142,8 +155,8 @@
                     ContactsRegistered: '0'
                     EndpointName: 'phone1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AuthDetail'
@@ -160,8 +173,8 @@
                     Username: 'testuser'
                     EndpointName: 'phone1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'TransportDetail'
@@ -191,8 +204,8 @@
                     Protocol: 'udp'
                     EndpointName: 'phone1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetailComplete'
@@ -202,4 +215,4 @@
                     EventList: 'Complete'
                     ListItems: '4'
             count: 1
-
+        stop_test:
diff --git a/tests/channels/pjsip/config_wizard/registration/test-config.yaml b/tests/channels/pjsip/config_wizard/registration/test-config.yaml
index 4894337..892ddd8 100644
--- a/tests/channels/pjsip/config_wizard/registration/test-config.yaml
+++ b/tests/channels/pjsip/config_wizard/registration/test-config.yaml
@@ -18,25 +18,38 @@
 test-modules:
     # allow test_runner to find and run the local test
     add-test-to-search-path: 'True'
-    add-relative-to-search-path: ['../']
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
-    ACTION: { "Action": "PJSIPShowRegistrationsOutbound", "ActionID": "12345" }
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowRegistrationsOutbound'
+                ActionID: '12345'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'OutboundRegistrationDetail'
+                    ClientUri: 'sip:testuser at 127.0.0.5:41060'
             requirements:
                 match:
                     ActionID: '12345'
@@ -51,13 +64,36 @@
                     OutboundProxy: ''
                     Transport: 'ipv4'
                     ContactUser: ''
-                    ClientUri: 'sip:testuser at 127.*'
                     ServerUri: 'sip:127.*'
                     Status: 'Unregistered|Rejected'
                     NextReg: '0'
-            count: 2
-        -
-            type: 'headermatch'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'OutboundRegistrationDetail'
+                    ClientUri: 'sip:testuser at 127.0.0.6:41070'
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'registration'
+                    ObjectName: 'trunk1-reg-*'
+                    OutboundAuth: 'trunk1-oauth'
+                    AuthRejectionPermanent: 'true'
+                    MaxRetries: '10'
+                    ForbiddenRetryInterval: '0'
+                    RetryInterval: '38'
+                    Expiration: '3600'
+                    OutboundProxy: ''
+                    Transport: 'ipv4'
+                    ContactUser: ''
+                    ServerUri: 'sip:127.*'
+                    Status: 'Unregistered|Rejected'
+                    NextReg: '0'
+            count: 1
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AuthDetail'
@@ -74,8 +110,8 @@
                     Username: 'testuser'
 
             count: 2
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'OutboundRegistrationDetailComplete'
@@ -86,3 +122,4 @@
                     Registered: '0'
                     NotRegistered: '2'
             count: 1
+        stop_test:
diff --git a/tests/channels/pjsip/config_wizard/trunk/test-config.yaml b/tests/channels/pjsip/config_wizard/trunk/test-config.yaml
index cbb14eb..6a075b1 100644
--- a/tests/channels/pjsip/config_wizard/trunk/test-config.yaml
+++ b/tests/channels/pjsip/config_wizard/trunk/test-config.yaml
@@ -18,22 +18,35 @@
 test-modules:
     # allow test_runner to find and run the local test
     add-test-to-search-path: 'True'
-    add-relative-to-search-path: ['../']
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
-    ACTION: { "Action": "PJSIPShowEndpoint", "ActionID": "12345", "Endpoint": "trunk1" }
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowEndpoint'
+                ActionID: '12345'
+                Endpoint: 'trunk1'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetail'
@@ -121,8 +134,8 @@
                     DeviceState: 'Invalid|Not in use|Unavailable'
                     ActiveChannels: ''
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AorDetail'
@@ -144,8 +157,8 @@
                     ContactsRegistered: '0'
                     EndpointName: 'trunk1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'ContactStatusDetail'
@@ -155,8 +168,8 @@
                     AOR: 'trunk1'
                     EndpointName: 'trunk1'
             count: 2
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'AuthDetail'
@@ -173,8 +186,8 @@
                     Username: 'testuser'
                     EndpointName: 'trunk1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'IdentifyDetail'
@@ -187,8 +200,8 @@
                     Endpoint: 'trunk1'
                     EndpointName: 'trunk1'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'TransportDetail'
@@ -218,8 +231,8 @@
                     Protocol: 'udp'
                     EndpointName: 'trunk'
             count: 1
-        -
-            type: 'headermatch'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetailComplete'
@@ -229,4 +242,4 @@
                     EventList: 'Complete'
                     ListItems: '7'
             count: 1
-
+        stop_test:
diff --git a/tests/channels/pjsip/qualify/AMISendTest.py b/tests/channels/pjsip/qualify/AMISendTest.py
deleted file mode 100644
index ead830c..0000000
--- a/tests/channels/pjsip/qualify/AMISendTest.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (C) 2013, Digium, Inc.
-Kevin Harwell <kharwell at digium.com>
-George Joseph <george.joseph at fairview5.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 test_case import TestCase
-
-class AMISendTest(TestCase):
-    def __init__(self, path=None, config=None):
-        super(AMISendTest, self).__init__(path, config)
-        self.config = config
-        self.action = config.get('ACTION')
-        if not self.action:
-            raise Exception('"ACTION" was not defined in test-config.yaml')
-        self.create_asterisk()
-
-    def run(self):
-        super(AMISendTest, self).run()
-        self.create_ami_factory()
-
-    def ami_connect(self, ami):
-        ami.sendDeferred(self.action).addCallback(self.__on_response)
-
-    def __on_response(self, result):
-        # stop test since done
-        self.stop_reactor()
-
diff --git a/tests/channels/pjsip/qualify/no_qualify/test-config.yaml b/tests/channels/pjsip/qualify/no_qualify/test-config.yaml
index faf512b..52fd2ba 100644
--- a/tests/channels/pjsip/qualify/no_qualify/test-config.yaml
+++ b/tests/channels/pjsip/qualify/no_qualify/test-config.yaml
@@ -15,22 +15,36 @@
 test-modules:
     # allow test_runner to find and run the local test
     add-test-to-search-path: 'True'
-    add-relative-to-search-path: ['../']
     test-object:
         config-section: object-config
-        typename: 'AMISendTest.AMISendTest'
+        typename: 'test_case.TestCaseModule'
     modules:
         -
+            minversion: '12.0.0'
             config-section: 'ami-config'
-            typename: 'ami.AMIEventModule'
+            typename: 'pluggable_modules.EventActionModule'
 
 object-config:
     reactor-timeout: 15
-    ACTION: { "Action": "PJSIPShowEndpoint", "ActionID": "12345", "Endpoint": "sipp" }
+    connect-ami: True
 
 ami-config:
-        -
-            type: 'headermatch'
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'FullyBooted'
+            requirements:
+                match:
+                    Status: 'Fully Booted'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'PJSIPShowEndpoint'
+                ActionID: '12345'
+                Endpoint: 'sipp'
+    -
+        ami-events:
             conditions:
                 match:
                     Event: 'EndpointDetail'
@@ -41,3 +55,4 @@
                     ObjectName: 'sipp'
                     DeviceState: 'Not in use'
             count: 1
+        stop_test:

-- 
To view, visit https://gerrit.asterisk.org/153
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d3e5298114bd4eb676537a816bc6e437036642b
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>



More information about the asterisk-code-review mailing list