<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19441">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:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_tonedetect: Add ringback support to TONE_DETECT.<br><br>Adds support for detecting audible ringback tone<br>to the TONE_DETECT function using the p option.<br><br>ASTERISK-30254 #close<br><br>Change-Id: Ie2329ff245248768367d26749c285fbe823f6414<br>---<br>A doc/CHANGES-staging/res_tonedetect_ring.txt<br>M res/res_tonedetect.c<br>2 files changed, 43 insertions(+), 1 deletion(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/CHANGES-staging/res_tonedetect_ring.txt b/doc/CHANGES-staging/res_tonedetect_ring.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..e5e4c2e</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/res_tonedetect_ring.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: res_tonedetect</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The TONE_DETECT function now supports</span><br><span style="color: hsl(120, 100%, 40%);">+detection of audible ringback tone</span><br><span style="color: hsl(120, 100%, 40%);">+using the p option.</span><br><span>diff --git a/res/res_tonedetect.c b/res/res_tonedetect.c</span><br><span>index c02eeeb..c81e80c 100644</span><br><span>--- a/res/res_tonedetect.c</span><br><span>+++ b/res/res_tonedetect.c</span><br><span>@@ -228,6 +228,10 @@</span><br><span>                                                provided timeout) before going to the destination provided in the <literal>g</literal></span><br><span>                                           or <literal>h</literal> option. Default is 1.</para></span><br><span>                                       </option></span><br><span style="color: hsl(120, 100%, 40%);">+                                       <option name="p"></span><br><span style="color: hsl(120, 100%, 40%);">+                                             <para>Match immediately on audible ringback tone, instead of or in addition to</span><br><span style="color: hsl(120, 100%, 40%);">+                                          a particular frequency.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                  </option></span><br><span>                                      <option name="r"></span><br><span>                                            <para>Apply to received frames only. Default is both directions.</para></span><br><span>                                  </option></span><br><span>@@ -297,6 +301,7 @@</span><br><span>        OPT_SIT = (1 << 9),</span><br><span>    OPT_BUSY = (1 << 10),</span><br><span>  OPT_DIALTONE = (1 << 11),</span><br><span style="color: hsl(120, 100%, 40%);">+       OPT_RINGING = (1 << 12),</span><br><span> };</span><br><span> </span><br><span> enum {</span><br><span>@@ -316,6 +321,7 @@</span><br><span>     AST_APP_OPTION_ARG('g', OPT_GOTO_RX, OPT_ARG_GOTO_RX),</span><br><span>       AST_APP_OPTION_ARG('h', OPT_GOTO_TX, OPT_ARG_GOTO_TX),</span><br><span>       AST_APP_OPTION_ARG('n', OPT_HITS_REQ, OPT_ARG_HITS_REQ),</span><br><span style="color: hsl(120, 100%, 40%);">+      AST_APP_OPTION('p', OPT_RINGING),</span><br><span>    AST_APP_OPTION('s', OPT_SQUELCH),</span><br><span>    AST_APP_OPTION('t', OPT_TX),</span><br><span>         AST_APP_OPTION('r', OPT_RX),</span><br><span>@@ -403,18 +409,31 @@</span><br><span>                 if (tstate > 0) {</span><br><span>                         ast_debug(3, "tcount: %d, tstate: %d\n", tcount, tstate);</span><br><span>                  switch (tstate) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     case DSP_TONE_STATE_RINGING:</span><br><span style="color: hsl(120, 100%, 40%);">+                          if (di->signalfeatures & DSP_PROGRESS_RINGING) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                       ast_debug(1, "Detected ringing on %s in %s direction\n", ast_channel_name(chan),</span><br><span style="color: hsl(120, 100%, 40%);">+                                            direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write");</span><br><span style="color: hsl(120, 100%, 40%);">+                                    match = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+                            }</span><br><span style="color: hsl(120, 100%, 40%);">+                             break;</span><br><span>                       case DSP_TONE_STATE_DIALTONE:</span><br><span>                                if (di->signalfeatures & DSP_FEATURE_WAITDIALTONE) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                   ast_debug(1, "Detected dial tone on %s in %s direction\n", ast_channel_name(chan),</span><br><span style="color: hsl(120, 100%, 40%);">+                                          direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write");</span><br><span>                                   match = 1;</span><br><span>                           }</span><br><span>                            break;</span><br><span>                       case DSP_TONE_STATE_BUSY:</span><br><span>                            if (di->signalfeatures & DSP_PROGRESS_BUSY) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                  ast_debug(1, "Detected busy tone on %s in %s direction\n", ast_channel_name(chan),</span><br><span style="color: hsl(120, 100%, 40%);">+                                          direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write");</span><br><span>                                   match = 1;</span><br><span>                           }</span><br><span>                            break;</span><br><span>                       case DSP_TONE_STATE_SPECIAL3:</span><br><span>                                if (di->signalfeatures & DSP_PROGRESS_CONGESTION) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                    ast_debug(1, "Detected SIT on %s in %s direction\n", ast_channel_name(chan),</span><br><span style="color: hsl(120, 100%, 40%);">+                                                direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write");</span><br><span>                                   match = 1;</span><br><span>                           }</span><br><span>                            break;</span><br><span>@@ -427,7 +446,8 @@</span><br><span>                                 } else if (di->gototx) {</span><br><span>                                  ast_async_parseable_goto(chan, di->gototx);</span><br><span>                               } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                                        ast_debug(3, "Detected call progress signal, but don't know where to go\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                                    ast_debug(3, "Detected call progress signal in %s direction, but don't know where to go\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                                             direction == AST_AUDIOHOOK_DIRECTION_READ ? "read" : "write");</span><br><span>                           }</span><br><span>                    }</span><br><span>            }</span><br><span>@@ -583,6 +603,9 @@</span><br><span>      if (ast_test_flag(flags, OPT_DIALTONE)) {</span><br><span>            features |= DSP_FEATURE_WAITDIALTONE;</span><br><span>        }</span><br><span style="color: hsl(120, 100%, 40%);">+     if (ast_test_flag(flags, OPT_RINGING)) {</span><br><span style="color: hsl(120, 100%, 40%);">+              features |= DSP_PROGRESS_RINGING;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span> </span><br><span>        return features;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19441">change 19441</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/+/19441"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 20 </div>
<div style="display:none"> Gerrit-Change-Id: Ie2329ff245248768367d26749c285fbe823f6414 </div>
<div style="display:none"> Gerrit-Change-Number: 19441 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </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-MessageType: merged </div>