Skip to content

Commit dd171a4

Browse files
users.conf: Deprecate users.conf configuration.
This deprecates the users.conf config file, which is no longer as widely supported but still integrated with a number of different modules. Because there is no real mechanism for marking a configuration file as "deprecated", and users.conf is not just used in a single place, this now emits a warning to the user when the PBX loads to notify about the deprecation. This configuration mechanism has been widely criticized and discouraged since its inception, and is no longer relevant to the configuration that most users are doing today. Removing it will allow for some simplification and cleanup in the codebase. Resolves: #183 UpgradeNote: The users.conf config is now deprecated and will be removed in a future version of Asterisk.
1 parent 016ff87 commit dd171a4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

configs/samples/users.conf.sample

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
;
22
; User configuration
33
;
4+
; WARNING: This configuration file is deprecated and will be removed in
5+
; a future version of Asterisk. It is recommended that you make configurations
6+
; in the appropriate module-specific configuration file for more flexibility.
7+
; Many Asterisk modules already no longer support users.conf.
8+
;
49
; Creating entries in users.conf is a "shorthand" for creating individual
510
; entries in each configuration file. Using users.conf is not intended to
611
; provide you with as much flexibility as using the separate configuration

pbx/pbx_config.c

+24
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,27 @@ static void append_interface(char *iface, int maxlen, char *add)
19741974
}
19751975
}
19761976

1977+
static void startup_event_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
1978+
{
1979+
struct ast_json_payload *payload;
1980+
const char *type;
1981+
1982+
if (stasis_message_type(message) != ast_manager_get_generic_type()) {
1983+
return;
1984+
}
1985+
1986+
payload = stasis_message_data(message);
1987+
type = ast_json_string_get(ast_json_object_get(payload->json, "type"));
1988+
1989+
if (strcmp(type, "FullyBooted")) {
1990+
return;
1991+
}
1992+
1993+
ast_log(LOG_WARNING, "users.conf is deprecated and will be removed in a future version of Asterisk\n");
1994+
1995+
stasis_unsubscribe(sub);
1996+
}
1997+
19771998
static void pbx_load_users(void)
19781999
{
19792000
struct ast_config *cfg;
@@ -1994,6 +2015,9 @@ static void pbx_load_users(void)
19942015
if (!cfg)
19952016
return;
19962017

2018+
/*! \todo Remove users.conf support in Asterisk 23 */
2019+
stasis_subscribe_pool(ast_manager_get_topic(), startup_event_cb, NULL);
2020+
19972021
for (cat = ast_category_browse(cfg, NULL); cat ; cat = ast_category_browse(cfg, cat)) {
19982022
if (!strcasecmp(cat, "general"))
19992023
continue;

0 commit comments

Comments
 (0)