<p>Salah Ahmed has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9808">View Change</a></p><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: I2d10e8b82e5eed845cca9921f78e4e7530f544ee<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;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/9808/1</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..c9d8762 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/9808">change 9808</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/9808"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I2d10e8b82e5eed845cca9921f78e4e7530f544ee </div>
<div style="display:none"> Gerrit-Change-Number: 9808 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Salah Ahmed <txrubel@gmail.com> </div>