aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-07-09 10:57:43 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-07-09 10:57:43 +0000
commit76941d2eb82c6fb67337eb24cf816a7827db7f18 (patch)
tree64fc32a98bc1ac22b1f8ab3b8f6cff199c455048 /channel.c
parent1ca809a8480be3191b35001c4a9a0f2eca91af29 (diff)
Swap states early in masquerade process (bug #1987)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3412 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-xchannel.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/channel.c b/channel.c
index c2ccfdc91..16935f684 100755
--- a/channel.c
+++ b/channel.c
@@ -2152,6 +2152,7 @@ int ast_do_masquerade(struct ast_channel *original)
{
int x,i;
int res=0;
+ int origstate;
char *tmp;
struct ast_var_t *varptr;
struct ast_frame *cur, *prev;
@@ -2234,6 +2235,14 @@ int ast_do_masquerade(struct ast_channel *original)
clone->_softhangup = AST_SOFTHANGUP_DEV;
+ /* And of course, so does our current state. Note we need not
+ call ast_setstate since the event manager doesn't really consider
+ these separate. We do this early so that the clone has the proper
+ state of the original channel. */
+ origstate = original->_state;
+ original->_state = clone->_state;
+ clone->_state = origstate;
+
if (clone->pvt->fixup){
res = clone->pvt->fixup(original, clone);
if (res)
@@ -2302,11 +2311,6 @@ int ast_do_masquerade(struct ast_channel *original)
/* Our native formats are different now */
original->nativeformats = clone->nativeformats;
-
- /* And of course, so does our current state. Note we need not
- call ast_setstate since the event manager doesn't really consider
- these separate */
- original->_state = clone->_state;
/* Context, extension, priority, app data, jump table, remain the same */
/* pvt switches. pbx stays the same, as does next */