[commit] r11709 - freeswitch/branches/gmaruzz/mod_skypiax
Author: gmaruzz Date: Mon Feb 9 11:23:01 2009 New Revision: 11709 Log: skypiax: cleaning skypiax_protocol.c 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 Mon Feb 9 11:23:01 2009 @@ -25,7 +25,6 @@ switch_mutex_t *mutex; } globals; -int option_debug = 100; switch_endpoint_interface_t *skypiax_endpoint_interface; switch_memory_pool_t *skypiax_module_pool = NULL; int running = 0; @@ -95,7 +94,6 @@ void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session) { - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); tech_pvt->read_frame.data = tech_pvt->databuf; tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf); switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, @@ -111,7 +109,6 @@ DEBUGA_SKYPE("skypiax_codec SUCCESS\n", SKYPIAX_P_LOG); } - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); } /* @@ -585,7 +582,6 @@ int res; int forever = 1; - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG, (void *) tech_pvt); @@ -623,7 +619,6 @@ memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str)); } } - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); return NULL; } @@ -971,7 +966,6 @@ skypiax_endpoint_interface->io_routines = &skypiax_io_routines; 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; 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 Mon Feb 9 11:23:01 2009 @@ -11,10 +11,10 @@ extern switch_endpoint_interface_t *skypiax_endpoint_interface; #endif /* ASTERISK */ -extern int option_debug; extern int running; /*************************************/ +/* suspicious globals FIXME */ #ifdef WIN32 DWORD win32_dwThreadId; #else @@ -45,9 +45,6 @@ short kill_cli_buff[SAMPLES_PER_FRAME]; short totalbuf[SAMPLES_PER_FRAME]; - if (option_debug > 100) { - DEBUGA_SKYPE("ENTERING FUNC\n", SKYPIAX_P_LOG); - } memset(&my_addr, 0, sizeof(my_addr)); my_addr.sin_family = AF_INET; my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */ @@ -55,17 +52,11 @@ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { ERRORA("socket Error\n", SKYPIAX_P_LOG); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return NULL; } if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) { ERRORA("bind Error\n", SKYPIAX_P_LOG); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return NULL; } DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG); @@ -183,9 +174,6 @@ DEBUGA_SKYPE("incoming audio server (I am it) GONE\n", SKYPIAX_P_LOG); skypiax_close_socket(s); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return NULL; } @@ -208,9 +196,6 @@ unsigned int sin_size; #endif /* WIN32 */ - if (option_debug > 100) { - DEBUGA_SKYPE("ENTERING FUNC\n", SKYPIAX_P_LOG); - } memset(&my_addr, 0, sizeof(my_addr)); my_addr.sin_family = AF_INET; my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */ @@ -218,17 +203,11 @@ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { ERRORA("socket Error\n", SKYPIAX_P_LOG); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return NULL; } if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) { ERRORA("bind Error\n", SKYPIAX_P_LOG); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } skypiax_close_socket(s); return NULL; } @@ -321,9 +300,6 @@ DEBUGA_SKYPE("outbound audio server (I am it) GONE\n", SKYPIAX_P_LOG); skypiax_close_socket(s); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return NULL; } @@ -391,9 +367,6 @@ struct timeval to; #endif /* WIN32 */ - if (option_debug > 100) { - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); - } memset(read_from_pipe, 0, 4096); memset(messaggio, 0, 4096); @@ -442,14 +415,10 @@ ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n", SKYPIAX_P_LOG, messaggio); tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; - if (option_debug) DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG); tech_pvt->skype_call_id[0] = '\0'; if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) { - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } tech_pvt->interface_state = SKYPIAX_STATE_DOWN; return CALLFLOW_INCOMING_HANGUP; } else { @@ -487,14 +456,10 @@ if (!strcasecmp(messaggio, "ERROR")) { ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, messaggio); tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; - if (option_debug) DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG); tech_pvt->skype_call_id[0] = '\0'; if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) { - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } tech_pvt->interface_state = SKYPIAX_STATE_DOWN; return CALLFLOW_INCOMING_HANGUP; } else { @@ -596,7 +561,6 @@ where = strsep(stringp, " "); - if (option_debug > 101) DEBUGA_SKYPE ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n", SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL"); @@ -643,7 +607,6 @@ if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) { if (strcasecmp(id, tech_pvt->skype_call_id)) { strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); - if (option_debug > 1) DEBUGA_SKYPE ("We called a Skype contact and he answered us on skype_call: %s.\n", SKYPIAX_P_LOG, id); @@ -674,7 +637,6 @@ skypiax_sleep(10000); sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id); skypiax_skype_write(tech_pvt, msg_to_skype); - if (option_debug) DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG, id); strncpy(tech_pvt->skype_call_id, id, @@ -710,14 +672,10 @@ } else if (!strcasecmp(value, "FINISHED")) { //tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; - if (option_debug) DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id); tech_pvt->skype_call_id[0] = '\0'; if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) { - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } //tech_pvt->interface_state = SKYPIAX_STATE_DOWN; return CALLFLOW_INCOMING_HANGUP; } else { @@ -726,16 +684,12 @@ } else if (!strcasecmp(value, "CANCELLED")) { tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED; - if (option_debug) DEBUGA_SKYPE ("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n", SKYPIAX_P_LOG, id); tech_pvt->skype_call_id[0] = '\0'; if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) { - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } tech_pvt->interface_state = SKYPIAX_STATE_DOWN; return CALLFLOW_INCOMING_HANGUP; } else { @@ -743,22 +697,17 @@ } } else if (!strcasecmp(value, "FAILED")) { tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED; - if (option_debug) DEBUGA_SKYPE ("we tried to call Skype on skype_call %s and Skype has now FAILED\n", SKYPIAX_P_LOG, id); tech_pvt->skype_call_id[0] = '\0'; strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); tech_pvt->interface_state = SKYPIAX_STATE_DOWN; - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return CALLFLOW_INCOMING_HANGUP; } else if (!strcasecmp(value, "REFUSED")) { if (!strcasecmp(id, tech_pvt->skype_call_id)) { /* this is the id of the call we are in, probably we generated it */ tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED; - if (option_debug) DEBUGA_SKYPE ("we tried to call Skype on skype_call %s and Skype has now REFUSED\n", SKYPIAX_P_LOG, id); @@ -766,9 +715,6 @@ sizeof(tech_pvt->skype_call_id) - 1); tech_pvt->interface_state = SKYPIAX_STATE_DOWN; tech_pvt->skype_call_id[0] = '\0'; - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return CALLFLOW_INCOMING_HANGUP; } else { /* we're here because were us that refused an incoming call */ @@ -825,19 +771,12 @@ } } - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } - //DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); return 0; } int skypiax_skype_senddigit(private_t * tech_pvt, char digit) { char msg_to_skype[1024]; - if (option_debug > 10) { - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); - } DEBUGA_SKYPE("DIGIT received: %c\n", SKYPIAX_P_LOG, digit); @@ -845,9 +784,6 @@ skypiax_skype_write(tech_pvt, msg_to_skype); - if (option_debug > 10) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return 0; } @@ -855,9 +791,6 @@ { char msg_to_skype[1024]; - if (option_debug > 10) { - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); - } skypiax_sleep(5000); DEBUGA_SKYPE("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest); skypiax_skype_write(tech_pvt, "SET AGC OFF"); @@ -869,9 +802,6 @@ if (skypiax_skype_write(tech_pvt, msg_to_skype) < 0) { ERRORA("failed to communicate with Skype client, now exit\n", SKYPIAX_P_LOG); - if (option_debug > 10) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return -1; } return 0; @@ -988,11 +918,7 @@ DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype); - if (option_debug > 100) { - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); - } sprintf(acInputRow, "%s", msg_to_skype); - if (option_debug > 100) DEBUGA_SKYPE("acInputRow: |||%s||||\n", SKYPIAX_P_LOG, acInputRow); /* send command to skype */ oCopyData.dwData = 0; @@ -1006,16 +932,10 @@ ERRORA ("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then launch Skypiax and try again.\n", SKYPIAX_P_LOG); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return -1; } } - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return 0; } @@ -1319,24 +1239,15 @@ DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype); - if (option_debug > 100) { - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); - } SkypiaxHandles = &tech_pvt->SkypiaxHandles; if (!skypiax_skype_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); - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return -1; } - if (option_debug > 100) { - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); - } return 0; } @@ -1407,7 +1318,6 @@ Window root = -1; Window win = -1; - DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG); if (!strlen(tech_pvt->X11_display)) strcpy(tech_pvt->X11_display, getenv("DISPLAY")); @@ -1455,7 +1365,6 @@ ERRORA ("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; } @@ -1465,7 +1374,6 @@ ERRORA ("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; } @@ -1517,7 +1425,6 @@ running = 0; return NULL; } - DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG); running = 0; return NULL;
participants (1)
-
FreeSWITCH SVN