aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-06 06:37:08 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-06 06:37:08 +0000
commitc30aaa890638ce89d3f643eb8e47314538fad257 (patch)
tree88cee5fc2ca5bbe3d2e9178933acad0a9bd8df59
parent2d771aed0d77229d1a6426ddb065a610ca20418c (diff)
Make call forwarding work properly by using new Local channel
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@758 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xCHANGES3
-rwxr-xr-xapps/app_dial.c40
-rwxr-xr-xchannels/chan_local.c2
3 files changed, 29 insertions, 16 deletions
diff --git a/CHANGES b/CHANGES
index d394c045e..cc9cad3da 100755
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+ -- Improve call forwarding using new "Local" channel driver.
+ -- Add "Local" channel
+ -- Substantial SIP enhancements including retransmissions
-- Enforce case sensitivity on extension/context names
-- Add monitor support (Thanks, Mahmut)
-- Add experimental "trunk" option to IAX2 for high density VoIP
diff --git a/apps/app_dial.c b/apps/app_dial.c
index a5e43c222..e3d59d4d6 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -95,7 +95,7 @@ static void hanguptree(struct localuser *outgoing, struct ast_channel *exception
struct localuser *oo;
while(outgoing) {
/* Hangup any existing lines we have open */
- if (outgoing->chan != exception)
+ if (outgoing->chan && (outgoing->chan != exception))
ast_hangup(outgoing->chan);
oo = outgoing;
outgoing=outgoing->next;
@@ -187,15 +187,26 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
}
} else if (o->chan == winner) {
if (strlen(o->chan->call_forward)) {
+ char tmpchan[256];
/* Before processing channel, go ahead and check for forwarding */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s@%s' (thanks to %s)\n", in->name, o->chan->call_forward, o->chan->context, o->chan->name);
/* Setup parameters */
- strncpy(in->exten, o->chan->call_forward, sizeof(in->exten));
- strncpy(in->context, o->chan->context, sizeof(in->context));
- in->priority = 0;
- *to = 0;
- break;
+ snprintf(tmpchan, sizeof(tmpchan),"%s@%s", o->chan->call_forward, o->chan->context);
+ ast_hangup(o->chan);
+ o->chan = ast_request("Local", in->nativeformats, tmpchan);
+ if (!o->chan) {
+ ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s'\n", tmpchan);
+ o->stillgoing = 0;
+ numbusies++;
+ }
+ if (ast_call(o->chan, tmpchan, 0)) {
+ ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
+ o->stillgoing = 0;
+ ast_hangup(o->chan);
+ o->chan = NULL;
+ }
+ continue;
}
f = ast_read(winner);
if (f) {
@@ -470,17 +481,18 @@ static int dial_exec(struct ast_channel *chan, void *data)
continue;
}
if (strlen(tmp->chan->call_forward)) {
+ char tmpchan[256];
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Forwarding call to '%s@%s'\n", tmp->chan->call_forward, tmp->chan->context);
- /* Setup parameters */
- strncpy(chan->exten, tmp->chan->call_forward, sizeof(chan->exten));
- strncpy(chan->context, tmp->chan->context, sizeof(chan->context));
- chan->priority = 0;
- to = 0;
+ snprintf(tmpchan, sizeof(tmpchan),"%s@%s", tmp->chan->call_forward, tmp->chan->context);
ast_hangup(tmp->chan);
- free(tmp);
- cur = rest;
- break;
+ tmp->chan = ast_request("Local", chan->nativeformats, tmpchan);
+ if (!tmp->chan) {
+ ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s'\n", tmpchan);
+ free(tmp);
+ cur = rest;
+ continue;
+ }
}
/* If creating a SIP channel, look for a variable called */
/* VXML_URL in the calling channel and copy it to the */
diff --git a/channels/chan_local.c b/channels/chan_local.c
index e4bc3c676..feabb36ba 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -85,8 +85,6 @@ retrylock:
ast_pthread_mutex_lock(&p->lock);
goto retrylock;
}
- if (f->frametype != AST_FRAME_VOICE)
- ast_verbose("Queueing frmae %d/%d on %s\n", f->frametype, f->subclass, other->name);
ast_queue_frame(other, f, 0);
ast_pthread_mutex_unlock(&other->lock);
return 0;