|
|
|
|
@ -243,10 +243,10 @@ struct vm_zone {
|
|
|
|
|
struct vm_state {
|
|
|
|
|
char curbox[80];
|
|
|
|
|
char username[80];
|
|
|
|
|
char curdir[256];
|
|
|
|
|
char vmbox[256];
|
|
|
|
|
char fn[256];
|
|
|
|
|
char fn2[256];
|
|
|
|
|
char curdir[PATH_MAX];
|
|
|
|
|
char vmbox[PATH_MAX];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char fn2[PATH_MAX];
|
|
|
|
|
int *deleted;
|
|
|
|
|
int *heard;
|
|
|
|
|
int curmsg;
|
|
|
|
|
@ -639,7 +639,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
|
|
|
|
|
int linenum=0;
|
|
|
|
|
char inbuf[256];
|
|
|
|
|
char orig[256];
|
|
|
|
|
char currcontext[256] ="";
|
|
|
|
|
char currcontext[256] = "";
|
|
|
|
|
char tmpin[AST_CONFIG_MAX_PATH];
|
|
|
|
|
char tmpout[AST_CONFIG_MAX_PATH];
|
|
|
|
|
struct stat statbuf;
|
|
|
|
|
@ -839,7 +839,7 @@ static int retrieve_file(char *dir, int msgnum)
|
|
|
|
|
void *fdm=NULL;
|
|
|
|
|
SQLSMALLINT colcount=0;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char fmt[80]="";
|
|
|
|
|
char *c;
|
|
|
|
|
char coltitle[256];
|
|
|
|
|
@ -850,8 +850,8 @@ static int retrieve_file(char *dir, int msgnum)
|
|
|
|
|
SQLULEN colsize;
|
|
|
|
|
FILE *f=NULL;
|
|
|
|
|
char rowdata[80];
|
|
|
|
|
char fn[256];
|
|
|
|
|
char full_fn[256];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char full_fn[PATH_MAX];
|
|
|
|
|
char msgnums[80];
|
|
|
|
|
|
|
|
|
|
odbc_obj *obj;
|
|
|
|
|
@ -986,8 +986,8 @@ yuck:
|
|
|
|
|
|
|
|
|
|
static int remove_file(char *dir, int msgnum)
|
|
|
|
|
{
|
|
|
|
|
char fn[256];
|
|
|
|
|
char full_fn[256];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char full_fn[PATH_MAX];
|
|
|
|
|
char msgnums[80];
|
|
|
|
|
|
|
|
|
|
if (msgnum > -1) {
|
|
|
|
|
@ -1006,7 +1006,7 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
|
|
|
|
|
int x = 0;
|
|
|
|
|
int res;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char rowdata[20];
|
|
|
|
|
|
|
|
|
|
odbc_obj *obj;
|
|
|
|
|
@ -1057,7 +1057,7 @@ static int message_exists(char *dir, int msgnum)
|
|
|
|
|
int x = 0;
|
|
|
|
|
int res;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char rowdata[20];
|
|
|
|
|
char msgnums[20];
|
|
|
|
|
|
|
|
|
|
@ -1115,7 +1115,7 @@ static void delete_file(char *sdir, int smsg)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char msgnums[20];
|
|
|
|
|
|
|
|
|
|
odbc_obj *obj;
|
|
|
|
|
@ -1212,10 +1212,10 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
|
|
|
|
|
size_t fdlen = -1;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
SQLINTEGER len;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char msgnums[20];
|
|
|
|
|
char fn[256];
|
|
|
|
|
char full_fn[256];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char full_fn[PATH_MAX];
|
|
|
|
|
char fmt[80]="";
|
|
|
|
|
char *c;
|
|
|
|
|
char *context="", *macrocontext="", *callerid="", *origtime="", *duration="";
|
|
|
|
|
@ -1331,7 +1331,7 @@ static void rename_file(char *sdir, int smsg, char *mailboxuser, char *mailboxco
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char msgnums[20];
|
|
|
|
|
char msgnumd[20];
|
|
|
|
|
odbc_obj *obj;
|
|
|
|
|
@ -1408,8 +1408,8 @@ static int count_messages(struct ast_vm_user *vmu, char *dir)
|
|
|
|
|
|
|
|
|
|
static void rename_file(char *sfn, char *dfn)
|
|
|
|
|
{
|
|
|
|
|
char stxt[256];
|
|
|
|
|
char dtxt[256];
|
|
|
|
|
char stxt[PATH_MAX];
|
|
|
|
|
char dtxt[PATH_MAX];
|
|
|
|
|
ast_filerename(sfn,dfn,NULL);
|
|
|
|
|
snprintf(stxt, sizeof(stxt), "%s.txt", sfn);
|
|
|
|
|
snprintf(dtxt, sizeof(dtxt), "%s.txt", dfn);
|
|
|
|
|
@ -1468,7 +1468,7 @@ static int copy(char *infile, char *outfile)
|
|
|
|
|
|
|
|
|
|
static void copy_file(char *frompath, char *topath)
|
|
|
|
|
{
|
|
|
|
|
char frompath2[256],topath2[256];
|
|
|
|
|
char frompath2[PATH_MAX], topath2[PATH_MAX];
|
|
|
|
|
ast_filecopy(frompath, topath, NULL);
|
|
|
|
|
snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
|
|
|
|
|
snprintf(topath2, sizeof(topath2), "%s.txt", topath);
|
|
|
|
|
@ -1481,7 +1481,7 @@ static void copy_file(char *frompath, char *topath)
|
|
|
|
|
static int last_message_index(struct ast_vm_user *vmu, char *dir)
|
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
char fn[256];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
|
|
|
|
|
if (vm_lock_path(dir))
|
|
|
|
|
return ERROR_LOCK_PATH;
|
|
|
|
|
@ -1660,10 +1660,10 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
|
|
|
|
|
char host[MAXHOSTNAMELEN] = "";
|
|
|
|
|
char who[256];
|
|
|
|
|
char bound[256];
|
|
|
|
|
char fname[256];
|
|
|
|
|
char dur[256];
|
|
|
|
|
char fname[PATH_MAX];
|
|
|
|
|
char dur[PATH_MAX];
|
|
|
|
|
char tmp[80] = "/tmp/astmail-XXXXXX";
|
|
|
|
|
char tmp2[256];
|
|
|
|
|
char tmp2[PATH_MAX];
|
|
|
|
|
time_t t;
|
|
|
|
|
struct tm tm;
|
|
|
|
|
struct vm_zone *the_zone = NULL;
|
|
|
|
|
@ -1819,11 +1819,11 @@ static int sendpage(char *srcemail, char *pager, int msgnum, char *context, char
|
|
|
|
|
FILE *p=NULL;
|
|
|
|
|
int pfd;
|
|
|
|
|
char date[256];
|
|
|
|
|
char host[MAXHOSTNAMELEN]="";
|
|
|
|
|
char host[MAXHOSTNAMELEN] = "";
|
|
|
|
|
char who[256];
|
|
|
|
|
char dur[256];
|
|
|
|
|
char dur[PATH_MAX];
|
|
|
|
|
char tmp[80] = "/tmp/astmail-XXXXXX";
|
|
|
|
|
char tmp2[256];
|
|
|
|
|
char tmp2[PATH_MAX];
|
|
|
|
|
time_t t;
|
|
|
|
|
struct tm tm;
|
|
|
|
|
struct vm_zone *the_zone = NULL;
|
|
|
|
|
@ -1942,12 +1942,12 @@ static int get_date(char *s, int len)
|
|
|
|
|
static int invent_message(struct ast_channel *chan, char *context, char *ext, int busy, char *ecodes)
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
char fn[256];
|
|
|
|
|
char dest[256];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char dest[PATH_MAX];
|
|
|
|
|
|
|
|
|
|
snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
|
|
|
|
|
|
|
|
|
|
if (!(res = create_dirpath(dest,256,context,ext,"greet"))) {
|
|
|
|
|
if (!(res = create_dirpath(dest, sizeof(dest), context, ext, "greet"))) {
|
|
|
|
|
ast_log(LOG_WARNING, "Failed to make directory(%s)\n", fn);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
@ -2032,9 +2032,9 @@ static int messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
|
|
|
|
int x = -1;
|
|
|
|
|
int res;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char rowdata[20];
|
|
|
|
|
char tmp[256]="";
|
|
|
|
|
char tmp[PATH_MAX] = "";
|
|
|
|
|
char *context;
|
|
|
|
|
|
|
|
|
|
if (newmsgs)
|
|
|
|
|
@ -2136,9 +2136,9 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
|
int nummsgs = 0;
|
|
|
|
|
int res;
|
|
|
|
|
SQLHSTMT stmt;
|
|
|
|
|
char sql[256];
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char rowdata[20];
|
|
|
|
|
char tmp[256]="";
|
|
|
|
|
char tmp[PATH_MAX] = "";
|
|
|
|
|
char *context;
|
|
|
|
|
if (!folder)
|
|
|
|
|
folder = "INBOX";
|
|
|
|
|
@ -2206,8 +2206,8 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
|
{
|
|
|
|
|
DIR *dir;
|
|
|
|
|
struct dirent *de;
|
|
|
|
|
char fn[256];
|
|
|
|
|
char tmp[256]="";
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char tmp[PATH_MAX] = "";
|
|
|
|
|
char *mb, *cur;
|
|
|
|
|
char *context;
|
|
|
|
|
int ret;
|
|
|
|
|
@ -2254,8 +2254,8 @@ static int messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
|
|
|
|
{
|
|
|
|
|
DIR *dir;
|
|
|
|
|
struct dirent *de;
|
|
|
|
|
char fn[256];
|
|
|
|
|
char tmp[256]="";
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char tmp[PATH_MAX] = "";
|
|
|
|
|
char *mb, *cur;
|
|
|
|
|
char *context;
|
|
|
|
|
int ret;
|
|
|
|
|
@ -2327,7 +2327,7 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
|
|
|
|
|
|
|
|
|
static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt)
|
|
|
|
|
{
|
|
|
|
|
char fromdir[256], todir[256], frompath[256], topath[256];
|
|
|
|
|
char fromdir[PATH_MAX], todir[PATH_MAX], frompath[PATH_MAX], topath[PATH_MAX];
|
|
|
|
|
char *frombox = mbox(imbox);
|
|
|
|
|
int recipmsgnum;
|
|
|
|
|
|
|
|
|
|
@ -2388,7 +2388,7 @@ struct leave_vm_options {
|
|
|
|
|
|
|
|
|
|
static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
|
|
|
|
|
{
|
|
|
|
|
char txtfile[256], tmptxtfile[256];
|
|
|
|
|
char txtfile[PATH_MAX], tmptxtfile[PATH_MAX];
|
|
|
|
|
char callerid[256];
|
|
|
|
|
FILE *txt;
|
|
|
|
|
int res = 0, txtdes;
|
|
|
|
|
@ -2398,11 +2398,11 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
|
|
|
|
|
int ousemacro = 0;
|
|
|
|
|
int ouseexten = 0;
|
|
|
|
|
char date[256];
|
|
|
|
|
char dir[256], tmpdir[260];
|
|
|
|
|
char dest[256];
|
|
|
|
|
char fn[256];
|
|
|
|
|
char prefile[256]="";
|
|
|
|
|
char tempfile[256]="";
|
|
|
|
|
char dir[PATH_MAX], tmpdir[PATH_MAX];
|
|
|
|
|
char dest[PATH_MAX];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
char prefile[PATH_MAX] = "";
|
|
|
|
|
char tempfile[PATH_MAX] = "";
|
|
|
|
|
char ext_context[256] = "";
|
|
|
|
|
char fmt[80];
|
|
|
|
|
char *context;
|
|
|
|
|
@ -2712,8 +2712,8 @@ static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
|
|
|
|
|
/* we know max messages, so stop process when number is hit */
|
|
|
|
|
|
|
|
|
|
int x,dest;
|
|
|
|
|
char sfn[256];
|
|
|
|
|
char dfn[256];
|
|
|
|
|
char sfn[PATH_MAX];
|
|
|
|
|
char dfn[PATH_MAX];
|
|
|
|
|
|
|
|
|
|
if (vm_lock_path(dir))
|
|
|
|
|
return ERROR_LOCK_PATH;
|
|
|
|
|
@ -2745,9 +2745,9 @@ static int say_and_wait(struct ast_channel *chan, int num, char *language)
|
|
|
|
|
|
|
|
|
|
static int save_to_folder(struct ast_vm_user *vmu, char *dir, int msg, char *context, char *username, int box)
|
|
|
|
|
{
|
|
|
|
|
char sfn[256];
|
|
|
|
|
char dfn[256];
|
|
|
|
|
char ddir[256];
|
|
|
|
|
char sfn[PATH_MAX];
|
|
|
|
|
char dfn[PATH_MAX];
|
|
|
|
|
char ddir[PATH_MAX];
|
|
|
|
|
char *dbox = mbox(box);
|
|
|
|
|
int x;
|
|
|
|
|
make_file(sfn, sizeof(sfn), dir, msg);
|
|
|
|
|
@ -3009,7 +3009,7 @@ static void adsi_message(struct ast_channel *chan, struct vm_state *vms)
|
|
|
|
|
int bytes=0;
|
|
|
|
|
unsigned char buf[256];
|
|
|
|
|
char buf1[256], buf2[256];
|
|
|
|
|
char fn2[256];
|
|
|
|
|
char fn2[PATH_MAX];
|
|
|
|
|
|
|
|
|
|
char cid[256]="";
|
|
|
|
|
char *val;
|
|
|
|
|
@ -3269,7 +3269,7 @@ static int get_folder(struct ast_channel *chan, int start)
|
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
|
int d;
|
|
|
|
|
char fn[256];
|
|
|
|
|
char fn[PATH_MAX];
|
|
|
|
|
d = ast_play_and_wait(chan, "vm-press"); /* "Press" */
|
|
|
|
|
if (d)
|
|
|
|
|
return d;
|
|
|
|
|
@ -3406,7 +3406,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu,
|
|
|
|
|
|
|
|
|
|
static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *cidnum, char *cidname)
|
|
|
|
|
{
|
|
|
|
|
char todir[256], fn[256], ext_context[256], *stringp;
|
|
|
|
|
char todir[PATH_MAX], fn[PATH_MAX], ext_context[PATH_MAX], *stringp;
|
|
|
|
|
int newmsgs = 0, oldmsgs = 0;
|
|
|
|
|
|
|
|
|
|
make_dir(todir, sizeof(todir), vmu->context, vmu->mailbox, "INBOX");
|
|
|
|
|
@ -3718,7 +3718,7 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms,
|
|
|
|
|
int res = 0;
|
|
|
|
|
int i;
|
|
|
|
|
char *callerid, *name;
|
|
|
|
|
char prefile[256]="";
|
|
|
|
|
char prefile[PATH_MAX] = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If voicemail cid is not enabled, or we didn't get cid or context from the attribute file, leave now. */
|
|
|
|
|
@ -3802,7 +3802,7 @@ static int play_message_duration(struct ast_channel *chan, struct vm_state *vms,
|
|
|
|
|
static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)
|
|
|
|
|
{
|
|
|
|
|
int res = 0;
|
|
|
|
|
char filename[256],*origtime, *cid, *context, *duration;
|
|
|
|
|
char filename[PATH_MAX], *origtime, *cid, *context, *duration;
|
|
|
|
|
char *category;
|
|
|
|
|
struct ast_config *msg_cfg;
|
|
|
|
|
|
|
|
|
|
@ -4633,7 +4633,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct
|
|
|
|
|
int tries = 0;
|
|
|
|
|
char newpassword[80] = "";
|
|
|
|
|
char newpassword2[80] = "";
|
|
|
|
|
char prefile[256]="";
|
|
|
|
|
char prefile[PATH_MAX] = "";
|
|
|
|
|
unsigned char buf[256];
|
|
|
|
|
int bytes=0;
|
|
|
|
|
|
|
|
|
|
@ -4711,7 +4711,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct
|
|
|
|
|
int duration = 0;
|
|
|
|
|
char newpassword[80] = "";
|
|
|
|
|
char newpassword2[80] = "";
|
|
|
|
|
char prefile[256]="";
|
|
|
|
|
char prefile[PATH_MAX] = "";
|
|
|
|
|
unsigned char buf[256];
|
|
|
|
|
int bytes=0;
|
|
|
|
|
|
|
|
|
|
@ -4807,10 +4807,10 @@ static int vm_tempgreeting(struct ast_channel *chan, struct ast_vm_user *vmu, st
|
|
|
|
|
int cmd = 0;
|
|
|
|
|
int retries = 0;
|
|
|
|
|
int duration = 0;
|
|
|
|
|
char prefile[256]="";
|
|
|
|
|
char prefile[PATH_MAX] = "";
|
|
|
|
|
unsigned char buf[256];
|
|
|
|
|
char dest[256];
|
|
|
|
|
int bytes=0;
|
|
|
|
|
char dest[PATH_MAX];
|
|
|
|
|
int bytes = 0;
|
|
|
|
|
|
|
|
|
|
if (adsi_available(chan))
|
|
|
|
|
{
|
|
|
|
|
@ -6440,7 +6440,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
|
|
|
|
|
int option, signed char record_gain)
|
|
|
|
|
{
|
|
|
|
|
int res = 0;
|
|
|
|
|
char filename[256],*origtime, *cid, *context, *name, *num;
|
|
|
|
|
char filename[PATH_MAX], *origtime, *cid, *context, *name, *num;
|
|
|
|
|
struct ast_config *msg_cfg;
|
|
|
|
|
int retries = 0;
|
|
|
|
|
|
|
|
|
|
|