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
This commit is contained in:
Naveen Albert
2022-11-11 00:47:57 +00:00
committed by Friendly Automation
parent 315eb551db
commit 67186aad56
3 changed files with 39 additions and 2 deletions

View File

@@ -3731,6 +3731,32 @@ void *analog_handle_init_event(struct analog_pvt *i, int event)
/* 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;