[Asterisk-code-review] chan_dahdi: Allow FXO channels to start immediately. (asterisk[20])

N A asteriskteam at digium.com
Mon Nov 28 06:07:20 CST 2022


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


Change subject: chan_dahdi: Allow FXO channels to start immediately.
......................................................................

chan_dahdi: Allow FXO channels to start immediately.

Currently, chan_dahdi will wait for at least one
ring before an incoming call can enter the dialplan.
This is generally necessary in order to receive
the Caller ID spill and/or distinctive ringing
detection.

However, if neither of these is required, then there
is nothing gained by waiting for one ring and this
unnecessarily delays call setup. Users can now
use immediate=yes to make FXO channels (FXS signaled)
begin processing dialplan as soon as Asterisk receives
the call.

ASTERISK-30305 #close

Change-Id: I20818b370b2e4892c7f40c8a8753fa06a81750b5
---
M channels/sig_analog.c
M configs/samples/chan_dahdi.conf.sample
A doc/CHANGES-staging/fxo_immediate.txt
3 files changed, 63 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/19587/1

diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index 76ee645..ccc14a8 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -3731,6 +3731,32 @@
 	/* Handle an event on a given channel for the monitor thread. */
 	switch (event) {
 	case ANALOG_EVENT_WINKFLASH:
+	case ANALOG_EVENT_RINGBEGIN:
+		switch (i->sig) {
+		case ANALOG_SIG_FXSLS:
+		case ANALOG_SIG_FXSGS:
+		case ANALOG_SIG_FXSKS:
+			if (i->immediate) {
+				if (i->use_callerid || i->usedistinctiveringdetection) {
+					ast_log(LOG_WARNING, "Can't start PBX immediately, must wait for Caller ID / distinctive ring\n");
+				} else {
+					/* If we don't care about Caller ID or Distinctive Ring, then there's
+					 * no need to wait for anything before accepting the call, as
+					 * waiting will buy us nothing.
+					 * So if the channel is configured for immediate, actually start immediately
+					 * and get the show on the road as soon as possible. */
+					ast_debug(1, "Disabling ring timeout (previously %d) to begin handling immediately\n", i->ringt_base);
+					analog_set_ringtimeout(i, 0);
+				}
+			}
+			break;
+		default:
+			break;
+		}
+		/* Fall through */
+		if (!(ISTRUNK(i) && i->immediate && !i->use_callerid && !i->usedistinctiveringdetection)) {
+			break;
+		}
 	case ANALOG_EVENT_RINGOFFHOOK:
 		if (i->inalarm) {
 			break;
diff --git a/configs/samples/chan_dahdi.conf.sample b/configs/samples/chan_dahdi.conf.sample
index 6333351..6b29549 100644
--- a/configs/samples/chan_dahdi.conf.sample
+++ b/configs/samples/chan_dahdi.conf.sample
@@ -936,8 +936,13 @@
                                                 ; target of the transfer.
 
 ;
-; Specify whether the channel should be answered immediately or if the simple
-; switch should provide dialtone, read digits, etc.
+; On FXS channels (FXO signaled), specifies whether the channel should enter the dialplan
+; immediately or if the simple switch should provide dialtone, read digits, etc.
+; On FXO channels (FXS signaled), specifies whether the call should enter the dialplan
+; immediately or if we should wait for at least one ring. This is required if
+; Caller ID or distinctive ringing is enabled. If you do not need either, you can
+; skip waiting for the first ring to begin call processing sooner.
+;
 ; Note: If immediate=yes the dialplan execution will always start at extension
 ; 's' priority 1 regardless of the dialed number!
 ;
diff --git a/doc/CHANGES-staging/fxo_immediate.txt b/doc/CHANGES-staging/fxo_immediate.txt
new file mode 100644
index 0000000..01f9ec5
--- /dev/null
+++ b/doc/CHANGES-staging/fxo_immediate.txt
@@ -0,0 +1,6 @@
+Subject: chan_dahdi
+
+FXO channels (FXS signaled) that don't use callerid or
+distinctive ring detection can now be configured
+to enter the dialplan immediately using immediate=yes,
+instead of waiting for at least one ring.

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

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: I20818b370b2e4892c7f40c8a8753fa06a81750b5
Gerrit-Change-Number: 19587
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/20221128/aa413cde/attachment.html>


More information about the asterisk-code-review mailing list