[Freeswitch-branches] [commit] r10285 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax

Freeswitch SVN gmaruzz at freeswitch.org
Fri Nov 7 11:42:22 PST 2008


Author: gmaruzz
Date: Fri Nov  7 06:00:37 2008
New Revision: 10285

Modified:
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c

Log:
skypiax: cosmetics

Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	Fri Nov  7 06:00:37 2008
@@ -2864,8 +2864,8 @@
   DEBUGA_SKYPE("OUT destroyed disp\n", SKYPIAX_P_LOG);
   usleep(1000);
 }
-//void *do_skype_thread(void *data)
-static void *SWITCH_THREAD_FUNC do_skype_thread(switch_thread_t *thread, void *data)
+
+static void *SWITCH_THREAD_FUNC do_skype_thread(switch_thread_t *thread, void *obj)
 {
 
   struct skypiax_config *p;
@@ -2874,10 +2874,11 @@
   Display *disp = NULL;
   Window root = -1;
   Window win = -1;
+int res;
 
-  p = data;
-
+  p = obj;
     DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
+
 /*
   if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
     ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
@@ -2888,8 +2889,17 @@
   }
 */
 
+  res = pipe(p->AsteriskHandlesAst.fdesc);
+  if (res) {
+    ERRORA("Unable to create skype pipe, exiting skype thread\n", SKYPIAX_P_LOG);
+    DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
+	return NULL;
+  }
+  fcntl(p->AsteriskHandlesAst.fdesc[0], F_SETFL, O_NONBLOCK);
+  fcntl(p->AsteriskHandlesAst.fdesc[1], F_SETFL, O_NONBLOCK);
+
+
   AsteriskHandlesAst = &p->AsteriskHandlesAst;
-  //AsteriskHandlesAst = &ciapa;
   //disp = XOpenDisplay(getenv("DISPLAY"));
   disp = XOpenDisplay(p->X11_display);
   if (!disp) {
@@ -3148,7 +3158,6 @@
 			if (name) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "name=%s\n", name);
 			}
-
 			if(span_id && span_id < SKYPIAX_MAX_INTERFACES ) {
 				struct skypiax_config newconf;
 				memset(&newconf, '\0', sizeof(newconf));
@@ -3168,6 +3177,8 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].context=%s\n", span_id, SKYPIAX_CONFIGS[span_id].context);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].dialplan=%s\n", span_id, SKYPIAX_CONFIGS[span_id].dialplan);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STARTING span_id=%d\n", span_id);
+
+
 if(1)
 {
     switch_thread_t *thread;
@@ -3178,6 +3189,7 @@
     switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
     switch_thread_create(&thread, thd_attr, do_skype_thread, &SKYPIAX_CONFIGS[span_id], module_pool);
 }
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "STARTED span_id=%d\n", span_id);
 
 
 			} else {
@@ -3200,9 +3212,6 @@
 
 	switch_xml_free(xml);
 
-
-//static void unicall_thread_launch(uc_t *uc)
-
 	return SWITCH_STATUS_SUCCESS;
 }
 



More information about the Freeswitch-branches mailing list