Author: gmaruzz Date: Thu Feb 12 08:49:13 2009 New Revision: 11923 Log: skypiax: cleaning Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c freeswitch/branches/gmaruzz/mod_skypiax/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 Thu Feb 12 08:49:13 2009 @@ -36,7 +36,7 @@ " chan_skypiax adds to Asterisk the following CLI commands:\n" " \n" " CLI COMMANDS:\n" " skypiax_hangup\n" " skypiax_dial\n" " skypiax_console\n" " skypiax_playback_boost\n" - " skypiax_capture_boost\n" " skypiax_skype\n" + " skypiax_capture_boost\n" " skypiax_\n" " skypiax_dir_import\n" "\n" " You can type 'help [command]' to obtain more specific info on usage.\n" " \n"; @@ -67,7 +67,7 @@ " If the parameter is \"show\", the available interfaces are listed\n"; char skypiax_console_skype_usage[] = - "Usage: skypiax_skype [command string]\n" + "Usage: skypiax_ [command string]\n" " Send the 'command string' skype_msg to the Skype client connected to the \"current\" skypiax_console (Skypiax) channel.\n" " Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n"; @@ -140,7 +140,7 @@ skypiax_console_capture_boost_usage}, {{"skypiax_usage", NULL}, skypiax_console_skypiax, "chan_skypiax commands info", skypiax_console_skypiax_usage}, - {{"skypiax_skype", NULL}, skypiax_console_skype, "Skype msg", + {{"skypiax_", NULL}, skypiax_console_skype, "Skype msg", skypiax_console_skype_usage}, {{"skypiax_dial", NULL}, skypiax_console_dial, "Dial an extension on the skypiax_console", @@ -510,7 +510,7 @@ } #endif /* ASTERISK_VERSION_1_4 */ -//struct ast_frame *skypiax_skypeaudio_read(struct skypiax_pvt *p) +//struct ast_frame *skypiax_audio_read(struct skypiax_pvt *p) //#define SAMPLES_PER_FRAME 160 /*! \brief Read audio frames from channel */ struct ast_frame *skypiax_read(struct ast_channel *c) @@ -609,7 +609,7 @@ idest, timeout, dstr); strcpy(p->session_uuid_str, "dialing"); - status = skypiax_skype_call(p, dstr, timeout); + status = skypiax__call(p, dstr, timeout); if (status) { WARNINGA("skypiax_call dialing failed: %d!\n", SKYPIAX_P_LOG, status); return -1; @@ -813,7 +813,7 @@ ast_log(LOG_ERROR, "Not initialized XInitThreads!\n"); #endif /* __CYGWIN__ */ #if 0 - ast_register_atexit(skypiax_skype_disconnect); + ast_register_atexit(skypiax__disconnect); ast_register_application(skype2skypiaxapp, skype2skypiax, skype2skypiaxsynopsis, skype2skypiaxdescrip); ast_register_application(skypiax2skypeapp, skypiax2skype, skypiax2skypesynopsis, @@ -927,7 +927,7 @@ //FIXME what to do? ast_log(LOG_ERROR, "Not initialized XInitThreads!\n"); #endif /* __CYGWIN__ */ #if 0 - ast_unregister_atexit(skypiax_skype_disconnect); + ast_unregister_atexit(skypiax__disconnect); ast_unregister_application(skype2skypiaxapp); ast_unregister_application(skypiax2skypeapp); #endif @@ -1509,7 +1509,7 @@ int skypiax_sound_init(struct skypiax_pvt *p) { - return skypiax_skypeaudio_init(p); + return skypiax_audio_init(p); } /*! @@ -1535,7 +1535,7 @@ struct ast_frame *f = NULL; int res; - res = skypiax_skypeaudio_read(p); + res = skypiax_audio_read(p); f = &p->read_frame; return f; } @@ -1545,7 +1545,7 @@ { int ret = -1; - ret = skypiax_skypeaudio_write(p, f); + ret = skypiax_audio_write(p, f); return ret; } @@ -1908,7 +1908,7 @@ return skypiax_do_tcp_cli_thread_func(obj); } -int skypiax_skypeaudio_write(struct skypiax_pvt *p, struct ast_frame *f) +int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f) { int sent; @@ -1927,7 +1927,7 @@ } if (!p) { ast_cli(fd, - "No \"current\" console for skypiax_skype, please enter 'help console'\n"); + "No \"current\" console for skypiax_, please enter 'help console'\n"); return RESULT_SUCCESS; } if (!p->skype) { 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 Thu Feb 12 08:49:13 2009 @@ -316,16 +316,16 @@ void *do_skypeapi_thread(void *data); //int skypiax2skype(struct ast_channel *c, void *data); //int skype2skypiax(struct ast_channel *c, void *data); -//void skypiax_skype_disconnect(void); +//void skypiax__disconnect(void); int skypiax_signaling_write(struct skypiax_pvt *p, char *msg_to_skype); int skypiax_signaling_read(struct skypiax_pvt *p); int skypiax_console_skype(int fd, int argc, char *argv[]); #ifdef WANT_SKYPE_X11 int X11_errors_handler(Display * dpy, XErrorEvent * err); -int skypiax_skype_send_message(struct SkypiaxHandles *SkypiaxHandles, +int skypiax__send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P); -int skypiax_skype_present(struct SkypiaxHandles *SkypiaxHandles); -void skypiax_skype_clean_disp(void *data); +int skypiax__present(struct SkypiaxHandles *SkypiaxHandles); +void skypiax__clean_disp(void *data); #endif /* WANT_SKYPE_X11 */ #ifdef __CYGWIN__ @@ -386,13 +386,13 @@ int skypiax_console_capture_boost(int fd, int argc, char *argv[]); int skypiax_console_skypiax(int fd, int argc, char *argv[]); int skypiax_console_dial(int fd, int argc, char *argv[]); -int skypiax_skypeaudio_init(struct skypiax_pvt *p); -//struct ast_frame *skypiax_skypeaudio_read(struct skypiax_pvt *p); -int skypiax_skypeaudio_read(struct skypiax_pvt *p); +int skypiax_audio_init(struct skypiax_pvt *p); +//struct ast_frame *skypiax_audio_read(struct skypiax_pvt *p); +int skypiax_audio_read(struct skypiax_pvt *p); void *skypiax_do_tcp_srv_thread(void *data); -int skypiax_skypeaudio_write(struct skypiax_pvt *p, struct ast_frame *f); +int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f); void *skypiax_do_tcp_cli_thread(void *data); -int skypiax_skype_call(struct skypiax_pvt *p, char *idest, int timeout); +int skypiax__call(struct skypiax_pvt *p, char *idest, int timeout); int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]); void *skypiax_do_tcp_srv_thread_func(void *obj); @@ -402,7 +402,7 @@ int start_audio_threads(private_t * tech_pvt); int new_inbound_channel(private_t * tech_pvt); int outbound_channel_answered(private_t * tech_pvt); -int skypiax_skype_senddigit(struct skypiax_pvt *p, char digit); +int skypiax__senddigit(struct skypiax_pvt *p, char digit); int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype); #if defined(WIN32) && !defined(__CYGWIN__) int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany); 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 Thu Feb 12 08:49:13 2009 @@ -270,7 +270,7 @@ DEBUGA_SKYPE("DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit); - skypiax_skype_senddigit(tech_pvt, dtmf->digit); + skypiax__senddigit(tech_pvt, dtmf->digit); return SWITCH_STATUS_SUCCESS; } @@ -291,9 +291,9 @@ tech_pvt->read_frame.flags = SFF_NONE; *frame = NULL; - if (!skypiax_skypeaudio_read(tech_pvt)) { + if (!skypiax_audio_read(tech_pvt)) { - ERRORA("skypiax_skypeaudio_read ERROR\n", SKYPIAX_P_LOG); + ERRORA("skypiax_audio_read ERROR\n", SKYPIAX_P_LOG); } else { switch_set_flag_locked(tech_pvt, TFLAG_VOICE); @@ -562,7 +562,7 @@ rdest = strchr(caller_profile->destination_number, '/'); *rdest++ = '\0'; - skypiax_skype_call(tech_pvt, rdest, 30); + skypiax__call(tech_pvt, rdest, 30); switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(*new_session), @@ -813,7 +813,7 @@ if (interface_id && interface_id < SKYPIAX_MAX_INTERFACES) { private_t newconf; - switch_threadattr_t *skypiax_skypeapi_thread_attr = NULL; + switch_threadattr_t *skypiax_api_thread_attr = NULL; switch_threadattr_t *skypiax_signaling_thread_attr = NULL; memset(&newconf, '\0', sizeof(newconf)); @@ -882,11 +882,11 @@ SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context); NOTICA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id); - switch_threadattr_create(&skypiax_skypeapi_thread_attr, skypiax_module_pool); - switch_threadattr_stacksize_set(skypiax_skypeapi_thread_attr, + switch_threadattr_create(&skypiax_api_thread_attr, skypiax_module_pool); + switch_threadattr_stacksize_set(skypiax_api_thread_attr, SWITCH_THREAD_STACKSIZE); switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id]. - skypiax_skypeapi_thread, skypiax_skypeapi_thread_attr, + skypiax_api_thread, skypiax_api_thread_attr, skypiax_do_skypeapi_thread, &globals.SKYPIAX_INTERFACES[interface_id], skypiax_module_pool); @@ -904,7 +904,7 @@ switch_sleep(100000); - skypiax_skypeaudio_init(&globals.SKYPIAX_INTERFACES[interface_id]); + skypiax_audio_init(&globals.SKYPIAX_INTERFACES[interface_id]); i = 0; while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 60000) { // 60sec FIXME @@ -999,9 +999,9 @@ #endif /* WIN32 */ } - if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_skypeapi_thread) { + if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) { #ifdef WIN32 - if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_skypeapi_thread_func die + if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_api_thread_func die DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError()); } #else @@ -1030,10 +1030,10 @@ globals.SKYPIAX_INTERFACES[interface_id]. skypiax_signaling_thread); } - if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_skypeapi_thread) { + if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) { switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id]. - skypiax_skypeapi_thread); + skypiax_api_thread); } } return SWITCH_STATUS_SUCCESS; Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Thu Feb 12 08:49:13 2009 @@ -212,7 +212,7 @@ switch_thread_t *tcp_srv_thread; switch_thread_t *tcp_cli_thread; switch_thread_t *skypiax_signaling_thread; - switch_thread_t *skypiax_skypeapi_thread; + switch_thread_t *skypiax_api_thread; short audiobuf[SAMPLES_PER_FRAME]; int audiobuf_is_loaded; @@ -234,16 +234,16 @@ typedef struct private_object private_t; -void *SWITCH_THREAD_FUNC skypiax_skypeapi_thread_func(switch_thread_t * thread, +void *SWITCH_THREAD_FUNC skypiax_api_thread_func(switch_thread_t * thread, void *obj); void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session); -int skypiax_skypeaudio_read(private_t * tech_pvt); -int skypiax_skypeaudio_init(private_t * tech_pvt); +int skypiax_audio_read(private_t * tech_pvt); +int skypiax_audio_init(private_t * tech_pvt); int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype); int skypiax_signaling_read(private_t * tech_pvt); -int skypiax_skype_call(private_t * tech_pvt, char *idest, int timeout); -int skypiax_skype_senddigit(private_t * tech_pvt, char digit); +int skypiax__call(private_t * tech_pvt, char *idest, int timeout); +int skypiax__senddigit(private_t * tech_pvt, char digit); void *skypiax_do_tcp_srv_thread_func(void *obj); void *SWITCH_THREAD_FUNC skypiax_do_tcp_srv_thread(switch_thread_t * thread, void *obj); 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 Thu Feb 12 08:49:13 2009 @@ -687,7 +687,7 @@ return NULL; } -int skypiax_skypeaudio_read(private_t * tech_pvt) +int skypiax_audio_read(private_t * tech_pvt) { unsigned int samples; @@ -707,7 +707,7 @@ return 1; } -int skypiax_skype_senddigit(private_t * tech_pvt, char digit) +int skypiax__senddigit(private_t * tech_pvt, char digit) { char msg_to_skype[1024]; @@ -718,7 +718,7 @@ return 0; } -int skypiax_skype_call(private_t * tech_pvt, char *rdest, int timeout) +int skypiax__call(private_t * tech_pvt, char *rdest, int timeout) { char msg_to_skype[1024]; @@ -774,7 +774,7 @@ return res; } -int skypiax_skypeaudio_init(private_t * tech_pvt) +int skypiax_audio_init(private_t * tech_pvt) { switch_status_t rv; rv = @@ -805,7 +805,7 @@ return res; } -int skypiax_skypeaudio_init(private_t * tech_pvt) +int skypiax_audio_init(private_t * tech_pvt) { if (pipe(tech_pvt->audiopipe)) { fcntl(tech_pvt->audiopipe[0], F_SETFL, O_NONBLOCK); @@ -897,7 +897,7 @@ } -LRESULT APIENTRY skypiax_skype_present(HWND hWindow, UINT uiMessage, WPARAM uiParam, +LRESULT APIENTRY skypiax__present(HWND hWindow, UINT uiMessage, WPARAM uiParam, LPARAM ulParam) { LRESULT lReturnCode; @@ -1016,7 +1016,7 @@ (char *) paucUUIDString); oWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; - oWindowClass.lpfnWndProc = (WNDPROC) & skypiax_skype_present; + oWindowClass.lpfnWndProc = (WNDPROC) & skypiax__present; oWindowClass.cbClsExtra = 0; oWindowClass.cbWndExtra = 0; oWindowClass.hInstance = tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle; @@ -1141,7 +1141,7 @@ return (xerror != BadValue) && (xerror != BadWindow); } -int skypiax_skype_send_message(struct SkypiaxHandles *SkypiaxHandles, +int skypiax__send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P) { @@ -1197,7 +1197,7 @@ SkypiaxHandles = &tech_pvt->SkypiaxHandles; - if (!skypiax_skype_send_message(SkypiaxHandles, msg_to_skype)) { + if (!skypiax__send_message(SkypiaxHandles, msg_to_skype)) { ERRORA ("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then restart Skype, then launch Skypiax and try again.\n", SKYPIAX_P_LOG); @@ -1208,7 +1208,7 @@ } -int skypiax_skype_present(struct SkypiaxHandles *SkypiaxHandles) +int skypiax__present(struct SkypiaxHandles *SkypiaxHandles) { Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True); @@ -1242,7 +1242,7 @@ return 1; } -void skypiax_skype_clean_disp(void *data) +void skypiax__clean_disp(void *data) { int *dispptr; @@ -1303,7 +1303,7 @@ SkypiaxHandles->disp = disp; - if (skypiax_skype_present(SkypiaxHandles)) { + if (skypiax__present(SkypiaxHandles)) { root = DefaultRootWindow(disp); win = XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0, @@ -1315,7 +1315,7 @@ snprintf(buf, 512, "NAME skypiax"); - if (!skypiax_skype_send_message(SkypiaxHandles, buf)) { + if (!skypiax__send_message(SkypiaxHandles, buf)) { ERRORA ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG); @@ -1324,7 +1324,7 @@ } snprintf(buf, 512, "PROTOCOL 7"); - if (!skypiax_skype_send_message(SkypiaxHandles, buf)) { + if (!skypiax__send_message(SkypiaxHandles, buf)) { ERRORA ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);