[svn-commits] mjordan: testsuite/asterisk/trunk r5379 - in /asterisk/trunk/tests/rest_api/m...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Aug 7 13:13:21 CDT 2014
Author: mjordan
Date: Thu Aug 7 13:13:17 2014
New Revision: 5379
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5379
Log:
tests/rest_api: Add nominal message tests
This patch adds four tests for ARI out of call text messaging support. The
tests cover:
- message/endpoint/recv - receiving a message while subscribed to an
endpoint
- message/endpoint/send - sending a message to an endpoint
- message/technology/recv - receiving a message while subscribed to a
technology
- message/technology/send - sending a message through the endpoints/ resource.
Review: https://reviewboard.asterisk.org/r/3864/
ASTERISK-23692
ASTERISK-23969
Added:
asterisk/trunk/tests/rest_api/message/
asterisk/trunk/tests/rest_api/message/endpoint/
asterisk/trunk/tests/rest_api/message/endpoint/recv/
asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/
asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/
asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/
asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml (with props)
asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/message/endpoint/send/
asterisk/trunk/tests/rest_api/message/endpoint/send/configs/
asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/
asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/
asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml (with props)
asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml (with props)
asterisk/trunk/tests/rest_api/message/message_modules.py (with props)
asterisk/trunk/tests/rest_api/message/technology/
asterisk/trunk/tests/rest_api/message/technology/recv/
asterisk/trunk/tests/rest_api/message/technology/recv/configs/
asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/
asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/rest_api/message/technology/recv/sipp/
asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml (with props)
asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/message/technology/send/
asterisk/trunk/tests/rest_api/message/technology/send/configs/
asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/
asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/rest_api/message/technology/send/sipp/
asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml (with props)
asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/message/technology/tests.yaml (with props)
asterisk/trunk/tests/rest_api/message/tests.yaml (with props)
Added: asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf Thu Aug 7 13:13:17 2014
@@ -1,0 +1,20 @@
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+transport=local-transport-udp
+aors=alice
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061\;transport=udp
+
+[alice-identify]
+type=identify
+match=127.0.0.1:50601
+endpoint=alice
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml (added)
+++ asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic MESSAGE send and receive">
+ <send retrans="500">
+ <![CDATA[
+
+ MESSAGE sip:alice@[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:asterisk@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 MESSAGE
+ Max-Forwards: 70
+ Expires: 3600
+ Content-Type: text/plain
+ Content-Length: 18
+
+ Watson, come here.
+
+ ]]>
+ </send>
+
+ <recv response="202" rtd="true" />
+
+</scenario>
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/sipp/message.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,65 @@
+testinfo:
+ summary: Test receiving a message from an endpoint
+ description: |
+ This test covers nominal subscribing to an endpoint for
+ text messages and receiving a message from said endpoint.
+
+test-modules:
+ add-to-search-path:
+ - 'tests/rest_api/message'
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriTestObject
+ modules:
+ -
+ config-section: ari-config
+ typename: ari.WebSocketEventModule
+ -
+ config-section: message-sender
+ typename: 'message_modules.SIPMessageRunner'
+ -
+ config-section: message-subscriber
+ typename: 'message_modules.MessageSubscriber'
+
+test-object-config:
+ asterisk-instances: 1
+ test-iterations: None
+
+message-subscriber:
+ subscriptions:
+ - { event-source: 'endpoint:PJSIP/alice', app: 'testsuite' }
+
+message-sender:
+ end-on-success: True
+ sipp:
+ - { 'scenario':'message.xml', '-p':'5061' }
+
+ari-config:
+ events:
+ - conditions:
+ match:
+ type: TextMessageReceived
+ application: testsuite
+ message:
+ to: 'pjsip:asterisk at 127.0.0.1'
+ from: '"alice" <sip:alice at 127.0.0.1>'
+ body: 'Watson, come here.'
+ endpoint:
+ technology: PJSIP
+ resource: alice
+ state: online
+ count: 1
+
+properties:
+ minversion: '12.5.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - asterisk : res_ari_endpoints
+ - asterisk : res_ari_applications
+ - asterisk : res_pjsip_messaging
+ tags:
+ - ARI
+
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/recv/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf Thu Aug 7 13:13:17 2014
@@ -1,0 +1,20 @@
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+transport=local-transport-udp
+aors=alice
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061\;transport=udp
+
+[alice-identify]
+type=identify
+match=127.0.0.1:5061
+endpoint=alice
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml (added)
+++ asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic MESSAGE send and receive">
+ <recv request="MESSAGE" crlf="true">
+ <action>
+ <ereg regexp="Hello there.*"
+ search_in="body" check_it="true" assign_to="1"/>
+ <ereg regexp="(\W|^)(Everything\sis\sawesome)(\W|$)"
+ search_in="hdr" header="X-Awesome-Header"
+ check_it="true" assign_to="2"/>
+ </action>
+ </recv>
+
+ <Reference variables="1,2" />
+
+ <send>
+ <![CDATA[
+ SIP/2.0 202 Accepted
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
+ Supported: replaces, timer
+ Content-Length: 0
+
+ ]]>
+ </send>
+</scenario>
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/sipp/message_recv.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,61 @@
+testinfo:
+ summary: Test receiving a message from an endpoint
+ description: |
+ This test covers nominal subscribing to an endpoint for
+ text messages and receiving a message from said endpoint.
+
+test-modules:
+ add-to-search-path:
+ - 'tests/rest_api/message'
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriTestObject
+ modules:
+ -
+ config-section: message-receiver
+ typename: 'message_modules.SIPMessageRunner'
+ -
+ config-section: message-subscriber
+ typename: 'message_modules.MessageSubscriber'
+ -
+ config-section: message-sender
+ typename: 'message_modules.MessageSender'
+
+test-object-config:
+ asterisk-instances: 1
+ test-iterations: None
+
+message-subscriber:
+ subscriptions:
+ - { event-source: 'endpoint:PJSIP/alice', app: 'testsuite' }
+
+message-receiver:
+ end-on-success: True
+ sipp:
+ - { 'scenario':'message_recv.xml', '-p':'5061' }
+
+message-sender:
+ messages:
+ -
+ tech: 'PJSIP'
+ resource: 'alice'
+ params:
+ from: 'Asterisk'
+ body: 'Hello there'
+ variables:
+ X-Awesome-Header: 'Everything is awesome'
+
+properties:
+ minversion: '12.5.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - python : json
+ - asterisk : res_ari_endpoints
+ - asterisk : res_ari_applications
+ - asterisk : res_pjsip_messaging
+ tags:
+ - ARI
+
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/send/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml (added)
+++ asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,3 @@
+tests:
+ - test: 'recv'
+ - test: 'send'
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/endpoint/tests.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/message_modules.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/message_modules.py?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/message_modules.py (added)
+++ asterisk/trunk/tests/rest_api/message/message_modules.py Thu Aug 7 13:13:17 2014
@@ -1,0 +1,230 @@
+#!/usr/bin/env python
+"""
+Copyright (C) 2014, Digium, Inc.
+Matt Jordan <mjordan at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+"""
+
+import sys
+import logging
+import json
+import requests
+
+from twisted.internet import defer
+
+sys.path.append('lib/python/asterisk')
+
+from sipp import SIPpScenario
+
+LOGGER = logging.getLogger(__name__)
+
+class MessageCoordinator(object):
+ """Coordinater for sending/receiving messages
+
+ Because other modules will want to do things once we're subscribed, this
+ class acts as a singleton (ew) that allows pluggable modules to be
+ notified once subscriptions are done.
+ """
+
+ _singleton_instance = None
+
+ @staticmethod
+ def get_instance():
+ """Return the singleton instance of the message coordinator"""
+ if (MessageCoordinator._singleton_instance is None):
+ # Note that the constructor sets the singleton instance.
+ # This is a tad backwards, but is needed for the pluggable
+ # framework.
+ MessageCoordinator._singleton_instance = MessageCoordinator()
+ return MessageCoordinator._singleton_instance
+
+ def __init__(self):
+ """Constructor"""
+
+ self._observers = []
+
+ def register_observer(self, observer):
+ """Register a callback function to be called when we get poked
+
+ The callback function takes no arguments. It just gets poked.
+ """
+ self._observers.append(observer)
+
+ def poke_observers(self):
+ """Let the observers know that something happened"""
+ for observer in self._observers:
+ LOGGER.info('Poking observer...')
+ observer()
+
+
+class MessageSubscriber(object):
+ """Pluggable module that makes subscriptions to the specified resources"""
+
+ def __init__(self, module_config, test_object):
+ """Constructor
+
+ Keyword Arguments:
+ module_config This object's configuration
+ test_object The one and only test object
+ """
+ super(MessageSubscriber, self).__init__()
+
+ self.module_config = module_config
+ self.test_object = test_object
+
+ self.test_object.register_ami_observer(self._handle_ami_connection)
+
+ def _handle_ami_connection(self, ami):
+ """Called when the AMI connection is made
+
+ Keyword Arguments:
+ ami Our AMI protocol wrapper
+ """
+
+ ari = self.test_object.ari
+ for sub in self.module_config.get('subscriptions'):
+ app = sub.get('app', 'testsuite')
+ expected_response = sub.get('expected-response')
+ if expected_response:
+ ari.set_allow_errors(True)
+
+ resp = ari.post("applications", app, "subscription",
+ eventSource="%s" % sub['event-source'])
+
+ if expected_response:
+ if resp.status_code != expected_response:
+ LOGGER.error('Failed to get expected response %d: Got %d' %
+ (expected_response, resp.status_code))
+ self.test_object.set_passed(False)
+ else:
+ LOGGER.info('Got expected response %d for sub to %s' %
+ (expected_response, sub['event-source']))
+ self.test_object.set_passed(True)
+ ari.set_allow_errors(False)
+
+ coordinator = MessageCoordinator.get_instance()
+ coordinator.poke_observers()
+
+
+
+class MessageSender(object):
+ """Pluggable module that posts a message"""
+
+ def __init__(self, module_config, test_object):
+ """Constructor
+
+ Keyword Arguments:
+ module_config This object's configuration
+ test_object The one and only test object
+ """
+ super(MessageSender, self).__init__()
+
+ self.module_config = module_config
+ self.test_object = test_object
+
+ coordinator = MessageCoordinator.get_instance()
+ coordinator.register_observer(self._on_poke)
+
+ def _on_poke(self):
+ """Called when the message coordinator gets poked"""
+
+ ari = self.test_object.ari
+ for message in self.module_config.get('messages'):
+ tech = message.get('tech')
+ resource = message.get('resource')
+ args = []
+
+ if tech:
+ args.append(tech)
+ if resource:
+ args.append(resource)
+ args.append('sendMessage')
+ url = ari.build_url('endpoints', *args)
+
+ data = None
+ headers = None
+ params = message.get('params')
+ if 'variables' in message:
+ data = json.dumps({ 'variables': message['variables'] })
+ headers = { 'Content-Type': 'application/json' }
+
+ LOGGER.info('PUT %s %s %s' %
+ (url, params, data if data else ""))
+ resp = requests.put(url, params=params, data=data,
+ headers=headers, auth=ari.userpass)
+
+
+class SIPMessageRunner(object):
+ """Start up a SIPp scenario for messaging purposes"""
+
+ def __init__(self, module_config, test_object):
+ """Constructor
+
+ Keyword Arguments:
+ module_config This object's configuration
+ test_object The one and only test object
+ """
+ super(SIPMessageRunner, self).__init__()
+
+ self.result = []
+ self.module_config = module_config
+ self.test_object = test_object
+
+ self.scenarios = []
+
+ test_object.register_ami_observer(self._handle_ami_connection)
+ test_object.register_stop_observer(self._handle_stop)
+
+ def _handle_stop(self, result):
+ """Deferred called when the reactor/test is stopped
+
+ Keyword Arguments:
+ result The object getting passed down the deferred chain
+ """
+ if len(self.scenarios):
+ LOGGER.error("We still have %d SIPp scenarios running!" %
+ len(self.scenarios))
+ self.test_object.set_passed(False)
+ for scenario in self.scenarios:
+ try:
+ scenario.kill()
+ except:
+ # Move along now...
+ pass
+
+ def _handle_ami_connection(self, ami):
+ """Called when the AMI connection is made
+
+ Keyword Arguments:
+ ami Our AMI protocol wrapper
+ """
+
+ def _check_result(scenario):
+ """Append the result of the test to our list of results"""
+ self.scenarios.remove(scenario)
+ return scenario
+
+ def _set_pass_fail(result):
+ """Check if all tests have passed
+
+ If any have failed, set our passed status to False"""
+ passed = all(r[0] for r in result)
+ self.test_object.set_passed(passed)
+
+ if (self.module_config.get('end-on-success', False) and passed):
+ self.test_object.stop_reactor()
+ return result
+
+ deferds = []
+ for scenario_def in self.module_config.get('sipp'):
+ scenario = SIPpScenario(self.test_object.test_name, scenario_def)
+
+ deferred = scenario.run(self.test_object)
+ deferred.addCallback(_check_result)
+ deferds.append(deferred)
+
+ self.scenarios.append(scenario)
+
+ defer.DeferredList(deferds).addCallback(_set_pass_fail)
Propchange: asterisk/trunk/tests/rest_api/message/message_modules.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/message_modules.py
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/message_modules.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf Thu Aug 7 13:13:17 2014
@@ -1,0 +1,20 @@
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+transport=local-transport-udp
+aors=alice
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061\;transport=udp
+
+[alice-identify]
+type=identify
+match=127.0.0.1:50601
+endpoint=alice
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml (added)
+++ asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic MESSAGE send and receive">
+ <send retrans="500">
+ <![CDATA[
+
+ MESSAGE sip:alice@[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:asterisk@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 MESSAGE
+ Max-Forwards: 70
+ Expires: 3600
+ Content-Type: text/plain
+ Content-Length: 18
+
+ Watson, come here.
+
+ ]]>
+ </send>
+
+ <recv response="202" rtd="true" />
+
+</scenario>
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/sipp/message.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,65 @@
+testinfo:
+ summary: Test receiving a message from an endpoint
+ description: |
+ This test covers nominal subscribing to an endpoint for
+ text messages and receiving a message from said endpoint.
+
+test-modules:
+ add-to-search-path:
+ - 'tests/rest_api/message'
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriTestObject
+ modules:
+ -
+ config-section: ari-config
+ typename: ari.WebSocketEventModule
+ -
+ config-section: message-sender
+ typename: 'message_modules.SIPMessageRunner'
+ -
+ config-section: message-subscriber
+ typename: 'message_modules.MessageSubscriber'
+
+test-object-config:
+ asterisk-instances: 1
+ test-iterations: None
+
+message-subscriber:
+ subscriptions:
+ - { event-source: 'endpoint:PJSIP', app: 'testsuite' }
+
+message-sender:
+ end-on-success: True
+ sipp:
+ - { 'scenario':'message.xml', '-p':'5061' }
+
+ari-config:
+ events:
+ - conditions:
+ match:
+ type: TextMessageReceived
+ application: testsuite
+ message:
+ to: 'pjsip:asterisk at 127.0.0.1'
+ from: '"alice" <sip:alice at 127.0.0.1>'
+ body: 'Watson, come here.'
+ endpoint:
+ technology: PJSIP
+ resource: alice
+ state: online
+ count: 1
+
+properties:
+ minversion: '12.5.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - asterisk : res_ari_endpoints
+ - asterisk : res_ari_applications
+ - asterisk : res_pjsip_messaging
+ tags:
+ - ARI
+
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/technology/recv/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf Thu Aug 7 13:13:17 2014
@@ -1,0 +1,20 @@
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+transport=local-transport-udp
+aors=alice
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061\;transport=udp
+
+[alice-identify]
+type=identify
+match=127.0.0.1:5061
+endpoint=alice
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml (added)
+++ asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic MESSAGE send and receive">
+ <recv request="MESSAGE" crlf="true">
+ <action>
+ <ereg regexp="Hello there.*"
+ search_in="body" check_it="true" assign_to="1"/>
+ <ereg regexp="(\W|^)(Everything\sis\sawesome)(\W|$)"
+ search_in="hdr" header="X-Awesome-Header"
+ check_it="true" assign_to="2"/>
+ </action>
+ </recv>
+
+ <Reference variables="1,2" />
+
+ <send>
+ <![CDATA[
+ SIP/2.0 202 Accepted
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
+ Supported: replaces, timer
+ Content-Length: 0
+
+ ]]>
+ </send>
+</scenario>
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/sipp/message_recv.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,60 @@
+testinfo:
+ summary: Test receiving a message from an endpoint
+ description: |
+ This test covers nominal subscribing to an endpoint for
+ text messages and receiving a message from said endpoint.
+
+test-modules:
+ add-to-search-path:
+ - 'tests/rest_api/message'
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriTestObject
+ modules:
+ -
+ config-section: message-receiver
+ typename: 'message_modules.SIPMessageRunner'
+ -
+ config-section: message-subscriber
+ typename: 'message_modules.MessageSubscriber'
+ -
+ config-section: message-sender
+ typename: 'message_modules.MessageSender'
+
+test-object-config:
+ asterisk-instances: 1
+ test-iterations: None
+
+message-subscriber:
+ subscriptions:
+ - { event-source: 'endpoint:PJSIP/alice', app: 'testsuite' }
+
+message-receiver:
+ end-on-success: True
+ sipp:
+ - { 'scenario':'message_recv.xml', '-p':'5061' }
+
+message-sender:
+ messages:
+ -
+ params:
+ to: 'pjsip:alice'
+ from: 'Asterisk'
+ body: 'Hello there'
+ variables:
+ X-Awesome-Header: 'Everything is awesome'
+
+properties:
+ minversion: '12.5.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - python : json
+ - asterisk : res_ari_endpoints
+ - asterisk : res_ari_applications
+ - asterisk : res_pjsip_messaging
+ tags:
+ - ARI
+
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/technology/send/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/technology/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/technology/tests.yaml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/technology/tests.yaml (added)
+++ asterisk/trunk/tests/rest_api/message/technology/tests.yaml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,3 @@
+tests:
+ - test: 'recv'
+ - test: 'send'
Propchange: asterisk/trunk/tests/rest_api/message/technology/tests.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/technology/tests.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/technology/tests.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/message/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/message/tests.yaml?view=auto&rev=5379
==============================================================================
--- asterisk/trunk/tests/rest_api/message/tests.yaml (added)
+++ asterisk/trunk/tests/rest_api/message/tests.yaml Thu Aug 7 13:13:17 2014
@@ -1,0 +1,3 @@
+tests:
+ - dir: 'endpoint'
+ - dir: 'technology'
Propchange: asterisk/trunk/tests/rest_api/message/tests.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/message/tests.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/message/tests.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the svn-commits
mailing list