[Freeswitch-users] Set custom SIP header in ESL Outbound

Alex Balashov abalashov at evaristesys.com
Thu Dec 12 07:04:35 MSK 2013


It seems my question may be somewhat misplaced, inasmuch as elsewhere in 
the documentation it says that I can add SIP headers to outbound calls 
simply by adding ordinary sip_h_* channel variables:

    http://wiki.freeswitch.org/wiki/Sofia-SIP#Adding_Request_Headers

If true, that's very confusing in relation to the "Custom Headers" 
section, which insists that the operation be a CDATA attribute inside an 
<action> tag.

Anyway, I'll give this a try.  If it works, it obviates the need to 
answer my question.  :-)

-- Alex

On 12/11/2013 06:23 AM, Alex Balashov wrote:

> Another newbie question, if I may:
>
> (I realise this may be more of a modesl/node-esl question than an ESL
> question per se.)
>
> I'm using node-esl/modesl for ESL outbound actions, and can't figure out
> how to get it to append a custom SIP header on the B leg.
>
> Were it the case that the 'set' formula were the same as with most
> conventional variables, set via a 'params' tag attribute, it'd be easy:
>
>      conn.execute('set', 'foo=bar');
>
> However, in the case of the ${sip_h...} container, this is specified as
> the body value of the <action> tag, not a 'params' attribute.  Example
> per http://wiki.freeswitch.org/wiki/Sofia-SIP#Adding_Custom_Headers:
>
>      <action
> application="set"><![CDATA[sip_h_P-Charge-Info=<sip:${caller_id_number}@${domain_name}>;npi=0;noa=3]]></action>
>
> I can't quite figure out how to get the API to mimic this effect.  The
> second argument to the execute() method appears to get turned into tag
> attributes only.  From
> https://github.com/englercj/node-esl/blob/master/lib/esl/connection.js:
>
>      Connection.prototype.execute = function(app, arg, uuid, cb) {
>         ...
>
>         opts['execute-app-name'] = app;
>         opts['execute-app-arg'] = arg;
>
>         ...
>
> Am I just SOL on that one?
>
> I suppose one option is to run the call through a loopback endpoint that
> takes care of the header-setting in dialplan XML, but, as the aim is to
> build a thoroughly API-controlled environment, I'd rather avoid that
> kludge if I can help it.
>
> Any insights appreciated!
>
> -- 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