]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
users.conf: Remove deprecated users.conf integration.
authorNaveen Albert <asterisk@phreaknet.org>
Wed, 9 Jul 2025 13:30:43 +0000 (09:30 -0400)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Thu, 10 Jul 2025 14:47:38 +0000 (14:47 +0000)
users.conf was deprecated in Asterisk 21 and is now being removed
for Asterisk 23, in accordance with the Asterisk deprecation policy.

This consists of:
* Removing integration with app_directory, app_voicemail, chan_dahdi,
  chan_iax2, and AMI.
* users.conf was also partially used for res_phoneprov, and this remaining
  functionality is consolidated to a separate phoneprov_users.conf,
  used only by res_phoneprov.

Resolves: #1292

UpgradeNote: users.conf has been removed and all channel drivers must
be configured using their specific configuration files. The functionality
previously in users.conf for res_phoneprov is now in phoneprov_users.conf.

13 files changed:
apps/app_directory.c
apps/app_voicemail.c
channels/chan_dahdi.c
channels/chan_iax2.c
configs/samples/chan_dahdi.conf.sample
configs/samples/phoneprov.conf.sample
configs/samples/phoneprov_users.conf [new file with mode: 0644]
configs/samples/users.conf.sample [deleted file]
configs/samples/voicemail.conf.sample
contrib/scripts/vmail.cgi
main/manager.c
pbx/pbx_config.c
res/res_phoneprov.c

index a1ff495c231ed72b7f24df07a5e3a22271386295..690bb55639b46f2d83a2c19e2cdb36865928dfa1 100644 (file)
@@ -699,14 +699,13 @@ static int check_match(struct directory_item **result, const char *item_context,
 
 typedef AST_LIST_HEAD_NOLOCK(, directory_item) itemlist;
 
-static int search_directory_sub(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
+static int search_directory_sub(const char *context, struct ast_config *vmcfg, const char *ext, struct ast_flags flags, itemlist *alist)
 {
        struct ast_variable *v;
        struct ast_str *buf = ast_str_thread_get(&commonbuf, 100);
        char *name;
        char *options;
        char *alias;
-       char *cat;
        struct directory_item *item;
        int res;
 
@@ -765,52 +764,10 @@ static int search_directory_sub(const char *context, struct ast_config *vmcfg, s
 
                AST_LIST_INSERT_TAIL(alist, item, entry);
        }
-
-       if (ucfg) {
-               for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
-                       const char *position;
-
-                       if (!strcasecmp(cat, "general")) {
-                               continue;
-                       }
-                       if (!ast_true(ast_config_option(ucfg, cat, "hasdirectory"))) {
-                               continue;
-                       }
-
-                       /* Find all candidate extensions */
-                       if (!(position = ast_variable_retrieve(ucfg, cat, "fullname"))) {
-                               continue;
-                       }
-
-                       res = 0;
-                       if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
-                               res = check_match(&item, context, position, cat, ext, 0 /* use_first_name */);
-                       }
-                       if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
-                               res = check_match(&item, context, position, cat, ext, 1 /* use_first_name */);
-                       }
-                       if (!res && ast_test_flag(&flags, OPT_ALIAS)) {
-                               for (v = ast_variable_browse(ucfg, cat); v; v = v->next) {
-                                       if (!strcasecmp(v->name, "alias")
-                                               && (res = check_match(&item, context, v->value, cat, ext, 1))) {
-                                               break;
-                                       }
-                               }
-                       }
-
-                       if (!res) {
-                               continue;
-                       } else if (res < 0) {
-                               return -1;
-                       }
-
-                       AST_LIST_INSERT_TAIL(alist, item, entry);
-               }
-       }
        return 0;
 }
 
-static int search_directory(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
+static int search_directory(const char *context, struct ast_config *vmcfg, const char *ext, struct ast_flags flags, itemlist *alist)
 {
        const char *searchcontexts = ast_variable_retrieve(vmcfg, "general", "searchcontexts");
        if (ast_strlen_zero(context)) {
@@ -823,19 +780,19 @@ static int search_directory(const char *context, struct ast_config *vmcfg, struc
                                        continue;
                                }
 
-                               if ((res = search_directory_sub(catg, vmcfg, ucfg, ext, flags, alist))) {
+                               if ((res = search_directory_sub(catg, vmcfg, ext, flags, alist))) {
                                        return res;
                                }
                        }
                        return 0;
                } else {
                        ast_debug(1, "Searching by category default\n");
-                       return search_directory_sub("default", vmcfg, ucfg, ext, flags, alist);
+                       return search_directory_sub("default", vmcfg, ext, flags, alist);
                }
        } else {
                /* Browse only the listed context for a match */
                ast_debug(1, "Searching by category %s\n", context);
-               return search_directory_sub(context, vmcfg, ucfg, ext, flags, alist);
+               return search_directory_sub(context, vmcfg, ext, flags, alist);
        }
 }
 
@@ -861,7 +818,7 @@ static void sort_items(struct directory_item **sorted, int count)
        } while (reordered);
 }
 
-static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, struct ast_config *ucfg, char *context, char *dialcontext, char digit, int digits, struct ast_flags *flags, char *opts[])
+static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, char *context, char *dialcontext, char digit, int digits, struct ast_flags *flags, char *opts[])
 {
        /* Read in the first three digits..  "digit" is the first digit, already read */
        int res = 0;
@@ -884,7 +841,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, stru
        if (ast_readstring(chan, ext + 1, digits - 1, 3000, 3000, "#") < 0)
                return -1;
 
-       res = search_directory(context, vmcfg, ucfg, ext, *flags, &alist);
+       res = search_directory(context, vmcfg, ext, *flags, &alist);
        if (res)
                goto exit;
 
@@ -943,11 +900,10 @@ exit:
 static int directory_exec(struct ast_channel *chan, const char *data)
 {
        int res = 0, digit = 3;
-       struct ast_config *cfg, *ucfg;
+       struct ast_config *cfg;
        const char *dirintro;
        char *parse, *opts[OPT_ARG_ARRAY_SIZE] = { 0, };
        struct ast_flags flags = { 0 };
-       struct ast_flags config_flags = { 0 };
        enum { FIRST, LAST, BOTH } which = LAST;
        char digits[9] = "digits/3";
        AST_DECLARE_APP_ARGS(args,
@@ -970,11 +926,6 @@ static int directory_exec(struct ast_channel *chan, const char *data)
                return -1;
        }
 
-       if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEINVALID) {
-               ast_log(LOG_ERROR, "Config file users.conf is in an invalid format.  Aborting.\n");
-               ucfg = NULL;
-       }
-
        dirintro = ast_variable_retrieve(cfg, args.vmcontext, "directoryintro");
        if (ast_strlen_zero(dirintro))
                dirintro = ast_variable_retrieve(cfg, "general", "directoryintro");
@@ -1065,7 +1016,7 @@ static int directory_exec(struct ast_channel *chan, const char *data)
                        break;
                }
 
