Forwarding X Headers

We have a soft phone that’s dialing out, on a SIP trunk, through our Asterisk server. The soft phone is sending X Headers that we want to send on to the destination.
We see the headers coming into Asterisk, but not going out. Is there something we can do to forward the headers along to the destination?

Read them from the incoming call using the appropriate function and use SIPAddHeader to add them to the outgoing call. You will need to know the names of the headers.

Thanks David,

I’m assuming then that I do something like this:

exten => s,1,SIPAddHeader(X-My-First-Header: ${SIP_HEADER(X-My-First-Header)})
exten => s,n,SIPAddHeader(X-My-Second-Header: ${SIP_HEADER(X-My-Second-Header)})

But, if it’s a call that’s going out, not stopping at a particular extension, which Dial Plan do I add that to?

In Asterisk, all calls go to extensions, but some extensions result in calling external numbers.

Exactly where to put it will depend on the details of your dialplan.