set rtp stack into optimal mode for transferring data during fax situations (that does not mean we support the idea of audio fax over ip......)

This commit is contained in:
Anthony Minessale committed 2011-12-08 12:26:36 -06:00
1 parent 19dad4a527
commit 4943f68208
5 files changed
+67 -1

No files matched your search

@@ -264,6 +264,40 @@ SWITCH_STANDARD_API(stop_tone_detect_api)
}
void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on)
{
switch_core_session_t *target_session = NULL;
int locked = 0;
if (self) {
target_session = session;
} else {
if (switch_core_session_get_partner(session, &target_session) == SWITCH_STATUS_SUCCESS) {
locked = 1;
} else {
target_session = NULL;
}
}
if (target_session) {
switch_core_session_message_t *msg;
msg = switch_core_session_alloc(target_session, sizeof(*msg));
MESSAGE_STAMP_FFL(msg);
msg->message_id = SWITCH_MESSAGE_INDICATE_AUDIO_DATA;
msg->from = __FILE__;
msg->numeric_arg = on;
switch_core_session_queue_message(target_session, msg);
if (locked) {
switch_core_session_rwunlock(target_session);
locked = 0;
}
}
}
/* **************************************************************************
CONFIGURATION
************************************************************************* */
@@ -138,3 +138,4 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session);
void spanfax_log_message(int level, const char *msg);
switch_status_t load_configuration(switch_bool_t reload);
void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on);
@@ -650,7 +650,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
{
switch_channel_t *channel;
private_t *tech_pvt;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
@@ -661,16 +661,23 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
case SWITCH_MESSAGE_INDICATE_ANSWER:
t31_call_event(tech_pvt->modem->t31_state, AT_CALL_EVENT_CONNECTED);
modem_set_state(tech_pvt->modem, MODEM_STATE_CONNECTED);
mod_spandsp_indicate_data(session, SWITCH_FALSE, SWITCH_TRUE);
break;
case SWITCH_MESSAGE_INDICATE_PROGRESS:
t31_call_event(tech_pvt->modem->t31_state, AT_CALL_EVENT_CONNECTED);
modem_set_state(tech_pvt->modem, MODEM_STATE_CONNECTED);
mod_spandsp_indicate_data(session, SWITCH_FALSE, SWITCH_TRUE);
break;
case SWITCH_MESSAGE_INDICATE_RINGING:
break;
case SWITCH_MESSAGE_INDICATE_BRIDGE:
mod_spandsp_indicate_data(session, SWITCH_FALSE, SWITCH_TRUE);
break;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
mod_spandsp_indicate_data(session, SWITCH_FALSE, SWITCH_TRUE);
break;
default:
break;
@@ -743,6 +750,7 @@ static void tech_attach(private_t *tech_pvt, modem_t *modem)
switch_channel_set_variable_printf(tech_pvt->channel, "modem_slot", "%d", modem->slot);
switch_channel_set_variable(tech_pvt->channel, "modem_devlink", modem->devlink);
switch_channel_set_variable(tech_pvt->channel, "modem_digits", modem->digits);
switch_channel_export_variable(tech_pvt->channel, "rtp_autoflush_during_bridge", "false", SWITCH_EXPORT_VARS_VARIABLE);
}