<p> Attention is currently required from: N A, Joshua Colp. </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/+/16071">View Change</a></p><p>5 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="null">File funcs/func_frame_drop.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/+/16071/comment/5d18e310_46edfd36">Patch Set #4, Line 45:</a> <code style="font-family:monospace,monospace">filter list type</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">You still should change this to "direction".</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16071/comment/5c7ed371_6a2580b6">Patch Set #4, Line 276:</a> <code style="font-family:monospace,monospace">strcasecmp</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Per my other comment, you can't use strcasecmp because "value" could have multiple frame types in it.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="null">File funcs/func_framedrop.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/+/16071/comment/ebccb4c6_133b2ddf">Patch Set #2, Line 195:</a> <code style="font-family:monospace,monospace">int list_type; /* 0 = TX, 1 = RX */</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Are you referring to list_type or values here? I don't see a red line in the excerpt.</blockquote></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Sorry.  I meant create an enum for the list_type...<br>enum direction {<br>    TX = 0,<br>    RX,<br>};</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">struct frame_drop_data {<br>    enum direction list_type;<br>...<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/+/16071/comment/5ad1950b_a9a23017">Patch Set #2, Line 278:</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;">  for (i = 0; i < ARRAY_LEN(frametype2str); i++) {<br>           if (strcasestr(value, frametype2str[i].str)) {<br>                        framedata->values[i] = 1;<br>          }<br>     }<br><br>   for (i = 0; i < ARRAY_LEN(controlframetype2str); i++) {<br>            if (strcasestr(value, controlframetype2str[i].str)) {<br>                 framedata->controlvalues[i] = 1;<br>           }<br>     }<br></pre></blockquote></p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Whoops, didn't notice that before. What about strcasecmp instead of strcasestr?</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Sure you can do strcasecmp but you'll still have to tokenize the "value" so you're not trying to compare "TEXT" with "TEXT_DATA,VIDEO".  Another option I've used in other places is to allocate a buffer that's long enough to hold "value" plus 2 commas, then place a comma in the first character, copy "value" into the buffer character by character skipping spaces starting at the second character, then place a comma after that so your new value looks like ",TEXT,TEXT_DATA,VIDEO,".  Now change your array string values to have a comma at the start and end and you can do your strcasestr() without tokenizing.  You'll be searching for ",TEXT," in ",TEXT_DATA,VIDEO," and you won't get a false match on ",TEXT_DATA,".</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/16071/comment/6275b95d_27db523b">Patch Set #2, Line 294:</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;">           if ((datastore = ast_channel_datastore_find(chan, &frame_drop_datastore, NULL))) {<br>                        id = datastore->data;<br>                      ast_framehook_detach(chan, *id);<br>                      ast_channel_datastore_remove(chan, datastore);<br>                        ast_datastore_free(datastore);<br>                }<br><br></pre></blockquote></p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Added.<br>Also, something I noticed from testing is that the directions seem to work backwards from other functions. For instance, to prevent DTMF from registering in Asterisk from an endpoint, Set(FRAME_DROP(TX)=DTMF_END,DTMF_BEGIN) is the way that does it. This seems backwards to me at least - wondering if the TX/RX should be flipped around in the code so that it works the other way or if there should be a note about this.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">I'd make it consistent with the other functions and add the note.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16071">change 16071</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/+/16071"/><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: I8147c9d55d74e2e48861edba6b22f930920541ec </div>
<div style="display:none"> Gerrit-Change-Number: 16071 </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-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-Comment-Date: Tue, 22 Jun 2021 12:51:12 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Comment-In-Reply-To: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Comment-In-Reply-To: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>