[Asterisk-code-review] apps/dial: Add privacy test for call connection (testsuite[master])

Matt Jordan asteriskteam at digium.com
Sat Sep 3 15:59:51 CDT 2016


Matt Jordan has uploaded a new change for review.

  https://gerrit.asterisk.org/3812

Change subject: apps/dial: Add privacy test for call connection
......................................................................

apps/dial: Add privacy test for call connection

This patch is the first in a series that adds tests for the privacy (P)
and screening (p) options for the Dial application. As such, it consists
of two parts:

(1) It adds a common extensions.conf that will be used by all the tests.
    Since the privacy and screening options include recording a name
    prompt on the caller side and DTMF selection on the callee side, the
    Test Suite AppTest module will be used.

(2) It adds the first test in the series, a test that covers the privacy
    mode where the callee chooses to connect the call. The test does
    basic verification that key sound prompts are played and that the
    call is indeed bridged.

ASTERISK-25691

Change-Id: I1c5143c546c88dc91dee94de8f93445d442d7d81
---
A tests/apps/dial/privacy/configs/extensions.conf
A tests/apps/dial/privacy/privacy/connect-call/test-config.yaml
A tests/apps/dial/privacy/privacy/tests.yaml
A tests/apps/dial/privacy/tests.yaml
M tests/apps/dial/tests.yaml
5 files changed, 210 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/12/3812/1

diff --git a/tests/apps/dial/privacy/configs/extensions.conf b/tests/apps/dial/privacy/configs/extensions.conf
new file mode 100644
index 0000000..69d64cc
--- /dev/null
+++ b/tests/apps/dial/privacy/configs/extensions.conf
@@ -0,0 +1,35 @@
+[default]
+
+exten => test_privacy,1,NoOp()
+	same => n,Set(CALLERID(num)=5551234)
+	same => n,Dial(Local/farend at default,,gP)
+	same => n,UserEvent(DialStatus, Result: ${DIALSTATUS})
+	same => n,Hangup()
+
+exten => test_screening,1,NoOp()
+	same => n,Set(CALLERID(num)=5551234)
+	same => n,Dial(Local/farend at default,,gp)
+	same => n,UserEvent(DialStatus,Result: ${DIALSTATUS})
+	same => n,Hangup()
+
+exten => farend,1,NoOp()
+	same => n,Set(testuniqueid=farend)
+	same => n,Set(appchannel=${CHANNEL:0:-2}\;1)
+	same => n,Answer()
+	same => n,Goto(default,wait,1)
+
+exten => sendAudio,1,NoOp()
+	same => n,Playback(${TALK_AUDIO})
+	same => n,Goto(default,wait,1)
+
+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 => hangup,1,NoOp()
+	same => n,Verbose(1, Hanging up)
+	same => n,Hangup()
+
+exten => wait,1,NoOp()
+	same => n,Wait(10000)
diff --git a/tests/apps/dial/privacy/privacy/connect-call/test-config.yaml b/tests/apps/dial/privacy/privacy/connect-call/test-config.yaml
new file mode 100644
index 0000000..d820990
--- /dev/null
+++ b/tests/apps/dial/privacy/privacy/connect-call/test-config.yaml
@@ -0,0 +1,166 @@
+testinfo:
+    summary: 'Test Privacy where the call is connected'
+    description: |
+        'This test covers the privacy option (P) where the called
+        party chooses to connect the call. The test verifies some
+        basic properties of the Privacy mode, including the recording
+        of the name of the caller, along with the resulting DIALSTATUS.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: apptest.AppTest
+    modules:
+        -
+            config-section: asterisk-config
+            typename: pluggable_modules.AsteriskConfigModule
+
+asterisk-config:
+    -
+        src: 'tests/apps/dial/privacy/configs/extensions.conf'
+        dst: 'extensions.conf'
+
+test-object-config:
+  app: 'Dial'
+  scenarios:
+    -
+      channels:
+        -
+          channel-id: 'Test-User'
+          channel-name: 'Local/test_privacy at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Context: 'default'
+                  Extension: 'wait'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'beep'
+              actions:
+                -
+                  action-type: 'stream-audio-with-dtmf'
+                  sound-file: 'agent-loginok'
+                  dtmf: '#'
+                  dtmf-delay: 4
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'vm-dialout'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Dial out commencing and announced'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'BridgeEnter'
+                  Channel: 'Local/test_privacy at default-00000000;2'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Bridge of test_privacy half occurred'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'DialStatus'
+                  Result: 'ANSWER'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'DIALSTATUS is ANSWER'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Channel test_privacy hungup'
+        -
+          # This channel is dialed; as a result, we don't control
+          # it when it goes into an application. Instead, channel
+          # variables set in the dialplan will inform apptest that
+          # it can be controlled
+          channel-id: 'Farend'
+          channel-name: 'Local/farend at default'
+          testuniqueid: 'farend'
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'priv-callerintros/5551234.*'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Calling party name played to called party'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Message: 'priv-callee-options'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Options played to far end'
+                -
+                  action-type: 'send-dtmf'
+                  delay: 1
+                  dtmf: '1'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'BridgeEnter'
+                  Channel: 'Local/farend at default-00000001;1'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Bridge of farend half occurred'
+                -
+                  action-type: 'hangup'
+                  delay: 3
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Channel farend hungup'
+
+
+properties:
+    minversion: '13.12.0'
+    tags:
+      - apps
+      - dial
+    dependencies:
+      - buildoption: 'TEST_FRAMEWORK'
+      - python : 'twisted'
+      - python : 'starpy'
+      - asterisk : 'app_senddtmf'
+      - asterisk : 'app_dial'
+
diff --git a/tests/apps/dial/privacy/privacy/tests.yaml b/tests/apps/dial/privacy/privacy/tests.yaml
new file mode 100644
index 0000000..5c6dc0d
--- /dev/null
+++ b/tests/apps/dial/privacy/privacy/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'connect-call'
+
diff --git a/tests/apps/dial/privacy/tests.yaml b/tests/apps/dial/privacy/tests.yaml
new file mode 100644
index 0000000..f70df47
--- /dev/null
+++ b/tests/apps/dial/privacy/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - dir: 'privacy'
+
diff --git a/tests/apps/dial/tests.yaml b/tests/apps/dial/tests.yaml
index 36cf8be..2a7686c 100644
--- a/tests/apps/dial/tests.yaml
+++ b/tests/apps/dial/tests.yaml
@@ -12,3 +12,4 @@
     - dir: 'mid_call_events'
     - dir: 'action_post_answer'
     - test: 'peer_h_exten'
+    - dir: 'privacy'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c5143c546c88dc91dee94de8f93445d442d7d81
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list