mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 17:22:21 +00:00
skypopen: indented
This commit is contained in:
parent
bc067ebc69
commit
38215f9d5c
@ -447,9 +447,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
switch_channel_set_variable(channel, "skype_user", tech_pvt->skype_user);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_set_flag(tech_pvt, TFLAG_IO);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
|
||||
/* Move channel's state machine to ROUTING. This means the call is trying
|
||||
to get from the initial start where the call because, to the point
|
||||
@ -484,21 +484,21 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
|
||||
DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG);
|
||||
conta=0;
|
||||
while(tech_pvt->tcp_srv_thread){
|
||||
conta = 0;
|
||||
while (tech_pvt->tcp_srv_thread) {
|
||||
switch_sleep(5000);
|
||||
conta++;
|
||||
if(conta==200){
|
||||
if (conta == 200) {
|
||||
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){
|
||||
conta = 0;
|
||||
while (tech_pvt->tcp_cli_thread) {
|
||||
switch_sleep(5000);
|
||||
conta++;
|
||||
if(conta==200){
|
||||
if (conta == 200) {
|
||||
ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG);
|
||||
break;
|
||||
}
|
||||
@ -618,7 +618,6 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
if (globals.calls < 0) {
|
||||
globals.calls = 0;
|
||||
}
|
||||
|
||||
//DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG);
|
||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||
if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) {
|
||||
@ -869,15 +868,15 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
tech_pvt->read_frame.datalen = 640;
|
||||
}
|
||||
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_set_flag(tech_pvt, TFLAG_VOICE);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
|
||||
while (switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||
if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_clear_flag(tech_pvt, TFLAG_BREAK);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
DEBUGA_SKYPE("CHANNEL READ FRAME goto CNG\n", SKYPOPEN_P_LOG);
|
||||
goto cng;
|
||||
}
|
||||
@ -888,9 +887,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
}
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_clear_flag(tech_pvt, TFLAG_VOICE);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
if (!tech_pvt->read_frame.datalen) {
|
||||
DEBUGA_SKYPE("CHANNEL READ CONTINUE\n", SKYPOPEN_P_LOG);
|
||||
continue;
|
||||
@ -1024,9 +1023,9 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
skypopen_answer(tech_pvt);
|
||||
|
||||
while (!switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||
@ -1069,9 +1068,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||
{
|
||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_set_flag(tech_pvt, TFLAG_PROGRESS);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
}
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS:
|
||||
@ -1406,21 +1405,21 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t *
|
||||
|
||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||
DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG);
|
||||
conta=0;
|
||||
while(tech_pvt->tcp_srv_thread){
|
||||
conta = 0;
|
||||
while (tech_pvt->tcp_srv_thread) {
|
||||
switch_sleep(5000);
|
||||
conta++;
|
||||
if(conta==200){
|
||||
if (conta == 200) {
|
||||
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){
|
||||
conta = 0;
|
||||
while (tech_pvt->tcp_cli_thread) {
|
||||
switch_sleep(5000);
|
||||
conta++;
|
||||
if(conta==200){
|
||||
if (conta == 200) {
|
||||
ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG);
|
||||
break;
|
||||
}
|
||||
@ -3073,7 +3072,7 @@ struct SkypopenHandles *skypopen_list_remove_by_value(struct SkypopenList *list,
|
||||
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
||||
struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *list, struct SkypopenHandles *handle)
|
||||
{
|
||||
private_t *tech_pvt=NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
switch_mutex_lock(globals.list_mutex);
|
||||
|
||||
@ -3081,7 +3080,7 @@ struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *l
|
||||
if (handle->managed == SWITCH_FALSE) {
|
||||
// already removed
|
||||
switch_mutex_unlock(globals.list_mutex);
|
||||
DEBUGA_SKYPE("EXIT REMOVE\n", SKYPOPEN_P_LOG);
|
||||
DEBUGA_SKYPE("EXIT REMOVE\n", SKYPOPEN_P_LOG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -227,27 +227,29 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
||||
}
|
||||
} else if (!strncasecmp(message, "ERROR 36 Not online", 18)) {
|
||||
char msg_to_skype[256];
|
||||
ERRORA("Skype client is not online, eg: not connected to Skype network, probably got a temporary net outage: |||%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);
|
||||
ERRORA("Skype client is not online, eg: not connected to Skype network, probably got a temporary net outage: |||%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);
|
||||
}
|
||||
if(strlen(tech_pvt->ring_id)){
|
||||
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
if (strlen(tech_pvt->ring_id)) {
|
||||
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||
return CALLFLOW_INCOMING_HANGUP;
|
||||
} else if (!strncasecmp(message, "ERROR 589 ALTER CALL", 19)) {
|
||||
char msg_to_skype[256];
|
||||
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);
|
||||
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);
|
||||
}
|
||||
if(strlen(tech_pvt->ring_id)){
|
||||
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
if (strlen(tech_pvt->ring_id)) {
|
||||
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||
return CALLFLOW_INCOMING_HANGUP;
|
||||
@ -497,7 +499,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
||||
//SKYPOPEN_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
|
||||
|
||||
if (!strcasecmp(prop, "PARTNER_HANDLE")) {
|
||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){
|
||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE) {
|
||||
/* we are NOT inside an active call */
|
||||
DEBUGA_SKYPE("Call %s go to skypopen_partner_handle_ring\n", SKYPOPEN_P_LOG, id);
|
||||
skypopen_strncpy(tech_pvt->ring_id, id, sizeof(tech_pvt->ring_id));
|
||||
@ -579,7 +581,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
||||
|
||||
if (!strcasecmp(value, "RINGING")) {
|
||||
char msg_to_skype[1024];
|
||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){
|
||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE) {
|
||||
// CLOUDTREE (Thomas Hazel)
|
||||
skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
|
||||
@ -604,8 +606,9 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
||||
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) {
|
||||
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);
|
||||
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);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id);
|
||||
@ -735,7 +738,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
|
||||
if(skypopen_answered(tech_pvt)!= SWITCH_STATUS_SUCCESS){
|
||||
if (skypopen_answered(tech_pvt) != SWITCH_STATUS_SUCCESS) {
|
||||
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
@ -866,8 +869,8 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
|
||||
if (!(running && tech_pvt->running))
|
||||
break;
|
||||
while (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_IDLE
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_IDLE
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED
|
||||
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) {
|
||||
@ -1026,8 +1029,8 @@ void *skypopen_do_tcp_cli_thread_func(void *obj)
|
||||
if (!(running && tech_pvt->running))
|
||||
break;
|
||||
while (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_IDLE
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_IDLE
|
||||
&& tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED
|
||||
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) {
|
||||
@ -1916,9 +1919,9 @@ int inbound_channel_answered(private_t *tech_pvt)
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
||||
if (channel) {
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_set_flag(tech_pvt, TFLAG_IO);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
} else {
|
||||
ERRORA("no channel\n", SKYPOPEN_P_LOG);
|
||||
}
|
||||
@ -1938,30 +1941,30 @@ int skypopen_answered(private_t *tech_pvt)
|
||||
switch_core_session_t *session = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
if(strlen(tech_pvt->session_uuid_str)){
|
||||
session = switch_core_session_locate(tech_pvt->session_uuid_str);
|
||||
if (session) {
|
||||
channel = switch_core_session_get_channel(session);
|
||||
if (strlen(tech_pvt->session_uuid_str)) {
|
||||
session = switch_core_session_locate(tech_pvt->session_uuid_str);
|
||||
if (session) {
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
||||
if (channel) {
|
||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
tech_pvt->interface_state = SKYPOPEN_STATE_UP;
|
||||
DEBUGA_SKYPE("Outbound Channel Answered! session_uuid_str=%s\n", SKYPOPEN_P_LOG, tech_pvt->session_uuid_str);
|
||||
outbound_channel_answered(tech_pvt);
|
||||
} else {
|
||||
DEBUGA_SKYPE("answered Inbound Channel!\n\n\n\n", SKYPOPEN_P_LOG);
|
||||
inbound_channel_answered(tech_pvt);
|
||||
}
|
||||
|
||||
if (channel) {
|
||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
tech_pvt->interface_state = SKYPOPEN_STATE_UP;
|
||||
DEBUGA_SKYPE("Outbound Channel Answered! session_uuid_str=%s\n", SKYPOPEN_P_LOG, tech_pvt->session_uuid_str);
|
||||
outbound_channel_answered(tech_pvt);
|
||||
} else {
|
||||
DEBUGA_SKYPE("answered Inbound Channel!\n\n\n\n", SKYPOPEN_P_LOG);
|
||||
inbound_channel_answered(tech_pvt);
|
||||
ERRORA("no channel after INPROGRESS?\n", SKYPOPEN_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
ERRORA("no channel after INPROGRESS?\n", SKYPOPEN_P_LOG);
|
||||
WARNINGA("no session after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
WARNINGA("no session after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
} else {
|
||||
WARNINGA("no tech_pvt->session_uuid_str after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user