[asterisk-commits] file: testsuite/asterisk/trunk r5007 - in /asterisk/trunk/tests/channels/pjsi...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 1 07:34:45 CDT 2014
Author: file
Date: Thu May 1 07:34:37 2014
New Revision: 5007
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5007
Log:
Add tests for call pickup in PJSIP.
AST-1363 #close
Review: https://reviewboard.asterisk.org/r/3479/
Added:
asterisk/trunk/tests/channels/pjsip/call_pickup/
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf (with props)
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf (with props)
asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf (with props)
asterisk/trunk/tests/channels/pjsip/call_pickup/run-test (with props)
asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/channels/pjsip/tests.yaml
Added: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf?view=auto&rev=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf Thu May 1 07:34:37 2014
@@ -1,0 +1,13 @@
+[general]
+
+[globals]
+
+[pickuptest]
+exten => dial_faker,1,NoOp()
+ same => n,Answer()
+ same => n,Dial(PJSIP/faker)
+
+exten => test_fuzz,1,NoOp
+ same => n,Answer()
+ same => n,Playback(tt-monkeys)
+
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf?view=auto&rev=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf Thu May 1 07:34:37 2014
@@ -1,0 +1,4 @@
+[general]
+pickupexten = *8
+pickupsound = tt-allbusy
+pickupfailsound = beeperr
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/features.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf?view=auto&rev=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf Thu May 1 07:34:37 2014
@@ -1,0 +1,33 @@
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[sip_receive]
+type=aor
+contact=sip:127.0.0.1:5062
+
+[sip_receive]
+type=identify
+endpoint=sip_receive
+match=127.0.0.1
+
+[faker]
+type=aor
+contact=sip:127.0.0.1:5064
+
+[sip_receive]
+type = endpoint
+aors = sip_receive
+context = default
+disallow = all
+allow = ulaw
+pickup_group = 5
+
+[faker]
+type = endpoint
+aors = faker
+context = default
+disallow = all
+allow = ulaw
+call_group = 5
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf?view=auto&rev=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf Thu May 1 07:34:37 2014
@@ -1,0 +1,7 @@
+[pickuptest]
+exten => test_out,1,NoOp
+ same => n, Dial(PJSIP/*8 at sip_send)
+
+exten => pickup_exten,1,NoOp
+ same => n, Answer()
+ same => n, playback(tt-monkeys)
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf?view=auto&rev=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf Thu May 1 07:34:37 2014
@@ -1,0 +1,20 @@
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5062
+
+[sip_send]
+type=aor
+contact=sip:127.0.0.1:5060
+
+[sip_send]
+type=identify
+endpoint=sip_send
+match=127.0.0.1
+
+[sip_send]
+type = endpoint
+aors = sip_send
+context = default
+disallow = all
+allow = ulaw
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/call_pickup/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/call_pickup/run-test?view=auto&rev=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/call_pickup/run-test (added)
+++ asterisk/trunk/tests/channels/pjsip/call_pickup/run-test Thu May 1 07:34:37 2014
@@ -1,0 +1,133 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2013-2014, Digium, Inc.
+Jonathan Rose <jrose at digium.com>
+Joshua Colp <jcolp at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import logging
+import re
+
+from twisted.internet import reactor
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.test_case import TestCase
+
+LOGGER = logging.getLogger(__name__)
+
+class CallPickupTest(TestCase):
+
+ def __init__(self):
+ TestCase.__init__(self)
+
+ self.pickeeChannel = re.compile("Local/dial_faker at pickuptest-")
+ self.pickerChannel = re.compile("PJSIP/sip_receive-")
+ self.targetChannel = re.compile("PJSIP/faker-")
+
+ self.bridge = None
+
+ self.bridgeComplete = False
+ self.pickupComplete = False
+
+ self.pickerJoined = False
+ self.pickeeJoined = False
+
+ self.connectionsEstablished = 0
+
+ self.create_asterisk(count=2)
+
+ def hangup(self, ami):
+ self.stop_reactor()
+
+ def check_bridge_enter(self, ami, event):
+ channel = event.get('channel')
+ bridge = event.get('bridgeuniqueid')
+
+ if not self.bridge:
+ self.bridge = bridge
+ elif self.bridge != bridge:
+ LOGGER.error("The bridge ID mismatch - got %s - expected %s - FAIL" % (bridge, self.bridge))
+ self.set_passed(False)
+ self.stop_reactor()
+
+ if self.pickerChannel.match(channel):
+ self.pickerJoined = True
+ elif self.pickeeChannel.match(channel):
+ self.pickeeJoined = True
+ else:
+ LOGGER.error("Unexpected Channel %s joined the bridge - FAIL" % channel)
+ self.set_passed(False)
+ self.stop_reactor()
+
+ if self.pickerJoined and self.pickeeJoined:
+ if self.pickupComplete:
+ self.set_passed(True)
+ self.ami[0].hangup(channel).addCallback(self.hangup)
+ else:
+ self.bridgeComplete = True
+
+ def check_pickup(self, ami, event):
+ picker = event.get("channel")
+ target = event.get("targetchannel")
+
+ if self.pickerChannel.match(picker) and self.targetChannel.match(target):
+ if self.bridgeComplete:
+ self.set_passed(True)
+ self.ami[0].hangup(picker).addCallback(self.hangup)
+ else:
+ self.pickupComplete = True
+
+ def check_dial(self, ami, event):
+ dialstring = event.get('dialstring')
+ if dialstring != 'faker':
+ return
+
+ self.ami[0].registerEvent('Pickup', self.check_pickup)
+ self.ami[0].registerEvent('BridgeEnter', self.check_bridge_enter)
+
+ LOGGER.info("Originating Pickup attempt")
+
+ self.ami[1].originate(
+ channel="Local/test_out at pickuptest",
+ exten="pickup_exten",
+ context="pickuptest",
+ priority="1"
+ ).addErrback(self.handle_originate_failure)
+
+ def ami_connect(self, ami):
+ self.connectionsEstablished += 1
+
+ if self.connectionsEstablished != 2:
+ return
+
+ self.ami[0].registerEvent("DialBegin", self.check_dial)
+
+ LOGGER.info("Originating channel to be picked up")
+ self.ami[0].originate(
+ channel="Local/dial_faker at pickuptest",
+ exten="test_fuzz",
+ context="pickuptest",
+ priority=1
+ ).addErrback(self.handle_originate_failure)
+
+ def run(self):
+ TestCase.run(self)
+ self.create_ami_factory(2)
+
+def main():
+ test = CallPickupTest()
+ reactor.run()
+ if test.passed != True:
+ return 1
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.yaml?view=auto&rev=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.yaml Thu May 1 07:34:37 2014
@@ -1,0 +1,15 @@
+testinfo:
+ summary: 'Test PJSIP Call Pickup'
+ description: |
+ 'This test verifies that a PJSIP channel can use the call pickup extension to
+ Answer a call to a channel that is assigned to its pickupgroup.'
+
+properties:
+ minversion: '12.2.0'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'chan_pjsip'
+ tags:
+ - pickup
+ - features
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/call_pickup/test-config.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=5007&r1=5006&r2=5007
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/tests.yaml Thu May 1 07:34:37 2014
@@ -21,4 +21,5 @@
- test: 'headers'
- dir: 'transfers'
- test: 'info_dtmf'
+ - test: 'call_pickup'
More information about the asterisk-commits
mailing list