-               res = do_directory(chan, cfg, ucfg, args.vmcontext, args.dialcontext, res, digit, &flags, opts);
+               res = do_directory(chan, cfg, args.vmcontext, args.dialcontext, res, digit, &flags, opts);
                if (res)
                        break;
 
@@ -1076,8 +1027,6 @@ static int directory_exec(struct ast_channel *chan, const char *data)
                }
        }
 
-       if (ucfg)
-               ast_config_destroy(ucfg);
        ast_config_destroy(cfg);
 
        if (ast_check_hangup(chan)) {
index 7ab47a940cd19cfe34e2bcb213feb225531c0b68..9f22d9c5daac1eca54d9741e1207a861432e2065 100644 (file)
@@ -782,7 +782,6 @@ enum vm_option_args {
 enum vm_passwordlocation {
        OPT_PWLOC_VOICEMAILCONF = 0,
        OPT_PWLOC_SPOOLDIR      = 1,
-       OPT_PWLOC_USERSCONF     = 2,
 };
 
 AST_APP_OPTIONS(vm_app_options, {
@@ -834,9 +833,9 @@ static int load_config_force(int reload, int force);
 
 static int load_config(int reload);
 #ifdef TEST_FRAMEWORK
-static int load_config_from_memory(int reload, struct ast_config *cfg, struct ast_config *ucfg);
+static int load_config_from_memory(int reload, struct ast_config *cfg);
 #endif
-static int actual_load_config(int reload, struct ast_config *cfg, struct ast_config *ucfg);
+static int actual_load_config(int reload, struct ast_config *cfg);
 
 /*! \page vmlang Voicemail Language Syntaxes Supported
 
@@ -1086,8 +1085,6 @@ static int pwdchange = PWDCHANGE_INTERNAL;
 # endif
 #endif
 
-static char userscontext[AST_MAX_EXTENSION] = "default";
-
 static char *addesc = "Comedian Mail";
 
 /* Leave a message */
@@ -2098,7 +2095,6 @@ static inline int valid_config(const struct ast_config *cfg)
 static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
 {
        struct ast_config   *cfg = NULL;
-       struct ast_variable *var = NULL;
        struct ast_category *cat = NULL;
        char *category = NULL;
        const char *tmp = NULL;
@@ -2163,48 +2159,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
 
                        ast_config_destroy(cfg);
                }
-               /* Fall-through */
-       case OPT_PWLOC_USERSCONF:
-               /* check users.conf and update the password stored for the mailbox */
-               /* if no vmsecret entry exists create one. */
-               if ((cfg = ast_config_load("users.conf", config_flags)) && valid_config(cfg)) {
-                       ast_debug(4, "we are looking for %s\n", vmu->mailbox);
-                       for (category = ast_category_browse(cfg, NULL); category; category = ast_category_browse(cfg, category)) {
-                               ast_debug(4, "users.conf: %s\n", category);
-                               if (!strcasecmp(category, vmu->mailbox)) {
-                                       char new[strlen(newpassword) + 1];
-                                       if (!ast_variable_retrieve(cfg, category, "vmsecret")) {
-                                               ast_debug(3, "looks like we need to make vmsecret!\n");
-                                               var = ast_variable_new("vmsecret", newpassword, "");
-                                       } else {
-                                               var = NULL;
-                                       }
-
-                                       sprintf(new, "%s", newpassword);
-                                       if (!(cat = ast_category_get(cfg, category, NULL))) {
-                                               ast_debug(4, "failed to get category!\n");
-                                               ast_free(var);
-                                               break;
-                                       }
-                                       if (!var) {
-                                               ast_variable_update(cat, "vmsecret", new, NULL, 0);
-                                       } else {
-                                               ast_variable_append(cat, var);
-                                       }
-                                       found = 1;
-                                       break;
-                               }
-                       }
-                       /* save the results and clean things up */
-                       if (found) {
-                               ast_test_suite_event_notify("PASSWORDCHANGED", "Message: users.conf updated with new password\r\nPasswordSource: users.conf");
-                               reset_user_pw(vmu->context, vmu->mailbox, newpassword);
-                               ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
-                               ast_config_text_file_save("users.conf", cfg, "app_voicemail");
-                       }
-
-                       ast_config_destroy(cfg);
-               }
+               break;
        }
 }
 
@@ -14736,7 +14691,7 @@ static const char *substitute_escapes(const char *value)
 
 static int load_config_force(int reload, int force)
 {
-       struct ast_config *cfg, *ucfg;
+       struct ast_config *cfg;
        struct ast_flags config_flags = { reload && !force ? CONFIG_FLAG_FILEUNCHANGED : 0 };
        int res;
 
@@ -14744,15 +14699,8 @@ static int load_config_force(int reload, int force)
        ast_unload_realtime("voicemail_data");
 
        if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
-               if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
-                       return 0;
-               } else if (ucfg == CONFIG_STATUS_FILEINVALID) {
-                       ast_log(LOG_ERROR, "Config file users.conf is in an invalid format.  Avoiding.\n");
-                       ucfg = NULL;
-               }
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
                if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEINVALID) {
-                       ast_config_destroy(ucfg);
                        ast_log(LOG_ERROR, "Config file " VOICEMAIL_CONFIG " is in an invalid format.  Aborting.\n");
                        return 0;
                }
@@ -14761,16 +14709,11 @@ static int load_config_force(int reload, int force)
                return 0;
        } else {
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
-               if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEINVALID) {
-                       ast_log(LOG_ERROR, "Config file users.conf is in an invalid format.  Avoiding.\n");
-                       ucfg = NULL;
-               }
        }
 
-       res = actual_load_config(reload, cfg, ucfg);
+       res = actual_load_config(reload, cfg);
 
        ast_config_destroy(cfg);
-       ast_config_destroy(ucfg);
 
        return res;
 }
@@ -14781,11 +14724,11 @@ static int load_config(int reload)
 }
 
 #ifdef TEST_FRAMEWORK
-static int load_config_from_memory(int reload, struct ast_config *cfg, struct ast_config *ucfg)
+static int load_config_from_memory(int reload, struct ast_config *cfg)
 {
        ast_unload_realtime("voicemail");
        ast_unload_realtime("voicemail_data");
-       return actual_load_config(reload, cfg, ucfg);
+       return actual_load_config(reload, cfg);
 }
 #endif
 
@@ -14881,15 +14824,12 @@ static void load_users(struct ast_config *cfg)
        }
 }
 
