aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-21 06:11:56 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-21 06:11:56 +0000
commit172f7c07c3200635b77ce36fa5800d04b5638eb3 (patch)
tree70444da79accf33024d05240f784f16949004a54 /apps/app_dial.c
parent8bb793aa0b9f55faf60248bafa7e4e0d73f927e1 (diff)
Add promiscuous redirect option
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3254 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rwxr-xr-xapps/app_dial.c46
1 files changed, 35 insertions, 11 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index b320075cf..437ff12d5 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -210,16 +210,27 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
}
} else if (o->chan && (o->chan == winner)) {
if (!ast_strlen_zero(o->chan->call_forward)) {
- char tmpchan[256];
+ char tmpchan[256]="";
+ char *stuff;
+ char *tech;
+ strncpy(tmpchan, o->chan->call_forward, sizeof(tmpchan) - 1);
+ if ((stuff = strchr(tmpchan, '/'))) {
+ *stuff = '\0';
+ stuff++;
+ tech = tmpchan;
+ } else {
+ snprintf(tmpchan, sizeof(tmpchan), "%s@%s", o->chan->call_forward, o->chan->context);
+ stuff = tmpchan;
+ tech = "Local";
+ }
/* 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);
+ ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, o->chan->name);
/* Setup parameters */
- 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);
+ o->chan = ast_request(tech, in->nativeformats, stuff);
if (!o->chan) {
- ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s'\n", tmpchan);
+ ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s'\n", tech, stuff);
o->stillgoing = 0;
numbusies++;
} else {
@@ -699,14 +710,27 @@ static int dial_exec(struct ast_channel *chan, void *data)
continue;
}
if (!ast_strlen_zero(tmp->chan->call_forward)) {
- char tmpchan[256];
+ char tmpchan[256]="";
+ char *stuff;
+ char *tech;
+ strncpy(tmpchan, o->chan->call_forward, sizeof(tmpchan) - 1);
+ if ((stuff = strchr(tmpchan, '/'))) {
+ *stuff = '\0';
+ stuff++;
+ tech = tmpchan;
+ } else {
+ snprintf(tmpchan, sizeof(tmpchan), "%s@%s", tmp->chan->call_forward, tmp->chan->context);
+ stuff = tmpchan;
+ tech = "Local";
+ }
+ /* Before processing channel, go ahead and check for forwarding */
if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Forwarding call to '%s@%s'\n", tmp->chan->call_forward, tmp->chan->context);
- snprintf(tmpchan, sizeof(tmpchan),"%s@%s", tmp->chan->call_forward, tmp->chan->context);
- ast_hangup(tmp->chan);
- tmp->chan = ast_request("Local", chan->nativeformats, tmpchan);
+ ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, tmp->chan->name);
+ /* Setup parameters */
+ ast_hangup(o->chan);
+ tmp->chan = ast_request(tech, in->nativeformats, stuff);
if (!tmp->chan) {
- ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s'\n", tmpchan);
+ ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s'\n", tech, stuff);
free(tmp);
cur = rest;
continue;