From e3095522c2c1234963408b21cd502d33a87792fe Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Sat, 15 Aug 2009 15:37:44 +0000 Subject: [PATCH] skypiax: more stability, no dangling channels, MODSKYPIAX-42, added 'sk list' statistics (thanks Seven Du) MODENDP-236 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14533 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_skypiax/mod_skypiax.c | 149 +++++++++++++++--- src/mod/endpoints/mod_skypiax/skypiax.h | 80 +++++----- .../endpoints/mod_skypiax/skypiax_protocol.c | 14 +- 3 files changed, 180 insertions(+), 63 deletions(-) diff --git a/src/mod/endpoints/mod_skypiax/mod_skypiax.c b/src/mod/endpoints/mod_skypiax/mod_skypiax.c index 6ce63b661d..68a3b6cff5 100644 --- a/src/mod/endpoints/mod_skypiax/mod_skypiax.c +++ b/src/mod/endpoints/mod_skypiax/mod_skypiax.c @@ -96,6 +96,51 @@ SWITCH_STANDARD_API(skypiax_function); #define SOFT_RELOAD 1 /* END: Changes heres */ +char *interface_status[] = { /* should match SKYPIAX_STATE_xxx in skypiax.h */ + "IDLE", + "DOWN", + "RING", + "DIALING", + "BUSY", + "UP", + "RINGING", + "PRERING", + "DOUBLE", + "SELECTD", + "HANG_RQ", + "PREANSW" +}; +char *skype_callflow[] = { /* should match CALLFLOW_XXX in skypiax.h */ +"CALL_IDLE", +"CALL_DOWN", +"INCOMING_RNG", +"CALL_DIALING", +"CALL_LINEBUSY", +"CALL_ACTIVE", +"INCOMING_HNG", +"CALL_RLEASD", +"CALL_NOCARR", +"CALL_INFLUX", +"CALL_INCOMING", +"CALL_FAILED", +"CALL_NOSRVC", +"CALL_OUTRESTR", +"CALL_SECFAIL", +"CALL_NOANSWER", +"STATUS_FNSHED", +"STATUS_CANCLED", +"STATUS_FAILED", +"STATUS_REFUSED", +"STATUS_RINGING", +"STATUS_INPROGRS", +"STATUS_UNPLACD", +"STATUS_ROUTING", +"STATUS_EARLYMD", +"INCOMING_CLID", +"STATUS_RMTEHOLD" +}; + + static struct { int debug; char *ip; @@ -140,6 +185,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session); static switch_status_t channel_on_destroy(switch_core_session_t *session); static switch_status_t channel_on_routing(switch_core_session_t *session); static switch_status_t channel_on_exchange_media(switch_core_session_t *session); +static switch_status_t channel_on_consume_media(switch_core_session_t *session); static switch_status_t channel_on_soft_execute(switch_core_session_t *session); static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, @@ -375,7 +421,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); - DEBUGA_SKYPE("%s CHANNEL INIT\n", SKYPIAX_P_LOG, switch_channel_get_name(channel)); + //ERRORA("%s CHANNEL INIT\n", SKYPIAX_P_LOG, tech_pvt->name); switch_set_flag(tech_pvt, TFLAG_IO); /* Move channel's state machine to ROUTING. This means the call is trying @@ -387,6 +433,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) globals.calls++; switch_mutex_unlock(globals.mutex); + DEBUGA_SKYPE("%s CHANNEL INIT %s\n", SKYPIAX_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); return SWITCH_STATUS_SUCCESS; } @@ -397,7 +444,10 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); + if (tech_pvt) { + DEBUGA_SKYPE("%s CHANNEL DESTROY %s\n", SKYPIAX_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); + if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } @@ -406,7 +456,13 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) switch_core_codec_destroy(&tech_pvt->write_codec); } *tech_pvt->session_uuid_str = '\0'; + tech_pvt->interface_state = SKYPIAX_STATE_IDLE; + if(tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED){ + tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; + } switch_core_session_set_private(session, NULL); + } else { + DEBUGA_SKYPE("!!!!!!NO tech_pvt!!!! CHANNEL DESTROY %s\n", SKYPIAX_P_LOG, switch_core_session_get_uuid(session)); } return SWITCH_STATUS_SUCCESS; @@ -425,6 +481,14 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + if (!switch_channel_test_flag(channel, CF_ANSWERED)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + tech_pvt->ob_failed_calls++; + } else { + tech_pvt->ib_failed_calls++; + } + } + switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); //switch_set_flag(tech_pvt, TFLAG_HANGUP); @@ -437,12 +501,17 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) } //memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str)); //*tech_pvt->session_uuid_str = '\0'; - DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPIAX_P_LOG, switch_channel_get_name(channel)); + DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPIAX_P_LOG, tech_pvt->name); switch_mutex_lock(globals.mutex); globals.calls--; if (globals.calls < 0) { globals.calls = 0; } + + tech_pvt->interface_state = SKYPIAX_STATE_IDLE; + if(tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED){ + tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; + } switch_mutex_unlock(globals.mutex); return SWITCH_STATUS_SUCCESS; @@ -459,7 +528,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - DEBUGA_SKYPE("%s CHANNEL ROUTING\n", SKYPIAX_P_LOG, switch_channel_get_name(channel)); + DEBUGA_SKYPE("%s CHANNEL ROUTING\n", SKYPIAX_P_LOG, tech_pvt->name); return SWITCH_STATUS_SUCCESS; } @@ -476,7 +545,7 @@ static switch_status_t channel_on_execute(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - DEBUGA_SKYPE("%s CHANNEL EXECUTE\n", SKYPIAX_P_LOG, switch_channel_get_name(channel)); + DEBUGA_SKYPE("%s CHANNEL EXECUTE\n", SKYPIAX_P_LOG, tech_pvt->name); return SWITCH_STATUS_SUCCESS; } @@ -492,6 +561,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + DEBUGA_SKYPE("%s CHANNEL KILL_CHANNEL\n", SKYPIAX_P_LOG, tech_pvt->name); switch (sig) { case SWITCH_SIG_KILL: DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPIAX_P_LOG, switch_channel_get_name(channel)); @@ -514,18 +584,30 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int return SWITCH_STATUS_SUCCESS; } +static switch_status_t channel_on_consume_media(switch_core_session_t *session) +{ + private_t *tech_pvt = NULL; + + tech_pvt = switch_core_session_get_private(session); + + DEBUGA_SKYPE("%s CHANNEL CONSUME_MEDIA\n", SKYPIAX_P_LOG, tech_pvt->name); + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t channel_on_exchange_media(switch_core_session_t *session) { private_t *tech_pvt = NULL; - DEBUGA_SKYPE("CHANNEL LOOPBACK\n", SKYPIAX_P_LOG); + tech_pvt = switch_core_session_get_private(session); + DEBUGA_SKYPE("%s CHANNEL EXCHANGE_MEDIA\n", SKYPIAX_P_LOG, tech_pvt->name); return SWITCH_STATUS_SUCCESS; } static switch_status_t channel_on_soft_execute(switch_core_session_t *session) { private_t *tech_pvt = NULL; - DEBUGA_SKYPE("CHANNEL TRANSMIT\n", SKYPIAX_P_LOG); + tech_pvt = switch_core_session_get_private(session); + DEBUGA_SKYPE("%s CHANNEL SOFT_EXECUTE\n", SKYPIAX_P_LOG, tech_pvt->name); return SWITCH_STATUS_SUCCESS; } @@ -534,6 +616,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s private_t *tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + DEBUGA_SKYPE("%s CHANNEL SEND_DTMF\n", SKYPIAX_P_LOG, tech_pvt->name); DEBUGA_SKYPE("DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit); skypiax_senddigit(tech_pvt, dtmf->digit); @@ -718,7 +801,7 @@ switch_state_handler_table_t skypiax_state_handlers = { /*.on_hangup */ channel_on_hangup, /*.on_exchange_media */ channel_on_exchange_media, /*.on_soft_execute */ channel_on_soft_execute, - /*.on_consume_media */ NULL, + /*.on_consume_media */ channel_on_consume_media, /*.on_hibernate */ NULL, /*.on_reset */ NULL, /*.on_park */ NULL, @@ -749,6 +832,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi int found = 0; char interface_name[256]; + DEBUGA_SKYPE("1 SESSION_REQUEST %s\n", SKYPIAX_P_LOG, switch_core_session_get_uuid(*new_session)); switch_core_session_add_stream(*new_session, NULL); @@ -783,6 +867,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi DEBUGA_SKYPE ("globals.SKYPIAX_INTERFACES[%d].name=|||%s||| session_uuid_str=|||%s||| is BUSY\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str); + DEBUGA_SKYPE("1 SESSION_DESTROY %s\n", SKYPIAX_P_LOG, switch_core_session_get_uuid(*new_session)); switch_core_session_destroy(new_session); switch_mutex_unlock(globals.mutex); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; @@ -804,6 +889,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if (!found) { DEBUGA_SKYPE("Doh! no available interface for |||%s|||?\n", SKYPIAX_P_LOG, interface_name); + DEBUGA_SKYPE("2 SESSION_DESTROY %s\n", SKYPIAX_P_LOG, switch_core_session_get_uuid(*new_session)); switch_core_session_destroy(new_session); switch_mutex_unlock(globals.mutex); //return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; @@ -840,6 +926,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_mutex_unlock(globals.mutex); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } + + tech_pvt->ob_calls++; rdest = strchr(caller_profile->destination_number, '/'); *rdest++ = '\0'; @@ -904,14 +992,21 @@ static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t * } else { DEBUGA_SKYPE("no session\n", SKYPIAX_P_LOG); } + switch_mutex_lock(globals.mutex); tech_pvt->interface_state = SKYPIAX_STATE_DOWN; *tech_pvt->session_uuid_str = '\0'; *tech_pvt->skype_call_id = '\0'; + switch_mutex_unlock(globals.mutex); //ERRORA("LET'S WAIT\n", SKYPIAX_P_LOG); switch_sleep(300000); //0.3 sec //ERRORA("WAIT'S OVER\n", SKYPIAX_P_LOG); - tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; + //tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; + //usleep(30000); //0.03 sec + switch_mutex_lock(globals.mutex); + tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; + tech_pvt->interface_state = SKYPIAX_STATE_IDLE; + switch_mutex_unlock(globals.mutex); } else { ERRORA("no tech_pvt?\n", SKYPIAX_P_LOG); } @@ -1461,6 +1556,7 @@ int new_inbound_channel(private_t * tech_pvt) switch_channel_t *channel = NULL; if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) { + DEBUGA_SKYPE("2 SESSION_REQUEST %s\n", SKYPIAX_P_LOG, switch_core_session_get_uuid(session)); switch_core_session_add_stream(session, NULL); channel = switch_core_session_get_channel(session); if (!channel) { @@ -1668,20 +1764,27 @@ SWITCH_STANDARD_API(sk_function) int i; char next_flag_char = ' '; + stream->write_function(stream, "F ID\t Name \tIB (F/T) OB (F/T)\tState\tCallFlw\t\tUUID\n"); + stream->write_function(stream, "= ====\t ======== \t======= =======\t======\t============\t======\n"); + for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) { next_flag_char = i == globals.next_interface ? '*' : ' '; if (strlen(globals.SKYPIAX_INTERFACES[i].name)) { - if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)) { - stream->write_function(stream, - "%c\t%d\t[%s]\tBUSY, session_uuid_str=|||%s|||\n", - next_flag_char, i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str); - } else { - stream->write_function(stream, "%c\t%d\t[%s]\tIDLE\n", next_flag_char, i, globals.SKYPIAX_INTERFACES[i].name); - } - } else if (argc > 1 && !strcasecmp(argv[1], "full")) { + stream->write_function(stream, + "%c %d\t[%s]\t%3ld/%ld\t%6ld/%ld\t%s\t%s\t%s\n", + next_flag_char, + i, globals.SKYPIAX_INTERFACES[i].name, + globals.SKYPIAX_INTERFACES[i].ib_failed_calls, + globals.SKYPIAX_INTERFACES[i].ib_calls, + globals.SKYPIAX_INTERFACES[i].ob_failed_calls, + globals.SKYPIAX_INTERFACES[i].ob_calls, + interface_status[globals.SKYPIAX_INTERFACES[i].interface_state], + skype_callflow[globals.SKYPIAX_INTERFACES[i].skype_callflow], + globals.SKYPIAX_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, "\nTotal: %d\n", globals.real_interfaces - 1); @@ -1847,9 +1950,12 @@ int skypiax_answer(private_t * tech_pvt, char *id, char *value) if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { /* we are not inside an active call */ + tech_pvt->ib_calls++; + sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id); skypiax_signaling_write(tech_pvt, msg_to_skype); switch_sleep(10000); + tech_pvt->interface_state = SKYPIAX_STATE_PREANSWER; sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id); skypiax_signaling_write(tech_pvt, msg_to_skype); DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG, id); @@ -1912,7 +2018,7 @@ int skypiax_transfer(private_t * tech_pvt, char *id, char *value) if (!tech_pvt || !tech_pvt->skype_call_id || !strlen(tech_pvt->skype_call_id)) { /* we are not inside an active call */ - ERRORA("We're NO MORE in a call now %s\n", SKYPIAX_P_LOG, (tech_pvt && tech_pvt->skype_call_id) ? tech_pvt->skype_call_id : ""); + DEBUGA_SKYPE("We're NO MORE in a call now %s\n", SKYPIAX_P_LOG, (tech_pvt && tech_pvt->skype_call_id) ? tech_pvt->skype_call_id : ""); switch_mutex_unlock(globals.mutex); } else { @@ -1966,8 +2072,15 @@ int skypiax_transfer(private_t * tech_pvt, char *id, char *value) DEBUGA_SKYPE ("Let's transfer the skype_call %s to %s interface (with skype_user: %s), because we are already in a skypiax call(%s)\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name, available_skypiax_interface->skype_user, id); + + //FIXME why this? the inbound call will come, eventually, on that other interface + //available_skypiax_interface->ib_calls++; + sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypiax_interface->skype_user); skypiax_signaling_write(tech_pvt, msg_to_skype); + if(tech_pvt->interface_state == SKYPIAX_STATE_SELECTED) { + tech_pvt->interface_state = SKYPIAX_STATE_IDLE; //we marked it SKYPIAX_STATE_SELECTED just in case it has to make an outbound call + } } else { /* no skypiax interfaces idle, do nothing */ DEBUGA_SKYPE diff --git a/src/mod/endpoints/mod_skypiax/skypiax.h b/src/mod/endpoints/mod_skypiax/skypiax.h index 06382e036b..f5ca5fe1e8 100644 --- a/src/mod/endpoints/mod_skypiax/skypiax.h +++ b/src/mod/endpoints/mod_skypiax/skypiax.h @@ -91,45 +91,47 @@ typedef enum { #define SKYPIAX_CONTROL_ANSWER 2 /*********************************/ -#define SKYPIAX_STATE_DOWN 1 -#define SKYPIAX_STATE_RING 2 -#define SKYPIAX_STATE_DIALING 3 -#define SKYPIAX_STATE_BUSY 4 -#define SKYPIAX_STATE_UP 5 -#define SKYPIAX_STATE_RINGING 6 -#define SKYPIAX_STATE_PRERING 7 -#define SKYPIAX_STATE_ERROR_DOUBLE_CALL 8 -#define SKYPIAX_STATE_SELECTED 9 +#define SKYPIAX_STATE_IDLE 0 +#define SKYPIAX_STATE_DOWN 1 +#define SKYPIAX_STATE_RING 2 +#define SKYPIAX_STATE_DIALING 3 +#define SKYPIAX_STATE_BUSY 4 +#define SKYPIAX_STATE_UP 5 +#define SKYPIAX_STATE_RINGING 6 +#define SKYPIAX_STATE_PRERING 7 +#define SKYPIAX_STATE_ERROR_DOUBLE_CALL 8 +#define SKYPIAX_STATE_SELECTED 9 +#define SKYPIAX_STATE_HANGUP_REQUESTED 10 +#define SKYPIAX_STATE_PREANSWER 11 /*********************************/ /* call flow from the device */ -#define CALLFLOW_CALL_IDLE SKYPIAX_STATE_DOWN -#define CALLFLOW_INCOMING_RING SKYPIAX_STATE_RING -#define CALLFLOW_CALL_DIALING SKYPIAX_STATE_DIALING -#define CALLFLOW_CALL_LINEBUSY SKYPIAX_STATE_BUSY -#define CALLFLOW_CALL_ACTIVE 300 -#define CALLFLOW_INCOMING_HANGUP 100 -#define CALLFLOW_CALL_RELEASED 101 -#define CALLFLOW_CALL_NOCARRIER 102 -#define CALLFLOW_CALL_INFLUX 103 -#define CALLFLOW_CALL_INCOMING 104 -#define CALLFLOW_CALL_FAILED 105 -#define CALLFLOW_CALL_NOSERVICE 106 -#define CALLFLOW_CALL_OUTGOINGRESTRICTED 107 -#define CALLFLOW_CALL_SECURITYFAIL 108 -#define CALLFLOW_CALL_NOANSWER 109 -#define CALLFLOW_STATUS_FINISHED 110 -#define CALLFLOW_STATUS_CANCELLED 111 -#define CALLFLOW_STATUS_FAILED 112 -#define CALLFLOW_STATUS_REFUSED 113 -#define CALLFLOW_STATUS_RINGING 114 -#define CALLFLOW_STATUS_INPROGRESS 115 -#define CALLFLOW_STATUS_UNPLACED 116 -#define CALLFLOW_STATUS_ROUTING 117 -#define CALLFLOW_STATUS_EARLYMEDIA 118 -#define SKYPIAX_STATE_HANGUP_REQUESTED 200 - //FIXME CALLFLOW_INCOMING_CALLID to be removed -#define CALLFLOW_INCOMING_CALLID 1019 -#define CALLFLOW_STATUS_REMOTEHOLD 201 +#define CALLFLOW_CALL_IDLE 0 +#define CALLFLOW_CALL_DOWN 1 +#define CALLFLOW_INCOMING_RING 2 +#define CALLFLOW_CALL_DIALING 3 +#define CALLFLOW_CALL_LINEBUSY 4 +#define CALLFLOW_CALL_ACTIVE 5 +#define CALLFLOW_INCOMING_HANGUP 6 +#define CALLFLOW_CALL_RELEASED 7 +#define CALLFLOW_CALL_NOCARRIER 8 +#define CALLFLOW_CALL_INFLUX 9 +#define CALLFLOW_CALL_INCOMING 10 +#define CALLFLOW_CALL_FAILED 11 +#define CALLFLOW_CALL_NOSERVICE 12 +#define CALLFLOW_CALL_OUTGOINGRESTRICTED 13 +#define CALLFLOW_CALL_SECURITYFAIL 14 +#define CALLFLOW_CALL_NOANSWER 15 +#define CALLFLOW_STATUS_FINISHED 16 +#define CALLFLOW_STATUS_CANCELLED 17 +#define CALLFLOW_STATUS_FAILED 18 +#define CALLFLOW_STATUS_REFUSED 19 +#define CALLFLOW_STATUS_RINGING 20 +#define CALLFLOW_STATUS_INPROGRESS 21 +#define CALLFLOW_STATUS_UNPLACED 22 +#define CALLFLOW_STATUS_ROUTING 23 +#define CALLFLOW_STATUS_EARLYMEDIA 24 +#define CALLFLOW_INCOMING_CALLID 25 +#define CALLFLOW_STATUS_REMOTEHOLD 26 /*********************************/ @@ -241,6 +243,10 @@ struct private_object { char transfer_callid_number[50]; char skype_transfer_call_id[512]; int running; + unsigned long ib_calls; + unsigned long ob_calls; + unsigned long ib_failed_calls; + unsigned long ob_failed_calls; }; typedef struct private_object private_t; diff --git a/src/mod/endpoints/mod_skypiax/skypiax_protocol.c b/src/mod/endpoints/mod_skypiax/skypiax_protocol.c index a401858f22..2568bf5aae 100644 --- a/src/mod/endpoints/mod_skypiax/skypiax_protocol.c +++ b/src/mod/endpoints/mod_skypiax/skypiax_protocol.c @@ -62,7 +62,6 @@ int skypiax_socket_create_and_bind(private_t * tech_pvt, int *which_port) tech_pvt->tcp_cli_port, tech_pvt->tcp_srv_port); return -1; } - //usleep(100); } DEBUGA_SKYPE("SUCCESS! *which_port=%d, tech_pvt->tcp_cli_port=%d, tech_pvt->tcp_srv_port=%d\n", SKYPIAX_P_LOG, *which_port, tech_pvt->tcp_cli_port, @@ -231,7 +230,7 @@ int skypiax_signaling_read(private_t * tech_pvt) //SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL"); if (!strcasecmp(prop, "PARTNER_HANDLE")) { - if (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str)) { + if (tech_pvt->interface_state != SKYPIAX_STATE_SELECTED && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str)) ) { //if (!strlen(tech_pvt->skype_call_id)) { /* we are NOT inside an active call */ DEBUGA_SKYPE("Call %s TRY ANSWER\n", SKYPIAX_P_LOG, id); @@ -256,13 +255,13 @@ int skypiax_signaling_read(private_t * tech_pvt) } if (!strcasecmp(prop, "CONF_ID") && !strcasecmp(value, "0")) { //DEBUGA_SKYPE("the skype_call %s is NOT a conference call\n", SKYPIAX_P_LOG, id); - if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN) - tech_pvt->interface_state = SKYPIAX_STATE_PRERING; + //if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN) + //tech_pvt->interface_state = SKYPIAX_STATE_PRERING; } if (!strcasecmp(prop, "CONF_ID") && strcasecmp(value, "0")) { DEBUGA_SKYPE("the skype_call %s is a conference call\n", SKYPIAX_P_LOG, id); - if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN) - tech_pvt->interface_state = SKYPIAX_STATE_PRERING; + //if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN) + //tech_pvt->interface_state = SKYPIAX_STATE_PRERING; } if (!strcasecmp(prop, "DTMF")) { DEBUGA_SKYPE("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value); @@ -338,7 +337,6 @@ int skypiax_signaling_read(private_t * tech_pvt) DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id); } else if (!strcasecmp(value, "FINISHED")) { //DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id); - //usleep(150000);//150msec, let's give the TCP sockets time to timeout if (!strcasecmp(tech_pvt->skype_call_id, id)) { //tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPIAX_P_LOG, id); @@ -429,7 +427,7 @@ int skypiax_signaling_read(private_t * tech_pvt) DEBUGA_SKYPE("New Inbound Channel!\n\n\n\n", SKYPIAX_P_LOG); new_inbound_channel(tech_pvt); } else { - DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG); + DEBUGA_SKYPE("Outbound Channel Answered! session_uuid_str=%s\n", SKYPIAX_P_LOG, tech_pvt->session_uuid_str); outbound_channel_answered(tech_pvt); } } else {