From e10f0824018c10dc319ae9aaee13d681a1bfaa40 Mon Sep 17 00:00:00 2001
From: Christian Richter <christian.richter@beronet.com>
Date: Wed, 19 Sep 2007 09:48:33 +0000
Subject: [PATCH] Merged revisions 83023-83024 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r83023 | crichter | 2007-09-19 11:31:55 +0200 (Mi, 19 Sep 2007) | 1 line

added 'astdtmf' option to allow configuring the asterisk dtmf detector instead of the mISDN_dsp ones. also added the patch from irroot #10190, so that dtmf tones detected by the asterisk detector are passed outofband to asterisk, to make any use of dtmf tones at all.
........
r83024 | crichter | 2007-09-19 11:32:42 +0200 (Mi, 19 Sep 2007) | 1 line

removed comment which violates the coding guidelines.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83025 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_misdn.c              | 19 ++++++++++++++-----
 channels/misdn/chan_misdn_config.h |  1 +
 channels/misdn_config.c            |  4 ++++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index a8b108626a..837a74997b 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -1749,7 +1749,6 @@ static int read_config(struct chan_list *ch, int orig)
 	}
 	
 	port = bc->port;
-
 	chan_misdn_log(1, port, "read_config: Getting Config\n");
 
 	misdn_cfg_get(port, MISDN_CFG_LANGUAGE, lang, sizeof(lang));
@@ -1764,6 +1763,12 @@ static int read_config(struct chan_list *ch, int orig)
 	misdn_cfg_get(port, MISDN_CFG_INCOMING_EARLY_AUDIO, &ch->incoming_early_audio, sizeof(ch->incoming_early_audio));
 
 	misdn_cfg_get(port, MISDN_CFG_SENDDTMF, &bc->send_dtmf, sizeof(bc->send_dtmf));
+	
+	misdn_cfg_get( port, MISDN_CFG_ASTDTMF, &ch->ast_dsp, sizeof(int));
+
+	if (ch->ast_dsp) {
+		ch->ignore_dtmf=1;
+	}
 
 	misdn_cfg_get(port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(bc->need_more_infos));
 	misdn_cfg_get(port, MISDN_CFG_NTTIMEOUT, &ch->nttimeout, sizeof(ch->nttimeout));
@@ -1909,12 +1914,16 @@ static int read_config(struct chan_list *ch, int orig)
 
 	ch->overlap_dial_task = -1;
 	
-	if (ch->faxdetect) {
+	if (ch->faxdetect  || ch->ast_dsp) {
 		misdn_cfg_get(port, MISDN_CFG_FAXDETECT_TIMEOUT, &ch->faxdetect_timeout, sizeof(ch->faxdetect_timeout));
 		if (!ch->dsp)
 			ch->dsp = ast_dsp_new();
-		if (ch->dsp)
-			ast_dsp_set_features(ch->dsp, DSP_FEATURE_DTMF_DETECT | DSP_FEATURE_FAX_DETECT);
+		if (ch->dsp) {
+			if (ch->faxdetect) 
+				ast_dsp_set_features(ch->dsp, DSP_FEATURE_DTMF_DETECT | DSP_FEATURE_FAX_DETECT);
+			else 
+				ast_dsp_set_features(ch->dsp, DSP_FEATURE_DTMF_DETECT );
+		}
 		if (!ch->trans)
 			ch->trans = ast_translator_build_path(AST_FORMAT_SLINEAR, AST_FORMAT_ALAW);
 	}
@@ -2539,7 +2548,7 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame
  		chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass);
  	}
 
-	return frame;
+	return f;
 }
 
 
diff --git a/channels/misdn/chan_misdn_config.h b/channels/misdn/chan_misdn_config.h
index 87481deb30..42fdd8a818 100644
--- a/channels/misdn/chan_misdn_config.h
+++ b/channels/misdn/chan_misdn_config.h
@@ -48,6 +48,7 @@ enum misdn_cfg_elements {
 	MISDN_CFG_NODIALTONE,    /* int (bool) */
 	MISDN_CFG_IMMEDIATE,           /* int (bool) */
 	MISDN_CFG_SENDDTMF,           /* int (bool) */
+	MISDN_CFG_ASTDTMF,            /* int (bool) */
 	MISDN_CFG_HOLD_ALLOWED,        /* int (bool) */
 	MISDN_CFG_EARLY_BCONNECT,      /* int (bool) */
 	MISDN_CFG_INCOMING_EARLY_AUDIO,      /* int (bool) */
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index 008f0f6e46..6a68bfb1a5 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -231,6 +231,10 @@ static const struct misdn_cfg_spec port_spec[] = {
 		"\tinstead." },
 	{ "senddtmf", MISDN_CFG_SENDDTMF, MISDN_CTYPE_BOOL, "no", NONE,
 		"Enable this if we should produce DTMF Tones ourselves." },
+	{ "astdtmf", MISDN_CFG_ASTDTMF, MISDN_CTYPE_BOOL, "no", NONE,
+		"Enable this if you want to use the Asterisk dtmf detector\n"
+		"instead of the mISDN_dsp/hfcmulti one."
+		},
 	{ "hold_allowed", MISDN_CFG_HOLD_ALLOWED, MISDN_CTYPE_BOOL, "no", NONE,
 		"Enable this to have support for hold and retrieve." },
 	{ "early_bconnect", MISDN_CFG_EARLY_BCONNECT, MISDN_CTYPE_BOOL, "yes", NONE,
-- 
GitLab