]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix an issue where Local channels dialed by app_queue are considered in use immediately.
authorJoshua Colp <jcolp@digium.com>
Thu, 27 Sep 2012 11:31:23 +0000 (11:31 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 27 Sep 2012 11:31:23 +0000 (11:31 +0000)
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/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@373878 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_local.c

index dde6174fe4c139352390b11884de6c3c116f76a2..a7d31a728e8bd4f543d3f681a718bd1357e80505 100644 (file)
@@ -308,11 +308,13 @@ static int local_devicestate(void *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);
        }