<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19560">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_dahdi: Allow FXO channels to start immediately.<br><br>Currently, chan_dahdi will wait for at least one<br>ring before an incoming call can enter the dialplan.<br>This is generally necessary in order to receive<br>the Caller ID spill and/or distinctive ringing<br>detection.<br><br>However, if neither of these is required, then there<br>is nothing gained by waiting for one ring and this<br>unnecessarily delays call setup. Users can now<br>use immediate=yes to make FXO channels (FXS signaled)<br>begin processing dialplan as soon as Asterisk receives<br>the call.<br><br>ASTERISK-30305 #close<br><br>Change-Id: I20818b370b2e4892c7f40c8a8753fa06a81750b5<br>---<br>M channels/sig_analog.c<br>M configs/samples/chan_dahdi.conf.sample<br>A doc/CHANGES-staging/fxo_immediate.txt<br>3 files changed, 63 insertions(+), 2 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/sig_analog.c b/channels/sig_analog.c</span><br><span>index 76ee645..ccc14a8 100644</span><br><span>--- a/channels/sig_analog.c</span><br><span>+++ b/channels/sig_analog.c</span><br><span>@@ -3731,6 +3731,32 @@</span><br><span>    /* Handle an event on a given channel for the monitor thread. */</span><br><span>     switch (event) {</span><br><span>     case ANALOG_EVENT_WINKFLASH:</span><br><span style="color: hsl(120, 100%, 40%);">+  case ANALOG_EVENT_RINGBEGIN:</span><br><span style="color: hsl(120, 100%, 40%);">+          switch (i->sig) {</span><br><span style="color: hsl(120, 100%, 40%);">+          case ANALOG_SIG_FXSLS:</span><br><span style="color: hsl(120, 100%, 40%);">+                case ANALOG_SIG_FXSGS:</span><br><span style="color: hsl(120, 100%, 40%);">+                case ANALOG_SIG_FXSKS:</span><br><span style="color: hsl(120, 100%, 40%);">+                        if (i->immediate) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                if (i->use_callerid || i->usedistinctiveringdetection) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                        ast_log(LOG_WARNING, "Can't start PBX immediately, must wait for Caller ID / distinctive ring\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                              } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                                      /* If we don't care about Caller ID or Distinctive Ring, then there's</span><br><span style="color: hsl(120, 100%, 40%);">+                                  * no need to wait for anything before accepting the call, as</span><br><span style="color: hsl(120, 100%, 40%);">+                                  * waiting will buy us nothing.</span><br><span style="color: hsl(120, 100%, 40%);">+                                        * So if the channel is configured for immediate, actually start immediately</span><br><span style="color: hsl(120, 100%, 40%);">+                                   * and get the show on the road as soon as possible. */</span><br><span style="color: hsl(120, 100%, 40%);">+                                       ast_debug(1, "Disabling ring timeout (previously %d) to begin handling immediately\n", i->ringt_base);</span><br><span style="color: hsl(120, 100%, 40%);">+                                   analog_set_ringtimeout(i, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+                         }</span><br><span style="color: hsl(120, 100%, 40%);">+                     }</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                default:</span><br><span style="color: hsl(120, 100%, 40%);">+                      break;</span><br><span style="color: hsl(120, 100%, 40%);">+                }</span><br><span style="color: hsl(120, 100%, 40%);">+             /* Fall through */</span><br><span style="color: hsl(120, 100%, 40%);">+            if (!(ISTRUNK(i) && i->immediate && !i->use_callerid && !i->usedistinctiveringdetection)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span style="color: hsl(120, 100%, 40%);">+                }</span><br><span>    case ANALOG_EVENT_RINGOFFHOOK:</span><br><span>               if (i->inalarm) {</span><br><span>                         break;</span><br><span>diff --git a/configs/samples/chan_dahdi.conf.sample b/configs/samples/chan_dahdi.conf.sample</span><br><span>index 6333351..6b29549 100644</span><br><span>--- a/configs/samples/chan_dahdi.conf.sample</span><br><span>+++ b/configs/samples/chan_dahdi.conf.sample</span><br><span>@@ -936,8 +936,13 @@</span><br><span>                                                 ; target of the transfer.</span><br><span> </span><br><span> ;</span><br><span style="color: hsl(0, 100%, 40%);">-; Specify whether the channel should be answered immediately or if the simple</span><br><span style="color: hsl(0, 100%, 40%);">-; switch should provide dialtone, read digits, etc.</span><br><span style="color: hsl(120, 100%, 40%);">+; On FXS channels (FXO signaled), specifies whether the channel should enter the dialplan</span><br><span style="color: hsl(120, 100%, 40%);">+; immediately or if the simple switch should provide dialtone, read digits, etc.</span><br><span style="color: hsl(120, 100%, 40%);">+; On FXO channels (FXS signaled), specifies whether the call should enter the dialplan</span><br><span style="color: hsl(120, 100%, 40%);">+; immediately or if we should wait for at least one ring. This is required if</span><br><span style="color: hsl(120, 100%, 40%);">+; Caller ID or distinctive ringing is enabled. If you do not need either, you can</span><br><span style="color: hsl(120, 100%, 40%);">+; skip waiting for the first ring to begin call processing sooner.</span><br><span style="color: hsl(120, 100%, 40%);">+;</span><br><span> ; Note: If immediate=yes the dialplan execution will always start at extension</span><br><span> ; 's' priority 1 regardless of the dialed number!</span><br><span> ;</span><br><span>diff --git a/doc/CHANGES-staging/fxo_immediate.txt b/doc/CHANGES-staging/fxo_immediate.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..01f9ec5</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/fxo_immediate.txt</span><br><span>@@ -0,0 +1,6 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: chan_dahdi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+FXO channels (FXS signaled) that don't use callerid or</span><br><span style="color: hsl(120, 100%, 40%);">+distinctive ring detection can now be configured</span><br><span style="color: hsl(120, 100%, 40%);">+to enter the dialplan immediately using immediate=yes,</span><br><span style="color: hsl(120, 100%, 40%);">+instead of waiting for at least one ring.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19560">change 19560</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19560"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I20818b370b2e4892c7f40c8a8753fa06a81750b5 </div>
<div style="display:none"> Gerrit-Change-Number: 19560 </div>
<div style="display:none"> Gerrit-PatchSet: 6 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>