diff options
-rwxr-xr-x | app.c | 8 | ||||
-rwxr-xr-x | apps/app_voicemail.c | 6 | ||||
-rwxr-xr-x | channels/chan_iax2.c | 2 | ||||
-rwxr-xr-x | channels/chan_mgcp.c | 2 | ||||
-rwxr-xr-x | channels/chan_skinny.c | 2 | ||||
-rwxr-xr-x | channels/chan_zap.c | 4 | ||||
-rwxr-xr-x | include/asterisk/app.h | 2 | ||||
-rwxr-xr-x | manager.c | 2 |
8 files changed, 15 insertions, 13 deletions
@@ -150,7 +150,7 @@ int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prom return 0; } -int ast_app_has_voicemail(const char *mailbox) +int ast_app_has_voicemail(const char *mailbox, const char *folder) { DIR *dir; struct dirent *de; @@ -159,6 +159,8 @@ int ast_app_has_voicemail(const char *mailbox) char *mb, *cur; char *context; int ret; + if (!folder) + folder = "INBOX"; /* If no mailbox, return immediately */ if (ast_strlen_zero(mailbox)) return 0; @@ -168,7 +170,7 @@ int ast_app_has_voicemail(const char *mailbox) ret = 0; while((cur = strsep(&mb, ","))) { if (!ast_strlen_zero(cur)) { - if (ast_app_has_voicemail(cur)) + if (ast_app_has_voicemail(cur, folder)) return 1; } } @@ -181,7 +183,7 @@ int ast_app_has_voicemail(const char *mailbox) context++; } else context = "default"; - snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, tmp); + snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/%s", (char *)ast_config_AST_SPOOL_DIR, context, tmp, folder); dir = opendir(fn); if (!dir) return 0; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 791978fac..6ea59bf7c 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2217,7 +2217,7 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, } /* 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, NULL)); run_externnotify(chan->context, ext_context); return 0; } @@ -2343,7 +2343,7 @@ 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", 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, NULL)); run_externnotify(chan->context, ext_context); saved_messages++; @@ -3730,7 +3730,7 @@ out: close_mailbox(&vms, vmu); if (valid) { 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, NULL)); run_externnotify(chan->context, ext_context); } if (vmu) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index b828719b8..c495f53d9 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -4475,7 +4475,7 @@ static int update_registry(char *name, struct sockaddr_in *sin, int callno, char old = 255; msgcount = (old << 8) | new; } else { - msgcount = ast_app_has_voicemail(p->mailbox); + msgcount = ast_app_has_voicemail(p->mailbox, NULL); if (msgcount) msgcount = 65535; } diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 309283b77..e1e1e76c1 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -460,7 +460,7 @@ static int mgcp_reload(int fd, int argc, char *argv[]); static int has_voicemail(struct mgcp_endpoint *p) { - return ast_app_has_voicemail(p->mailbox); + return ast_app_has_voicemail(p->mailbox, NULL); } static int unalloc_sub(struct mgcp_subchannel *sub) diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 727d427e0..3a37ea213 100755 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -1197,7 +1197,7 @@ static struct skinny_device *build_device(char *cat, struct ast_variable *v) static int has_voicemail(struct skinny_line *l) { - return ast_app_has_voicemail(l->mailbox); + return ast_app_has_voicemail(l->mailbox, NULL); } static int skinny_register(skinny_req *req, struct skinnysession *s) diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 8ef934a93..a42edc7dd 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -1404,7 +1404,7 @@ int send_cwcidspill(struct zt_pvt *p) static int has_voicemail(struct zt_pvt *p) { - return ast_app_has_voicemail(p->mailbox); + return ast_app_has_voicemail(p->mailbox, NULL); } static int send_callerid(struct zt_pvt *p) @@ -5831,7 +5831,7 @@ static void *do_monitor(void *data) #if 0 printf("Channel %d has mailbox %s\n", last->channel, last->mailbox); #endif - res = ast_app_has_voicemail(last->mailbox); + res = ast_app_has_voicemail(last->mailbox, NULL); if (last->msgstate != res) { int x; ast_log(LOG_DEBUG, "Message status for %s changed from %d to %d on %d\n", last->mailbox, last->msgstate, res, last->channel); diff --git a/include/asterisk/app.h b/include/asterisk/app.h index 6b11c650b..dc77489f2 100755 --- a/include/asterisk/app.h +++ b/include/asterisk/app.h @@ -40,7 +40,7 @@ extern int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, in int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prompt, int silence, int maxsec); //! Determine if a given mailbox has any voicemail -extern int ast_app_has_voicemail(const char *mailbox); +extern int ast_app_has_voicemail(const char *mailbox, const char *folder); //! Determine number of new/old messages in a mailbox extern int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs); @@ -981,7 +981,7 @@ static int action_mailboxstatus(struct mansession *s, struct message *m) } if (id && !ast_strlen_zero(id)) snprintf(idText,256,"ActionID: %s\r\n",id); - ret = ast_app_has_voicemail(mailbox); + ret = ast_app_has_voicemail(mailbox, NULL); ast_mutex_lock(&s->lock); ast_cli(s->fd, "Response: Success\r\n" "%s" |