Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 48123) +++ apps/app_voicemail.c (working copy) @@ -2309,10 +2309,9 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, int msgnum, long duration, char *fmt, char *cidnum, char *cidname); -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) +static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, char *frombox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt) { char fromdir[256], todir[256], frompath[256], topath[256]; - char *frombox = mbox(imbox); int recipmsgnum; ast_log(LOG_NOTICE, "Copying message from %s@%s to %s@%s\n", vmu->mailbox, vmu->context, recip->mailbox, recip->context); @@ -2653,7 +2652,7 @@ context++; } if ((recip = find_user(&recipu, context, exten))) { - copy_message(chan, vmu, 0, msgnum, duration, recip, fmt); + copy_message(chan, vmu, "INBOX", msgnum, duration, recip, fmt); free_user(recip); } } @@ -3428,7 +3427,7 @@ return 0; } -static int forward_message(struct ast_channel *chan, char *context, char *dir, int curmsg, struct ast_vm_user *sender, +static int forward_message(struct ast_channel *chan, char *context, struct vm_state *vms, struct ast_vm_user *sender, char *fmt, int flag, signed char record_gain) { char username[70]=""; @@ -3566,11 +3565,11 @@ /* Forward VoiceMail */ long duration = 0; - RETRIEVE(dir, curmsg); - cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, context, record_gain, &duration); + RETRIEVE(vms->dir, vms->curmsg); + cmd = vm_forwardoptions(chan, sender, vms->curdir, vms->curmsg, vmfmts, context, record_gain, &duration); if (!cmd) { while (!res && vmtmp) { - copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt); + copy_message(chan, sender, vms->curbox, vms->curmsg, duration, vmtmp, fmt); saved_messages++; vmfree = vmtmp; @@ -5311,7 +5310,7 @@ case '5': /* Leave VoiceMail */ if (ast_test_flag(vmu, VM_SVMAIL)) { - cmd = forward_message(chan, vmu->context, vms.curdir, vms.curmsg, vmu, vmfmts, 1, record_gain); + cmd = forward_message(chan, vmu->context, &vms, vmu, vmfmts, 1, record_gain); if (cmd == ERROR_LOCK_PATH) { res = cmd; goto out; @@ -5392,7 +5391,7 @@ case '8': if (vms.lastmsg > -1) { - cmd = forward_message(chan, vmu->context, vms.curdir, vms.curmsg, vmu, vmfmts, 0, record_gain); + cmd = forward_message(chan, vmu->context, &vms, vmu, vmfmts, 0, record_gain); if (cmd == ERROR_LOCK_PATH) { res = cmd; goto out;