if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) {
#ifdef WIN32
skypopen_signaling_write(tech_pvt, "DIE");
- switch_sleep(10000);
+ switch_sleep(20000);
switch_file_write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", &howmany); // let's the controldev_thread die
#else /* WIN32 */
howmany = write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", howmany);
if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) {
XEvent e;
Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
- switch_sleep(1000);
+ switch_sleep(20000);
XFlush(tech_pvt->SkypopenHandles.disp);
memset(&e, 0, sizeof(e));
e.xclient.type = ClientMessage;
DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG);
conta = 0;
while (tech_pvt->tcp_srv_thread) {
- switch_sleep(5000);
+ switch_sleep(50000);
conta++;
- if (conta == 200) {
+ if (conta == 20) {
ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG);
break;
}
DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta);
conta = 0;
while (tech_pvt->tcp_cli_thread) {
- switch_sleep(5000);
+ switch_sleep(50000);
conta++;
- if (conta == 200) {
+ if (conta == 20) {
ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG);
break;
}
try = 0;
if (!bytes_read) {
- switch_sleep(1000);
+ switch_sleep(1000); //XXX don't like this
try++;
- if (try < 5)
+ if (try < 5){
+ DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG);
goto read;
- DEBUGA_SKYPE("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG);
+ }
+ WARNINGA("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG);
memset(tech_pvt->read_frame.data, 255, BYTES_PER_FRAME);
tech_pvt->read_frame.datalen = BYTES_PER_FRAME;
if (switch_channel_get_state(channel) == CS_RESET) {
return SWITCH_STATUS_FALSE;
}
- switch_sleep(5000);
+ switch_sleep(50000);
conta++;
- if (conta == 100) { //0.5 seconds
+ if (conta == 10) { //0.5 seconds
return SWITCH_STATUS_FALSE;
}
}
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
- tech_pvt->ob_calls++;
rdest = strchr(caller_profile->destination_number, '/');
*rdest++ = '\0';
caller_profile->destination_number = rdest;
switch_mutex_lock(tech_pvt->flag_mutex);
+ tech_pvt->ob_calls++;
switch_set_flag(tech_pvt, TFLAG_OUTBOUND);
switch_mutex_unlock(tech_pvt->flag_mutex);
switch_channel_set_state(channel, CS_INIT);
if (channel) {
switch_channel_state_t state = switch_channel_get_state(channel);
if (state < CS_EXECUTE) {
- switch_sleep(10000); //10 msec, let the state evolve from CS_NEW
+ switch_sleep(20000); //20 msec, let the state evolve from CS_NEW
}
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
} else {
DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG);
conta = 0;
while (tech_pvt->tcp_srv_thread) {
- switch_sleep(5000);
+ switch_sleep(50000);
conta++;
- if (conta == 200) {
+ if (conta == 20) {
ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG);
break;
}
DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta);
conta = 0;
while (tech_pvt->tcp_cli_thread) {
- switch_sleep(5000);
+ switch_sleep(50000);
conta++;
- if (conta == 200) {
+ if (conta == 20) {
ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG);
break;
}
} else {
DEBUGA_SKYPE("Initialized XInitThreads!\n", SKYPOPEN_P_LOG);
}
- switch_sleep(1000);
+ switch_sleep(20000);
#endif /* WIN32 */
if (interface_id && interface_id < SKYPOPEN_MAX_INTERFACES) {
SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].skype_user);
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "PROTOCOL 7");
- switch_sleep(10000);
+ switch_sleep(20000);
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET AUTOAWAY OFF");
- switch_sleep(10000);
+ switch_sleep(20000);
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET WINDOWSTATE HIDDEN");
- switch_sleep(10000);
+ switch_sleep(20000);
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET USERSTATUS ONLINE");
- switch_sleep(10000);
+ switch_sleep(20000);
if (globals.SKYPOPEN_INTERFACES[interface_id].silent_mode) {
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET SILENT_MODE ON");
- switch_sleep(10000);
+ switch_sleep(20000);
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET SILENT_MODE OFF");
- switch_sleep(10000);
+ switch_sleep(20000);
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET SILENT_MODE ON");
- switch_sleep(10000);
+ switch_sleep(20000);
}
} else {
ERRORA
snprintf(skype_msg, sizeof(skype_msg), "CHAT CREATE %s", to);
skypopen_signaling_write(tech_pvt, skype_msg);
- switch_sleep(1000);
+ switch_sleep(20000);
}
found = 0;
if (found) {
break;
}
- if (tried > 1000) {
+ tried++;
+ if (tried > 20) {
ERRORA("No chat with dialog_partner='%s' was found\n", SKYPOPEN_P_LOG, to);
break;
}
- switch_sleep(1000);
+ switch_sleep(50000);
}
}
if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) {
#ifdef WIN32
skypopen_signaling_write(tech_pvt, "DIE");
- switch_sleep(10000);
+ switch_sleep(20000);
switch_file_write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", &howmany); // let's the controldev_thread die
#else /* WIN32 */
skypopen_signaling_write(tech_pvt, "DIE");
- switch_sleep(10000);
+ switch_sleep(20000);
howmany = write(tech_pvt->SkypopenHandles.fdesc[1], "sciutati", howmany);
#endif /* WIN32 */
}
XEvent e;
Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
False);
- switch_sleep(1000);
+ switch_sleep(20000);
XFlush(tech_pvt->SkypopenHandles.disp);
memset(&e, 0, sizeof(e));
e.xclient.type = ClientMessage;
for (tmp_i = 0; tmp_i < SKYPOPEN_MAX_INTERFACES; tmp_i++) {
if (strlen(globals.SKYPOPEN_INTERFACES[tmp_i].name)) {
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE");
- switch_sleep(10000);
+ switch_sleep(20000);
strncpy(tmp_message, globals.SKYPOPEN_INTERFACES[tmp_i].message, sizeof(globals.SKYPOPEN_INTERFACES[tmp_i].message));
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE_CURRENCY");
- switch_sleep(10000);
+ switch_sleep(20000);
if(strlen(tmp_message)>21 && strlen(globals.SKYPOPEN_INTERFACES[tmp_i].message) > 30)
stream->write_function(stream, " %s \t%s\t%s\n", globals.SKYPOPEN_INTERFACES[tmp_i].name, tmp_message+21, globals.SKYPOPEN_INTERFACES[tmp_i].message+30);
}
stream->write_function(stream, "= ====\t ======== \t======= =======\t======\t============\t======\n");
for (i = 0; i < SKYPOPEN_MAX_INTERFACES; i++) {
+ if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) {
next_flag_char = i == globals.next_interface ? '*' : ' ';
ib += globals.SKYPOPEN_INTERFACES[i].ib_calls;
ib_failed += globals.SKYPOPEN_INTERFACES[i].ib_failed_calls;
ob += globals.SKYPOPEN_INTERFACES[i].ob_calls;
ob_failed += globals.SKYPOPEN_INTERFACES[i].ob_failed_calls;
- if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) {
stream->write_function(stream,
"%c %d\t[%s]\t%3u/%u\t%6u/%u\t%s\t%s\t%s\n",
next_flag_char,
interface_status[globals.SKYPOPEN_INTERFACES[i].interface_state],
skype_callflow[globals.SKYPOPEN_INTERFACES[i].skype_callflow], globals.SKYPOPEN_INTERFACES[i].session_uuid_str);
} else if (argc > 1 && !strcasecmp(argv[1], "full")) {
- stream->write_function(stream, "%c\t%d\n", next_flag_char, i);
+ stream->write_function(stream, "%c %d\n", next_flag_char, i);
}
}
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id);
skypopen_signaling_write(tech_pvt, msg_to_skype);
}
- switch_sleep(10000);
+ switch_sleep(20000);
DEBUGA_SKYPE
("We have NOT answered a Skype RING from skype_call %s, because we are already in a skypopen call (%s)\n",
SKYPOPEN_P_LOG, id, tech_pvt->skype_call_id);
SKYPOPEN_P_LOG);
skypopen_sleep(1000000);
skypopen_signaling_write(tech_pvt, "PROTOCOL 7");
- skypopen_sleep(10000);
+ skypopen_sleep(20000);
return 0;
}
if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) {
switch_core_timer_next(&tech_pvt->timer_read_srv);
+ } else {
+ skypopen_sleep(20000);
+
}
//rt = select(fdselect + 1, &fs, NULL, NULL, &to);
if (rt > 0) {
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
len = recv(fd, (char *) srv_in, BYTES_PER_FRAME * 2, 0);
} else {
- skypopen_sleep(10000);
+ //skypopen_sleep(10000);
continue;
}
if (tech_pvt->begin_to_read == 0) {
DEBUGA_SKYPE("len=%d\n", SKYPOPEN_P_LOG, len);
- skypopen_sleep(10000);
+ //skypopen_sleep(10000);
continue;
}
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next
&& tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED) {
switch_core_timer_next(&tech_pvt->timer_write);
+ } else {
+ skypopen_sleep(20000);
}
if (tech_pvt->begin_to_write == 0) {
DEBUGA_SKYPE("len=%d, error: %s\n", SKYPOPEN_P_LOG, len, strerror(errno));
break;
}
- skypopen_sleep(10000);
+ //skypopen_sleep(10000);
continue;
} else {
}
break;
case SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION:
- skypopen_sleep(5000);
+ skypopen_sleep(20000);
break;
case SKYPECONTROLAPI_ATTACH_REFUSED:
ERRORA("Skype client refused to be connected by Skypopen!\n", SKYPOPEN_P_LOG);
break;
case SKYPECONTROLAPI_ATTACH_API_AVAILABLE:
DEBUGA_SKYPE("Skype API available\n", SKYPOPEN_P_LOG);
- skypopen_sleep(5000);
+ skypopen_sleep(20000);
break;
default:
WARNINGA("GOT AN UNKNOWN SKYPE WINDOWS MSG\n", SKYPOPEN_P_LOG);
DEBUGA_SKYPE("NOT destroyed disp\n", SKYPOPEN_P_LOG);
}
DEBUGA_SKYPE("OUT destroyed disp\n", SKYPOPEN_P_LOG);
- skypopen_sleep(1000);
+ skypopen_sleep(20000);
}
void *skypopen_do_skypeapi_thread_func(void *obj)
SKYPOPEN_P_LOG, buf);
skypopen_sleep(1000000); //1 sec
}
- skypopen_sleep(1000); //0.1 msec
+ skypopen_sleep(20000); //20 msec
break;
}
}
if (continue_is_broken) {
XFlush(disp);
- skypopen_sleep(1000); //0.1 msec
+ skypopen_sleep(20000); //20 msec
+ WARNINGA("continue_is_broken\n", SKYPOPEN_P_LOG);
continue;
}
strcat(buffer, buf);