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

Jenkins2 asteriskteam at digium.com
Mon Oct 23 07:59:07 CDT 2017


Jenkins2 has submitted this change and it was merged. ( 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(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



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: merged
Gerrit-Change-Id: Id9500c988b4f6cac44783fcd7663dc2cbef4add5
Gerrit-Change-Number: 6844
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171023/3c936934/attachment-0001.html>


More information about the asterisk-code-review mailing list