aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-09 14:52:25 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-09 14:52:25 +0000
commit5bc12b2bf3368a5d360f29f9bdfa7aa89f699dac (patch)
treefb4462d9c9b6aaedccf38086ae6264d3d6ac8921
parent3258fe014a2a64df6d62454d3ecf4a598d917bb9 (diff)
Fix a problem with GROUP() settings on a masquerade.
The previous code carried over group settings from the old channel to the new one. However, it did nothing with the group settings that were already on the new channel. This patch removes all group settings that already existed on the new channel. I have a more complicated version of this patch which addresses only the most blatant problem with this, which is that a channel can end up with multiple group settings in the same category. However, I could not think of a use case for keeping any of the group settings from the old channel, so I went this route for now. (closes AST-152) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@161948 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/app.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/app.c b/main/app.c
index bad03e09b..88346f424 100644
--- a/main/app.c
+++ b/main/app.c
@@ -915,10 +915,15 @@ 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)
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&groups, gi, list) {
+ if (gi->chan == old) {
gi->chan = new;
+ } else if (gi->chan == new) {
+ AST_LIST_REMOVE_CURRENT(&groups, list);
+ free(gi);
+ }
}
+ AST_LIST_TRAVERSE_SAFE_END
AST_LIST_UNLOCK(&groups);
return 0;