[Asterisk-code-review] channels/pjsip/qualify/call unreachable: Trigger on a more r... (testsuite[master])

Richard Mudgett asteriskteam at digium.com
Thu Oct 19 17:35:11 CDT 2017


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/6844


Change subject: channels/pjsip/qualify/call_unreachable: Trigger on a more reliable event
......................................................................

channels/pjsip/qualify/call_unreachable: Trigger on a more reliable event

On my test box, the test occasionally never saw the ContactStatus event on
the AMI connection.  The ContactStatus event is only sent once per status
change and likely got "sent" before the test established the AMI
connection.  The test was using that event to trigger sending the
Originate action and thus the test fails.

* Switch to using the TEST_FRAMEWORK test event 'TestEvent' for the
AOR_CONTACT_QUALIFY_RESULT state.  This event is sent periodically and is
a more reliable trigger event to initiate the Originate action.

* Added some more test failure checks.

Change-Id: Id9500c988b4f6cac44783fcd7663dc2cbef4add5
---
M tests/channels/pjsip/qualify/call_unreachable/configs/ast1/extensions.conf
M tests/channels/pjsip/qualify/call_unreachable/test-config.yaml
2 files changed, 36 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/44/6844/1

diff --git a/tests/channels/pjsip/qualify/call_unreachable/configs/ast1/extensions.conf b/tests/channels/pjsip/qualify/call_unreachable/configs/ast1/extensions.conf
index a1dec5e..3f8e15a 100644
--- a/tests/channels/pjsip/qualify/call_unreachable/configs/ast1/extensions.conf
+++ b/tests/channels/pjsip/qualify/call_unreachable/configs/ast1/extensions.conf
@@ -3,14 +3,21 @@
 
 ; -- Audio Source --
 
+; We should never execute this section of dialplan.
+; If we do then the unreachable endpoint answered!
 exten => playback,1,NoOp()
- same => n,Answer()
- same => n,Playback(tt-monkeys)
+ same => n,UserEvent(failed)
+ same => n,Playback(tt-weasels)
  same => n,Hangup()
 
 ; -- Sender --
 
+; The unreachable endpoint should fail to dial immediately.
 exten => 1000,1,NoOp()
- same => n,Dial(PJSIP/test)
- same => n,ExecIf($[${DIALSTATUS}=CHANUNAVAIL]?UserEvent(success)
+ same => n,Dial(PJSIP/test,10)
+ same => n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"]?unavail
+ same => n,UserEvent(failed)
  same => n,Hangup()
+ same => n(unavail),UserEvent(success)
+ same => n,Hangup()
+
diff --git a/tests/channels/pjsip/qualify/call_unreachable/test-config.yaml b/tests/channels/pjsip/qualify/call_unreachable/test-config.yaml
index 2f7a579..99409f8 100644
--- a/tests/channels/pjsip/qualify/call_unreachable/test-config.yaml
+++ b/tests/channels/pjsip/qualify/call_unreachable/test-config.yaml
@@ -26,13 +26,17 @@
         ami-events:
             conditions:
                 match:
-                    Event: 'ContactStatus'
-                    ContactStatus: 'Unreachable'
-                    AOR: 'test'
+                    Event: 'TestEvent'
+                    Type: 'StateChange'
+                    State: 'AOR_CONTACT_QUALIFY_RESULT'
             requirements:
                 match:
-                    EndpointName: 'test'
-            count: '1'
+                    Status: 'Unreachable'
+            # We have to wait for the second event just in case
+            # the first event happens too early and the unreachable
+            # ContactStatus state has not been set yet.
+            count: '>2'
+            trigger-on-count: True
         ami-actions:
             action:
                 Action: 'Originate'
@@ -43,12 +47,21 @@
                 Priority: '1'
     -
         ami-events:
+          -
+            id: '0'
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'failed'
+            count: '0' # shouldn't receive any of these
+          -
             id: '0'
             conditions:
                 match:
                     Event: 'UserEvent'
                     UserEvent: 'success'
-            count: 1
+            count: '1'
+        stop_test:
 
 hangup-monitor:
     ids: '0'
@@ -56,5 +69,11 @@
 properties:
     minversion: '13.17.0'
     dependencies:
+        - buildoption: 'TEST_FRAMEWORK'
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'app_dial'
+        - asterisk : 'app_playback'
+        - asterisk : 'app_userevent'
         - asterisk : 'res_pjsip'
 

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9500c988b4f6cac44783fcd7663dc2cbef4add5
Gerrit-Change-Number: 6844
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171019/95a994df/attachment-0001.html>


More information about the asterisk-code-review mailing list