Merged revisions 90548 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Mon, 3 Dec 2007 18:44:16 +0000 (18:44 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 3 Dec 2007 18:44:16 +0000 (18:44 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r90548 | file | 2007-12-03 14:40:56 -0400 (Mon, 03 Dec 2007) | 2 lines

Preserve the indication currently playing on a channel when a masquerade operation happens. (issue #BE-88)

........

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

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

index f5c8955..bb95160 100644 (file)
@@ -1 +1 @@
-32
+33
index aea8f4d..8a20d3b 100644 (file)
@@ -505,6 +505,7 @@ struct ast_channel {
        int epfd;
        struct ast_epoll_data *epfd_data[AST_MAX_FDS];
 #endif
        int epfd;
        struct ast_epoll_data *epfd_data[AST_MAX_FDS];
 #endif
+       int visible_indication;                         /*!< Indication currently playing on the channel */
 };
 
 /*! \brief ast_channel_tech Properties */
 };
 
 /*! \brief ast_channel_tech Properties */
index 2194859..f0ee9e7 100644 (file)
@@ -1519,7 +1519,7 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
        default:
                break;
        }
        default:
                break;
        }
-
+       chan->visible_indication = 0;
        ast_channel_unlock(chan);
 
        return res;
        ast_channel_unlock(chan);
 
        return res;
@@ -2557,6 +2557,7 @@ int ast_indicate_data(struct ast_channel *chan, int condition, const void *data,
                                ast_debug(1, "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;
                                ast_debug(1, "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) {
                        } else if (condition == AST_CONTROL_PROGRESS) {
                                /* ast_playtones_stop(chan); */
                        } else if (condition == AST_CONTROL_PROCEEDING) {
@@ -2573,7 +2574,9 @@ int ast_indicate_data(struct ast_channel *chan, int condition, const void *data,
                                res = -1;
                        }
                }
                                res = -1;
                        }
                }
-       }
+       } else
+               chan->visible_indication = condition;
+
        return res;
 }
 
        return res;
 }
 
@@ -3724,6 +3727,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);
        } 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
        
        /* 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