Getting and setting custom header

Hi !
I m not very familiar with Asterisk thats why i had to ask this question here…
I m using Asterisk 1.4

the problem is with this line of code
exten => _X.,8,SipAddHeader(x-CustomHdr: ${SIP_HEADER(x-CustomHdr)})

I have been unable to understand why if there is an x- in header SIP_HEADER is unable to get this header from message (although x-CustomHdr is present in message).
I tried by removing - from x-CustomHdr and it works fine…

any comments?

regards

First, does your device/soft phone/application recognize your custom header? If they do not then it doesn’t matter what you set it too. It will always be ignored.

And not sure if it matters, but I think the “x” needs to be capitalized. X-CustomHdr.

Second, you should try setting the ${SIP_HEADER} variable outside of that line. i.e.

SIP_HEADER = Can be anything you want
exten => _X.,8,SipAddHeader(X-CustomHdr: ${SIP_HEADER})

Hope that helps

thanx herb for ur reply…but that didn’t make any difference…
Is there any limit on number of custom headers? coz I have two more custom headers in the message and i can get and set them without any problem, these headers have this format
customhdr: string_value
customhdr: string_value2
and then i have
X-CustomHdr: 192.168.0.2
I tried
customhdr: 192.168.0.2
and all sorts of things but its just not giving me the value…I can surely see the
X-CustomHdr: 192.168.0.2
value on the wire with ngrep but asterisk does not get the value :frowning:

If i can get two headers like this…why not the third one…