From 2bc910c60188c668d7ad530a61eeacdac8ac9ee6 Mon Sep 17 00:00:00 2001 From: Jeffrey C. Ollie Date: Thu, 8 Nov 2007 16:32:56 -0600 Subject: [PATCH] Allow alternate extensions to be specified in users.conf --- pbx/pbx_config.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index b63fedd..3574d0d 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1562,11 +1562,14 @@ static void pbx_load_users(void) { struct ast_config *cfg; char *cat, *chan; + char *ext; const char *dahdichan; const char *hasexten; + const char *altexts; char tmp[256]; char iface[256]; char dahdicopy[256]; + char altcopy[256]; char *c; int len; int hasvoicemail; @@ -1647,6 +1650,17 @@ static void pbx_load_users(void) } else { ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free_ptr, registrar); } + 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", strdup(tmp), ast_free, registrar); + ext = strsep(&c, ","); + } + } } } ast_config_destroy(cfg); -- 1.5.6.5