--- app_voicemail.c.orig 2004-05-11 15:00:37.000000000 -0300 +++ app_voicemail.c 2004-05-11 15:09:45.000000000 -0300 @@ -1498,6 +1498,7 @@ char dir[256]; char fn[256]; char prefile[256]=""; + char ext_context[256] = ""; char fmt[80]; char *context; char *ecodes = "#"; @@ -1517,6 +1518,7 @@ if ((vmu = find_user(&svm, context, ext))) { /* Setup pre-file if appropriate */ + snprintf(ext_context, sizeof(ext_context), "%s@%s",ext,vmu->context); if (busy) snprintf(prefile, sizeof(prefile), "voicemail/%s/%s/busy", vmu->context, ext); else if (unavail) @@ -1690,10 +1692,10 @@ chan->priority+=100; } /* Leave voicemail for someone */ - manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext, ast_app_has_voicemail(ext)); + manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, ast_app_has_voicemail(ext_context)); /* If an external program is specified to be run after leaving a voicemail */ - run_externnotify(chan->context, ext, ast_app_has_voicemail(ext)); + run_externnotify(chan->context, ext_context, ast_app_has_voicemail(ext_context)); return res; } @@ -2391,6 +2393,7 @@ char miffile[256]; char fn[256]; char callerid[512]; + char ext_context[256]=""; int res = 0, cmd = 0; struct ast_vm_user *receiver, *extensions = NULL, *vmtmp = NULL, *vmfree; char tmp[256]; @@ -2444,6 +2447,7 @@ */ snprintf(todir, sizeof(todir), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, vmtmp->context, vmtmp->mailbox); snprintf(sys, sizeof(sys), "mkdir -p %s\n", todir); + snprintf(ext_context, sizeof(ext_context), "%s@%s",vmtmp->mailbox,vmtmp->context); ast_log(LOG_DEBUG, sys); ast_safe_system(sys); @@ -2494,8 +2498,8 @@ ast_destroy(mif); /* or here */ } /* Leave voicemail for someone */ - manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", vmtmp->mailbox, ast_app_has_voicemail(vmtmp->mailbox)); - run_externnotify(chan->context, vmtmp->mailbox, ast_app_has_voicemail(vmtmp->mailbox)); + manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, ast_app_has_voicemail(ext_context)); + run_externnotify(chan->context, ext_context, ast_app_has_voicemail(ext_context)); saved_messages++; vmfree = vmtmp; @@ -2943,6 +2947,7 @@ struct localuser *u; char prefixstr[80] =""; char empty[80] = ""; + char ext_context[256]=""; int box; int useadsi = 0; int skipuser = 0; @@ -3319,8 +3324,9 @@ if (vmu) free_user(vmu); if (valid) { - manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", vms.username, ast_app_has_voicemail(vms.username)); - run_externnotify(chan->context, vms.username, ast_app_has_voicemail(vms.username)); + snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context); + manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, ast_app_has_voicemail(ext_context)); + run_externnotify(chan->context, ext_context, ast_app_has_voicemail(ext_context)); } LOCAL_USER_REMOVE(u);