[Asterisk-code-review] app_sf: Add tests for app_sf module (testsuite[19])

N A asteriskteam at digium.com
Wed Jan 5 09:48:55 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/17831 )


Change subject: app_sf: Add tests for app_sf module
......................................................................

app_sf: Add tests for app_sf module

Adds tests for SendSF, ReceiveSF, and SF
dial integration.

ASTERISK-29802

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



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/31/17831/1

diff --git a/tests/apps/sf/configs/ast1/extensions.conf b/tests/apps/sf/configs/ast1/extensions.conf
new file mode 100644
index 0000000..215974b
--- /dev/null
+++ b/tests/apps/sf/configs/ast1/extensions.conf
@@ -0,0 +1,43 @@
+
+[default]
+exten => s,1,Answer()
+	same => n,Set(GLOBAL(sendsf1)=111111)
+	same => n,Set(GLOBAL(sendsf2)=1234567890)
+	same => n,Set(GLOBAL(sendsf3)=4652544465)
+	same => n,Set(GLOBAL(sendsf4)=996512350)
+	same => n,Set(GLOBAL(sendsf5)=10104345)
+	same => n,Set(GLOBAL(sendsf6)=056863456)
+	same => n,Set(GLOBAL(sendsf7)=723503763)
+	same => n,Set(GLOBAL(sendsf8)=567565967)
+	same => n,Set(GLOBAL(sendsf9)=6565546)
+	same => n,Set(i=0)
+	same => n,While($[${INC(i)}<=8])
+	same => n,Originate(Local/${i}@send-sf,exten,receive-sf,${i},1,,a)
+	same => n,EndWhile()
+	same => n,Dial(Local/9 at receive-sf,,D(:::::${sendsf9}))
+	same => n,Hangup()
+
+[nothing]
+exten => 0,1,Answer()
+	same => n,Wait(15) ; enough time for sendsf9 to send. must be greater than ReceiveSF timeout.
+	same => n,Hangup()
+
+[send-sf]
+exten => _X!,1,Answer(0.5)
+	same => n,SendSF(${sendsf${EXTEN}})
+	same => n,Wait(44) ; needed so ReceiveSF has time to finish.
+	same => n,Hangup()
+
+[receive-sf]
+exten => _X!,1,Answer()
+	same => n,ReceiveSF(digits,${LEN(${sendsf${EXTEN}})})
+	same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
+exten => 9,1,Progress()
+	same => n,ReceiveSF(digits,,10)
+	same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
+exten => success,1,Answer(1)
+	same => n,UserEvent(ReceiveSFSuccess,Result: Pass)
+	same => n,Hangup()
+exten => fail,1,Answer(1)
+	same => n,UserEvent(ReceiveSFSuccess,Result: Fail ${RECEIVESFSTATUS} ${digits},Reason: ${digits})
+	same => n,Hangup()
diff --git a/tests/apps/sf/test-config.yaml b/tests/apps/sf/test-config.yaml
new file mode 100644
index 0000000..edd7b2f
--- /dev/null
+++ b/tests/apps/sf/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary: 'Ensure that app_sf module functions correctly.'
+    description: |
+        'This tests the SendSF and ReceiveSF applications as
+        well as Dial D option work correctly.'
+
+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: 'nothing'
+    exten: '0'
+    priority: '1'
+    trigger: 'ami_connect'
+
+hangup-monitor:
+    ids: '0'
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'ReceiveSFSuccess'
+            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: 'app_sf'
+        - asterisk: 'pbx_config'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index 5b59498..6dd267f 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -27,4 +27,5 @@
     - test: 'waitdigit'
     - dir: 'sendtext'
     - test: 'mf'
+    - test: 'sf'
     - test: 'read'

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

Gerrit-Project: testsuite
Gerrit-Branch: 19
Gerrit-Change-Id: Ieacd700811b26d336e9ce8422a7785547fd40c6f
Gerrit-Change-Number: 17831
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220105/453231c3/attachment.html>


More information about the asterisk-code-review mailing list