How to pass variables via Trunks or header?

How to pass variables via IAX2/SIP trunks and how to recibe in the other side?

viariable1=“Hello World” ASTERISK SERVER —>TRUNK —> OTHER SIDE ASTERISK SERVER display thevar=“Hello Word”

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


We are using Asterisk 1.4.x.


Marco Bruni

set Callerid(name) for example
and decode it on the other side.

Thanks a lot, for you guys!