[asterisk-commits] marquis: trunk r296353 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 26 12:23:08 CST 2010


Author: marquis
Date: Fri Nov 26 12:23:02 2010
New Revision: 296353

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=296353
Log:
Merged revisions 296352 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r296352 | marquis | 2010-11-26 13:19:02 -0500 (Fri, 26 Nov 2010) | 12 lines
  
  Fix reloading of peer when a user is requested.
  
  Prevent peer reloading from causing multiple MWI subscriptions to be created when using realtime.  This had the effect of sending one NOTIFY for every time a sip peer made a call, in one case eventually overwhelming  the phone and causing it to reboot.
  
  (closes issue #18342)
  Reported by: nivek
  Patches:
        issue0018342p1.patch uploaded by nivek (license 636)
  Tested by: nivek
  
  Review: https://reviewboard.asterisk.org/r/1029/
........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=296353&r1=296352&r2=296353
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Nov 26 12:23:02 2010
@@ -1431,7 +1431,7 @@
 static void update_peer(struct sip_peer *p, int expire);
 static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config);
 static const char *get_name_from_variable(struct ast_variable *var, const char *newpeername);
-static struct sip_peer *realtime_peer(const char *peername, struct ast_sockaddr *sin, int devstate_only);
+static struct sip_peer *realtime_peer(const char *peername, struct ast_sockaddr *sin, int devstate_only, int which_objects);
 static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 
 /*--- Internal UA client handling (outbound registrations) */
@@ -4429,7 +4429,7 @@
  * This returns a pointer to a peer and because we use build_peer, we can rest
  * assured that the refcount is bumped.
 */
-static struct sip_peer *realtime_peer(const char *newpeername, struct ast_sockaddr *addr, int devstate_only)
+static struct sip_peer *realtime_peer(const char *newpeername, struct ast_sockaddr *addr, int devstate_only, int which_objects)
 {
 	struct sip_peer *peer;
 	struct ast_variable *var = NULL;
@@ -4553,11 +4553,19 @@
 	}
 
 	for (tmp = var; tmp; tmp = tmp->next) {
-		if (!newpeername && !strcasecmp(tmp->name, "name")) {
+		if (!strcasecmp(tmp->name, "type") && (!strcasecmp(tmp->value, "peer") && which_objects == FINDUSERS)) {
+			if (peerlist) {
+				ast_config_destroy(peerlist);
+			} else {
+				ast_variables_destroy(var);
+				ast_variables_destroy(varregs);
+			}
+			return NULL;
+		} else if (!newpeername && !strcasecmp(tmp->name, "name")) {
 			newpeername = tmp->value;
 		}
 	}
-	
+
 	if (!newpeername) {	/* Did not find peer in realtime */
 		ast_log(LOG_WARNING, "Cannot Determine peer name ip=%s\n", ipaddr);
 		if(peerlist)
@@ -4672,7 +4680,7 @@
 	}
 
 	if (!p && (realtime || devstate_only)) {
-		p = realtime_peer(peer, addr, devstate_only);
+		p = realtime_peer(peer, addr, devstate_only, which_objects);
 		if (p) {
 			switch (which_objects) {
 			case FINDUSERS:




More information about the asterisk-commits mailing list