Store the cause code that is returned when trying to create a channel in ChanIsAvail in the
AVAILCAUSECODE dialplan variable instead of overwriting the device state in AVAILSTATUS. (closes issue #14426) Reported by: macli git-svn-id: http://svn.digium.com/svn/asterisk/trunk@229970 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
fafc40dd5c
commit
58f16a0044
2
CHANGES
2
CHANGES
|
@ -99,6 +99,8 @@ Applications
|
||||||
spool directory of each individual user. The control for this is located in
|
spool directory of each individual user. The control for this is located in
|
||||||
the "passwordlocation" option in voicemail.conf. Please see the sample
|
the "passwordlocation" option in voicemail.conf. Please see the sample
|
||||||
configuration for more information.
|
configuration for more information.
|
||||||
|
* The ChanIsAvail application now exposes the returned cause code using a separate
|
||||||
|
variable, AVAILCAUSECODE, instead of overwriting the device state in AVAILSTATUS.
|
||||||
|
|
||||||
Dialplan Functions
|
Dialplan Functions
|
||||||
------------------
|
------------------
|
||||||
|
|
|
@ -55,6 +55,12 @@ From 1.6.2 to 1.8:
|
||||||
The new channel naming for PRI channels is:
|
The new channel naming for PRI channels is:
|
||||||
DAHDI/i<span>/<number>[:<subaddress>]-<sequence-number>
|
DAHDI/i<span>/<number>[:<subaddress>]-<sequence-number>
|
||||||
|
|
||||||
|
* The ChanIsAvail application has been changed so the AVAILSTATUS variable
|
||||||
|
no longer contains both the device state and cause code. The cause code
|
||||||
|
is now available in the AVAILCAUSECODE variable. If existing dialplan logic
|
||||||
|
is written to expect AVAILSTATUS to contain the cause code it needs to be
|
||||||
|
changed to use AVAILCAUSECODE.
|
||||||
|
|
||||||
From 1.6.1 to 1.6.2:
|
From 1.6.1 to 1.6.2:
|
||||||
|
|
||||||
* The firmware for the IAXy has been removed from Asterisk. It can be
|
* The firmware for the IAXy has been removed from Asterisk. It can be
|
||||||
|
|
|
@ -85,8 +85,11 @@ static const char app[] = "ChanIsAvail";
|
||||||
<para>The canonical channel name that was used to create the channel</para>
|
<para>The canonical channel name that was used to create the channel</para>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="AVAILSTATUS">
|
<variable name="AVAILSTATUS">
|
||||||
<para>The status code for the available channel</para>
|
<para>The device state for the device</para>
|
||||||
</variable>
|
</variable>
|
||||||
|
<variable name="AVAILCAUSECODE">
|
||||||
|
<para>The cause code returned when requesting the channel</para>
|
||||||
|
</variable>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</description>
|
</description>
|
||||||
</application>
|
</application>
|
||||||
|
@ -100,6 +103,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
||||||
struct ast_str *tmp_availchan = ast_str_alloca(2048);
|
struct ast_str *tmp_availchan = ast_str_alloca(2048);
|
||||||
struct ast_str *tmp_availorig = ast_str_alloca(2048);
|
struct ast_str *tmp_availorig = ast_str_alloca(2048);
|
||||||
struct ast_str *tmp_availstat = ast_str_alloca(2048);
|
struct ast_str *tmp_availstat = ast_str_alloca(2048);
|
||||||
|
struct ast_str *tmp_availcause = ast_str_alloca(2048);
|
||||||
struct ast_channel *tempchan;
|
struct ast_channel *tempchan;
|
||||||
AST_DECLARE_APP_ARGS(args,
|
AST_DECLARE_APP_ARGS(args,
|
||||||
AST_APP_ARG(reqchans);
|
AST_APP_ARG(reqchans);
|
||||||
|
@ -159,6 +163,8 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
||||||
snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
|
snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
|
||||||
status = inuse = ast_device_state(trychan);
|
status = inuse = ast_device_state(trychan);
|
||||||
}
|
}
|
||||||
|
snprintf(tmp, sizeof(tmp), "%d", status);
|
||||||
|
ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp);
|
||||||
if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, chan, number, &status))) {
|
if ((inuse <= 1) && (tempchan = ast_request(tech, chan->nativeformats, chan, number, &status))) {
|
||||||
ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", tempchan->name);
|
ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", tempchan->name);
|
||||||
|
|
||||||
|
@ -166,7 +172,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
||||||
ast_str_append(&tmp_availorig, 0, "%s%s", ast_str_strlen(tmp_availorig) ? "&" : "", tmp);
|
ast_str_append(&tmp_availorig, 0, "%s%s", ast_str_strlen(tmp_availorig) ? "&" : "", tmp);
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "%d", status);
|
snprintf(tmp, sizeof(tmp), "%d", status);
|
||||||
ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp);
|
ast_str_append(&tmp_availcause, 0, "%s%s", ast_str_strlen(tmp_availcause) ? "&" : "", tmp);
|
||||||
|
|
||||||
ast_hangup(tempchan);
|
ast_hangup(tempchan);
|
||||||
tempchan = NULL;
|
tempchan = NULL;
|
||||||
|
@ -174,9 +180,6 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
||||||
if (!option_all_avail) {
|
if (!option_all_avail) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
snprintf(tmp, sizeof(tmp), "%d", status);
|
|
||||||
ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp);
|
|
||||||
}
|
}
|
||||||
cur = rest;
|
cur = rest;
|
||||||
} while (cur);
|
} while (cur);
|
||||||
|
@ -186,6 +189,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
|
||||||
/* Store the originally used channel too */
|
/* Store the originally used channel too */
|
||||||
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", ast_str_buffer(tmp_availorig));
|
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", ast_str_buffer(tmp_availorig));
|
||||||
pbx_builtin_setvar_helper(chan, "AVAILSTATUS", ast_str_buffer(tmp_availstat));
|
pbx_builtin_setvar_helper(chan, "AVAILSTATUS", ast_str_buffer(tmp_availstat));
|
||||||
|
pbx_builtin_setvar_helper(chan, "AVAILCAUSECODE", ast_str_buffer(tmp_availcause));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue