]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Convert call to park_call_full to masq_park_call_announce
authorTerry Wilson <twilson@digium.com>
Thu, 15 Jan 2009 18:22:49 +0000 (18:22 +0000)
committerTerry Wilson <twilson@digium.com>
Thu, 15 Jan 2009 18:22:49 +0000 (18:22 +0000)
Since we removed the AST_PBX_KEEPALIVE return value, we need to use masqueraded
parking, otherwise we will try to call ast_hangup() in __pbx_run() and in
do_parking_thread() and then promptly crash.
(closes issue #14215)
Reported by: waverly360
Tested by: otherwiseguy
(closes issue #14228)
Reported by: kobaz
Tested by: otherwiseguy

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

res/res_features.c

index e476676f479e6c61de4edecd2e47568fe122f16c..aaa1ff593e8c40300c1c474af70b8397c8a58950 100644 (file)
@@ -176,8 +176,6 @@ struct ast_bridge_thread_obj
        struct ast_channel *peer;
 };
 
-
-
 /*! \brief store context, priority and extension */
 static void set_c_e_p(struct ast_channel *chan, const char *context, const char *ext, int pri)
 {
@@ -512,6 +510,10 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, i
                ast_frfree(f);
        }
 
+       if (peer == rchan) {
+               peer = chan;
+       }
+
        if (!play_announcement) {
                orig_chan_name = ast_strdupa(chan->name);
        }
@@ -1927,6 +1929,10 @@ static void *do_parking_thread(void *ignore)
 
                                                ast_channel_unlock(chan);
 
+                                               if (!strncmp(peername, "Parked/", 7)) {
+                                                       peername += 7;
+                                               }
+
                                                if (dialfeatures)
                                                        snprintf(returnexten, sizeof(returnexten), "%s|30|%s", peername, dialfeatures->options);
                                                else /* Existing default */
@@ -2059,7 +2065,6 @@ static int park_call_exec(struct ast_channel *chan, void *data)
        /* Cache the original channel name in case we get masqueraded in the middle
         * of a park--it is still theoretically possible for a transfer to happen before
         * we get here, but it is _really_ unlikely */
-       char *orig_chan_name = ast_strdupa(chan->name);
        char orig_exten[AST_MAX_EXTENSION];
        int orig_priority = chan->priority;
 
@@ -2084,11 +2089,7 @@ static int park_call_exec(struct ast_channel *chan, void *data)
                res = ast_safe_sleep(chan, 1000);
        /* Park the call */
        if (!res) {
-               res = park_call_full(chan, chan, 0, NULL, orig_chan_name);  /* In experiments, using the masq_park_call
-                                                                                                                                          func here yielded no difference with 
-                                                                                                                                          current implementation. I saw no advantage
-                                                                                                                                          in calling it instead.
-                                                                                                                                        */
+               res = masq_park_call_announce(chan, chan, 0, NULL);
                /* Continue on in the dialplan */
                if (res == 1) {
                        ast_copy_string(chan->exten, orig_exten, sizeof(chan->exten));