Hello, we use Asterisk 19.4.0 on Debian 11 using PJSIP. Our SIP devices use Opus full band codec internally and have h.264 video support. Our SIP trunk does not support video, and supports ulaw.
When we dial an outside number over the trunk, Asterisk transcodes from opus to ulaw. This is an undesired behavior - for outgoing calls, we’d like to force ulaw while still maintaining wideband opus capability internally. Additionally, our devices show a black screen for the video feed, also undesirable - we’d like to disable video for outgoing SIP trunk calls.
Our endpoints are configured as follows, allowing all codecs used in our configuration.
disallow=all
allow=opus
allow=g722
allow=ulaw
allow=h264
I was able to get this sort of working by editing the dial plan entry for my sip trunk, and re-inviting the media session after it has been established with a different set of codecs (ulaw) and disabling video, as follows:
[sip-trunk]
exten => _X.,1,NoOp()
exten => _X.,2,Answer()
exten => _X.,3,Set(PJSIP_MEDIA_OFFER(audio)=!all,ulaw)
exten => _X.,4,Set(PJSIP_MEDIA_OFFER(video)=!all)
exten => _X.,5,Set(PJSIP_SEND_SESSION_REFRESH()=invite) ;send invite with variable
exten => _1NXXNXXXXXX,6,NoOp()
exten => _1NXXNXXXXXX,n,Dial(PJSIP/${EXTEN}@voipms)
exten => _1NXXNXXXXXX,n,Hangup()
exten => _NXXNXXXXXX,6,NoOp()
exten => _NXXNXXXXXX,n,Dial(PJSIP/1${EXTEN}@voipms)
exten => _NXXNXXXXXX,n,Hangup()
This works and the outgoing codec is switched from opus to ulaw, and the video feed is disabled. However, when an outgoing call is made, the video feed starts and then once asterisk answers, it flickers and is disabled. I am guessing this is because asterisk answers (Answer()) and then changes the media session parameters, turning the feed off. This is annoying to our users and seems to slow down the initial contact.
Is there a way to fix this, perhaps to disable the video feed and set the codec before the media stream is first established?
Thank you