mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-08 17:02:23 +00:00
mod_portaudio: check for CF_ANSWERED too
This commit is contained in:
parent
45fb1725b0
commit
72f2ffce5d
@ -318,16 +318,12 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
|
if (!tech_pvt->audio_endpoint &&
|
||||||
|
switch_test_flag(tech_pvt, TFLAG_OUTBOUND) &&
|
||||||
|
!switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
|
||||||
|
|
||||||
add_pvt(tech_pvt, PA_SLAVE);
|
add_pvt(tech_pvt, PA_SLAVE);
|
||||||
|
|
||||||
/* endpoints do not ring (yet) */
|
|
||||||
if (tech_pvt->audio_endpoint) {
|
|
||||||
ring_file = NULL;
|
|
||||||
goto endpoint_noring;
|
|
||||||
}
|
|
||||||
|
|
||||||
ring_file = globals.ring_file;
|
ring_file = globals.ring_file;
|
||||||
if ((val = switch_channel_get_variable(channel, "pa_ring_file"))) {
|
if ((val = switch_channel_get_variable(channel, "pa_ring_file"))) {
|
||||||
ring_file = val;
|
ring_file = val;
|
||||||
@ -356,20 +352,23 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endpoint_noring:
|
|
||||||
|
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
|
if (tech_pvt->audio_endpoint || switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
|
||||||
switch_mutex_lock(globals.pvt_lock);
|
switch_mutex_lock(globals.pvt_lock);
|
||||||
add_pvt(tech_pvt, PA_MASTER);
|
add_pvt(tech_pvt, PA_MASTER);
|
||||||
|
if (switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) {
|
||||||
switch_channel_mark_answered(channel);
|
switch_channel_mark_answered(channel);
|
||||||
switch_set_flag(tech_pvt, TFLAG_ANSWER);
|
switch_set_flag(tech_pvt, TFLAG_ANSWER);
|
||||||
|
}
|
||||||
switch_mutex_unlock(globals.pvt_lock);
|
switch_mutex_unlock(globals.pvt_lock);
|
||||||
switch_yield(1000000);
|
switch_yield(1000000);
|
||||||
} else {
|
} else {
|
||||||
switch_channel_mark_ring_ready(channel);
|
switch_channel_mark_ring_ready(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (switch_channel_get_state(channel) == CS_ROUTING && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
|
while (switch_channel_get_state(channel) == CS_ROUTING &&
|
||||||
|
!switch_channel_test_flag(channel, CF_ANSWERED) &&
|
||||||
|
!switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
|
||||||
switch_size_t olen = globals.readfile_timer.samples;
|
switch_size_t olen = globals.readfile_timer.samples;
|
||||||
|
|
||||||
if (switch_micro_time_now() - last >= waitsec) {
|
if (switch_micro_time_now() - last >= waitsec) {
|
||||||
@ -416,10 +415,12 @@ endpoint_noring:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||||
if (!switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
|
if (!switch_test_flag(tech_pvt, TFLAG_ANSWER) &&
|
||||||
|
!switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_NO_ANSWER);
|
switch_channel_hangup(channel, SWITCH_CAUSE_NO_ANSWER);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
switch_set_flag(tech_pvt, TFLAG_ANSWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_set_flag_locked(tech_pvt, TFLAG_IO);
|
switch_set_flag_locked(tech_pvt, TFLAG_IO);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user