Index: pbx/pbx_config.c =================================================================== --- pbx/pbx_config.c (revision 312948) +++ pbx/pbx_config.c (working copy) @@ -1620,7 +1620,7 @@ struct ast_config *cfg; char *cat, *chan; const char *dahdichan; - const char *hasexten, *altexts; + const char *hasexten, *mailbox, *altexts; char tmp[256]; char iface[256]; char dahdicopy[256]; @@ -1700,7 +1700,8 @@ ast_add_extension2(con, 0, cat, -1, NULL, NULL, iface, NULL, NULL, registrar); /* If voicemail, use "stdexten" else use plain old dial */ if (hasvoicemail) { - snprintf(tmp, sizeof(tmp), "stdexten,%s,${HINT}", cat); + mailbox = ast_variable_retrieve(cfg, cat, "mailbox"); + snprintf(tmp, sizeof(tmp), "stdexten,%s,${HINT}", (mailbox ? mailbox : cat)); ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Macro", strdup(tmp), ast_free_ptr, registrar); } else { ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free_ptr, registrar); @@ -1712,6 +1713,7 @@ c = altcopy; ext = strsep(&c, ","); while (ext) { + ast_add_extension2(con, 0, ext, -1, NULL, NULL, iface, NULL, NULL, registrar); ast_add_extension2(con, 0, ext, 1, NULL, NULL, "Goto", strdup(tmp), ast_free_ptr, registrar); ext = strsep(&c, ","); } Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 312948) +++ apps/app_voicemail.c (working copy) @@ -12140,12 +12140,26 @@ 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))) { + char* mailbox = cat; + char* mailbox_context = userscontext; + if ((val = ast_variable_retrieve(ucfg, cat, "mailbox"))) { + char* mailbox = ast_strdupa(val); + ast_log(AST_LOG_NOTICE, "Looking for @ in '%s'\n", mailbox); + if ((mailbox_context = strchr(mailbox, '@'))) { + *mailbox_context++ = '\0'; + } else { + mailbox_context = userscontext; + } + /* XXX: Do I need to "free" mailbox after ast_strdupa()? */ + } + if ((current = find_or_create(mailbox_context, mailbox))) { populate_defaults(current); apply_options_full(current, ast_variable_browse(ucfg, cat)); - ast_copy_string(current->context, userscontext, sizeof(current->context)); + ast_copy_string(current->context, mailbox_context, sizeof(current->context)); if (!ast_strlen_zero(current->password) && current->passwordlocation == OPT_PWLOC_VOICEMAILCONF) { current->passwordlocation = OPT_PWLOC_USERSCONF; } Index: configs/users.conf.sample =================================================================== --- configs/users.conf.sample (revision 312948) +++ configs/users.conf.sample (working copy) @@ -104,6 +104,10 @@ ; alternateexts entry. ; ;alternateexts = 7057,3249 +; +; Specify voicemail mailbox. Useful with alphanumeric extensions. +; +;mailbox = 7057 ;macaddress = 112233445566 ;autoprov = yes ;LINEKEYS = 1