aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_chanisavail.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-10-26 22:25:43 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-10-26 22:25:43 +0000
commite2c75a92f97e22fed0bd2017fccb550fc2106ba3 (patch)
tree8cc9a36b9066a72d36a623a08bb8779286caedf2 /apps/app_chanisavail.c
parentb561eb0a2d237ca6c387b60011d55fc38bec1c2c (diff)
Pass concept of status back, permit "leaveempty" to work with static agents who are not loggedon (bug #2719)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4106 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_chanisavail.c')
-rwxr-xr-xapps/app_chanisavail.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c
index d61b0f1d3..91bf838b2 100755
--- a/apps/app_chanisavail.c
+++ b/apps/app_chanisavail.c
@@ -51,6 +51,7 @@ LOCAL_USER_DECL;
static int chanavail_exec(struct ast_channel *chan, void *data)
{
int res=-1;
+ int status;
struct localuser *u;
char info[512], tmp[512], *peers, *tech, *number, *rest, *cur;
struct ast_channel *tempchan;
@@ -80,20 +81,24 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
}
*number = '\0';
number++;
- if ((tempchan = ast_request(tech, chan->nativeformats, number))) {
+ if ((tempchan = ast_request(tech, chan->nativeformats, number, &status))) {
pbx_builtin_setvar_helper(chan, "AVAILCHAN", tempchan->name);
/* Store the originally used channel too */
snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", tmp);
+ snprintf(tmp, sizeof(tmp), "%d", status);
+ pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
ast_hangup(tempchan);
tempchan = NULL;
res = 1;
break;
+ } else {
+ snprintf(tmp, sizeof(tmp), "%d", status);
+ pbx_builtin_setvar_helper(chan, "AVAILSTATUS", tmp);
}
cur = rest;
} while (cur);
}
-
if (res < 1) {
pbx_builtin_setvar_helper(chan, "AVAILCHAN", "");
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");