CtRiX is fast
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@472 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
965e37759a
commit
e1a86feba8
|
@ -123,8 +123,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool,
|
||||
switch_originate_flag_t flags);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
||||
|
||||
|
||||
|
@ -359,7 +359,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
|||
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_IO);
|
||||
|
||||
/* Move Channel's State Machine to ROUTING */
|
||||
/* Move channel's state machine to ROUTING */
|
||||
switch_channel_set_state(channel, CS_ROUTING);
|
||||
switch_mutex_lock(globals.mutex);
|
||||
globals.calls++;
|
||||
|
@ -510,27 +510,6 @@ static switch_status_t channel_on_soft_execute(switch_core_session_t *session)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_waitfor_read(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_waitfor_write(switch_core_session_t *session, int ms, int stream_id)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
@ -545,7 +524,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
@ -553,7 +532,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
zap_wait_flag_t wflags = ZAP_READ;
|
||||
char dtmf[128] = "";
|
||||
zap_status_t status;
|
||||
int total_to = timeout;
|
||||
int total_to;
|
||||
int chunk, do_break = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
@ -566,9 +545,14 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
assert(tech_pvt->zchan != NULL);
|
||||
|
||||
chunk = tech_pvt->zchan->effective_interval * 2;
|
||||
total_to = chunk * 2;
|
||||
|
||||
top:
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_SUSPEND)) {
|
||||
do_break = 1;
|
||||
}
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_BREAK);
|
||||
do_break = 1;
|
||||
|
@ -597,7 +581,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
}
|
||||
|
||||
if (status == ZAP_TIMEOUT) {
|
||||
if (timeout > 0 && !switch_test_flag(tech_pvt, TFLAG_HOLD)) {
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_HOLD)) {
|
||||
total_to -= chunk;
|
||||
if (total_to <= 0) {
|
||||
goto fail;
|
||||
|
@ -646,7 +630,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
|
||||
}
|
||||
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
@ -835,8 +819,6 @@ switch_io_routines_t openzap_io_routines = {
|
|||
/*.read_frame */ channel_read_frame,
|
||||
/*.write_frame */ channel_write_frame,
|
||||
/*.kill_channel */ channel_kill_channel,
|
||||
/*.waitfor_read */ channel_waitfor_read,
|
||||
/*.waitfor_write */ channel_waitfor_write,
|
||||
/*.send_dtmf */ channel_send_dtmf,
|
||||
/*.receive_message*/ channel_receive_message
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue