<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9812">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">dialplan_functions: wrong srtp use status report of a dialplan function<br><br>If asterisk offer an endpoint with SRTP and that endpoint respond<br>with non srtp, in that case channel(rtp,secure,audio) reply wrong<br>status.<br><br>Why delete flag AST_SRTP_CRYPTO_OFFER_OK while check identical remote_key:<br>Currently this flag has being set redundantly. In either case identical<br>or different remote_key this flag has being set. So if we<br>don't set it while we receive identical remote_key or non SRTP SDP<br>response then we can take decision of srtp use by using that flag.<br><br>ASTERISK-27999<br><br>Change-Id: I29dc2843cf4e5ae2604301cb4ff258f1822dc2d7<br>---<br>M channels/pjsip/dialplan_functions.c<br>M res/res_srtp.c<br>2 files changed, 7 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c</span><br><span>index ce347dc..d21a80c 100644</span><br><span>--- a/channels/pjsip/dialplan_functions.c</span><br><span>+++ b/channels/pjsip/dialplan_functions.c</span><br><span>@@ -529,7 +529,13 @@</span><br><span> } else if (!strcmp(type, "direct")) {</span><br><span> ast_copy_string(buf, ast_sockaddr_stringify(&media->direct_media_addr), buflen);</span><br><span> } else if (!strcmp(type, "secure")) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(buf, buflen, "%d", media->srtp ? 1 : 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (media->srtp) {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_sdp_srtp *srtp = media->srtp;</span><br><span style="color: hsl(120, 100%, 40%);">+ int flag = ast_test_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf, buflen, "%d", flag ? 1 : 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf, buflen, "%d", 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> } else if (!strcmp(type, "hold")) {</span><br><span> snprintf(buf, buflen, "%d", media->remotely_held ? 1 : 0);</span><br><span> } else {</span><br><span>diff --git a/res/res_srtp.c b/res/res_srtp.c</span><br><span>index 7552a7a..97856d0 100644</span><br><span>--- a/res/res_srtp.c</span><br><span>+++ b/res/res_srtp.c</span><br><span>@@ -1015,7 +1015,6 @@</span><br><span> }</span><br><span> } else if (!memcmp(crypto->remote_key, remote_key, key_len_from_sdp)) {</span><br><span> ast_debug(1, "SRTP remote key unchanged; maintaining current policy\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9812">change 9812</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/9812"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I29dc2843cf4e5ae2604301cb4ff258f1822dc2d7 </div>
<div style="display:none"> Gerrit-Change-Number: 9812 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Salah Ahmed <txrubel@gmail.com> </div>