diff -Nru a/apps/app_voicemail.c b/apps/app_voicemail.c --- a/apps/app_voicemail.c 2004-12-11 22:23:41 -07:00 +++ b/apps/app_voicemail.c 2004-12-11 22:23:41 -07:00 @@ -1132,6 +1132,7 @@ char fmt[80]=""; char *c; char *context="", *macrocontext="", *callerid="", *origtime="", *duration=""; + char *category = ""; struct ast_config *cfg=NULL; odbc_obj *obj; @@ -1172,6 +1173,8 @@ if (!origtime) origtime = ""; duration = ast_variable_retrieve(cfg, "message", "duration"); if (!duration) duration = ""; + category = ast_variable_retrieve(cfg, "message", "category"); + if (!category) category = ""; } fdlen = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); @@ -1956,6 +1959,7 @@ char tmp[256] = "", *tmpptr; struct ast_vm_user *vmu; struct ast_vm_user svm; + char *category = NULL; strncpy(tmp, ext, sizeof(tmp) - 1); ext = tmp; @@ -1973,6 +1977,8 @@ tmpptr++; } + category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY"); + if ((vmu = find_user(&svm, context, ext))) { /* Setup pre-file if appropriate */ if (strcmp(vmu->context, "default")) @@ -2126,7 +2132,8 @@ "callerchan=%s\n" "callerid=%s\n" "origdate=%s\n" -"origtime=%ld\n", +"origtime=%ld\n" +"category=%s\n", ext, chan->context, chan->macrocontext, @@ -2134,7 +2141,8 @@ chan->priority, chan->name, ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"), - date, (long)time(NULL)); + date, (long)time(NULL), + category ? category : ""); fclose(txt); } else ast_log(LOG_WARNING, "Error opening text file for output\n"); @@ -3122,6 +3130,16 @@ return ast_control_streamfile(chan, file, "#", "*", "1456789", "0", skipms); } +static int play_message_category(struct ast_channel *chan, char *category) +{ + int res = 0; + + if (category && !ast_strlen_zero(category)) + res = ast_play_and_wait(chan, category); + + return res; +} + static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *vmu, char *origtime, char *filename) { int res = 0; @@ -3273,6 +3291,7 @@ { int res = 0; char filename[256],*origtime, *cid, *context, *duration; + char *category; struct ast_config *msg_cfg; vms->starting = 0; @@ -3308,11 +3327,14 @@ cid = ast_variable_retrieve(msg_cfg, "message", "callerid"); duration = ast_variable_retrieve(msg_cfg, "message", "duration"); + category = ast_variable_retrieve(msg_cfg, "message", "category"); context = ast_variable_retrieve(msg_cfg, "message", "context"); if (!strncasecmp("macro",context,5)) /* Macro names in contexts are useless for our needs */ context = ast_variable_retrieve(msg_cfg, "message","macrocontext"); + if (!res) + res = play_message_category(chan, category); if ((!res)&&(vmu->envelope)) res = play_message_datetime(chan, vmu, origtime, filename); if ((!res)&&(vmu->saycid))