IVR, Pin Number and Sip Header


I would like put something in place.

This how it would work :

  • The client call us
  • He is asked for a pin number (any, 6 digits)
  • [option - the digits are controlled]
  • the digits are put in the sip header
  • a call is make to an extension with the modified sip header

I took a look at IVR and Call Flow Control but I did not found what I’m searching for.
I already nearly made it with 3CX but this system do not allowed to modify headers so it was useless.

First question do you think I can do such a thing with Freepbx?
If yes Do you have an idea on how to?

Many thanks by advance.

Can’t be done with the GUI, but can be done with custom dialplan. Add a context to extensions_custom.conf that prompts for the input and then write the sip header. Use a Custom Destination to send the caller to your dialplan.

To write the header, here is some sample code:

exten => s,n,GoSub(func-set-sipheader,s,1(X-custom-header-name,header_content))

It’s the type of thing we do a lot in Sangoma Support if you need assistance and you have a budget for it.


Many thanks for your answer. I’ll take a look at this.
I’ll look at services provided by Sangoma, but my bosses ususally
ask us to get the skills. But we don’t know, they sometimes change their mind, I’ll take a look.

And once again : thank you.

1 Like

Just a question, these SIP headers you are trying to add. These are headers that the phone is expecting? It’s programmed to accept and process these headers, correct?

Yes, an application that have a sip connection to freepbx is waiting for specfific headers.

I’m reading dial plan and ivr docs on asterisk.org.

1 Like

In additional to the suggestion of func-set-sipheader, you can also add the header with just SIPAddHeader.

For example: I have an IVR application built in extensions_custom.conf that asks for a pin, the pin is stored as a variable. Some work is done against the variable to retrieve needed data. The returned data is what I store as a SIP header. Below is my SIP header line , where CURL_DATA is my retrieved variable. In your case, it could be the pin.

exten => s,n(enterconf),SIPAddHeader(Conference-Room:${CURL_DATA})

No. This is obsolete advice and only works for chan_sip which is now deprecated. The supported way to add custom SIP headers in any modern version of FreePBX is to use the native subroutines.

Appreciate the heads up. thanks :slight_smile:
BTW, is that specific to FreePBX or Asterisk? I’m finding Asterisk 17 still allows SIPAddHeader.

1 Like

Using sipaddheader is not wrong and obviously works as expected for chan sip channels. But chan sip is deprecated, and fewer systems will be using it at all going forward. When doing development, you need to be doing so with an eye toward the horizon.

@lgaetz Thanks. Is func-set-sipheader a FreePBX implementation or native asterisk?


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