]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix app_dial ring groups
authorTerry Wilson <twilson@digium.com>
Wed, 18 May 2011 19:56:08 +0000 (19:56 +0000)
committerTerry Wilson <twilson@digium.com>
Wed, 18 May 2011 19:56:08 +0000 (19:56 +0000)
Revert part of r315643. We need to remove the datastore here as well.
The code in bridging code will catch anything that app_dial might miss.

(closes issue #19311)
Reported by: mspuhler
Patches:
      issue_19311_no_answer.diff uploaded by elguero (license 37)

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

apps/app_dial.c

index fec1c9b72934f7ad27c423c37359e45c367e9946..9434047f8b0ca32b202d5c656fcec2f39e95bac5 100644 (file)
@@ -1453,6 +1453,17 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
        time(&start_time);
        peer = wait_for_answer(chan, outgoing, &to, peerflags, &sentringing, status, sizeof(status), numbusy, numnochan, numcongestion, ast_test_flag(&opts, OPT_PRIORITY_JUMP), &result);
 
+       /* 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(chan);
+       if (!ast_channel_datastore_remove(chan, datastore)) {
+               ast_channel_datastore_free(datastore);
+       }
+       ast_channel_unlock(chan);
        if (!peer) {
                if (result) {
                        res = result;