Passing sip headers through asterisk

I did a brand new clean install of 1.4.22 and then asteriskNOW from svn. The one thing that I can’t seem to get working is that asterisk keeps overriding all my sip headers such as From, Remote-Party-ID instead of passing through what I sent in my sip message.

How do I make sure asterisk passes through my Remote-Party-ID? I set the sendrpid=yes and trustrpid=no in sip.conf and sendrpid=yes on the users.conf trunk settings. How do I get asterisk to pass through my headers?

well, I found out the asterisk GUI’s macro for trunk failover is what is screwing SOME of this up. I finally have this…
exten = _1NXXNXXXXXX,1,Dial(${}/${EXTEN:0},r)

BUT now the Remote-Party-ID is the From of the original invite so it is a step in the right direction, but I want the Remote-Party-ID to be the one I sent in the first place :frowning:. HOW DO I FIX???
thanks for any help,

Asterisk is a back to back user agent. SIP headers are regenerated on the outbound leg from basic parameters like calling line ID. Asterisk can only forward From header information that corresponds to one of its types of caller id information.

So, are you saying if I have an extension 6201 on asterisk, I cannot spoof the caller id on every call from 6201 to a different number? I basically have 6201 in a pool of registered phones and from the software, I need to set the caller id to xxx-xxx-xxxx on one call and yyy-yyy-yyyy on the next call, etc. etc. depending on the data in my database. Are you saying this is not possible? or is there another header that I can change besides the from.

If I change the from, then we have problems finding the state that was associated with the phone. When a response comes back and we look up phone xxx-xxx-xxxx, it is not found as the phone is really 6201. Is there a way to solve this problem?

core show function CALLERID

The allowable datatypes are “all”, “name”, “num”, “ANI”, “DNID”, “RDNIS”.

but I still think I am screwed then, correct? The From header needs to be extension 6201 for my phone but I want the caller id to be determined from my sip message Remote-Party-ID field(NOT the From header). Can I do ${CALLERID(SIPHeader(Remote-Party-ID))) or something like that?

Every call 6201 makes outbound is a different phone number. The only examples I have seen on setting callerId have been static so far(well, the only examples I understood :frowning: )


The syntax would be something like:

assuming that SIPHeader behaves appropriately.

cool, I will have to try this out…thanks,

well, I have two problems still…

  1. When I set caller id to just a number, this is in the logs but the caller id does not go through…
    – Executing [13035178902@DLPN_inHouse:1] Set(“SIP/6201-0863fb98”, “CALLERID
    =13035225477”) in new stack
    – Executing [13035178902@DLPN_inHouse:2] Dial(“SIP/6201-0863fb98”, “SIP/tel||r”) in new stack

  2. Grabbing the sip header results in “” instead of a number of any kind?


exten => xxxx,n,Set(CALLERID=${SIPHeader(Remote-Party-ID)})

will set a variable called CALLERID to the info not the CALLERID(num) to the number


exten => xxxx,n,Set(CALLERID(num)=${SIPHeader(Remote-Party-ID)})
exten => xxxx,n,Noop(${CALLERID(num)})

and see what happens


ONE step further and ONE step to go!!!

So, that worked when I stuck a number in there but this line resolves to nothing…


The sip header I see in the packet sent to asterisk is this…
Remote-Party-ID: “”;privacy=off;screen=no

Is my header correct? or is the dial plan wrong for grabbing the phone number 13035178902 and using it?

I even tried this which resolves to nothing as well


When I say nothing I mean a string of 0 length in the logs of verbose level 5. Only if I statically set it does it work. How do you grab a sip header properly?

sweeet, it has to be SIP_HEADER and it works!!!

now, I just have to google around on cutting it down to just the number…sooo close baby…thanks for all the HELP!!! :smiley:

yeah!!! it works now!!! I learned the cut function.

thanks for all your help!!!