FS-10634 [mod_spandsp]: txfax failing with 488 Not Acceptable Here race

This commit is contained in:
Brian West 2019-06-04 17:12:47 -05:00 committed by Andrey Volk
parent 38f0f0662f
commit d355a57264
3 changed files with 37 additions and 2 deletions

View File

@ -101,6 +101,9 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *oth
SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel,
switch_channel_flag_t want_flag,
switch_bool_t pres, uint32_t to, switch_channel_t *super_channel);
SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_app_flag(switch_channel_t *channel,
uint32_t app_flag,
const char *key, switch_bool_t pres, uint32_t to);
SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_channel_t *channel,
const char *file, const char *func, int line, switch_channel_state_t state);

View File

@ -1748,6 +1748,39 @@ SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *c
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_app_flag(switch_channel_t *channel,
uint32_t app_flag,
const char *key, switch_bool_t pres, uint32_t to)
{
if (to) {
to++;
}
for (;;) {
if (pres) {
if (switch_channel_test_app_flag_key(key, channel, app_flag)) {
break;
}
} else {
if (!switch_channel_test_app_flag_key(key, channel, app_flag)) {
break;
}
}
switch_cond_next();
if (switch_channel_down(channel)) {
return SWITCH_STATUS_FALSE;
}
if (to && !--to) {
return SWITCH_STATUS_FALSE;
}
}
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(void) switch_channel_set_cap_value(switch_channel_t *channel, switch_channel_cap_t cap, uint32_t value)
{

View File

@ -5223,9 +5223,8 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
}
}
/* do nothing here, mod_fax will trigger a response (if it's listening =/) */
if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38_POSSIBLE)) {
if (switch_channel_wait_for_app_flag(channel, CF_APP_T38_POSSIBLE, "T38", SWITCH_TRUE, 2000)) {
fmatch = 1;
} else {