Endless SIP re-invite after attended or blind transfer when using video codecs with non video enabled phones

I encounter a very strange behaviour, which I can repeat systematically:

Using PJSIP and asterisk 20.6, dialplan managed by ARI

Scenario is as follow:

  1. A calls B
  2. B answers A
  3. B open a new line and calls C
  4. B makes an attended transfer to connect C & A

Note: the problem only occurs when h264,vp8 codes are allowed in pjsip.conf

Everything works correctly until step 4) above, at this time, asteirks continuously send SIP INVITE with audio and video request, to which the phone respond with audio codec and no support for video codec (video 0)

Then it seems like asterisk sends and sends the same sequence, which prevent any audio sound

(asterisk is 172.51.0.5)

The attended transfer occurs at 20:36:57, a new invite is sent which is acknowledged, then starting 20:36:57.188 asterisk continuously iniates new invites

Below is the detail where we can see the audio/video request.

If I remove video codecs from pjsip.conf, the behaviour is then normal with only one reinvite just after the transfer

Video port is constantly changing, which probably causes the sip reinvite, example:

What’s the actual full configuration and SIP trace? I would also suggest getting a debug log[1] because the logic will generally tell you why it is doing what it is doing.

[1] Collecting Debug Information - Asterisk Documentation