[Asterisk-code-review] chan_dahdi: allow audio to pass during call setup phase (asterisk[18])

Sarah Autumn asteriskteam at digium.com
Mon Jan 31 17:42:11 CST 2022


Sarah Autumn has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/17948 )


Change subject: chan_dahdi: allow audio to pass during call setup phase
......................................................................

chan_dahdi: allow audio to pass during call setup phase

This patch allows the user to specify channels where the audio
should be passed to the caller immediately, instead of waiting for
call setup to complete. This is useful for those wishing to
troubleshoot or otherwise interact with electromechanical switching
equipment, where inband audio during call setup is the expected norm.

Users can configure this setting in chan_dahdi.conf by using "hearpulsing=yes"
on the desired channels. Separate configuration of DAHDI system.conf is also required.

ASTERISK-29890

Change-Id: Ibcef6e21020ab6e64f16f4761ec1e0e7fce9c260
---
M channels/chan_dahdi.c
M channels/chan_dahdi.h
M channels/sig_analog.c
M channels/sig_analog.h
M configs/samples/chan_dahdi.conf.sample
5 files changed, 29 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/17948/1

diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index ad7a8e5..6263a3a 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -963,6 +963,7 @@
 			.use_callerid = 1,
 			.sig = -1,
 			.outsigmod = -1,
+			.hearpulsing = 0,
 
 			.cid_rxgain = +5.0,
 
@@ -12660,6 +12661,7 @@
 		tmp->dahditrcallerid = conf->chan.dahditrcallerid;
 		tmp->restrictcid = conf->chan.restrictcid;
 		tmp->use_callingpres = conf->chan.use_callingpres;
+		tmp->hearpulsing = conf->chan.hearpulsing;
 		if (tmp->usedistinctiveringdetection) {
 			if (!tmp->use_callerid) {
 				ast_log(LOG_NOTICE, "Distinctive Ring detect requires 'usecallerid' be on\n");
@@ -12810,6 +12812,7 @@
 		tmp->ani_info_digits = conf->chan.ani_info_digits;
 		tmp->ani_wink_time = conf->chan.ani_wink_time;
 		tmp->ani_timeout = conf->chan.ani_timeout;
+		tmp->hearpulsing = conf->chan.hearpulsing;
 		tmp->hanguponpolarityswitch = conf->chan.hanguponpolarityswitch;
 		tmp->sendcalleridafter = conf->chan.sendcalleridafter;
 		ast_cc_copy_config_params(tmp->cc_params, conf->chan.cc_params);
@@ -12918,6 +12921,7 @@
 				analog_p->ani_info_digits = conf->chan.ani_info_digits;
 				analog_p->ani_timeout = conf->chan.ani_timeout;
 				analog_p->ani_wink_time = conf->chan.ani_wink_time;
+				analog_p->hearpulsing = conf->chan.hearpulsing;
 				analog_p->hanguponpolarityswitch = conf->chan.hanguponpolarityswitch;
 				analog_p->permcallwaiting = conf->chan.callwaiting; /* permcallwaiting possibly modified in analog_config_complete */
 				analog_p->callreturn = conf->chan.callreturn;
@@ -18221,6 +18225,8 @@
 			confp->chan.hanguponpolarityswitch = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "sendcalleridafter")) {
 			confp->chan.sendcalleridafter = atoi(v->value);
+		} else if(!strcasecmp(v->name, "hearpulsing")) {
+			confp->chan.hearpulsing = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "mwimonitornotify")) {
 			ast_copy_string(mwimonitornotify, v->value, sizeof(mwimonitornotify));
 		} else if (ast_cc_is_config_param(v->name)) {
diff --git a/channels/chan_dahdi.h b/channels/chan_dahdi.h
index de813f2..fe321b5 100644
--- a/channels/chan_dahdi.h
+++ b/channels/chan_dahdi.h
@@ -441,6 +441,11 @@
 	struct sig_pri_span *pri;
 	int logicalspan;
 #endif	/* defined(HAVE_PRI) */
+
+	/*!\brief TRUE if the caller should hear signaling on analog
+	 * \analog channels
+	 */
+	unsigned int hearpulsing:0;
 	/*!
 	 * \brief TRUE if SMDI (Simplified Message Desk Interface) is enabled
 	 * \note Set from the "usesmdi" value read in from chan_dahdi.conf
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index 64f1114..415e701 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -1243,6 +1243,12 @@
 		ast_debug(1, "not yet implemented\n");
 		return -1;
 	}
+
+	if (p->hearpulsing == 1) {
+		ast_verb(3, "Enqueueing progress frame when dialling has begun in chan %d\n", p->channel);
+		ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
+	}
+
 	return 0;
 }
 
diff --git a/channels/sig_analog.h b/channels/sig_analog.h
index 488be36..768a197 100644
--- a/channels/sig_analog.h
+++ b/channels/sig_analog.h
@@ -304,6 +304,11 @@
 	/*! \brief The SMDI interface to get SMDI messages from. */
 	struct ast_smdi_interface *smdi_iface;
 
+	/*!\brief TRUE if the caller should hear signaling on analog
+	* \analog channels
+	*/
+	unsigned int hearpulsing:0;
+
 	/* Not used for anything but log messages.  Could be just the TCID */
 	int channel;					/*!< Channel Number */
 
diff --git a/configs/samples/chan_dahdi.conf.sample b/configs/samples/chan_dahdi.conf.sample
index 5c3af43..6df3632 100644
--- a/configs/samples/chan_dahdi.conf.sample
+++ b/configs/samples/chan_dahdi.conf.sample
@@ -629,6 +629,13 @@
 ;
 ;dialtone_detect=no
 ;
+; Select yes to enable early-audio cut through on analog channels.
+; This is useful for working with analog or electromechanical switches
+; where the signalling would normally be audible.
+;
+;hearpulsing=no
+;
+;
 ; The following option enables receiving MWI on FXO lines.  The default
 ; value is no.
 ; 	The mwimonitor can take the following values

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17948
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Ibcef6e21020ab6e64f16f4761ec1e0e7fce9c260
Gerrit-Change-Number: 17948
Gerrit-PatchSet: 1
Gerrit-Owner: Sarah Autumn <sarah at endlesstemple.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220131/bc9437f3/attachment-0001.html>


More information about the asterisk-code-review mailing list