aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-07 21:39:52 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-07 21:39:52 +0000
commit0870f9f84a98a3f9f1c6a848e4472be77efa6497 (patch)
tree68d77327e950e350142689577dc192bf9d59993e
parent3c4a8564079c294e0fb47d8387ed95844e5d4770 (diff)
Properly handle what happens during a masquerade in relation to group counting. (issue #9657 reported by ramonpeek)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@63285 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--app.c14
-rw-r--r--channel.c2
-rw-r--r--include/asterisk/app.h3
3 files changed, 18 insertions, 1 deletions
diff --git a/app.c b/app.c
index dd4a1853b..f99775248 100644
--- a/app.c
+++ b/app.c
@@ -1113,6 +1113,20 @@ int ast_app_group_match_get_count(char *groupmatch, 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/channel.c b/channel.c
index 55276c9ec..4c71ce3f6 100644
--- a/channel.c
+++ b/channel.c
@@ -3106,7 +3106,7 @@ int ast_do_masquerade(struct ast_channel *original)
original->fds[x] = clone->fds[x];
}
/* Drop group from original */
- ast_app_group_discard(original);
+ ast_app_group_update(clone, original);
clone_variables(original, clone);
AST_LIST_HEAD_INIT_NOLOCK(&clone->varshead);
/* Presense of ADSI capable CPE follows clone */
diff --git a/include/asterisk/app.h b/include/asterisk/app.h
index b09cc8eb8..98a78d2d0 100644
--- a/include/asterisk/app.h
+++ b/include/asterisk/app.h
@@ -188,6 +188,9 @@ int ast_app_group_match_get_count(char *groupmatch, 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);