diff --git a/Makefile b/Makefile index 3392fead0310b8591cc2079dbcb35c8d71c88436..f983e2db1e4683e75bf239879733d7e20e14b54f 100644 --- a/Makefile +++ b/Makefile @@ -674,6 +674,7 @@ samples: adsi echo ";cache_record_files = yes ; Cache recorded sound files to another directory during recording" ; \ echo ";record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files)" ; \ echo ";transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded" ; \ + echo ";transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated" ; \ echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \ echo ";runuser = asterisk ; The user to run as" ; \ echo ";rungroup = asterisk ; The group to run as" ; \ diff --git a/include/asterisk/options.h b/include/asterisk/options.h index f974ca2c9ac4b07754b4b0d1e012b4fad0710ca3..794a75759e9fa280d038699b97dd964db0a185ef 100644 --- a/include/asterisk/options.h +++ b/include/asterisk/options.h @@ -64,7 +64,7 @@ enum ast_option_flags { AST_OPT_FLAG_OVERRIDE_CONFIG = (1 << 15), /*! Reconnect */ AST_OPT_FLAG_RECONNECT = (1 << 16), - /*! Transmit Silence during Record() */ + /*! Transmit Silence during Record() and DTMF Generation */ AST_OPT_FLAG_TRANSMIT_SILENCE = (1 << 17), /*! Suppress some warnings */ AST_OPT_FLAG_DONT_WARN = (1 << 18), diff --git a/main/app.c b/main/app.c index 7a2227fb9dfa99330b78fad30e5d5bd36fc6216e..ee72d1078b8dfd9c1414b4b837b09033b6cb8780 100644 --- a/main/app.c +++ b/main/app.c @@ -244,6 +244,7 @@ int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const ch { const char *ptr; int res = 0; + struct ast_silence_generator *silgen = NULL; if (!between) between = 100; @@ -258,6 +259,10 @@ int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const ch if (res < 0) return res; + if (ast_opt_transmit_silence) { + silgen = ast_channel_start_silence_generator(chan); + } + for (ptr = digits; *ptr; ptr++) { if (*ptr == 'w') { /* 'w' -- wait half a second */ @@ -284,6 +289,10 @@ int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const ch res = -1; } + if (silgen) { + ast_channel_stop_silence_generator(chan, silgen); + } + return res; } diff --git a/main/asterisk.c b/main/asterisk.c index 9ad011b49196090b7dad1bd192a530fafac42fe9..aac00c9b2ca6759663723907c12d0d46c9f9c8f3 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -2633,8 +2633,8 @@ static void ast_readconfig(void) /* Build transcode paths via SLINEAR, instead of directly */ } else if (!strcasecmp(v->name, "transcode_via_sln")) { ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSCODE_VIA_SLIN); - /* Transmit SLINEAR silence while a channel is being recorded */ - } else if (!strcasecmp(v->name, "transmit_silence_during_record")) { + /* Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated on a channel */ + } else if (!strcasecmp(v->name, "transmit_silence_during_record") || !strcasecmp(v->name, "transmit_silence")) { ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE); /* Enable internal timing */ } else if (!strcasecmp(v->name, "internal_timing")) {