-static int actual_load_config(int reload, struct ast_config *cfg, struct ast_config *ucfg)
+static int actual_load_config(int reload, struct ast_config *cfg)
 {
-       struct ast_vm_user *current;
-       char *cat;
        const char *val;
        char *q, *stringp, *tmp;
        int x;
        unsigned int tmpadsi[4];
-       char secretfn[PATH_MAX] = "";
        long tps_queue_low;
        long tps_queue_high;
 
@@ -14898,6 +14838,7 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
 #endif
        /* set audio control prompts */
        strcpy(listen_control_forward_key, DEFAULT_LISTEN_CONTROL_FORWARD_KEY);
+       strcpy(listen_control_forward_key, DEFAULT_LISTEN_CONTROL_FORWARD_KEY);
        strcpy(listen_control_reverse_key, DEFAULT_LISTEN_CONTROL_REVERSE_KEY);
        strcpy(listen_control_pause_key, DEFAULT_LISTEN_CONTROL_PAUSE_KEY);
        strcpy(listen_control_restart_key, DEFAULT_LISTEN_CONTROL_RESTART_KEY);
@@ -14924,11 +14865,6 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
 
        if (cfg) {
                /* General settings */
-
-               if (!(val = ast_variable_retrieve(cfg, "general", "userscontext")))
-                       val = "default";
-               ast_copy_string(userscontext, val, sizeof(userscontext));
-
                aliasescontext[0] = '\0';
                val = ast_variable_retrieve(cfg, "general", "aliasescontext");
                ast_copy_string(aliasescontext, S_OR(val, ""), sizeof(aliasescontext));
@@ -15524,31 +15460,6 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
                        ast_log(AST_LOG_WARNING, "Failed to set alert levels for voicemail taskprocessor.\n");
                }
 
-               /* load mailboxes from users.conf */
-               if (ucfg) {
-                       for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
-                               if (!strcasecmp(cat, "general")) {
-                                       continue;
-                               }
-                               if (!ast_true(ast_config_option(ucfg, cat, "hasvoicemail")))
-                                       continue;
-                               if ((current = find_or_create(userscontext, cat))) {
-                                       populate_defaults(current);
-                                       apply_options_full(current, ast_variable_browse(ucfg, cat));
-                                       ast_copy_string(current->context, userscontext, sizeof(current->context));
-                                       if (!ast_strlen_zero(current->password) && current->passwordlocation == OPT_PWLOC_VOICEMAILCONF) {
-                                               current->passwordlocation = OPT_PWLOC_USERSCONF;
-                                       }
-
-                                       switch (current->passwordlocation) {
-                                       case OPT_PWLOC_SPOOLDIR:
-                                               snprintf(secretfn, sizeof(secretfn), "%s%s/%s/secret.conf", VM_SPOOL_DIR, current->context, current->mailbox);
-                                               read_password_from_file(secretfn, current->password, sizeof(current->password));
-                                       }
-                               }
-                       }
-               }
-
                /* load mailboxes from voicemail.conf */
 
                /*
@@ -16119,7 +16030,7 @@ AST_TEST_DEFINE(test_voicemail_load_config)
                goto cleanup;
        }
 
-       load_config_from_memory(1, cfg, NULL);
+       load_config_from_memory(1, cfg);
        ast_config_destroy(cfg);
 
 #define CHECK(u, attr, value) else if (strcmp(u->attr, value)) { \
index 2b0b14f471e20f4f840941573f7abbaba4f07463..99a28b02860101e0f64299e333e421807f241414 100644 (file)
@@ -18676,19 +18676,6 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                        ast_copy_string(confp->chan.mailbox, v->value, sizeof(confp->chan.mailbox));
                } else if (!strcasecmp(v->name, "description")) {
                        ast_copy_string(confp->chan.description, v->value, sizeof(confp->chan.description));
-               } else if (!strcasecmp(v->name, "hasvoicemail")) {
-                       if (ast_true(v->value) && ast_strlen_zero(confp->chan.mailbox)) {
-                               /*
-                                * hasvoicemail is a users.conf legacy voicemail enable method.
-                                * hasvoicemail is only going to work for app_voicemail mailboxes.
-                                */
-                               if (strchr(cat, '@')) {
-                                       ast_copy_string(confp->chan.mailbox, cat, sizeof(confp->chan.mailbox));
-                               } else {
-                                       snprintf(confp->chan.mailbox, sizeof(confp->chan.mailbox),
-                                               "%s@default", cat);
-                               }
-                       }
                } else if (!strcasecmp(v->name, "adsi")) {
                        confp->chan.adsi = ast_true(v->value);
                } else if (!strcasecmp(v->name, "usesmdi")) {
@@ -20062,7 +20049,7 @@ static void deep_copy_dahdi_chan_conf(struct dahdi_chan_conf *dest, const struct
 static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, struct dahdi_chan_conf *base_conf, struct dahdi_chan_conf *conf)
 {
        struct ast_config *cfg;
-       struct ast_config *ucfg;
+       struct ast_config;
        struct ast_variable *v;
        struct ast_flags config_flags = { reload == 1 ? CONFIG_FLAG_FILEUNCHANGED : 0 };
        const char *chans;
@@ -20092,25 +20079,7 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
                if (!cfg) {
                        return 0;
                }
-               ucfg = ast_config_load("users.conf", config_flags);
-               if (ucfg == CONFIG_STATUS_FILEUNCHANGED) {
-                       ast_config_destroy(cfg);
-                       return 0;
-               }
-               if (ucfg == CONFIG_STATUS_FILEINVALID) {
-                       ast_log(LOG_ERROR, "File users.conf cannot be parsed.  Aborting.\n");
-                       ast_config_destroy(cfg);
-                       return 0;
-               }
        } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
-               ucfg = ast_config_load("users.conf", config_flags);
-               if (ucfg == CONFIG_STATUS_FILEUNCHANGED) {
-                       return 0;
-               }
-               if (ucfg == CONFIG_STATUS_FILEINVALID) {
-                       ast_log(LOG_ERROR, "File users.conf cannot be parsed.  Aborting.\n");
-                       return 0;
-               }
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
                cfg = ast_config_load(config, config_flags);
                have_cfg_now = !!cfg;
@@ -20118,17 +20087,14 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
                        if (had_cfg_before) {
                                /* We should have been able to load the config. */
                                ast_log(LOG_ERROR, "Bad. Unable to load config %s\n", config);
-                               ast_config_destroy(ucfg);
                                return 0;
                        }
                        cfg = ast_config_new();/* Dummy config */
                        if (!cfg) {
-                               ast_config_destroy(ucfg);
                                return 0;
                        }
                } else if (cfg == CONFIG_STATUS_FILEINVALID) {
                        ast_log(LOG_ERROR, "File %s cannot be parsed.  Aborting.\n", config);
-                       ast_config_destroy(ucfg);
                        return 0;
                }
        } else if (cfg == CONFIG_STATUS_FILEINVALID) {
@@ -20136,12 +20102,6 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
                return 0;
        } else {
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
-               ucfg = ast_config_load("users.conf", config_flags);
-               if (ucfg == CONFIG_STATUS_FILEINVALID) {
-                       ast_log(LOG_ERROR, "File users.conf cannot be parsed.  Aborting.\n");
-                       ast_config_destroy(cfg);
-                       return 0;
-               }
        }
        had_cfg_before = have_cfg_now;
 
