Merged revisions 131357 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Wed, 16 Jul 2008 19:37:42 +0000 (19:37 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 16 Jul 2008 19:37:42 +0000 (19:37 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r131357 | mmichelson | 2008-07-16 14:37:08 -0500 (Wed, 16 Jul 2008) | 6 lines

Apparently, "thread safety" is important, whatever
that means. :P

(Thanks Russell!)

........

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

apps/app_queue.c

index 8fc5698..dc9fa65 100644 (file)
@@ -3798,7 +3798,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                 * when the masquerade occurred. These other "ending" queue_log messages are unnecessary
                 */
                if (!attended_transfer_occurred(qe->chan)) {
                 * when the masquerade occurred. These other "ending" queue_log messages are unnecessary
                 */
                if (!attended_transfer_occurred(qe->chan)) {
-                       struct ast_datastore *transfer_ds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL);
+                       struct ast_datastore *transfer_ds;
                        if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
                                ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
                                        qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
                        if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
                                ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
                                        qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
@@ -3813,12 +3813,13 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                        (long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
                                send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
                        }
                                        (long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
                                send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
                        }
+                       ast_channel_lock(qe->chan);
+                       transfer_ds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL);
                        if (transfer_ds) {
                        if (transfer_ds) {
-                               ast_channel_lock(qe->chan);
                                ast_channel_datastore_remove(qe->chan, transfer_ds);
                                ast_channel_datastore_free(transfer_ds);
                                ast_channel_datastore_remove(qe->chan, transfer_ds);
                                ast_channel_datastore_free(transfer_ds);
-                               ast_channel_unlock(qe->chan);
                        }
                        }
+                       ast_channel_unlock(qe->chan);
                }
 
                if (bridge != AST_PBX_NO_HANGUP_PEER)
                }
 
                if (bridge != AST_PBX_NO_HANGUP_PEER)