[Freeswitch-svn] [commit] r11268 - freeswitch/branches/ctrix/mod_airpe
FreeSWITCH SVN
ctrix at freeswitch.org
Sat Jan 17 16:54:58 PST 2009
Author: ctrix
Date: Sat Jan 17 18:54:58 2009
New Revision: 11268
Log:
api for:
- airpe_debug: switch debug on/off for a client
- airpe_raw_command: sends a raw command to a client
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 18:54:58 2009
@@ -37,6 +37,42 @@
*/
+#define AIRPE_RAW_SYNTAX "airpe_raw_command <clientname> <command string>"
+SWITCH_STANDARD_API(airpe_raw_command)
+{
+ int argc = 0;
+ char *argv[2] = { 0 };
+ char *mycmd = NULL;
+ char *client = NULL;
+ char buf[SKYPE_MSG_LEN];
+ 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_RAW_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);
+ goto done;
+ }
+
+ snprintf(buf, SKYPE_MSG_LEN, "%s", argv[1] );
+ airpe_cmd_write(airpe, buf);
+
+ done:
+ return SWITCH_STATUS_SUCCESS;
+}
+
#define AIRPE_DEBUG_SYNTAX "airpe_debug <clientname> <on|off|true|false|1|0>"
SWITCH_STANDARD_API(airpe_debug_command)
{
@@ -201,6 +237,27 @@
switch_snprintf(buf, sizeof(buf), "%-20s: %s\n", "Auto-auth", (airpe->auto_auth) ? "Yes" : "No" );
stream->write_function(stream, buf);
+ if ( airpe->variables_hash ) {
+ switch_hash_index_t *hi;
+ const void *var = NULL;
+ void *val = NULL;
+ const char *vname, *vvalue;
+
+ for (hi = switch_hash_first(NULL, airpe->variables_hash); hi; hi = switch_hash_next(hi)) {
+ if ( !var ) {
+ stream->write_function(stream, "Client variables\n");
+ }
+ switch_hash_this(hi, &var, NULL, &val);
+ vname = var;
+ vvalue = (const char*) val;
+ if ( vname && vvalue ) {
+ switch_snprintf(buf, sizeof(buf), "- %-20s: %s\n", vname, vvalue );
+ stream->write_function(stream, buf);
+ }
+ }
+
+ }
+
done:
return SWITCH_STATUS_SUCCESS;
}
@@ -305,6 +362,9 @@
switch_console_set_complete("add airpe_status ");
SWITCH_ADD_API(api, "airpe_status", "gets/sets the status of an airpe client", airpe_status_command, AIRPE_STATUS_SYNTAX);
+ switch_console_set_complete("add airpe_raw_command ");
+ SWITCH_ADD_API(api, "airpe_raw_command", "sends a raw command to an airpe client", airpe_raw_command, AIRPE_RAW_SYNTAX);
+
return SWITCH_STATUS_SUCCESS;
}
More information about the Freeswitch-svn
mailing list