[svn-commits] russell: branch russell/chan_refcount r82351 - /team/russell/chan_refcount/main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 13 16:53:01 CDT 2007


Author: russell
Date: Thu Sep 13 16:53:01 2007
New Revision: 82351

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82351
Log:
convert the show channel CLI handler

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

Modified: team/russell/chan_refcount/main/cli.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/cli.c?view=diff&rev=82351&r1=82350&r2=82351
==============================================================================
--- team/russell/chan_refcount/main/cli.c (original)
+++ team/russell/chan_refcount/main/cli.c Thu Sep 13 16:53:01 2007
@@ -906,12 +906,16 @@
 	
 	if (argc != 4)
 		return RESULT_SHOWUSAGE;
+
 	now = ast_tvnow();
-	c = ast_get_channel_by_name_locked(argv[3]);
-	if (!c) {
+
+	if (!(c = ast_channel_get_by_name(argv[3]))) {
 		ast_cli(fd, "%s is not a known channel\n", argv[3]);
 		return RESULT_SUCCESS;
 	}
+
+	ast_channel_lock(c);
+
 	if (c->cdr) {
 		elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec;
 		hour = elapsed_seconds / 3600;
@@ -920,6 +924,7 @@
 		snprintf(cdrtime, sizeof(cdrtime), "%dh%dm%ds", hour, min, sec);
 	} else
 		strcpy(cdrtime, "N/A");
+
 	ast_cli(fd, 
 		" -- General --\n"
 		"           Name: %s\n"
@@ -974,10 +979,12 @@
 	
 	if (pbx_builtin_serialize_variables(c, &out))
 		ast_cli(fd,"      Variables:\n%s\n", out->str);
+
 	if (c->cdr && ast_cdr_serialize_variables(c->cdr, &out, '=', '\n', 1))
 		ast_cli(fd,"  CDR Variables:\n%s\n", out->str);
 	
 	ast_channel_unlock(c);
+
 	return RESULT_SUCCESS;
 }
 




More information about the svn-commits mailing list