From 314ddb3e245eefc93d4372a838cd33c600adb84c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 30 Dec 2006 17:22:17 +0000 Subject: [PATCH] add break to iax git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3872 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_iax/mod_iax.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_iax/mod_iax.c b/src/mod/endpoints/mod_iax/mod_iax.c index f9aa925c77..fd7d8626d7 100644 --- a/src/mod/endpoints/mod_iax/mod_iax.c +++ b/src/mod/endpoints/mod_iax/mod_iax.c @@ -56,7 +56,8 @@ typedef enum { TFLAG_VOICE = (1 << 4), TFLAG_HANGUP = (1 << 5), TFLAG_LINEAR = (1 << 6), - TFLAG_CODEC = (1 << 7) + TFLAG_CODEC = (1 << 7), + TFLAG_BREAK = (1 << 8) } TFLAGS; typedef enum { @@ -573,6 +574,9 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); //switch_thread_cond_signal(tech_pvt->cond); break; + case SWITCH_SIG_BREAK: + switch_set_flag_locked(tech_pvt, TFLAG_BREAK); + break; default: break; } @@ -644,10 +648,19 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - - + tech_pvt->read_frame.flags = SFF_NONE; + while (switch_test_flag(tech_pvt, TFLAG_IO)) { //switch_thread_cond_wait(tech_pvt->cond, tech_pvt->mutex); + if (switch_test_flag_locked(tech_pvt, TFLAG_BREAK)) { + switch_clear_flag(tech_pvt, TFLAG_BREAK); + tech_pvt->read_frame.datalen = 13; + memset(tech_pvt->read_frame.data, 0, 13); + tech_pvt->read_frame.flags = SFF_CNG; + *frame = &tech_pvt->read_frame; + return SWITCH_STATUS_SUCCESS; + } + if (!switch_test_flag(tech_pvt, TFLAG_IO)) { return SWITCH_STATUS_FALSE; }