[asterisk-commits] mmichelson: trunk r265449 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 24 16:44:34 CDT 2010


Author: mmichelson
Date: Mon May 24 16:44:30 2010
New Revision: 265449

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=265449
Log:
Allow type=user SIP endpoints to be loaded properly from realtime.

(closes issue #16021)
Reported by: Guggemand
Patches:
      realtime-type-fix.patch uploaded by Guggemand (license 897)
	  (altered by me slightly to avoid ref leaks)
Tested by: Guggemand



Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=265449&r1=265448&r2=265449
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon May 24 16:44:30 2010
@@ -4379,17 +4379,7 @@
 	}
 
 	for (tmp = var; tmp; tmp = tmp->next) {
-		/* If this is type=user, then skip this object. */
-		if (!strcasecmp(tmp->name, "type") &&
-		    !strcasecmp(tmp->value, "user")) {
-			if(peerlist)
-				ast_config_destroy(peerlist);
-			else {
-				ast_variables_destroy(var);
-				ast_variables_destroy(varregs);
-			}
-			return NULL;
-		} else if (!newpeername && !strcasecmp(tmp->name, "name")) {
+		if (!newpeername && !strcasecmp(tmp->name, "name")) {
 			newpeername = tmp->value;
 		}
 	}
@@ -4510,6 +4500,24 @@
 
 	if (!p && (realtime || devstate_only)) {
 		p = realtime_peer(peer, sin, devstate_only);
+		if (p) {
+			switch (which_objects) {
+			case FINDUSERS:
+				if (!(p->type & SIP_TYPE_USER)) {
+					unref_peer(p, "Wrong type of realtime SIP endpoint");
+					return NULL;
+				}
+				break;
+			case FINDPEERS:
+				if (!(p->type & SIP_TYPE_PEER)) {
+					unref_peer(p, "Wrong type of realtime SIP endpoint");
+					return NULL;
+				}
+				break;
+			case FINDALLDEVICES:
+				break;
+			}
+		}
 	}
 
 	return p;




More information about the asterisk-commits mailing list