--- app_voicemail.c.orig 2006-04-12 00:24:46.000000000 +0200 +++ app_voicemail.c 2006-05-02 00:46:54.886459500 +0200 @@ -668,13 +668,9 @@ char *user = NULL, *pass = NULL, *rest = NULL, *comment = NULL, *tmpctx = NULL, *tmpctxend = NULL; /* Read in the line */ - fgets(inbuf, sizeof(inbuf), configin); - linenum++; - - if (ast_strlen_zero(inbuf)) { - fprintf(configout, "\n"); + if (fgets(inbuf, sizeof(inbuf), configin) == NULL) continue; - } + linenum++; /* Make a backup of it */ ast_copy_string(orig, inbuf, sizeof(orig)); @@ -2375,6 +2371,7 @@ int duration = 0; int ausemacro = 0; int ousemacro = 0; + int ouseexten = 0; char date[256]; char dir[256]; char fn[256]; @@ -2433,14 +2430,20 @@ create_dirpath(dir, sizeof(dir), vmu->context, ext, "INBOX"); /* Check current or macro-calling context for special extensions */ - if (!ast_strlen_zero(vmu->exit)) { - if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num)) + if (ast_test_flag(vmu, VM_OPERATOR)) { + if (!ast_strlen_zero(vmu->exit)) { + if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num)) { + strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); + ouseexten = 1; + } + } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num)) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); - } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num)) - strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); - else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) { - strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); - ousemacro = 1; + ouseexten = 1; + } + else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) { + strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); + ousemacro = 1; + } } if (!ast_strlen_zero(vmu->exit)) { @@ -2502,10 +2505,11 @@ pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); return 0; } + /* Check for a '0' here */ if (res == '0') { transfer: - if (ast_test_flag(vmu, VM_OPERATOR)) { + if(ouseexten || ousemacro) { chan->exten[0] = 'o'; chan->exten[1] = '\0'; if (!ast_strlen_zero(vmu->exit)) { @@ -2517,12 +2521,8 @@ chan->priority = 0; free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); - return 0; - } else { - ast_play_and_wait(chan, "vm-sorry"); - pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); - return 0; } + return 0; } if (res < 0) { free_user(vmu); @@ -6429,6 +6429,9 @@ res = play_message_datetime(chan, vmu, origtime, filename); if (!res) res = play_message_callerid(chan, vms, cid, context, 0); + + res = 't'; + } else if (option == 2) { /* Call back */ if (!ast_strlen_zero(cid)) { @@ -6626,7 +6629,7 @@ /* 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) ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0); - cmd = ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir); + cmd = ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir, ast_test_flag(vmu, VM_OPERATOR)); if (record_gain) ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0); if (cmd == -1) { @@ -6689,6 +6692,10 @@ return 1; #endif case '0': + if(!ast_test_flag(vmu, VM_OPERATOR)) { + cmd = ast_play_and_wait(chan, "vm-sorry"); + break; + } if (message_exists || recorded) { cmd = ast_play_and_wait(chan, "vm-saveoper"); if (!cmd)