<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/5934">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_rtp_asterisk: trigger source change control frame when dtls is established<br><br>There needed to be a way to notify handlers upstream that DTLS had been<br>established. This patch makes it so once DTLS has been estalished a source<br>change control frame is put into the read queue. Any handlers can then watch<br>for that frame and trigger off of it.<br><br>ASTERISK-27096 #close<br><br>Change-Id: I27ff344f5a8c691a1890dfe3254a4b1a49e7f4a0<br>---<br>M res/res_rtp_asterisk.c<br>1 file changed, 19 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c<br>index 600846c..dc09166 100644<br>--- a/res/res_rtp_asterisk.c<br>+++ b/res/res_rtp_asterisk.c<br>@@ -109,6 +109,8 @@<br> #define SRTP_MASTER_SALT_LEN 14<br> #define SRTP_MASTER_LEN (SRTP_MASTER_KEY_LEN + SRTP_MASTER_SALT_LEN)<br> <br>+#define RTP_DTLS_ESTABLISHED -37<br>+<br> enum strict_rtp_state {<br> STRICT_RTP_OPEN = 0, /*! No RTP packets should be dropped, all sources accepted */<br> STRICT_RTP_LEARN, /*! Accept next packet as source */<br>@@ -2477,7 +2479,11 @@<br> /* Any further connections will be existing since this is now established */<br> dtls->connection = AST_RTP_DTLS_CONNECTION_EXISTING;<br> /* Use the keying material to set up key/salt information */<br>- res = dtls_srtp_setup(rtp, srtp, instance, rtcp);<br>+ if ((res = dtls_srtp_setup(rtp, srtp, instance, rtcp))) {<br>+ return res;<br>+ }<br>+ /* Notify that dtls has been established */<br>+ res = RTP_DTLS_ESTABLISHED;<br> } else {<br> /* Since we've sent additional traffic start the timeout timer for retransmission */<br> dtls_srtp_start_timeout_timer(instance, rtp, rtcp);<br>@@ -4750,6 +4756,12 @@<br> /* Read in RTCP data from the socket */<br> if ((res = rtcp_recvfrom(instance, read_area, read_area_size,<br> 0, &addr)) < 0) {<br>+ if (res == RTP_DTLS_ESTABLISHED) {<br>+ rtp->f.frametype = AST_FRAME_CONTROL;<br>+ rtp->f.subclass.integer = AST_CONTROL_SRCCHANGE;<br>+ return &rtp->f;<br>+ }<br>+<br> ast_assert(errno != EBADF);<br> if (errno != EAGAIN) {<br> ast_log(LOG_WARNING, "RTCP Read error: %s. Hanging up.\n",<br>@@ -4947,6 +4959,12 @@<br> /* Actually read in the data from the socket */<br> if ((res = rtp_recvfrom(instance, read_area, read_area_size, 0,<br> &addr)) < 0) {<br>+ if (res == RTP_DTLS_ESTABLISHED) {<br>+ rtp->f.frametype = AST_FRAME_CONTROL;<br>+ rtp->f.subclass.integer = AST_CONTROL_SRCCHANGE;<br>+ return &rtp->f;<br>+ }<br>+<br> ast_assert(errno != EBADF);<br> if (errno != EAGAIN) {<br> ast_log(LOG_WARNING, "RTP Read error: %s. Hanging up.\n",<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5934">change 5934</a>. To unsubscribe, 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/5934"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I27ff344f5a8c691a1890dfe3254a4b1a49e7f4a0 </div>
<div style="display:none"> Gerrit-Change-Number: 5934 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@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: Kevin Harwell <kharwell@digium.com> </div>