mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 08:31:02 +00:00
Merged revisions 324914 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r324914 | rmudgett | 2011-06-27 10:37:19 -0500 (Mon, 27 Jun 2011) | 21 lines When subscribing MWI to an unsolicited mailbox the first notification is incorrect. A remote peer subscribed to MWI with the unsolicited option and a local phone subscribed to the remote mailbox. The notify message-summary events are sent correctly except for the first one when subscribing, which will always be 0. This means the phone MWI indicator will be wrong until the mailbox read/unread count changes and the event is fired. Looks like this is a regression from ASTERISK-16149. * Fix the logic to check the cache and if allowed then fallback to manually counting mailbox messages. (closes issue ASTERISK-17997) Reported by: rsw686 Patches: jira_asterisk_17997_v1.8.patch (license #5621) uploaded by rmudgett Tested by: rsw686 JIRA SWP-3551 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -25408,13 +25408,14 @@ create_tcptls_session_fail:
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get cached MWI info
|
* \brief Get cached MWI info
|
||||||
* \retval 0 At least one message is waiting
|
* \return TRUE if found MWI in cache
|
||||||
* \retval 1 no messages waiting
|
|
||||||
*/
|
*/
|
||||||
static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
|
static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
|
||||||
{
|
{
|
||||||
struct sip_mailbox *mailbox;
|
struct sip_mailbox *mailbox;
|
||||||
|
int in_cache;
|
||||||
|
|
||||||
|
in_cache = 0;
|
||||||
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
|
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
|
||||||
struct ast_event *event;
|
struct ast_event *event;
|
||||||
event = ast_event_get_cached(AST_EVENT_MWI,
|
event = ast_event_get_cached(AST_EVENT_MWI,
|
||||||
@@ -25426,9 +25427,10 @@ static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
|
|||||||
*new += ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
|
*new += ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
|
||||||
*old += ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
|
*old += ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
|
||||||
ast_event_destroy(event);
|
ast_event_destroy(event);
|
||||||
|
in_cache = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*new || *old) ? 0 : 1;
|
return in_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Send message waiting indication to alert peer that they've got voicemail */
|
/*! \brief Send message waiting indication to alert peer that they've got voicemail */
|
||||||
@@ -25448,12 +25450,11 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *e
|
|||||||
if (event) {
|
if (event) {
|
||||||
newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
|
newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
|
||||||
oldmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
|
oldmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
|
||||||
} else if (!cache_only) { /* Fall back to manually checking the mailbox */
|
} else if (!get_cached_mwi(peer, &newmsgs, &oldmsgs) && !cache_only) {
|
||||||
|
/* Fall back to manually checking the mailbox */
|
||||||
struct ast_str *mailbox_str = ast_str_alloca(512);
|
struct ast_str *mailbox_str = ast_str_alloca(512);
|
||||||
peer_mailboxes_to_str(&mailbox_str, peer);
|
peer_mailboxes_to_str(&mailbox_str, peer);
|
||||||
ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
|
ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
|
||||||
} else {
|
|
||||||
get_cached_mwi(peer, &newmsgs, &oldmsgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peer->mwipvt) {
|
if (peer->mwipvt) {
|
||||||
|
Reference in New Issue
Block a user