aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_transfer.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-19 17:34:06 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-19 17:34:06 +0000
commitb8375317121c5cd16ca4f3239fcaa4ee2e894cb1 (patch)
tree1a87d1f73644bbb9f57399fe2d4d8e8969c18f2d /apps/app_transfer.c
parent56a6b23126220c47c1204dc74c57e402bef5c8ce (diff)
Add sip redirect support (bug #3419i, with mods)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5055 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_transfer.c')
-rwxr-xr-xapps/app_transfer.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/app_transfer.c b/apps/app_transfer.c
index 212792c86..d46e34f25 100755
--- a/apps/app_transfer.c
+++ b/apps/app_transfer.c
@@ -29,7 +29,7 @@ static char *app = "Transfer";
static char *synopsis = "Transfer caller to remote extension";
static char *descrip =
-" Transfer(exten): Requests the remote caller be transferred to\n"
+" Transfer([Tech/]dest): Requests the remote caller be transferred\n"
"a given extension. Returns -1 on hangup, or 0 on completion\n"
"regardless of whether the transfer was successful. If the transfer\n"
"was *not* supported or successful and there exists a priority n + 101,\n"
@@ -42,14 +42,21 @@ LOCAL_USER_DECL;
static int transfer_exec(struct ast_channel *chan, void *data)
{
int res=0;
+ int len;
struct localuser *u;
+ char *slash;
if (!data || !strlen(data)) {
- ast_log(LOG_WARNING, "Transfer requires an argument (destination)\n");
+ ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination)\n");
res = 1;
}
+ if ((slash = strchr((char *)data, '/')) && (len = (slash - (char *)data))) {
+ /* Allow execution only if the Tech/destination agrees with the type of the channel */
+ if (strncasecmp(chan->type, (char *)data, len))
+ return 0;
+ }
LOCAL_USER_ADD(u);
if (!res) {
- res = ast_transfer(chan, data);
+ res = ast_transfer(chan, data + strlen(chan->type) + 1);
}
if (!res) {
/* Look for a "busy" place */