Index: apps/app_voicemail.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v retrieving revision 1.205 diff -u -r1.205 app_voicemail.c --- apps/app_voicemail.c 2 Apr 2005 01:08:55 -0000 1.205 +++ apps/app_voicemail.c 12 Apr 2005 17:40:23 -0000 @@ -219,9 +219,9 @@ "Leave a voicemail message"; static char *descrip_vm = -" VoiceMail([s|u|b]extension[@context][&extension[@context]][...]): Leaves" +" VoiceMail(extension[@context][&extension[@context]][...][|options]): Leaves" "voicemail for a given extension (must be configured in voicemail.conf).\n" -" If the extension is preceded by \n" +" If the extension is followed by \n" "* 's' then instructions for leaving the message will be skipped.\n" "* 'u' then the \"unavailable\" message will be played.\n" " (/var/lib/asterisk/sounds/vm//unavail) if it exists.\n" @@ -4852,7 +4852,8 @@ { int res=0, silent=0, busy=0, unavail=0; struct localuser *u; - char tmp[256], *ext; + char tmp[256]; + char *ext, *options; LOCAL_USER_ADD(u); if (chan->_state != AST_STATE_UP) @@ -4866,20 +4867,33 @@ if (ast_strlen_zero(tmp)) return 0; } - ext = tmp; - while (*ext) { - if (*ext == 's') { + + ext = tmp; + if ((options = strchr(tmp, '|'))) { + *options = '0'; + options++; + if (strchr(options, 's')) silent = 2; - ext++; - } else if (*ext == 'b') { - busy=1; - ext++; - } else if (*ext == 'u') { - unavail=1; - ext++; - } else - break; - } + else if (strchr(options, 'b')) + busy = 2; + else if (strchr(options, 'u')) + unavail = 2; + } else { + /* old school options parsing */ + while (*ext) { + if (*ext == 's') { + silent = 2; + ext++; + } else if (*ext == 'b') { + busy=1; + ext++; + } else if (*ext == 'u') { + unavail=1; + ext++; + } else + break; + } + } res = leave_voicemail(chan, ext, silent, busy, unavail); LOCAL_USER_REMOVE(u); return res; @@ -4925,6 +4939,7 @@ struct localuser *u; struct ast_vm_user svm; char *context, *box; + char *options; char tmp[256]; if (!data || !strlen(data)) { @@ -4936,11 +4951,15 @@ LOCAL_USER_ADD(u); box = tmp; - while (*box) { - if ((*box == 's') || (*box == 'b') || (*box == 'u')) { - box++; - } else - break; + if ((options = strchr(tmp, '|'))) { + *options = '\0'; + } else { + while (*box) { + if ((*box == 's') || (*box == 'b') || (*box == 'u')) + box++; + else + break; + } } context = strchr(tmp, '@');