add case for kill sigs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3778 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-12-21 16:46:11 +00:00
parent 6f3f463f0b
commit 90440eaf1d
5 changed files with 73 additions and 37 deletions

View File

@ -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;
}
}
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_kill_socket(tech_pvt->rtp_session);
}
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 (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;
}

View File

@ -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));

View File

@ -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));

View File

@ -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);

View File

@ -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;