Replay check failed (index too old)

I’m looking at Asterisk WebRTC video calls, and want to smooth out video when relayed via Asterisk. At the moment audio works fine, but video is a bit messy. The video is choppy, low quality, and stops after a few seconds - sometimes it recovers, but most of the time after a few seconds, it stops and doesn’t recover.

Here is a typical result:

    -- Called PJSIP/drdZc30SSe@innovateasterisk.com/sip:vg1fdu93@127.0.0.1:47640;transport=WS;x-ast-orig-host=5did95h99m0m.invalid:0
    -- PJSIP/drdZc30SSe@innovateasterisk.com-00000038 is ringing
       > 0x7fd1341852b0 -- Strict RTP learning after remote address set to: 41.71.39.122:56176
       > 0x7fd13409ab20 -- Strict RTP learning after remote address set to: 41.71.39.122:56176
    -- PJSIP/drdZc30SSe@innovateasterisk.com-00000038 answered PJSIP/yAS43lAg8L@innovateasterisk.com-00000037
       > 0x7fd128076f60 -- Strict RTP learning after remote address set to: 41.71.39.122:57869
       > 0x7fd12806d2e0 -- Strict RTP learning after remote address set to: 41.71.39.122:57869
    -- Channel PJSIP/drdZc30SSe@innovateasterisk.com-00000038 joined 'simple_bridge' basic-bridge <ceb66132-6365-4f77-a525-0ff509688239>
    -- Channel PJSIP/yAS43lAg8L@innovateasterisk.com-00000037 joined 'simple_bridge' basic-bridge <ceb66132-6365-4f77-a525-0ff509688239>
       > 0x7fd13409ab20 -- Strict RTP learning after remote address set to: 41.71.39.122:56176
       > 0x7fd1341852b0 -- Strict RTP learning after ICE completion
       > 0x7fd13409ab20 -- Strict RTP learning after remote address set to: 41.71.39.122:56176
       > 0x7fd1341852b0 -- Strict RTP learning after remote address set to: 41.71.39.122:56176
       > 0x7fd128076f60 -- Strict RTP learning after remote address set to: 41.71.39.122:57869
       > 0x7fd12806d2e0 -- Strict RTP learning after ICE completion
       > 0x7fd128076f60 -- Strict RTP learning after remote address set to: 41.71.39.122:57869
       > 0x7fd12806d2e0 -- Strict RTP learning after remote address set to: 41.71.39.122:57869
       > 0x7fd1341852b0 -- Strict RTP switching to RTP target address 41.71.39.122:56176 as source
       > 0x7fd13409ab20 -- Strict RTP switching to RTP target address 41.71.39.122:56176 as source
       > 0x7fd12806d2e0 -- Strict RTP switching to RTP target address 41.71.39.122:57869 as source
       > 0x7fd128076f60 -- Strict RTP switching to RTP target address 41.71.39.122:57869 as source
       > 0x7fd1341852b0 -- Strict RTP learning complete - Locking on source address 41.71.39.122:56176
       > 0x7fd13409ab20 -- Strict RTP learning complete - Locking on source address 41.71.39.122:56176
       > 0x7fd12806d2e0 -- Strict RTP learning complete - Locking on source address 41.71.39.122:57869
       > 0x7fd128076f60 -- Strict RTP learning complete - Locking on source address 41.71.39.122:57869
[Oct 14 10:04:08] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:08] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:08] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 10:04:25] WARNING[10845][C-00000028]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)

(loads more lines)

The above goes on for a while, recovers, and then freezes for the remainder of the call. (There is no hold, transfer or any other activity on the call.)

In the rtp.conf I see reference to this:

; Enable sRTP replay protection. Buggy SIP user agents (UAs) reset the
; sequence number (RTP-SEQ) on a re-INVITE, for example, with Session Timers
; or on Call Hold/Resume, but keep the synchronization source (RTP-SSRC). If
; the new RTP-SEQ is higher than the previous one, the call continues if the
; roll-over counter (sRTP-ROC) is zero (the call lasted less than 22 minutes).
; In all other cases, the call faces one-way audio or even no audio at all.
; "replay check failed (index too old)" gets printed continuously. This is a
; software bug. You have to report this to the creator of that UA. Until it is
; fixed, you could disable sRTP replay protection (see RFC 3711 section 3.3.2).
; This option is enabled by default.
; srtpreplayprotection=yes

