[Freeswitch-branches] [commit] r11207 - in freeswitch/branches/ctrix/mod_airpe: . config

FreeSWITCH SVN ctrix at freeswitch.org
Wed Jan 14 16:03:50 PST 2009


Author: ctrix
Date: Wed Jan 14 18:03:50 2009
New Revision: 11207

Log:
Add option to let the client auto-auth incoming requests



Modified:
   freeswitch/branches/ctrix/mod_airpe/airpe_api.c
   freeswitch/branches/ctrix/mod_airpe/airpe_if_common.c
   freeswitch/branches/ctrix/mod_airpe/airpe_if_x11.c
   freeswitch/branches/ctrix/mod_airpe/config/airpe.conf.xml
   freeswitch/branches/ctrix/mod_airpe/mod_airpe.c
   freeswitch/branches/ctrix/mod_airpe/mod_airpe.h

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	Wed Jan 14 18:03:50 2009
@@ -152,6 +152,11 @@
     switch_snprintf(buf, sizeof(buf), "%-20s: %s\n", "Mood text", (airpe->mood_text ) ? airpe->mood_text : "Unknown" );
     stream->write_function(stream, buf);
 
+    switch_snprintf(buf, sizeof(buf), "%-20s: %s\n", "Debug", (airpe->debug ) ? "Yes" : "No" );
+    stream->write_function(stream, buf);
+    switch_snprintf(buf, sizeof(buf), "%-20s: %s\n", "Auto-auth", (airpe->auto_auth) ? "Yes" : "No" );
+    stream->write_function(stream, buf);
+
  done:
     return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/ctrix/mod_airpe/airpe_if_common.c
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/airpe_if_common.c	(original)
+++ freeswitch/branches/ctrix/mod_airpe/airpe_if_common.c	Wed Jan 14 18:03:50 2009
@@ -553,10 +553,10 @@
     else if ( !strncmp( buf, "USER", strlen("USER")) && argc >= 2 ) {
 	/* Updates about the users of our list or new auth requests */
 	if ( !strncmp(argv[2], "RECEIVEDAUTHREQUEST", strlen("RECEIVEDAUTHREQUEST") ) ) {
-	    /* TODO add option to ignore such requests */
-	    char buf[SKYPE_MSG_LEN] = "";
-	    snprintf(buf, sizeof(buf), "SET USER %s ISAUTHORIZED TRUE", argv[1]);
-	    airpe_cmd_write(airpe, buf);
+	    if ( airpe->auto_auth ) {
+		snprintf(buf, sizeof(buf), "SET USER %s ISAUTHORIZED TRUE", argv[1]);
+		airpe_cmd_write(airpe, buf);
+	    }
 	}
     }
     else if ( !strncmp( buf, "GROUP", strlen("GROUP")) ) {
@@ -583,7 +583,7 @@
     else if ( !strncmp( buf, "CHAT", strlen("CHAT")) && argc >=2 ) {
 	/* Chat status - ignored. */
 	if ( airpe->protocol > 6 ) {
-	    //TODO : ALTER CHAT <chat_id> DISBAND - Doesn't seems to work on linux
+	    /* ALTER CHAT <chat_id> DISBAND - Doesn't seems to work on linux */
 	    char buf[SKYPE_MSG_LEN] = "";
 	    snprintf(buf, sizeof(buf), "ALTER CHAT %s DISBAND", argv[1]);
 	    airpe_cmd_write(airpe, buf);
@@ -616,13 +616,13 @@
 
 	if ( !strncmp(cmd, "DURATION", strlen("DURATION")) ) {
 	    /* Ignore the duration that is updated every second */
+	    /* TODO: maybe in the future we could consider this message as a keepalive signal */
 	    if ( callid != airpe->active_call_id ) {
 		char buf[SKYPE_MSG_LEN] = "";
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "airpe client %s: hanging up unknown call id %d\n", airpe->name, callid);
 		snprintf(buf, sizeof(buf), "SET CALL %d STATUS FINISHED", callid);
 		airpe_cmd_write(airpe, buf);
 	    }
-	    //TODO: maybe we could consider this message as a keepalive signal
 	}
 	else if ( !strncmp(cmd, "STATUS", strlen("STATUS")) && argc >=4 ) {
 	    char *callstatus = argv[3];
@@ -734,7 +734,11 @@
 	/* Ignoring by now */
     }
     else if ( !strncmp( buf, "ERROR", strlen("ERROR")) ) {
-	//TODO If we are in the middle of a call, hangup
+	/* If we are in the middle of a call, hangup */
+	if ( airpe->active_call_id ) {
+	    snprintf(buf, sizeof(buf), "ALTER CALL %d END HANGUP", airpe->active_call_id );
+	    airpe_cmd_write(airpe, buf);
+	}
     }
     else {
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unmanaged message\n");

Modified: freeswitch/branches/ctrix/mod_airpe/airpe_if_x11.c
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/airpe_if_x11.c	(original)
+++ freeswitch/branches/ctrix/mod_airpe/airpe_if_x11.c	Wed Jan 14 18:03:50 2009
@@ -95,8 +95,7 @@
     switch_log_printf(	SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
 			"HEY! where is my skype window gone ? Restarting skype for client...\n");
 /*
-
-    TODO AND TO USE
+    TODO AND TO USE - Start skype client
 
     int fid;
     const char *args[] = { "skype", "--actiondispatch", params, 0 };

Modified: freeswitch/branches/ctrix/mod_airpe/config/airpe.conf.xml
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/config/airpe.conf.xml	(original)
+++ freeswitch/branches/ctrix/mod_airpe/config/airpe.conf.xml	Wed Jan 14 18:03:50 2009
@@ -19,6 +19,7 @@
 	<param name="context" value="default"/>
 	<param name="destination" value="4321"/>
 
+	<param name="auto-auth" value="false"/>
 	<!-- 
 	    The following params won't be affected by reloading xml 
 	-->

Modified: freeswitch/branches/ctrix/mod_airpe/mod_airpe.c
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/mod_airpe.c	(original)
+++ freeswitch/branches/ctrix/mod_airpe/mod_airpe.c	Wed Jan 14 18:03:50 2009
@@ -260,7 +260,6 @@
 
     if ( switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ) {
 	airpe_originate(tech_pvt->airpe, tech_pvt->destination );
-	// TODO if fail switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
     }
 
     switch_channel_set_state(channel, CS_ROUTING);
@@ -509,14 +508,13 @@
     switch (sig) {
 	case SWITCH_SIG_KILL:
 	    break;
-    case SWITCH_SIG_BREAK:
+	case SWITCH_SIG_BREAK:
 	    break;
-    default:
-	//TODO Log unhandled signal
-	break;
-  }
+	default:
+	    break;
+    }
 
-  return SWITCH_STATUS_SUCCESS;
+    return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t channel_send_dtmf(switch_core_session_t * session, const switch_dtmf_t * dtmf) {
@@ -686,6 +684,7 @@
     	    char *skype_password= NULL;
 	    char *cid_name	= NULL;
 	    char *cid_num	= NULL;
+	    int	 auto_auth	= 0;
 	    int	 debug		= 0;
 
     	    airpe_interface_t 	*newconf = NULL;
@@ -701,6 +700,8 @@
 
     		if        (!strcasecmp(var, "debug")) {
 		    debug = switch_true(val) ? 1 : 0;
+    		} else if (!strcasecmp(var, "auto-auth")) {
+		    auto_auth = switch_true(val) ? 1 : 0;
     		} else if (!strcasecmp(var, "context")) {
         	    context = val;
     		} else if (!strcasecmp(var, "dialplan")) {
@@ -765,6 +766,7 @@
 		newconf->dialplan 	= switch_core_strdup(pool, dialplan);
 		newconf->context  	= switch_core_strdup(pool, context);
 		newconf->destination  	= switch_core_strdup(pool, destination);
+		newconf->auto_auth  	= auto_auth;
 		newconf->debug  	= debug;
 
 		if ( reload ) {

Modified: freeswitch/branches/ctrix/mod_airpe/mod_airpe.h
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/mod_airpe.h	(original)
+++ freeswitch/branches/ctrix/mod_airpe/mod_airpe.h	Wed Jan 14 18:03:50 2009
@@ -139,6 +139,7 @@
     char 			*skype_user;
     char 			*skype_password;
 
+    int				auto_auth;
     int 			audio_in_port;
     int 			audio_out_port;
     switch_socket_t		*audio_in_socket;



More information about the Freeswitch-branches mailing list