]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 373879 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Thu, 27 Sep 2012 12:28:44 +0000 (12:28 +0000)
committerAutomerge script <automerge@asterisk.org>
Thu, 27 Sep 2012 12:28:44 +0000 (12:28 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r373879 | file | 2012-09-27 06:32:13 -0500 (Thu, 27 Sep 2012) | 14 lines

  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
................

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

channels/chan_local.c

index 325e9d725618599930e9345c888e44af33f12118..f81aa956644cb06ab00ce5d6ec0d327818846620 100644 (file)
@@ -307,11 +307,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);
        }