And while I have srtpreplayprotection=yes, I still get the above error on the screen, and the video still freezes.

I would really like to understand what’s going on here, and how to get Asterisk to do peer-to-peer video well, as it’s been quite a while (quite a few versions ago) since I have seen it handle smooth video.

What version of Asterisk? What is the endpoint configuration? What does a packet capture show for the stream itself (is it out of order? dropped packets?)

I’m a bit behind: Asterisk 18.14.0 on Ubuntu 22

Endpoint is in the DB, so the two endpoints calling each other are:

pjsip show endpoint yAS43lAg8L@innovateasterisk.com 

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  yAS43lAg8L@innovateasterisk.com/100                  Unavailable   0 of 1
     InAuth:  yAS43lAg8L/yAS43lAg8L
        Aor:  yAS43lAg8L                                        10


 ParameterName                      : ParameterValue
 ===================================================================================================
 100rel                             : yes
 accept_multiple_sdp_answers        : false
 accountcode                        : 
 acl                                : 
 aggregate_mwi                      : true
 allow                              : (opus|ulaw|vp8)
 allow_overlap                      : true
 allow_subscribe                    : true
 allow_transfer                     : true
 allow_unauthenticated_options      : false
 aors                               : yAS43lAg8L
 asymmetric_rtp_codec               : false
 auth                               : yAS43lAg8L
 bind_rtp_to_media_address          : false
 bundle                             : true
 call_group                         : 
 callerid                           : "One Hundred" <100>
 callerid_privacy                   : allowed_not_screened
 callerid_tag                       : 
 codec_prefs_incoming_answer        : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_incoming_offer         : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_outgoing_answer        : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_outgoing_offer         : prefer:pending, operation:union, keep:all, transcode:allow
 connected_line_method              : invite
 contact_acl                        : 
 context                            : from-Local
 cos_audio                          : 0
 cos_video                          : 0
 device_state_busy_at               : 1
 direct_media                       : false
 direct_media_glare_mitigation      : none
 direct_media_method                : invite
 disable_direct_media_on_nat        : false
 dtls_auto_generate_cert            : Yes
 dtls_ca_file                       : 
 dtls_ca_path                       : 
 dtls_cert_file                     : 
 dtls_cipher                        : 
 dtls_fingerprint                   : SHA-256
 dtls_private_key                   : 
 dtls_rekey                         : 0
 dtls_setup                         : actpass
 dtls_verify                        : Yes
 dtmf_mode                          : rfc4733
 fax_detect                         : false
 fax_detect_timeout                 : 0
 follow_early_media_fork            : true
 force_avp                          : false
 force_rport                        : true
 from_domain                        : 
 from_user                          : 
 g726_non_standard                  : false
 geoloc_incoming_call_profile       : 
 geoloc_outgoing_call_profile       : 
 ice_support                        : true
 identify_by                        : username,ip
 ignore_183_without_sdp             : false
 inband_progress                    : false
 incoming_call_offer_pref           : local
 incoming_mwi_mailbox               : 
 language                           : 
 mailboxes                          : 
 max_audio_streams                  : 50
 max_video_streams                  : 50
 media_address                      : 
 media_encryption                   : dtls
 media_encryption_optimistic        : false
 media_use_received_transport       : true
 message_context                    : textmessages
 moh_passthrough                    : false
 moh_suggest                        : default
 mwi_from_user                      : 
 mwi_subscribe_replaces_unsolicited : no
 named_call_group                   : 
 named_pickup_group                 : 
 notify_early_inuse_ringing         : false
 one_touch_recording                : false
 outbound_auth                      : 
 outbound_proxy                     : 
 outgoing_call_offer_pref           : remote_merge
 pickup_group                       : 
 preferred_codec_only               : false
 record_off_feature                 : automixmon
 record_on_feature                  : automixmon
 refer_blind_progress               : true
 rewrite_contact                    : true
 rpid_immediate                     : false
 rtcp_mux                           : true
 rtp_engine                         : asterisk
 rtp_ipv6                           : false
 rtp_keepalive                      : 0
 rtp_symmetric                      : true
 rtp_timeout                        : 0
 rtp_timeout_hold                   : 0
 sdp_owner                          : -
 sdp_session                        : Asterisk
 send_connected_line                : yes
 send_diversion                     : true
 send_history_info                  : false
 send_pai                           : false
 send_rpid                          : false
 set_var                            : 
 srtp_tag_32                        : false
 stir_shaken                        : off
 stir_shaken_profile                : 
 sub_min_expiry                     : 0
 subscribe_context                  : subscriptions
 suppress_q850_reason_headers       : false
 t38_bind_udptl_to_media_address    : false
 t38_udptl                          : false
 t38_udptl_ec                       : none
 t38_udptl_ipv6                     : false
 t38_udptl_maxdatagram              : 0
 t38_udptl_nat                      : false
 timers                             : yes
 timers_min_se                      : 90
 timers_sess_expires                : 1800
 tone_zone                          : 
 tos_audio                          : 0
 tos_video                          : 0
 transport                          : 
 trust_connected_line               : yes
 trust_id_inbound                   : false
 trust_id_outbound                  : false
 use_avpf                           : true
 use_ptime                          : false
 user_eq_phone                      : false
 voicemail_extension                : 
 webrtc                             : yes

