more spacing fixes to mod_spandsp.
This commit is contained in:
parent
ec412c07d2
commit
1dbb05b690
|
@ -227,12 +227,12 @@ SWITCH_STANDARD_APP(t38_gateway_function)
|
|||
} else {
|
||||
if ((var = switch_channel_get_variable(channel, "t38_gateway_detect_timeout"))) {
|
||||
long to = atol(var);
|
||||
if (to > -1) {
|
||||
timeout = (time_t) (switch_epoch_time_now(NULL) + to);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s invalid timeout value.\n", switch_channel_get_name(channel));
|
||||
if (to > -1) {
|
||||
timeout = (time_t) (switch_epoch_time_now(NULL) + to);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s invalid timeout value.\n", switch_channel_get_name(channel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start);
|
||||
spandsp_fax_detect_session(session, "rw", timeout, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, 1, direction, NULL, t38_gateway_start);
|
||||
|
@ -461,8 +461,8 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel
|
|||
switch_core_session_queue_message(target_session, msg);
|
||||
|
||||
if (locked) {
|
||||
switch_core_session_rwunlock(target_session);
|
||||
locked = 0;
|
||||
switch_core_session_rwunlock(target_session);
|
||||
locked = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,3 +151,14 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const
|
|||
switch_status_t spandsp_stop_tdd_decode_session(switch_core_session_t *session);
|
||||
switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session);
|
||||
switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const char *text);
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:nil
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
|
|
@ -685,11 +685,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
|
|||
switch_assert(channel);
|
||||
|
||||
if ((tmp = switch_channel_get_variable(channel, "t38_gateway_redundancy"))) {
|
||||
int tmp_value;
|
||||
tmp_value = atoi(tmp);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX changing redundancy from %d:%d to %d:%d\n", fec_span, fec_entries, tmp_value, tmp_value );
|
||||
fec_entries = tmp_value;
|
||||
fec_span = tmp_value;
|
||||
int tmp_value;
|
||||
tmp_value = atoi(tmp);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX changing redundancy from %d:%d to %d:%d\n", fec_span, fec_entries, tmp_value, tmp_value );
|
||||
fec_entries = tmp_value;
|
||||
fec_span = tmp_value;
|
||||
}
|
||||
|
||||
switch (trans_mode) {
|
||||
|
@ -721,62 +721,62 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
|
|||
}
|
||||
break;
|
||||
case T38_MODE:
|
||||
{
|
||||
switch_core_session_message_t msg = { 0 };
|
||||
{
|
||||
switch_core_session_message_t msg = { 0 };
|
||||
|
||||
if (pvt->t38_state == NULL) {
|
||||
pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t));
|
||||
}
|
||||
if (pvt->t38_state == NULL) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (pvt->udptl_state == NULL) {
|
||||
pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t));
|
||||
}
|
||||
if (pvt->udptl_state == NULL) {
|
||||
t38_terminal_free(pvt->t38_state);
|
||||
pvt->t38_state = NULL;
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (pvt->t38_state == NULL) {
|
||||
pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t));
|
||||
}
|
||||
if (pvt->t38_state == NULL) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (pvt->udptl_state == NULL) {
|
||||
pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t));
|
||||
}
|
||||
if (pvt->udptl_state == NULL) {
|
||||
t38_terminal_free(pvt->t38_state);
|
||||
pvt->t38_state = NULL;
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
t38 = pvt->t38_state;
|
||||
t30 = t38_terminal_get_t30_state(t38);
|
||||
t38 = pvt->t38_state;
|
||||
t30 = t38_terminal_get_t30_state(t38);
|
||||
|
||||
memset(t38, 0, sizeof(t38_terminal_state_t));
|
||||
memset(t38, 0, sizeof(t38_terminal_state_t));
|
||||
|
||||
if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state);
|
||||
pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state);
|
||||
|
||||
if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries,
|
||||
(udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, fec_span, fec_entries,
|
||||
(udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
msg.from = __FILE__;
|
||||
msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE;
|
||||
switch_core_session_receive_message(pvt->session, &msg);
|
||||
msg.from = __FILE__;
|
||||
msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE;
|
||||
switch_core_session_receive_message(pvt->session, &msg);
|
||||
|
||||
/* add to timer thread processing */
|
||||
if (!add_pvt(pvt)) {
|
||||
if (channel) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
/* add to timer thread processing */
|
||||
if (!add_pvt(pvt)) {
|
||||
if (channel) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
}
|
||||
}
|
||||
|
||||
span_log_set_message_handler(&t38->logging, spanfax_log_message, NULL);
|
||||
span_log_set_message_handler(&t30->logging, spanfax_log_message, NULL);
|
||||
|
||||
if (pvt->verbose) {
|
||||
span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||
span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||
}
|
||||
}
|
||||
|
||||
span_log_set_message_handler(&t38->logging, spanfax_log_message, NULL);
|
||||
span_log_set_message_handler(&t30->logging, spanfax_log_message, NULL);
|
||||
|
||||
if (pvt->verbose) {
|
||||
span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||
span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case T38_GATEWAY_MODE:
|
||||
if (pvt->t38_gateway_state == NULL) {
|
||||
pvt->t38_gateway_state = (t38_gateway_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_gateway_state_t));
|
||||
|
@ -959,9 +959,9 @@ static t38_mode_t configure_t38(pvt_t *pvt)
|
|||
|
||||
if (t38_options->T38FaxRateManagement) {
|
||||
if (!strcasecmp(t38_options->T38FaxRateManagement, "transferredTCF")) {
|
||||
method = 2;
|
||||
method = 2;
|
||||
} else {
|
||||
method = 1;
|
||||
method = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,20 +79,20 @@ static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf,
|
|||
switch_size_t wrote;
|
||||
wrote = write(modem->master, buf, len);
|
||||
#else
|
||||
DWORD wrote;
|
||||
OVERLAPPED o;
|
||||
o.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
DWORD wrote;
|
||||
OVERLAPPED o;
|
||||
o.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
|
||||
/* Initialize the rest of the OVERLAPPED structure to zero. */
|
||||
o.Internal = 0;
|
||||
o.InternalHigh = 0;
|
||||
o.Offset = 0;
|
||||
o.OffsetHigh = 0;
|
||||
assert(o.hEvent);
|
||||
if (!WriteFile(modem->master, buf, (DWORD)len, &wrote, &o)) {
|
||||
GetOverlappedResult(modem->master, &o, &wrote, TRUE);
|
||||
}
|
||||
CloseHandle (o.hEvent);
|
||||
/* Initialize the rest of the OVERLAPPED structure to zero. */
|
||||
o.Internal = 0;
|
||||
o.InternalHigh = 0;
|
||||
o.Offset = 0;
|
||||
o.OffsetHigh = 0;
|
||||
assert(o.hEvent);
|
||||
if (!WriteFile(modem->master, buf, (DWORD)len, &wrote, &o)) {
|
||||
GetOverlappedResult(modem->master, &o, &wrote, TRUE);
|
||||
}
|
||||
CloseHandle (o.hEvent);
|
||||
#endif
|
||||
|
||||
if (wrote != len) {
|
||||
|
@ -244,12 +244,12 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
|
|||
snprintf(modem->devlink, sizeof(modem->devlink), "COM%d", modem->slot);
|
||||
|
||||
modem->master = CreateFile(modem->devlink,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
0,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
0);
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
0,
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
0);
|
||||
if(modem->master==INVALID_HANDLE_VALUE) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
if(GetLastError()==ERROR_FILE_NOT_FOUND) {
|
||||
|
@ -1463,3 +1463,14 @@ void modem_global_shutdown(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:nil
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
|
|
@ -155,3 +155,14 @@ switch_status_t modem_global_init(switch_loadable_module_interface_t **module_in
|
|||
void modem_global_shutdown(void);
|
||||
|
||||
#endif //_MOD_SPANDSP_MODEM_H
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:nil
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue