diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 47d85295d3..a7476bb3fa 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1131,28 +1131,41 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch_channel_t *channel = NULL; struct private_object *tech_pvt = NULL; - if ((channel = switch_core_session_get_channel(session))) { - if ((tech_pvt = switch_core_session_get_private(session))) { - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); + if (!(channel = switch_core_session_get_channel(session))) { + return SWITCH_STATUS_SUCCESS; + } - if (tech_pvt->dlsession) { - if (!switch_test_flag(tech_pvt, TFLAG_TERM)) { - ldl_session_terminate(tech_pvt->dlsession); - switch_set_flag_locked(tech_pvt, TFLAG_TERM); - } - ldl_session_destroy(&tech_pvt->dlsession); + if (!(tech_pvt = switch_core_session_get_private(session))) { + return SWITCH_STATUS_SUCCESS; + } + - } + switch (sig) { + case SWITCH_SIG_KILL: + switch_clear_flag_locked(tech_pvt, TFLAG_IO); + switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); + switch_set_flag_locked(tech_pvt, TFLAG_BYE); - if (switch_rtp_ready(tech_pvt->rtp_session)) { - switch_rtp_kill_socket(tech_pvt->rtp_session); - } + if (tech_pvt->dlsession) { + if (!switch_test_flag(tech_pvt, TFLAG_TERM)) { + ldl_session_terminate(tech_pvt->dlsession); + switch_set_flag_locked(tech_pvt, TFLAG_TERM); + } + ldl_session_destroy(&tech_pvt->dlsession); + + } + + if (switch_rtp_ready(tech_pvt->rtp_session)) { + switch_rtp_kill_socket(tech_pvt->rtp_session); + } + break; + case SWITCH_SIG_BREAK: + switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK); + break; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel)); - } - } return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_iax/mod_iax.c b/src/mod/endpoints/mod_iax/mod_iax.c index 6baccc4da4..f9aa925c77 100644 --- a/src/mod/endpoints/mod_iax/mod_iax.c +++ b/src/mod/endpoints/mod_iax/mod_iax.c @@ -566,11 +566,16 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - //switch_thread_cond_signal(tech_pvt->cond); - + switch(sig) { + case SWITCH_SIG_KILL: + switch_clear_flag_locked(tech_pvt, TFLAG_IO); + switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + //switch_thread_cond_signal(tech_pvt->cond); + break; + default: + break; + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel)); diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 9a4a73057b..d7f203217d 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -273,10 +273,15 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - deactivate_audio_device(tech_pvt); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - + switch (sig) { + case SWITCH_SIG_KILL: + switch_clear_flag_locked(tech_pvt, TFLAG_IO); + deactivate_audio_device(tech_pvt); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + break; + default: + break; + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel)); diff --git a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c index d61b8509c0..ff64b6ce54 100644 --- a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c +++ b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c @@ -755,11 +755,16 @@ static switch_status_t wanpipe_kill_channel(switch_core_session_t *session, int tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - switch_mutex_lock(tech_pvt->flag_mutex); - switch_set_flag(tech_pvt, TFLAG_BYE); - switch_clear_flag(tech_pvt, TFLAG_MEDIA); - switch_mutex_unlock(tech_pvt->flag_mutex); - + switch(sig) { + case SWITCH_SIG_KILL: + switch_mutex_lock(tech_pvt->flag_mutex); + switch_set_flag(tech_pvt, TFLAG_BYE); + switch_clear_flag(tech_pvt, TFLAG_MEDIA); + switch_mutex_unlock(tech_pvt->flag_mutex); + break; + default: + break; + } //sangoma_socket_close(&tech_pvt->wpsock->fd); //wp_close(tech_pvt); diff --git a/src/mod/endpoints/mod_woomera/mod_woomera.c b/src/mod/endpoints/mod_woomera/mod_woomera.c index a31633919b..3fdbc6380a 100644 --- a/src/mod/endpoints/mod_woomera/mod_woomera.c +++ b/src/mod/endpoints/mod_woomera/mod_woomera.c @@ -327,11 +327,19 @@ static switch_status_t woomerachan_kill_channel(switch_core_session_t *session, return SWITCH_STATUS_FALSE; } - udp_socket_close(tech_pvt); - - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel)); - + switch(sig) { + case SWITCH_SIG_KILL: + udp_socket_close(tech_pvt); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel)); + break; + case SWITCH_SIG_BREAK: + { + int p = 0; + switch_size_t len = sizeof(p); + switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, &p, &len); + } + break; + } return SWITCH_STATUS_SUCCESS;