@@ -20219,9 +20179,6 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
                v, reload, 0))) {
                ast_mutex_unlock(&iflock);
                ast_config_destroy(cfg);
-               if (ucfg) {
-                       ast_config_destroy(ucfg);
-               }
                return res;
        }
 
@@ -20249,44 +20206,11 @@ static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, str
                if ((res = process_dahdi(conf, cat, ast_variable_browse(cfg, cat), reload, PROC_DAHDI_OPT_NOCHAN))) {
                        ast_mutex_unlock(&iflock);
                        ast_config_destroy(cfg);
-                       if (ucfg) {
-                               ast_config_destroy(ucfg);
-                       }
                        return res;
                }
        }
 
        ast_config_destroy(cfg);
-
-       if (ucfg) {
-               /* Reset base_conf, so things don't leak from chan_dahdi.conf */
-               deep_copy_dahdi_chan_conf(base_conf, default_conf);
-               process_dahdi(base_conf,
-                       "" /* Must be empty for the general category.  Silly voicemail mailbox. */,
-                       ast_variable_browse(ucfg, "general"), 1, 0);
-
-               for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
-                       if (!strcasecmp(cat, "general")) {
-                               continue;
-                       }
-
-                       chans = ast_variable_retrieve(ucfg, cat, "dahdichan");
-                       if (ast_strlen_zero(chans)) {
-                               /* Section is useless without a dahdichan value present. */
-                               continue;
-                       }
-
-                       /* Copy base_conf to conf. */
-                       deep_copy_dahdi_chan_conf(conf, base_conf);
-
-                       if ((res = process_dahdi(conf, cat, ast_variable_browse(ucfg, cat), reload, PROC_DAHDI_OPT_NOCHAN | PROC_DAHDI_OPT_NOWARN))) {
-                               ast_config_destroy(ucfg);
-                               ast_mutex_unlock(&iflock);
-                               return res;
-                       }
-               }
-               ast_config_destroy(ucfg);
-       }
        ast_mutex_unlock(&iflock);
 
 #ifdef HAVE_PRI
