if (switch_core_codec_init
(&tech_pvt->read_codec, "L16", NULL, sample_rate, codec_ms, 1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
- ERRORA("Can't load codec?\n", SKYPOPEN_P_LOG);
+ ERRORA("skypopen_codec: Can't load codec?\n", SKYPOPEN_P_LOG);
return SWITCH_STATUS_FALSE;
}
if (switch_core_codec_init
(&tech_pvt->write_codec, "L16", NULL, sample_rate, codec_ms, 1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
- ERRORA("Can't load codec?\n", SKYPOPEN_P_LOG);
+ ERRORA("skypopen_codec: Can't load codec?\n", SKYPOPEN_P_LOG);
switch_core_codec_destroy(&tech_pvt->read_codec);
return SWITCH_STATUS_FALSE;
}
switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
switch_core_session_rwunlock(session);
} else {
- ERRORA("no session\n", SKYPOPEN_P_LOG);
+ ERRORA("skypopen_codec: no session\n", SKYPOPEN_P_LOG);
return SWITCH_STATUS_FALSE;
}
+ DEBUGA_SKYPE("codecs UP\n", SKYPOPEN_P_LOG);
return SWITCH_STATUS_SUCCESS;
}
switch_core_session_set_private(session, tech_pvt);
switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str));
if (!strlen(tech_pvt->session_uuid_str)) {
- ERRORA("no tech_pvt->session_uuid_str\n", SKYPOPEN_P_LOG);
+ ERRORA("skypopen_tech_init: no tech_pvt->session_uuid_str\n", SKYPOPEN_P_LOG);
return SWITCH_STATUS_FALSE;
}
if (skypopen_codec(tech_pvt, SAMPLERATE_SKYPOPEN, 20) != SWITCH_STATUS_SUCCESS) {
- ERRORA("skypopen_codec FAILED\n", SKYPOPEN_P_LOG);
+ ERRORA("skypopen_tech_init: skypopen_codec FAILED\n", SKYPOPEN_P_LOG);
return SWITCH_STATUS_FALSE;
}
}
switch_mutex_unlock(tech_pvt->flag_mutex);
- if (switch_core_codec_ready(&tech_pvt->read_codec)) {
- switch_core_codec_destroy(&tech_pvt->read_codec);
- }
-
- if (switch_core_codec_ready(&tech_pvt->write_codec)) {
- switch_core_codec_destroy(&tech_pvt->write_codec);
- }
-
- if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
- switch_core_timer_destroy(&tech_pvt->timer_read);
- }
-
- if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
- switch_core_timer_destroy(&tech_pvt->timer_write);
- }
-
- if (tech_pvt->read_buffer) {
- switch_buffer_destroy(&tech_pvt->read_buffer);
- }
- if (tech_pvt->write_buffer) {
- switch_buffer_destroy(&tech_pvt->write_buffer);
- }
-
DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG);
conta=0;
while(tech_pvt->tcp_srv_thread){
}
DEBUGA_SKYPE("audio tcp cli thread DEAD %d\n", SKYPOPEN_P_LOG, conta);
+
+ if (switch_core_codec_ready(&tech_pvt->read_codec)) {
+ switch_core_codec_destroy(&tech_pvt->read_codec);
+ }
+
+ if (switch_core_codec_ready(&tech_pvt->write_codec)) {
+ switch_core_codec_destroy(&tech_pvt->write_codec);
+ }
+
+ DEBUGA_SKYPE("codecs DOWN\n", SKYPOPEN_P_LOG);
+ if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
+ switch_core_timer_destroy(&tech_pvt->timer_read);
+ }
+
+ if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
+ switch_core_timer_destroy(&tech_pvt->timer_write);
+ }
+
+ if (tech_pvt->read_buffer) {
+ switch_buffer_destroy(&tech_pvt->read_buffer);
+ }
+ if (tech_pvt->write_buffer) {
+ switch_buffer_destroy(&tech_pvt->write_buffer);
+ }
//DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG);
switch_mutex_lock(tech_pvt->mutex_thread_audio_cli);
//DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG);
tech_pvt = &globals.SKYPOPEN_INTERFACES[interface_id];
skype_state = tech_pvt->interface_state;
//DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].name, skype_state);
- if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1)
- && (SKYPOPEN_STATE_DOWN == skype_state || 0 == skype_state) && (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED
- || 0 == tech_pvt->skype_callflow)) {
+ if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1)
+ //&& (SKYPOPEN_STATE_DOWN == skype_state || 0 == skype_state) && (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED || 0 == tech_pvt->skype_callflow)) {}
+ && (SKYPOPEN_STATE_IDLE == skype_state)) {
DEBUGA_SKYPE("returning as available skype interface name: %s, state: %d callflow: %d\n", SKYPOPEN_P_LOG, tech_pvt->name, skype_state,
tech_pvt->skype_callflow);
if (tech_pvt_calling == NULL) {
if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) {
giovatech = &globals.SKYPOPEN_INTERFACES[i];
- /* let's look for a DOWN one */
- if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
+ /* let's look for a IDLE one */
+ //if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) {} //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
+ if ((giovatech->interface_state == SKYPOPEN_STATE_IDLE) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
found = 1;
DEBUGA_SKYPE
("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n",
sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypopen_interface->skype_user);
skypopen_signaling_write(tech_pvt, msg_to_skype);
if (tech_pvt->interface_state == SKYPOPEN_STATE_SELECTED) {
- tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; //we marked it SKYPOPEN_STATE_SELECTED just in case it has to make an outbound call
+ //FIXME why this? tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; //we marked it SKYPOPEN_STATE_SELECTED just in case it has to make an outbound call
}
} else {
/* no skypopen interfaces idle, do nothing */
("Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. Let's the previous one to continue.\n",
SKYPOPEN_P_LOG, message);
} else if (!strncasecmp(message, "ERROR 99 CALL", 12)) {
- WARNINGA("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message);
+ DEBUGA_SKYPE("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message);
tech_pvt->interface_state = SKYPOPEN_STATE_ERROR_DOUBLE_CALL;
} else if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) {
NOTICA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message);
return CALLFLOW_INCOMING_HANGUP;
} else if (!strncasecmp(message, "ERROR 589 ALTER CALL", 19)) {
char msg_to_skype[256];
- WARNINGA("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message);
+ DEBUGA_SKYPE("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message);
if(strlen(tech_pvt->skype_call_id)){
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
skypopen_signaling_write(tech_pvt, msg_to_skype);
skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPOPEN_P_LOG, id);
if (remote_party_is_ringing(tech_pvt) != SWITCH_STATUS_SUCCESS) {
- WARNINGA("We are getting the RINGING from a call we probably canceled, trying to get out hanging up call id: %s.\n",
+ DEBUGA_SKYPE("We are getting the RINGING from a call we probably canceled, trying to get out hanging up call id: %s.\n",
SKYPOPEN_P_LOG, id);
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
skypopen_signaling_write(tech_pvt, msg_to_skype);
// CLOUDTREE (Thomas Hazel)
tech_pvt->ringing_state = SKYPOPEN_RINGING_INIT;
tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE;
- tech_pvt->interface_state = SKYPOPEN_STATE_IDLE;
- WARNINGA("we're back to IDLE\n", SKYPOPEN_P_LOG);
- skypopen_sleep(10000);
+ tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
+ DEBUGA_SKYPE("we're now DOWN\n", SKYPOPEN_P_LOG);
+ return CALLFLOW_INCOMING_HANGUP;
+ //skypopen_sleep(10000);
}
} else {
} else if (!strcasecmp(value, "LOCALHOLD")) {
char msg_to_skype[256];
- WARNINGA("skype_call: %s is now LOCALHOLD, let's hangup\n", SKYPOPEN_P_LOG, id);
+ DEBUGA_SKYPE("skype_call: %s is now LOCALHOLD, let's hangup\n", SKYPOPEN_P_LOG, id);
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id);
skypopen_signaling_write(tech_pvt, msg_to_skype);
} else if (!strcasecmp(value, "REMOTEHOLD")) {