This bug is related to ICE and TURN protocols. The media stops because the TURN server will drop all packets from peers that do not have permission. When ICE starts, it will request permission on each allocation for each peer candidate. The permission lasts exactly 5mn (as per RFC). In the current implementation of PJSIP, only the selected peer candidate will have its permission renewed.
There are situations where we can have a mismatch in the valid lists of connections pair and the resulting active connection selected by ICE on each side. Since the pairs are mismatching, the ICE agent will renew permission for the wrong peer address, and the media stops after exactly 5mn.
The attached email exchanges we had with PJSIP maintainers provide a detailed description of the issue and the fixes.
media-loss-after-5mn-email.txt