aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-12 00:17:31 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-12 00:17:31 +0000
commit20dde4c8fc681f8e610b47176c5b019364f14e92 (patch)
tree7f238412a5e029b65c8a187d2408e9134306407d /apps
parentb3b27f9f92a01f0bcdf1faa3e9e1e5442eac6ae7 (diff)
Put sip history stuff in (for real) and provide voicemail context (when not default) in some critical places (bug #1609)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2950 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_voicemail.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index fb36366d1..44b49f244 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1498,6 +1498,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
char dir[256];
char fn[256];
char prefile[256]="";
+ char ext_context[256] = "";
char fmt[80];
char *context;
char *ecodes = "#";
@@ -1517,6 +1518,10 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
if ((vmu = find_user(&svm, context, ext))) {
/* Setup pre-file if appropriate */
+ if (strcmp(vmu->context, "default"))
+ snprintf(ext_context, sizeof(ext_context), "%s@%s", ext, vmu->context);
+ else
+ strncpy(ext_context, vmu->context, sizeof(ext_context) - 1);
if (busy)
snprintf(prefile, sizeof(prefile), "voicemail/%s/%s/busy", vmu->context, ext);
else if (unavail)
@@ -1690,10 +1695,10 @@ leave_vm_out:
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 +2396,7 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
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 +2450,7 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
*/
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 +2501,8 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
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 +2950,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
struct localuser *u;
char prefixstr[80] ="";
char empty[80] = "";
+ char ext_context[256]="";
int box;
int useadsi = 0;
int skipuser = 0;
@@ -3319,8 +3327,9 @@ out:
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);