add new function to check when messages need parsing to improve performance on parsing messages during originate
This commit is contained in:
parent
7630d47e0e
commit
8b0421ff68
|
@ -1024,6 +1024,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(_In_ switch_core
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(uint32_t) switch_core_session_event_count(_In_ switch_core_session_t *session);
|
SWITCH_DECLARE(uint32_t) switch_core_session_event_count(_In_ switch_core_session_t *session);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Number of parsable messages waiting on the session.
|
||||||
|
*/
|
||||||
|
SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_session_t *session);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief DE-Queue an event on a given session
|
\brief DE-Queue an event on a given session
|
||||||
\param session the session to de-queue the message on
|
\param session the session to de-queue the message on
|
||||||
|
|
|
@ -861,6 +861,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_sess
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_session_t *session)
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
if (session->private_event_queue) {
|
||||||
|
x += switch_queue_size(session->private_event_queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (session->message_queue) {
|
||||||
|
x += switch_queue_size(session->message_queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(uint32_t) switch_core_session_event_count(switch_core_session_t *session)
|
SWITCH_DECLARE(uint32_t) switch_core_session_event_count(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
if (session->event_queue) {
|
if (session->event_queue) {
|
||||||
|
|
|
@ -638,12 +638,14 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat
|
||||||
|
|
||||||
if (!switch_channel_test_flag(originate_status[i].peer_channel, CF_PARK) &&
|
if (!switch_channel_test_flag(originate_status[i].peer_channel, CF_PARK) &&
|
||||||
!switch_channel_test_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE)) {
|
!switch_channel_test_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE)) {
|
||||||
|
if (switch_core_session_messages_waiting(originate_status[i].peer_session)) {
|
||||||
if (switch_channel_test_flag(originate_status[i].peer_channel, CF_THREAD_SLEEPING)) {
|
if (switch_channel_test_flag(originate_status[i].peer_channel, CF_THREAD_SLEEPING)) {
|
||||||
switch_core_session_wake_session_thread(originate_status[i].peer_session);
|
switch_core_session_wake_session_thread(originate_status[i].peer_session);
|
||||||
} else {
|
} else {
|
||||||
switch_ivr_parse_all_events(originate_status[i].peer_session);
|
switch_ivr_parse_all_events(originate_status[i].peer_session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
state = switch_channel_get_state(originate_status[i].peer_channel);
|
state = switch_channel_get_state(originate_status[i].peer_channel);
|
||||||
if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) ||
|
if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) ||
|
||||||
|
|
Loading…
Reference in New Issue