[Freeswitch-branches] [commit] r10713 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax
Author: gmaruzz Date: Thu Dec 11 11:00:23 2008 New Revision: 10713 Log: skypiax: better function distribution between mod_skypiax.c and skypiax_protocol.c Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c ============================================================================== --- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original) +++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c Thu Dec 11 11:00:23 2008 @@ -155,6 +155,53 @@ return SWITCH_STATUS_SUCCESS; } +static switch_status_t channel_on_hangup(switch_core_session_t * session) +{ + switch_channel_t *channel = NULL; + private_t *tech_pvt = NULL; + skypiax_interface_t *p; + char msg_to_skype[256]; + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + tech_pvt = switch_core_session_get_private(session); + assert(tech_pvt != NULL); + + p = tech_pvt->p; + + switch_clear_flag_locked(tech_pvt, TFLAG_IO); + switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); + //switch_set_flag_locked(tech_pvt, TFLAG_HANGUP); + + if (strlen(p->skype_call_id)) { + //switch_thread_cond_signal(tech_pvt->cond); + WARNINGA("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id); + //sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id); + skypiax_skype_write(p, msg_to_skype); + } + + if (tech_pvt->read_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->read_codec); + } + + if (tech_pvt->write_codec.implementation) { + switch_core_codec_destroy(&tech_pvt->write_codec); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", + switch_channel_get_name(channel)); + switch_mutex_lock(globals.mutex); + globals.calls--; + if (globals.calls < 0) { + globals.calls = 0; + } + switch_mutex_unlock(globals.mutex); + + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t channel_on_routing(switch_core_session_t * session) { switch_channel_t *channel = NULL; @@ -879,52 +926,6 @@ return SWITCH_STATUS_SUCCESS; } -static switch_status_t channel_on_hangup(switch_core_session_t * session) -{ - switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; - skypiax_interface_t *p; - char msg_to_skype[256]; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - p = tech_pvt->p; - - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); - //switch_set_flag_locked(tech_pvt, TFLAG_HANGUP); - - if (strlen(p->skype_call_id)) { - //switch_thread_cond_signal(tech_pvt->cond); - WARNINGA("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id); - //sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id); - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id); - skypiax_skype_write(p, msg_to_skype); - } - - if (tech_pvt->read_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->read_codec); - } - - if (tech_pvt->write_codec.implementation) { - switch_core_codec_destroy(&tech_pvt->write_codec); - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", - switch_channel_get_name(channel)); - switch_mutex_lock(globals.mutex); - globals.calls--; - if (globals.calls < 0) { - globals.calls = 0; - } - switch_mutex_unlock(globals.mutex); - - return SWITCH_STATUS_SUCCESS; -} /* For Emacs: * Local Variables:
participants (1)
-
FreeSWITCH SVN