[asterisk-commits] branch oej/test-this-branch r15427 - /team/oej/test-this-branch/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 27 17:44:09 MST 2006


Author: oej
Date: Mon Mar 27 18:44:08 2006
New Revision: 15427

URL: http://svn.digium.com/view/asterisk?rev=15427&view=rev
Log:
Fix matching on incoming calls from service providers we register with,
without checking the list of peers

Modified:
    team/oej/test-this-branch/channels/chan_sip.c

Modified: team/oej/test-this-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_sip.c?rev=15427&r1=15426&r2=15427&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Mon Mar 27 18:44:08 2006
@@ -7942,16 +7942,24 @@
 	}
 	if (ast_strlen_zero(of))
 		return 0;
-
-	if (!authpeer)	/* If it's a mailbox SUBSCRIBE, don't check users */
+	
+	if (p->registry && p->registry->peer) {	/* Do we know this peer already? */
+		device = p->registry->peer;	/* Service provider we registered with */
+		ASTOBJ_REF(device);
+		devicematch = SIP_PEER;		/* We matched on a peer */
+	}
+
+	if (!authpeer && !device) {	/* If it's a mailbox SUBSCRIBE, don't check users */
 		device = find_user(of, 1);
+		if (device)
+			devicematch = SIP_USER;			/* We matched on a user */
+	}
+
 	if (device && !ast_apply_ha(device->ha, sin)) {
-		ast_verbose("Found user '%s', but fails host access\n", device->name);
+		ast_verbose("Found device '%s', but fails host access\n", device->name);
 		ASTOBJ_UNREF(device,sip_destroy_device);
 		device = NULL;
 	}
-	if (device)
-		devicematch = SIP_USER;			/* We matched on a user */
 
 	if (!device) {
 		/* Secondly, match on peer name */
@@ -7969,6 +7977,7 @@
 			device = find_peer(NULL, &p->recv, 1);
 		}
 		if (device && !ast_apply_ha(device->ha, sin)) {
+			ast_verbose("Found device '%s', but fails host access\n", device->name);
 			ASTOBJ_UNREF(device,sip_destroy_device);
 			device = NULL;
 		}



More information about the asterisk-commits mailing list