[Asterisk-cvs] asterisk/channels chan_agent.c, 1.113,
1.114 chan_local.c, 1.39, 1.40 chan_sip.c, 1.660, 1.661
markster at lists.digium.com
markster at lists.digium.com
Mon Feb 14 17:20:32 CST 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv8461/channels
Modified Files:
chan_agent.c chan_local.c chan_sip.c
Log Message:
Fix native agent transfer, add UPGRADE.txt for notes about backwards compatibility issues upgrading from Asterisk 1.0 to current CVS head
Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- chan_agent.c 10 Feb 2005 06:36:09 -0000 1.113
+++ chan_agent.c 14 Feb 2005 23:20:01 -0000 1.114
@@ -360,6 +360,8 @@
for us when the PBX instance that called login finishes */
if (!ast_strlen_zero(p->loginchan)) {
p->chan->_bridge = NULL;
+ if (p->chan)
+ ast_log(LOG_DEBUG, "Bridge on '%s' being cleared (2)\n", p->chan->name);
ast_hangup(p->chan);
if (p->wrapuptime) {
gettimeofday(&p->lastdisc, NULL);
@@ -375,8 +377,9 @@
p->acknowledged = 0;
}
}
- if ((p->chan && (p->chan->_state != AST_STATE_UP)) && f && (f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_ANSWER)) {
+ if (p->chan && f && (f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_ANSWER)) {
/* TC */
+ ast_log(LOG_DEBUG, "Got answer on %s\n", p->chan->name);
if (p->ackcall) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s answered, waiting for '#' to acknowledge\n", p->chan->name);
@@ -385,10 +388,8 @@
f = &null_frame;
} else {
p->acknowledged = 1;
+ ast_frfree(f);
f = &answer_frame;
- if (p->chan)
- p->chan->_bridge = ast;
-
}
}
if (f && (f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
@@ -398,8 +399,6 @@
p->acknowledged = 1;
ast_frfree(f);
f = &answer_frame;
- if (p->chan)
- p->chan->_bridge = ast;
}
}
if (f && (f->frametype == AST_FRAME_DTMF) && (f->subclass == '*')) {
@@ -408,6 +407,13 @@
f = NULL;
}
CLEANUP(ast,p);
+ if (p->chan && !p->chan->_bridge) {
+ if (strcasecmp(p->chan->type, "Local")) {
+ p->chan->_bridge = ast;
+ if (p->chan)
+ ast_log(LOG_DEBUG, "Bridge on '%s' being set to '%s' (3)\n", p->chan->name, p->chan->_bridge->name);
+ }
+ }
ast_mutex_unlock(&p->lock);
if (recordagentcalls && f == &answer_frame)
agent_start_monitoring(ast,0);
@@ -563,8 +569,6 @@
if (recordagentcalls)
agent_start_monitoring(ast,0);
p->acknowledged = 1;
- if (p->chan)
- p->chan->_bridge = ast;
}
res = 0;
}
@@ -892,7 +896,7 @@
group = 0;
autologoff = 0;
wrapuptime = 0;
- ackcall = 1;
+ ackcall = 0;
cfg = ast_config_load(config);
if (!cfg) {
ast_log(LOG_NOTICE, "No agent configuration found -- agent support disabled\n");
Index: chan_local.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_local.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- chan_local.c 11 Dec 2004 04:46:49 -0000 1.39
+++ chan_local.c 14 Feb 2005 23:20:01 -0000 1.40
@@ -139,28 +139,28 @@
{
if (p->alreadymasqed || p->nooptimization)
return;
- if (isoutbound && p->chan && ast_bridged_channel(p->chan) && p->owner) {
+ if (isoutbound && p->chan && p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ && p->owner) {
/* Masquerade bridged channel into owner */
/* Lock everything we need, one by one, and give up if
we can't get everything. Remember, we'll get another
chance in just a little bit */
- if (!ast_mutex_trylock(&(ast_bridged_channel(p->chan))->lock)) {
+ if (!ast_mutex_trylock(&(p->chan->_bridge)->lock)) {
if (!ast_mutex_trylock(&p->owner->lock)) {
- ast_channel_masquerade(p->owner, ast_bridged_channel(p->chan));
+ ast_channel_masquerade(p->owner, p->chan->_bridge);
p->alreadymasqed = 1;
ast_mutex_unlock(&p->owner->lock);
}
- ast_mutex_unlock(&(ast_bridged_channel(p->chan)->lock));
+ ast_mutex_unlock(&(p->chan->_bridge)->lock);
}
- } else if (!isoutbound && p->owner && ast_bridged_channel(p->owner) && p->chan) {
+ } else if (!isoutbound && p->owner && p->owner->_bridge && p->chan) {
/* Masquerade bridged channel into chan */
- if (!ast_mutex_trylock(&(ast_bridged_channel(p->owner)->lock))) {
+ if (!ast_mutex_trylock(&(p->owner->_bridge)->lock)) {
if (!ast_mutex_trylock(&p->chan->lock)) {
- ast_channel_masquerade(p->chan, ast_bridged_channel(p->owner));
+ ast_channel_masquerade(p->chan, p->owner->_bridge);
p->alreadymasqed = 1;
ast_mutex_unlock(&p->chan->lock);
}
- ast_mutex_unlock(&(ast_bridged_channel(p->owner)->lock));
+ ast_mutex_unlock(&(p->owner->_bridge)->lock);
}
}
}
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.660
retrieving revision 1.661
diff -u -d -r1.660 -r1.661
--- chan_sip.c 14 Feb 2005 19:46:45 -0000 1.660
+++ chan_sip.c 14 Feb 2005 23:20:01 -0000 1.661
@@ -8186,6 +8186,7 @@
if (c) {
transfer_to = ast_bridged_channel(c);
if (transfer_to) {
+ ast_log(LOG_DEBUG, "Got SIP blind transfer, applying to '%s'\n", transfer_to->name);
ast_moh_stop(transfer_to);
if (!strcmp(p->refer_to, ast_parking_ext())) {
/* Must release c's lock now, because it will not longer
@@ -8202,6 +8203,7 @@
ast_async_goto(transfer_to,p->context, p->refer_to,1);
}
} else {
+ ast_log(LOG_DEBUG, "Got SIP blind transfer but nothing to transfer to.\n");
ast_queue_hangup(p->owner);
}
}
More information about the svn-commits
mailing list