[Freeswitch-branches] [commit] r11510 - freeswitch/branches/gmaruzz/mod_skypiax
Author: gmaruzz Date: Tue Jan 27 12:04:52 2009 New Revision: 11510 Log: skypiax: if it do not find the X server or the Skype client at startup, exit with an error Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Tue Jan 27 12:04:52 2009 @@ -28,7 +28,7 @@ int option_debug = 100; switch_endpoint_interface_t *skypiax_endpoint_interface; switch_memory_pool_t *skypiax_module_pool = NULL; -int running = 1; +int running = 0; SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, globals.context); @@ -880,10 +880,17 @@ skypiax_skypeaudio_init(&globals.SKYPIAX_INTERFACES[interface_id]); - while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0) { + i=0; + while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 6000) { // 60sec switch_sleep(1000); + i++; } - NOTICA("STARTED interface_id=%d\n", SKYPIAX_P_LOG, interface_id); + if(globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected){ + NOTICA("STARTED interface_id=%d\n", SKYPIAX_P_LOG, interface_id); + } else { + ERRORA("interface_id=%d has not been started\n", SKYPIAX_P_LOG, interface_id); + break; + } } else { ERRORA("interface id %d is higher than SKYPIAX_MAX_INTERFACES (%d)\n", @@ -926,6 +933,8 @@ memset(&globals, '\0', sizeof(globals)); + running = 1; + load_config(); *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -936,8 +945,11 @@ skypiax_endpoint_interface->state_handler = &skypiax_state_handlers; DEBUGA_SKYPE("EXITING FUNC!\n", SKYPIAX_P_LOG); + if(running) /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; + else + return SWITCH_STATUS_FALSE; } SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown) Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Tue Jan 27 12:04:52 2009 @@ -933,6 +933,7 @@ if (!disp) { ERRORA("Cannot open X Display '%s', exiting skype thread\n", SKYPIAX_P_LOG, tech_pvt->X11_display); + running=0; return NULL; } else { DEBUGA_SKYPE("X Display '%s' opened\n", SKYPIAX_P_LOG, tech_pvt->X11_display); @@ -963,6 +964,7 @@ ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG); DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); + running=0; return NULL; } @@ -972,6 +974,7 @@ ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG); DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); + running=0; return NULL; } @@ -1019,9 +1022,11 @@ ERRORA ("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG); + running=0; return NULL; } DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); + running=0; return NULL; }
participants (1)
-
FreeSWITCH SVN