[Freeswitch-branches] [commit] r11267 - freeswitch/branches/ctrix/mod_airpe

FreeSWITCH SVN ctrix at freeswitch.org
Sat Jan 17 14:40:42 PST 2009


Author: ctrix
Date: Sat Jan 17 16:40:42 2009
New Revision: 11267

Log:
airpe_debug command.

Modified:
   freeswitch/branches/ctrix/mod_airpe/airpe_api.c

Modified: freeswitch/branches/ctrix/mod_airpe/airpe_api.c
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/airpe_api.c	(original)
+++ freeswitch/branches/ctrix/mod_airpe/airpe_api.c	Sat Jan 17 16:40:42 2009
@@ -37,6 +37,51 @@
 */
 
 
+#define AIRPE_DEBUG_SYNTAX "airpe_debug <clientname> <on|off|true|false|1|0>"
+SWITCH_STANDARD_API(airpe_debug_command)
+{
+    int argc = 0;
+    char *argv[2] = { 0 };
+    char *mycmd  = NULL;
+    char *client = NULL;
+    airpe_interface_t *airpe = NULL;
+
+    if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
+	argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+	switch_assert(argv[0]);
+    }
+
+    if ( argc < 1 ) {
+	stream->write_function(stream, "-USAGE: %s\n", AIRPE_DEBUG_SYNTAX);
+	goto done;
+    }
+
+    client = argv[0];
+    airpe = airpe_find_interface(client);
+
+    if ( !airpe ) {
+	stream->write_function(stream, "-ERR interface not found for client ");
+	stream->write_function(stream, client);
+	stream->write_function(stream, "\n");
+	goto done;
+    } 
+
+    if ( argc > 1 ) {
+	int debug = switch_true(argv[1]);
+	airpe->debug = debug;
+    }
+
+    stream->write_function(stream, "Debug status: ");
+    if ( airpe->debug )
+        stream->write_function(stream, "On");
+    else
+        stream->write_function(stream, "Off");
+    stream->write_function(stream, "\n");
+
+ done:
+    return SWITCH_STATUS_SUCCESS;
+}
+
 #define AIRPE_MOODTEXT_SYNTAX "airpe_moodtext <clientname> [text]"
 SWITCH_STANDARD_API(airpe_moodtext_command)
 {
@@ -248,6 +293,9 @@
 
     switch_api_interface_t *api;
 
+    switch_console_set_complete("add airpe_debug ");
+    SWITCH_ADD_API(api, "airpe_debug", "gets/sets debug status of an airpe client", airpe_debug_command, AIRPE_DEBUG_SYNTAX);
+
     switch_console_set_complete("add airpe_moodtext ");
     SWITCH_ADD_API(api, "airpe_moodtext", "gets/sets the mood text of an airpe client", airpe_moodtext_command, AIRPE_MOODTEXT_SYNTAX);
 



More information about the Freeswitch-branches mailing list