[asterisk-commits] mmichelson: branch mmichelson/bridge-tests r3361 - in /asterisk/team/mmichels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 24 17:16:48 CDT 2012
Author: mmichelson
Date: Tue Jul 24 17:16:46 2012
New Revision: 3361
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3361
Log:
Add talk detection to tests.
Finally.
Modified:
asterisk/team/mmichelson/bridge-tests/configs/bridge/ast2/extensions.conf
asterisk/team/mmichelson/bridge-tests/configs/bridge/ast3/extensions.conf
asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py
asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/asterisk.py
asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf
Modified: asterisk/team/mmichelson/bridge-tests/configs/bridge/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/configs/bridge/ast2/extensions.conf?view=diff&rev=3361&r1=3360&r2=3361
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/configs/bridge/ast2/extensions.conf (original)
+++ asterisk/team/mmichelson/bridge-tests/configs/bridge/ast2/extensions.conf Tue Jul 24 17:16:46 2012
@@ -1,15 +1,20 @@
;Alice's dialplan
+[global]
+CURRENT_RECORDED_FILE=none
[default]
; Originated call is linked to this extension
-exten => test_call,1,UserEvent(Connected, Channel: ${CHANNEL(name)})
-;same => n,Wait(2)
-same => n,SendDTMF(1)
-;same => n,Read(DIGIT,,1,,,1000)
-;same => n,GotoIf($["${DIGIT}" = "1"]?:fail)
-;same => n,UserEvent(DTMF, Success: True)
+exten => test_call,1,Playback(${TALK_AUDIO})
+same => n,SendDTMF(#)
+same => n,Record(alice_audio_%d.wav,,,k)
+same => n,UserEvent(Connected, Channel: ${CHANNEL(name)})
+same => n,BackgroundDetect(${RECORDED_FILE},1,20,,20000)
+same => n,GoToIf($[${TALK_DETECTED}=0]?talkdetectfail:talkdetectpass)
+same => n(talkdetectfail),NoOp()
+same => n,UserEvent(TalkDetect, result: fail)
+same => n,Hangup()
+same => n(talkdetectpass),NoOp()
+same => n,UserEvent(TalkDetect, result: pass)
same => n,Echo()
same => n,Hangup()
-same => n(fail),UserEvent(DTMF, Success: False)
-same => n,Hangup()
Modified: asterisk/team/mmichelson/bridge-tests/configs/bridge/ast3/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/configs/bridge/ast3/extensions.conf?view=diff&rev=3361&r1=3360&r2=3361
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/configs/bridge/ast3/extensions.conf (original)
+++ asterisk/team/mmichelson/bridge-tests/configs/bridge/ast3/extensions.conf Tue Jul 24 17:16:46 2012
@@ -3,12 +3,10 @@
; Incoming call comes here
[default]
-exten => test_call,1,UserEvent(Connected, Channel: ${CHANNEL(name)})
-same => n,Answer()
-;same => n,Read(DIGIT,,1,,,1000)
-;same => n,GotoIf($["${DIGIT}" = "1"]?:fail)
-;same => n,UserEvent(DTMF, Success: True)
-;same => n,SendDTMF(1)
+exten => test_call,1,Record(bob_audio_%d.wav,,,k)
+same => n,Playback(${RECORDED_FILE})
+same => n,SendDTMF(#)
+same => n,UserEvent(Connected, Channel: ${CHANNEL(name)})
same => n,Echo()
same => n,Hangup()
same => n(fail),UserEvent(DTMF, Success: False)
Modified: asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py?view=diff&rev=3361&r1=3360&r2=3361
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py (original)
+++ asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py Tue Jul 24 17:16:46 2012
@@ -112,7 +112,9 @@
self.ami_alice.originate(channel = 'SIP/%s at uut' % test_run['extension'],
exten = 'test_call',
context = 'default',
- priority = '1')
+ priority = '1',
+ variable = {'TALK_AUDIO' : '%s' % os.path.join(os.getcwd(),
+ 'lib/python/asterisk/audio')})
def user_callback(self, ami, event):
if (event.get('userevent') == 'Connected'):
@@ -125,20 +127,14 @@
self.alice_channel = event.get('channel')
LOGGER.info("Alice's channel is %s" % self.alice_channel)
- if self.alice_connected and self.bob_connected:
+ if (event.get('userevent') == 'TalkDetect'):
+ if event.get('result') == 'pass':
+ LOGGER.info("Audio be good")
+ self.audio_detected = True
self.check_identities()
-
- if (event.get('userevent') == 'DTMF'):
- if ami is self.ami_bob:
- LOGGER.info("Bob received DTMF as expected")
- self.bob_dtmf = True
- elif ami is self.ami_alice:
- LOGGER.info("Alice received DTMF as expected")
- self.alice_dtmf = True
- if self.bob_dtmf and self.alice_dtmf:
- # Both parties have received audio properly. Move on to identity
- # tests
- self.check_identities()
+ else:
+ LOGGER.info("AUDIO SUCK!")
+ self.stop_reactor()
def test_callback(self, ami, event):
if (event.get('state') == 'DTMFRECEIVED'):
Modified: asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/asterisk.py?view=diff&rev=3361&r1=3360&r2=3361
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/asterisk.py Tue Jul 24 17:16:46 2012
@@ -440,6 +440,9 @@
self.install_configs("%s/configs" % os.getcwd())
self.__configs_installed = True
+ if not os.access(cfg_path, os.F_OK):
+ return
+
for f in os.listdir(cfg_path):
target = "%s/%s" % (cfg_path, f)
if os.path.isfile(target):
Modified: asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf?view=diff&rev=3361&r1=3360&r2=3361
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf (original)
+++ asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf Tue Jul 24 17:16:46 2012
@@ -1,4 +1,4 @@
[default]
-exten => test_call,1,Dial(test_call at SIP/bob)
+exten => test_call,1,Dial(SIP/test_call at bob,,Ww)
same => n,Hangup()
More information about the asterisk-commits
mailing list