Make Intercom and BLF work at the same time on Grandstream phones

I previously posted this thread Pass-through Alert-Info header from phone about making the built-in Intercom feature of my Grandstream phones work with FreePBX.

Now my users want to be able to use BLF keys on their phones. As noted in BLF not working when extensions are in custom context and BLF not working for extensions not in from-internal context, it is quite annoying to get BLF working with phones that are using custom contexts.

In case anyone finds my previous thread and wants to try using it (and for my own future reference), hopefully they’ll find this thread which includes this much better way of doing it:

[macro-dialout-one-predial-hook]
exten => s,1,Noop(Checking for Grandstream intercom header)
exten => s,n,Set(WANTINTERCOM="info=alert-autoanswer")
exten => s,n,Set(ALERTHEADER="${CUT(PJSIP_HEADER(read,Alert-Info),\;,2)}")
exten => s,n,GotoIf($[${WANTINTERCOM} = ${ALERTHEADER}]?intercom)
exten => s,n,MacroExit()
exten => s,n(intercom),Noop(Making an intercom call from ${CHANNEL} to ${EXTTOCALL})
exten => s,n,Goto(from-internal,*80${EXTTOCALL},1)
exten => s,n,MacroExit()

Note that while it is possible to just set the headers in the new call, it is better to Goto the beginning of a *80 intercom call because that way FreePBX will also do all the rest of the intercom dialplan, such as permission checks.

2 Likes