Preserve Alert-Info header

Trying to use Polycom’s built-in intercom feature, which sets the Alert-Info header on the outbound INVITE. Asterisk does not pass this on of course; is there some custom dialplan I can create so this happens? I’m guessing maybe I can put something in [from-internal-custom], but would rather not reinvent the wheel if someone has already done something similar. Thanks.


Can you paste here your Polycom config file?

Thank you,

Daniel Friedman
Trixton LTD.

This is nothing to do with the Polycom, I only included that detail for context. This is about taking SIP headers from an inbound call and relaying them to the outbound leg. But thanks for taking a look.


You can set it in the inbound route in the special Alert Info field like this: Alert-Info: Auto Answer or any other value that you have set in your Polycom configuration file.

If you want to use the from-internal-custom context you can use this:

exten => _99X.,1,SIPAddHeader(Alert-Info: Auto Answer)
same => n,Goto(from-internal,${EXTEN:2},1)

Just make sure that you are adding the right prefix (99 in my example) to your destination, or customize it to your needs.

Thank you,

Daniel Friedman
Trixton LTD.

I haven’t played with the SIP headers for a while so this is a bit of a shot in the dark, but maybe an angle you can experiment with:

Your normal context for the extension is from-intenral such that when your Polycom makes a call, it’s going to send it to the number you dialed @ from-internal. From there of course, we never look at your SIP headers, we originate a new call out to the extension you’re trying to call.

So … what if you changed your context on that Polycom to from-internal-polycom (as an example). The context for from-internal-polycom, in extensions_custom.conf, would be written so as to catch all dialed numbers (so _X.) and would check if there’s an Alert-Info header set. If so, and if you just want to pass that on, you could simply set the header onto the outbound leg of the call and then pass the call on with a goto ${EXTEN},from-internal,1 which is where it would have been normally sent.

An alternative approach which would tie into the normal dialpan would be a slightly more ‘complex’ dialplan in that context where you would do the following. Say all your internal extensions were in the range of ‘2XXX’ (just extensions, nothing else such as no ring groups, etc), you can have _2XXX as an extension in your context and from there prepend the normal intercom code before sending it to from-internal assuming you detect the Alert-Info header desired. For any other number you dial, you just pass it on to from-internal with no change, same as if there’s no alert-info header. This has the advantage of sticking to the normal FreePBX dialplan, honoring whitelist/blacklists for intercom, and any other dialplan that we put in there.

That sounds promising, but where can I hook into the dialplan before it hits from-internal? I added the following but it overwrites the built-in FreePBX dialplan (which is setting the __RINGTIMER global at that point.)

exten => _7XXX,1,ExecIf($["${SIP_HEADER(Alert-Info)}"=="Intercom"]?SipAddHeader(Alert-Info: Intercom))

Ah, never mind; just saw your “in that context” in the paragraph, still talking about the from-internal-polycom context.

I may just end up using the FreePBX paging module, to save confusing the operations staff with custom contexts. The built-in intercom function is nicer because it has a UI allowing the user to choose from directory and recent contacts.

you aren’t 'hooking into the dialplan, you’re pointing the extension at a different context, doing your required work, and then doing a goto back into the normal dialplan. If you use the context you listed above as an example, but with my renaming so as not to confuse it with from-internal-custom, then you would do the following:

Under the extension configuration you change the context to:


next, if you want to take the approach of ONLY prepending the 7XXX extension numbers then your context looks like:

exten => _7XXX,1,ExecIf($["${SIP_HEADER(Alert-Info)}"=="Intercom"]?SipAddHeader(Alert-Info: Intercom))
exten => _7XXX,n,Goto(from-internal, ${EXTEN}1)
exten => _X.,1,Goto(from-internal,${EXTEN},1)

but referring to your followup post (as I was writing the above before you replied), I would suggest using the builtin capability. Either have the users intercom with the intercom prefix, program the phones so they can do this with a button, or if what they want is for all internal calls to be intercom calls, then go to advanced settings and flip the PBX into that mode.