]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Re-fix queue round-robin
authorTerry Wilson <twilson@digium.com>
Fri, 6 May 2011 07:55:21 +0000 (07:55 +0000)
committerTerry Wilson <twilson@digium.com>
Fri, 6 May 2011 07:55:21 +0000 (07:55 +0000)
This part of the change for r315596 was incorrect. No bridge occurs
when doing a roundrobin dial and no one answers, so this code shouldn't
have been removed.

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

apps/app_queue.c

index a2447d43eb2edcf2a24520bf8067b9fc6ca58e54..7f34d1fc30f1e59a0e94a0ac13ba374349c81025 100644 (file)
@@ -3047,6 +3047,17 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
        if (need_weight)
                AST_LIST_UNLOCK(&queues);
        lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed);
+       /* The ast_channel_datastore_remove() function could fail here if the
+        * datastore was moved to another channel during a masquerade. If this is
+        * the case, don't free the datastore here because later, when the channel
+        * to which the datastore was moved hangs up, it will attempt to free this
+        * datastore again, causing a crash
+        */
+       ast_channel_lock(qe->chan);
+       if (datastore && !ast_channel_datastore_remove(qe->chan, datastore)) {
+               ast_channel_datastore_free(datastore);
+       }
+       ast_channel_unlock(qe->chan);
        ao2_lock(qe->parent);
        if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_RRORDERED) {
                store_next(qe, outgoing);