[Freeswitch-branches] [commit] r11576 - freeswitch/branches/gmaruzz/mod_skypiax
Author: gmaruzz Date: Sat Jan 31 03:25:47 2009 New Revision: 11576 Log: skypiax: moving switch specific things out of skypiax_protocol.c, and cosmetics Modified: 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/mod_skypiax.c ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Sat Jan 31 03:25:47 2009 @@ -706,6 +706,8 @@ uint32_t interface_id = 0, to = 0, max = 0; + tech_pvt = NULL; + for (param = switch_xml_child(myinterface, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); @@ -808,13 +810,16 @@ memset(&newconf, '\0', sizeof(newconf)); globals.SKYPIAX_INTERFACES[interface_id] = newconf; - DEBUGA_SKYPE("CONFIGURING interface_id=%d\n", SKYPIAX_P_LOG, interface_id); + + tech_pvt=&globals.SKYPIAX_INTERFACES[interface_id]; + switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].interface_id, id); if (name) { switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].name, name); } else { switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].name, "N/A"); } + DEBUGA_SKYPE("CONFIGURING interface_id=%d\n", SKYPIAX_P_LOG, interface_id); #ifdef WIN32 globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port = (unsigned short) atoi(tcp_cli_port); @@ -915,6 +920,8 @@ for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) { if (strlen(globals.SKYPIAX_INTERFACES[i].name)) { + tech_pvt = &globals.SKYPIAX_INTERFACES[i]; + DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].interface_id=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].interface_id); DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].X11_display=%s\n", @@ -1082,7 +1089,7 @@ skypiax_do_tcp_cli_thread, tech_pvt, skypiax_module_pool); DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG); - skypiax_sleep(100000); + switch_sleep(100000); return 0; Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h ============================================================================== --- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original) +++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Sat Jan 31 03:25:47 2009 @@ -245,7 +245,6 @@ int skypiax_skype_call(private_t * tech_pvt, char *idest, int timeout); int skypiax_skype_senddigit(private_t * tech_pvt, char digit); -#define skypiax_sleep switch_sleep 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 Sat Jan 31 03:25:47 2009 @@ -1,5 +1,9 @@ #include "skypiax.h" +#define skypiax_sleep switch_sleep +#define skypiax_file_write switch_file_write +#define skypiax_file_read switch_file_read + extern switch_memory_pool_t *skypiax_module_pool; extern int option_debug; extern switch_endpoint_interface_t *skypiax_endpoint_interface; @@ -145,7 +149,7 @@ howmany = len; #ifdef WIN32 - switch_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); + skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); #else /* WIN32 */ howmany = write(tech_pvt->audiopipe[1], totalbuf, howmany); #endif /* WIN32 */ @@ -170,7 +174,7 @@ unsigned int howmany; howmany = len; - switch_file_write(tech_pvt->audiopipe[1], srv_in, &howmany); + skypiax_file_write(tech_pvt->audiopipe[1], srv_in, &howmany); #else /* WIN32 */ len = write(tech_pvt->audiopipe[1], srv_in, len); #endif /* WIN32 */ @@ -191,7 +195,7 @@ } #ifdef WIN32 - switch_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); + skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, &howmany); #else /* WIN32 */ howmany = write(tech_pvt->audiopipe[1], totalbuf, howmany); #endif /* WIN32 */ @@ -222,14 +226,14 @@ } #ifdef WIN32 kill_cli_size = SAMPLES_PER_FRAME * sizeof(short); - switch_file_write(tech_pvt->audiopipe[1], kill_cli_buff, &kill_cli_size); + skypiax_file_write(tech_pvt->audiopipe[1], kill_cli_buff, &kill_cli_size); kill_cli_size = SAMPLES_PER_FRAME * sizeof(short); - switch_file_write(tech_pvt->audioskypepipe[1], kill_cli_buff, &kill_cli_size); + skypiax_file_write(tech_pvt->audioskypepipe[1], kill_cli_buff, &kill_cli_size); tech_pvt->interface_state = SKYPIAX_STATE_DOWN; kill_cli_size = SAMPLES_PER_FRAME * sizeof(short); - switch_file_write(tech_pvt->audiopipe[1], kill_cli_buff, &kill_cli_size); + skypiax_file_write(tech_pvt->audiopipe[1], kill_cli_buff, &kill_cli_size); kill_cli_size = SAMPLES_PER_FRAME * sizeof(short); - switch_file_write(tech_pvt->audioskypepipe[1], kill_cli_buff, &kill_cli_size); + skypiax_file_write(tech_pvt->audioskypepipe[1], kill_cli_buff, &kill_cli_size); #else /* WIN32 */ kill_cli_size = SAMPLES_PER_FRAME * sizeof(short); len = write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size); @@ -357,7 +361,7 @@ if ((SAMPLERATE_SKYPIAX - 8000) == 0) { got = SAMPLES_PER_FRAME * sizeof(short); #ifdef WIN32 - switch_file_read(tech_pvt->audioskypepipe[0], cli_in, &got); + skypiax_file_read(tech_pvt->audioskypepipe[0], cli_in, &got); #else /* WIN32 */ got = read(tech_pvt->audioskypepipe[0], cli_in, got); #endif /* WIN32 */ @@ -387,7 +391,7 @@ } else if (SAMPLERATE_SKYPIAX == 16000) { got = SAMPLES_PER_FRAME * sizeof(short); #ifdef WIN32 - switch_file_read(tech_pvt->audioskypepipe[0], cli_in, &got); + skypiax_file_read(tech_pvt->audioskypepipe[0], cli_in, &got); #else /* WIN32 */ got = read(tech_pvt->audioskypepipe[0], cli_in, got); #endif /* WIN32 */ @@ -495,7 +499,7 @@ if (rt > 0) { samples = SAMPLES_PER_FRAME * sizeof(short); #ifdef WIN32 - switch_file_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, &samples); + 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); #endif /* WIN32 */ @@ -596,7 +600,7 @@ sizeof(msg_from_skype) - 2); howmany = strlen(msg_from_skype) + 1; - switch_file_write(tech_pvt->SkypiaxHandles.fdesc[1], msg_from_skype, &howmany); + 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); lReturnCode = 1; } @@ -778,8 +782,6 @@ } } - //switch_thread_exit(thread, SWITCH_STATUS_SUCCESS); - return NULL; } @@ -1134,7 +1136,7 @@ if (tech_pvt->SkypiaxHandles.fdesc[0]) { howmany = sizeof(read_from_pipe); #ifdef WIN32 - switch_file_read(tech_pvt->SkypiaxHandles.fdesc[0], read_from_pipe, &howmany); + skypiax_file_read(tech_pvt->SkypiaxHandles.fdesc[0], read_from_pipe, &howmany); #else /* WIN32 */ howmany = read(tech_pvt->SkypiaxHandles.fdesc[0], read_from_pipe, sizeof(read_from_pipe));
participants (1)
-
FreeSWITCH SVN