app_voicemail: Set globals to default values when voicemail.conf missing

If voicemail.conf exists but is empty, the config parsing process will
default a number of global variables to non-zero values. On the other
hand, if voicemail.conf is missing (arguably semantically equivalent
to an empty file), this process is skipped and the globals are
defaulted to 0.

Set the globals to the same values they would be set to if a
configuration were present. This allows voicemail configuration to be
done completely by Realtime without the need to create an empty
voicemail.conf file.

ASTERISK-27622 #close
Reported by: Jim Van Meggelen

Change-Id: Id907d280f310f12e542ca527e6a025432b9fb409
17.2
Sean Bright 5 years ago
parent 0bd7cd562e
commit b60dfac98e

@ -477,20 +477,20 @@
***/ ***/
#ifdef IMAP_STORAGE #ifdef IMAP_STORAGE
static char imapserver[48]; static char imapserver[48] = "localhost";
static char imapport[8]; static char imapport[8] = "143";
static char imapflags[128]; static char imapflags[128];
static char imapfolder[64]; static char imapfolder[64] = "INBOX";
static char imapparentfolder[64] = "\0"; static char imapparentfolder[64];
static char greetingfolder[64]; static char greetingfolder[64] = "INBOX";
static char authuser[32]; static char authuser[32];
static char authpassword[42]; static char authpassword[42];
static int imapversion = 1; static int imapversion = 1;
static int expungeonhangup = 1; static int expungeonhangup = 1;
static int imapgreetings = 0; static int imapgreetings;
static int imap_poll_logout = 0; static int imap_poll_logout;
static char delimiter = '\0'; static char delimiter;
/* mail_open cannot be protected on a stream basis */ /* mail_open cannot be protected on a stream basis */
ast_mutex_t mail_open_lock; ast_mutex_t mail_open_lock;
@ -876,8 +876,8 @@ struct vm_state {
}; };
#ifdef ODBC_STORAGE #ifdef ODBC_STORAGE
static char odbc_database[80]; static char odbc_database[80] = "asterisk";
static char odbc_table[80]; static char odbc_table[80] = "voicemessages";
#define RETRIEVE(a,b,c,d) retrieve_file(a,b) #define RETRIEVE(a,b,c,d) retrieve_file(a,b)
#define DISPOSE(a,b) remove_file(a,b) #define DISPOSE(a,b) remove_file(a,b)
#define STORE(a,b,c,d,e,f,g,h,i,j,k) store_file(a,b,c,d) #define STORE(a,b,c,d,e,f,g,h,i,j,k) store_file(a,b,c,d)
@ -951,21 +951,21 @@ static AST_LIST_HEAD_STATIC(zones, vm_zone);
static char zonetag[80]; static char zonetag[80];
static char locale[20]; static char locale[20];
static int maxsilence; static int maxsilence;
static int maxmsg; static int maxmsg = MAXMSG;
static int maxdeletedmsg; static int maxdeletedmsg;
static int silencethreshold = 128; static int silencethreshold = 128;
static char serveremail[80]; static char serveremail[80] = ASTERISK_USERNAME;
static char mailcmd[160]; /* Configurable mail cmd */ static char mailcmd[160] = SENDMAIL; /* Configurable mail cmd */
static char externnotify[160]; static char externnotify[160];
static struct ast_smdi_interface *smdi_iface = NULL; static struct ast_smdi_interface *smdi_iface = NULL;
static char vmfmts[80]; static char vmfmts[80] = "wav";
static double volgain; static double volgain;
static int vmminsecs; static int vmminsecs;
static int vmmaxsecs; static int vmmaxsecs;
static int maxgreet; static int maxgreet;
static int skipms; static int skipms = 3000;
static int maxlogins; static int maxlogins = 3;
static int minpassword; static int minpassword = MINPASSWORD;
static int passwordlocation; static int passwordlocation;
static char aliasescontext[MAX_VM_CONTEXT_LEN]; static char aliasescontext[MAX_VM_CONTEXT_LEN];
@ -973,10 +973,10 @@ static char aliasescontext[MAX_VM_CONTEXT_LEN];
* app_voicemail that may change them. */ * app_voicemail that may change them. */
static unsigned int poll_mailboxes; static unsigned int poll_mailboxes;
/*! Polling frequency */
static unsigned int poll_freq;
/*! By default, poll every 30 seconds */ /*! By default, poll every 30 seconds */
#define DEFAULT_POLL_FREQ 30 #define DEFAULT_POLL_FREQ 30
/*! Polling frequency */
static unsigned int poll_freq = DEFAULT_POLL_FREQ;
AST_MUTEX_DEFINE_STATIC(poll_lock); AST_MUTEX_DEFINE_STATIC(poll_lock);
static ast_cond_t poll_cond = PTHREAD_COND_INITIALIZER; static ast_cond_t poll_cond = PTHREAD_COND_INITIALIZER;
@ -1038,7 +1038,7 @@ static char vm_prepend_timeout[80] = "vm-then-pound";
static struct ast_flags globalflags = {0}; static struct ast_flags globalflags = {0};
static int saydurationminfo; static int saydurationminfo = 2;
static char dialcontext[AST_MAX_CONTEXT] = ""; static char dialcontext[AST_MAX_CONTEXT] = "";
static char callcontext[AST_MAX_CONTEXT] = ""; static char callcontext[AST_MAX_CONTEXT] = "";
@ -1047,10 +1047,10 @@ static char exitcontext[AST_MAX_CONTEXT] = "";
static char cidinternalcontexts[MAX_NUM_CID_CONTEXTS][64]; static char cidinternalcontexts[MAX_NUM_CID_CONTEXTS][64];
static char *emailbody = NULL; static char *emailbody;
static char *emailsubject = NULL; static char *emailsubject;
static char *pagerbody = NULL; static char *pagerbody;
static char *pagersubject = NULL; static char *pagersubject;
static char fromstring[100]; static char fromstring[100];
static char pagerfromstring[100]; static char pagerfromstring[100];
static char charset[32] = "ISO-8859-1"; static char charset[32] = "ISO-8859-1";

Loading…
Cancel
Save