diff options
-rw-r--r-- | include/asterisk/app.h | 3 | ||||
-rw-r--r-- | main/app.c | 14 | ||||
-rw-r--r-- | main/channel.c | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/include/asterisk/app.h b/include/asterisk/app.h index 2106fe6b3..1c6dca0e7 100644 --- a/include/asterisk/app.h +++ b/include/asterisk/app.h @@ -225,6 +225,9 @@ int ast_app_group_match_get_count(const char *groupmatch, const char *category); /*! Discard all group counting for a channel */ int ast_app_group_discard(struct ast_channel *chan); +/*! Update all group counting for a channel to a new one */ +int ast_app_group_update(struct ast_channel *old, struct ast_channel *new); + /*! Lock the group count list */ int ast_app_group_list_lock(void); diff --git a/main/app.c b/main/app.c index ef25e1ba5..89fdb26d4 100644 --- a/main/app.c +++ b/main/app.c @@ -872,6 +872,20 @@ int ast_app_group_match_get_count(const char *groupmatch, const char *category) return count; } +int ast_app_group_update(struct ast_channel *old, struct ast_channel *new) +{ + struct ast_group_info *gi = NULL; + + AST_LIST_LOCK(&groups); + AST_LIST_TRAVERSE(&groups, gi, list) { + if (gi->chan == old) + gi->chan = new; + } + AST_LIST_UNLOCK(&groups); + + return 0; +} + int ast_app_group_discard(struct ast_channel *chan) { struct ast_group_info *gi = NULL; diff --git a/main/channel.c b/main/channel.c index bf1c9fec8..5c5b4899c 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3611,7 +3611,7 @@ int ast_do_masquerade(struct ast_channel *original) original->fds[x] = clone->fds[x]; } - ast_app_group_discard(original); + ast_app_group_update(clone, original); /* move any whisperer over */ ast_channel_whisper_stop(original); |