]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Preserve the indication currently playing on a channel when a masquerade operation...
authorJoshua Colp <jcolp@digium.com>
Mon, 3 Dec 2007 18:40:56 +0000 (18:40 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 3 Dec 2007 18:40:56 +0000 (18:40 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@90548 65c4cc65-6c06-0410-ace0-fbb531ad65f3

.cleancount
include/asterisk/channel.h
main/channel.c

index f04c001f3f7fd5d290d0264b4a2c35f7b159ac42..64bb6b746dceaf12b0ba8c08f310b0426babde44 100644 (file)
@@ -1 +1 @@
-29
+30
index a05975a5658758b0ba54ef143136387556a39f50..7ee4bef11915b682a23b3dd99db5081f2e20ac5d 100644 (file)
@@ -437,6 +437,8 @@ struct ast_channel {
        unsigned int emulate_dtmf_duration;     /*!< Number of ms left to emulate DTMF for */
        struct timeval dtmf_tv;       /*!< The time that an in process digit began, or the last digit ended */
 
+       int visible_indication;                         /*!< Indication currently playing on the channel */
+
        /*! \brief Data stores on the channel */
        AST_LIST_HEAD_NOLOCK(datastores, ast_datastore) datastores;
 };
index 3c4af0f93f86d448abf0589ad22e8c14031f7006..25b4900db940577cc51bef728ebf7accb7fe14a6 100644 (file)
@@ -1817,6 +1817,7 @@ int ast_answer(struct ast_channel *chan)
        default:
                break;
        }
+       chan->visible_indication = 0;
        ast_channel_unlock(chan);
        return res;
 }
@@ -2608,6 +2609,7 @@ int ast_indicate_data(struct ast_channel *chan, int condition, const void *data,
                                        ast_log(LOG_DEBUG, "Driver for channel '%s' does not support indication %d, emulating it\n", chan->name, condition);
                                ast_playtones_start(chan,0,ts->data, 1);
                                res = 0;
+                               chan->visible_indication = condition;
                        } else if (condition == AST_CONTROL_PROGRESS) {
                                /* ast_playtones_stop(chan); */
                        } else if (condition == AST_CONTROL_PROCEEDING) {
@@ -2624,7 +2626,9 @@ int ast_indicate_data(struct ast_channel *chan, int condition, const void *data,
                                res = -1;
                        }
                }
-       }
+       } else
+               chan->visible_indication = condition;
+
        return res;
 }
 
@@ -3837,6 +3841,10 @@ int ast_do_masquerade(struct ast_channel *original)
        } else
                ast_log(LOG_WARNING, "Channel type '%s' does not have a fixup routine (for %s)!  Bad things may happen.\n",
                        original->tech->type, original->name);
+
+       /* If an indication is currently playing maintain it on the channel that is taking the place of original */
+       if (original->visible_indication)
+               ast_indicate(original, original->visible_indication);
        
        /* Now, at this point, the "clone" channel is totally F'd up.  We mark it as
           a zombie so nothing tries to touch it.  If it's already been marked as a