Whitespace fixes

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37604 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Tilghman Lesher 20 years ago
parent d8ccfb6711
commit 954b0dd624

@ -124,23 +124,23 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define MAX_DATETIME_FORMAT 512 #define MAX_DATETIME_FORMAT 512
#define MAX_NUM_CID_CONTEXTS 10 #define MAX_NUM_CID_CONTEXTS 10
#define VM_REVIEW (1 << 0) #define VM_REVIEW (1 << 0)
#define VM_OPERATOR (1 << 1) #define VM_OPERATOR (1 << 1)
#define VM_SAYCID (1 << 2) #define VM_SAYCID (1 << 2)
#define VM_SVMAIL (1 << 3) #define VM_SVMAIL (1 << 3)
#define VM_ENVELOPE (1 << 4) #define VM_ENVELOPE (1 << 4)
#define VM_SAYDURATION (1 << 5) #define VM_SAYDURATION (1 << 5)
#define VM_SKIPAFTERCMD (1 << 6) #define VM_SKIPAFTERCMD (1 << 6)
#define VM_FORCENAME (1 << 7) /*!< Have new users record their name */ #define VM_FORCENAME (1 << 7) /*!< Have new users record their name */
#define VM_FORCEGREET (1 << 8) /*!< Have new users record their greetings */ #define VM_FORCEGREET (1 << 8) /*!< Have new users record their greetings */
#define VM_PBXSKIP (1 << 9) #define VM_PBXSKIP (1 << 9)
#define VM_DIRECFORWARD (1 << 10) /*!< directory_forward */ #define VM_DIRECFORWARD (1 << 10) /*!< directory_forward */
#define VM_ATTACH (1 << 11) #define VM_ATTACH (1 << 11)
#define VM_DELETE (1 << 12) #define VM_DELETE (1 << 12)
#define VM_ALLOCED (1 << 13) #define VM_ALLOCED (1 << 13)
#define VM_SEARCH (1 << 14) #define VM_SEARCH (1 << 14)
#define VM_TEMPGREETWARN (1 << 15) /*!< Remind user tempgreeting is set */ #define VM_TEMPGREETWARN (1 << 15) /*!< Remind user tempgreeting is set */
#define ERROR_LOCK_PATH -100 #define ERROR_LOCK_PATH -100
enum { enum {
OPT_SILENT = (1 << 0), OPT_SILENT = (1 << 0),
@ -253,24 +253,24 @@ struct baseio {
/*! Structure for linked list of users */ /*! Structure for linked list of users */
struct ast_vm_user { struct ast_vm_user {
char context[AST_MAX_CONTEXT]; /*!< Voicemail context */ char context[AST_MAX_CONTEXT]; /*!< Voicemail context */
char mailbox[AST_MAX_EXTENSION];/*!< Mailbox id, unique within vm context */ char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox id, unique within vm context */
char password[80]; /*!< Secret pin code, numbers only */ char password[80]; /*!< Secret pin code, numbers only */
char fullname[80]; /*!< Full name, for directory app */ char fullname[80]; /*!< Full name, for directory app */
char email[80]; /*!< E-mail address */ char email[80]; /*!< E-mail address */
char pager[80]; /*!< E-mail address to pager (no attachment) */ char pager[80]; /*!< E-mail address to pager (no attachment) */
char serveremail[80]; /*!< From: Mail address */ char serveremail[80]; /*!< From: Mail address */
char mailcmd[160]; /*!< Configurable mail command */ char mailcmd[160]; /*!< Configurable mail command */
char language[MAX_LANGUAGE]; /*!< Config: Language setting */ char language[MAX_LANGUAGE]; /*!< Config: Language setting */
char zonetag[80]; /*!< Time zone */ char zonetag[80]; /*!< Time zone */
char callback[80]; char callback[80];
char dialout[80]; char dialout[80];
char uniqueid[20]; /*!< Unique integer identifier */ char uniqueid[20]; /*!< Unique integer identifier */
char exit[80]; char exit[80];
char attachfmt[20]; /*!< Attachment format */ char attachfmt[20]; /*!< Attachment format */
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 */
AST_LIST_ENTRY(ast_vm_user) list; AST_LIST_ENTRY(ast_vm_user) list;
}; };
@ -297,12 +297,11 @@ struct vm_state {
int starting; int starting;
int repeats; int repeats;
}; };
static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msg, 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 option, signed char record_gain);
static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context); 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, 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, char *fmt, int outsidecaller, struct ast_vm_user *vmu, int *duration, const char *unlockdir,
signed char record_gain); 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_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); 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)); ast_copy_string(vmu->exit, value, sizeof(vmu->exit));
} 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) {
ast_log(LOG_WARNING, "Invalid number of messages per folder maxmsg=%s. Using default value %i\n", value, MAXMSG); ast_log(LOG_WARNING, "Invalid number of messages per folder maxmsg=%s. Using default value %i\n", value, MAXMSG);
vmu->maxmsg = MAXMSG; vmu->maxmsg = MAXMSG;
} else if (vmu->maxmsg > MAXMSGLIMIT) { } 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); var = ast_load_realtime("voicemail", "mailbox", mailbox, "context", context, NULL);
if (var) { if (var) {
tmp = var; tmp = var;
while(tmp) { while (tmp) {
printf("%s => %s\n", tmp->name, tmp->value); printf("%s => %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));
@ -759,8 +758,8 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
/* Compare user, pass AND context */ /* Compare user, pass AND context */
if (!ast_strlen_zero(user) && !strcmp(user, vmu->mailbox) && if (!ast_strlen_zero(user) && !strcmp(user, vmu->mailbox) &&
!ast_strlen_zero(pass) && !strcmp(pass, vmu->password) && !ast_strlen_zero(pass) && !strcmp(pass, vmu->password) &&
!strcasecmp(currcontext, vmu->context)) { !strcasecmp(currcontext, vmu->context)) {
/* This is the line */ /* This is the line */
if (rest) { if (rest) {
fprintf(configout, "%s => %s,%s", user, newpassword, 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)) { if (!ast_strlen_zero(context)) {
make_dir(dest, len, 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)); ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
return 0; return 0;
} }
} }
if (!ast_strlen_zero(ext)) { if (!ast_strlen_zero(ext)) {
make_dir(dest, len, context, 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)); ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
return 0; return 0;
} }
} }
if (!ast_strlen_zero(folder)) { if (!ast_strlen_zero(folder)) {
make_dir(dest, len, context, ext, 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)); ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
return 0; return 0;
} }
@ -1217,7 +1216,7 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
#ifdef EXTENDED_ODBC_STORAGE #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); 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 #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 #endif
res = SQLPrepare(stmt, sql, SQL_NTS); res = SQLPrepare(stmt, sql, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { 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, 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); SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL);
#else #else
SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(sdir), 0, (void *)sdir, 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); SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL);
#endif #endif
res = odbc_smart_execute(obj, stmt); res = odbc_smart_execute(obj, stmt);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { 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); odbc_release_obj(obj);
goto yuck; goto yuck;
} }
if (!ast_strlen_zero(category)) if (!ast_strlen_zero(category))
#ifdef EXTENDED_ODBC_STORAGE #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); snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)",odbc_table);
#else #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 #endif
else else
#ifdef EXTENDED_ODBC_STORAGE #ifdef EXTENDED_ODBC_STORAGE
snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)",odbc_table); snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)",odbc_table);
#else #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 #endif
res = SQLPrepare(stmt, sql, SQL_NTS); res = SQLPrepare(stmt, sql, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { 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)) if (!ast_strlen_zero(category))
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL); SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL);
#else #else
if (!ast_strlen_zero(category)) if (!ast_strlen_zero(category))
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL); SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(category), 0, (void *)category, 0, NULL);
#endif #endif
res = odbc_smart_execute(obj, stmt); res = odbc_smart_execute(obj, stmt);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { 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 #ifdef EXTENDED_ODBC_STORAGE
snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?",odbc_table); snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?",odbc_table);
#else #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 #endif
res = SQLPrepare(stmt, sql, SQL_NTS); res = SQLPrepare(stmt, sql, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { 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, 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); SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL);
#else #else
SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(sdir), 0, (void *)sdir, 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); SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(msgnums), 0, (void *)msgnums, 0, NULL);
#endif #endif
res = odbc_smart_execute(obj, stmt); res = odbc_smart_execute(obj, stmt);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { 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)); ast_copy_string(tmp, mailbox, sizeof(tmp));
mb = tmp; mb = tmp;
while((cur = strsep(&mb, ", "))) { while ((cur = strsep(&mb, ", "))) {
if (!ast_strlen_zero(cur)) { if (!ast_strlen_zero(cur)) {
if (inboxcount(cur, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL)) if (inboxcount(cur, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL))
return -1; return -1;
@ -2395,7 +2394,7 @@ static void run_externnotify(char *context, char *extension)
} else { } else {
snprintf(arguments, sizeof(arguments), "%s %s %s %d&", externnotify, context, extension, newvoicemails); snprintf(arguments, sizeof(arguments), "%s %s %s %d&", externnotify, context, extension, newvoicemails);
ast_log(LOG_DEBUG, "Executing %s\n", arguments); 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 */ /* Check for a '0' here */
if (res == '0') { if (res == '0') {
transfer: transfer:
if(ouseexten || ousemacro) { if (ouseexten || ousemacro) {
chan->exten[0] = 'o'; chan->exten[0] = 'o';
chan->exten[1] = '\0'; chan->exten[1] = '\0';
if (!ast_strlen_zero(vmu->exit)) { 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"); pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
} else } else
ast_log(LOG_WARNING, "No format for saving voicemail?\n"); ast_log(LOG_WARNING, "No format for saving voicemail?\n");
leave_vm_out: leave_vm_out:
free_user(vmu); free_user(vmu);
return res; return res;
@ -2727,7 +2726,7 @@ static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
make_file(sfn, sizeof(sfn), dir, x); make_file(sfn, sizeof(sfn), dir, x);
if (EXISTS(dir, x, sfn, NULL)) { if (EXISTS(dir, x, sfn, NULL)) {
if(x != dest) { if (x != dest) {
make_file(dfn, sizeof(dfn), dir, dest); make_file(dfn, sizeof(dfn), dir, dest);
RENAME(dir, x, vmu->mailbox, vmu->context, dir, dest, sfn, dfn); 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]; char ddir[256];
const char *dbox = mbox(box); const char *dbox = mbox(box);
int x; int x;
make_file(sfn, sizeof(sfn), dir, msg); make_file(sfn, sizeof(sfn), dir, msg);
create_dirpath(ddir, sizeof(ddir), context, username, dbox); create_dirpath(ddir, sizeof(ddir), context, username, dbox);
if (vm_lock_path(ddir)) if (vm_lock_path(ddir))
@ -2795,7 +2794,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
*useadsi = 0; *useadsi = 0;
bytes += adsi_data_mode(buf + bytes); 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 = 0;
bytes += adsi_logo(buf); bytes += adsi_logo(buf);
@ -2805,7 +2804,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
#endif #endif
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1); bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
bytes += adsi_data_mode(buf + bytes); 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)) { if (adsi_begin_download(chan, addesc, adsifdn, adsisec, adsiver)) {
bytes = 0; 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, 3, ADSI_JUST_CENT, 0, "Downloading Scripts", "");
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_LEFT, 0, " ..", ""); bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_LEFT, 0, " ..", "");
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1); 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 #endif
bytes = 0; bytes = 0;
bytes += adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 0, "Listen", "Listen", "1", 1); 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 + 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 + 4, "Help", "Help", "*", 1);
bytes += adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 5, "Exit", "Exit", "#", 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 #ifdef DISPLAY
/* Add another dot */ /* 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_voice_mode(buf + bytes, 0);
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1); 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 #endif
bytes = 0; 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 + 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 + 10, "Save", "Save", "9", 1);
bytes += adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 11, "Undelete", "Restore", "7", 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 #ifdef DISPLAY
/* Add another dot */ /* Add another dot */
bytes = 0; bytes = 0;
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_LEFT, 0, " ....", ""); bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_LEFT, 0, " ....", "");
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1); 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 #endif
bytes = 0; 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 + x, mbox(x), mbox(x), num, 1);
} }
bytes += adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 12 + 5, "Cancel", "Cancel", "#", 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 #ifdef DISPLAY
/* Add another dot */ /* Add another dot */
bytes = 0; bytes = 0;
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_LEFT, 0, " .....", ""); bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_LEFT, 0, " .....", "");
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1); 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 #endif
if (adsi_end_download(chan)) { if (adsi_end_download(chan)) {
@ -2891,7 +2890,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
bytes = 0; bytes = 0;
bytes += adsi_download_disconnect(buf + bytes); bytes += adsi_download_disconnect(buf + bytes);
bytes += adsi_voice_mode(buf + bytes, 0); 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"); ast_log(LOG_DEBUG, "Done downloading scripts...\n");
@ -2911,7 +2910,7 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
} else } else
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 3, ADSI_JUST_CENT, 0, "Load Failed!", ""); 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; 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_load_soft_key(buf + bytes, ADSI_KEY_APPS + 3, "Enter", "Enter", "#", 1);
bytes += adsi_set_keys(buf + bytes, keys); bytes += adsi_set_keys(buf + bytes, keys);
bytes += adsi_voice_mode(buf + bytes, 0); 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) 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); keys[5] = ADSI_KEY_SKT | (ADSI_KEY_APPS + 5);
snprintf(buf1, sizeof(buf1), "%s%s", vms->curbox, snprintf(buf1, sizeof(buf1), "%s%s", vms->curbox,
strcasecmp(vms->curbox, "INBOX") ? " Messages" : ""); 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, 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, 3, ADSI_JUST_LEFT, 0, name, "");
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_LEFT, 0, datetime, ""); 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[0] = ' ';
buf2[1] = '\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_display(buf + bytes, ADSI_COMM_PAGE, 2, ADSI_JUST_LEFT, 0, buf2, "");
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1); 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); snprintf(buf2, sizeof(buf2), "%d %s.", vms->lastmsg + 1, mess);
else else
strcpy(buf2, "no messages."); 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, 2, ADSI_JUST_LEFT, 0, buf2, "");
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 3, ADSI_JUST_LEFT, 0, "", ""); bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 3, ADSI_JUST_LEFT, 0, "", "");
bytes += adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1); 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; return res;
} }
static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vmfts, 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)
char *context, signed char record_gain)
{ {
int cmd = 0; int cmd = 0;
int retries = 0; int retries = 0;
@ -3352,7 +3350,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
retries++; retries++;
if (retries > 3) if (retries > 3)
cmd = 't'; cmd = 't';
} }
} }
if (cmd == 't' || cmd == 'S') if (cmd == 't' || cmd == 'S')
cmd = 0; cmd = 0;
@ -3411,8 +3409,7 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
return 0; return 0;
} }
static int forward_message(struct ast_channel *chan, char *context, char *dir, int curmsg, struct ast_vm_user *sender, 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 *fmt, int flag, signed char record_gain)
{ {
char username[70]=""; char username[70]="";
char sys[256]; char sys[256];
@ -3434,11 +3431,11 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
while (!res && !valid_extensions) { while (!res && !valid_extensions) {
int use_directory = 0; int use_directory = 0;
if(ast_test_flag((&globalflags), VM_DIRECFORWARD)) { if (ast_test_flag((&globalflags), VM_DIRECFORWARD)) {
int done = 0; int done = 0;
int retries = 0; int retries = 0;
cmd=0; cmd=0;
while((cmd >= 0) && !done ){ while ((cmd >= 0) && !done ){
if (cmd) if (cmd)
retries = 0; retries = 0;
switch (cmd) { switch (cmd) {
@ -3467,9 +3464,9 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
done = 1; done = 1;
} }
} }
} }
if( cmd<0 || cmd=='t' ) if (cmd < 0 || cmd == 't')
break; 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_log(LOG_WARNING, "Could not find the Directory application, disabling directory_forward\n");
ast_clear_flag((&globalflags), VM_DIRECFORWARD); ast_clear_flag((&globalflags), VM_DIRECFORWARD);
} }
} else { } else {
/* Ask for an extension */ /* Ask for an extension */
res = ast_streamfile(chan, "vm-extension", chan->language); /* "extension" */ res = ast_streamfile(chan, "vm-extension", chan->language); /* "extension" */
if (res) if (res)
@ -3720,17 +3717,17 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
#endif #endif
if (the_zone) if (the_zone)
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone); 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); 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); 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); 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); 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); 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); 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")) 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); 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 durationm;
int durations; int durations;
/* Verify that we have a duration for the message */ /* Verify that we have a duration for the message */
if((duration == NULL)) if (duration == NULL)
return res; return res;
/* Convert from seconds to minutes */ /* 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); last_msg = last_message_index(vmu, vms->curdir);
if (last_msg < 0) if (last_msg < 0)
return last_msg; 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); ast_log(LOG_NOTICE, "Resequencing Mailbox: %s\n", vms->curdir);
res = resequence_mailbox(vmu, 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" * ("filika mynhmata") it is not elegant. This also goes for "work/family messages"
* ("ergasiaka/oikogeniaka mynhmata"). Therefore it is better to use a reversed * ("ergasiaka/oikogeniaka mynhmata"). Therefore it is better to use a reversed
* syntax for the above three categories which is more elegant. * syntax for the above three categories which is more elegant.
*/ */
static int vm_play_folder_name_gr(struct ast_channel *chan, char *mbox) 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" */ return cmd ? cmd : ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */
} else { } else {
cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages" -> "MYNHMATA" */ 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"); return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");
} else { } else {
cmd = ast_play_and_wait(chan, "vm-messages"); 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 In greek the plural for old/new is
different so we need the following files different so we need the following files
We also need vm-denExeteMynhmata because 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-Olds.wav : "Palia"
-> vm-INBOXs.wav : "Nea" -> vm-INBOXs.wav : "Nea"
-> vm-denExeteMynhmata : "den exete mynhmata" -> vm-denExeteMynhmata : "den exete mynhmata"
*/ */
static int vm_intro_gr(struct ast_channel *chan, struct vm_state *vms) 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)) { if ((vms->newmessages == 1)) {
res = ast_play_and_wait(chan, "vm-INBOX"); res = ast_play_and_wait(chan, "vm-INBOX");
if (!res) if (!res)
res = ast_play_and_wait(chan, "vm-message"); res = ast_play_and_wait(chan, "vm-message");
} else { } else {
res = ast_play_and_wait(chan, "vm-INBOXs"); res = ast_play_and_wait(chan, "vm-INBOXs");
if (!res) if (!res)
res = ast_play_and_wait(chan, "vm-messages"); res = ast_play_and_wait(chan, "vm-messages");
} }
} }
} else if (vms->oldmessages){ } else if (vms->oldmessages){
res = ast_play_and_wait(chan, "vm-youhave"); 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"); res = ast_play_and_wait(chan, "vm-message");
} else { } else {
res = ast_play_and_wait(chan, "vm-Olds"); res = ast_play_and_wait(chan, "vm-Olds");
if (!res) if (!res)
res = ast_play_and_wait(chan, "vm-messages"); res = ast_play_and_wait(chan, "vm-messages");
} }
} else if (!vms->oldmessages && !vms->newmessages) } else if (!vms->oldmessages && !vms->newmessages)
res = ast_play_and_wait(chan, "vm-denExeteMynhmata"); res = ast_play_and_wait(chan, "vm-denExeteMynhmata");
return res; return res;
} }
/* Default English syntax */ /* Default English syntax */
@ -4640,17 +4637,17 @@ static int vm_intro_pt(struct ast_channel *chan,struct vm_state *vms)
/* CZECH syntax */ /* CZECH syntax */
/* in czech there must be declension of word new and message /* in czech there must be declension of word new and message
* czech : english : czech : english * czech : english : czech : english
* -------------------------------------------------------- * --------------------------------------------------------
* vm-youhave : you have * vm-youhave : you have
* vm-novou : one new : vm-zpravu : message * vm-novou : one new : vm-zpravu : message
* vm-nove : 2-4 new : vm-zpravy : messages * vm-nove : 2-4 new : vm-zpravy : messages
* vm-novych : 5-infinite new : vm-zprav : messages * vm-novych : 5-infinite new : vm-zprav : messages
* vm-starou : one old * vm-starou : one old
* vm-stare : 2-4 old * vm-stare : 2-4 old
* vm-starych : 5-infinite old * vm-starych : 5-infinite old
* jednu : one - falling 4. * jednu : one - falling 4.
* vm-no : no ( no messages ) * vm-no : no ( no messages )
*/ */
static int vm_intro_cz(struct ast_channel *chan,struct vm_state *vms) 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) { if (!res) {
switch(lastnum) { switch (lastnum) {
case 1: case 1:
res = ast_play_and_wait(chan, "vm-soobshenie"); res = ast_play_and_wait(chan, "vm-soobshenie");
break; break;
@ -5042,7 +5039,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct
retries++; retries++;
if (retries > 3) if (retries > 3)
cmd = 't'; cmd = 't';
} }
} }
if (cmd == 't') if (cmd == 't')
cmd = 0; cmd = 0;
@ -5115,20 +5112,20 @@ static int vm_browse_messages_gr(struct ast_channel *chan, struct vm_state *vms,
if (vms->lastmsg > -1) { if (vms->lastmsg > -1) {
cmd = play_message(chan, vmu, vms); cmd = play_message(chan, vmu, vms);
} else { } else {
cmd = ast_play_and_wait(chan, "vm-youhaveno"); cmd = ast_play_and_wait(chan, "vm-youhaveno");
if (!strcasecmp(vms->vmbox, "vm-INBOX") ||!strcasecmp(vms->vmbox, "vm-Old")){ if (!strcasecmp(vms->vmbox, "vm-INBOX") ||!strcasecmp(vms->vmbox, "vm-Old")){
if (!cmd) { if (!cmd) {
snprintf(vms->fn, sizeof(vms->fn), "vm-%ss", vms->curbox); snprintf(vms->fn, sizeof(vms->fn), "vm-%ss", vms->curbox);
cmd = ast_play_and_wait(chan, vms->fn); cmd = ast_play_and_wait(chan, vms->fn);
} }
if (!cmd) if (!cmd)
cmd = ast_play_and_wait(chan, "vm-messages"); cmd = ast_play_and_wait(chan, "vm-messages");
} else { } else {
if (!cmd) if (!cmd)
cmd = ast_play_and_wait(chan, "vm-messages"); cmd = ast_play_and_wait(chan, "vm-messages");
if (!cmd) { if (!cmd) {
snprintf(vms->fn, sizeof(vms->fn), "vm-%s", vms->curbox); snprintf(vms->fn, sizeof(vms->fn), "vm-%s", vms->curbox);
cmd = ast_play_and_wait(chan, vms->fn); 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, 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, struct ast_vm_user *res_vmu, const char *context, const char *prefix,
int skipuser, int maxlogins, int silent) int skipuser, int maxlogins, int silent)
{ {
int useadsi=0, valid=0, logretries=0; int useadsi=0, valid=0, logretries=0;
char password[AST_MAX_EXTENSION]="", *passptr; 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)) { if (ast_test_flag(&flags, OPT_RECORDGAIN)) {
int gain; int gain;
if(opts[OPT_ARG_RECORDGAIN]) { if (opts[OPT_ARG_RECORDGAIN]) {
if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) { 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]); ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]);
LOCAL_USER_REMOVE(u); 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) ) { if (ast_test_flag(&flags, OPT_AUTOPLAY) ) {
play_auto = 1; play_auto = 1;
if(opts[OPT_ARG_PLAYFOLDER]) { if (opts[OPT_ARG_PLAYFOLDER]) {
if (sscanf(opts[OPT_ARG_PLAYFOLDER], "%d", &play_folder) != 1) { 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]); 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 */ /* Check to see if this is a new user */
if (!strcasecmp(vmu->mailbox, vmu->password) && 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) if (ast_play_and_wait(chan, "vm-newuser") == -1)
ast_log(LOG_WARNING, "Couldn't stream new user file\n"); ast_log(LOG_WARNING, "Couldn't stream new user file\n");
cmd = vm_newuser(chan, vmu, &vms, vmfmts, record_gain); 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; vms.starting = 1;
while ((cmd > -1) && (cmd != 't') && (cmd != '#')) { while ((cmd > -1) && (cmd != 't') && (cmd != '#')) {
/* Run main menu */ /* Run main menu */
switch(cmd) { switch (cmd) {
case '1': case '1':
vms.curmsg = 0; vms.curmsg = 0;
/* Fall through */ /* Fall through */
@ -5563,7 +5560,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
cmd = 0; cmd = 0;
vms.repeats = 0; vms.repeats = 0;
while ((cmd > -1) && (cmd != 't') && (cmd != '#')) { while ((cmd > -1) && (cmd != 't') && (cmd != '#')) {
switch(cmd) { switch (cmd) {
case '1': /* Reply */ case '1': /* Reply */
if (vms.lastmsg > -1 && !vms.starting) { if (vms.lastmsg > -1 && !vms.starting) {
cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 1, record_gain); cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 1, record_gain);
@ -6176,7 +6173,7 @@ static int load_config(void)
char *thresholdstr; char *thresholdstr;
char *fmt; char *fmt;
char *astemail; char *astemail;
char *astmailcmd = SENDMAIL; char *astmailcmd = SENDMAIL;
char *astforcename; char *astforcename;
char *astforcegreet; char *astforcegreet;
char *s,*q,*stringp; char *s,*q,*stringp;
@ -6717,8 +6714,7 @@ static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num,
return 0; return 0;
} }
static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msg, 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 option, signed char record_gain)
{ {
int res = 0; int res = 0;
char filename[256],*origtime, *cid, *context, *name, *num; 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); ast_callerid_parse(cid, &name, &num);
while ((res > -1) && (res != 't')) { while ((res > -1) && (res != 't')) {
switch(res) { switch (res) {
case '1': case '1':
if (num) { if (num) {
/* Dial the CID number */ /* 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, 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, int outsidecaller, struct ast_vm_user *vmu, int *duration, const char *unlockdir,
signed char record_gain) signed char record_gain)
{ {
/* Record message & let caller review or re-record it, or set options if applicable */ /* Record message & let caller review or re-record it, or set options if applicable */
int res = 0; int res = 0;
int cmd = 0; int cmd = 0;
int max_attempts = 3; int max_attempts = 3;
int attempts = 0; int attempts = 0;
int recorded = 0; int recorded = 0;
int message_exists = 0; int message_exists = 0;
signed char zero_gain = 0; signed char zero_gain = 0;
char *acceptdtmf = "#"; char *acceptdtmf = "#";
char *canceldtmf = ""; 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 */ /* barf if no pointer passed to store duration in */
if (duration == NULL) { if (duration == NULL) {
@ -6921,47 +6917,47 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
return -1; return -1;
} }
cmd = '3'; /* Want to start by recording */ cmd = '3'; /* Want to start by recording */
while ((cmd >= 0) && (cmd != 't')) { while ((cmd >= 0) && (cmd != 't')) {
switch (cmd) { switch (cmd) {
case '1': case '1':
if (!message_exists) { if (!message_exists) {
/* In this case, 1 is to record a message */ /* In this case, 1 is to record a message */
cmd = '3'; cmd = '3';
break; break;
} else { } else {
/* Otherwise 1 is to save the existing message */ /* Otherwise 1 is to save the existing message */
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n"); 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); STORE(recordfile, vmu->mailbox, vmu->context, -1);
DISPOSE(recordfile, -1); DISPOSE(recordfile, -1);
cmd = 't'; cmd = 't';
return res; return res;
} }
case '2': case '2':
/* Review */ /* Review */
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n"); ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY); cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
break; break;
case '3': case '3':
message_exists = 0; message_exists = 0;
/* Record */ /* Record */
if (recorded == 1) { if (recorded == 1) {
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Re-recording the message\n"); ast_verbose(VERBOSE_PREFIX_3 "Re-recording the message\n");
} else { } else {
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Recording the message\n"); ast_verbose(VERBOSE_PREFIX_3 "Recording the message\n");
} }
if (recorded && outsidecaller) { if (recorded && outsidecaller) {
cmd = ast_play_and_wait(chan, INTRO); cmd = ast_play_and_wait(chan, INTRO);
cmd = ast_play_and_wait(chan, "beep"); cmd = ast_play_and_wait(chan, "beep");
} }
recorded = 1; 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 */ /* 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) if (record_gain)
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0); ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
if (ast_test_flag(vmu, VM_OPERATOR)) 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); cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf);
if (record_gain) if (record_gain)
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0); ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
if (cmd == -1) { if (cmd == -1) {
/* User has hung up, no options to give */ /* User has hung up, no options to give */
return cmd; return cmd;
}
if (cmd == '0') {
break;
} else if (cmd == '*') {
break;
} }
if (cmd == '0') {
break;
} else if (cmd == '*') {
break;
}
#if 0 #if 0
else if (vmu->review && (*duration < 5)) { else if (vmu->review && (*duration < 5)) {
/* Message is too short */ /* Message is too short */
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Message too short\n"); ast_verbose(VERBOSE_PREFIX_3 "Message too short\n");
cmd = ast_play_and_wait(chan, "vm-tooshort"); cmd = ast_play_and_wait(chan, "vm-tooshort");
cmd = vm_delete(recordfile); cmd = vm_delete(recordfile);
break; break;
} }
else if (vmu->review && (cmd == 2 && *duration < (maxsilence + 3))) { else if (vmu->review && (cmd == 2 && *duration < (maxsilence + 3))) {
/* Message is all silence */ /* Message is all silence */
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Nothing recorded\n"); ast_verbose(VERBOSE_PREFIX_3 "Nothing recorded\n");
cmd = vm_delete(recordfile); cmd = vm_delete(recordfile);
cmd = ast_play_and_wait(chan, "vm-nothingrecorded"); cmd = ast_play_and_wait(chan, "vm-nothingrecorded");
if (!cmd) if (!cmd)
cmd = ast_play_and_wait(chan, "vm-speakup"); cmd = ast_play_and_wait(chan, "vm-speakup");
break; break;
} }
#endif #endif
else { else {
/* If all is well, a message exists */ /* If all is well, a message exists */
message_exists = 1; message_exists = 1;
cmd = 0; cmd = 0;
} }
break; break;
case '4': case '4':
case '5': case '5':
case '6': case '6':
case '7': case '7':
case '8': case '8':
case '9': case '9':
case '*': case '*':
case '#': case '#':
cmd = ast_play_and_wait(chan, "vm-sorry"); cmd = ast_play_and_wait(chan, "vm-sorry");
break; break;
#if 0 #if 0
/* XXX Commented out for the moment because of the dangers of deleting /* XXX Commented out for the moment because of the dangers of deleting
a message while recording (can put the message numbers out of sync) */ a message while recording (can put the message numbers out of sync) */
case '*': case '*':
/* Cancel recording, delete message, offer to take another message*/ /* Cancel recording, delete message, offer to take another message*/
cmd = ast_play_and_wait(chan, "vm-deleted"); cmd = ast_play_and_wait(chan, "vm-deleted");
cmd = vm_delete(recordfile); cmd = vm_delete(recordfile);
if (outsidecaller) { if (outsidecaller) {
res = vm_exec(chan, NULL); res = vm_exec(chan, NULL);
return res; return res;
} }
else else
return 1; return 1;
#endif #endif
case '0': case '0':
if(!ast_test_flag(vmu, VM_OPERATOR)) { if (!ast_test_flag(vmu, VM_OPERATOR)) {
cmd = ast_play_and_wait(chan, "vm-sorry"); cmd = ast_play_and_wait(chan, "vm-sorry");
break; break;
} }
if (message_exists || recorded) { if (message_exists || recorded) {
cmd = ast_play_and_wait(chan, "vm-saveoper"); 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; return cmd;
default: default:
/* If the caller is an ouside caller, and the review option is enabled, /* 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 allow them to review the message, but let the owner of the box review
their OGM's */ their OGM's */
if (outsidecaller && !ast_test_flag(vmu, VM_REVIEW)) if (outsidecaller && !ast_test_flag(vmu, VM_REVIEW))
return cmd; return cmd;
if (message_exists) { if (message_exists) {
cmd = ast_play_and_wait(chan, "vm-review"); cmd = ast_play_and_wait(chan, "vm-review");
} }
else { else {
cmd = ast_play_and_wait(chan, "vm-torerecord"); cmd = ast_play_and_wait(chan, "vm-torerecord");
if (!cmd) if (!cmd)
cmd = ast_waitfordigit(chan, 600); cmd = ast_waitfordigit(chan, 600);
} }
if (!cmd && outsidecaller && ast_test_flag(vmu, VM_OPERATOR)) { if (!cmd && outsidecaller && ast_test_flag(vmu, VM_OPERATOR)) {
cmd = ast_play_and_wait(chan, "vm-reachoper"); cmd = ast_play_and_wait(chan, "vm-reachoper");
if (!cmd) if (!cmd)
cmd = ast_waitfordigit(chan, 600); cmd = ast_waitfordigit(chan, 600);
} }
#if 0 #if 0
if (!cmd) if (!cmd)
cmd = ast_play_and_wait(chan, "vm-tocancelmsg"); cmd = ast_play_and_wait(chan, "vm-tocancelmsg");
#endif #endif
if (!cmd) if (!cmd)
cmd = ast_waitfordigit(chan, 6000); cmd = ast_waitfordigit(chan, 6000);
if (!cmd) { if (!cmd) {
attempts++; attempts++;
} }
if (attempts > max_attempts) { if (attempts > max_attempts) {
cmd = 't'; cmd = 't';
} }
} }
} }
if (outsidecaller) if (outsidecaller)
ast_play_and_wait(chan, "vm-goodbye"); ast_play_and_wait(chan, "vm-goodbye");
if (cmd == 't') if (cmd == 't')
cmd = 0; cmd = 0;
return cmd; return cmd;
} }
static const char *description(void) static const char *description(void)

Loading…
Cancel
Save