[Asterisk-code-review] Testsuite: Fix sporadic failures in attended transfer tests. (testsuite[master])
John Bigelow
asteriskteam at digium.com
Wed Nov 11 14:38:48 CST 2015
John Bigelow has uploaded a new change for review.
https://gerrit.asterisk.org/1605
Change subject: Testsuite: Fix sporadic failures in attended transfer tests.
......................................................................
Testsuite: Fix sporadic failures in attended transfer tests.
These tests would sometimes fail due to the SIPp scenarios receiving an
unexpected BYE while expecting a COLP update. The problem was that the
channel for charlie & alice (SIPp #1) would be hung up to quickly after
the transfer. This would cause a BYE to be sent to the alice channel
before the expected COLP update would occur.
This fixes the problem by triggering the hang up upon the COLP updates
occurring rather than the channel hang ups as a result of the transfer.
This does not fix the failure originally reported as it could not be
reproduced.
ASTERISK-25536 #close
Reported By: Kevin Harwell
Change-Id: I15413539945424cf1ff604f2b0cfa7ede94acaf8
---
D tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/attended_transfer.py
M tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
D tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/attended_transfer.py
M tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
4 files changed, 46 insertions(+), 69 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/05/1605/1
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/attended_transfer.py b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/attended_transfer.py
deleted file mode 100755
index dcb3444..0000000
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/attended_transfer.py
+++ /dev/null
@@ -1,21 +0,0 @@
-"""
-Copyright (C) 2014, Digium, Inc.
-Kinsey Moore <kmoore at digium.com>
-
-This program is free software, distributed under the terms of
-the GNU General Public License Version 2.
-"""
-
-import logging
-
-LOGGER = logging.getLogger(__name__)
-
-HUNGUP = 0
-
-def transfer_complete(ami, event):
- global HUNGUP
- HUNGUP += 1
- if HUNGUP == 2:
- LOGGER.debug("Hanging up all charlie channels")
- ami.hangup("/^PJSIP/charlie-.*$/")
- return True
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
index 033ced7..e296325 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local/test-config.yaml
@@ -12,14 +12,13 @@
SIPp #1 and SIPp #4 are hung up."
test-modules:
- add-test-to-search-path: True
test-object:
config-section: test-object-config
typename: sipp.SIPpTestCase
modules:
-
config-section: ami-config
- typename: 'ami.AMIEventModule'
+ typename: 'pluggable_modules.EventActionModule'
test-object-config:
fail-on-any: True
@@ -33,19 +32,29 @@
ami-config:
-
- type: 'headermatch'
- conditions:
- match:
- Event: 'AttendedTransfer'
- Result: 'Success'
- count: 1
+ ami-events:
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'AttendedTransfer'
+ Result: 'Success'
+ count: 1
+ # Ensure COLP updates occur for alice and charlie before hanging up.
-
- type: 'callback'
- conditions:
- match:
- Event: 'Hangup'
- callbackModule: 'attended_transfer'
- callbackMethod: 'transfer_complete'
+ ami-events:
+ conditions:
+ match:
+ Event: 'NewConnectedLine'
+ Channel: 'PJSIP/charlie-.*|PJSIP/alice-.*'
+ ChannelStateDesc: 'Up'
+ ConnectedLineNum: 'alice|charlie'
+ ConnectedLineName: 'Alice|Charlie'
+ count: '>2'
+ trigger-on-count: True
+ ami-actions:
+ action:
+ action: 'Hangup'
+ channel: '/^PJSIP/charlie-.*$/'
properties:
minversion: '12.0.0'
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/attended_transfer.py b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/attended_transfer.py
deleted file mode 100755
index dcb3444..0000000
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/attended_transfer.py
+++ /dev/null
@@ -1,21 +0,0 @@
-"""
-Copyright (C) 2014, Digium, Inc.
-Kinsey Moore <kmoore at digium.com>
-
-This program is free software, distributed under the terms of
-the GNU General Public License Version 2.
-"""
-
-import logging
-
-LOGGER = logging.getLogger(__name__)
-
-HUNGUP = 0
-
-def transfer_complete(ami, event):
- global HUNGUP
- HUNGUP += 1
- if HUNGUP == 2:
- LOGGER.debug("Hanging up all charlie channels")
- ami.hangup("/^PJSIP/charlie-.*$/")
- return True
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
index ac8c670..4bf00e1 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local/test-config.yaml
@@ -22,7 +22,7 @@
modules:
-
config-section: ami-config
- typename: 'ami.AMIEventModule'
+ typename: 'pluggable_modules.EventActionModule'
test-object-config:
fail-on-any: True
@@ -35,19 +35,29 @@
ami-config:
-
- type: 'headermatch'
- conditions:
- match:
- Event: 'AttendedTransfer'
- Result: 'Success'
- count: 1
+ ami-events:
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'AttendedTransfer'
+ Result: 'Success'
+ count: 1
+ # Ensure COLP updates occur for alice and charlie before hanging up.
-
- type: 'callback'
- conditions:
- match:
- Event: 'Hangup'
- callbackModule: 'attended_transfer'
- callbackMethod: 'transfer_complete'
+ ami-events:
+ conditions:
+ match:
+ Event: 'NewConnectedLine'
+ Channel: 'PJSIP/charlie-.*|PJSIP/alice-.*'
+ ChannelStateDesc: 'Up'
+ ConnectedLineNum: 'alice|charlie'
+ ConnectedLineName: 'Alice|Charlie'
+ count: '>2'
+ trigger-on-count: True
+ ami-actions:
+ action:
+ action: 'Hangup'
+ channel: '/^PJSIP/charlie-.*$/'
properties:
minversion: '12.0.0'
--
To view, visit https://gerrit.asterisk.org/1605
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I15413539945424cf1ff604f2b0cfa7ede94acaf8
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: John Bigelow <jbigelow at digium.com>
More information about the asterisk-code-review
mailing list