[asterisk-commits] russell: branch russell/ast_channel_ao2 r174209 - /team/russell/ast_channel_a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Feb 7 10:55:12 CST 2009


Author: russell
Date: Sat Feb  7 10:55:12 2009
New Revision: 174209

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174209
Log:
Convert chan_sip

Modified:
    team/russell/ast_channel_ao2/channels/chan_sip.c

Modified: team/russell/ast_channel_ao2/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/channels/chan_sip.c?view=diff&rev=174209&r1=174208&r2=174209
==============================================================================
--- team/russell/ast_channel_ao2/channels/chan_sip.c (original)
+++ team/russell/ast_channel_ao2/channels/chan_sip.c Sat Feb  7 10:55:12 2009
@@ -10109,12 +10109,21 @@
 	return 0;
 }
 
-static int find_calling_channel(struct ast_channel *c, void *data) {
+static int find_calling_channel(void *obj, void *arg, void *data, int flags)
+{
+	struct ast_channel *c = obj;
 	struct sip_pvt *p = data;
-
-	return (c->pbx &&
+	int res;
+
+	ast_channel_lock(c);
+
+	res = (c->pbx &&
 			(!strcasecmp(c->macroexten, p->exten) || !strcasecmp(c->exten, p->exten)) &&
 			(sip_cfg.notifycid == IGNORE_CONTEXT || !strcasecmp(c->context, p->context)));
+
+	ast_channel_unlock(c);
+
+	return res ? CMP_MATCH | CMP_STOP : 0;
 }
 
 /*! \brief Used in the SUBSCRIBE notification subsystem (RFC3265) */
@@ -10283,15 +10292,16 @@
 			   callee must be dialing the same extension that is being monitored.  Simply dialing
 			   the hint'd device is not sufficient. */
 			if (sip_cfg.notifycid) {
-				struct ast_channel *caller = ast_channel_search_locked(find_calling_channel, p);
-
-				if (caller) {
+				struct ast_channel *caller;
+				
+				if ((caller = ast_channel_callback(find_calling_channel, NULL, p, 0))) {
 					int need = strlen(caller->cid.cid_num) + strlen(p->fromdomain) + sizeof("sip:@");
 					local_target = alloca(need);
+					ast_channel_lock(caller);
 					snprintf(local_target, need, "sip:%s@%s", caller->cid.cid_num, p->fromdomain);
 					local_display = ast_strdupa(caller->cid.cid_name);
 					ast_channel_unlock(caller);
-					caller = NULL;
+					caller = ast_channel_unref(caller);
 				}
 			}
 




More information about the asterisk-commits mailing list