and:

CLI> pjsip show endpoint drdZc30SSe@innovateasterisk.com 

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  drdZc30SSe@innovateasterisk.com/200                  Unavailable   0 of 1
     InAuth:  drdZc30SSe/drdZc30SSe
        Aor:  drdZc30SSe                                        10


 ParameterName                      : ParameterValue
 ===================================================================================================
 100rel                             : yes
 accept_multiple_sdp_answers        : false
 accountcode                        : 
 acl                                : 
 aggregate_mwi                      : true
 allow                              : (opus|ulaw|vp8)
 allow_overlap                      : true
 allow_subscribe                    : true
 allow_transfer                     : true
 allow_unauthenticated_options      : false
 aors                               : drdZc30SSe
 asymmetric_rtp_codec               : false
 auth                               : drdZc30SSe
 bind_rtp_to_media_address          : false
 bundle                             : true
 call_group                         : 
 callerid                           : "Two Hundred" <200>
 callerid_privacy                   : allowed_not_screened
 callerid_tag                       : 
 codec_prefs_incoming_answer        : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_incoming_offer         : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_outgoing_answer        : prefer:pending, operation:intersect, keep:all, transcode:allow
 codec_prefs_outgoing_offer         : prefer:pending, operation:union, keep:all, transcode:allow
 connected_line_method              : invite
 contact_acl                        : 
 context                            : from-Local
 cos_audio                          : 0
 cos_video                          : 0
 device_state_busy_at               : 1
 direct_media                       : false
 direct_media_glare_mitigation      : none
 direct_media_method                : invite
 disable_direct_media_on_nat        : false
 dtls_auto_generate_cert            : Yes
 dtls_ca_file                       : 
 dtls_ca_path                       : 
 dtls_cert_file                     : 
 dtls_cipher                        : 
 dtls_fingerprint                   : SHA-256
 dtls_private_key                   : 
 dtls_rekey                         : 0
 dtls_setup                         : actpass
 dtls_verify                        : Yes
 dtmf_mode                          : rfc4733
 fax_detect                         : false
 fax_detect_timeout                 : 0
 follow_early_media_fork            : true
 force_avp                          : false
 force_rport                        : true
 from_domain                        : 
 from_user                          : 
 g726_non_standard                  : false
 geoloc_incoming_call_profile       : 
 geoloc_outgoing_call_profile       : 
 ice_support                        : true
 identify_by                        : username,ip
 ignore_183_without_sdp             : false
 inband_progress                    : false
 incoming_call_offer_pref           : local
 incoming_mwi_mailbox               : 
 language                           : 
 mailboxes                          : 
 max_audio_streams                  : 50
 max_video_streams                  : 50
 media_address                      : 
 media_encryption                   : dtls
 media_encryption_optimistic        : false
 media_use_received_transport       : true
 message_context                    : textmessages
 moh_passthrough                    : false
 moh_suggest                        : default
 mwi_from_user                      : 
 mwi_subscribe_replaces_unsolicited : no
 named_call_group                   : 
 named_pickup_group                 : 
 notify_early_inuse_ringing         : false
 one_touch_recording                : false
 outbound_auth                      : 
 outbound_proxy                     : 
 outgoing_call_offer_pref           : remote_merge
 pickup_group                       : 
 preferred_codec_only               : false
 record_off_feature                 : automixmon
 record_on_feature                  : automixmon
 refer_blind_progress               : true
 rewrite_contact                    : true
 rpid_immediate                     : false
 rtcp_mux                           : true
 rtp_engine                         : asterisk
 rtp_ipv6                           : false
 rtp_keepalive                      : 0
 rtp_symmetric                      : true
 rtp_timeout                        : 0
 rtp_timeout_hold                   : 0
 sdp_owner                          : -
 sdp_session                        : Asterisk
 send_connected_line                : yes
 send_diversion                     : true
 send_history_info                  : false
 send_pai                           : false
 send_rpid                          : false
 set_var                            : 
 srtp_tag_32                        : false
 stir_shaken                        : off
 stir_shaken_profile                : 
 sub_min_expiry                     : 0
 subscribe_context                  : subscriptions
 suppress_q850_reason_headers       : false
 t38_bind_udptl_to_media_address    : false
 t38_udptl                          : false
 t38_udptl_ec                       : none
 t38_udptl_ipv6                     : false
 t38_udptl_maxdatagram              : 0
 t38_udptl_nat                      : false
 timers                             : yes
 timers_min_se                      : 90
 timers_sess_expires                : 1800
 tone_zone                          : 
 tos_audio                          : 0
 tos_video                          : 0
 transport                          : 
 trust_connected_line               : yes
 trust_id_inbound                   : false
 trust_id_outbound                  : false
 use_avpf                           : true
 use_ptime                          : false
 user_eq_phone                      : false
 voicemail_extension                : 
 webrtc                             : yes

