make dtmf duration defaults tweakable

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8126 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2008-04-18 17:03:34 +00:00
parent 56f6d7f17a
commit 96ff2abcd7
15 changed files with 97 additions and 39 deletions
@@ -562,7 +562,7 @@ SWITCH_STANDARD_API(status_function)
return SWITCH_STATUS_SUCCESS;
}
#define CTL_SYNTAX "[hupall|pause|resume|shutdown|sync_clock|reclaim_mem|max_sessions [num]|loglevel [level]]"
#define CTL_SYNTAX "[hupall|pause|resume|shutdown|sync_clock|reclaim_mem|max_sessions|max_dtmf_duration [num]|loglevel [level]]"
SWITCH_STANDARD_API(ctl_function)
{
int argc;
@@ -597,6 +597,18 @@ SWITCH_STANDARD_API(ctl_function)
}
switch_core_session_ctl(SCSC_MAX_SESSIONS, &arg);
stream->write_function(stream, "+OK max sessions: %d\n", arg);
} else if (!strcasecmp(argv[0], "max_dtmf_duration")) {
if (argc > 1) {
arg = atoi(argv[1]);
}
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], "default_dtmf_duration")) {
if (argc > 1) {
arg = atoi(argv[1]);
}
switch_core_session_ctl(SCSC_DEFAULT_DTMF_DURATION, &arg);
stream->write_function(stream, "+OK default dtmf duration: %d\n", arg);
} else if (!strcasecmp(argv[0], "loglevel")) {
if (argc > 1) {
if (*argv[1] > 47 && *argv[1] < 58) {
+1 -1
View File
@@ -1212,7 +1212,7 @@ static switch_status_t engage_device(unsigned int sample_rate, int codec_ms)
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
{
char *dtmf_str = argv[0];
switch_dtmf_t dtmf = {0, SWITCH_DEFAULT_DTMF_DURATION};
switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
if (switch_strlen_zero(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
@@ -2706,7 +2706,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
if (msg) {
if (*msg == '+') {
char *p = msg + 1;
switch_dtmf_t dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
while (p && *p) {
dtmf.digit = *p;
switch_channel_queue_dtmf(channel, &dtmf);
+1 -1
View File
@@ -1126,7 +1126,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
break;
case IAX_EVENT_DTMF:
if (channel) {
switch_dtmf_t dtmf = { (char) iaxevent->subclass , SWITCH_DEFAULT_DTMF_DURATION };
switch_dtmf_t dtmf = { (char) iaxevent->subclass , switch_core_default_dtmf_duration(0) };
if (globals.debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%c DTMF %s\n", dtmf.digit, switch_channel_get_name(channel));
}
@@ -1203,7 +1203,7 @@ static switch_status_t engage_ring_device(int sample_rate, int channels)
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
{
char *dtmf_str = argv[0];
switch_dtmf_t dtmf = {0, SWITCH_DEFAULT_DTMF_DURATION};
switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
if (switch_strlen_zero(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
+2 -2
View File
@@ -2382,7 +2382,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
const char *signal_ptr;
const char *rec_header;
const char *clientcode_header;
switch_dtmf_t dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
if (session) {
/* Get the channel */
@@ -2408,7 +2408,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
int tmp;
signal_ptr += 9;
if ((tmp = atoi(signal_ptr)) <= 0) {
tmp = SWITCH_DEFAULT_DTMF_DURATION;
tmp = switch_core_default_dtmf_duration(0);
}
dtmf.duration = tmp * 8;
}
@@ -761,7 +761,7 @@ JSClass event_class = {
static JSBool dtmf_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
switch_dtmf_t *dtmf;
int32 duration = SWITCH_DEFAULT_DTMF_DURATION;
int32 duration = switch_core_default_dtmf_duration(0);
char *ename;
if (argc > 0) {
@@ -774,7 +774,7 @@ static JSBool dtmf_construct(JSContext * cx, JSObject * obj, uintN argc, jsval *
if (argc > 1) {
JS_ValueToInt32(cx, argv[1], &duration);
if (duration <= 0) {
duration = SWITCH_DEFAULT_DTMF_DURATION;
duration = switch_core_default_dtmf_duration(0);
}
}