[commit] r11679 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk
Author: gmaruzz Date: Sat Feb 7 08:09:40 2009 New Revision: 11679 Log: skypiax: * compile and works on Cygwin Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Sat Feb 7 08:09:40 2009 @@ -1285,6 +1285,7 @@ M_UINT("tcp_srv_port", tmp->tcp_srv_port) M_F("playback_boost", skypiax_store_boost(v->value, &tmp->playback_boost)) M_F("capture_boost", skypiax_store_boost(v->value, &tmp->capture_boost)) + M_STR("skype_user", tmp->skype_user) M_UINT("skypiax_dir_entry_extension_prefix", tmp->skypiax_dir_entry_extension_prefix) M_END(;); @@ -1404,6 +1405,7 @@ free(tmp); return NULL; } + /* res = pipe(tmp->SkypiaxHandles.fdesc); if (res) { ast_log(LOG_ERROR, "Unable to create skype pipe\n"); @@ -1415,6 +1417,7 @@ } fcntl(tmp->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK); fcntl(tmp->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK); + */ tmp->skype_thread = AST_PTHREADT_NULL; if (tmp->skype) { @@ -1424,7 +1427,7 @@ (unsigned long) AST_PTHREADT_NULL); #ifdef __CYGWIN__ if (ast_pthread_create - (&tmp->skype_thread, NULL, do_skypeapi_thread, &tmp->SkypiaxHandles) < 0) { + (&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) { ast_log(LOG_ERROR, "Unable to start skype_main thread.\n"); if (option_debug > 10) { DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG); Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf Sat Feb 7 08:09:40 2009 @@ -53,6 +53,7 @@ X11_display=:101 tcp_cli_port=11234 tcp_srv_port=11235 +skype_user=gmaruzz2 ;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;; ; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels @@ -63,57 +64,58 @@ playback_boost=0 ; capture_boost=0 ; -[skypeclient2] -;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;; -; general settings, valid on all platforms -; -; -; Default language -; -language=en -; -; Default context (in extensions.conf, can be overridden with @context syntax) -; -context=default -; -; Default extension (in extensions.conf) where incoming calls land -; -extension=s -; -;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;; -; Debugging settings, valid globally for all interfaces on all platforms -; -; the debug values are global for all the interfaces. -; -; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax -; -; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch -; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages -; -; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all -; debug_all activate all possible debugging info -; -;debug_all=yes -debug_skype=yes -debug_pbx=yes -;debug_sound=yes -;debug_locks=yes -;debug_monitorlocks=yes - -skype=yes ; legacy setting, leave it to yes -X11_display=:102 -tcp_cli_port=11236 -tcp_srv_port=11237 -;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;; -; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels -; tweak it if you get horrible (or not hearable) sound -; -;boost can be positive or negative (-40 to +40) in db -;experiment to find which values are best for your computer -playback_boost=0 ; -capture_boost=0 ; - - +;;;[skypeclient2] +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; general settings, valid on all platforms +;;;; +;;;; +;;;; Default language +;;;; +;;;language=en +;;;; +;;;; Default context (in extensions.conf, can be overridden with @context syntax) +;;;; +;;;context=default +;;;; +;;;; Default extension (in extensions.conf) where incoming calls land +;;;; +;;;extension=s +;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; Debugging settings, valid globally for all interfaces on all platforms +;;;; +;;;; the debug values are global for all the interfaces. +;;;; +;;;; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax +;;;; +;;;; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch +;;;; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages +;;;; +;;;; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all +;;;; debug_all activate all possible debugging info +;;;; +;;;;debug_all=yes +;;;debug_skype=yes +;;;debug_pbx=yes +;;;;debug_sound=yes +;;;;debug_locks=yes +;;;;debug_monitorlocks=yes +;;; +;;;skype=yes ; legacy setting, leave it to yes +;;;X11_display=:102 +;;;tcp_cli_port=11236 +;;;tcp_srv_port=11237 +;;;skype_user=gmaruzz3 +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels +;;;; tweak it if you get horrible (or not hearable) sound +;;;; +;;;;boost can be positive or negative (-40 to +40) in db +;;;;experiment to find which values are best for your computer +;;;playback_boost=0 ; +;;;capture_boost=0 ; +;;; +;;; Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h Sat Feb 7 08:09:40 2009 @@ -230,7 +230,7 @@ UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach; UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover; int api_connected; - switch_file_t *fdesc[2]; + int fdesc[2]; }; #endif //WIN32 @@ -329,10 +329,11 @@ void skypiax_skype_clean_disp(void *data); #endif /* WANT_SKYPE_X11 */ #ifdef __CYGWIN__ -int win32_Initialize_CreateWindowClass(void); -void win32_DeInitialize_DestroyWindowClass(void); -int win32_Initialize_CreateMainWindow(void); -void win32_DeInitialize_DestroyMainWindow(void); + +int win32_Initialize_CreateWindowClass(private_t * tech_pvt); +void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt); +int win32_Initialize_CreateMainWindow(private_t * tech_pvt); +void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt); #endif /* __CYGWIN__ */ /* CHAN_SKYPIAX.C */ 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 Sat Feb 7 08:09:40 2009 @@ -4,8 +4,8 @@ #define skypiax_sleep usleep #define tech_pvt p extern int skypiax_debug; -#define skypiax_file_write switch_file_write -#define skypiax_file_read switch_file_read +//#define skypiax_file_write switch_file_write +//#define skypiax_file_read switch_file_read extern char *skypiax_console_active; #else /* FREESWITCH */ #define skypiax_sleep switch_sleep @@ -157,7 +157,7 @@ howmany = len; -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); #else /* WIN32 */ howmany = write(tech_pvt->audiopipe[1], totalbuf, howmany); @@ -179,7 +179,7 @@ //ERRORA("tech_pvt->audiopipe[1] = %d\n", SKYPIAX_P_LOG, tech_pvt->audiopipe[1]); if (len > 0) { if (len == SAMPLES_PER_FRAME * sizeof(short)) { -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) unsigned int howmany; howmany = len; @@ -203,7 +203,7 @@ i++; } -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); #else /* WIN32 */ howmany = write(tech_pvt->audiopipe[1], totalbuf, howmany); @@ -233,7 +233,7 @@ skypiax_sleep(10000); } } -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) kill_cli_size = SAMPLES_PER_FRAME * sizeof(short); skypiax_file_write(tech_pvt->audiopipe[1], kill_cli_buff, &kill_cli_size); kill_cli_size = SAMPLES_PER_FRAME * sizeof(short); @@ -255,20 +255,20 @@ len = write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size); #endif /* WIN32 */ DEBUGA_SKYPE("Skype client GONE\n", SKYPIAX_P_LOG); -#ifndef WIN32 - close(fd); -#else +#if defined(WIN32) && !defined(__CYGWIN__) closesocket(fd); +#else + close(fd); #endif if (exit) break; } DEBUGA_SKYPE("server (I am it) GONE\n", SKYPIAX_P_LOG); -#ifndef WIN32 - close(s); -#else +#if defined(WIN32) && !defined(__CYGWIN__) closesocket(s); +#else + close(s); #endif if (option_debug > 100) { DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); @@ -321,10 +321,10 @@ if (option_debug > 100) { DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); } -#ifndef WIN32 - close(s); +#if defined(WIN32) && !defined(__CYGWIN__) + closesocket(s); #else - closesocket(s); + close(s); #endif return NULL; } @@ -369,7 +369,7 @@ if (rt > 0) { if ((SAMPLERATE_SKYPIAX - 8000) == 0) { got = SAMPLES_PER_FRAME * sizeof(short); -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) skypiax_file_read(tech_pvt->audioskypepipe[0], cli_in, &got); #else /* WIN32 */ got = read(tech_pvt->audioskypepipe[0], cli_in, got); @@ -399,7 +399,7 @@ } } else if (SAMPLERATE_SKYPIAX == 16000) { got = SAMPLES_PER_FRAME * sizeof(short); -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) skypiax_file_read(tech_pvt->audioskypepipe[0], cli_in, &got); #else /* WIN32 */ got = read(tech_pvt->audioskypepipe[0], cli_in, got); @@ -436,19 +436,19 @@ } DEBUGA_SKYPE("Skype server GONE\n", SKYPIAX_P_LOG); -#ifndef WIN32 - close(fd); +#if defined(WIN32) && !defined(__CYGWIN__) + closesocket(s); #else - closesocket(fd); + close(fd); #endif break; } DEBUGA_SKYPE("client (I am it) GONE\n", SKYPIAX_P_LOG); -#ifndef WIN32 - close(s); -#else +#if defined(WIN32) && !defined(__CYGWIN__) closesocket(s); +#else + close(s); #endif if (option_debug > 100) { DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); @@ -459,7 +459,7 @@ int skypiax_skypeaudio_init(private_t * tech_pvt) { -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) switch_status_t rv; rv = switch_file_pipe_create(&tech_pvt->audiopipe[0], &tech_pvt->audiopipe[1], @@ -510,7 +510,7 @@ #endif /* WIN32 */ if (rt > 0) { samples = SAMPLES_PER_FRAME * sizeof(short); -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) skypiax_file_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, &samples); #else /* WIN32 */ samples = read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, samples); @@ -612,8 +612,13 @@ sizeof(msg_from_skype) - 2); howmany = strlen(msg_from_skype) + 1; +#if defined(WIN32) && !defined(__CYGWIN__) skypiax_file_write(tech_pvt->SkypiaxHandles.fdesc[1], msg_from_skype, &howmany); - //NOTICA("From Skype API: %s\n", SKYPIAX_P_LOG, (const char *) poCopyData->lpData); + //NOTICA("From Skype API: %s\n", SKYPIAX_P_LOG, msg_from_skype); +#else + howmany = write(tech_pvt->SkypiaxHandles.fdesc[1], msg_from_skype, howmany); + //NOTICA("From Skype API: %s\n", SKYPIAX_P_LOG, msg_from_skype); +#endif lReturnCode = 1; } break; @@ -758,9 +763,22 @@ /* destroy window class */ private_t *tech_pvt = obj; +#if defined(WIN32) && !defined(__CYGWIN__) + switch_status_t rv; switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0], &tech_pvt->SkypiaxHandles.fdesc[1], skypiax_module_pool); + rv = + switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0], &tech_pvt->SkypiaxHandles.fdesc[1], + skypiax_module_pool); +#else /* WIN32 */ + if (pipe(tech_pvt->SkypiaxHandles.fdesc)) { + fcntl(tech_pvt->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK); + fcntl(tech_pvt->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK); + } +#endif /* WIN32 */ + + tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach = RegisterWindowMessage("SkypeControlAPIAttach"); tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover = @@ -1156,7 +1174,7 @@ if (rt > 0) { if (tech_pvt->SkypiaxHandles.fdesc[0]) { howmany = sizeof(read_from_pipe); -#ifdef WIN32 +#if defined(WIN32) && !defined(__CYGWIN__) skypiax_file_read(tech_pvt->SkypiaxHandles.fdesc[0], read_from_pipe, &howmany); #else /* WIN32 */ howmany = @@ -1256,7 +1274,7 @@ if (!strcasecmp(id, tech_pvt->skype_user)) { tech_pvt->SkypiaxHandles.api_connected = 1; - //DEBUGA_SKYPE ("Skype MSG: messaggio: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n", SKYPIAX_P_LOG, messaggio, obj, id, tech_pvt->skype_user); + DEBUGA_SKYPE ("Skype MSG: messaggio: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n", SKYPIAX_P_LOG, messaggio, obj, id, tech_pvt->skype_user); } }
participants (1)
-
FreeSWITCH SVN