Fix skinny to recognise vmexten in general section of conf
authorDamien Wedhorn <voip@facts.com.au>
Fri, 14 Dec 2012 01:55:43 +0000 (01:55 +0000)
committerDamien Wedhorn <voip@facts.com.au>
Fri, 14 Dec 2012 01:55:43 +0000 (01:55 +0000)
Fixup the vmexten so if globally set in general section will be honored by
chan_skinny. Also get rid of the 'global_' part of variable name to match
regexten.

(closes issue ASTERISK-20790)
Reported by: snuffy
Tested by: snuffy, myself
Patches:
    skinny-vm.diff uploaded by snuffy (license 5024)
........

Merged revisions 378010 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378011 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_skinny.c

index bd24c6a..2e43411 100644 (file)
@@ -202,7 +202,7 @@ static int keep_alive = 120;
 static int auth_timeout = DEFAULT_AUTH_TIMEOUT;
 static int auth_limit = DEFAULT_AUTH_LIMIT;
 static int unauth_sessions = 0;
-static char global_vmexten[AST_MAX_EXTENSION];      /* Voicemail pilot number */
+static char vmexten[AST_MAX_EXTENSION];      /* Voicemail pilot number */
 static char used_context[AST_MAX_EXTENSION]; /* placeholder to check if context are already used in regcontext */
 static char regcontext[AST_MAX_CONTEXT];     /* Context for auto-extension */
 static char date_format[6] = "D-M-Y";
@@ -4170,7 +4170,7 @@ static char *handle_skinny_show_settings(struct ast_cli_entry *e, int cmd, struc
        ast_cli(a->fd, "  Bindaddress:            %s\n", ast_inet_ntoa(bindaddr.sin_addr));
        ast_cli(a->fd, "  KeepAlive:              %d\n", keep_alive);
        ast_cli(a->fd, "  Date Format:            %s\n", date_format);
-       ast_cli(a->fd, "  Voice Mail Extension:   %s\n", S_OR(global_vmexten, "(not set)"));
+       ast_cli(a->fd, "  Voice Mail Extension:   %s\n", S_OR(vmexten, "(not set)"));
        ast_cli(a->fd, "  Reg. context:           %s\n", S_OR(regcontext, "(not set)"));
        ast_cli(a->fd, "  Jitterbuffer enabled:   %s\n", AST_CLI_YESNO(ast_test_flag(&global_jbconf, AST_JB_ENABLED)));
         if (ast_test_flag(&global_jbconf, AST_JB_ENABLED)) {
@@ -7212,6 +7212,9 @@ static struct ast_channel *skinny_request(const char *type, struct ast_format_ca
                                }
                                ast_copy_string(regcontext, v->value, sizeof(regcontext));
                                continue;
+                       } else if (!strcasecmp(v->name, "vmexten")) {
+                               ast_copy_string(vmexten, v->value, sizeof(vmexten));
+                               continue;
                        } else if (!strcasecmp(v->name, "dateformat")) {
                                memcpy(date_format, v->value, sizeof(date_format));
                                continue;
@@ -7653,6 +7656,10 @@ static struct ast_channel *skinny_request(const char *type, struct ast_format_ca
                        AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
                        AST_EVENT_IE_END);
        }
+
+       if (!ast_strlen_zero(vmexten) && ast_strlen_zero(l->vmexten)) {
+               ast_copy_string(l->vmexten, vmexten, sizeof(l->vmexten));
+       }
  
        ast_mutex_unlock(&l->lock);