<p> Attention is currently required from: N A, Joshua Colp, Sarah Autumn. </p>
<p>Patch set 4:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4; color: #000000;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16080">View Change</a></p><p>6 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="null">File apps/app_sendmf.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16080/comment/bd0faa12_3a8d80f4">Patch Set #4, Line 91:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">                   <parameter name="Receive" required="false"><br>                         <para>Emulate receiving MF on this channel instead of sending it out.</para><br>                      </parameter><br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">You didn't implement this (which is fine) but don't you want to add the interval, KP and ST durations?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16080/comment/ee6295c9_eeb059f8">Patch Set #4, Line 158:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">static int senddigit_mf(struct ast_channel *chan, char digit, unsigned int duration, unsigned int durationkp, unsigned int durationst)<br>{<br> if (duration < DEFAULT_EMULATE_MF_DURATION) {<br>              duration = DEFAULT_EMULATE_MF_DURATION;<br>       }<br>     if (ast_channel_tech(chan)->send_digit_begin) {<br>            if (digit == '*')<br>                     duration = durationkp;<br>                else if (digit == '#' || digit == 'A' || digit == 'B' || digit == 'C')<br>                        duration = durationst;<br>                senddigit_mf_begin(chan, digit);<br>              ast_safe_sleep(chan, duration);<br>       }<br>     return senddigit_mf_end(chan);<br>}<br><br>static int senddigit_external_mf(struct ast_channel *chan, char digit, unsigned int duration,<br>    unsigned int durationkp, unsigned int durationst)<br>{<br>  if (duration < DEFAULT_EMULATE_MF_DURATION) {<br>              duration = DEFAULT_EMULATE_MF_DURATION;<br>       }<br>     if (ast_channel_tech(chan)->send_digit_begin) {<br>            senddigit_mf_begin(chan, digit);<br>              if (digit == '*')<br>                     duration = durationkp;<br>                else if (digit == '#' || digit == 'A' || digit == 'B' || digit == 'C')<br>                        duration = durationst;<br>                usleep(duration * 1000);<br>      }<br>     return senddigit_mf_end(chan);<br>}<br><br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Since these are private (unlike their DTMF counterparts) and the only difference between them is the type of sleep, just collapse these into 1 function and pass in the "is_external" flag to indicate which sleep function to call.  See comment below.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16080/comment/8cbd5685_edd3c1ee">Patch Set #4, Line 191:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">static int external_sleep(struct ast_channel *chan, int ms)<br>{<br>       usleep(ms * 1000);<br>    return 0;<br>}<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">If you move this above senddigit and add the is_internal flag, you can collapse the two senddigit functions and eliminate the need for the function pointers in mf_stream.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">static int mysleep(struct ast_channel *chan, int ms, int is_external)<br>{<br>    if (is_external) {<br>            usleep(ms * 1000);<br>    } else {<br>              ast_safe_sleep(chan, ms);<br>     }<br>     return 0;<br>}</pre></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16080/comment/462b97ba_bff2682d">Patch Set #4, Line 204:</a> <code style="font-family:monospace,monospace">       int (*my_senddigit)(struct ast_channel *chan, char digit, unsigned int duration, unsigned int durationkp, unsigned int durationst);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">You don't need the function pointer stuff if you do the above.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16080/comment/7815ff47_8e72f044">Patch Set #4, Line 257:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">static int mf_stream_digits(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration, unsigned int durationkp, unsigned int durationst)<br>{<br>     int res;<br><br>    if (peer && ast_autoservice_start(peer)) {<br>            return -1;<br>    }<br>     res = mf_stream(chan, digits, between, duration, durationkp, durationst, 0);<br>  if (peer && ast_autoservice_stop(peer)) {<br>             res = -1;<br>     }<br><br>   return res;<br>}<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Again, since this is private, just collapse with mf_stream.</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16080/comment/17543e11_90ddcaa0">Patch Set #4, Line 338:</a> <code style="font-family:monospace,monospace">        const char *duration = astman_get_header(m, "Duration");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Don't you want to add the interval and other durations?  I know SendDTMF didn't add interval to the AMI app but that doesn't mean you can't.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16080">change 16080</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/+/16080"/><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: I5d89afdbccee3f86cc702ed96d882f3d351327a4 </div>
<div style="display:none"> Gerrit-Change-Number: 16080 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </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-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-CC: Sarah Autumn <sarah@endlesstemple.org> </div>
<div style="display:none"> Gerrit-Attention: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Attention: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Attention: Sarah Autumn <sarah@endlesstemple.org> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 04 Aug 2021 15:30:17 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>