mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
Fix the retrieval of the new SYSTEMNAME variable. Also, clarify some
documentation of how pbx_retrieve_variable works. (issue #6493) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10209 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
9
pbx.c
9
pbx.c
@@ -909,13 +909,18 @@ void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, c
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Look first into predefined variables, then into variable lists.
|
* Look first into predefined variables, then into variable lists.
|
||||||
|
* Variable 's' points to the result, according to the following rules:
|
||||||
* s == ¬_found (set at the beginning) means that we did not find a
|
* s == ¬_found (set at the beginning) means that we did not find a
|
||||||
* matching variable and need to look into more places.
|
* matching variable and need to look into more places.
|
||||||
* If s != ¬_found, s is a valid result string as follows:
|
* If s != ¬_found, s is a valid result string as follows:
|
||||||
* s = NULL if the variable does not have a value;
|
* s = NULL if the variable does not have a value;
|
||||||
|
* you typically do this when looking for an unset predefined variable.
|
||||||
* s = workspace if the result has been assembled there;
|
* s = workspace if the result has been assembled there;
|
||||||
|
* typically done when the result is built e.g. with an snprintf(),
|
||||||
|
* so we don't need to do an additional copy.
|
||||||
* s != workspace in case we have a string, that needs to be copied
|
* s != workspace in case we have a string, that needs to be copied
|
||||||
* (the ast_copy_string is done once for all at the end).
|
* (the ast_copy_string is done once for all at the end).
|
||||||
|
* Typically done when the result is already available in some string.
|
||||||
*/
|
*/
|
||||||
s = ¬_found; /* default value */
|
s = ¬_found; /* default value */
|
||||||
if (c) { /* This group requires a valid channel */
|
if (c) { /* This group requires a valid channel */
|
||||||
@@ -961,7 +966,7 @@ void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, c
|
|||||||
snprintf(workspace, workspacelen, "%u",(int)time(NULL));
|
snprintf(workspace, workspacelen, "%u",(int)time(NULL));
|
||||||
s = workspace;
|
s = workspace;
|
||||||
} else if (!strcmp(var, "SYSTEMNAME")) {
|
} else if (!strcmp(var, "SYSTEMNAME")) {
|
||||||
ast_copy_string(workspace, ast_config_AST_SYSTEM_NAME, workspacelen);
|
s = ast_config_AST_SYSTEM_NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if not found, look into chanvars or global vars */
|
/* if not found, look into chanvars or global vars */
|
||||||
|
Reference in New Issue
Block a user