FS-3413 --resolve
This commit is contained in:
parent
a56aa89cc5
commit
3cbae3fbd8
|
@ -72,6 +72,7 @@ typedef struct switch_channel_timetable switch_channel_timetable_t;
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_state(switch_channel_t *channel);
|
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_state(switch_channel_t *channel);
|
||||||
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_channel_t *channel);
|
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_channel_t *channel);
|
||||||
|
SWITCH_DECLARE(int) switch_channel_check_signal(switch_channel_t *channel, switch_bool_t in_thread_only);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Determine if a channel is ready for io
|
\brief Determine if a channel is ready for io
|
||||||
|
@ -84,8 +85,8 @@ SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_
|
||||||
#define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE, SWITCH_TRUE)
|
#define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE, SWITCH_TRUE)
|
||||||
#define switch_channel_media_up(_channel) (switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA))
|
#define switch_channel_media_up(_channel) (switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA))
|
||||||
|
|
||||||
#define switch_channel_up(_channel) (switch_channel_get_state(_channel) < CS_HANGUP)
|
#define switch_channel_up(_channel) (switch_channel_check_signal(_channel, SWITCH_TRUE) || switch_channel_get_state(_channel) < CS_HANGUP)
|
||||||
#define switch_channel_down(_channel) (switch_channel_get_state(_channel) >= CS_HANGUP)
|
#define switch_channel_down(_channel) (switch_channel_check_signal(_channel, SWITCH_TRUE) || switch_channel_get_state(_channel) >= CS_HANGUP)
|
||||||
#define switch_channel_media_ack(_channel) (!switch_channel_test_cap(_channel, CC_MEDIA_ACK) || switch_channel_test_flag(_channel, CF_MEDIA_ACK))
|
#define switch_channel_media_ack(_channel) (!switch_channel_test_cap(_channel, CC_MEDIA_ACK) || switch_channel_test_flag(_channel, CF_MEDIA_ACK))
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
|
SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
|
||||||
|
|
|
@ -1701,12 +1701,23 @@ SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channe
|
||||||
return channel->running_state != channel->state;
|
return channel->running_state != channel->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(int) switch_channel_check_signal(switch_channel_t *channel, switch_bool_t in_thread_only)
|
||||||
|
{
|
||||||
|
if (!in_thread_only || switch_core_session_in_thread(channel->session)) {
|
||||||
|
switch_ivr_parse_all_signal_data(channel->session);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t check_ready, switch_bool_t check_media)
|
SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t check_ready, switch_bool_t check_media)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
switch_assert(channel != NULL);
|
switch_assert(channel != NULL);
|
||||||
|
|
||||||
|
switch_channel_check_signal(channel, SWITCH_TRUE);
|
||||||
|
|
||||||
if (check_media) {
|
if (check_media) {
|
||||||
ret = ((switch_channel_test_flag(channel, CF_ANSWERED) ||
|
ret = ((switch_channel_test_flag(channel, CF_ANSWERED) ||
|
||||||
switch_channel_test_flag(channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(channel, CF_PROXY_MODE) &&
|
switch_channel_test_flag(channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(channel, CF_PROXY_MODE) &&
|
||||||
|
@ -1728,9 +1739,7 @@ SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret && switch_core_session_in_thread(channel->session)) {
|
|
||||||
switch_ivr_parse_all_signal_data(channel->session);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue