Merge matt's voicemail patch with some restructuring (bug #1971)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
18844270c3
commit
216fd6e249
1 changed files with 15 additions and 9 deletions
|
@ -1660,16 +1660,22 @@ static void copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int
|
||||||
notify_new_message(chan, recip, recipmsgnum, duration, fmt, chan->callerid);
|
notify_new_message(chan, recip, recipmsgnum, duration, fmt, chan->callerid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void run_externnotify(char *context, char *extension, int numvoicemails)
|
static void run_externnotify(char *context, char *extension)
|
||||||
{
|
{
|
||||||
char arguments[255];
|
char arguments[255];
|
||||||
|
int newvoicemails = 0, oldvoicemails = 0;
|
||||||
|
|
||||||
if(!ast_strlen_zero(externnotify)) {
|
if(externnotify[0]) {
|
||||||
snprintf(arguments, sizeof(arguments), "%s %s %s %d&", externnotify, context, extension, numvoicemails);
|
if (ast_app_messagecount(extension, &newvoicemails, &oldvoicemails)) {
|
||||||
|
ast_log(LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
|
||||||
|
} else {
|
||||||
|
strncpy(arguments, externnotify, sizeof(arguments));
|
||||||
|
snprintf(arguments, sizeof(arguments)-1, "%s %s %s %d&", externnotify, context, extension, newvoicemails);
|
||||||
ast_log(LOG_DEBUG,"Executing %s\n", arguments);
|
ast_log(LOG_DEBUG,"Executing %s\n", arguments);
|
||||||
ast_safe_system(arguments);
|
ast_safe_system(arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int busy, int unavail)
|
static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int busy, int unavail)
|
||||||
|
@ -2581,7 +2587,7 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
||||||
|
|
||||||
/* Leave voicemail for someone */
|
/* Leave voicemail for someone */
|
||||||
manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context));
|
manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context));
|
||||||
run_externnotify(chan->context, ext_context, ast_app_has_voicemail(ext_context));
|
run_externnotify(chan->context, ext_context);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2702,7 +2708,7 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
|
||||||
}
|
}
|
||||||
/* Leave voicemail for someone */
|
/* Leave voicemail for someone */
|
||||||
manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, ast_app_has_voicemail(ext_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));
|
run_externnotify(chan->context, ext_context);
|
||||||
|
|
||||||
saved_messages++;
|
saved_messages++;
|
||||||
vmfree = vmtmp;
|
vmfree = vmtmp;
|
||||||
|
@ -3872,7 +3878,7 @@ out:
|
||||||
if (valid) {
|
if (valid) {
|
||||||
snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context);
|
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));
|
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));
|
run_externnotify(chan->context, ext_context);
|
||||||
}
|
}
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue