How to pass variables via Trunks or header?

With SIP you may use SIPAddHeader to add the information to the SIP messages and SIP_HEADER to read that information, see how we use the two to pass the uniqueid id of a call from Asterisk 1 server to Asterisk 2 when we route the call received from Asterisk 1 to Asterisk 2:
Asterisk 1

Asterisk 2

exten=>s,n,Set(UNIQUEID_VPGW=${SIP_HEADER(X-VVCC-uniqueid_vpgw)})

We are using Asterisk 1.4.x.

Cheers.

Marco Bruni