<p style="white-space: pre-wrap; word-wrap: break-word;">Good first attempt.  The code appears to work as is but can be better expressed and needs to follow the coding guidelines.</p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/9807">View Change</a></p><p>3 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/9807/1//COMMIT_MSG">Commit Message:</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/9807/1//COMMIT_MSG@7">Patch Set #1, Line 7:</a> <code style="font-family:monospace,monospace">dialplan_functions: wrong srtp useage report of a dialplan function</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">s/useage/usage/</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/9807/1/channels/pjsip/dialplan_functions.c">File channels/pjsip/dialplan_functions.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/9807/1/channels/pjsip/dialplan_functions.c@533">Patch Set #1, Line 533:</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(media->srtp) {<br>            struct ast_sdp_srtp *srtp = media->srtp;<br>           int flag = ast_test_flag( srtp, AST_SRTP_CRYPTO_OFFER_OK);<br>            snprintf(buf, buflen, "%d", flag ? 1 : 0);<br>        } else {<br>        snprintf(buf, buflen, "%d", 0);<br>   }             <br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">This code is better expressed:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">snprintf(buf, buflen, "%d",<br>    (media->srtp && ast_test_flag(media->srtp, AST_SRTP_CRYPTO_OFFER_OK)) ? 1 : 0);</pre><p style="white-space: pre-wrap; word-wrap: break-word;"> Otherwise you have several coding guideline problems.</p><ul><li>Use tabs not spaces to indent.</li><li>Space after if: if ()</li><li>No space after open paren: ast_test_flag(srtp,...</li><li>Trailing whitespace indicated by a red blob if the code isn't highlighted by a comment as happened here.</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">https://wiki.asterisk.org/wiki/display/AST/Coding+Guidelines</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/9807/1/main/sdp_srtp.c">File main/sdp_srtp.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/9807/1/main/sdp_srtp.c@a353">Patch Set #1, Line 353:</a> <code style="font-family:monospace,monospace"></code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Ok.  I understand why you removed this.  Setting this flag is actually redundant.  It was set by the earlier SRTP negotiation that wasn't changed during the current renegotiation.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Removing this deserves a mention in the commit message.  Otherwise, someone could be puzzled why it was removed at a later time.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/9807">change 9807</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/9807"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I29dc2843cf4e5ae2604301cb4ff258f1822dc2d7 </div>
<div style="display:none"> Gerrit-Change-Number: 9807 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Salah Ahmed <txrubel@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 02 Aug 2018 20:54:57 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>