englercj / node-esl

FreeSWITCH ESL implementation for Node.js; implements the full Event Socket Library specified in: http://wiki.freeswitch.org/wiki/Esl
http://englercj.github.com/node-esl/
MIT License
170 stars 111 forks source link

How to send messages using node-els #55

Closed karapetyan closed 8 years ago

karapetyan commented 8 years ago

here is some simplified example on lua:

freeswitch.consoleLog("info", "chat console\n") local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE"); event:addHeader("proto","ws"); event:addHeader("dest_proto", "sip"); event:addHeader("from","2183@internal"); event:addHeader("to","internal/2183@3waytalk.com"); event:addHeader("type","text/html"); event:addBody("ping"); freeswitch.consoleLog("info", event:serialize()); event:fire();

how to make same on node-esl ?

englercj commented 8 years ago

Did you take a look at the examples and source?

https://github.com/englercj/node-esl/blob/master/lib/esl/Connection.js#L647

AlexMarlo commented 8 years ago

we use this:

Dialer.prototype.sendSipMessage = function( connection, id, cb) {

  var event = new Event('custom', 'SMS::SEND_MESSAGE');
  event.addHeader('proto', 'ws');
  event.addHeader('dest_proto', 'sip');

  var from = "internal/"+id+"@3waytalk.com";
  event.addHeader('from', from);
  event.addHeader('from_full', from);

  event.addHeader('to', id+"@internal");
  event.addHeader('sip_profile', "internal");

  event.addHeader('type', 'text/plain');
  event.addHeader('Content-Type', 'text/plain');

  event.addBody( "Very big body");

  connection.sendEvent(event, cb);
};

and with "sofia profile internal siptrace on" we can't see that anything was send how to check this?

englercj commented 8 years ago

Things to try:

AlexMarlo commented 8 years ago

problem solved, it was our bug