[Asterisk-code-review] app_originate: Tests for variables (testsuite[16])

Friendly Automation asteriskteam at digium.com
Fri Jun 11 11:36:13 CDT 2021


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/16085 )

Change subject: app_originate: Tests for variables
......................................................................

app_originate: Tests for variables

Tests to ensure correct behavior
of Caller ID and variable
functionality added to Originate.

ASTERISK-29450

Change-Id: Ia63cf95a5a06257d4cfd856c029d6296abd82d9b
---
A tests/apps/originate/configs/ast1/extensions.conf
A tests/apps/originate/test-config.yaml
M tests/apps/tests.yaml
3 files changed, 95 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/apps/originate/configs/ast1/extensions.conf b/tests/apps/originate/configs/ast1/extensions.conf
new file mode 100644
index 0000000..adf5648
--- /dev/null
+++ b/tests/apps/originate/configs/ast1/extensions.conf
@@ -0,0 +1,35 @@
+[default]
+exten => s,1,Answer(1)
+	same => n,Set(CALLERID(num)=13115552368)
+	same => n,Set(CALLERID(name)=Bell Labs)
+	same => n,Set(CALLERID(pres)=prohib_not_screened)
+	same => n,Originate(Local/0 at orig-dest,exten,orig-dest,1,1,,av(mytestvar=42))
+	same => n,Originate(Local/0 at orig-dest,exten,orig-dest,2,1,,av(__mytestvar=24))
+	same => n,Originate(Local/0 at orig-dest,exten,orig-dest,3,1,,av(bunny=bear^dog=cat^mytestvar=ice-cream))
+	same => n,Originate(Local/0 at orig-dest,exten,orig-dest,4,1,,av(fish=salmon^CALLERID(num)=${CALLERID(num)}^arctic=polar_bear))
+	same => n,Originate(Local/0 at orig-dest,exten,orig-dest,5,1,,av(CALLERID(pres)=${CALLERID(pres)}^CALLERID(name)=${CALLERID(name)}))
+	same => n,Originate(Local/0 at orig-dest,exten,orig-dest,6,1,,av(CALLERID(pres)=${CALLERID(pres)}^CALLERID(name)=${CALLERID(name)}))
+	same => n,Originate(Local/7 at orig-dest,app,Wait,2,,,acn)
+	same => n,Originate(Local/8 at orig-dest,app,Wait,2,,,ac(18005551212)n(Directory Assis))
+	same => n,GotoIf($["${ORIGINATE_STATUS}"="SUCCESS"]?orig-dest,pass,1:orig-dest,fail,1)
+
+[orig-dest]
+exten => 0,1,Answer(1)
+	same => n,Wait(2)
+	same => n,Hangup()
+exten => 1,1,GotoIf($["${mytestvar}"="42"]?pass,1:fail,1)
+exten => 2,1,GotoIf($["${mytestvar}"="24"]?pass,1:fail,1)
+exten => 3,1,GotoIf($["${mytestvar}"="ice-cream"]?pass,1:fail,1)
+exten => 4,1,GotoIf($["${CALLERID(num)}"="13115552368"]?pass,1:fail,1)
+exten => 5,1,GotoIf($["${CALLERID(name)}"="Bell Labs"]?pass,1:fail,1)
+exten => 6,1,GotoIf($["${CALLERID(pres)}"="prohib_not_screened"]?pass,1:fail,1)
+exten => 7,1,GotoIf($["${CALLERID(num)}"!="13115552368"]?fail,1)
+	same => n,GotoIf($["${CALLERID(name)}"="Bell Labs"]?pass,1:fail,1)
+exten => 8,1,GotoIf($["${CALLERID(num)}"!="18005551212"]?fail,1)
+	same => n,GotoIf($["${CALLERID(name)}"="Directory Assis"]?pass,1:fail,1)
+exten => pass,1,Answer(1)
+	same => n,UserEvent(OriginateVariableSet,Result: Pass)
+	same => n,Hangup()
+exten => fail,1,Answer(1)
+	same => n,UserEvent(OriginateVariableSet,Result: Fail ${ORIGINATE_STATUS},Reason: ${mytestvar})
+	same => n,Hangup()
\ No newline at end of file
diff --git a/tests/apps/originate/test-config.yaml b/tests/apps/originate/test-config.yaml
new file mode 100644
index 0000000..93c324e
--- /dev/null
+++ b/tests/apps/originate/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary: 'Ensure that Originate work as intended.'
+    description: |
+        'This tests multiple Originate scenarios with
+        Caller ID and variables on each channel to
+        ensure that they are set properly.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: caller-originator
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-monitor
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    connect-ami: True
+
+caller-originator:
+    channel: 'Local/s at default'
+    context: 'orig-dest'
+    exten: '0'
+    priority: '1'
+    trigger: 'ami_connect'
+
+hangup-monitor:
+    ids: '0'
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'OriginateVariableSet'
+            requirements:
+                match:
+                    Result: 'Pass'
+            count: 9
+        stop_test:
+
+properties:
+    tags:
+        - dial
+        - apps
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_userevent'
+        - asterisk: 'app_originate'
+        - asterisk: 'pbx_config'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index c4a6cce..a00c9d1 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -4,6 +4,7 @@
     - dir: 'directory'
     - dir: 'bridge'
     - dir: 'dial'
+    - test: 'originate'
     - dir: 'voicemail'
     - dir: 'incomplete'
     - dir: 'confbridge'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/16085
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: Ia63cf95a5a06257d4cfd856c029d6296abd82d9b
Gerrit-Change-Number: 16085
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210611/b676cba4/attachment.html>


More information about the asterisk-code-review mailing list