aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-08 18:53:41 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-08 18:53:41 +0000
commit809b2f32c0fdb4bb781921f07683db56adc97f21 (patch)
tree760901b911b87e8f46658bfbf66ae5aa40d8ee35
parent411f01b40e15f0d398957f4e08824617e7b162b8 (diff)
Merged revisions 42452 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r42452 | file | 2006-09-08 14:50:43 -0400 (Fri, 08 Sep 2006) | 2 lines Swap spies during masquerading ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@42453 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/channel.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 84485240b..908e8c08c 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -3154,6 +3154,8 @@ int ast_do_masquerade(struct ast_channel *original)
void *t_pvt;
struct ast_callerid tmpcid;
struct ast_channel *clone = original->masq;
+ struct ast_channel_spy_list *spy_list = NULL;
+ struct ast_channel_spy *spy = NULL;
int rformat = original->readformat;
int wformat = original->writeformat;
char newn[100];
@@ -3232,6 +3234,27 @@ int ast_do_masquerade(struct ast_channel *original)
original->rawwriteformat = clone->rawwriteformat;
clone->rawwriteformat = x;
+ /* Swap the spies */
+ spy_list = original->spies;
+ original->spies = clone->spies;
+ clone->spies = spy_list;
+
+ /* Update channel on respective spy lists if present */
+ if (original->spies) {
+ AST_LIST_TRAVERSE(&original->spies->list, spy, list) {
+ ast_mutex_lock(&spy->lock);
+ spy->chan = original;
+ ast_mutex_unlock(&spy->lock);
+ }
+ }
+ if (clone->spies) {
+ AST_LIST_TRAVERSE(&clone->spies->list, spy, list) {
+ ast_mutex_lock(&spy->lock);
+ spy->chan = clone;
+ ast_mutex_unlock(&spy->lock);
+ }
+ }
+
/* Save any pending frames on both sides. Start by counting
* how many we're going to need... */
x = 0;