IVR, Pin Number and Sip Header


(Gmv) #1

Hi,

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.


(Lorne Gaetz) #2

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.


(Gmv) #3

Hi,

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.


(Tom Ray) #4

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?


(Gmv) #5

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.


(Craig Eustice) #6

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})

(Lorne Gaetz) #7

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.


(Craig Eustice) #8

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


(Lorne Gaetz) #9

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.


(Craig Eustice) #10

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


(Lorne Gaetz) #11

FreePBX.