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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 27 14:25:53 CST 2009


Author: russell
Date: Fri Feb 27 14:25:50 2009
New Revision: 179121

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=179121
Log:
Fix the case that a type=user and type=peer are defined in separate entries.

Reset the type on the first pass after a reload, and just add the user/peer
setting instead of setting that as the type.

(issue #14505)
Reported by: lmadsen
Tested by: russell

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=179121&r1=179120&r2=179121
==============================================================================
--- team/group/sip-object-matching/channels/chan_sip.c (original)
+++ team/group/sip-object-matching/channels/chan_sip.c Fri Feb 27 14:25:50 2009
@@ -22501,7 +22501,7 @@
 	const char *srvlookup = NULL;
 	static int deprecation_warning = 1;
 	struct ast_str *fullcontact = ast_str_alloca(512);
-	
+
 	if (!realtime || ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
 		/* Note we do NOT use find_peer here, to avoid realtime recursion */
 		/* We also use a case-sensitive comparison (unlike find_peer) so
@@ -22511,13 +22511,13 @@
 		ast_copy_string(tmp_peer.name, name, sizeof(tmp_peer.name));
 		peer = ao2_t_find(peers, &tmp_peer, OBJ_POINTER | OBJ_UNLINK, "find and unlink peer from peers table");
 	}
-	
+
 	if (peer) {
 		/* Already in the list, remove it and it will be added back (or FREE'd)  */
 		found++;
 		if (!(peer->the_mark))
 			firstpass = 0;
- 	} else {
+	} else {
 		if (!(peer = ao2_t_alloc(sizeof(*peer), sip_destroy_peer_fn, "allocate a peer struct")))
 			return NULL;
 
@@ -22539,9 +22539,10 @@
 		oldha = peer->ha;
 		peer->ha = NULL;
 		set_peer_defaults(peer);	/* Set peer defaults */
+		peer->type = 0;
 	}
 	if (!found && name)
-			ast_copy_string(peer->name, name, sizeof(peer->name));
+		ast_copy_string(peer->name, name, sizeof(peer->name));
 
 	/* If we have channel variables, remove them (reload) */
 	if (peer->chanvars) {
@@ -22595,9 +22596,9 @@
 			}
 		} else if (!strcasecmp(v->name, "type")) {
 			if (!strcasecmp(v->value, "peer")) {
-				peer->type = SIP_TYPE_PEER;
+				peer->type |= SIP_TYPE_PEER;
 			} else if (!strcasecmp(v->value, "user")) {
-				peer->type = SIP_TYPE_USER;
+				peer->type |= SIP_TYPE_USER;
 			} else if (!strcasecmp(v->value, "friend")) {
 				peer->type = SIP_TYPE_USER | SIP_TYPE_PEER;
 			}




More information about the asterisk-commits mailing list