[asterisk-commits] mmichelson: branch group/CCSS r224853 - /team/group/CCSS/main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 20 16:58:59 CDT 2009


Author: mmichelson
Date: Tue Oct 20 16:58:55 2009
New Revision: 224853

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=224853
Log:
Now the state is output as a string.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=224853&r1=224852&r2=224853
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Oct 20 16:58:55 2009
@@ -2724,12 +2724,33 @@
 	return;
 }
 
+static struct {
+	enum cc_state state;
+	const char *state_string;
+} cc_state_to_string_map[] = {
+	{CC_AVAILABLE,          "CC is available"},
+	{CC_CALLER_OFFERED,     "CC offered to caller"},
+	{CC_CALLER_REQUESTED,   "CC requested by caller"},
+	{CC_ACTIVE,             "CC accepted by callee"},
+	{CC_CALLEE_READY,       "Callee has become available"},
+	{CC_CALLER_BUSY,        "Callee was ready, but caller is now unavailable"},
+	{CC_RECALLING,          "Caller is attempting to recall"},
+	/* Should never return these last two, but never hurts to have my bases covered */
+	{CC_COMPLETE,           "Recall has been acknowledged"},
+	{CC_FAILED,             "CC has failed"},
+};
+
+static const char *cc_state_to_string(enum cc_state state)
+{
+	return cc_state_to_string_map[state].state_string;
+}
+
 static int print_stats_cb(void *obj, void *arg, int flags)
 {
 	int *cli_fd = arg;
 	struct cc_core_instance *core_instance = obj;
 
-	ast_cli(*cli_fd, "Core: %d, State: %d\n", core_instance->core_id, core_instance->current_state);
+	ast_cli(*cli_fd, "Core: %d, State: %s\n", core_instance->core_id, cc_state_to_string(core_instance->current_state));
 	return 0;
 }
 




More information about the asterisk-commits mailing list