[Asterisk-code-review] sig_analog: Allow three-way flash to time out to silence. (asterisk[master])

N A asteriskteam at digium.com
Thu Dec 15 15:18:58 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19716 )


Change subject: sig_analog: Allow three-way flash to time out to silence.
......................................................................

sig_analog: Allow three-way flash to time out to silence.

sig_analog allows users to flash and use the three-way dial
tone as a primitive hold function, simply by never timing
it out.

Some systems allow this dial tone to time out to silence,
so the user is not annoyed by a persistent dial tone.
This option allows the dial tone to time out normally to
silence.

ASTERISK-30004 #close

Change-Id: Ic748f04dbb333a178f814bb02b713886f788d88e
---
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
A doc/CHANGES-staging/chan_dahdi_threewaysilenthold.txt
6 files changed, 52 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/16/19716/1

diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 5607eb0..7433e630 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -12806,6 +12806,7 @@
 		tmp->usedistinctiveringdetection = usedistinctiveringdetection;
 		tmp->callwaitingcallerid = conf->chan.callwaitingcallerid;
 		tmp->threewaycalling = conf->chan.threewaycalling;
+		tmp->threewaysilenthold = conf->chan.threewaysilenthold;
 		tmp->adsi = conf->chan.adsi;
 		tmp->use_smdi = conf->chan.use_smdi;
 		tmp->permhidecallerid = conf->chan.hidecallerid;
@@ -13111,6 +13112,7 @@
 				analog_p->permhidecallerid = conf->chan.permhidecallerid;
 				analog_p->pulse = conf->chan.pulse;
 				analog_p->threewaycalling = conf->chan.threewaycalling;
+				analog_p->threewaysilenthold = conf->chan.threewaysilenthold;
 				analog_p->transfer = conf->chan.transfer;
 				analog_p->transfertobusy = conf->chan.transfertobusy;
 				analog_p->use_callerid = tmp->use_callerid;
@@ -18150,6 +18152,8 @@
 				confp->chan.cid_start = CID_START_RING;
 		} else if (!strcasecmp(v->name, "threewaycalling")) {
 			confp->chan.threewaycalling = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "threewaysilenthold")) {
+			confp->chan.threewaysilenthold = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "cancallforward")) {
 			confp->chan.cancallforward = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "relaxdtmf")) {
diff --git a/channels/chan_dahdi.h b/channels/chan_dahdi.h
index de813f2..c0d75c2 100644
--- a/channels/chan_dahdi.h
+++ b/channels/chan_dahdi.h
@@ -345,6 +345,11 @@
 	 */
 	unsigned int threewaycalling:1;
 	/*!
+	 * \brief TRUE if a three way dial tone should time out to silence
+	 * \note Set from the "threewaysilenthold" value read in from chan_dahdi.conf
+	 */
+	unsigned int threewaysilenthold:1;
+	/*!
 	 * \brief TRUE if call transfer is enabled
 	 * \note For FXS ports (either direct analog or over T1/E1):
 	 *   Support flash-hook call transfer
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index b694a96..029a0f1 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -2136,8 +2136,10 @@
 		/* Read the first digit */
 		timeout = analog_get_firstdigit_timeout(p);
 		/* If starting a threeway call, never timeout on the first digit so someone
-		   can use flash-hook as a "hold" feature */
-		if (p->subs[ANALOG_SUB_THREEWAY].owner) {
+		 * can use flash-hook as a "hold" feature
+		 * Unless three-way dial tone should time out to silence, in which case the default suffices.
+		 */
+		if (!p->threewaysilenthold && p->subs[ANALOG_SUB_THREEWAY].owner) {
 			timeout = INT_MAX;
 		}
 		while (len < AST_MAX_EXTENSION-1) {
@@ -2219,7 +2221,11 @@
 				}
 			} else if (res == 0) {
 				ast_debug(1, "not enough digits (and no ambiguous match)...\n");
-				res = analog_play_tone(p, idx, ANALOG_TONE_CONGESTION);
+				if (p->threewaysilenthold) {
+					ast_debug(1, "Nothing dialed at three-way dial tone, timed out to silent hold\n");
+				} else {
+					res = analog_play_tone(p, idx, ANALOG_TONE_CONGESTION);
+				}
 				analog_wait_event(p);
 				ast_hangup(chan);
 				goto quit;
diff --git a/channels/sig_analog.h b/channels/sig_analog.h
index 7e9acda..2a1e2c2 100644
--- a/channels/sig_analog.h
+++ b/channels/sig_analog.h
@@ -292,6 +292,7 @@
 	unsigned int permhidecallerid:1;		/*!< Whether to hide our outgoing caller ID or not */
 	unsigned int pulse:1;
 	unsigned int threewaycalling:1;
+	unsigned int threewaysilenthold:1;		/*!< Whether to time out a three-way dial tone to silence */
 	unsigned int transfer:1;
 	unsigned int transfertobusy:1;			/*!< allow flash-transfers to busy channels */
 	unsigned int use_callerid:1;			/*!< Whether or not to use caller id on this channel */
diff --git a/configs/samples/chan_dahdi.conf.sample b/configs/samples/chan_dahdi.conf.sample
index 6b29549..f5b233d 100644
--- a/configs/samples/chan_dahdi.conf.sample
+++ b/configs/samples/chan_dahdi.conf.sample
@@ -750,6 +750,14 @@
 ;
 threewaycalling=yes
 ;
+; By default, the three-way dial tone never times out, allowing it to be
+; used as a primitive "hold" mechanism. However, if you'd prefer
+; to have the dial tone time out to silence, you can use this option
+; to time out after the normal first digit timeout to silence.
+; Default is 'no'.
+;
+;threewaysilenthold=no
+;
 ; For FXS ports (either direct analog or over T1/E1):
 ;   Support flash-hook call transfer (requires three way calling)
 ;   Also enables call parking (overrides the 'canpark' parameter)
diff --git a/doc/CHANGES-staging/chan_dahdi_threewaysilenthold.txt b/doc/CHANGES-staging/chan_dahdi_threewaysilenthold.txt
new file mode 100644
index 0000000..05d6398
--- /dev/null
+++ b/doc/CHANGES-staging/chan_dahdi_threewaysilenthold.txt
@@ -0,0 +1,5 @@
+Subject: chan_dahdi
+
+The threewaysilenthold option now allows the three-way
+dial tone to time out to silence, rather than continuing
+forever.

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ic748f04dbb333a178f814bb02b713886f788d88e
Gerrit-Change-Number: 19716
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221215/c42c095b/attachment.html>


More information about the asterisk-code-review mailing list