Hi,
I’m trying to convert my CID numbers for sending them in an additional header I created in extensions_custom.conf. They need to be changed from “normal” like
1234567890
to this:
2143658709
Every group of 2 digits has to switch positions. If the number of digits is odd, a F is added in penultimate place:
1234567
to this:
214365F7
My first thought was, to count the length an then work with
So I set up an AGI to recreate my CID number, but ran into another problem:
Is there any chance to get a custom header with info of the dialed number into a pagegroup?
I managed to change [autoanswer] by coping it into extensions_override_freepbx.conf:
I thought this would be a good place, beause it deals already with headers, but there I cannot get the original called number by originator of the call.
Do you also have a little advice for this problem?
You can do this without modifying existing dialplan. Set it up as
Misc Application → Custom Destination (Return) → Page Group
For the custom Destination, write your own block of dialplan like:
[custom-page-headers]
exten => s,1,Noop(Entering user defined context custom-page-headers in extensions_custom.conf)
exten => s,n,DumpChan
exten => s,n,Return()
The DumpChan will give you a list of call details and defined variables at the asterisk console you can reference, one of them will be the dialed digits. Define the headers in this block with Gosub func-set-sipheader, but don’t run the func-apply-sipheaders, that will be done for you later in the call.
So now is when I admit that I’ve never attempted to add custom SIP headers to a paging call before. It appears that somewhere late in the call flow, the SIPHEADERS hash gets reset, probably to accommodate the auto answer feature. I think you’ll have to go back to your initial plan, but this time remove the gosub to func-set-sipheaders.
Yes. The headers can be set wherever you want in the call flow, but the apply gosub only gets called once as part of the dial application at the very end.