[asterisk-commits] russell: branch russell/chan_refcount r94976 - /team/russell/chan_refcount/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 27 14:01:23 CST 2007


Author: russell
Date: Thu Dec 27 14:01:22 2007
New Revision: 94976

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94976
Log:
convert some more new code to the new api

Modified:
    team/russell/chan_refcount/main/manager.c

Modified: team/russell/chan_refcount/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/manager.c?view=diff&rev=94976&r1=94975&r2=94976
==============================================================================
--- team/russell/chan_refcount/main/manager.c (original)
+++ team/russell/chan_refcount/main/manager.c Thu Dec 27 14:01:22 2007
@@ -2345,15 +2345,22 @@
 	struct ast_channel *c = NULL;
 	int numchans = 0;
 	int duration, durh, durm, durs;
+	struct ast_channel_iterator *iter;
 
 	if (!ast_strlen_zero(actionid))
 		snprintf(actionidtext, sizeof(actionidtext), "ActionID: %s\r\n", actionid);
 
 	astman_send_listack(s, m, "Channels will follow", "start");	
 
-	while ((c = ast_channel_walk_locked(c)) != NULL) {
-		struct ast_channel *bc = ast_bridged_channel(c);
+	iter = ast_channel_iterator_all_new();
+
+	while ((c = ast_channel_iterator_next(iter))) {
+		struct ast_channel *bc;
 		char durbuf[10] = "";
+
+		ast_channel_lock(c);
+
+ 		bc = ast_bridged_channel(c);
 
 		if (c->cdr && !ast_tvzero(c->cdr->start)) {
 			duration = (int)(ast_tvdiff_ms(ast_tvnow(), c->cdr->start) / 1000);
@@ -2382,8 +2389,11 @@
 			c->appl ? c->appl : "", c->data ? S_OR(c->data, ""): "",
 			S_OR(c->cid.cid_num, ""), durbuf, S_OR(c->accountcode, ""), bc ? bc->name : "", bc ? bc->uniqueid : "");
 		ast_channel_unlock(c);
+		ast_channel_unref(c);
 		numchans++;
 	}
+
+	ast_channel_iterator_destroy(iter);
 
 	astman_append(s,
                 "Event: CoreShowChannelsComplete\r\n"




More information about the asterisk-commits mailing list