summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2012-09-27 11:33:54 +0000
committerJoshua Colp <jcolp@digium.com>2012-09-27 11:33:54 +0000
commit10eb78d213fe3bfa4c41ceb5dffe65491d9d0d1a (patch)
tree4449b3d503a208453d1ddfc4b0457795f3857d6a /channels
parentb6a780b923c32e8c217389be3dd05bd8c8d7ac1c (diff)
Fix an issue where Local channels dialed by app_queue are considered in use immediately.
The chan_local channel driver returns a device state of in use even if a created Local channel has not yet been dialed. This fix changes the logic to return a state of not in use until the channel itself has been dialed. (closes issue ASTERISK-20390) Reported by: tim_ringenbach Review: https://reviewboard.asterisk.org/r/2116/ ........ Merged revisions 373878 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 373879 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 373880 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373881 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_local.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index fcef1c7f1..4e0316670 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -311,11 +311,13 @@ static int local_devicestate(const char *data)
res = AST_DEVICE_NOT_INUSE;
it = ao2_iterator_init(locals, 0);
- while ((lp = ao2_iterator_next(&it))) {
+ while ((lp = ao2_iterator_next(&it)) && (res == AST_DEVICE_NOT_INUSE)) {
if (!strcmp(exten, lp->exten) && !strcmp(context, lp->context) && lp->owner) {
- res = AST_DEVICE_INUSE;
- ao2_ref(lp, -1);
- break;
+ ao2_lock(lp);
+ if (ast_test_flag(lp, LOCAL_LAUNCHED_PBX)) {
+ res = AST_DEVICE_INUSE;
+ }
+ ao2_unlock(lp);
}
ao2_ref(lp, -1);
}