index 465f9805ff3a395f955825bcdc40b77fcf8b61a1..1ddf66fe3d7fa82e6c519f1e64397ad595ccf106 100644 (file)
@@ -13083,18 +13083,6 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
                                ast_string_field_set(peer, secret, v->value);
                        } else if (!strcasecmp(v->name, "mailbox")) {
                                ast_string_field_set(peer, mailbox, v->value);
-                       } else if (!strcasecmp(v->name, "hasvoicemail")) {
-                               if (ast_true(v->value) && ast_strlen_zero(peer->mailbox)) {
-                                       /*
-                                        * hasvoicemail is a users.conf legacy voicemail enable method.
-                                        * hasvoicemail is only going to work for app_voicemail mailboxes.
-                                        */
-                                       if (strchr(name, '@')) {
-                                               ast_string_field_set(peer, mailbox, name);
-                                       } else {
-                                               ast_string_field_build(peer, mailbox, "%s@default", name);
-                                       }
-                               }
                        } else if (!strcasecmp(v->name, "mohinterpret")) {
                                ast_string_field_set(peer, mohinterpret, v->value);
                        } else if (!strcasecmp(v->name, "mohsuggest")) {
@@ -13695,7 +13683,7 @@ static void set_config_destroy(void)
 /*! \brief Load configuration */
 static int set_config(const char *config_file, int reload, int forced)
 {
-       struct ast_config *cfg, *ucfg;
+       struct ast_config *cfg;
        iax2_format capability;
        struct ast_variable *v;
        char *cat;
@@ -13719,14 +13707,9 @@ static int set_config(const char *config_file, int reload, int forced)
                ast_log(LOG_ERROR, "Unable to load config %s\n", config_file);
                return -1;
        } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
-               ucfg = ast_config_load("users.conf", config_flags);
-               if (ucfg == CONFIG_STATUS_FILEUNCHANGED)
-                       return 0;
-               /* Otherwise we need to reread both files */
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
                if ((cfg = ast_config_load(config_file, config_flags)) == CONFIG_STATUS_FILEINVALID) {
                        ast_log(LOG_ERROR, "Config file %s is in an invalid format.  Aborting.\n", config_file);
-                       ast_config_destroy(ucfg);
                        return 0;
                }
                if (!cfg) {
@@ -13737,13 +13720,8 @@ static int set_config(const char *config_file, int reload, int forced)
        } else if (cfg == CONFIG_STATUS_FILEINVALID) {
                ast_log(LOG_ERROR, "Config file %s is in an invalid format.  Aborting.\n", config_file);
                return 0;
-       } else { /* iax.conf changed, gotta reread users.conf, too */
+       } else { /* iax.conf changed */
                ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
-               if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEINVALID) {
-                       ast_log(LOG_ERROR, "Config file users.conf is in an invalid format.  Aborting.\n");
-                       ast_config_destroy(cfg);
-                       return 0;
-               }
        }
 
        if (reload) {
@@ -14126,61 +14104,6 @@ static int set_config(const char *config_file, int reload, int forced)
        prefs_global = prefs_new;
        iax2_capability = capability;
 
-       if (ucfg) {
-               struct ast_variable *gen;
-               int genhasiax;
-               int genregisteriax;
-               const char *hasiax, *registeriax;
-
-               genhasiax = ast_true(ast_variable_retrieve(ucfg, "general", "hasiax"));
-               genregisteriax = ast_true(ast_variable_retrieve(ucfg, "general", "registeriax"));
-               gen = ast_variable_browse(ucfg, "general");
-               cat = ast_category_browse(ucfg, NULL);
-               while (cat) {
-                       if (strcasecmp(cat, "general")) {
-                               hasiax = ast_variable_retrieve(ucfg, cat, "hasiax");
-                               registeriax = ast_variable_retrieve(ucfg, cat, "registeriax");
-                               if (ast_true(hasiax) || (!hasiax && genhasiax)) {
-                                       /* Start with general parameters, then specific parameters, user and peer */
-                                       user = build_user(cat, gen, ast_variable_browse(ucfg, cat), 0);
-                                       if (user) {
-                                               ao2_link(users, user);
-                                               user = user_unref(user);
-                                       }
-                                       peer = build_peer(cat, gen, ast_variable_browse(ucfg, cat), 0);
-                                       if (peer) {
-                                               if (ast_test_flag64(peer, IAX_DYNAMIC)) {
-                                                       reg_source_db(peer);
-                                               }
-                                               ao2_link(peers, peer);
-                                               peer = peer_unref(peer);
-                                       }
-                               }
-                               if (ast_true(registeriax) || (!registeriax && genregisteriax)) {
-                                       char tmp[256];
-                                       const char *host = ast_variable_retrieve(ucfg, cat, "host");
-                                       const char *username = ast_variable_retrieve(ucfg, cat, "username");
-                                       const char *secret = ast_variable_retrieve(ucfg, cat, "secret");
-                                       if (!host)
-                                               host = ast_variable_retrieve(ucfg, "general", "host");
-                                       if (!username)
-                                               username = ast_variable_retrieve(ucfg, "general", "username");
-                                       if (!secret)
-                                               secret = ast_variable_retrieve(ucfg, "general", "secret");
-                                       if (!ast_strlen_zero(username) && !ast_strlen_zero(host)) {
-                                               if (!ast_strlen_zero(secret))
-                                                       snprintf(tmp, sizeof(tmp), "%s:%s@%s", username, secret, host);
-                                               else
-                                                       snprintf(tmp, sizeof(tmp), "%s@%s", username, host);
-                                               iax2_register(tmp, 0);
-                                       }
-                               }
-                       }
-                       cat = ast_category_browse(ucfg, cat);
-               }
-               ast_config_destroy(ucfg);
-       }
-
        cat = ast_category_browse(cfg, NULL);
        while(cat) {
                if (strcasecmp(cat, "general")) {
index a574ab41f8f97699d2643a3fdad3f85f2fb64552..8797c677b3a2797ae3ead3056f425c7b359f652e 100644 (file)
@@ -1777,7 +1777,7 @@ pickupgroup=1
 ; ~~~~~~~~~~~~~~~~~~~~~~
 ; You can also configure channels in a separate chan_dahdi.conf section. In
 ; this case the keyword 'channel' is not used. Instead the keyword
-; 'dahdichan' is used (as in users.conf) - configuration is only processed
+; 'dahdichan' is used - configuration is only processed
 ; in a section where the keyword dahdichan is used. It will only be
 ; processed in the end of the section. Thus the following section:
 ;
@@ -1795,8 +1795,7 @@ pickupgroup=1
 ;
 ; When starting a new section almost all of the configuration values are
 ; copied from their values at the end of the section [channels] in
-; chan_dahdi.conf and [general] in users.conf - one section's configuration
-; does not affect another one's.
+; chan_dahdi.conf - one section's configuration does not affect another one's.
 ;
 ; Instead of letting common configuration values "slide through" you can
 ; use configuration templates to easily keep the common part in one
index fc2c4868511f098b03d03d8f3ec0eae217a3cdb5..f98eeed5cf84bf5594adb4c26a6c28a85a8a41a5 100644 (file)
@@ -1,5 +1,5 @@
 [general]
-; This section applies only to the default users.conf config provider
+; This section applies only to the default phoneprov_users.conf config provider
 ; embedded in res_phoneprov.  Other providers may provide their own default settings.
 
 ; The default behavior of res_phoneprov will be to set the SERVER template variable to
@@ -11,7 +11,7 @@
                         ; Useful for when the interface uses DHCP and the asterisk http
                         ; server listens on a different IP than sip.
 ;serverport=5060        ; Override port to send to the phone to use as server port.
-default_profile=polycom ; The default profile to use if none specified in users.conf
+default_profile=polycom ; The default profile to use if none specified in phoneprov_users.conf
 
 ; You can define profiles for different phones specifying what files to register
 ; with the provisioning server.  You can define either static files, or dynamically
@@ -29,10 +29,10 @@ default_profile=polycom ; The default profile to use if none specified in users.
 
 ; Dynamically generated files have a filename registered with variable substitution
 ; with variables obtained from various config providers.  The default provider
-; embedded in res_phoneprov reads users.conf.  Other providers will have their own
+; embedded in res_phoneprov reads phoneprov_users.conf.  Other providers will have their own
 ; sources for the variables and may provide additional variables not listed here.
 
-; Built in variables and the options in users.conf that they come from
+; Built in variables and the options in phoneprov_users.conf that they come from
 ;   MAC (macaddress)
 ;   USERNAME (username)
 ;   DISPLAY_NAME (fullname)
diff --git a/configs/samples/phoneprov_users.conf b/configs/samples/phoneprov_users.conf
new file mode 100644 (file)
index 0000000..40de4e0
--- /dev/null
@@ -0,0 +1,40 @@
+;
+; Device provisioning configuration
+;
+; This file is used by res_phoneprov to define provisioning entries.
+;
+
+[general]
+;
+; Full name of a user
+;
+fullname = New User
+;
+; MAC Address for res_phoneprov
+;
+;macaddress = 112233445566
+;
+; Auto provision the phone with res_phoneprov
+;
+;autoprov = yes
+;
+; Line Keys for hardphone
+;
+;LINEKEYS = 1
+;
+; Line number for hardphone
+;
+;linenumber = 1
+;
+; Local Caller ID number used with res_phoneprov and Asterisk GUI
+;
+;cid_number = 6000
+
+;[6000]
+;fullname = Joe User
+;secret = 1234
+;macaddress = 112233445566
+;autoprov = yes
+;LINEKEYS = 1
+;linenumber = 1
+;cid_number = 6000
diff --git a/configs/samples/users.conf.sample b/configs/samples/users.conf.sample
deleted file mode 100644 (file)
index 3f1076a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-;
-; User configuration
-;
-; WARNING: This configuration file is deprecated and will be removed in
-; a future version of Asterisk. It is recommended that you make configurations
-; in the appropriate module-specific configuration file for more flexibility.
-; Many Asterisk modules already no longer support users.conf.
-;
-; Creating entries in users.conf is a "shorthand" for creating individual
-; entries in each configuration file.  Using users.conf is not intended to
-; provide you with as much flexibility as using the separate configuration
-; files (e.g. iax.conf, etc) but is intended to accelerate the
-; simple task of adding users.  Note that creating individual items (e.g.
-; IAX friends, etc.) will allow you to override specific parameters within
-; this file.  Parameter names here are the same as they appear in the
-; other configuration files.  There is no way to change the value of a
-; parameter here for just one subsystem.
-;
-
-[general]
-;
-; Full name of a user
-;
-fullname = New User
-;
-; Starting point of allocation of extensions
-;
-userbase = 6000
-;
-; Create voicemail mailbox
-;
-hasvoicemail = yes
-;
-; Set voicemail mailbox 6000 password to 1234
-;
-vmsecret = 1234
-;
-; Create IAX friend
-;
-hasiax = yes
-;
-; Create H.323 friend
-;
-;hash323 = yes
-;
-; Create manager entry
-;
-hasmanager = no
-;
-; Set permissions for manager entry (see manager.conf.sample for documentation)
-; (defaults to *all* permissions)
-;managerread = system,call,log,verbose,command,agent,user,config
-;managerwrite = system,call,log,verbose,command,agent,user,config
-;
-;
-; MAC Address for res_phoneprov
-;
-;macaddress = 112233445566
-;
-; Auto provision the phone with res_phoneprov
-;
-;autoprov = yes
-;
-; Line Keys for hardphone
-;
-;LINEKEYS = 1
-;
-; Line number for hardphone
-;
-;linenumber = 1
-;
-; Local Caller ID number used with res_phoneprov and Asterisk GUI
-;
-;cid_number = 6000
-;
-; Remaining options are not specific to users.conf entries but are general.
-;
-callwaiting = yes
-threewaycalling = yes
-callwaitingcallerid = yes
-transfer = yes
-canpark = yes
-cancallforward = yes
-callreturn = yes
-callgroup = 1
-pickupgroup = 1
-;nat = no
-
-;[6000]
-;fullname = Joe User
-;description = Courtesy Phone In Lobby    ; Used to provide a description of the
-                                          ; peer in console output
-;email = joe@foo.bar
-;secret = 1234
-;dahdichan = 1
-;hasvoicemail = yes
-;vmsecret = 1234
-;hasiax = no
-;hash323 = no
-;hasmanager = no
-;callwaiting = no
-;context = international
-;
-; Some administrators choose alphanumeric extensions, but still want their
-; users to be reachable by traditional numeric extensions, specified by the
-; alternateexts entry.
-;
-;alternateexts = 7057,3249
-;macaddress = 112233445566
-;autoprov = yes
-;LINEKEYS = 1
-;linenumber = 1
-;cid_number = 6000
index 70e0db13582370a2c98f1cd8ce7b39858626238f..1d6e24072adc3332a51442e9b425fb630d43080a 100644 (file)
@@ -72,11 +72,6 @@ maxlogins=3
 ; sender can set the urgency on the envelope of the forwarded message.
 ;forward_urgent_auto=no
 ;
-; User context is where entries from users.conf are registered.  The
-; default value is 'default'
-;
-;userscontext=default
-;
 ; Aliases allow a mailbox to be referenced by an alias.  The aliases are
 ; specified in the special context named here.  There is no default.
 ;aliasescontext=myaliases
@@ -411,7 +406,7 @@ sendvoicemail=yes ; Allow the user to compose and send a voicemail while inside
                     ; Supported options:
                     ;   voicemail.conf:
                     ;     This is the default option.  The secret is read from
-                    ;     and written to voicemail.conf (or users.conf).
+                    ;     and written to voicemail.conf.
                     ;   spooldir:
                     ;     The secret is stored in a separate file in the user's
                     ;     voicemail spool directory in a file named secret.conf.
@@ -419,7 +414,7 @@ sendvoicemail=yes ; Allow the user to compose and send a voicemail while inside
                     ;     permitted to access Asterisk's spool directory as the
                     ;     secret is stored in plain text.  If a secret is not
                     ;     found in this directory, the password in
-                    ;     voicemail.conf (or users.conf) will be used.
+                    ;     voicemail.conf will be used.
                     ; Note that this option does not affect password storage for
                     ; realtime users, which are still stored in the realtime
                     ; backend.
index de51a4dc73841c6bee527625d75c7c913cc4f74c..0d6b6431aaf23b3661b72913102ea64e7f70ddc8 100644 (file)
@@ -193,39 +193,6 @@ sub check_login($$)
                }
        }
        close(VMAIL);
-       return check_login_users();
-}
-
-sub check_login_users {
-       my ($mbox, $context) = split(/\@/, param('mailbox'));
-       my $pass = param('password');
-       my ($found, $fullname) = (0, "");
-       open VMAIL, "</etc/asterisk/users.conf";
-       while (<VMAIL>) {
-               chomp;
-               if (m/\[(.*)\]/) {
-                       if ($1 eq $mbox) {
-                               $found = 1;
-                       } elsif ($found == 2) {
-                               close VMAIL;
-                               return (($fullname ? $fullname : "Extension $mbox in $context"), $context);
-                       } else {
-                               $found = 0;
-                       }
-               } elsif ($found) {
-                       my ($var, $value) = split /\s*=\s*/, $_, 2;
-                       if ($var eq 'vmsecret' and $value eq $pass) {
-                               $found = 2;
-                       } elsif ($var eq 'fullname') {
-                               $fullname = $value;
-                               if ($found == 2) {
-                                       close VMAIL;
-                                       return ($fullname, $context);
-                               }
-                       }
-               }
-       }
-       close VMAIL;
        return ("", "");
 }
 