So in an 100 video calls 200 as per above, the below is a sample of this. In the exact capture below I was not able to re-create the situation that it freezes and is not able to recover. The below shows that there was some gaps in the video but generally it was ok.

Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023229, ts 3490841833, len 001143)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023230, ts 3490841833, len 001143)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023231, ts 3490844803, len 001082)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009835, ts 3490841833, len 001135)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009836, ts 3490841833, len 001135)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009837, ts 3490844803, len 001074)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007317, ts 204935369, len 000051)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023232, ts 3490844803, len 001082)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017652, ts 3730629506, len 000048)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019725, ts 204935328, len 000051)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009838, ts 3490844803, len 001074)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013540, ts 3730629504, len 000048)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029281, ts 785547634, len 001022)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028635, ts 785547634, len 001010)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029282, ts 785547634, len 001022)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028636, ts 785547634, len 001010)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017653, ts 3730629986, len 000055)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017654, ts 3730630466, len 000049)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017655, ts 3730630946, len 000042)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017656, ts 3730631426, len 000041)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013541, ts 3730629984, len 000055)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013542, ts 3730630464, len 000049)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013543, ts 3730630944, len 000042)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013544, ts 3730631424, len 000041)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029283, ts 785547634, len 001022)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028637, ts 785547634, len 001010)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029284, ts 785547634, len 001023)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028638, ts 785547634, len 001011)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023233, ts 3490847773, len 000793)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023234, ts 3490847773, len 000794)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023235, ts 3490850833, len 000750)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023236, ts 3490850833, len 000750)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14287][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017657, ts 3730631906, len 000045)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017658, ts 3730632386, len 000046)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017659, ts 3730632866, len 000042)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023237, ts 3490854073, len 000784)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023238, ts 3490854073, len 000784)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009839, ts 3490847773, len 000785)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009840, ts 3490847773, len 000786)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009841, ts 3490850833, len 000742)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009842, ts 3490850833, len 000742)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013545, ts 3730631904, len 000045)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017660, ts 3730633346, len 000041)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013546, ts 3730632384, len 000046)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013547, ts 3730632864, len 000042)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009843, ts 3490854073, len 000776)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009844, ts 3490854073, len 000776)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013548, ts 3730633344, len 000041)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029285, ts 785547634, len 001023)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028639, ts 785547634, len 001011)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029286, ts 785547634, len 001023)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028640, ts 785547634, len 001011)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007318, ts 204935849, len 000052)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019726, ts 204935808, len 000052)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007319, ts 204936329, len 000053)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019727, ts 204936288, len 000053)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007320, ts 204936809, len 000052)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019728, ts 204936768, len 000052)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007321, ts 204937289, len 000048)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019729, ts 204937248, len 000048)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029287, ts 785551144, len 001191)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017661, ts 3730633826, len 000041)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028641, ts 785551144, len 001179)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013549, ts 3730633824, len 000041)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029288, ts 785551144, len 001192)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028642, ts 785551144, len 001180)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029289, ts 785551144, len 001192)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028643, ts 785551144, len 001180)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029290, ts 785551144, len 001192)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028644, ts 785551144, len 001180)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029291, ts 785551144, len 001192)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028645, ts 785551144, len 001180)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007322, ts 204937769, len 000051)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019730, ts 204937728, len 000051)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007323, ts 204938249, len 000052)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019731, ts 204938208, len 000052)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007324, ts 204938729, len 000048)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019732, ts 204938688, len 000048)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029292, ts 785553754, len 001170)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028646, ts 785553754, len 001158)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029293, ts 785553754, len 001170)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028647, ts 785553754, len 001158)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029294, ts 785553754, len 001170)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028648, ts 785553754, len 001158)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029295, ts 785553754, len 001170)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028649, ts 785553754, len 001158)
Got  RTP packet from    197.83.226.63:57918 (type 96, seq 029296, ts 785553754, len 001171)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017662, ts 3730634306, len 000041)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023239, ts 3490856863, len 000720)
Got  RTP packet from    197.83.226.63:59139 (type 100, seq 023240, ts 3490856863, len 000720)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 100, seq 028650, ts 785553754, len 001159)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013550, ts 3730634304, len 000041)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009845, ts 3490856863, len 000712)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 96, seq 009846, ts 3490856863, len 000712)
Got  RTP packet from    197.83.226.63:59139 (type 107, seq 017663, ts 3730634786, len 000043)
[Oct 14 17:53:31] WARNING[14248][C-0000002b]: res_srtp.c:508 ast_srtp_protect: SRTP protect: replay check failed (index too old)
Sent RTP packet to      197.83.226.63:57918 (via ICE) (type 111, seq 013551, ts 3730634784, len 000043)
Got  RTP packet from    197.83.226.63:57918 (type 111, seq 007325, ts 204939209, len 000051)
Sent RTP packet to      197.83.226.63:59139 (via ICE) (type 107, seq 019733, ts 204939168, len 000051)

