@ -312,6 +312,7 @@ struct ast_vm_user {
unsigned int flags ; /*!< VM_ flags */
unsigned int flags ; /*!< VM_ flags */
int saydurationm ;
int saydurationm ;
int maxmsg ; /*!< Maximum number of msgs per folder for this mailbox */
int maxmsg ; /*!< Maximum number of msgs per folder for this mailbox */
int maxsecs ; /*!< Maximum number of seconds per message for this mailbox */
# ifdef IMAP_STORAGE
# ifdef IMAP_STORAGE
char imapuser [ 80 ] ; /* IMAP server login */
char imapuser [ 80 ] ; /* IMAP server login */
char imappassword [ 80 ] ; /* IMAP server password if authpassword not defined */
char imappassword [ 80 ] ; /* IMAP server password if authpassword not defined */
@ -511,8 +512,8 @@ 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 ] ;
static double volgain ;
static double volgain ;
static int vmmin me ssage ;
static int vmmin sec s;
static int vmmax me ssage ;
static int vmmax sec s;
static int maxgreet ;
static int maxgreet ;
static int skipms ;
static int skipms ;
static int maxlogins ;
static int maxlogins ;
@ -561,6 +562,8 @@ static void populate_defaults(struct ast_vm_user *vmu)
ast_copy_string ( vmu - > dialout , dialcontext , sizeof ( vmu - > dialout ) ) ;
ast_copy_string ( vmu - > dialout , dialcontext , sizeof ( vmu - > dialout ) ) ;
if ( exitcontext )
if ( exitcontext )
ast_copy_string ( vmu - > exit , exitcontext , sizeof ( vmu - > exit ) ) ;
ast_copy_string ( vmu - > exit , exitcontext , sizeof ( vmu - > exit ) ) ;
if ( vmmaxsecs )
vmu - > maxsecs = vmmaxsecs ;
if ( maxmsg )
if ( maxmsg )
vmu - > maxmsg = maxmsg ;
vmu - > maxmsg = maxmsg ;
vmu - > volgain = volgain ;
vmu - > volgain = volgain ;
@ -617,6 +620,13 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
ast_copy_string ( vmu - > dialout , value , sizeof ( vmu - > dialout ) ) ;
ast_copy_string ( vmu - > dialout , value , sizeof ( vmu - > dialout ) ) ;
} else if ( ! strcasecmp ( var , " exitcontext " ) ) {
} else if ( ! strcasecmp ( var , " exitcontext " ) ) {
ast_copy_string ( vmu - > exit , value , sizeof ( vmu - > exit ) ) ;
ast_copy_string ( vmu - > exit , value , sizeof ( vmu - > exit ) ) ;
} else if ( ! strcasecmp ( var , " maxmessage " ) ) {
if ( vmu - > maxsecs < = 0 ) {
ast_log ( LOG_WARNING , " Invalid max message length of %s. Using global value %i \n " , value , vmmaxsecs ) ;
vmu - > maxsecs = vmmaxsecs ;
} else {
vmu - > maxsecs = atoi ( value ) ;
}
} else if ( ! strcasecmp ( var , " maxmsg " ) ) {
} else if ( ! strcasecmp ( var , " maxmsg " ) ) {
vmu - > maxmsg = atoi ( value ) ;
vmu - > maxmsg = atoi ( value ) ;
if ( vmu - > maxmsg < = 0 ) {
if ( vmu - > maxmsg < = 0 ) {
@ -668,6 +678,7 @@ static void apply_options_full(struct ast_vm_user *retval, struct ast_variable *
struct ast_variable * tmp ;
struct ast_variable * tmp ;
tmp = var ;
tmp = var ;
while ( tmp ) {
while ( tmp ) {
ast_log ( LOG_DEBUG , " Name: %s Value: %s \n " , tmp - > name , tmp - > value ) ;
if ( ! strcasecmp ( tmp - > name , " password " ) ) {
if ( ! strcasecmp ( tmp - > name , " password " ) ) {
ast_copy_string ( retval - > password , tmp - > value , sizeof ( retval - > password ) ) ;
ast_copy_string ( retval - > password , tmp - > value , sizeof ( retval - > password ) ) ;
} else if ( ! strcasecmp ( tmp - > name , " uniqueid " ) ) {
} else if ( ! strcasecmp ( tmp - > name , " uniqueid " ) ) {
@ -3086,15 +3097,15 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
} else
} else
ast_log ( LOG_WARNING , " Error opening text file for output \n " ) ;
ast_log ( LOG_WARNING , " Error opening text file for output \n " ) ;
# ifdef IMAP_STORAGE
# ifdef IMAP_STORAGE
res = play_record_review ( chan , NULL , tmptxtfile , vm maxmes sag e, fmt , 1 , vmu , & duration , NULL , options - > record_gain , vms ) ;
res = play_record_review ( chan , NULL , tmptxtfile , vm u- > maxsecs , fmt , 1 , vmu , & duration , NULL , options - > record_gain , vms ) ;
# else
# else
res = play_record_review ( chan , NULL , tmptxtfile , vm maxmes sag e, fmt , 1 , vmu , & duration , NULL , options - > record_gain , NULL ) ;
res = play_record_review ( chan , NULL , tmptxtfile , vm u- > maxsecs , fmt , 1 , vmu , & duration , NULL , options - > record_gain , NULL ) ;
# endif
# endif
if ( txt ) {
if ( txt ) {
if ( duration < vmmin me ssage ) {
if ( duration < vmmin sec s) {
if ( option_verbose > 2 )
if ( option_verbose > 2 )
ast_verbose ( VERBOSE_PREFIX_3 " Recording was %d seconds long but needs to be at least %d - abandoning \n " , duration , vmmin me ssage ) ;
ast_verbose ( VERBOSE_PREFIX_3 " Recording was %d seconds long but needs to be at least %d - abandoning \n " , duration , vmmin sec s) ;
ast_filedelete ( tmptxtfile , NULL ) ;
ast_filedelete ( tmptxtfile , NULL ) ;
unlink ( tmptxtfile ) ;
unlink ( tmptxtfile ) ;
} else {
} else {
@ -3157,7 +3168,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
} else if ( res > 0 )
} else if ( res > 0 )
res = 0 ;
res = 0 ;
if ( duration < vmmin me ssage )
if ( duration < vmmin sec s)
/* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
/* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
pbx_builtin_setvar_helper ( chan , " VMSTATUS " , " FAILED " ) ;
pbx_builtin_setvar_helper ( chan , " VMSTATUS " , " FAILED " ) ;
else
else
@ -7271,25 +7282,50 @@ static int load_config(void)
astemail = ASTERISK_USERNAME ;
astemail = ASTERISK_USERNAME ;
ast_copy_string ( serveremail , astemail , sizeof ( serveremail ) ) ;
ast_copy_string ( serveremail , astemail , sizeof ( serveremail ) ) ;
vmmaxmessage = 0 ;
vmmaxsecs = 0 ;
if ( ( s = ast_variable_retrieve ( cfg , " general " , " maxmessage " ) ) ) {
if ( ( s = ast_variable_retrieve ( cfg , " general " , " maxsecs " ) ) ) {
if ( sscanf ( s , " %d " , & x ) = = 1 ) {
vmmaxsecs = x ;
} else {
ast_log ( LOG_WARNING , " Invalid max message time length \n " ) ;
}
} else if ( ( s = ast_variable_retrieve ( cfg , " general " , " maxmessage " ) ) ) {
static int maxmessage_deprecate = 0 ;
if ( maxmessage_deprecate = = 0 ) {
maxmessage_deprecate = 1 ;
ast_log ( LOG_WARNING , " Setting 'maxmessage' has been deprecated in favor of 'maxsecs'. \n " ) ;
}
if ( sscanf ( s , " %d " , & x ) = = 1 ) {
if ( sscanf ( s , " %d " , & x ) = = 1 ) {
vmmaxmessage = x ;
vmmax sec s = x ;
} else {
} else {
ast_log ( LOG_WARNING , " Invalid max message time length \n " ) ;
ast_log ( LOG_WARNING , " Invalid max message time length \n " ) ;
}
}
}
}
vmminmessage = 0 ;
vmmin sec s = 0 ;
if ( ( s = ast_variable_retrieve ( cfg , " general " , " minmessage " ) ) ) {
if ( ( s = ast_variable_retrieve ( cfg , " general " , " min sec s" ) ) ) {
if ( sscanf ( s , " %d " , & x ) = = 1 ) {
if ( sscanf ( s , " %d " , & x ) = = 1 ) {
vmminmessage = x ;
vmminsecs = x ;
if ( maxsilence < = vmminmessage )
if ( maxsilence < = vmminsecs )
ast_log ( LOG_WARNING , " maxsilence should be less than minmessage or you may get empty messages \n " ) ;
} else {
ast_log ( LOG_WARNING , " Invalid min message time length \n " ) ;
}
} else if ( ( s = ast_variable_retrieve ( cfg , " general " , " minmessage " ) ) ) {
static int maxmessage_deprecate = 0 ;
if ( maxmessage_deprecate = = 0 ) {
maxmessage_deprecate = 1 ;
ast_log ( LOG_WARNING , " Setting 'minmessage' has been deprecated in favor of 'minsecs'. \n " ) ;
}
if ( sscanf ( s , " %d " , & x ) = = 1 ) {
vmminsecs = x ;
if ( maxsilence < = vmminsecs )
ast_log ( LOG_WARNING , " maxsilence should be less than minmessage or you may get empty messages \n " ) ;
ast_log ( LOG_WARNING , " maxsilence should be less than minmessage or you may get empty messages \n " ) ;
} else {
} else {
ast_log ( LOG_WARNING , " Invalid min message time length \n " ) ;
ast_log ( LOG_WARNING , " Invalid min message time length \n " ) ;
}
}
}
}
fmt = ast_variable_retrieve ( cfg , " general " , " format " ) ;
fmt = ast_variable_retrieve ( cfg , " general " , " format " ) ;
if ( ! fmt )
if ( ! fmt )
fmt = " wav " ;
fmt = " wav " ;