aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-04 20:32:55 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-04 20:32:55 +0000
commit737272b1c0060527355ee2c0116acc465592662c (patch)
tree51881d8e6c6e2e0553129bd088e71894fe5f46c0 /res
parent320e8ef1d51738e33772bd7bf6bdd5926a37b6cd (diff)
Set username to default to the category name if it isn't overridden by a usernmae= setting in users.conf
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@105733 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_phoneprov.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index 507238d38..288b236f6 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -705,7 +705,13 @@ static struct user *build_user(struct ast_config *cfg, const char *name, const c
for (i = 0; i < PP_VAR_LIST_LENGTH; i++) {
tmp = ast_variable_retrieve(cfg, name, pp_variable_list[i].user_var);
- if (i == PP_TIMEZONE) {
+ /* If we didn't get a USERNAME variable, set it to the user->name */
+ if (i == PP_USERNAME && !tmp) {
+ if ((var = ast_var_assign(pp_variable_list[PP_USERNAME].template_var, user->name))) {
+ AST_LIST_INSERT_TAIL(user->headp, var, entries);
+ }
+ continue;
+ } else if (i == PP_TIMEZONE) {
/* perfectly ok if tmp is NULL, will set variables based on server's time zone */
set_timezone_variables(user->headp, tmp);
}