Some things that I have noticed:

  • Audio is always un-affected (good quality), no matter what the video quality is.
  • If I use a Proxy with RTPEngine, the quality if the video and the choppy-ness is about the same, but if it freezes - its able to re-sync.
  • The error “replay check failed (index too old)” always appears even if srtpreplayprotection is set to yes.
  • The upload internet quality is truly rubbish! like 0.3mb per second! I tested this with SpeedTest by selecting a server in a region close to the server.
  • I just noticed something now, if i hold the call, and unhold the call, i get video again, but only for a few seconds.

The challenge here is to have “as clean as possible” video that can recover from being frozen despite a poor link. I feel like there is a timeout that’s reached, that is not recoverable.

This is my rtp.conf:

[general]
rtpstart = 10000
rtpend = 20000
rtpchecksums = yes
dtmftimeout = 3000
rtcpinterval = 5000
strictrtp = yes
probation = 8
srtpreplayprotection = yes
icesupport = true
stunaddr = stun.l.google.com:19302

[ice_host_candidates]
192.168.0.1 => 99.88.77.66

libsrtp has limits built in, and the browsers will try to retransmit/adjust quality. You need to do a packet capture to truly understand what the packets are like. Audio is substantially smaller and less likely to encounter woes.

The packet captures are huge, but ok… what am I looking for? and yes, ok, so there will be missing an wrongly ordered packets, so what, I can’t change that.

How do I get Asterisk to be more accomodating of the missing/corrupt/out-of-order packets etc? is it in libsrtp?

Video is complicated, and when it doesn’t work right it’s complicated to identify/debug/improve. First you have to look at the packet captures to understand the stream itself - is there loss, is there retransmission, what are the size of the packets, what is the ordering. On reading with WebRTC enabled in PJSIP res_rtp_asterisk will try to do reordering and also retransmission - which can be seen with debug level enabled. After that occurs it is then passed to libsrtp to do the decryption which has its own timing and limits implemented as to what it will allow to decode. You then need to look at the resulting outgoing stream to see what it is like after all of this has occurred. If any packet is lost then depending on the codec the video stream will stall and not work, and the act of trying to get it going again can increase bandwidth usage.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.