Drop video when dialing outbound trunk

I have a Cisco 8865 phone that I have connected to FreePBX and registered successfully. All the features that I need work, except for one quirk that I’d like to fix. When I place an outbound call to an outbound SIP trunk with the shutter closed, the phone still seems to negotiate video with FreePBX/Asterisk, even though the SIP trunk doesn’t have any video codecs enabled (ulaw only). Consequently, the call drops after 30 seconds if I keep the shutter closed even though it’s only an audio SIP trunk because “Disconnecting channel ‘PJSIP/xxxxxxxx’ for lack of video RTP activity in 32 seconds” If I place a call with the camera shutter open, the call stays online indefinitely on a SIP outbound trunk. I’d like to be able to drop the video connection when placing an outbound sip trunk call.

I’ve looked around at a few different posts and came up with adding the following to extensions_custom.conf, but this doesn’t do it. I also attempted to use Set(“__SIP_CODEC”), but I think that is only for chan_sip, so it didn’t work.

Am I going at this the right way or do I need to explore something else? Disabling the video codecs on the phone’s extension configuration does work, but then I lose video calling between extensions, which is something I want to keep.

[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Run Dialout Trunk Predial Hook)
exten => s,n,Set(PJSIP_MEDIA_OFFER(video)=!all)
exten => s,n,Set(PJSIP_MEDIA_OFFER(audio)=ulaw)
exten => s,n,NoOp(Video Offer: ${PJSIP_MEDIA_OFFER(video)})
exten => s,n,NoOp(Audio Offer: ${PJSIP_MEDIA_OFFER(audio)})
exten => s,n,Return()

Edit: FreePBX 17.0.19.27 is the version I’m running.

Setting PJSIP_MEDIA_OFFER affects the outbound channel. You need a way to affect the SDP answer (not offer) from Asterisk back to your phone depending on the dialed number, which I don’t think you can do.

A hacky (bad) idea would be to set up two different extensions on the phone, one with the video codec enabled and one without, and use the video-enabled extension when you want video and the non-video extension for PSTN calls.

(I put bad ideas into the forum so that someone else will say how bad it is and rise to the challenge of providing a better solution.)

1 Like

Love this haha. I might have to do the second extension idea. My other bad idea is to put a sticker on the phone that says “leave shutter open when placing out of office call”

I’ll see what I can find on the SDP offer info, thanks for that direction. I worked with Asterisk about 10-15 years ago, but haven’t picked it back up until recently, and realize I’ve forgotten a lot of it.

If anyone else has any thoughts on this, please chime in!

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