@ -124,23 +124,23 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
# define MAX_DATETIME_FORMAT 512
# define MAX_NUM_CID_CONTEXTS 10
# define VM_REVIEW (1 << 0)
# define VM_OPERATOR (1 << 1)
# define VM_SAYCID (1 << 2)
# define VM_SVMAIL (1 << 3)
# define VM_ENVELOPE (1 << 4)
# define VM_SAYDURATION (1 << 5)
# define VM_SKIPAFTERCMD (1 << 6)
# define VM_FORCENAME (1 << 7) /*!< Have new users record their name */
# define VM_FORCEGREET (1 << 8) /*!< Have new users record their greetings */
# define VM_PBXSKIP (1 << 9)
# define VM_DIRECFORWARD (1 << 10) /*!< directory_forward */
# define VM_ATTACH (1 << 11)
# define VM_DELETE (1 << 12)
# define VM_ALLOCED (1 << 13)
# define VM_SEARCH (1 << 14)
# define VM_TEMPGREETWARN (1 << 15) /*!< Remind user tempgreeting is set */
# define ERROR_LOCK_PATH -100
# define VM_REVIEW (1 << 0)
# define VM_OPERATOR (1 << 1)
# define VM_SAYCID (1 << 2)
# define VM_SVMAIL (1 << 3)
# define VM_ENVELOPE (1 << 4)
# define VM_SAYDURATION (1 << 5)
# define VM_SKIPAFTERCMD (1 << 6)
# define VM_FORCENAME (1 << 7) /*!< Have new users record their name */
# define VM_FORCEGREET (1 << 8) /*!< Have new users record their greetings */
# define VM_PBXSKIP (1 << 9)
# define VM_DIRECFORWARD (1 << 10) /*!< directory_forward */
# define VM_ATTACH (1 << 11)
# define VM_DELETE (1 << 12)
# define VM_ALLOCED (1 << 13)
# define VM_SEARCH (1 << 14)
# define VM_TEMPGREETWARN (1 << 15) /*!< Remind user tempgreeting is set */
# define ERROR_LOCK_PATH -100
enum {
OPT_SILENT = ( 1 < < 0 ) ,
@ -253,24 +253,24 @@ struct baseio {
/*! Structure for linked list of users */
struct ast_vm_user {
char context [ AST_MAX_CONTEXT ] ; /*!< Voicemail context */
char mailbox [ AST_MAX_EXTENSION ] ; /*!< Mailbox id, unique within vm context */
char password [ 80 ] ; /*!< Secret pin code, numbers only */
char fullname [ 80 ] ; /*!< Full name, for directory app */
char email [ 80 ] ; /*!< E-mail address */
char pager [ 80 ] ; /*!< E-mail address to pager (no attachment) */
char serveremail [ 80 ] ; /*!< From: Mail address */
char mailcmd [ 160 ] ; /*!< Configurable mail command */
char language [ MAX_LANGUAGE ] ; /*!< Config: Language setting */
char zonetag [ 80 ] ; /*!< Time zone */
char context [ AST_MAX_CONTEXT ] ; /*!< Voicemail context */
char mailbox [ AST_MAX_EXTENSION ] ; /*!< Mailbox id, unique within vm context */
char password [ 80 ] ; /*!< Secret pin code, numbers only */
char fullname [ 80 ] ; /*!< Full name, for directory app */
char email [ 80 ] ; /*!< E-mail address */
char pager [ 80 ] ; /*!< E-mail address to pager (no attachment) */
char serveremail [ 80 ] ; /*!< From: Mail address */
char mailcmd [ 160 ] ; /*!< Configurable mail command */
char language [ MAX_LANGUAGE ] ; /*!< Config: Language setting */
char zonetag [ 80 ] ; /*!< Time zone */
char callback [ 80 ] ;
char dialout [ 80 ] ;
char uniqueid [ 20 ] ; /*!< Unique integer identifier */
char uniqueid [ 20 ] ; /*!< Unique integer identifier */
char exit [ 80 ] ;
char attachfmt [ 20 ] ; /*!< Attachment format */
unsigned int flags ; /*!< VM_ flags */
char attachfmt [ 20 ] ; /*!< Attachment format */
unsigned int flags ; /*!< VM_ flags */
int saydurationm ;
int maxmsg ; /*!< Maximum number of msgs per folder for this mailbox */
int maxmsg ; /*!< Maximum number of msgs per folder for this mailbox */
AST_LIST_ENTRY ( ast_vm_user ) list ;
} ;
@ -297,12 +297,11 @@ struct vm_state {
int starting ;
int repeats ;
} ;
static int advanced_options ( struct ast_channel * chan , struct ast_vm_user * vmu , struct vm_state * vms , int msg ,
int option , signed char record_gain ) ;
static int advanced_options ( struct ast_channel * chan , struct ast_vm_user * vmu , struct vm_state * vms , int msg , int option , signed char record_gain ) ;
static int dialout ( struct ast_channel * chan , struct ast_vm_user * vmu , char * num , char * outgoing_context ) ;
static int play_record_review ( struct ast_channel * chan , char * playfile , char * recordfile , int maxtime ,
char * fmt , int outsidecaller , struct ast_vm_user * vmu , int * duration , const char * unlockdir ,
signed char record_gain ) ;
char * fmt , int outsidecaller , struct ast_vm_user * vmu , int * duration , const char * unlockdir ,
signed char record_gain ) ;
static int vm_tempgreeting ( struct ast_channel * chan , struct ast_vm_user * vmu , struct vm_state * vms , char * fmtc , signed char record_gain ) ;
static int vm_play_folder_name ( struct ast_channel * chan , char * mbox ) ;
@ -522,7 +521,7 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
ast_copy_string ( vmu - > exit , value , sizeof ( vmu - > exit ) ) ;
} else if ( ! strcasecmp ( var , " maxmsg " ) ) {
vmu - > maxmsg = atoi ( value ) ;
if ( vmu - > maxmsg < = 0 ) {
if ( vmu - > maxmsg < = 0 ) {
ast_log ( LOG_WARNING , " Invalid number of messages per folder maxmsg=%s. Using default value %i \n " , value , MAXMSG ) ;
vmu - > maxmsg = MAXMSG ;
} else if ( vmu - > maxmsg > MAXMSGLIMIT ) {
@ -583,7 +582,7 @@ static struct ast_vm_user *find_user_realtime(struct ast_vm_user *ivm, const cha
var = ast_load_realtime ( " voicemail " , " mailbox " , mailbox , " context " , context , NULL ) ;
if ( var ) {
tmp = var ;
while ( tmp ) {
while ( tmp ) {
printf ( " %s => %s \n " , tmp - > name , tmp - > value ) ;
if ( ! strcasecmp ( tmp - > name , " password " ) ) {
ast_copy_string ( retval - > password , tmp - > value , sizeof ( retval - > password ) ) ;
@ -759,8 +758,8 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
/* Compare user, pass AND context */
if ( ! ast_strlen_zero ( user ) & & ! strcmp ( user , vmu - > mailbox ) & &
! ast_strlen_zero ( pass ) & & ! strcmp ( pass , vmu - > password ) & &
! strcasecmp ( currcontext , vmu - > context ) ) {
! ast_strlen_zero ( pass ) & & ! strcmp ( pass , vmu - > password ) & &
! strcasecmp ( currcontext , vmu - > context ) ) {
/* This is the line */
if ( rest ) {
fprintf ( configout , " %s => %s,%s " , user , newpassword , rest ) ;
@ -823,21 +822,21 @@ static int create_dirpath(char *dest, int len, const char *context, const char *
if ( ! ast_strlen_zero ( context ) ) {
make_dir ( dest , len , context , " " , " " ) ;
if ( mkdir ( dest , mode ) & & errno ! = EEXIST ) {
if ( mkdir ( dest , mode ) & & errno ! = EEXIST ) {
ast_log ( LOG_WARNING , " mkdir '%s' failed: %s \n " , dest , strerror ( errno ) ) ;
return 0 ;
}
}
if ( ! ast_strlen_zero ( ext ) ) {
make_dir ( dest , len , context , ext , " " ) ;
if ( mkdir ( dest , mode ) & & errno ! = EEXIST ) {
if ( mkdir ( dest , mode ) & & errno ! = EEXIST ) {
ast_log ( LOG_WARNING , " mkdir '%s' failed: %s \n " , dest , strerror ( errno ) ) ;
return 0 ;
}
}
if ( ! ast_strlen_zero ( folder ) ) {
make_dir ( dest , len , context , ext , folder ) ;
if ( mkdir ( dest , mode ) & & errno ! = EEXIST ) {
if ( mkdir ( dest , mode ) & & errno ! = EEXIST ) {
ast_log ( LOG_WARNING , " mkdir '%s' failed: %s \n " , dest , strerror ( errno ) ) ;
return 0 ;
}
@ -1217,7 +1216,7 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
# ifdef EXTENDED_ODBC_STORAGE
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=? " , odbc_table , odbc_table ) ;
# else
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording FROM %s WHERE dir=? AND msgnum=? " , odbc_table , odbc_table ) ;
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording FROM %s WHERE dir=? AND msgnum=? " , odbc_table , odbc_table ) ;
# endif
res = SQLPrepare ( stmt , sql , SQL_NTS ) ;
if ( ( res ! = SQL_SUCCESS ) & & ( res ! = SQL_SUCCESS_WITH_INFO ) ) {
@ -1234,8 +1233,8 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
SQLBindParameter ( stmt , 5 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( sdir ) , 0 , ( void * ) sdir , 0 , NULL ) ;
SQLBindParameter ( stmt , 6 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( msgnums ) , 0 , ( void * ) msgnums , 0 , NULL ) ;
# else
SQLBindParameter ( stmt , 3 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( sdir ) , 0 , ( void * ) sdir , 0 , NULL ) ;
SQLBindParameter ( stmt , 4 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( msgnums ) , 0 , ( void * ) msgnums , 0 , NULL ) ;
SQLBindParameter ( stmt , 3 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( sdir ) , 0 , ( void * ) sdir , 0 , NULL ) ;
SQLBindParameter ( stmt , 4 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( msgnums ) , 0 , ( void * ) msgnums , 0 , NULL ) ;
# endif
res = odbc_smart_execute ( obj , stmt ) ;
if ( ( res ! = SQL_SUCCESS ) & & ( res ! = SQL_SUCCESS_WITH_INFO ) ) {
@ -1324,17 +1323,17 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
odbc_release_obj ( obj ) ;
goto yuck ;
}
if ( ! ast_strlen_zero ( category ) )
if ( ! ast_strlen_zero ( category ) )
# ifdef EXTENDED_ODBC_STORAGE
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?) " , odbc_table ) ;
# else
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,category) VALUES (?,?,?,?,?,?,?,?,?) " , odbc_table ) ;
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,category) VALUES (?,?,?,?,?,?,?,?,?) " , odbc_table ) ;
# endif
else
else
# ifdef EXTENDED_ODBC_STORAGE
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?) " , odbc_table ) ;
# else
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration) VALUES (?,?,?,?,?,?,?,?) " , odbc_table ) ;
snprintf ( sql , sizeof ( sql ) , " INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration) VALUES (?,?,?,?,?,?,?,?) " , odbc_table ) ;
# endif
res = SQLPrepare ( stmt , sql , SQL_NTS ) ;
if ( ( res ! = SQL_SUCCESS ) & & ( res ! = SQL_SUCCESS_WITH_INFO ) ) {
@ -1358,8 +1357,8 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
if ( ! ast_strlen_zero ( category ) )
SQLBindParameter ( stmt , 11 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( category ) , 0 , ( void * ) category , 0 , NULL ) ;
# else
if ( ! ast_strlen_zero ( category ) )
SQLBindParameter ( stmt , 9 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( category ) , 0 , ( void * ) category , 0 , NULL ) ;
if ( ! ast_strlen_zero ( category ) )
SQLBindParameter ( stmt , 9 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( category ) , 0 , ( void * ) category , 0 , NULL ) ;
# endif
res = odbc_smart_execute ( obj , stmt ) ;
if ( ( res ! = SQL_SUCCESS ) & & ( res ! = SQL_SUCCESS_WITH_INFO ) ) {
@ -1405,7 +1404,7 @@ static void rename_file(char *sdir, int smsg, char *mailboxuser, char *mailboxco
# ifdef EXTENDED_ODBC_STORAGE
snprintf ( sql , sizeof ( sql ) , " UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=? " , odbc_table ) ;
# else
snprintf ( sql , sizeof ( sql ) , " UPDATE %s SET dir=?, msgnum=? WHERE dir=? AND msgnum=? " , odbc_table ) ;
snprintf ( sql , sizeof ( sql ) , " UPDATE %s SET dir=?, msgnum=? WHERE dir=? AND msgnum=? " , odbc_table ) ;
# endif
res = SQLPrepare ( stmt , sql , SQL_NTS ) ;
if ( ( res ! = SQL_SUCCESS ) & & ( res ! = SQL_SUCCESS_WITH_INFO ) ) {
@ -1422,8 +1421,8 @@ static void rename_file(char *sdir, int smsg, char *mailboxuser, char *mailboxco
SQLBindParameter ( stmt , 5 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( sdir ) , 0 , ( void * ) sdir , 0 , NULL ) ;
SQLBindParameter ( stmt , 6 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( msgnums ) , 0 , ( void * ) msgnums , 0 , NULL ) ;
# else
SQLBindParameter ( stmt , 3 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( sdir ) , 0 , ( void * ) sdir , 0 , NULL ) ;
SQLBindParameter ( stmt , 4 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( msgnums ) , 0 , ( void * ) msgnums , 0 , NULL ) ;
SQLBindParameter ( stmt , 3 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( sdir ) , 0 , ( void * ) sdir , 0 , NULL ) ;
SQLBindParameter ( stmt , 4 , SQL_PARAM_INPUT , SQL_C_CHAR , SQL_CHAR , strlen ( msgnums ) , 0 , ( void * ) msgnums , 0 , NULL ) ;
# endif
res = odbc_smart_execute ( obj , stmt ) ;
if ( ( res ! = SQL_SUCCESS ) & & ( res ! = SQL_SUCCESS_WITH_INFO ) ) {
@ -2294,7 +2293,7 @@ static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
ast_copy_string ( tmp , mailbox , sizeof ( tmp ) ) ;
mb = tmp ;
while ( ( cur = strsep ( & mb , " , " ) ) ) {
while ( ( cur = strsep ( & mb , " , " ) ) ) {
if ( ! ast_strlen_zero ( cur ) ) {
if ( inboxcount ( cur , newmsgs ? & tmpnew : NULL , oldmsgs ? & tmpold : NULL ) )
return - 1 ;
@ -2395,7 +2394,7 @@ static void run_externnotify(char *context, char *extension)
} else {
snprintf ( arguments , sizeof ( arguments ) , " %s %s %s %d& " , externnotify , context , extension , newvoicemails ) ;
ast_log ( LOG_DEBUG , " Executing %s \n " , arguments ) ;
ast_safe_system ( arguments ) ;
ast_safe_system ( arguments ) ;
}
}
}
@ -2549,7 +2548,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
/* Check for a '0' here */
if ( res = = ' 0 ' ) {
transfer :
if ( ouseexten | | ousemacro ) {
if ( ouseexten | | ousemacro ) {
chan - > exten [ 0 ] = ' o ' ;
chan - > exten [ 1 ] = ' \0 ' ;
if ( ! ast_strlen_zero ( vmu - > exit ) ) {
@ -2706,7 +2705,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
pbx_builtin_setvar_helper ( chan , " VMSTATUS " , " SUCCESS " ) ;
} else
ast_log ( LOG_WARNING , " No format for saving voicemail? \n " ) ;
leave_vm_out :
leave_vm_out :
free_user ( vmu ) ;
return res ;
@ -2727,7 +2726,7 @@ static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
make_file ( sfn , sizeof ( sfn ) , dir , x ) ;
if ( EXISTS ( dir , x , sfn , NULL ) ) {
if ( x ! = dest ) {
if ( x ! = dest ) {
make_file ( dfn , sizeof ( dfn ) , dir , dest ) ;
RENAME ( dir , x , vmu - > mailbox , vmu - > context , dir , dest , sfn , dfn ) ;
}
@ -2755,7 +2754,7 @@ static int save_to_folder(struct ast_vm_user *vmu, char *dir, int msg, char *con
char ddir [ 256 ] ;
const char * dbox = mbox ( box ) ;
int x ;
make_file ( sfn , sizeof ( sfn ) , dir , msg ) ;
make_file ( sfn , sizeof ( sfn ) , dir , msg ) ;
create_dirpath ( ddir , sizeof ( ddir ) , context , username , dbox ) ;
if ( vm_lock_path ( ddir ) )
@ -2795,7 +2794,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
* useadsi = 0 ;
bytes + = adsi_data_mode ( buf + bytes ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
bytes = 0 ;
bytes + = adsi_logo ( buf ) ;
@ -2805,7 +2804,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
# endif
bytes + = adsi_set_line ( buf + bytes , ADSI_COMM_PAGE , 1 ) ;
bytes + = adsi_data_mode ( buf + bytes ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
if ( adsi_begin_download ( chan , addesc , adsifdn , adsisec , adsiver ) ) {
bytes = 0 ;
@ -2824,7 +2823,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 3 , ADSI_JUST_CENT , 0 , " Downloading Scripts " , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 4 , ADSI_JUST_LEFT , 0 , " .. " , " " ) ;
bytes + = adsi_set_line ( buf + bytes , ADSI_COMM_PAGE , 1 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
# endif
bytes = 0 ;
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 0 , " Listen " , " Listen " , " 1 " , 1 ) ;
@ -2833,7 +2832,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 3 , " Options " , " Options " , " 0 " , 1 ) ;
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 4 , " Help " , " Help " , " * " , 1 ) ;
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 5 , " Exit " , " Exit " , " # " , 1 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
# ifdef DISPLAY
/* Add another dot */
@ -2842,7 +2841,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
bytes + = adsi_voice_mode ( buf + bytes , 0 ) ;
bytes + = adsi_set_line ( buf + bytes , ADSI_COMM_PAGE , 1 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
# endif
bytes = 0 ;
@ -2853,14 +2852,14 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 9 , " Next " , " Next " , " 6 " , 1 ) ;
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 10 , " Save " , " Save " , " 9 " , 1 ) ;
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 11 , " Undelete " , " Restore " , " 7 " , 1 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
# ifdef DISPLAY
/* Add another dot */
bytes = 0 ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 4 , ADSI_JUST_LEFT , 0 , " .... " , " " ) ;
bytes + = adsi_set_line ( buf + bytes , ADSI_COMM_PAGE , 1 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
# endif
bytes = 0 ;
@ -2869,14 +2868,14 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 12 + x , mbox ( x ) , mbox ( x ) , num , 1 ) ;
}
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 12 + 5 , " Cancel " , " Cancel " , " # " , 1 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
# ifdef DISPLAY
/* Add another dot */
bytes = 0 ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 4 , ADSI_JUST_LEFT , 0 , " ..... " , " " ) ;
bytes + = adsi_set_line ( buf + bytes , ADSI_COMM_PAGE , 1 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
# endif
if ( adsi_end_download ( chan ) ) {
@ -2891,7 +2890,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
bytes = 0 ;
bytes + = adsi_download_disconnect ( buf + bytes ) ;
bytes + = adsi_voice_mode ( buf + bytes , 0 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DOWNLOAD ) ;
ast_log ( LOG_DEBUG , " Done downloading scripts... \n " ) ;
@ -2911,7 +2910,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
} else
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 3 , ADSI_JUST_CENT , 0 , " Load Failed! " , " " ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
return 0 ;
}
@ -2955,7 +2954,7 @@ static void adsi_login(struct ast_channel *chan)
bytes + = adsi_load_soft_key ( buf + bytes , ADSI_KEY_APPS + 3 , " Enter " , " Enter " , " # " , 1 ) ;
bytes + = adsi_set_keys ( buf + bytes , keys ) ;
bytes + = adsi_voice_mode ( buf + bytes , 0 ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
adsi_transmit_message ( chan , buf , bytes , ADSI_MSG_DISPLAY ) ;
}
static void adsi_password ( struct ast_channel * chan )
@ -3089,9 +3088,9 @@ static void adsi_message(struct ast_channel *chan, struct vm_state *vms)
keys [ 5 ] = ADSI_KEY_SKT | ( ADSI_KEY_APPS + 5 ) ;
snprintf ( buf1 , sizeof ( buf1 ) , " %s%s " , vms - > curbox ,
strcasecmp ( vms - > curbox , " INBOX " ) ? " Messages " : " " ) ;
snprintf ( buf2 , sizeof ( buf2 ) , " Message %d of %d " , vms - > curmsg + 1 , vms - > lastmsg + 1 ) ;
snprintf ( buf2 , sizeof ( buf2 ) , " Message %d of %d " , vms - > curmsg + 1 , vms - > lastmsg + 1 ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 1 , ADSI_JUST_LEFT , 0 , buf1 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 1 , ADSI_JUST_LEFT , 0 , buf1 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 2 , ADSI_JUST_LEFT , 0 , buf2 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 3 , ADSI_JUST_LEFT , 0 , name , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 4 , ADSI_JUST_LEFT , 0 , datetime , " " ) ;
@ -3175,7 +3174,7 @@ static void adsi_status(struct ast_channel *chan, struct vm_state *vms)
buf2 [ 0 ] = ' ' ;
buf2 [ 1 ] = ' \0 ' ;
}
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 1 , ADSI_JUST_LEFT , 0 , buf1 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 1 , ADSI_JUST_LEFT , 0 , buf1 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 2 , ADSI_JUST_LEFT , 0 , buf2 , " " ) ;
bytes + = adsi_set_line ( buf + bytes , ADSI_COMM_PAGE , 1 ) ;
@ -3224,7 +3223,7 @@ static void adsi_status2(struct ast_channel *chan, struct vm_state *vms)
snprintf ( buf2 , sizeof ( buf2 ) , " %d %s. " , vms - > lastmsg + 1 , mess ) ;
else
strcpy ( buf2 , " no messages. " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 1 , ADSI_JUST_LEFT , 0 , buf1 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 1 , ADSI_JUST_LEFT , 0 , buf1 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 2 , ADSI_JUST_LEFT , 0 , buf2 , " " ) ;
bytes + = adsi_display ( buf + bytes , ADSI_COMM_PAGE , 3 , ADSI_JUST_LEFT , 0 , " " , " " ) ;
bytes + = adsi_set_line ( buf + bytes , ADSI_COMM_PAGE , 1 ) ;
@ -3310,8 +3309,7 @@ static int get_folder2(struct ast_channel *chan, char *fn, int start)
return res ;
}
static int vm_forwardoptions ( struct ast_channel * chan , struct ast_vm_user * vmu , char * curdir , int curmsg , char * vmfts ,
char * context , signed char record_gain )
static int vm_forwardoptions ( struct ast_channel * chan , struct ast_vm_user * vmu , char * curdir , int curmsg , char * vmfts , char * context , signed char record_gain )
{
int cmd = 0 ;
int retries = 0 ;
@ -3352,7 +3350,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
retries + + ;
if ( retries > 3 )
cmd = ' t ' ;
}
}
}
if ( cmd = = ' t ' | | cmd = = ' S ' )
cmd = 0 ;
@ -3411,8 +3409,7 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
return 0 ;
}
static int forward_message ( struct ast_channel * chan , char * context , char * dir , int curmsg , struct ast_vm_user * sender ,
char * fmt , int flag , signed char record_gain )
static int forward_message ( struct ast_channel * chan , char * context , char * dir , int curmsg , struct ast_vm_user * sender , char * fmt , int flag , signed char record_gain )
{
char username [ 70 ] = " " ;
char sys [ 256 ] ;
@ -3434,11 +3431,11 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
while ( ! res & & ! valid_extensions ) {
int use_directory = 0 ;
if ( ast_test_flag ( ( & globalflags ) , VM_DIRECFORWARD ) ) {
if ( ast_test_flag ( ( & globalflags ) , VM_DIRECFORWARD ) ) {
int done = 0 ;
int retries = 0 ;
cmd = 0 ;
while ( ( cmd > = 0 ) & & ! done ) {
while ( ( cmd > = 0 ) & & ! done ) {
if ( cmd )
retries = 0 ;
switch ( cmd ) {
@ -3467,9 +3464,9 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
done = 1 ;
}
}
}
}
if ( cmd < 0 | | cmd = = ' t ' )
if ( cmd < 0 | | cmd = = ' t ' )
break ;
}
@ -3503,7 +3500,7 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
ast_log ( LOG_WARNING , " Could not find the Directory application, disabling directory_forward \n " ) ;
ast_clear_flag ( ( & globalflags ) , VM_DIRECFORWARD ) ;
}
} else {
} else {
/* Ask for an extension */
res = ast_streamfile ( chan , " vm-extension " , chan - > language ) ; /* "extension" */
if ( res )
@ -3720,17 +3717,17 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
# endif
if ( the_zone )
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , the_zone - > msg_format , the_zone - > timezone ) ;
else if ( ! strcasecmp ( chan - > language , " pl " ) ) /* POLISH syntax */
else if ( ! strcasecmp ( chan - > language , " pl " ) ) /* POLISH syntax */
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , " 'vm-received' Q HM " , NULL ) ;
else if ( ! strcasecmp ( chan - > language , " se " ) ) /* SWEDISH syntax */
else if ( ! strcasecmp ( chan - > language , " se " ) ) /* SWEDISH syntax */
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , " 'vm-received' dB 'digits/at' k 'and' M " , NULL ) ;
else if ( ! strcasecmp ( chan - > language , " no " ) ) /* NORWEGIAN syntax */
else if ( ! strcasecmp ( chan - > language , " no " ) ) /* NORWEGIAN syntax */
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , " 'vm-received' Q 'digits/at' HM " , NULL ) ;
else if ( ! strcasecmp ( chan - > language , " de " ) ) /* GERMAN syntax */
else if ( ! strcasecmp ( chan - > language , " de " ) ) /* GERMAN syntax */
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , " 'vm-received' Q 'digits/at' HM " , NULL ) ;
else if ( ! strcasecmp ( chan - > language , " nl " ) ) /* DUTCH syntax */
else if ( ! strcasecmp ( chan - > language , " nl " ) ) /* DUTCH syntax */
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , " 'vm-received' q 'digits/nl-om' HM " , NULL ) ;
else if ( ! strcasecmp ( chan - > language , " it " ) ) /* ITALIAN syntax */
else if ( ! strcasecmp ( chan - > language , " it " ) ) /* ITALIAN syntax */
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , " 'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes' " , NULL ) ;
else if ( ! strcasecmp ( chan - > language , " gr " ) )
res = ast_say_date_with_format ( chan , t , AST_DIGIT_ANY , chan - > language , " 'vm-received' q H 'digits/kai' M " , NULL ) ;
@ -3813,7 +3810,7 @@ static int play_message_duration(struct ast_channel *chan, struct vm_state *vms,
int durationm ;
int durations ;
/* Verify that we have a duration for the message */
if ( ( duration = = NULL ) )
if ( duration = = NULL )
return res ;
/* Convert from seconds to minutes */
@ -3984,7 +3981,7 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
last_msg = last_message_index ( vmu , vms - > curdir ) ;
if ( last_msg < 0 )
return last_msg ;
else if ( vms - > lastmsg ! = last_msg )
else if ( vms - > lastmsg ! = last_msg )
{
ast_log ( LOG_NOTICE , " Resequencing Mailbox: %s \n " , vms - > curdir ) ;
res = resequence_mailbox ( vmu , vms - > curdir ) ;
@ -4053,7 +4050,7 @@ done:
* ( " filika mynhmata " ) it is not elegant . This also goes for " work/family messages "
* ( " ergasiaka/oikogeniaka mynhmata " ) . Therefore it is better to use a reversed
* syntax for the above three categories which is more elegant .
*/
*/
static int vm_play_folder_name_gr ( struct ast_channel * chan , char * mbox )
{
@ -4069,7 +4066,7 @@ static int vm_play_folder_name_gr(struct ast_channel *chan, char *mbox)
return cmd ? cmd : ast_play_and_wait ( chan , " vm-messages " ) ; /* "messages" -> "MYNHMATA" */
} else {
cmd = ast_play_and_wait ( chan , " vm-messages " ) ; /* "messages" -> "MYNHMATA" */
return cmd ? cmd : ast_play_and_wait ( chan , mbox ) ; /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
return cmd ? cmd : ast_play_and_wait ( chan , mbox ) ; /* friends/family/work... -> "FILWN"/"OIKOGENIAS"/"DOULEIAS"*/
}
}
@ -4085,7 +4082,7 @@ static int vm_play_folder_name_pl(struct ast_channel *chan, char *mbox)
return cmd ? cmd : ast_play_and_wait ( chan , " vm-messages " ) ;
} else {
cmd = ast_play_and_wait ( chan , " vm-messages " ) ;
return cmd ? cmd : ast_play_and_wait ( chan , mbox ) ;
return cmd ? cmd : ast_play_and_wait ( chan , mbox ) ;
}
}
@ -4106,7 +4103,7 @@ static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
}
}
/* GREEK SYNTAX
/* GREEK SYNTAX
In greek the plural for old / new is
different so we need the following files
We also need vm - denExeteMynhmata because
@ -4115,7 +4112,7 @@ static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
- > vm - Olds . wav : " Palia "
- > vm - INBOXs . wav : " Nea "
- > vm - denExeteMynhmata : " den exete mynhmata "
*/
*/
static int vm_intro_gr ( struct ast_channel * chan , struct vm_state * vms )
@ -4130,12 +4127,12 @@ static int vm_intro_gr(struct ast_channel *chan, struct vm_state *vms)
if ( ( vms - > newmessages = = 1 ) ) {
res = ast_play_and_wait ( chan , " vm-INBOX " ) ;
if ( ! res )
res = ast_play_and_wait ( chan , " vm-message " ) ;
} else {
res = ast_play_and_wait ( chan , " vm-message " ) ;
} else {
res = ast_play_and_wait ( chan , " vm-INBOXs " ) ;
if ( ! res )
res = ast_play_and_wait ( chan , " vm-messages " ) ;
}
}
}
} else if ( vms - > oldmessages ) {
res = ast_play_and_wait ( chan , " vm-youhave " ) ;
@ -4147,12 +4144,12 @@ static int vm_intro_gr(struct ast_channel *chan, struct vm_state *vms)
res = ast_play_and_wait ( chan , " vm-message " ) ;
} else {
res = ast_play_and_wait ( chan , " vm-Olds " ) ;
if ( ! res )
if ( ! res )
res = ast_play_and_wait ( chan , " vm-messages " ) ;
}
} else if ( ! vms - > oldmessages & & ! vms - > newmessages )
res = ast_play_and_wait ( chan , " vm-denExeteMynhmata " ) ;
return res ;
} else if ( ! vms - > oldmessages & & ! vms - > newmessages )
res = ast_play_and_wait ( chan , " vm-denExeteMynhmata " ) ;
return res ;
}
/* Default English syntax */
@ -4640,17 +4637,17 @@ static int vm_intro_pt(struct ast_channel *chan,struct vm_state *vms)
/* CZECH syntax */
/* in czech there must be declension of word new and message
* czech : english : czech : english
* czech : english : czech : english
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* vm - youhave : you have
* vm - novou : one new : vm - zpravu : message
* vm - nove : 2 - 4 new : vm - zpravy : messages
* vm - novych : 5 - infinite new : vm - zprav : messages
* vm - youhave : you have
* vm - novou : one new : vm - zpravu : message
* vm - nove : 2 - 4 new : vm - zpravy : messages
* vm - novych : 5 - infinite new : vm - zprav : messages
* vm - starou : one old
* vm - stare : 2 - 4 old
* vm - starych : 5 - infinite old
* jednu : one - falling 4.
* vm - no : no ( no messages )
* vm - stare : 2 - 4 old
* vm - starych : 5 - infinite old
* jednu : one - falling 4.
* vm - no : no ( no messages )
*/
static int vm_intro_cz ( struct ast_channel * chan , struct vm_state * vms )
@ -4767,7 +4764,7 @@ static int vm_intro_ru(struct ast_channel *chan,struct vm_state *vms)
}
if ( ! res ) {
switch ( lastnum ) {
switch ( lastnum ) {
case 1 :
res = ast_play_and_wait ( chan , " vm-soobshenie " ) ;
break ;
@ -5042,7 +5039,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct
retries + + ;
if ( retries > 3 )
cmd = ' t ' ;
}
}
}
if ( cmd = = ' t ' )
cmd = 0 ;
@ -5115,20 +5112,20 @@ static int vm_browse_messages_gr(struct ast_channel *chan, struct vm_state *vms,
if ( vms - > lastmsg > - 1 ) {
cmd = play_message ( chan , vmu , vms ) ;
} else {
cmd = ast_play_and_wait ( chan , " vm-youhaveno " ) ;
if ( ! strcasecmp ( vms - > vmbox , " vm-INBOX " ) | | ! strcasecmp ( vms - > vmbox , " vm-Old " ) ) {
cmd = ast_play_and_wait ( chan , " vm-youhaveno " ) ;
if ( ! strcasecmp ( vms - > vmbox , " vm-INBOX " ) | | ! strcasecmp ( vms - > vmbox , " vm-Old " ) ) {
if ( ! cmd ) {
snprintf ( vms - > fn , sizeof ( vms - > fn ) , " vm-%ss " , vms - > curbox ) ;
cmd = ast_play_and_wait ( chan , vms - > fn ) ;
snprintf ( vms - > fn , sizeof ( vms - > fn ) , " vm-%ss " , vms - > curbox ) ;
cmd = ast_play_and_wait ( chan , vms - > fn ) ;
}
if ( ! cmd )
cmd = ast_play_and_wait ( chan , " vm-messages " ) ;
} else {
if ( ! cmd )
cmd = ast_play_and_wait ( chan , " vm-messages " ) ;
} else {
if ( ! cmd )
cmd = ast_play_and_wait ( chan , " vm-messages " ) ;
if ( ! cmd ) {
snprintf ( vms - > fn , sizeof ( vms - > fn ) , " vm-%s " , vms - > curbox ) ;
cmd = ast_play_and_wait ( chan , vms - > fn ) ;
snprintf ( vms - > fn , sizeof ( vms - > fn ) , " vm-%s " , vms - > curbox ) ;
cmd = ast_play_and_wait ( chan , vms - > fn ) ;
}
}
}
@ -5229,8 +5226,8 @@ static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, st
}
static int vm_authenticate ( struct ast_channel * chan , char * mailbox , int mailbox_size ,
struct ast_vm_user * res_vmu , const char * context , const char * prefix ,
int skipuser , int maxlogins , int silent )
struct ast_vm_user * res_vmu , const char * context , const char * prefix ,
int skipuser , int maxlogins , int silent )
{
int useadsi = 0 , valid = 0 , logretries = 0 ;
char password [ AST_MAX_EXTENSION ] = " " , * passptr ;
@ -5381,7 +5378,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
}
if ( ast_test_flag ( & flags , OPT_RECORDGAIN ) ) {
int gain ;
if ( opts [ OPT_ARG_RECORDGAIN ] ) {
if ( opts [ OPT_ARG_RECORDGAIN ] ) {
if ( sscanf ( opts [ OPT_ARG_RECORDGAIN ] , " %d " , & gain ) ! = 1 ) {
ast_log ( LOG_WARNING , " Invalid value '%s' provided for record gain option \n " , opts [ OPT_ARG_RECORDGAIN ] ) ;
LOCAL_USER_REMOVE ( u ) ;
@ -5395,7 +5392,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
}
if ( ast_test_flag ( & flags , OPT_AUTOPLAY ) ) {
play_auto = 1 ;
if ( opts [ OPT_ARG_PLAYFOLDER ] ) {
if ( opts [ OPT_ARG_PLAYFOLDER ] ) {
if ( sscanf ( opts [ OPT_ARG_PLAYFOLDER ] , " %d " , & play_folder ) ! = 1 ) {
ast_log ( LOG_WARNING , " Invalid value '%s' provided for folder autoplay option \n " , opts [ OPT_ARG_PLAYFOLDER ] ) ;
}
@ -5503,7 +5500,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
/* Check to see if this is a new user */
if ( ! strcasecmp ( vmu - > mailbox , vmu - > password ) & &
( ast_test_flag ( vmu , VM_FORCENAME | VM_FORCEGREET ) ) ) {
( ast_test_flag ( vmu , VM_FORCENAME | VM_FORCEGREET ) ) ) {
if ( ast_play_and_wait ( chan , " vm-newuser " ) = = - 1 )
ast_log ( LOG_WARNING , " Couldn't stream new user file \n " ) ;
cmd = vm_newuser ( chan , vmu , & vms , vmfmts , record_gain ) ;
@ -5528,7 +5525,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
vms . starting = 1 ;
while ( ( cmd > - 1 ) & & ( cmd ! = ' t ' ) & & ( cmd ! = ' # ' ) ) {
/* Run main menu */
switch ( cmd ) {
switch ( cmd ) {
case ' 1 ' :
vms . curmsg = 0 ;
/* Fall through */
@ -5563,7 +5560,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
cmd = 0 ;
vms . repeats = 0 ;
while ( ( cmd > - 1 ) & & ( cmd ! = ' t ' ) & & ( cmd ! = ' # ' ) ) {
switch ( cmd ) {
switch ( cmd ) {
case ' 1 ' : /* Reply */
if ( vms . lastmsg > - 1 & & ! vms . starting ) {
cmd = advanced_options ( chan , vmu , & vms , vms . curmsg , 1 , record_gain ) ;
@ -6176,7 +6173,7 @@ static int load_config(void)
char * thresholdstr ;
char * fmt ;
char * astemail ;
char * astmailcmd = SENDMAIL ;
char * astmailcmd = SENDMAIL ;
char * astforcename ;
char * astforcegreet ;
char * s , * q , * stringp ;
@ -6717,8 +6714,7 @@ static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num,
return 0 ;
}
static int advanced_options ( struct ast_channel * chan , struct ast_vm_user * vmu , struct vm_state * vms , int msg ,
int option , signed char record_gain )
static int advanced_options ( struct ast_channel * chan , struct ast_vm_user * vmu , struct vm_state * vms , int msg , int option , signed char record_gain )
{
int res = 0 ;
char filename [ 256 ] , * origtime , * cid , * context , * name , * num ;
@ -6770,7 +6766,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
ast_callerid_parse ( cid , & name , & num ) ;
while ( ( res > - 1 ) & & ( res ! = ' t ' ) ) {
switch ( res ) {
switch ( res ) {
case ' 1 ' :
if ( num ) {
/* Dial the CID number */
@ -6899,21 +6895,21 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
}
static int play_record_review ( struct ast_channel * chan , char * playfile , char * recordfile , int maxtime , char * fmt ,
int outsidecaller , struct ast_vm_user * vmu , int * duration , const char * unlockdir ,
signed char record_gain )
int outsidecaller , struct ast_vm_user * vmu , int * duration , const char * unlockdir ,
signed char record_gain )
{
/* Record message & let caller review or re-record it, or set options if applicable */
int res = 0 ;
int cmd = 0 ;
int max_attempts = 3 ;
int attempts = 0 ;
int recorded = 0 ;
int message_exists = 0 ;
int res = 0 ;
int cmd = 0 ;
int max_attempts = 3 ;
int attempts = 0 ;
int recorded = 0 ;
int message_exists = 0 ;
signed char zero_gain = 0 ;
char * acceptdtmf = " # " ;
char * canceldtmf = " " ;
/* Note that urgent and private are for flagging messages as such in the future */
/* Note that urgent and private are for flagging messages as such in the future */
/* barf if no pointer passed to store duration in */
if ( duration = = NULL ) {
@ -6921,47 +6917,47 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
return - 1 ;
}
cmd = ' 3 ' ; /* Want to start by recording */
cmd = ' 3 ' ; /* Want to start by recording */
while ( ( cmd > = 0 ) & & ( cmd ! = ' t ' ) ) {
switch ( cmd ) {
case ' 1 ' :
if ( ! message_exists ) {
/* In this case, 1 is to record a message */
cmd = ' 3 ' ;
break ;
} else {
/* Otherwise 1 is to save the existing message */
if ( option_verbose > 2 )
/* In this case, 1 is to record a message */
cmd = ' 3 ' ;
break ;
} else {
/* Otherwise 1 is to save the existing message */
if ( option_verbose > 2 )
ast_verbose ( VERBOSE_PREFIX_3 " Saving message as is \n " ) ;
ast_stream_and_wait ( chan , " vm-msgsaved " , chan - > language , " " ) ;
ast_stream_and_wait ( chan , " vm-msgsaved " , chan - > language , " " ) ;
STORE ( recordfile , vmu - > mailbox , vmu - > context , - 1 ) ;
DISPOSE ( recordfile , - 1 ) ;
cmd = ' t ' ;
return res ;
}
case ' 2 ' :
/* Review */
if ( option_verbose > 2 )
cmd = ' t ' ;
return res ;
}
case ' 2 ' :
/* Review */
if ( option_verbose > 2 )
ast_verbose ( VERBOSE_PREFIX_3 " Reviewing the message \n " ) ;
cmd = ast_stream_and_wait ( chan , recordfile , chan - > language , AST_DIGIT_ANY ) ;
break ;
case ' 3 ' :
message_exists = 0 ;
/* Record */
if ( recorded = = 1 ) {
cmd = ast_stream_and_wait ( chan , recordfile , chan - > language , AST_DIGIT_ANY ) ;
break ;
case ' 3 ' :
message_exists = 0 ;
/* Record */
if ( recorded = = 1 ) {
if ( option_verbose > 2 )
ast_verbose ( VERBOSE_PREFIX_3 " Re-recording the message \n " ) ;
} else {
} else {
if ( option_verbose > 2 )
ast_verbose ( VERBOSE_PREFIX_3 " Recording the message \n " ) ;
}
if ( recorded & & outsidecaller ) {
cmd = ast_play_and_wait ( chan , INTRO ) ;
cmd = ast_play_and_wait ( chan , " beep " ) ;
}
recorded = 1 ;
/* After an attempt has been made to record message, we have to take care of INTRO and beep for incoming messages, but not for greetings */
cmd = ast_play_and_wait ( chan , INTRO ) ;
cmd = ast_play_and_wait ( chan , " beep " ) ;
}
recorded = 1 ;
/* After an attempt has been made to record message, we have to take care of INTRO and beep for incoming messages, but not for greetings */
if ( record_gain )
ast_channel_setoption ( chan , AST_OPTION_RXGAIN , & record_gain , sizeof ( record_gain ) , 0 ) ;
if ( ast_test_flag ( vmu , VM_OPERATOR ) )
@ -6969,69 +6965,69 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
cmd = ast_play_and_record_full ( chan , playfile , recordfile , maxtime , fmt , duration , silencethreshold , maxsilence , unlockdir , acceptdtmf , canceldtmf ) ;
if ( record_gain )
ast_channel_setoption ( chan , AST_OPTION_RXGAIN , & zero_gain , sizeof ( zero_gain ) , 0 ) ;
if ( cmd = = - 1 ) {
/* User has hung up, no options to give */
return cmd ;
if ( cmd = = - 1 ) {
/* User has hung up, no options to give */
return cmd ;
}
if ( cmd = = ' 0 ' ) {
break ;
} else if ( cmd = = ' * ' ) {
break ;
}
if ( cmd = = ' 0 ' ) {
break ;
} else if ( cmd = = ' * ' ) {
break ;
}
#if 0
else if ( vmu - > review & & ( * duration < 5 ) ) {
/* Message is too short */
if ( option_verbose > 2 )
else if ( vmu - > review & & ( * duration < 5 ) ) {
/* Message is too short */
if ( option_verbose > 2 )
ast_verbose ( VERBOSE_PREFIX_3 " Message too short \n " ) ;
cmd = ast_play_and_wait ( chan , " vm-tooshort " ) ;
cmd = vm_delete ( recordfile ) ;
break ;
}
else if ( vmu - > review & & ( cmd = = 2 & & * duration < ( maxsilence + 3 ) ) ) {
/* Message is all silence */
if ( option_verbose > 2 )
cmd = vm_delete ( recordfile ) ;
break ;
}
else if ( vmu - > review & & ( cmd = = 2 & & * duration < ( maxsilence + 3 ) ) ) {
/* Message is all silence */
if ( option_verbose > 2 )
ast_verbose ( VERBOSE_PREFIX_3 " Nothing recorded \n " ) ;
cmd = vm_delete ( recordfile ) ;
cmd = vm_delete ( recordfile ) ;
cmd = ast_play_and_wait ( chan , " vm-nothingrecorded " ) ;
if ( ! cmd )
cmd = ast_play_and_wait ( chan , " vm-speakup " ) ;
break ;
}
cmd = ast_play_and_wait ( chan , " vm-speakup " ) ;
break ;
}
# endif
else {
/* If all is well, a message exists */
message_exists = 1 ;
else {
/* If all is well, a message exists */
message_exists = 1 ;
cmd = 0 ;
}
break ;
case ' 4 ' :
case ' 5 ' :
case ' 6 ' :
case ' 7 ' :
case ' 8 ' :
case ' 9 ' :
}
break ;
case ' 4 ' :
case ' 5 ' :
case ' 6 ' :
case ' 7 ' :
case ' 8 ' :
case ' 9 ' :
case ' * ' :
case ' # ' :
cmd = ast_play_and_wait ( chan , " vm-sorry " ) ;
break ;
cmd = ast_play_and_wait ( chan , " vm-sorry " ) ;
break ;
#if 0
/* XXX Commented out for the moment because of the dangers of deleting
a message while recording ( can put the message numbers out of sync ) */
case ' * ' :
/* Cancel recording, delete message, offer to take another message*/
cmd = ast_play_and_wait ( chan , " vm-deleted " ) ;
cmd = vm_delete ( recordfile ) ;
if ( outsidecaller ) {
res = vm_exec ( chan , NULL ) ;
return res ;
}
else
return 1 ;
case ' * ' :
/* Cancel recording, delete message, offer to take another message*/
cmd = ast_play_and_wait ( chan , " vm-deleted " ) ;
cmd = vm_delete ( recordfile ) ;
if ( outsidecaller ) {
res = vm_exec ( chan , NULL ) ;
return res ;
}
else
return 1 ;
# endif
case ' 0 ' :
if ( ! ast_test_flag ( vmu , VM_OPERATOR ) ) {
cmd = ast_play_and_wait ( chan , " vm-sorry " ) ;
break ;
case ' 0 ' :
if ( ! ast_test_flag ( vmu , VM_OPERATOR ) ) {
cmd = ast_play_and_wait ( chan , " vm-sorry " ) ;
break ;
}
if ( message_exists | | recorded ) {
cmd = ast_play_and_wait ( chan , " vm-saveoper " ) ;
@ -7047,45 +7043,45 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
}
}
return cmd ;
default :
default :
/* If the caller is an ouside caller, and the review option is enabled,
allow them to review the message , but let the owner of the box review
their OGM ' s */
if ( outsidecaller & & ! ast_test_flag ( vmu , VM_REVIEW ) )
return cmd ;
if ( message_exists ) {
cmd = ast_play_and_wait ( chan , " vm-review " ) ;
}
else {
cmd = ast_play_and_wait ( chan , " vm-torerecord " ) ;
if ( ! cmd )
cmd = ast_waitfordigit ( chan , 600 ) ;
}
if ( ! cmd & & outsidecaller & & ast_test_flag ( vmu , VM_OPERATOR ) ) {
cmd = ast_play_and_wait ( chan , " vm-reachoper " ) ;
if ( ! cmd )
cmd = ast_waitfordigit ( chan , 600 ) ;
}
if ( message_exists ) {
cmd = ast_play_and_wait ( chan , " vm-review " ) ;
}
else {
cmd = ast_play_and_wait ( chan , " vm-torerecord " ) ;
if ( ! cmd )
cmd = ast_waitfordigit ( chan , 600 ) ;
}
if ( ! cmd & & outsidecaller & & ast_test_flag ( vmu , VM_OPERATOR ) ) {
cmd = ast_play_and_wait ( chan , " vm-reachoper " ) ;
if ( ! cmd )
cmd = ast_waitfordigit ( chan , 600 ) ;
}
#if 0
if ( ! cmd )
cmd = ast_play_and_wait ( chan , " vm-tocancelmsg " ) ;
cmd = ast_play_and_wait ( chan , " vm-tocancelmsg " ) ;
# endif
if ( ! cmd )
cmd = ast_waitfordigit ( chan , 6000 ) ;
if ( ! cmd ) {
attempts + + ;
}
if ( attempts > max_attempts ) {
cmd = ' t ' ;
}
}
}
if ( outsidecaller )
if ( ! cmd )
cmd = ast_waitfordigit ( chan , 6000 ) ;
if ( ! cmd ) {
attempts + + ;
}
if ( attempts > max_attempts ) {
cmd = ' t ' ;
}
}
}
if ( outsidecaller )
ast_play_and_wait ( chan , " vm-goodbye " ) ;
if ( cmd = = ' t ' )
cmd = 0 ;
return cmd ;
if ( cmd = = ' t ' )
cmd = 0 ;
return cmd ;
}
static const char * description ( void )