|
|
|
@ -152,17 +152,28 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if SPANDSP_RELEASE_DATE >= 20230620
|
|
|
|
|
static void handle_v18_status(void *user_data, int status)
|
|
|
|
|
{
|
|
|
|
|
switch_tdd_t *pvt = (switch_tdd_t *) user_data;
|
|
|
|
|
switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
|
|
|
|
|
|
|
|
|
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_INFO, "%s detected V.18 modem: %s\n", switch_channel_get_name(channel), v18_status_to_str(status));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static int get_v18_mode(switch_core_session_t *session)
|
|
|
|
|
{
|
|
|
|
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
|
|
|
|
const char *var;
|
|
|
|
|
int r = V18_MODE_5BIT_4545;
|
|
|
|
|
int r = V18_MODE_WEITBRECHT_5BIT_4545;
|
|
|
|
|
|
|
|
|
|
if ((var = switch_channel_get_variable(channel, "v18_mode"))) {
|
|
|
|
|
if (!strcasecmp(var, "5BIT_45") || !strcasecmp(var, "baudot")) {
|
|
|
|
|
r = V18_MODE_5BIT_4545;
|
|
|
|
|
r = V18_MODE_WEITBRECHT_5BIT_4545;
|
|
|
|
|
} else if (!strcasecmp(var, "5BIT_50")) {
|
|
|
|
|
r = V18_MODE_5BIT_50;
|
|
|
|
|
r = V18_MODE_WEITBRECHT_5BIT_50;
|
|
|
|
|
} else if (!strcasecmp(var, "DTMF")) {
|
|
|
|
|
r = V18_MODE_DTMF;
|
|
|
|
|
} else if (!strcasecmp(var, "EDT")) {
|
|
|
|
@ -213,8 +224,11 @@ switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const c
|
|
|
|
|
return SWITCH_STATUS_FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if SPANDSP_RELEASE_DATE >= 20230620
|
|
|
|
|
tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL, handle_v18_status, NULL);
|
|
|
|
|
#else
|
|
|
|
|
tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
v18_put(tdd_state, text, -1);
|
|
|
|
|
|
|
|
|
@ -260,7 +274,13 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pvt->session = session;
|
|
|
|
|
|
|
|
|
|
#if SPANDSP_RELEASE_DATE >= 20230620
|
|
|
|
|
pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL, handle_v18_status, pvt);
|
|
|
|
|
#else
|
|
|
|
|
pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
pvt->head_lead = TDD_LEAD;
|
|
|
|
|
|
|
|
|
|
v18_put(pvt->tdd_state, text, -1);
|
|
|
|
@ -338,7 +358,12 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pvt->session = session;
|
|
|
|
|
|
|
|
|
|
#if SPANDSP_RELEASE_DATE >= 20230620
|
|
|
|
|
pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt, handle_v18_status, pvt);
|
|
|
|
|
#else
|
|
|
|
|
pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if ((status = switch_core_media_bug_add(session, "spandsp_tdd_decode", NULL,
|
|
|
|
|
tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) {
|
|
|
|
|