[asterisk-commits] trunk r9508 - in /trunk: channel.c include/asterisk/channel.h

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Feb 11 00:06:53 MST 2006


Author: markster
Date: Sat Feb 11 01:06:47 2006
New Revision: 9508

URL: http://svn.digium.com/view/asterisk?rev=9508&view=rev
Log:
Add capability to retrieve list of channel types

Modified:
    trunk/channel.c
    trunk/include/asterisk/channel.h

Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=9508&r1=9507&r2=9508&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Sat Feb 11 01:06:47 2006
@@ -164,6 +164,22 @@
 	{ AST_CAUSE_INTERWORKING, "Interworking, unspecified" },
 };
 
+
+struct ast_variable *ast_channeltype_list(void)
+{
+	struct chanlist *cl;
+	struct ast_variable *var=NULL, *prev = NULL;
+	AST_LIST_TRAVERSE(&backends, cl, list) {
+		if (prev)  {
+			if ((prev->next = ast_variable_new(cl->tech->type, cl->tech->description)))
+				prev = prev->next;
+		} else {
+			var = ast_variable_new(cl->tech->type, cl->tech->description);
+			prev = var;
+		}
+	}
+	return var;
+}
 
 static int show_channeltypes(int fd, int argc, char *argv[])
 {

Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?rev=9508&r1=9507&r2=9508&view=diff
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Sat Feb 11 01:06:47 2006
@@ -1236,6 +1236,9 @@
 */
 const char *channelreloadreason2txt(enum channelreloadreason reason);
 
+/*! \brief return an ast_variable list of channeltypes */
+extern struct ast_variable *ast_channeltype_list(void);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif



More information about the asterisk-commits mailing list