Disable video calling on trunk calls

I am doing some experimentation with video phones and want to set FreePBX to not make a video call when dialling over a trunk.

I have the phones set so they always make video calls. Dial an internal extension and the screen shows the video when the other phone answers, but when dialling externally, all I get is a black screen, because there is no video to display, so is it possible for asterisk to tell the phone not to use video selectively ?

Yes, and it needs to be set in the dialplan, because once the call is going out a trunk, even if you have “videosupport=no” on your trunk settings, Asterisk has already negotiated video with your video phone.

Here’s how I solved it. In /etc/asterisk/extensions_custom.conf, in [from-internal-custom], I added extensions that match my PSTN calling patterns, and explicitly set the codecs. (By not including video codecs, video is not negotiated on the first call leg.)

; prevent black video screen on PSTN calls (outbound) exten => _1NXXNXXXXXX,1,Set(__SIP_CODEC=ulaw) exten => _1NXXNXXXXXX,n,Goto(outbound-allroutes,${EXTEN},1) exten => _NXXNXXXXXX,1,Set(__SIP_CODEC=ulaw) exten => _NXXNXXXXXX,n,Goto(outbound-allroutes,${EXTEN},1) exten => _011.,1,Set(__SIP_CODEC=ulaw) exten => _011.,n,Goto(outbound-allroutes,${EXTEN},1)

Similarly, I removed video on calls coming in from the PSTN trunk:

; prevent black video on calls coming in from PROVIDER [from-trunk-PROVIDER-custom] exten => _.,1,Set(__SIP_CODEC_OUTBOUND=ulaw) exten => _.,n,Goto(from-trunk-sip-PROVIDER,${EXTEN},1)

and set the context in your trunk setting, context=from-trunk-PROVIDER-custom

replace PROVIDER with your Outgoing PEER Details name.

1 Like

Perfect, thank you!
I can’t test the outbound until I’m back in the office in the morning, but I had a go at the inbound, adding a NoOp to the dialplan to make sure I hit it. (ssh into the box) Took a little fiddling with the settings. FreePBX is great, but the abstraction from the dialplan can make tweaks like this quite confusing.

My main inbound SIP trunk had an entry already for context, it was set to “from-trunk”, so that’s now set to 'from-trunk-providername-custom" and the goto in that context points back to “from-trunk” so if I’m reading this right: Calls come in, the trunk settings in FreePBX point them to this custom dialplan which overrides a SIP header setting and then passes the call on to the next context, which is the one that they originally went to.

Pretty smooth!

I figure outbound will be just as much fun. Your example for that seems to be just two lines again, but repeated three times for different matches. I’m in the UK and all the outbound calls start with a 0, so I figure that “exten=> _0.” will do it, right?

I really appreciate the response for this one, those black screens would have been a UAT fail and a half!!!

Yes, that should be enough. Essentially, it’s just whatever you would set as the match for the outbound route that directs calls to your PSTN trunk.

I’ve now added and tested these and it’s working great, no video is attempted for trunk calls.
Is there a way to do similar for voicemail?

*79 gives the unfriendly black screen, and any other service extension will do the same.

Lastly, we’re blocking video here by locking the coded to one, law in this case. How to allow more than just the one? I tried =ulaw&alaw but that seemed to error with:
Ignoring ${SIP_CODEC*} variable because of unrecognized/not configured codec ulaw&alaw (check allow/disallow in sip.conf)

Depending on your version, the right syntax might be to separate the list of codecs with a comma.

See discussion (http://forums.asterisk.org/viewtopic.php?p=203015) and patch that was accepted in version 11 (https://reviewboard.asterisk.org/r/2728/).

Comma seperation was indeed the answer.

I ended up adding this:
exten => _*.,1,Set(__SIP_CODEC=ulaw,alaw)

Which quashes video for most of the internal feature calls, voicemail, speaking clock etc. I kinda think this should be a standard setting - unless there’s a plan afoot to have Alison videos in included in the Asterisk-sounds files :slight_smile:

Video voicemail works though! Before you disable video on all internal features, try video voicemail as well as *43 echo test (echoes video also).

With video voicemail, there’s a black screen during the menus, but when you are retrieving messages, if the caller recorded video, you will see it.

Learn something new every day! I’ll check this out in the morning :slight_smile: