|
|
|
@ -7,7 +7,7 @@ Subject: sipwise_vm_add_actions_wmi
|
|
|
|
|
1 file changed, 277 insertions(+), 19 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
|
|
|
|
|
index c3cdb58..77575c5 100644
|
|
|
|
|
index c98cefa..afee86d 100644
|
|
|
|
|
--- a/apps/app_voicemail.c
|
|
|
|
|
+++ b/apps/app_voicemail.c
|
|
|
|
|
@@ -1043,6 +1043,52 @@ static int adsiver = 1;
|
|
|
|
@ -74,7 +74,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
@@ -4447,9 +4494,11 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
|
|
|
|
|
@@ -4451,9 +4498,11 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
|
|
|
|
|
char msgnums[20];
|
|
|
|
|
char msgnumd[20];
|
|
|
|
|
char msg_id[MSG_ID_LEN];
|
|
|
|
@ -88,7 +88,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
|
|
|
|
|
generate_msg_id(msg_id);
|
|
|
|
|
delete_file(ddir, dmsg);
|
|
|
|
|
@@ -4461,7 +4510,10 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
|
|
|
|
|
@@ -4465,7 +4514,10 @@ static void copy_file(char *sdir, int smsg, char *ddir, int dmsg, char *dmailbox
|
|
|
|
|
|
|
|
|
|
snprintf(msgnums, sizeof(msgnums), "%d", smsg);
|
|
|
|
|
snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
|
|
|
|
@ -100,7 +100,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
|
|
|
|
|
if (!stmt)
|
|
|
|
|
ast_log(AST_LOG_WARNING, "SQL Execute error!\n[%s] (You probably don't have MySQL 4.1 or later installed)\n\n", sql);
|
|
|
|
|
@@ -6281,8 +6333,9 @@ static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
|
|
|
|
@@ -6285,8 +6337,9 @@ static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -111,7 +111,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
char arguments[2048];
|
|
|
|
|
char date[256];
|
|
|
|
|
struct ast_tm tm;
|
|
|
|
|
@@ -6325,14 +6378,39 @@ static void run_externnotify(const char *context, const char *extension, const c
|
|
|
|
|
@@ -6329,14 +6382,39 @@ static void run_externnotify(const char *context, const char *extension, const c
|
|
|
|
|
} else if (ast_strlen_zero(number) || !strcmp(extension, number)) {
|
|
|
|
|
ast_log(AST_LOG_WARNING, "Missing user number to run externnotify on context '%s'\n", ext_context);
|
|
|
|
|
} else {
|
|
|
|
@ -156,7 +156,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else { // original short notify + extension
|
|
|
|
|
snprintf(arguments, sizeof(arguments), "%s %s %s %s %d %d %d &",
|
|
|
|
|
externnotify, S_OR(context, "\"\""),
|
|
|
|
|
@@ -6418,6 +6496,9 @@ static int msg_create_from_file(struct ast_vm_recording_data *recdata)
|
|
|
|
|
@@ -6422,6 +6500,9 @@ static int msg_create_from_file(struct ast_vm_recording_data *recdata)
|
|
|
|
|
const char *category = NULL; /* pointless for now */
|
|
|
|
|
char msg_id[MSG_ID_LEN];
|
|
|
|
|
|
|
|
|
@ -166,7 +166,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
/* Start by checking to see if the file actually exists... */
|
|
|
|
|
if (!(ast_fileexists(recdata->recording_file, recdata->recording_ext, NULL))) {
|
|
|
|
|
ast_log(LOG_ERROR, "File: %s not found.\n", recdata->recording_file);
|
|
|
|
|
@@ -6674,7 +6755,9 @@ static int msg_create_from_file(struct ast_vm_recording_data *recdata)
|
|
|
|
|
@@ -6678,7 +6759,9 @@ static int msg_create_from_file(struct ast_vm_recording_data *recdata)
|
|
|
|
|
if (send_email) { /* We tried and failed. */
|
|
|
|
|
ast_log(LOG_WARNING, "Failed to allocate dummy channel, email will not be sent\n");
|
|
|
|
|
}
|
|
|
|
@ -177,7 +177,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -8164,6 +8247,74 @@ static void load_vmu_timezone(struct ast_vm_user *vmu)
|
|
|
|
|
@@ -8168,6 +8251,74 @@ static void load_vmu_timezone(struct ast_vm_user *vmu)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -252,7 +252,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Sends email notification that a user has a new voicemail waiting for them.
|
|
|
|
|
* \param chan
|
|
|
|
|
@@ -8187,6 +8338,9 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
|
|
|
|
@@ -8191,6 +8342,9 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
|
|
|
|
struct timeval msg_time = ast_tvnow();
|
|
|
|
|
struct vm_zone *tz = get_vmu_timezone(vmu);
|
|
|
|
|
|
|
|
|
@ -262,7 +262,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
ast_channel_lock(chan);
|
|
|
|
|
if ((category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY"))) {
|
|
|
|
|
category = ast_strdupa(category);
|
|
|
|
|
@@ -8254,7 +8408,9 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
|
|
|
|
@@ -8258,7 +8412,9 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
|
|
|
|
ast_app_inboxcount2(ext_context, &urgentmsgs, &newmsgs, &oldmsgs);
|
|
|
|
|
|
|
|
|
|
queue_mwi_event(ast_channel_uniqueid(chan), ext_context, urgentmsgs, newmsgs, oldmsgs);
|
|
|
|
@ -273,7 +273,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
|
|
|
|
|
#ifdef IMAP_STORAGE
|
|
|
|
|
vm_delete(fn); /* Delete the file, but not the IMAP message */
|
|
|
|
|
@@ -11420,6 +11576,9 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11424,6 +11580,9 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
#ifdef IMAP_STORAGE
|
|
|
|
|
int deleted = 0;
|
|
|
|
|
#endif
|
|
|
|
@ -283,7 +283,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
|
|
|
|
|
/* Add the vm_state to the active list and keep it active */
|
|
|
|
|
vms.curmsg = -1;
|
|
|
|
|
@@ -11610,6 +11769,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11614,6 +11773,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
if (vms.lastmsg == -1) {
|
|
|
|
|
in_urgent = 0;
|
|
|
|
|
cmd = vm_browse_messages(chan, &vms, vmu);
|
|
|
|
@ -295,7 +295,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
res = 0;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
@@ -11685,6 +11849,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11689,6 +11853,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
case '5': /* Play current message */
|
|
|
|
|
ast_test_suite_event_notify("BROWSE", "Message: browsing message %d\r\nVoicemail: %d", vms.curmsg, vms.curmsg);
|
|
|
|
|
cmd = vm_browse_messages(chan, &vms, vmu);
|
|
|
|
@ -307,7 +307,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
break;
|
|
|
|
|
case '2': /* Change folders */
|
|
|
|
|
folder_change = 1;
|
|
|
|
|
@@ -11775,6 +11944,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11779,6 +11948,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
if (vms.curmsg > 0) {
|
|
|
|
|
vms.curmsg--;
|
|
|
|
|
cmd = play_message(chan, vmu, &vms);
|
|
|
|
@ -319,7 +319,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else {
|
|
|
|
|
/* Check if we were listening to new
|
|
|
|
|
messages. If so, go to Urgent messages
|
|
|
|
|
@@ -11797,6 +11971,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11801,6 +11975,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
} else if (ast_test_flag(vmu, VM_MESSAGEWRAP) && vms.lastmsg > 0) {
|
|
|
|
|
vms.curmsg = vms.lastmsg;
|
|
|
|
|
cmd = play_message(chan, vmu, &vms);
|
|
|
|
@ -331,7 +331,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else {
|
|
|
|
|
cmd = ast_play_and_wait(chan, "vm-nomore");
|
|
|
|
|
}
|
|
|
|
|
@@ -11807,6 +11986,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11811,6 +11990,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
if (vms.curmsg < vms.lastmsg) {
|
|
|
|
|
vms.curmsg++;
|
|
|
|
|
cmd = play_message(chan, vmu, &vms);
|
|
|
|
@ -343,7 +343,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else {
|
|
|
|
|
if (in_urgent && vms.newmessages > 0) {
|
|
|
|
|
/* Check if we were listening to urgent
|
|
|
|
|
@@ -11828,6 +12012,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11832,6 +12016,11 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
} else if (ast_test_flag(vmu, VM_MESSAGEWRAP) && vms.lastmsg > 0) {
|
|
|
|
|
vms.curmsg = 0;
|
|
|
|
|
cmd = play_message(chan, vmu, &vms);
|
|
|
|
@ -355,7 +355,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else {
|
|
|
|
|
cmd = ast_play_and_wait(chan, "vm-nomore");
|
|
|
|
|
}
|
|
|
|
|
@@ -11849,6 +12038,9 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11853,6 +12042,9 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
else if (play_folder == 1)
|
|
|
|
|
vms.oldmessages--;
|
|
|
|
|
cmd = ast_play_and_wait(chan, "vm-deleted");
|
|
|
|
@ -365,7 +365,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else {
|
|
|
|
|
if (play_folder == 0) {
|
|
|
|
|
if (in_urgent) {
|
|
|
|
|
@@ -11860,14 +12052,27 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11864,14 +12056,27 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
else if (play_folder == 1)
|
|
|
|
|
vms.oldmessages++;
|
|
|
|
|
cmd = ast_play_and_wait(chan, "vm-undeleted");
|
|
|
|
@ -393,7 +393,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else {
|
|
|
|
|
/* Check if we were listening to urgent
|
|
|
|
|
messages. If so, go to regular new messages
|
|
|
|
|
@@ -11918,6 +12123,29 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11922,6 +12127,29 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
} else if (cmd > 0) {
|
|
|
|
|
box = cmd = cmd - '0';
|
|
|
|
|
cmd = save_to_folder(vmu, &vms, vms.curmsg, cmd, NULL, 0);
|
|
|
|
@ -423,7 +423,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
if (cmd == ERROR_LOCK_PATH) {
|
|
|
|
|
res = cmd;
|
|
|
|
|
goto out;
|
|
|
|
|
@@ -11949,9 +12177,19 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
@@ -11953,9 +12181,19 @@ static int vm_execmain(struct ast_channel *chan, const char *data)
|
|
|
|
|
if (vms.curmsg < vms.lastmsg) {
|
|
|
|
|
vms.curmsg++;
|
|
|
|
|
cmd = play_message(chan, vmu, &vms);
|
|
|
|
@ -443,7 +443,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
} else {
|
|
|
|
|
/* Check if we were listening to urgent
|
|
|
|
|
messages. If so, go to regular new messages
|
|
|
|
|
@@ -12068,7 +12306,7 @@ out:
|
|
|
|
|
@@ -12072,7 +12310,7 @@ out:
|
|
|
|
|
int new = 0, old = 0, urgent = 0;
|
|
|
|
|
snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context);
|
|
|
|
|
/* Urgent flag not passwd to externnotify here */
|
|
|
|
@ -452,7 +452,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
ast_app_inboxcount2(ext_context, &urgent, &new, &old);
|
|
|
|
|
queue_mwi_event(ast_channel_uniqueid(chan), ext_context, urgent, new, old);
|
|
|
|
|
}
|
|
|
|
|
@@ -15989,13 +16227,13 @@ done:
|
|
|
|
|
@@ -15993,13 +16231,13 @@ done:
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -468,7 +468,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
ast_app_inboxcount2(ext_context, &urgent, &new, &old);
|
|
|
|
|
queue_mwi_event(NULL, ext_context, urgent, new, old);
|
|
|
|
|
}
|
|
|
|
|
@@ -16022,6 +16260,9 @@ static int vm_msg_forward(const char *from_mailbox,
|
|
|
|
|
@@ -16026,6 +16264,9 @@ static int vm_msg_forward(const char *from_mailbox,
|
|
|
|
|
int i;
|
|
|
|
|
int *msg_nums;
|
|
|
|
|
|
|
|
|
@ -478,7 +478,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
if (ast_strlen_zero(from_mailbox) || ast_strlen_zero(to_mailbox)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Cannot forward message because either the from or to mailbox was not specified\n");
|
|
|
|
|
return -1;
|
|
|
|
|
@@ -16135,7 +16376,9 @@ vm_forward_cleanup:
|
|
|
|
|
@@ -16139,7 +16380,9 @@ vm_forward_cleanup:
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!res) {
|
|
|
|
@ -489,7 +489,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free_user(vmu);
|
|
|
|
|
@@ -16159,6 +16402,9 @@ static int vm_msg_move(const char *mailbox,
|
|
|
|
|
@@ -16163,6 +16406,9 @@ static int vm_msg_move(const char *mailbox,
|
|
|
|
|
int i;
|
|
|
|
|
int *old_msg_nums;
|
|
|
|
|
|
|
|
|
@ -499,7 +499,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
if (ast_strlen_zero(mailbox)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Cannot move message because no mailbox was specified\n");
|
|
|
|
|
return -1;
|
|
|
|
|
@@ -16240,7 +16486,9 @@ vm_move_cleanup:
|
|
|
|
|
@@ -16244,7 +16490,9 @@ vm_move_cleanup:
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!res) {
|
|
|
|
@ -510,7 +510,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free_user(vmu);
|
|
|
|
|
@@ -16261,6 +16509,9 @@ static int vm_msg_remove(const char *mailbox,
|
|
|
|
|
@@ -16265,6 +16513,9 @@ static int vm_msg_remove(const char *mailbox,
|
|
|
|
|
int i;
|
|
|
|
|
int *msg_nums;
|
|
|
|
|
|
|
|
|
@ -520,7 +520,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
if (ast_strlen_zero(mailbox)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Cannot remove message because no mailbox was specified\n");
|
|
|
|
|
return -1;
|
|
|
|
|
@@ -16338,7 +16589,9 @@ vm_remove_cleanup:
|
|
|
|
|
@@ -16342,7 +16593,9 @@ vm_remove_cleanup:
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!res) {
|
|
|
|
@ -531,7 +531,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free_user(vmu);
|
|
|
|
|
@@ -16363,6 +16616,9 @@ static int vm_msg_play(struct ast_channel *chan,
|
|
|
|
|
@@ -16367,6 +16620,9 @@ static int vm_msg_play(struct ast_channel *chan,
|
|
|
|
|
int duration = 0;
|
|
|
|
|
const char *value;
|
|
|
|
|
|
|
|
|
@ -541,7 +541,7 @@ index c3cdb58..77575c5 100644
|
|
|
|
|
if (ast_strlen_zero(mailbox)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Cannot play message because no mailbox was specified\n");
|
|
|
|
|
return -1;
|
|
|
|
|
@@ -16452,7 +16708,9 @@ play2_msg_cleanup:
|
|
|
|
|
@@ -16456,7 +16712,9 @@ play2_msg_cleanup:
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!res) {
|
|
|
|
|