Index: channel.c =================================================================== RCS file: /home/ipcontact/cvsroot/asterisk/channel.c,v retrieving revision 1.1.1.1 diff -w -u -r1.1.1.1 channel.c --- channel.c 29 Jun 2004 16:11:30 -0000 1.1.1.1 +++ channel.c 7 Jul 2004 14:10:04 -0000 @@ -2163,6 +2163,7 @@ char orig[100]; char masqn[100]; char zombn[100]; + int oldstate; #if 1 ast_log(LOG_DEBUG, "Actually Masquerading %s(%d) into the structure of %s(%d)\n", @@ -2233,6 +2234,9 @@ } clone->_softhangup = AST_SOFTHANGUP_DEV; + /* To allow hangup on chan_sip.c before calling sip_fixup + when doing SIP's call-pickup */ + /* usleep(100); */ if (clone->pvt->fixup){ res = clone->pvt->fixup(original, clone); @@ -2240,9 +2244,13 @@ ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clone->name); } + oldstate = original->_state; + original->_state = clone->_state; + clone->_state = oldstate; /* Start by disconnecting the original's physical side */ - if (clone->pvt->hangup) + if (clone->pvt->hangup) { res = clone->pvt->hangup(clone); + } if (res) { ast_log(LOG_WARNING, "Hangup failed! Strange things may happen!\n"); ast_mutex_unlock(&clone->lock); @@ -2306,7 +2314,7 @@ /* 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; + /* original->_state = clone->_state; */ /* Context, extension, priority, app data, jump table, remain the same */ /* pvt switches. pbx stays the same, as does next */ @@ -2383,6 +2391,8 @@ int ast_setstate(struct ast_channel *chan, int state) { + ast_log(LOG_DEBUG, "Channel %s: state changed from:%s to state:%s\n", + chan->name,ast_state2str(chan->_state), ast_state2str(state)); if (chan->_state != state) { int oldstate = chan->_state; chan->_state = state;