index 241cec2b26036eb1cc4b5412bf8a1620cceccf0e..291a2eb964e634fab9a7b7fdffa2793f67f48226 100644 (file)
@@ -36,7 +36,7 @@
  * \ref amiconf
  */
 
-/*! \li \ref manager.c uses the configuration file \ref manager.conf and \ref users.conf
+/*! \li \ref manager.c uses the configuration file \ref manager.conf
  * \addtogroup configuration_file
  */
 
  * \verbinclude manager.conf.sample
  */
 
-/*! \page users.conf users.conf
- * \verbinclude users.conf.sample
- */
-
 /*** MODULEINFO
        <support_level>core</support_level>
  ***/
@@ -9645,7 +9641,7 @@ static void manager_set_defaults(void)
 
 static int __init_manager(int reload, int by_external_config)
 {
-       struct ast_config *ucfg = NULL, *cfg = NULL;
+       struct ast_config *cfg = NULL;
        const char *val;
        char *cat = NULL;
        int newhttptimeout = 60;
@@ -9880,100 +9876,6 @@ static int __init_manager(int reload, int by_external_config)
 
        AST_RWLIST_WRLOCK(&users);
 
-       /* First, get users from users.conf */
-       ucfg = ast_config_load2("users.conf", "manager", config_flags);
-       if (ucfg && (ucfg != CONFIG_STATUS_FILEUNCHANGED) && ucfg != CONFIG_STATUS_FILEINVALID) {
-               const char *hasmanager;
-               int genhasmanager = ast_true(ast_variable_retrieve(ucfg, "general", "hasmanager"));
-
-               while ((cat = ast_category_browse(ucfg, cat))) {
-                       if (!strcasecmp(cat, "general")) {
-                               continue;
-                       }
-
-                       hasmanager = ast_variable_retrieve(ucfg, cat, "hasmanager");
-                       if ((!hasmanager && genhasmanager) || ast_true(hasmanager)) {
-                               const char *user_secret = ast_variable_retrieve(ucfg, cat, "secret");
-                               const char *user_read = ast_variable_retrieve(ucfg, cat, "read");
-                               const char *user_write = ast_variable_retrieve(ucfg, cat, "write");
-                               const char *user_displayconnects = ast_variable_retrieve(ucfg, cat, "displayconnects");
-                               const char *user_allowmultiplelogin = ast_variable_retrieve(ucfg, cat, "allowmultiplelogin");
-                               const char *user_writetimeout = ast_variable_retrieve(ucfg, cat, "writetimeout");
-
-                               /* Look for an existing entry,
-                                * if none found - create one and add it to the list
-                                */
-                               if (!(user = get_manager_by_name_locked(cat))) {
-                                       if (!(user = ast_calloc(1, sizeof(*user)))) {
-                                               break;
-                                       }
-
-                                       /* Copy name over */
-                                       ast_copy_string(user->username, cat, sizeof(user->username));
-                                       /* Insert into list */
-                                       AST_LIST_INSERT_TAIL(&users, user, list);
-                                       user->acl = NULL;
-                                       user->keep = 1;
-                                       user->readperm = -1;
-                                       user->writeperm = -1;
-                                       /* Default displayconnect from [general] */
-                                       user->displayconnects = displayconnects;
-                                       /* Default allowmultiplelogin from [general] */
-                                       user->allowmultiplelogin = allowmultiplelogin;
-                                       user->writetimeout = 100;
-                               }
-
-                               if (!user_secret) {
-                                       user_secret = ast_variable_retrieve(ucfg, "general", "secret");
-                               }
-                               if (!user_read) {
-                                       user_read = ast_variable_retrieve(ucfg, "general", "read");
-                               }
-                               if (!user_write) {
-                                       user_write = ast_variable_retrieve(ucfg, "general", "write");
-                               }
-                               if (!user_displayconnects) {
-                                       user_displayconnects = ast_variable_retrieve(ucfg, "general", "displayconnects");
-                               }
-                               if (!user_allowmultiplelogin) {
-                                       user_allowmultiplelogin = ast_variable_retrieve(ucfg, "general", "allowmultiplelogin");
-                               }
-                               if (!user_writetimeout) {
-                                       user_writetimeout = ast_variable_retrieve(ucfg, "general", "writetimeout");
-                               }
-
-                               if (!ast_strlen_zero(user_secret)) {
-                                       ast_free(user->secret);
-                                       user->secret = ast_strdup(user_secret);
-                               }
-
-                               if (user_read) {
-                                       user->readperm = get_perm(user_read);
-                               }
-                               if (user_write) {
-                                       user->writeperm = get_perm(user_write);
-                               }
-                               if (user_displayconnects) {
-                                       user->displayconnects = ast_true(user_displayconnects);
-                               }
-                               if (user_allowmultiplelogin) {
-                                       user->allowmultiplelogin = ast_true(user_allowmultiplelogin);
-                               }
-                               if (user_writetimeout) {
-                                       int value = atoi(user_writetimeout);
-                                       if (value < 100) {
-                                               ast_log(LOG_WARNING, "Invalid writetimeout value '%d' in users.conf\n", value);
-                                       } else {
-                                               user->writetimeout = value;
-                                       }
-                               }
-                       }
-               }
-               ast_config_destroy(ucfg);
-       }
-
-       /* cat is NULL here in any case */
-
        while ((cat = ast_category_browse(cfg, cat))) {
                struct ast_acl_list *oldacl;
 
index 9d43164136f923a656ffb1dd64190d2280b81b7a..4b052d0cefc8d32f30faccd1321e4be574b85772 100644 (file)
@@ -110,8 +110,6 @@ static int clearglobalvars_config = 0;
 static int extenpatternmatchnew_config = 0;
 static char *overrideswitch_config = NULL;
 
-static struct stasis_subscription *fully_booted_subscription;
-
 AST_MUTEX_DEFINE_STATIC(save_dialplan_lock);
 
 AST_MUTEX_DEFINE_STATIC(reload_lock);
@@ -1641,8 +1639,6 @@ static int unload_module(void)
        ast_manager_unregister(AMI_EXTENSION_REMOVE);
        ast_context_destroy(NULL, registrar);
 
-       stasis_unsubscribe_and_join(fully_booted_subscription);
-
        return 0;
 }
 
@@ -1972,143 +1968,6 @@ process_extension:
        return 1;
 }
 
