FS-3624 --resolve
This commit is contained in:
parent
bad5964b94
commit
d6d187486c
|
@ -74,25 +74,35 @@ SWITCH_STANDARD_APP(stop_dtmf_session_function)
|
||||||
SWITCH_STANDARD_APP(spandsp_fax_detect_session_function)
|
SWITCH_STANDARD_APP(spandsp_fax_detect_session_function)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
char *argv[3] = { 0 };
|
char *argv[4] = { 0 };
|
||||||
char *dupdata;
|
char *dupdata;
|
||||||
const char *app = NULL, *arg = NULL;
|
const char *app = NULL, *arg = NULL;
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
|
int tone_type = MODEM_CONNECT_TONES_FAX_CNG;
|
||||||
|
|
||||||
if (!zstr(data) && (dupdata = switch_core_session_strdup(session, data))) {
|
if (!zstr(data) && (dupdata = switch_core_session_strdup(session, data))) {
|
||||||
if ((argc = switch_split(dupdata, ' ', argv)) == 3) {
|
if ((argc = switch_split(dupdata, ' ', argv)) >= 2) {
|
||||||
app = argv[0];
|
app = argv[0];
|
||||||
arg = argv[1];
|
arg = argv[1];
|
||||||
timeout = atoi(argv[2]);
|
if (argc > 2) {
|
||||||
if (timeout < 0) {
|
timeout = atoi(argv[2]);
|
||||||
timeout = 0;
|
if (timeout < 0) {
|
||||||
}
|
timeout = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (argc > 3) {
|
||||||
|
if (!strcmp(argv[3], "ced")) {
|
||||||
|
tone_type = MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE;
|
||||||
|
} else {
|
||||||
|
tone_type = MODEM_CONNECT_TONES_FAX_CNG;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app) {
|
if (app) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Enabling fax detection '%s' '%s'\n", argv[0], argv[1]);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Enabling fax detection '%s' '%s'\n", argv[0], argv[1]);
|
||||||
spandsp_fax_detect_session(session, "rw", timeout, 1, app, arg, NULL);
|
spandsp_fax_detect_session(session, "rw", timeout, tone_type, 1, app, arg, NULL);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Enable fax detection '%s' '%s'\n", argv[0], argv[1]);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Enable fax detection '%s' '%s'\n", argv[0], argv[1]);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +161,7 @@ SWITCH_STANDARD_APP(t38_gateway_function)
|
||||||
}
|
}
|
||||||
|
|
||||||
//switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start);
|
//switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start);
|
||||||
spandsp_fax_detect_session(session, "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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +280,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init)
|
||||||
SWITCH_ADD_APP(app_interface, "spandsp_start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_MEDIA_TAP);
|
SWITCH_ADD_APP(app_interface, "spandsp_start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_MEDIA_TAP);
|
||||||
|
|
||||||
SWITCH_ADD_APP(app_interface, "spandsp_start_fax_detect", "start fax detect", "start fax detect", spandsp_fax_detect_session_function,
|
SWITCH_ADD_APP(app_interface, "spandsp_start_fax_detect", "start fax detect", "start fax detect", spandsp_fax_detect_session_function,
|
||||||
"<app>[ <arg>][ <timeout>]", SAF_NONE);
|
"<app>[ <arg>][ <timeout>][ <tone_type>]", SAF_NONE);
|
||||||
|
|
||||||
SWITCH_ADD_APP(app_interface, "spandsp_stop_fax_detect", "stop fax detect", "stop fax detect", spandsp_stop_fax_detect_session_function, "", SAF_NONE);
|
SWITCH_ADD_APP(app_interface, "spandsp_stop_fax_detect", "stop fax detect", "stop fax detect", spandsp_stop_fax_detect_session_function, "", SAF_NONE);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ switch_status_t callprogress_detector_start(switch_core_session_t *session, cons
|
||||||
switch_status_t callprogress_detector_stop(switch_core_session_t *session);
|
switch_status_t callprogress_detector_stop(switch_core_session_t *session);
|
||||||
|
|
||||||
switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
|
switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
|
||||||
const char *flags, int timeout,
|
const char *flags, int timeout, int tone_type,
|
||||||
int hits, const char *app, const char *data, switch_tone_detect_callback_t callback);
|
int hits, const char *app, const char *data, switch_tone_detect_callback_t callback);
|
||||||
|
|
||||||
switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session);
|
switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session);
|
||||||
|
|
|
@ -1861,6 +1861,7 @@ typedef struct {
|
||||||
char *data;
|
char *data;
|
||||||
char *key;
|
char *key;
|
||||||
int up;
|
int up;
|
||||||
|
int tone_type;
|
||||||
int total_hits;
|
int total_hits;
|
||||||
int hits;
|
int hits;
|
||||||
int sleep;
|
int sleep;
|
||||||
|
@ -1910,7 +1911,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da
|
||||||
case SWITCH_ABC_TYPE_INIT:
|
case SWITCH_ABC_TYPE_INIT:
|
||||||
if (cont) {
|
if (cont) {
|
||||||
cont->bug_running = 1;
|
cont->bug_running = 1;
|
||||||
modem_connect_tones_rx_init(&cont->rx_tones, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL);
|
modem_connect_tones_rx_init(&cont->rx_tones, cont->tone_type, NULL, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SWITCH_ABC_TYPE_CLOSE:
|
case SWITCH_ABC_TYPE_CLOSE:
|
||||||
|
@ -2018,7 +2019,7 @@ switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
|
switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
|
||||||
const char *flags, int timeout,
|
const char *flags, int timeout, int tone_type,
|
||||||
int hits, const char *app, const char *data, switch_tone_detect_callback_t callback)
|
int hits, const char *app, const char *data, switch_tone_detect_callback_t callback)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
@ -2051,6 +2052,7 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
|
||||||
cont->data = switch_core_session_strdup(session, data);
|
cont->data = switch_core_session_strdup(session, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cont->tone_type = tone_type;
|
||||||
cont->callback = callback;
|
cont->callback = callback;
|
||||||
cont->up = 1;
|
cont->up = 1;
|
||||||
cont->session = session;
|
cont->session = session;
|
||||||
|
|
Loading…
Reference in New Issue