chan_psip, res_pjsip_sdp_rtp: ignore rtptimeout if direct-media is active

Do not hang up a PJSIP channel on RTP timeout if that channel is in
a direct-media bridge. Also reset the time of the last received RTP packet when
direct-media ends (wait full rtp_timeout period before checking first time after
audio came back to Asterisk).

ASTERISK-28774
Reported-by: Michael Neuhauser

Change-Id: I8b62012be7685849e8fb2b1c5dd39d35313ca2d1
This commit is contained in:
Michael Neuhauser
2020-03-06 17:50:00 +01:00
committed by George Joseph
parent 82c3939c38
commit 5562fb2ea0
2 changed files with 41 additions and 10 deletions

View File

@@ -332,6 +332,14 @@ static int check_for_rtp_changes(struct ast_channel *chan, struct ast_rtp_instan
ast_sockaddr_setnull(&media->direct_media_addr);
changed = 1;
if (media->rtp) {
/* Direct media has ended - reset time of last received RTP packet
* to avoid premature RTP timeout. Synchronisation between the
* modification of direct_mdedia_addr+last_rx here and reading the
* values in res_pjsip_sdp_rtp.c:rtp_check_timeout() is provided
* by the channel's lock (which is held while this function is
* executed).
*/
ast_rtp_instance_set_last_rx(media->rtp, time(NULL));
ast_rtp_instance_set_prop(media->rtp, AST_RTP_PROPERTY_RTCP, 1);
if (position != -1) {
ast_channel_set_fd(chan, position + AST_EXTENDED_FDS, ast_rtp_instance_fd(media->rtp, 1));