Asterisk changing SSRC for RTP stream and causing 6-7 seconds of missing RTP (voice)

I have done call forwarding in my mobile phone (say Entity B) and the call gets forwarded to asterisk.
Call flow:
Entity A makes call to Entity B which forwards the call to Asterisk
Asterisk play some music file and Dial to Entity C (webRTC).

until C answers the call, A can hear the Music files played by Asterisk and the ringing from C but as soon as C answers the call there is a missing voice at both ends A and C for about 6 to 7 seconds.

after wireshark analysis i found that Asterisk changes the SSRC for RTP stream from Asterisk to A which takes 6 to 7 seconds and there is no RTP packets for that duration of SSRC change.

my question is why asterisk changes the SSRC for RTP stream after the call gets accepted.

Also if i directly make a call to Asterisk without forwarding than there is no missing voice in this case.

You haven’t said which channel technology driver you are using.

If there is no RTP how can you know what SSRC would be used?

You should only hear the music. This suggests to me that you may be using directrtpsetup (which is not officially supported, and C is sending ringback as early media, direct to A, which is trying to make sense of both a direct stream from C and the stream from Asterisk.

Historically, Asterisk has failed to change SSRC when it should do, which causes some PABXes to have problems with jitter buffers for several seconds. Asterisk was settting the marker bit, only. On the other hand, some PABXes don’t seem to like SSRC changes.

The SSRC should change when MoH changes to media from C.

I am using SIP (chan_sip) as channel technology also this is not a directrtpsetup i have the entry directmedia=no in my sip.conf.

also the SSRC change duration is not constant for some calls it happens within seconds but for most of the calls it is taking 6 to 7 seconds.

@david551, can you explain this point a little. “The SSRC should change when MoH changes to media from C”

The source of the music on hold is Asterisk. The source of the ringing tone is C. They are different sources, so should have different SSRCs.

Historically, at least, Asterisk hasn’t done this, simply setting the marker bit instead.

OK, but i can hear both music on hold and ringing in the same SSRC, and the conversation in different SSRC.

also i don’t know if it matters but there is another asterisk in play between Asterisk and WebRTC acting as a proxy server and just relaying the SIP and RTP traffic between main Asterisk and WebRTC.
proxy asterisk is also configured with directmedia=no.

You mean tandem switch. Asterisk never acts as a SIP proxy, although it can go into an internal native bridging mode where it forwards RTP with minimal changes.

Ok, i am just trying to isolate the issue as direct calls to asterisk works fine, the problem is only with forwarded calls where outward RTP stream from asterisk vanishes for few seconds and reappears with new SSRC though inwards RTP stream is constantly there but still no voice at any of the ends (A or C).
can you give me a direction as per what part of the system should i debug further.

Just a data point - chan_pjsip does not currently alter the SSRC in any circumstances (this may change in the future and would be behind a configurable option) so it should not suffer from such a problem.