[svn-commits] jrose: branch 10 r332119 - in /branches/10: ./ channels/chan_sip.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Aug 16 12:45:42 CDT 2011
Author: jrose
Date: Tue Aug 16 12:45:38 2011
New Revision: 332119
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=332119
Log:
Merged revisions 332118 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r332118 | jrose | 2011-08-16 12:38:19 -0500 (Tue, 16 Aug 2011) | 16 lines
ASTERISK-18067 ASTERISK-15479 - White Space affects mailbox value, multiple MWI subs
Before, having multiple subscriptions to mailboxes on a sip peer set via the mailbox
setting in sip.conf would only result in updates being sent on whichever mailbox
triggered the mwi event. Now all of them get counted regardless. Also fixes a bug
involving parsing of the mailbox option in sip.conf so that trailing and leading
spaces before/after commas are trimmed.
(closes issue ASTERISK-18067)
Reported by: aragon
(closes issue ASTERISK-15479)
Reported by: Ben Winslow
Patches: chan_sip.c-mwi_multi_mailbox_fix-1.6.2.13.diff (License #5288) patch uploaded by Ben Winslow
........
Modified:
branches/10/ (props changed)
branches/10/channels/chan_sip.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_sip.c?view=diff&rev=332119&r1=332118&r2=332119
==============================================================================
--- branches/10/channels/chan_sip.c (original)
+++ branches/10/channels/chan_sip.c Tue Aug 16 12:45:38 2011
@@ -1269,7 +1269,7 @@
static void copy_request(struct sip_request *dst, const struct sip_request *src);
static void receive_message(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e);
static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req, char **name, char **number, int set_call_forward);
-static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *event, int cache_only);
+static int sip_send_mwi_to_peer(struct sip_peer *peer, int cache_only);
/* Misc dialog routines */
static int __sip_autodestruct(const void *data);
@@ -14308,7 +14308,7 @@
struct sip_peer *peer = userdata;
ao2_lock(peer);
- sip_send_mwi_to_peer(peer, event, 0);
+ sip_send_mwi_to_peer(peer, 0);
ao2_unlock(peer);
}
@@ -14668,7 +14668,7 @@
sched_yield();
}
if (!res) {
- sip_send_mwi_to_peer(peer, NULL, 0);
+ sip_send_mwi_to_peer(peer, 0);
ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name);
}
if (res < 0) {
@@ -24867,7 +24867,7 @@
transmit_response(p, "200 OK", req);
if (p->relatedpeer) { /* Send first notification */
ao2_lock(p->relatedpeer); /* was WRLOCK */
- sip_send_mwi_to_peer(p->relatedpeer, NULL, 0);
+ sip_send_mwi_to_peer(p->relatedpeer, 0);
ao2_unlock(p->relatedpeer);
}
} else if (p->subscribed != CALL_COMPLETION) {
@@ -25580,7 +25580,7 @@
/*! \brief Send message waiting indication to alert peer that they've got voicemail
* \returns -1 on failure, 0 on success
*/
-static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *event, int cache_only)
+static int sip_send_mwi_to_peer(struct sip_peer *peer, int cache_only)
{
/* Called with peerl lock, but releases it */
struct sip_pvt *p;
@@ -25595,11 +25595,9 @@
return -1;
}
- if (event) {
- newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
- oldmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
- } else if (!get_cached_mwi(peer, &newmsgs, &oldmsgs) && !cache_only) {
- /* Fall back to manually checking the mailbox */
+ /* Attempt to use cached mwi to get message counts. */
+ if (!get_cached_mwi(peer, &newmsgs, &oldmsgs) && !cache_only) {
+ /* Fall back to manually checking the mailbox if not cache_only and get_cached_mwi failed */
struct ast_str *mailbox_str = ast_str_alloca(512);
peer_mailboxes_to_str(&mailbox_str, peer);
/* if there is no mailbox do nothing */
@@ -27110,7 +27108,8 @@
while ((mbox = context = strsep(&next, ","))) {
struct sip_mailbox *mailbox;
int duplicate = 0;
-
+ /* remove leading/trailing whitespace from mailbox string */
+ mbox = ast_strip(mbox);
strsep(&context, "@");
if (ast_strlen_zero(mbox)) {
@@ -27800,7 +27799,7 @@
/* Send MWI from the event cache only. This is so we can send initial
* MWI if app_voicemail got loaded before chan_sip. If it is the other
* way, then we will get events when app_voicemail gets loaded. */
- sip_send_mwi_to_peer(peer, NULL, 1);
+ sip_send_mwi_to_peer(peer, 1);
}
peer->the_mark = 0;
More information about the svn-commits
mailing list