summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2005-02-14 23:20:01 +0000
committerMark Spencer <markster@digium.com>2005-02-14 23:20:01 +0000
commitcea4a8e09eff22f54e5070402eb76947a8e24e9e (patch)
treecc26b9024433e54e3e7ed0d6cc4ab38ad9707539 /channels
parent90267ab0ead82aa339099e31bca947769eeb7250 (diff)
Fix native agent transfer, add UPGRADE.txt for notes about backwards compatibility issues upgrading from Asterisk 1.0 to current CVS head
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5031 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_agent.c22
-rwxr-xr-xchannels/chan_local.c16
-rwxr-xr-xchannels/chan_sip.c2
3 files changed, 23 insertions, 17 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 3895ddd2e..842616feb 100755
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -360,6 +360,8 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
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 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
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 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
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 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
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 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
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 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
if (recordagentcalls)
agent_start_monitoring(ast,0);
p->acknowledged = 1;
- if (p->chan)
- p->chan->_bridge = ast;
}
res = 0;
}
@@ -892,7 +896,7 @@ static int read_agent_config(void)
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");
diff --git a/channels/chan_local.c b/channels/chan_local.c
index b1998f1c8..e6ee96450 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -139,28 +139,28 @@ static void check_bridge(struct local_pvt *p, int isoutbound)
{
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);
}
}
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index cfd96076c..5e21641e6 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -8186,6 +8186,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
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 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
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);
}
}