-static void append_interface(char *iface, int maxlen, char *add)
-{
-       int len = strlen(iface);
-       if (strlen(add) + len < maxlen - 2) {
-               if (strlen(iface)) {
-                       iface[len] = '&';
-                       strcpy(iface + len + 1, add);
-               } else
-                       strcpy(iface, add);
-       }
-}
-
-static void startup_event_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
-{
-       struct ast_json_payload *payload;
-       const char *type;
-
-       if (stasis_message_type(message) != ast_manager_get_generic_type()) {
-               return;
-       }
-
-       payload = stasis_message_data(message);
-       type = ast_json_string_get(ast_json_object_get(payload->json, "type"));
-
-       if (strcmp(type, "FullyBooted")) {
-               return;
-       }
-
-       ast_log(LOG_WARNING, "users.conf is deprecated and will be removed in a future version of Asterisk\n");
-
-       fully_booted_subscription = stasis_unsubscribe(fully_booted_subscription);
-}
-
-static void pbx_load_users(void)
-{
-       struct ast_config *cfg;
-       char *cat, *chan;
-       const char *dahdichan;
-       const char *hasexten, *altexts;
-       char tmp[256];
-       char iface[256];
-       char dahdicopy[256];
-       char *ext, altcopy[256];
-       char *c;
-       int hasvoicemail;
-       int start, finish, x;
-       struct ast_context *con = NULL;
-       struct ast_flags config_flags = { 0 };
-
-       cfg = ast_config_load("users.conf", config_flags);
-       if (!cfg)
-               return;
-
-       /*! \todo Remove users.conf support in Asterisk 23 */
-       fully_booted_subscription =
-               stasis_subscribe_pool(ast_manager_get_topic(), startup_event_cb, NULL);
-
-       for (cat = ast_category_browse(cfg, NULL); cat ; cat = ast_category_browse(cfg, cat)) {
-               if (!strcasecmp(cat, "general"))
-                       continue;
-               iface[0] = '\0';
-               if (ast_true(ast_config_option(cfg, cat, "hasiax"))) {
-                       snprintf(tmp, sizeof(tmp), "IAX2/%s", cat);
-                       append_interface(iface, sizeof(iface), tmp);
-               }
-               if (ast_true(ast_config_option(cfg, cat, "hash323"))) {
-                       snprintf(tmp, sizeof(tmp), "H323/%s", cat);
-                       append_interface(iface, sizeof(iface), tmp);
-               }
-               hasexten = ast_config_option(cfg, cat, "hasexten");
-               if (hasexten && !ast_true(hasexten))
-                       continue;
-               hasvoicemail = ast_true(ast_config_option(cfg, cat, "hasvoicemail"));
-               dahdichan = ast_variable_retrieve(cfg, cat, "dahdichan");
-               if (!dahdichan)
-                       dahdichan = ast_variable_retrieve(cfg, "general", "dahdichan");
-               if (!ast_strlen_zero(dahdichan)) {
-                       ast_copy_string(dahdicopy, dahdichan, sizeof(dahdicopy));
-                       c = dahdicopy;
-                       chan = strsep(&c, ",");
-                       while (chan) {
-                               if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) {
-                                       /* Range */
-                               } else if (sscanf(chan, "%30d", &start)) {
-                                       /* Just one */
-                                       finish = start;
-                               } else {
-                                       start = 0; finish = 0;
-                               }
-                               if (finish < start) {
-                                       x = finish;
-                                       finish = start;
-                                       start = x;
-                               }
-                               for (x = start; x <= finish; x++) {
-                                       snprintf(tmp, sizeof(tmp), "DAHDI/%d", x);
-                                       append_interface(iface, sizeof(iface), tmp);
-                               }
-                               chan = strsep(&c, ",");
-                       }
-               }
-               if (!ast_strlen_zero(iface)) {
-                       /* Only create a context here when it is really needed. Otherwise default empty context
-                       created by pbx_config may conflict with the one explicitly created by pbx_ael */
-                       if (!con)
-                               con = ast_context_find_or_create(&local_contexts, local_table, userscontext, registrar);
-
-                       if (!con) {
-                               ast_log(LOG_ERROR, "Can't find/create user context '%s'\n", userscontext);
-                               return;
-                       }
-
-                       /* Add hint */
-                       ast_add_extension2(con, 0, cat, -1, NULL, NULL, iface, NULL, NULL, registrar, NULL, 0);
-                       /* If voicemail, use "stdexten" else use plain old dial */
-                       if (hasvoicemail) {
-                               snprintf(tmp, sizeof(tmp), "%s,stdexten(${HINT})", cat);
-                               ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Gosub", ast_strdup(tmp), ast_free_ptr, registrar, NULL, 0);
-                       } else {
-                               ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", ast_strdup("${HINT}"), ast_free_ptr, registrar, NULL, 0);
-                       }
-                       altexts = ast_variable_retrieve(cfg, cat, "alternateexts");
-                       if (!ast_strlen_zero(altexts)) {
-                               snprintf(tmp, sizeof(tmp), "%s,1", cat);
-                               ast_copy_string(altcopy, altexts, sizeof(altcopy));
-                               c = altcopy;
-                               ext = strsep(&c, ",");
-                               while (ext) {
-                                       ast_add_extension2(con, 0, ext, 1, NULL, NULL, "Goto", ast_strdup(tmp), ast_free_ptr, registrar, NULL, 0);
-                                       ext = strsep(&c, ",");
-                               }
-                       }
-               }
-       }
-       ast_config_destroy(cfg);
-}
-
 static int pbx_load_module(void)
 {
        struct ast_context *con;
@@ -2130,8 +1989,6 @@ static int pbx_load_module(void)
                return AST_MODULE_LOAD_DECLINE;
        }
 
