[asterisk-commits] chan dahdi: Add faxdetect timeout option. (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 21 18:25:52 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: chan_dahdi: Add faxdetect_timeout option.
......................................................................


chan_dahdi: Add faxdetect_timeout option.

The new option allows the channel driver's faxdetect option to timeout on
a call after the specified number of seconds into a call.  The new feature
is disabled if the timeout is set to zero.  The option is disabled by
default.

* Don't clear dsp_features after passing them to the dsp code in
my_pri_ss7_open_media().  We should still remember them especially for the
new faxdetect_timeout option.

ASTERISK-26214
Reported by: Richard Mudgett

Change-Id: Ieffd3fe788788d56282844774365546dce8ac810
---
M CHANGES
M channels/chan_dahdi.c
M channels/chan_dahdi.h
M configs/samples/chan_dahdi.conf.sample
4 files changed, 34 insertions(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve; Verified



diff --git a/CHANGES b/CHANGES
index 62d8178..c01739f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -364,6 +364,12 @@
 --- Functionality changes from Asterisk 13.10.0 to Asterisk 13.11.0 ----------
 ------------------------------------------------------------------------------
 
+chan_dahdi
+------------------
+ * Added "faxdetect_timeout" option.
+   The option determines how many seconds into a call before faxdetect
+   is disabled for the call.  Setting the value to zero disables the timeout.
+
 res_pjsip
 ------------------
  * Added "fax_detect_timeout" to endpoint.
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index e4b7c0e..b18dac9 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -2345,7 +2345,6 @@
 
 	if (pvt->dsp_features && pvt->dsp) {
 		ast_dsp_set_features(pvt->dsp, pvt->dsp_features);
-		pvt->dsp_features = 0;
 	}
 }
 #endif	/* defined(HAVE_PRI) || defined(HAVE_SS7) */
@@ -8640,6 +8639,15 @@
 		/* Perform busy detection etc on the dahdi line */
 		int mute;
 
+		if ((p->dsp_features & DSP_FEATURE_FAX_DETECT)
+			&& p->faxdetect_timeout
+			&& p->faxdetect_timeout <= ast_channel_get_up_time(ast)) {
+			p->dsp_features &= ~DSP_FEATURE_FAX_DETECT;
+			ast_dsp_set_features(p->dsp, p->dsp_features);
+			ast_debug(1, "Channel driver fax CNG detection timeout on %s\n",
+				ast_channel_name(ast));
+		}
+
 		f = ast_dsp_process(ast, p->dsp, &p->subs[idx].f);
 
 		/* Check if DSP code thinks we should be muting this frame and mute the conference if so */
@@ -12539,6 +12547,7 @@
 		tmp->callprogress = conf->chan.callprogress;
 		tmp->waitfordialtone = conf->chan.waitfordialtone;
 		tmp->dialtone_detect = conf->chan.dialtone_detect;
+		tmp->faxdetect_timeout = conf->chan.faxdetect_timeout;
 		tmp->cancallforward = conf->chan.cancallforward;
 		tmp->dtmfrelax = conf->chan.dtmfrelax;
 		tmp->callwaiting = tmp->permcallwaiting;
@@ -17790,6 +17799,10 @@
 				confp->chan.callprogress |= CALLPROGRESS_FAX_OUTGOING;
 			} else if (!strcasecmp(v->value, "both") || ast_true(v->value))
 				confp->chan.callprogress |= CALLPROGRESS_FAX_INCOMING | CALLPROGRESS_FAX_OUTGOING;
+		} else if (!strcasecmp(v->name, "faxdetect_timeout")) {
+			if (sscanf(v->value, "%30u", &confp->chan.faxdetect_timeout) != 1) {
+				confp->chan.faxdetect_timeout = 0;
+			}
 		} else if (!strcasecmp(v->name, "echocancel")) {
 			process_echocancel(confp, v->value, v->lineno);
 		} else if (!strcasecmp(v->name, "echotraining")) {
diff --git a/channels/chan_dahdi.h b/channels/chan_dahdi.h
index 4bb5d19..ab5c1eb 100644
--- a/channels/chan_dahdi.h
+++ b/channels/chan_dahdi.h
@@ -612,6 +612,11 @@
 	 */
 	int dialtone_detect;
 	int dialtone_scanning_time_elapsed;	/*!< Amount of audio scanned for dialtone, in frames */
+	/*!
+	 * \brief The number of seconds into call to disable fax detection.  (0 = disabled)
+	 * \note Set from the "faxdetect_timeout" value read in from chan_dahdi.conf
+	 */
+	unsigned int faxdetect_timeout;
 	struct timeval waitingfordt;			/*!< Time we started waiting for dialtone */
 	struct timeval flashtime;			/*!< Last flash-hook time */
 	/*! \brief Opaque DSP configuration structure. */
diff --git a/configs/samples/chan_dahdi.conf.sample b/configs/samples/chan_dahdi.conf.sample
index e0c69eb..a0c729c 100644
--- a/configs/samples/chan_dahdi.conf.sample
+++ b/configs/samples/chan_dahdi.conf.sample
@@ -1119,6 +1119,15 @@
 ;faxdetect=outgoing
 ;faxdetect=no
 ;
+; When 'faxdetect' is enabled, one could use 'faxdetect_timeout' to disable fax
+; detection after the specified number of seconds into a call.  Be aware that
+; outgoing analog channels may consider the channel is answered immediately
+; when dialing completes.  Analog does not have a reliable method of detecting
+; when the far end answers.  Zero disables the timeout.
+; Default is 0 to disable the timeout.
+;
+;faxdetect_timeout=30
+;
 ; When 'faxdetect' is used, one could use 'faxbuffers' to configure the DAHDI
 ; transmit buffer policy.  The default is *OFF*.  When this configuration
 ; option is used, the faxbuffer policy will be used for the life of the call

-- 
To view, visit https://gerrit.asterisk.org/3239
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieffd3fe788788d56282844774365546dce8ac810
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list