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

Alex Balashov abalashov at evaristesys.com
Wed Dec 11 14:23:17 MSK 2013


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