-       pbx_load_users();
-
        ast_merge_contexts_and_delete(&local_contexts, local_table, registrar);
        local_table = NULL; /* the local table has been moved into the global one. */
        local_contexts = NULL;
index 0ddf9c8f5cba3205fc1c778c490047334c477b37..73bac32479c7916ec8a8b6f38e1767e7e4fa23a1 100644 (file)
@@ -29,7 +29,7 @@
  * \author George Joseph <george.joseph@fairview5.com>
   */
 
-/*! \li \ref res_phoneprov.c uses the configuration file \ref phoneprov.conf and \ref users.conf
+/*! \li \ref res_phoneprov.c uses the configuration file \ref phoneprov.conf and \ref phoneprov_users.conf
  * \addtogroup configuration_file Configuration Files
  */
 
@@ -211,7 +211,7 @@ static const char *variable_lookup[] = {
        [AST_PHONEPROV_STD_DST_END_HOUR] = "DST_END_HOUR",
 };
 
-/* Translate the standard variables to their users.conf equivalents. */
+/* Translate the standard variables to their phoneprov_users.conf equivalents. */
 static const char *pp_user_lookup[] = {
        [AST_PHONEPROV_STD_MAC] = "macaddress",
        [AST_PHONEPROV_STD_PROFILE] = "profile",
@@ -314,7 +314,7 @@ struct ao2_container *profiles;
 SIMPLE_HASH_FN(phone_profile_hash_fn, phone_profile, name)
 SIMPLE_CMP_FN(phone_profile_cmp_fn, phone_profile, name)
 
-/*! \brief structure to hold users read from users.conf */
+/*! \brief structure to hold users read from phoneprov_users.conf */
 struct user {
        AST_DECLARE_STRING_FIELDS(
                AST_STRING_FIELD(macaddress);   /*!< Mac address of user's phone */
@@ -1273,13 +1273,13 @@ static struct varshead *get_defaults(void)
        AST_VAR_LIST_INSERT_TAIL(defaults, var);
        ast_config_destroy(phoneprov_cfg);
 
-       if (!(cfg = ast_config_load("users.conf", config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) {
-               ast_log(LOG_ERROR, "Unable to load users.conf\n");
+       if (!(cfg = ast_config_load("phoneprov_users.conf", config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) {
+               ast_log(LOG_ERROR, "Unable to load phoneprov_users.conf\n");
                ast_var_list_destroy(defaults);
                return NULL;
        }
 
-       /* Go ahead and load global variables from users.conf so we can append to profiles */
+       /* Go ahead and load global variables from phoneprov_users.conf so we can append to profiles */
        for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
                if (!strcasecmp(v->name, pp_user_lookup[AST_PHONEPROV_STD_VOICEMAIL_EXTEN])) {
                        var = ast_var_assign(variable_lookup[AST_PHONEPROV_STD_VOICEMAIL_EXTEN], v->value);
@@ -1308,9 +1308,9 @@ static int load_users(void)
                return -1;
        }
 
-       if (!(cfg = ast_config_load("users.conf", config_flags))
+       if (!(cfg = ast_config_load("phoneprov_users.conf", config_flags))
                || cfg == CONFIG_STATUS_FILEINVALID) {
-               ast_log(LOG_WARNING, "Unable to load users.conf\n");
+               ast_log(LOG_WARNING, "Unable to load phoneprov_users.conf\n");
                ast_var_list_destroy(defaults);
                return -1;
        }
@@ -1401,7 +1401,7 @@ static int unload_module(void)
        ast_custom_function_unregister(&pp_each_extension_function);
        ast_cli_unregister_multiple(pp_cli, ARRAY_LEN(pp_cli));
 
-       /* This cleans up the users.conf provider (called specifically for clarity) */
+       /* This cleans up the phoneprov_users.conf provider (called specifically for clarity) */
        ast_phoneprov_provider_unregister(SIPUSERS_PROVIDER_NAME);
 
        /* This cleans up the framework which also cleans up the providers. */
@@ -1466,7 +1466,7 @@ static int load_module(void)
                goto error;
        }
 
-       /* Register ourselves as the provider for users.conf */
+       /* Register ourselves as the provider for phoneprov_users.conf */
        if (ast_phoneprov_provider_register(SIPUSERS_PROVIDER_NAME, load_users)) {
                ast_log(LOG_WARNING, "Unable register users config provider.  Others may succeed.\n");
        }