[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r344955 - /team/irroot/distrot...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 12 05:38:59 CST 2011


Author: irroot
Date: Sat Nov 12 05:38:55 2011
New Revision: 344955

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=344955
Log:
fixup sip_send_mwi_to_peer

Modified:
    team/irroot/distrotech-customers-1.8/channels/chan_sip.c

Modified: team/irroot/distrotech-customers-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/channels/chan_sip.c?view=diff&rev=344955&r1=344954&r2=344955
==============================================================================
--- team/irroot/distrotech-customers-1.8/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-1.8/channels/chan_sip.c Sat Nov 12 05:38:55 2011
@@ -25302,7 +25302,8 @@
 
 /*! \brief Send message waiting indication to alert peer that they've got voicemail
  *  \note Both peer and associated sip_pvt must be unlocked prior to calling this function
-*/
+ *  \returns -1 on failure, 0 on success
+ */
 static int sip_send_mwi_to_peer(struct sip_peer *peer, int cache_only)
 {
 	/* Called with peerl lock, but releases it */
@@ -25316,13 +25317,13 @@
 
 	if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt) {
 		ao2_unlock(peer);
-		return 0;
+		return -1;
 	}
 
 	/* Do we have an IP address? If not, skip this peer */
 	if (ast_sockaddr_isnull(&peer->addr) && ast_sockaddr_isnull(&peer->defaddr)) {
 		ao2_unlock(peer);
-		return 0;
+		return -1;
 	}
 
 	/* Attempt to use cached mwi to get message counts. */
@@ -25330,6 +25331,11 @@
 		/* 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 */
+		if (ast_strlen_zero(mailbox_str->str)) {
+			ao2_unlock(peer);
+			return -1;
+		}
 		ao2_unlock(peer);
 		ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
 		ao2_lock(peer);




More information about the asterisk-commits mailing list