|
|
@ -227,8 +227,6 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
|
|
|
|
#define ERROR_MAILBOX_FULL -200
|
|
|
|
#define ERROR_MAILBOX_FULL -200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AST_THREADSTORAGE(voicemail_extension_list);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
enum {
|
|
|
|
NEW_FOLDER,
|
|
|
|
NEW_FOLDER,
|
|
|
|
OLD_FOLDER,
|
|
|
|
OLD_FOLDER,
|
|
|
@ -4255,14 +4253,14 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct leave_vm_options {
|
|
|
|
struct leave_vm_options {
|
|
|
|
unsigned int flags;
|
|
|
|
unsigned int flags;
|
|
|
|
signed char record_gain;
|
|
|
|
signed char record_gain;
|
|
|
|
char *exitcontext;
|
|
|
|
char *exitcontext;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
|
|
|
|
static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_options *options)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef IMAP_STORAGE
|
|
|
|
#ifdef IMAP_STORAGE
|
|
|
|
int newmsgs, oldmsgs;
|
|
|
|
int newmsgs, oldmsgs;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -4292,7 +4290,7 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
char *context;
|
|
|
|
char *context;
|
|
|
|
char ecodes[17] = "#";
|
|
|
|
char ecodes[17] = "#";
|
|
|
|
char *tmpptr;
|
|
|
|
char *tmpptr;
|
|
|
|
struct ast_str *tmp = ast_str_thread_get(&voicemail_extension_list, 16);
|
|
|
|
struct ast_str *tmp = ast_str_create(16);
|
|
|
|
struct ast_vm_user *vmu;
|
|
|
|
struct ast_vm_user *vmu;
|
|
|
|
struct ast_vm_user svm;
|
|
|
|
struct ast_vm_user svm;
|
|
|
|
const char *category = NULL, *code, *alldtmf = "0123456789ABCD*#";
|
|
|
|
const char *category = NULL, *code, *alldtmf = "0123456789ABCD*#";
|
|
|
@ -4306,8 +4304,9 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
tmpptr = strchr(ext, '&');
|
|
|
|
tmpptr = strchr(ext, '&');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (tmpptr)
|
|
|
|
if (tmpptr) {
|
|
|
|
*tmpptr++ = '\0';
|
|
|
|
*tmpptr++ = '\0';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY");
|
|
|
|
category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY");
|
|
|
|
|
|
|
|
|
|
|
@ -4315,13 +4314,15 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
if (!(vmu = find_user(&svm, context, ext))) {
|
|
|
|
if (!(vmu = find_user(&svm, context, ext))) {
|
|
|
|
ast_log(LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext);
|
|
|
|
ast_log(LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext);
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Setup pre-file if appropriate */
|
|
|
|
/* Setup pre-file if appropriate */
|
|
|
|
if (strcmp(vmu->context, "default"))
|
|
|
|
if (strcmp(vmu->context, "default")) {
|
|
|
|
snprintf(ext_context, sizeof(ext_context), "%s@%s", ext, vmu->context);
|
|
|
|
snprintf(ext_context, sizeof(ext_context), "%s@%s", ext, vmu->context);
|
|
|
|
else
|
|
|
|
} else {
|
|
|
|
ast_copy_string(ext_context, vmu->mailbox, sizeof(ext_context));
|
|
|
|
ast_copy_string(ext_context, vmu->mailbox, sizeof(ext_context));
|
|
|
|
|
|
|
|
}
|
|
|
|
if (ast_test_flag(options, OPT_BUSY_GREETING)) {
|
|
|
|
if (ast_test_flag(options, OPT_BUSY_GREETING)) {
|
|
|
|
snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, ext);
|
|
|
|
snprintf(prefile, sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, ext);
|
|
|
|
} else if (ast_test_flag(options, OPT_UNAVAIL_GREETING)) {
|
|
|
|
} else if (ast_test_flag(options, OPT_UNAVAIL_GREETING)) {
|
|
|
@ -4330,11 +4331,13 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, ext);
|
|
|
|
snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, ext);
|
|
|
|
if ((res = create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, ext, "tmp"))) {
|
|
|
|
if ((res = create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, ext, "tmp"))) {
|
|
|
|
ast_log(LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
|
|
|
|
ast_log(LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RETRIEVE(tempfile, -1, vmu->mailbox, vmu->context);
|
|
|
|
RETRIEVE(tempfile, -1, vmu->mailbox, vmu->context);
|
|
|
|
if (ast_fileexists(tempfile, NULL, NULL) > 0)
|
|
|
|
if (ast_fileexists(tempfile, NULL, NULL) > 0) {
|
|
|
|
ast_copy_string(prefile, tempfile, sizeof(prefile));
|
|
|
|
ast_copy_string(prefile, tempfile, sizeof(prefile));
|
|
|
|
|
|
|
|
}
|
|
|
|
DISPOSE(tempfile, -1);
|
|
|
|
DISPOSE(tempfile, -1);
|
|
|
|
/* It's easier just to try to make it than to check for its existence */
|
|
|
|
/* It's easier just to try to make it than to check for its existence */
|
|
|
|
create_dirpath(dir, sizeof(dir), vmu->context, ext, "INBOX");
|
|
|
|
create_dirpath(dir, sizeof(dir), vmu->context, ext, "INBOX");
|
|
|
@ -4356,11 +4359,12 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!ast_strlen_zero(vmu->exit)) {
|
|
|
|
if (!ast_strlen_zero(vmu->exit)) {
|
|
|
|
if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num))
|
|
|
|
if (ast_exists_extension(chan, vmu->exit, "a", 1, chan->cid.cid_num)) {
|
|
|
|
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
} else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num))
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (ast_exists_extension(chan, chan->context, "a", 1, chan->cid.cid_num)) {
|
|
|
|
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) {
|
|
|
|
} else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->cid.cid_num)) {
|
|
|
|
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
ausemacro = 1;
|
|
|
|
ausemacro = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4369,10 +4373,11 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
for (code = alldtmf; *code; code++) {
|
|
|
|
for (code = alldtmf; *code; code++) {
|
|
|
|
char e[2] = "";
|
|
|
|
char e[2] = "";
|
|
|
|
e[0] = *code;
|
|
|
|
e[0] = *code;
|
|
|
|
if (strchr(ecodes, e[0]) == NULL && ast_canmatch_extension(chan, chan->context, e, 1, chan->cid.cid_num))
|
|
|
|
if (strchr(ecodes, e[0]) == NULL && ast_canmatch_extension(chan, chan->context, e, 1, chan->cid.cid_num)) {
|
|
|
|
strncat(ecodes, e, sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
strncat(ecodes, e, sizeof(ecodes) - strlen(ecodes) - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Play the beginning intro if desired */
|
|
|
|
/* Play the beginning intro if desired */
|
|
|
|
if (!ast_strlen_zero(prefile)) {
|
|
|
|
if (!ast_strlen_zero(prefile)) {
|
|
|
@ -4386,6 +4391,7 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
ast_debug(1, "Hang up during prefile playback\n");
|
|
|
|
ast_debug(1, "Hang up during prefile playback\n");
|
|
|
|
free_user(vmu);
|
|
|
|
free_user(vmu);
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4401,10 +4407,11 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
res = 0;
|
|
|
|
res = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (res > 0)
|
|
|
|
if (res > 0) {
|
|
|
|
ast_stopstream(chan);
|
|
|
|
ast_stopstream(chan);
|
|
|
|
|
|
|
|
}
|
|
|
|
/* Check for a '*' here in case the caller wants to escape from voicemail to something
|
|
|
|
/* Check for a '*' here in case the caller wants to escape from voicemail to something
|
|
|
|
other than the operator -- an automated attendant or mailbox login for example */
|
|
|
|
* other than the operator -- an automated attendant or mailbox login for example */
|
|
|
|
if (res == '*') {
|
|
|
|
if (res == '*') {
|
|
|
|
chan->exten[0] = 'a';
|
|
|
|
chan->exten[0] = 'a';
|
|
|
|
chan->exten[1] = '\0';
|
|
|
|
chan->exten[1] = '\0';
|
|
|
@ -4416,12 +4423,13 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
chan->priority = 0;
|
|
|
|
chan->priority = 0;
|
|
|
|
free_user(vmu);
|
|
|
|
free_user(vmu);
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Check for a '0' here */
|
|
|
|
/* Check for a '0' here */
|
|
|
|
if (ast_test_flag(vmu, VM_OPERATOR) && res == '0') {
|
|
|
|
if (ast_test_flag(vmu, VM_OPERATOR) && res == '0') {
|
|
|
|
transfer:
|
|
|
|
transfer:
|
|
|
|
if (ouseexten || ousemacro) {
|
|
|
|
if (ouseexten || ousemacro) {
|
|
|
|
chan->exten[0] = 'o';
|
|
|
|
chan->exten[0] = 'o';
|
|
|
|
chan->exten[1] = '\0';
|
|
|
|
chan->exten[1] = '\0';
|
|
|
@ -4435,13 +4443,15 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
free_user(vmu);
|
|
|
|
free_user(vmu);
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Allow all other digits to exit Voicemail and return to the dialplan */
|
|
|
|
/* Allow all other digits to exit Voicemail and return to the dialplan */
|
|
|
|
if (ast_test_flag(options, OPT_DTMFEXIT) && res > 0) {
|
|
|
|
if (ast_test_flag(options, OPT_DTMFEXIT) && res > 0) {
|
|
|
|
if (!ast_strlen_zero(options->exitcontext))
|
|
|
|
if (!ast_strlen_zero(options->exitcontext)) {
|
|
|
|
ast_copy_string(chan->context, options->exitcontext, sizeof(chan->context));
|
|
|
|
ast_copy_string(chan->context, options->exitcontext, sizeof(chan->context));
|
|
|
|
|
|
|
|
}
|
|
|
|
free_user(vmu);
|
|
|
|
free_user(vmu);
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
@ -4450,6 +4460,7 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
if (res < 0) {
|
|
|
|
if (res < 0) {
|
|
|
|
free_user(vmu);
|
|
|
|
free_user(vmu);
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* The meat of recording the message... All the announcements and beeps have been played*/
|
|
|
|
/* The meat of recording the message... All the announcements and beeps have been played*/
|
|
|
@ -4463,6 +4474,7 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
res = inboxcount(ext_context, &newmsgs, &oldmsgs);
|
|
|
|
res = inboxcount(ext_context, &newmsgs, &oldmsgs);
|
|
|
|
if (res < 0) {
|
|
|
|
if (res < 0) {
|
|
|
|
ast_log(LOG_NOTICE, "Can not leave voicemail, unable to count messages\n");
|
|
|
|
ast_log(LOG_NOTICE, "Can not leave voicemail, unable to count messages\n");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!(vms = get_vm_state_by_mailbox(ext, 0))) {
|
|
|
|
if (!(vms = get_vm_state_by_mailbox(ext, 0))) {
|
|
|
@ -4472,6 +4484,7 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (!(vms = create_vm_state_from_user(vmu))) {
|
|
|
|
if (!(vms = create_vm_state_from_user(vmu))) {
|
|
|
|
ast_log(LOG_ERROR, "Couldn't allocate necessary space\n");
|
|
|
|
ast_log(LOG_ERROR, "Couldn't allocate necessary space\n");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4489,6 +4502,7 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
if (vms->quota_limit && vms->quota_usage >= vms->quota_limit) {
|
|
|
|
if (vms->quota_limit && vms->quota_usage >= vms->quota_limit) {
|
|
|
|
ast_debug(1, "*** QUOTA EXCEEDED!! %u >= %u\n", vms->quota_usage, vms->quota_limit);
|
|
|
|
ast_debug(1, "*** QUOTA EXCEEDED!! %u >= %u\n", vms->quota_usage, vms->quota_limit);
|
|
|
|
ast_play_and_wait(chan, "vm-mailboxfull");
|
|
|
|
ast_play_and_wait(chan, "vm-mailboxfull");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4496,13 +4510,15 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
if (msgnum >= vmu->maxmsg) {
|
|
|
|
if (msgnum >= vmu->maxmsg) {
|
|
|
|
ast_log(LOG_WARNING, "Unable to leave message since we will exceed the maximum number of messages allowed (%u > %u)\n", msgnum, vmu->maxmsg);
|
|
|
|
ast_log(LOG_WARNING, "Unable to leave message since we will exceed the maximum number of messages allowed (%u > %u)\n", msgnum, vmu->maxmsg);
|
|
|
|
ast_play_and_wait(chan, "vm-mailboxfull");
|
|
|
|
ast_play_and_wait(chan, "vm-mailboxfull");
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
if (count_messages(vmu, dir) >= vmu->maxmsg) {
|
|
|
|
if (count_messages(vmu, dir) >= vmu->maxmsg) {
|
|
|
|
res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
|
|
|
|
res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
|
|
|
|
if (!res)
|
|
|
|
if (!res) {
|
|
|
|
res = ast_waitstream(chan, "");
|
|
|
|
res = ast_waitstream(chan, "");
|
|
|
|
|
|
|
|
}
|
|
|
|
ast_log(LOG_WARNING, "No more messages possible\n");
|
|
|
|
ast_log(LOG_WARNING, "No more messages possible\n");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
goto leave_vm_out;
|
|
|
|
goto leave_vm_out;
|
|
|
@ -4514,8 +4530,9 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
chmod(tmptxtfile, VOICEMAIL_FILE_MODE & ~my_umask);
|
|
|
|
chmod(tmptxtfile, VOICEMAIL_FILE_MODE & ~my_umask);
|
|
|
|
if (txtdes < 0) {
|
|
|
|
if (txtdes < 0) {
|
|
|
|
res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
|
|
|
|
res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
|
|
|
|
if (!res)
|
|
|
|
if (!res) {
|
|
|
|
res = ast_waitstream(chan, "");
|
|
|
|
res = ast_waitstream(chan, "");
|
|
|
|
|
|
|
|
}
|
|
|
|
ast_log(LOG_ERROR, "Unable to create message file: %s\n", strerror(errno));
|
|
|
|
ast_log(LOG_ERROR, "Unable to create message file: %s\n", strerror(errno));
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
goto leave_vm_out;
|
|
|
|
goto leave_vm_out;
|
|
|
@ -4563,8 +4580,9 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
ast_callerid_merge(callerid, sizeof(callerid), S_OR(chan->cid.cid_name, NULL), S_OR(chan->cid.cid_num, NULL), "Unknown"),
|
|
|
|
ast_callerid_merge(callerid, sizeof(callerid), S_OR(chan->cid.cid_name, NULL), S_OR(chan->cid.cid_num, NULL), "Unknown"),
|
|
|
|
date, (long)time(NULL),
|
|
|
|
date, (long)time(NULL),
|
|
|
|
category ? category : "");
|
|
|
|
category ? category : "");
|
|
|
|
} else
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_WARNING, "Error opening text file for output\n");
|
|
|
|
ast_log(LOG_WARNING, "Error opening text file for output\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
res = play_record_review(chan, NULL, tmptxtfile, vmu->maxsecs, fmt, 1, vmu, &duration, NULL, options->record_gain, vms);
|
|
|
|
res = play_record_review(chan, NULL, tmptxtfile, vmu->maxsecs, fmt, 1, vmu, &duration, NULL, options->record_gain, vms);
|
|
|
|
|
|
|
|
|
|
|
|
if (txt) {
|
|
|
|
if (txt) {
|
|
|
@ -4612,8 +4630,9 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
|
|
|
|
|
|
|
|
/* Properly set permissions on voicemail text descriptor file.
|
|
|
|
/* Properly set permissions on voicemail text descriptor file.
|
|
|
|
Unfortunately mkstemp() makes this file 0600 on most unix systems. */
|
|
|
|
Unfortunately mkstemp() makes this file 0600 on most unix systems. */
|
|
|
|
if (chmod(txtfile, VOICEMAIL_FILE_MODE) < 0)
|
|
|
|
if (chmod(txtfile, VOICEMAIL_FILE_MODE) < 0) {
|
|
|
|
ast_log(LOG_ERROR, "Couldn't set permissions on voicemail text file %s: %s", txtfile, strerror(errno));
|
|
|
|
ast_log(LOG_ERROR, "Couldn't set permissions on voicemail text file %s: %s", txtfile, strerror(errno));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ast_unlock_path(dir);
|
|
|
|
ast_unlock_path(dir);
|
|
|
|
if (ast_check_realtime("voicemail_data")) {
|
|
|
|
if (ast_check_realtime("voicemail_data")) {
|
|
|
@ -4658,21 +4677,25 @@ static int has_voicemail(const char *mailbox, const char *folder)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (res == '0') {
|
|
|
|
if (res == '0') {
|
|
|
|
goto transfer;
|
|
|
|
goto transfer;
|
|
|
|
} else if (res > 0)
|
|
|
|
} else if (res > 0) {
|
|
|
|
res = 0;
|
|
|
|
res = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (duration < vmminsecs)
|
|
|
|
if (duration < vmminsecs) {
|
|
|
|
/* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
|
|
|
|
/* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
|
|
|
else
|
|
|
|
} else {
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
|
|
|
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
|
|
|
|
} else
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_WARNING, "No format for saving voicemail?\n");
|
|
|
|
ast_log(LOG_WARNING, "No format for saving voicemail?\n");
|
|
|
|
leave_vm_out:
|
|
|
|
}
|
|
|
|
|
|
|
|
leave_vm_out:
|
|
|
|
free_user(vmu);
|
|
|
|
free_user(vmu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ast_free(tmp);
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef IMAP_STORAGE
|
|
|
|
#ifndef IMAP_STORAGE
|
|
|
|
static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
|
|
|
|
static int resequence_mailbox(struct ast_vm_user *vmu, char *dir)
|
|
|
|