[Freeswitch-users] Add new headers with APIs
Alex Balashov
abalashov at evaristesys.com
Sun Dec 22 17:02:27 MSK 2013
Hi Sayyed,
First of all, it is best-practical for custom SIP headers to have names
that start with X- (e.g. X-Token), which will ensure that the header
will be treated by all upstream implementations as a custom header and
not interpreted or filtered out before relay.
That said, to create a new header on the B leg, you can just set a
channel variable with the name: sip_h_X-Token. In the XML dial plan,
this would look like:
<action application="set" data="sip_h_X-Token=abc123"/>
There's no reason you can't also do this in an API call, which provides
the ability to set channel variables, and also access to the dialplan
application that does so.
For instance, I use ESL Outbound in Javascript and do something like this:
conn.execute('set', 'sip_h_X-Token=abc123');
Your actual implementation will vary depending on the nature of the API
you're using (ESL inbound, ESL outbound, mod_curl_xml (if that can be
called an API)), and, of course, the language environment and any
libraries employed.
-- Alex
--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users
mailing list