Index: apps/app_voicemail.c =================================================================== RCS file: /usr/share/cvsroot/asterisk-ng/apps/app_voicemail.c,v retrieving revision 1.38 diff -c -r1.38 app_voicemail.c *** app_voicemail.c 2002/01/30 13:24:03 1.38 --- app_voicemail.c 2002/02/16 14:44:43 *************** *** 361,367 **** static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int busy, int unavail) { struct ast_config *cfg; ! char *copy, *name, *passwd, *email, *fmt, *fmts; char comment[256]; struct ast_filestream *writer=NULL, *others[MAX_OTHER_FORMATS]; char *sfmt[MAX_OTHER_FORMATS]; --- 361,368 ---- static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int busy, int unavail) { struct ast_config *cfg; ! char *copy, *name, *passwd, *email, *maxsec, *fmt, *fmts; ! int maxsecondsrecord; char comment[256]; struct ast_filestream *writer=NULL, *others[MAX_OTHER_FORMATS]; char *sfmt[MAX_OTHER_FORMATS]; *************** *** 396,401 **** --- 397,407 ---- passwd = strtok(copy, ","); name = strtok(NULL, ","); email = strtok(NULL, ","); + maxsec = strtok(NULL, ","); + if (maxsec != NULL) + maxsecondsrecord = atoi(maxsec); + else + maxsecondsrecord = 0; make_dir(dir, sizeof(dir), ext, ""); /* It's easier just to try to make it than to check for its existence */ if (mkdir(dir, 0700) && (errno != EEXIST)) *************** *** 502,507 **** --- 508,514 ---- free(sfmt[x]); } if (x == fmtcnt) { + long totaltime = 0; /* Loop forever, writing the packets we read to the writer(s), until we read a # or get a hangup */ if (option_verbose > 2) *************** *** 522,527 **** --- 529,539 ---- f = ast_read(chan); if (!f) break; + totaltime += f->timelen; + if ((totaltime > (maxsecondsrecord * 1000)) && (maxsecondsrecord > 0)) { + ast_log(LOG_WARNING, "User exceeded voicemail timeout of %d",maxsecondsrecord); + break; + } if (f->frametype == AST_FRAME_VOICE) { /* Write the primary format */ res = ast_writestream(writer, f);