<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Patch Set 1:</p><p style="white-space: pre-wrap; word-wrap: break-word;">Question (because I haven't looked that closely at the code) - what about not calling this function at all if direct media is in use?</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">Thank you for taking an interest. That would simplify things, but I do not see this working:</p><p style="white-space: pre-wrap; word-wrap: break-word;">rtp_check_timeout() in res_pjsip_sdp_rtp is a variably scheduled job (initially the configured rtp_timeout value, then the remaining time based on ast_rtp_instance_get_last_rx() and the current time). So one would have to add/delete the job when direct_media_addr==NULL changes - but *additionally* to the job-add/delete that is now in place in res_pjsip_sdp_rtp (triggered by the on_media_update PJSIP invite callback "on_media_update" and when the stream is stopped/destroyed).<br>The direct_media_addr value is set by chan_pjsip, via the update_peer rtp-engine callback, i.e., asynchronously to the job-add/delete that is happening in res_pjsp_sdp_rtp. So there would by 2 different places that try to add/delete the same job, which I think would be much too complicated to coordinate.<br>In summary, I think checking the direct_media_addr value in rtp_check_timeout() is the correct approach. (The RTP keepalive handling in res_pjsip_sdp_rtp also does it that way.)</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13860">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13860">change 13860</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/+/13860"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I8b62012be7685849e8fb2b1c5dd39d35313ca2d1 </div>
<div style="display:none"> Gerrit-Change-Number: 13860 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Michael Neuhauser <mike@firmix.at> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-CC: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Sun, 08 Mar 2020 12:13:54 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>