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

FreeSWITCH SVN ctrix at freeswitch.org
Thu Jan 22 17:01:31 PST 2009


Author: ctrix
Date: Thu Jan 22 19:01:31 2009
New Revision: 11450

Log:
More OSX Stuff...

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

Modified: freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c	(original)
+++ freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c	Thu Jan 22 19:01:31 2009
@@ -62,7 +62,7 @@
 /*****************************************************************************
     THREADS
  *****************************************************************************/
-void IncomingMessage(CFStringRef aNotificationString) {
+static void IncomingMessage(CFStringRef aNotificationString) {
 
     ADEBUG("Incoming message");
 
@@ -71,31 +71,55 @@
 
 }
 
+static void AttachResponse(unsigned int aAttachResponseCode) {
+    ADEBUG("Attach: %d\n", aAttachResponseCode);
+}
+
+
 void *SWITCH_THREAD_FUNC airpe_skype_thread(switch_thread_t * thread, void *obj) {
     airpe_interface_t *airpe = NULL;
     struct SkypeDelegate *del;
-    CFStringRef cfs;
 
     assert(obj);
     airpe = obj;
 
-    cfs = CFStringCreateWithCString(NULL, "airpe", 5);
+    if ( !IsSkypeAvailable() ) {
+	ADEBUG("Sorry, not available\n");
+	return NULL;
+    }
+
+    if ( !IsSkypeRunning() ) {
+	ADEBUG("Sorry, not running\n");
+	return NULL;
+    }
 
     del = &airpe->skype_window->delegate;
-    del->clientApplicationName=cfs;
+    del->clientApplicationName=CFSTR("airpe");
     del->SkypeNotificationReceived=IncomingMessage;
+    del->SkypeAttachResponse=AttachResponse;
+
     SetSkypeDelegate(del);
     ConnectToSkype();
 
+    if ( airpe_on_connect_messages( airpe, 6 ) != SWITCH_STATUS_SUCCESS ) {
+	switch_log_printf(	SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+				"airpe client %s. Failed to send handshake messages\n", 
+				airpe->name);
+    	return NULL;
+    }
+
+
+    airpe->running = 1;
     while ( airpe->running ) {
-ADEBUG("loop\n");
 	switch_sleep(1000000);
     }
 
     DisconnectFromSkype();
     RemoveSkypeDelegate();
 
-    CFRelease(cfs);
+    ADEBUG("Exiting\n");
+
+    airpe->airpe_thread_skype = NULL;
 
     return NULL;
 }



More information about the Freeswitch-branches mailing list