Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
navrotskyj committed Apr 4, 2017
1 parent 39cb825 commit ce62a71
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/lib/modesl/lib/esl/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var Connection = module.exports = function() {
this.executeHandlers = {};

//events required for the module to operate properly
this.reqEvents = ['BACKGROUND_JOB', 'CHANNEL_EXECUTE_COMPLETE'];
this.reqEvents = ['CHANNEL_EXECUTE_COMPLETE'];
this.listeningEvents = [];

//"Inbound" connection (going into FSW)
Expand Down Expand Up @@ -90,9 +90,10 @@ var Connection = module.exports = function() {
// this.send('connect');

this.once('esl::event::CHANNEL_DATA::**', function() {
self.subscribe(self.reqEvents, function() {
self.emit('esl::ready');
});
self.emit('esl::ready');
// self.subscribe(self.reqEvents, function() {
// self.emit('esl::ready');
// });
});

this.socket.on('error', this._onError.bind(this));
Expand Down
8 changes: 6 additions & 2 deletions src/lib/modesl/lib/esl/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ Server.prototype._onConnection = function(socket) {
conn.send('connect');
conn.on('esl::ready', function(id) {
if(this.bindEvents) {
conn.sendRecv('myevents', function() {
this.emit('connection::ready', this.connections[id], id, this.connectionsLength);
conn.sendRecv('myevents json', function() {
// this.emit('connection::ready', this.connections[id], id, this.connectionsLength);
conn.filter('Event-Name', 'CHANNEL_ANSWER');
conn.filter('Event-Name', 'CHANNEL_EXECUTE_COMPLETE', () => {
this.emit('connection::ready', this.connections[id], id, this.connectionsLength);
});
}.bind(this));
}else{
this.emit('connection::ready', this.connections[id], id, this.connectionsLength);
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/dialerContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = function (conn, destinationNumber, globalVariable) {
exec();
} else {
log.trace(`Channel not answered, subscribe CHANNEL_ANSWER`);
conn.subscribe('CHANNEL_ANSWER');
//conn.subscribe('CHANNEL_ANSWER');
conn.once('esl::event::CHANNEL_ANSWER::*', () => {
log.trace(`On CHANNEL_ANSWER ${uuid}`);
exec();
Expand Down

0 comments on commit ce62a71

Please sign in to comment.