aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_chanisavail.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-05 18:42:59 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-05 18:42:59 +0000
commitb1d46e807b7e055fe39985c460d079d7c7ac7310 (patch)
tree576adae7716d4d97660201bc2ce1e2497f38fbbd /apps/app_chanisavail.c
parent5f491f92f6be05d8a750f092358eeab07f5c64bf (diff)
Add ${AVAILORIGCHAN} with original channel name (bug #1793)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3149 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_chanisavail.c')
-rwxr-xr-xapps/app_chanisavail.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c
index 18e61b419..1c21af48b 100755
--- a/apps/app_chanisavail.c
+++ b/apps/app_chanisavail.c
@@ -43,7 +43,8 @@ static char *descrip =
"case ChanIsAvail will return -1). If any of the requested channels\n"
"are available, the next priority will be n+1, the channel variable\n"
"${AVAILCHAN} will be set to the name of the available channel and\n"
-"the ChanIsAvail app will return 0.\n";
+"the ChanIsAvail app will return 0. ${AVAILORIGCHAN} is\n"
+"the canonical channel name that was used to create the channel.\n";
STANDARD_LOCAL_USER;
@@ -83,6 +84,9 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
number++;
if ((tempchan = ast_request(tech, chan->nativeformats, number))) {
pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
+ /* Store the originally used channel too */
+ snprintf(info, sizeof(info), "%s/%s", tech, number);
+ pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", info);
ast_hangup(tempchan);
tempchan = NULL;
res = 1;
@@ -94,6 +98,7 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
if (res < 1) {
pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
+ pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
chan->priority+=100;
else