[asterisk-commits] russell: branch group/sip-object-matching r178068 - /team/group/sip-object-ma...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 23 12:54:14 CST 2009


Author: russell
Date: Mon Feb 23 12:54:14 2009
New Revision: 178068

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=178068
Log:
Fix handling of which_objects in find_by_name() and get rid of onlymatchonip

Modified:
    team/group/sip-object-matching/channels/chan_sip.c

Modified: team/group/sip-object-matching/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/sip-object-matching/channels/chan_sip.c?view=diff&rev=178068&r1=178067&r2=178068
==============================================================================
--- team/group/sip-object-matching/channels/chan_sip.c (original)
+++ team/group/sip-object-matching/channels/chan_sip.c Mon Feb 23 12:54:14 2009
@@ -1899,7 +1899,6 @@
 	
 	/*XXX Seems like we suddenly have two flags with the same content. Why? To be continued... */
 	enum sip_peer_type type; /*!< Distinguish between "user" and "peer" types. This is used solely for CLI and manager commands */
-	char onlymatchonip;		/*!< Only match on IP for incoming calls (old type=peer) */
 };
 
 
@@ -4519,10 +4518,19 @@
 		return 0;
 	}
 
-	/* If we're only looking for name matches, we should avoid type=peer devices,
-	   since these should not match on any name-based search */
-	if (!(*which_objects & FINDUSERS) && search->onlymatchonip) {
-		return 0;
+	switch (*which_objects) {
+	case FINDUSERS:
+		if (!(match->type & SIP_TYPE_USER)) {
+			return 0;
+		}
+		break;
+	case FINDPEERS:
+		if (!(match->type & SIP_TYPE_PEER)) {
+			return 0;
+		}
+		break;
+	case FINDALLDEVICES:
+		break;
 	}
 
 	return CMP_MATCH | CMP_STOP;
@@ -22527,8 +22535,6 @@
 			ast_atomic_fetchadd_int(&speerobjs, 1);
 	}
 
-	peer->onlymatchonip = ispeer;		/* If type=peer, don't match on caller ID for incoming calls */
-
 	/* Note that our peer HAS had its reference count increased */
 	if (firstpass) {
 		peer->lastmsgssent = -1;
@@ -22591,13 +22597,10 @@
 			}
 		} else if (!strcasecmp(v->name, "type")) {
 			if (!strcasecmp(v->value, "peer")) {
-				peer->onlymatchonip = TRUE;		/* For realtime support, add type=peer in the table */
 				peer->type = SIP_TYPE_PEER;
 			} else if (!strcasecmp(v->value, "user")) {
-				peer->onlymatchonip = FALSE;
 				peer->type = SIP_TYPE_USER;
 			} else if (!strcasecmp(v->value, "friend")) {
-				peer->onlymatchonip = FALSE;
 				peer->type = SIP_TYPE_USER | SIP_TYPE_PEER;
 			}
 		} else if (!strcasecmp(v->name, "remotesecret")) {




More information about the asterisk-commits mailing list