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

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


Author: gmaruzz
Date: Fri Nov  7 04:39:44 2008
New Revision: 10284

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

Log:
skypiax: gets X11 DISPLAY from config file

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 04:39:44 2008
@@ -2336,6 +2336,8 @@
 	char fail_dial_regex[256];
 	char hold_music[256];
 	char type[256];
+	char X11_display[256];
+	struct AsteriskHandles AsteriskHandlesAst;
 };
 
 typedef struct skypiax_config skypiax_config_t;
@@ -2730,7 +2732,7 @@
 	/*.receive_event */ channel_receive_event
 };
 #define SKYPE_THREAD
-  struct AsteriskHandles ciapa;
+  //struct AsteriskHandles ciapa;
 #ifdef SKYPE_THREAD
 #define SKYPE_X11_BUF_SIZE 512
 Window skype_win = (Window) - 1;
@@ -2866,19 +2868,17 @@
 static void *SWITCH_THREAD_FUNC do_skype_thread(switch_thread_t *thread, void *data)
 {
 
-//  struct skypiax_pvt *p;
+  struct skypiax_config *p;
   struct AsteriskHandles *AsteriskHandlesAst;
   char buf[SKYPE_X11_BUF_SIZE];
   Display *disp = NULL;
   Window root = -1;
   Window win = -1;
 
-  /*
   p = data;
 
-  if (option_debug > 10) {
     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);
     if (option_debug > 10) {
@@ -2886,16 +2886,17 @@
     }
     return NULL;
   }
+*/
 
   AsteriskHandlesAst = &p->AsteriskHandlesAst;
-*/
-  AsteriskHandlesAst = &ciapa;
-  disp = XOpenDisplay(getenv("DISPLAY"));
+  //AsteriskHandlesAst = &ciapa;
+  //disp = XOpenDisplay(getenv("DISPLAY"));
+  disp = XOpenDisplay(p->X11_display);
   if (!disp) {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open X Display, exiting skype thread\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open X Display '%s', exiting skype thread\n", p->X11_display);
     return NULL;
   } else {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "X Display opened\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "X Display '%s' opened\n", p->X11_display);
   }
 
   int xfd;
@@ -3076,6 +3077,7 @@
 			char *hold_music = NULL;
 			char *fail_dial_regex = NULL;
 			char *enable_callerid = "true";
+			char *X11_display = NULL;
 
 			uint32_t span_id = 0, to = 0, max = 0;
 			
@@ -3099,6 +3101,8 @@
 					fail_dial_regex = val;
 				} else if (!strcasecmp(var, "hold-music")) {
 					hold_music = val;
+				} else if (!strcasecmp(var, "X11-display") || !strcasecmp(var, "X11_display")) {
+					X11_display = val;
 				} else if (!strcasecmp(var, "max_digits") || !strcasecmp(var, "max-digits")) {
 					max_digits = val;
 				} else if (!strcasecmp(var, "hotline")) {
@@ -3106,7 +3110,12 @@
 				} 
 				
 			}
-				
+
+			if (!X11_display) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing REQUIRED param 'X11_display'\n");
+				continue;
+			}
+			
 			if (!id) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing REQUIRED param 'id'\n");
 				continue;
@@ -3151,8 +3160,10 @@
 				} else {
 					switch_set_string(SKYPIAX_CONFIGS[span_id].name, "N/A");
 				}
+				switch_set_string(SKYPIAX_CONFIGS[span_id].X11_display, X11_display);
 				switch_set_string(SKYPIAX_CONFIGS[span_id].context, context);
 				switch_set_string(SKYPIAX_CONFIGS[span_id].dialplan, dialplan);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].X11_display=%s\n", span_id, SKYPIAX_CONFIGS[span_id].X11_display);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "span_id=%d SKYPIAX_CONFIGS[span_id].name=%s\n", span_id, SKYPIAX_CONFIGS[span_id].name);
 				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);
@@ -3179,6 +3190,7 @@
 		for(i=0; i < SKYPIAX_MAX_INTERFACES; i++) {
 			if(strlen(SKYPIAX_CONFIGS[i].name)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].span_id=%s\n", i, SKYPIAX_CONFIGS[i].span_id);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].X11_display=%s\n", i, SKYPIAX_CONFIGS[i].X11_display);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].name=%s\n", i, SKYPIAX_CONFIGS[i].name);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].context=%s\n", i, SKYPIAX_CONFIGS[i].context);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "i=%d SKYPIAX_CONFIGS[i].dialplan=%s\n", i, SKYPIAX_CONFIGS[i].dialplan);
@@ -3188,7 +3200,6 @@
 
 	switch_xml_free(xml);
 
-	//do_skype_thread(NULL);
 
 //static void unicall_thread_launch(uc_t *uc)
 
@@ -3206,6 +3217,7 @@
   } else {
 	DEBUGA_SKYPE("Initialized XInitThreads!\n", SKYPIAX_P_LOG);
   }
+usleep(10000); //FIXME
 #endif /* _WINDOWS_ */
 
 



More information about the Freeswitch-svn mailing list