FSCORE-442
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14893 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
00909ae79d
commit
dcfe0f5743
|
@ -26,8 +26,25 @@
|
|||
<param name="loglevel" value="debug"/>
|
||||
<!--Try to catch any crashes that can be recoverable (in the context of a call)-->
|
||||
<param name="crash-protection" value="false"/>
|
||||
<!-- The min_dtmf_duration specifies the minimum DTMF duration to use on
|
||||
outgoing events. Events shorter than this will be increased in duration
|
||||
to match min_dtmf_duration. You cannot configure a dtmf duration on a
|
||||
profile that is less than this setting. You may increase this value,
|
||||
but cannot set it lower than 400. This value cannot exceed
|
||||
max_dtmf_duration. -->
|
||||
<!--<param name="min_dtmf_duration" value="400"/>-->
|
||||
<!-- The max_dtmf_duration caps the playout of a DTMF event at the specified
|
||||
duration. Events exceeding this duration will be truncated to this
|
||||
duration. You cannot configure a duration on a profile that exceeds
|
||||
this setting. This setting can be lowered, but cannot exceed 192000.
|
||||
This setting cannot be set lower than min_dtmf_duration. -->
|
||||
<!--<param name="max_dtmf_duration" value="192000"/>-->
|
||||
<!--<param name="default_dtmf_duration" value="8000"/>-->
|
||||
<!-- The default_dtmf_duration specifies the DTMF duration to use on
|
||||
originated DTMF events or on events that are received without a
|
||||
duration specified. This value can be increased or lowered. This
|
||||
value is lower-bounded by min_dtmf_duration and upper-bounded by
|
||||
max_dtmf_duration. -->
|
||||
<!--<param name="default_dtmf_duration" value="2000"/>-->
|
||||
<!--
|
||||
If you want to send out voicemail notifications via Windows you'll need to change the mailer-app
|
||||
variable to the setting below:
|
||||
|
|
|
@ -202,6 +202,7 @@ struct switch_runtime {
|
|||
char *mailer_app;
|
||||
char *mailer_app_args;
|
||||
uint32_t max_dtmf_duration;
|
||||
uint32_t min_dtmf_duration;
|
||||
uint32_t default_dtmf_duration;
|
||||
switch_frame_t dummy_cng_frame;
|
||||
char dummy_data[5];
|
||||
|
|
|
@ -1890,6 +1890,7 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload);
|
|||
SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_str, const char *list_name, const char **token);
|
||||
#define switch_check_network_list_ip(_ip_str, _list_name) switch_check_network_list_ip_token(_ip_str, _list_name, NULL)
|
||||
SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable);
|
||||
SWITCH_DECLARE(uint32_t) switch_core_min_dtmf_duration(uint32_t duration);
|
||||
SWITCH_DECLARE(uint32_t) switch_core_max_dtmf_duration(uint32_t duration);
|
||||
SWITCH_DECLARE(uint32_t) switch_core_default_dtmf_duration(uint32_t duration);
|
||||
SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string);
|
||||
|
|
|
@ -102,6 +102,7 @@ SWITCH_BEGIN_EXTERN_C
|
|||
#define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
|
||||
#endif
|
||||
#define SWITCH_DEFAULT_DTMF_DURATION 2000
|
||||
#define SWITCH_MIN_DTMF_DURATION 400
|
||||
#define SWITCH_MAX_DTMF_DURATION 192000
|
||||
#define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
|
||||
#ifdef WIN32
|
||||
|
@ -1371,6 +1372,7 @@ typedef enum {
|
|||
SCSC_MAX_SESSIONS,
|
||||
SCSC_SYNC_CLOCK,
|
||||
SCSC_MAX_DTMF_DURATION,
|
||||
SCSC_MIN_DTMF_DURATION,
|
||||
SCSC_DEFAULT_DTMF_DURATION,
|
||||
SCSC_SHUTDOWN_ELEGANT,
|
||||
SCSC_SHUTDOWN_ASAP,
|
||||
|
|
|
@ -1242,7 +1242,7 @@ SWITCH_STANDARD_API(status_function)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define CTL_SYNTAX "[send_sighup|hupall|pause|resume|shutdown [cancel|elegant|asap|restart]|sps|sync_clock|reclaim_mem|max_sessions|max_dtmf_duration [num]|loglevel [level]]"
|
||||
#define CTL_SYNTAX "[send_sighup|hupall|pause|resume|shutdown [cancel|elegant|asap|restart]|sps|sync_clock|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|loglevel [level]]"
|
||||
SWITCH_STANDARD_API(ctl_function)
|
||||
{
|
||||
int argc;
|
||||
|
@ -1311,6 +1311,12 @@ SWITCH_STANDARD_API(ctl_function)
|
|||
}
|
||||
switch_core_session_ctl(SCSC_MAX_DTMF_DURATION, &arg);
|
||||
stream->write_function(stream, "+OK max dtmf duration: %d\n", arg);
|
||||
} else if (!strcasecmp(argv[0], "min_dtmf_duration")) {
|
||||
if (argc > 1) {
|
||||
arg = atoi(argv[1]);
|
||||
}
|
||||
switch_core_session_ctl(SCSC_MIN_DTMF_DURATION, &arg);
|
||||
stream->write_function(stream, "+OK min dtmf duration: %d\n", arg);
|
||||
} else if (!strcasecmp(argv[0], "default_dtmf_duration")) {
|
||||
if (argc > 1) {
|
||||
arg = atoi(argv[1]);
|
||||
|
@ -3636,6 +3642,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
|||
switch_console_set_complete("add fsctl reclaim_mem");
|
||||
switch_console_set_complete("add fsctl max_sessions");
|
||||
switch_console_set_complete("add fsctl max_dtmf_duration");
|
||||
switch_console_set_complete("add fsctl min_dtmf_duration");
|
||||
switch_console_set_complete("add fsctl default_dtmf_duration");
|
||||
SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
|
||||
SWITCH_ADD_API(commands_api_interface, "version", "Show version of the switch", version_function, "");
|
||||
SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
|
||||
|
|
|
@ -1926,7 +1926,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
|||
profile->challenge_realm = switch_core_strdup(profile->pool, val);
|
||||
} else if (!strcasecmp(var, "dtmf-duration")) {
|
||||
int dur = atoi(val);
|
||||
if (dur > 10 && dur < 8000) {
|
||||
if (dur > switch_core_min_dtmf_duration(0) && dur < switch_core_max_dtmf_duration(0)) {
|
||||
profile->dtmf_duration = dur;
|
||||
} else {
|
||||
profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
|
||||
|
@ -2598,7 +2598,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
profile->challenge_realm = switch_core_strdup(profile->pool, val);
|
||||
} else if (!strcasecmp(var, "dtmf-duration")) {
|
||||
int dur = atoi(val);
|
||||
if (dur > 10 && dur < 8000) {
|
||||
if (dur > switch_core_min_dtmf_duration(0) && dur < switch_core_max_dtmf_duration(0)) {
|
||||
profile->dtmf_duration = dur;
|
||||
} else {
|
||||
profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
|
||||
|
|
|
@ -894,6 +894,17 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DEFAULT_DTMF_DURATION_get() {
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MIN_DTMF_DURATION_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 400;
|
||||
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_DTMF_DURATION_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
@ -6732,6 +6743,62 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_video_frame(void * j
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_read_impl(void * jarg1, void * jarg2) {
|
||||
int jresult ;
|
||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||
switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
|
||||
switch_status_t result;
|
||||
|
||||
arg1 = (switch_core_session_t *)jarg1;
|
||||
arg2 = (switch_codec_implementation_t *)jarg2;
|
||||
result = (switch_status_t)switch_core_session_set_read_impl(arg1,(switch_codec_implementation const *)arg2);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_write_impl(void * jarg1, void * jarg2) {
|
||||
int jresult ;
|
||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||
switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
|
||||
switch_status_t result;
|
||||
|
||||
arg1 = (switch_core_session_t *)jarg1;
|
||||
arg2 = (switch_codec_implementation_t *)jarg2;
|
||||
result = (switch_status_t)switch_core_session_set_write_impl(arg1,(switch_codec_implementation const *)arg2);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_read_impl(void * jarg1, void * jarg2) {
|
||||
int jresult ;
|
||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||
switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
|
||||
switch_status_t result;
|
||||
|
||||
arg1 = (switch_core_session_t *)jarg1;
|
||||
arg2 = (switch_codec_implementation_t *)jarg2;
|
||||
result = (switch_status_t)switch_core_session_set_video_read_impl(arg1,(switch_codec_implementation const *)arg2);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_write_impl(void * jarg1, void * jarg2) {
|
||||
int jresult ;
|
||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||
switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
|
||||
switch_status_t result;
|
||||
|
||||
arg1 = (switch_core_session_t *)jarg1;
|
||||
arg2 = (switch_codec_implementation_t *)jarg2;
|
||||
result = (switch_status_t)switch_core_session_set_video_write_impl(arg1,(switch_codec_implementation const *)arg2);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reset(void * jarg1, int jarg2, int jarg3) {
|
||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||
switch_bool_t arg2 ;
|
||||
|
@ -8348,6 +8415,18 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_monotonic(int jarg1) {
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_min_dtmf_duration(unsigned long jarg1) {
|
||||
unsigned long jresult ;
|
||||
uint32_t arg1 ;
|
||||
uint32_t result;
|
||||
|
||||
arg1 = (uint32_t)jarg1;
|
||||
result = (uint32_t)switch_core_min_dtmf_duration(arg1);
|
||||
jresult = (unsigned long)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_max_dtmf_duration(unsigned long jarg1) {
|
||||
unsigned long jresult ;
|
||||
uint32_t arg1 ;
|
||||
|
|
|
@ -1399,6 +1399,26 @@ public class freeswitch {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static switch_status_t switch_core_session_set_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
|
||||
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static switch_status_t switch_core_session_set_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
|
||||
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static switch_status_t switch_core_session_set_video_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
|
||||
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static switch_status_t switch_core_session_set_video_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
|
||||
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void switch_core_session_reset(SWIGTYPE_p_switch_core_session session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec) {
|
||||
freeswitchPINVOKE.switch_core_session_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf, (int)reset_read_codec);
|
||||
}
|
||||
|
@ -1977,6 +1997,11 @@ public class freeswitch {
|
|||
freeswitchPINVOKE.switch_time_set_monotonic((int)enable);
|
||||
}
|
||||
|
||||
public static uint switch_core_min_dtmf_duration(uint duration) {
|
||||
uint ret = freeswitchPINVOKE.switch_core_min_dtmf_duration(duration);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static uint switch_core_max_dtmf_duration(uint duration) {
|
||||
uint ret = freeswitchPINVOKE.switch_core_max_dtmf_duration(duration);
|
||||
return ret;
|
||||
|
@ -4280,6 +4305,7 @@ public class freeswitch {
|
|||
public static readonly string SWITCH_SEQ_CLEARLINEEND = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINEEND_get();
|
||||
public static readonly string SWITCH_SEQ_CLEARSCR = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_get();
|
||||
public static readonly int SWITCH_DEFAULT_DTMF_DURATION = freeswitchPINVOKE.SWITCH_DEFAULT_DTMF_DURATION_get();
|
||||
public static readonly int SWITCH_MIN_DTMF_DURATION = freeswitchPINVOKE.SWITCH_MIN_DTMF_DURATION_get();
|
||||
public static readonly int SWITCH_MAX_DTMF_DURATION = freeswitchPINVOKE.SWITCH_MAX_DTMF_DURATION_get();
|
||||
public static readonly string SWITCH_PATH_SEPARATOR = freeswitchPINVOKE.SWITCH_PATH_SEPARATOR_get();
|
||||
public static readonly string SWITCH_URL_SEPARATOR = freeswitchPINVOKE.SWITCH_URL_SEPARATOR_get();
|
||||
|
@ -4753,6 +4779,9 @@ class freeswitchPINVOKE {
|
|||
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_DTMF_DURATION_get")]
|
||||
public static extern int SWITCH_DEFAULT_DTMF_DURATION_get();
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MIN_DTMF_DURATION_get")]
|
||||
public static extern int SWITCH_MIN_DTMF_DURATION_get();
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_DTMF_DURATION_get")]
|
||||
public static extern int SWITCH_MAX_DTMF_DURATION_get();
|
||||
|
||||
|
@ -6169,6 +6198,18 @@ class freeswitchPINVOKE {
|
|||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_video_frame")]
|
||||
public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_read_impl")]
|
||||
public static extern int switch_core_session_set_read_impl(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_write_impl")]
|
||||
public static extern int switch_core_session_set_write_impl(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_read_impl")]
|
||||
public static extern int switch_core_session_set_video_read_impl(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_write_impl")]
|
||||
public static extern int switch_core_session_set_video_write_impl(HandleRef jarg1, HandleRef jarg2);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reset")]
|
||||
public static extern void switch_core_session_reset(HandleRef jarg1, int jarg2, int jarg3);
|
||||
|
||||
|
@ -6523,6 +6564,9 @@ class freeswitchPINVOKE {
|
|||
[DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_monotonic")]
|
||||
public static extern void switch_time_set_monotonic(int jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_min_dtmf_duration")]
|
||||
public static extern uint switch_core_min_dtmf_duration(uint jarg1);
|
||||
|
||||
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_max_dtmf_duration")]
|
||||
public static extern uint switch_core_max_dtmf_duration(uint jarg1);
|
||||
|
||||
|
@ -24486,6 +24530,7 @@ public enum switch_session_ctl_t {
|
|||
SCSC_MAX_SESSIONS,
|
||||
SCSC_SYNC_CLOCK,
|
||||
SCSC_MAX_DTMF_DURATION,
|
||||
SCSC_MIN_DTMF_DURATION,
|
||||
SCSC_DEFAULT_DTMF_DURATION,
|
||||
SCSC_SHUTDOWN_ELEGANT,
|
||||
SCSC_SHUTDOWN_ASAP,
|
||||
|
|
|
@ -11820,17 +11820,17 @@ XS(SWIG_init) {
|
|||
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
|
||||
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
|
||||
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
|
||||
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
|
||||
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
|
||||
SvREADONLY_on(sv);
|
||||
} while(0) /*@SWIG@*/;
|
||||
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
|
||||
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
|
||||
SvREADONLY_on(sv);
|
||||
} while(0) /*@SWIG@*/;
|
||||
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
|
||||
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
|
||||
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
|
||||
SvREADONLY_on(sv);
|
||||
|
|
|
@ -276,6 +276,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan
|
|||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(channel), new_dtmf.digit, new_dtmf.duration);
|
||||
new_dtmf.duration = switch_core_max_dtmf_duration(0);
|
||||
} else if (new_dtmf.duration < switch_core_min_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(channel), new_dtmf.digit, new_dtmf.duration);
|
||||
new_dtmf.duration = switch_core_min_dtmf_duration(0);
|
||||
} else if (!new_dtmf.duration) {
|
||||
new_dtmf.duration = switch_core_default_dtmf_duration(0);
|
||||
}
|
||||
|
@ -333,6 +337,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_
|
|||
if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "EXCESSIVE DTMF DIGIT LEN %c %d\n", dtmf.digit, dtmf.duration);
|
||||
dtmf.duration = switch_core_max_dtmf_duration(0);
|
||||
} else if (dtmf.duration < switch_core_min_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "SHORT DTMF DIGIT LEN %c %d\n", dtmf.digit, dtmf.duration);
|
||||
dtmf.duration = switch_core_min_dtmf_duration(0);
|
||||
} else if (!dtmf.duration) {
|
||||
dtmf.duration = switch_core_default_dtmf_duration(0);
|
||||
}
|
||||
|
@ -377,6 +384,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *ch
|
|||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(channel), dtmf->digit, dtmf->duration);
|
||||
dtmf->duration = switch_core_max_dtmf_duration(0);
|
||||
} else if (dtmf->duration < switch_core_min_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(channel), dtmf->digit, dtmf->duration);
|
||||
dtmf->duration = switch_core_min_dtmf_duration(0);
|
||||
} else if (!dtmf->duration) {
|
||||
dtmf->duration = switch_core_default_dtmf_duration(0);
|
||||
}
|
||||
|
|
|
@ -1104,6 +1104,9 @@ SWITCH_DECLARE(uint32_t) switch_core_max_dtmf_duration(uint32_t duration)
|
|||
if (duration > SWITCH_MAX_DTMF_DURATION) {
|
||||
duration = SWITCH_MAX_DTMF_DURATION;
|
||||
}
|
||||
if (duration < SWITCH_MIN_DTMF_DURATION) {
|
||||
duration = SWITCH_MIN_DTMF_DURATION;
|
||||
}
|
||||
runtime.max_dtmf_duration = duration;
|
||||
}
|
||||
return runtime.max_dtmf_duration;
|
||||
|
@ -1112,14 +1115,30 @@ SWITCH_DECLARE(uint32_t) switch_core_max_dtmf_duration(uint32_t duration)
|
|||
SWITCH_DECLARE(uint32_t) switch_core_default_dtmf_duration(uint32_t duration)
|
||||
{
|
||||
if (duration) {
|
||||
if (duration < SWITCH_DEFAULT_DTMF_DURATION) {
|
||||
duration = SWITCH_DEFAULT_DTMF_DURATION;
|
||||
if (duration < SWITCH_MIN_DTMF_DURATION) {
|
||||
duration = SWITCH_MIN_DTMF_DURATION;
|
||||
}
|
||||
if (duration > SWITCH_MAX_DTMF_DURATION) {
|
||||
duration = SWITCH_MAX_DTMF_DURATION;
|
||||
}
|
||||
runtime.default_dtmf_duration = duration;
|
||||
}
|
||||
return runtime.default_dtmf_duration;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(uint32_t) switch_core_min_dtmf_duration(uint32_t duration)
|
||||
{
|
||||
if (duration) {
|
||||
if (duration < SWITCH_MIN_DTMF_DURATION) {
|
||||
duration = SWITCH_MIN_DTMF_DURATION;
|
||||
}
|
||||
if (duration > SWITCH_MAX_DTMF_DURATION) {
|
||||
duration = SWITCH_MAX_DTMF_DURATION;
|
||||
}
|
||||
}
|
||||
return runtime.min_dtmf_duration;
|
||||
}
|
||||
|
||||
static void switch_core_set_serial(void)
|
||||
{
|
||||
char buf[13] = "";
|
||||
|
@ -1184,6 +1203,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
|||
runtime.mailer_app_args = "-t";
|
||||
runtime.max_dtmf_duration = SWITCH_MAX_DTMF_DURATION;
|
||||
runtime.default_dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
|
||||
runtime.min_dtmf_duration = SWITCH_MIN_DTMF_DURATION;
|
||||
|
||||
/* INIT APR and Create the pool context */
|
||||
if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -1395,6 +1415,11 @@ static void switch_load_core_config(const char *file)
|
|||
if (tmp > 0) {
|
||||
switch_core_max_dtmf_duration((uint32_t) tmp);
|
||||
}
|
||||
} else if (!strcasecmp(var, "min_dtmf_duration") && !switch_strlen_zero(val)) {
|
||||
int tmp = atoi(val);
|
||||
if (tmp > 0) {
|
||||
switch_core_min_dtmf_duration((uint32_t) tmp);
|
||||
}
|
||||
} else if (!strcasecmp(var, "default_dtmf_duration") && !switch_strlen_zero(val)) {
|
||||
int tmp = atoi(val);
|
||||
if (tmp > 0) {
|
||||
|
@ -1610,6 +1635,9 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_
|
|||
case SCSC_MAX_DTMF_DURATION:
|
||||
*val = switch_core_max_dtmf_duration(*val);
|
||||
break;
|
||||
case SCSC_MIN_DTMF_DURATION:
|
||||
*val = switch_core_min_dtmf_duration(*val);
|
||||
break;
|
||||
case SCSC_DEFAULT_DTMF_DURATION:
|
||||
*val = switch_core_default_dtmf_duration(*val);
|
||||
break;
|
||||
|
|
|
@ -1102,6 +1102,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio
|
|||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
|
||||
new_dtmf.duration = switch_core_max_dtmf_duration(0);
|
||||
} else if (new_dtmf.duration < switch_core_min_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
|
||||
new_dtmf.duration = switch_core_min_dtmf_duration(0);
|
||||
} else if (!new_dtmf.duration) {
|
||||
new_dtmf.duration = switch_core_default_dtmf_duration(0);
|
||||
}
|
||||
|
@ -1132,6 +1136,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
|
|||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
|
||||
new_dtmf.duration = switch_core_max_dtmf_duration(0);
|
||||
} else if (new_dtmf.duration < switch_core_min_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
|
||||
new_dtmf.duration = switch_core_min_dtmf_duration(0);
|
||||
} else if (!new_dtmf.duration) {
|
||||
new_dtmf.duration = switch_core_default_dtmf_duration(0);
|
||||
}
|
||||
|
@ -1203,6 +1211,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
|
|||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
|
||||
dtmf.duration = switch_core_max_dtmf_duration(0);
|
||||
} else if (dtmf.duration < switch_core_min_dtmf_duration(0)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
|
||||
switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
|
||||
dtmf.duration = switch_core_min_dtmf_duration(0);
|
||||
} else if (!dtmf.duration) {
|
||||
dtmf.duration = switch_core_default_dtmf_duration(0);
|
||||
}
|
||||
|
|
|
@ -2299,8 +2299,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_sessi
|
|||
|
||||
if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
|
||||
*rdigit = *dtmf;
|
||||
if (rdigit->duration < switch_core_default_dtmf_duration(0)) {
|
||||
rdigit->duration = switch_core_default_dtmf_duration(0);
|
||||
if (rdigit->duration < switch_core_min_dtmf_duration(0)) {
|
||||
rdigit->duration = switch_core_min_dtmf_duration(0);
|
||||
}
|
||||
|
||||
if ((switch_queue_trypush(rtp_session->dtmf_data.dtmf_queue, rdigit)) != SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -2324,8 +2324,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833_in(switch_rtp_t *rtp_se
|
|||
|
||||
if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
|
||||
*rdigit = *dtmf;
|
||||
if (rdigit->duration < switch_core_default_dtmf_duration(0)) {
|
||||
rdigit->duration = switch_core_default_dtmf_duration(0);
|
||||
if (rdigit->duration < switch_core_min_dtmf_duration(0)) {
|
||||
rdigit->duration = switch_core_min_dtmf_duration(0);
|
||||
}
|
||||
|
||||
if ((switch_queue_trypush(rtp_session->dtmf_data.dtmf_inqueue, rdigit)) != SWITCH_STATUS_SUCCESS) {
|
||||
|
|
Loading…
Reference in New Issue