mirror of
https://github.com/asterisk/asterisk.git
synced 2026-06-28 11:19:11 -07:00
Make evaluation of channel variables consistently case-sensitive.
Due to inconsistencies in how variable names were evaluated, the decision was made to make all evaluations case-sensitive. See the UPGRADE.txt file or https://wiki.asterisk.org/wiki/display/AST/Case+Sensitivity for more details. (closes issue ASTERISK-20163) reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/2160 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375442 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -56,6 +56,12 @@ chan_dahdi:
|
||||
between 'w' and 'W'. The 'w' pauses dialing for half a second. The 'W'
|
||||
pauses dialing for one second.
|
||||
|
||||
Dialplan:
|
||||
- All channel and global variable names are evaluated in a case-sensitive manner.
|
||||
In previous versions of Asterisk, variables created and evaluated in the
|
||||
dialplan were evaluated case-insensitively, but built-in variables and variable
|
||||
evaluation done internally within Asterisk was done case-sensitively.
|
||||
|
||||
From 10 to 11:
|
||||
|
||||
Voicemail:
|
||||
|
||||
+44
-44
@@ -2281,9 +2281,9 @@ static int ospauth_exec(
|
||||
|
||||
headp = ast_channel_varshead(chan);
|
||||
AST_LIST_TRAVERSE(headp, current, entries) {
|
||||
if (!strcasecmp(ast_var_name(current), "OSPINPEERIP")) {
|
||||
if (!strcmp(ast_var_name(current), "OSPINPEERIP")) {
|
||||
source = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINTOKEN")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINTOKEN")) {
|
||||
token = ast_var_value(current);
|
||||
}
|
||||
}
|
||||
@@ -2405,69 +2405,69 @@ static int osplookup_exec(
|
||||
|
||||
headp = ast_channel_varshead(chan);
|
||||
AST_LIST_TRAVERSE(headp, current, entries) {
|
||||
if (!strcasecmp(ast_var_name(current), "OSPINACTUALSRC")) {
|
||||
if (!strcmp(ast_var_name(current), "OSPINACTUALSRC")) {
|
||||
actualsrc = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINPEERIP")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINPEERIP")) {
|
||||
srcdev = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINTECH")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINTECH")) {
|
||||
ast_copy_string(results.intech, ast_var_value(current), sizeof(results.intech));
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINHANDLE")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &results.inhandle) != 1) {
|
||||
results.inhandle = OSP_INVALID_HANDLE;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINTIMELIMIT")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINTIMELIMIT")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &results.intimelimit) != 1) {
|
||||
results.intimelimit = OSP_DEF_TIMELIMIT;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINNETWORKID")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINNETWORKID")) {
|
||||
snetid = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINNPRN")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINNPRN")) {
|
||||
np.rn = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINNPCIC")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINNPCIC")) {
|
||||
np.cic = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINNPDI")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINNPDI")) {
|
||||
if (ast_true(ast_var_value(current))) {
|
||||
np.npdi = 1;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINSPID")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINSPID")) {
|
||||
np.opname[OSPC_OPNAME_SPID] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINOCN")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINOCN")) {
|
||||
np.opname[OSPC_OPNAME_OCN] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINSPN")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINSPN")) {
|
||||
np.opname[OSPC_OPNAME_SPN] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINALTSPN")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINALTSPN")) {
|
||||
np.opname[OSPC_OPNAME_ALTSPN] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINMCC")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINMCC")) {
|
||||
np.opname[OSPC_OPNAME_MCC] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINMNC")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINMNC")) {
|
||||
np.opname[OSPC_OPNAME_MNC] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINTOHOST")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINTOHOST")) {
|
||||
ast_copy_string(results.dest, ast_var_value(current), sizeof(results.dest));
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINRPIDUSER")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINRPIDUSER")) {
|
||||
headers.rpiduser = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINPAIUSER")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINPAIUSER")) {
|
||||
headers.paiuser = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINDIVUSER")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINDIVUSER")) {
|
||||
headers.divuser = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINDIVHOST")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINDIVHOST")) {
|
||||
headers.divhost = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINPCIUSER")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINPCIUSER")) {
|
||||
headers.pciuser = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO1")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO1")) {
|
||||
cinfo[0] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO2")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO2")) {
|
||||
cinfo[1] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO3")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO3")) {
|
||||
cinfo[2] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO4")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO4")) {
|
||||
cinfo[3] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO5")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO5")) {
|
||||
cinfo[4] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO6")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO6")) {
|
||||
cinfo[5] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO7")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO7")) {
|
||||
cinfo[6] = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO8")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINCUSTOMINFO8")) {
|
||||
cinfo[7] = ast_var_value(current);
|
||||
}
|
||||
}
|
||||
@@ -2669,23 +2669,23 @@ static int ospnext_exec(
|
||||
|
||||
headp = ast_channel_varshead(chan);
|
||||
AST_LIST_TRAVERSE(headp, current, entries) {
|
||||
if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
|
||||
if (!strcmp(ast_var_name(current), "OSPINHANDLE")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &results.inhandle) != 1) {
|
||||
results.inhandle = OSP_INVALID_HANDLE;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPOUTHANDLE")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &results.outhandle) != 1) {
|
||||
results.outhandle = OSP_INVALID_HANDLE;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINTIMELIMIT")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINTIMELIMIT")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &results.intimelimit) != 1) {
|
||||
results.intimelimit = OSP_DEF_TIMELIMIT;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPOUTCALLIDTYPES")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPOUTCALLIDTYPES")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &callidtypes) != 1) {
|
||||
callidtypes = OSP_CALLID_UNDEF;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPDESTREMAILS")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPDESTREMAILS")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &results.numdests) != 1) {
|
||||
results.numdests = 0;
|
||||
}
|
||||
@@ -2833,25 +2833,25 @@ static int ospfinished_exec(
|
||||
|
||||
headp = ast_channel_varshead(chan);
|
||||
AST_LIST_TRAVERSE(headp, current, entries) {
|
||||
if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
|
||||
if (!strcmp(ast_var_name(current), "OSPINHANDLE")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &inhandle) != 1) {
|
||||
inhandle = OSP_INVALID_HANDLE;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPOUTHANDLE")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &outhandle) != 1) {
|
||||
outhandle = OSP_INVALID_HANDLE;
|
||||
}
|
||||
} else if (!recorded &&
|
||||
(!strcasecmp(ast_var_name(current), "OSPAUTHSTATUS") ||
|
||||
!strcasecmp(ast_var_name(current), "OSPLOOKUPSTATUS") ||
|
||||
!strcasecmp(ast_var_name(current), "OSPNEXTSTATUS")))
|
||||
(!strcmp(ast_var_name(current), "OSPAUTHSTATUS") ||
|
||||
!strcmp(ast_var_name(current), "OSPLOOKUPSTATUS") ||
|
||||
!strcmp(ast_var_name(current), "OSPNEXTSTATUS")))
|
||||
{
|
||||
if (strcasecmp(ast_var_value(current), AST_OSP_SUCCESS)) {
|
||||
if (strcmp(ast_var_value(current), AST_OSP_SUCCESS)) {
|
||||
recorded = 1;
|
||||
}
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPINAUDIOQOS")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPINAUDIOQOS")) {
|
||||
ast_copy_string(inqos, ast_var_value(current), sizeof(inqos));
|
||||
} else if (!strcasecmp(ast_var_name(current), "OSPOUTAUDIOQOS")) {
|
||||
} else if (!strcmp(ast_var_name(current), "OSPOUTAUDIOQOS")) {
|
||||
ast_copy_string(outqos, ast_var_value(current), sizeof(outqos));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-10
@@ -842,20 +842,11 @@ static int mgcp_call(struct ast_channel *ast, const char *dest, int timeout)
|
||||
struct mgcp_endpoint *p;
|
||||
struct mgcp_subchannel *sub;
|
||||
char tone[50] = "";
|
||||
const char *distinctive_ring = NULL;
|
||||
struct varshead *headp;
|
||||
struct ast_var_t *current;
|
||||
const char *distinctive_ring = pbx_builtin_getvar_helper(ast, "ALERT_INFO");
|
||||
|
||||
ast_debug(3, "MGCP mgcp_call(%s)\n", ast_channel_name(ast));
|
||||
sub = ast_channel_tech_pvt(ast);
|
||||
p = sub->parent;
|
||||
headp = ast_channel_varshead(ast);
|
||||
AST_LIST_TRAVERSE(headp,current,entries) {
|
||||
/* Check whether there is an ALERT_INFO variable */
|
||||
if (strcasecmp(ast_var_name(current),"ALERT_INFO") == 0) {
|
||||
distinctive_ring = ast_var_value(current);
|
||||
}
|
||||
}
|
||||
|
||||
ast_mutex_lock(&sub->lock);
|
||||
switch (p->hookstate) {
|
||||
|
||||
+11
-11
@@ -6256,28 +6256,28 @@ static int sip_call(struct ast_channel *ast, const char *dest, int timeout)
|
||||
}
|
||||
|
||||
/* Check whether there is vxml_url, distinctive ring variables */
|
||||
headp=ast_channel_varshead(ast);
|
||||
headp = ast_channel_varshead(ast);
|
||||
AST_LIST_TRAVERSE(headp, current, entries) {
|
||||
/* Check whether there is a VXML_URL variable */
|
||||
if (!p->options->vxml_url && !strcasecmp(ast_var_name(current), "VXML_URL")) {
|
||||
if (!p->options->vxml_url && !strcmp(ast_var_name(current), "VXML_URL")) {
|
||||
p->options->vxml_url = ast_var_value(current);
|
||||
} else if (!p->options->uri_options && !strcasecmp(ast_var_name(current), "SIP_URI_OPTIONS")) {
|
||||
} else if (!p->options->uri_options && !strcmp(ast_var_name(current), "SIP_URI_OPTIONS")) {
|
||||
p->options->uri_options = ast_var_value(current);
|
||||
} else if (!p->options->addsipheaders && !strncasecmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) {
|
||||
} else if (!p->options->addsipheaders && !strncmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) {
|
||||
/* Check whether there is a variable with a name starting with SIPADDHEADER */
|
||||
p->options->addsipheaders = 1;
|
||||
} else if (!strcasecmp(ast_var_name(current), "SIPFROMDOMAIN")) {
|
||||
} else if (!strcmp(ast_var_name(current), "SIPFROMDOMAIN")) {
|
||||
ast_string_field_set(p, fromdomain, ast_var_value(current));
|
||||
} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER")) {
|
||||
} else if (!strcmp(ast_var_name(current), "SIPTRANSFER")) {
|
||||
/* This is a transfered call */
|
||||
p->options->transfer = 1;
|
||||
} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER_REFERER")) {
|
||||
} else if (!strcmp(ast_var_name(current), "SIPTRANSFER_REFERER")) {
|
||||
/* This is the referrer */
|
||||
referer = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "SIPTRANSFER_REPLACES")) {
|
||||
} else if (!strcmp(ast_var_name(current), "SIPTRANSFER_REPLACES")) {
|
||||
/* We're replacing a call. */
|
||||
p->options->replaces = ast_var_value(current);
|
||||
} else if (!strcasecmp(ast_var_name(current), "SIP_MAX_FORWARDS")) {
|
||||
} else if (!strcmp(ast_var_name(current), "SIP_MAX_FORWARDS")) {
|
||||
if (sscanf(ast_var_value(current), "%30d", &(p->maxforwards)) != 1) {
|
||||
ast_log(LOG_WARNING, "The SIP_MAX_FORWARDS channel variable is not a valid integer.\n");
|
||||
}
|
||||
@@ -14025,7 +14025,7 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init,
|
||||
const struct ast_var_t *current;
|
||||
AST_LIST_TRAVERSE(headp, current, entries) {
|
||||
/* SIPADDHEADER: Add SIP header to outgoing call */
|
||||
if (!strncasecmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) {
|
||||
if (!strncmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) {
|
||||
char *content, *end;
|
||||
const char *header = ast_var_value(current);
|
||||
char *headdup = ast_strdupa(header);
|
||||
@@ -32615,7 +32615,7 @@ static int sip_removeheader(struct ast_channel *chan, const char *data)
|
||||
|
||||
headp=ast_channel_varshead(chan);
|
||||
AST_LIST_TRAVERSE_SAFE_BEGIN (headp, newvariable, entries) {
|
||||
if (strncasecmp(ast_var_name(newvariable), "SIPADDHEADER", strlen("SIPADDHEADER")) == 0) {
|
||||
if (strncmp(ast_var_name(newvariable), "SIPADDHEADER", strlen("SIPADDHEADER")) == 0) {
|
||||
if (removeall || (!strncasecmp(ast_var_value(newvariable),inbuf,strlen(inbuf)))) {
|
||||
if (sipdebug) {
|
||||
ast_debug(1,"removing SIP Header \"%s\" as %s\n",
|
||||
|
||||
@@ -4425,7 +4425,7 @@ static int skinny_call(struct ast_channel *ast, const char *dest, int timeout)
|
||||
}
|
||||
|
||||
AST_LIST_TRAVERSE(ast_channel_varshead(ast), current, entries) {
|
||||
if (!(strcasecmp(ast_var_name(current),"SKINNY_AUTOANSWER"))) {
|
||||
if (!(strcmp(ast_var_name(current), "SKINNY_AUTOANSWER"))) {
|
||||
if (d->hookstate == SKINNY_ONHOOK && !sub->aa_sched) {
|
||||
char buf[24];
|
||||
int aatime;
|
||||
|
||||
@@ -998,7 +998,7 @@ static void clearvar_prefix(struct ast_channel *chan, const char *prefix)
|
||||
struct ast_var_t *var;
|
||||
int len = strlen(prefix);
|
||||
AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_varshead(chan), var, entries) {
|
||||
if (strncasecmp(prefix, ast_var_name(var), len) == 0) {
|
||||
if (strncmp(prefix, ast_var_name(var), len) == 0) {
|
||||
AST_LIST_REMOVE_CURRENT(entries);
|
||||
ast_free(var);
|
||||
}
|
||||
@@ -1098,7 +1098,7 @@ static int hashkeys_read(struct ast_channel *chan, const char *cmd, char *data,
|
||||
memset(buf, 0, len);
|
||||
|
||||
AST_LIST_TRAVERSE(ast_channel_varshead(chan), newvar, entries) {
|
||||
if (strncasecmp(ast_str_buffer(prefix), ast_var_name(newvar), ast_str_strlen(prefix)) == 0) {
|
||||
if (strncmp(ast_str_buffer(prefix), ast_var_name(newvar), ast_str_strlen(prefix)) == 0) {
|
||||
/* Copy everything after the prefix */
|
||||
strncat(buf, ast_var_name(newvar) + ast_str_strlen(prefix), len - strlen(buf) - 1);
|
||||
/* Trim the trailing ~ */
|
||||
@@ -1119,7 +1119,7 @@ static int hashkeys_read2(struct ast_channel *chan, const char *cmd, char *data,
|
||||
ast_str_set(&prefix, -1, HASH_PREFIX, data);
|
||||
|
||||
AST_LIST_TRAVERSE(ast_channel_varshead(chan), newvar, entries) {
|
||||
if (strncasecmp(ast_str_buffer(prefix), ast_var_name(newvar), ast_str_strlen(prefix)) == 0) {
|
||||
if (strncmp(ast_str_buffer(prefix), ast_var_name(newvar), ast_str_strlen(prefix)) == 0) {
|
||||
/* Copy everything after the prefix */
|
||||
ast_str_append(buf, len, "%s", ast_var_name(newvar) + ast_str_strlen(prefix));
|
||||
/* Trim the trailing ~ */
|
||||
|
||||
+1
-1
@@ -3398,7 +3398,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru
|
||||
if (places[i] == &globals)
|
||||
ast_rwlock_rdlock(&globalslock);
|
||||
AST_LIST_TRAVERSE(places[i], variables, entries) {
|
||||
if (!strcasecmp(ast_var_name(variables), var)) {
|
||||
if (!strcmp(ast_var_name(variables), var)) {
|
||||
s = ast_var_value(variables);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user