[asterisk-commits] mjordan: testsuite/asterisk/trunk r4813 - in /asterisk/trunk/tests/apps: ./ c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 8 10:43:54 CST 2014


Author: mjordan
Date: Sat Mar  8 10:43:47 2014
New Revision: 4813

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4813
Log:
channel_redirect: Add test for the ChannelRedirect dialplan application

This test covers the following scenarios:
1. A local channel is originated with both ends in the Echo application. A
   second local channel redirects the first to an extension that hangs up
   immediately. CHANNELREDIRECT_STATUS should then return SUCCESS.
2. A local channel attempts to redirect a non-existent channel.
   CHANNELREDIRECT_STATUS should return NOCHANNEL.

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

(closes issue ASTERISK-23353)
Reported by: Matt Jordan
patches:
  channel_redirect_diff uploaded by bford (license 6580)

ASTERISK-23353 #close

Added:
    asterisk/trunk/tests/apps/channel_redirect/
    asterisk/trunk/tests/apps/channel_redirect/configs/
    asterisk/trunk/tests/apps/channel_redirect/configs/ast1/
    asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/channel_redirect/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/apps/tests.yaml

Added: asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf?view=auto&rev=4813
==============================================================================
--- asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf Sat Mar  8 10:43:47 2014
@@ -1,0 +1,59 @@
+; Tests basic ChannelRedirect functionality
+[globals]
+REDIRECT_VAR=NULL
+
+; ----------------------------------------------------------------------
+; ***Required***
+; ----------------------------------------------------------------------
+[default]
+exten => sendDTMF,1,NoOp()
+    same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+    same => n,SendDTMF(${DTMF_TO_SEND})
+    same => n,Goto(default,wait,1)
+
+exten => sendAudio,1,NoOp()
+    same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+    same => n,Playback(${TALK_AUDIO})
+    same => n,Goto(default,wait,1)
+
+exten => sendAudioWithDTMF,1,NoOp()
+    same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+    same => n,Playback(${TALK_AUDIO})
+    same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+    same => n,SendDTMF(${DTMF_TO_SEND})
+    same => n,Goto(default,wait,1)
+
+exten => hangup,1,NoOp()
+    same => n,Verbose(1, Hanging up)
+    same => n,Hangup()
+
+exten => wait,1,NoOp()
+    same => n,Wait(10000)
+
+; ----------------------------------------------------------------------
+; Sets up the channels to be redirected and the channels to redirect
+; them.
+; ----------------------------------------------------------------------
+[test]
+exten => receiving,1,NoOp()
+    same => n,Answer()
+    same => n,Set(GLOBAL(REDIRECT_VAR)=${CHANNEL})
+    same => n,Echo()
+
+exten => initiating,1,NoOp()
+    same => n,Answer()
+    same => n,ChannelRedirect(${REDIRECT_VAR},test,hang-me-up,1)
+    same => n,ExecIf($[${CHANNELREDIRECT_STATUS}=SUCCESS]?UserEvent(TestResult,result:pass))
+    same => n,Hangup()
+
+exten => null-initiate,1,NoOp()
+    same => n,Answer()
+    same => n,ChannelRedirect(${REDIRECT_VAR},test,hang-me-up,1)
+    same => n,ExecIf($[${CHANNELREDIRECT_STATUS}=NOCHANNEL]?UserEvent(TestResult,result:pass))
+    same => n,Hangup()
+
+exten => hang-me-up,1,NoOp()
+    same => n,Hangup()
+
+exten => echo,1,NoOp()
+    same => n,Echo()

Propchange: asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/channel_redirect/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/channel_redirect/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/channel_redirect/test-config.yaml?view=auto&rev=4813
==============================================================================
--- asterisk/trunk/tests/apps/channel_redirect/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/channel_redirect/test-config.yaml Sat Mar  8 10:43:47 2014
@@ -1,0 +1,155 @@
+test-info:
+    summary: 'Tests basic ChannelRedirect functionality.'
+    description:
+        The first scenario has a local channel send both ends into the Echo()
+        application. A second channel is then called that redirects the first channel
+        into another extension that hangs up immediately. CHANNELREDIRECT_STATUS
+        should then return SUCCESS.
+        The second scenario only calls one channel and tries to redirect a non-existent
+        channel to an extension. CHANNELREDIRECT_STATUS should return NOCHANNEL.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'apptest.AppTest'
+
+test-object-config:
+  app: 'ChannelRedirect'
+  scenarios:
+    -
+      # Scenario 1
+      # The first local channel sends both ends into the Echo() application. The second
+      # channel then redirects the first channel to an extension that hangs up.
+      # CHANNELREDIRECT_STATUS should then return SUCCESS.
+      channels:
+        -
+          channel-id: 'Receiving-channel'
+          channel-name: 'Local/receiving at test'
+          context: 'test'
+          exten: 'echo'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Channel: 'Local/receiving at test-.*'
+                  Extension: 'receiving'
+                  Application: 'Echo'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Receiving channel hit Echo'
+                -
+                  action-type: 'start-call'
+                  delay: 1
+                  channel-id: 'Initiating-channel'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/receiving at test-.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Receiving channel hung up'
+        -
+          channel-id: 'Initiating-channel'
+          channel-name: 'Local/initiating at test'
+          context: 'default'
+          exten: 'wait'
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+              requirements:
+                match:
+                  Result: 'pass'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Receiving channel successfully redirected'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Channel: 'Local/initiating at test-.*'
+                  Application: 'ChannelRedirect'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Initiating channel is redirecting receiving channel'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/initiating at test-.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Initiating channel hung up'
+                -
+                  action-type: 'end-scenario'
+    -
+      # Scenario 2
+      # A local channel attempts to redirect a non-existent channel. CHANNELREDIRECT_STATUS
+      # should return NOCHANNEL.
+      channels:
+        -
+          channel-id: 'Null-initiate'
+          channel-name: 'Local/null-initiate at test'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+              requirements:
+                match:
+                  Result: 'pass'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'CHANNELREDIRECT_STATUS returned NOCHANNEL'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Channel: 'Local/null-initiate at test-.*'
+                  Application: 'ChannelRedirect'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Initiating channel is attempting to redirect non-existent channel'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/null-initiate at test-.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Null-initiate channel hung up'
+                -
+                  action-type: 'end-scenario'
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - apps

Propchange: asterisk/trunk/tests/apps/channel_redirect/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/channel_redirect/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/channel_redirect/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/apps/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/tests.yaml?view=diff&rev=4813&r1=4812&r2=4813
==============================================================================
--- asterisk/trunk/tests/apps/tests.yaml (original)
+++ asterisk/trunk/tests/apps/tests.yaml Sat Mar  8 10:43:47 2014
@@ -17,3 +17,4 @@
     - dir: 'control_playback'
     - dir: 'playback'
     - test: 'say_interrupt'
+    - test: 'channel_redirect'




More information about the asterisk-commits mailing list