[asterisk-commits] russell: trunk r39932 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Aug 15 15:17:39 MST 2006


Author: russell
Date: Tue Aug 15 17:17:38 2006
New Revision: 39932

URL: http://svn.digium.com/view/asterisk?rev=39932&view=rev
Log:
reduce duplicated code by using print_codec_to_cli in sip_show_user as it is
already used in sip_show_peer (issue #7739, DEA)

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=39932&r1=39931&r2=39932&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Aug 15 17:17:38 2006
@@ -9686,7 +9686,6 @@
 		ast_cli(fd, "%s\n", codec_buf);
 		ast_cli(fd, "  Codec Order  : (");
 		print_codec_to_cli(fd, &peer->prefs);
-
 		ast_cli(fd, ")\n");
 
 		ast_cli(fd, "  Status       : ");
@@ -9789,9 +9788,8 @@
 {
 	char cbuf[256];
 	struct sip_user *user;
-	struct ast_codec_pref *pref;
 	struct ast_variable *v;
-	int x = 0, codec = 0, load_realtime;
+	int load_realtime;
 
 	if (argc < 4)
 		return RESULT_SHOWUSAGE;
@@ -9821,18 +9819,7 @@
 		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), user->cid_name, user->cid_num, "<unspecified>"));
 		ast_cli(fd, "  ACL          : %s\n", (user->ha?"Yes":"No"));
 		ast_cli(fd, "  Codec Order  : (");
-		pref = &user->prefs;
-		for(x = 0; x < 32 ; x++) {
-			codec = ast_codec_pref_index(pref,x);
-			if (!codec)
-				break;
-			ast_cli(fd, "%s", ast_getformatname(codec));
-			if (x < 31 && ast_codec_pref_index(pref,x+1))
-				ast_cli(fd, "|");
-		}
-
-		if (!x)
-			ast_cli(fd, "none");
+		print_codec_to_cli(fd, &user->prefs);
 		ast_cli(fd, ")\n");
 
 		if (user->chanvars) {



More information about the asterisk-commits mailing list