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

Checking Application Name before calling execute callback #24

Closed eafzali closed 10 years ago

eafzali commented 10 years ago

I needed to break a command and continue running other commands, but this way you handled execute_complete event to calling back execute method would cause it to run wrong command callback. for example I wanted to break a bridge command or playback command in some special cases, but when I ran break command it first calls back bridge callback with wrong event from break execute_complete and then it calls back break cb with the bridge command execute_complete event.

kbdfck commented 10 years ago

This seems to be caused by same problem I described in my report - EXECUTE_COMPLETE callback gets executed on wrong event (event from previous 'execute' call). It is not enough to check app name or even app name and arguments, because we can launch one app multiple times, but event will be fired right after first of them gets executed. We need to set some App UUID that will be returned in CHANNEL_EXECUTE_COMPLETE event to distinguish events of different 'execute' calls, one of possible approaches is described here:

http://lists.freeswitch.org/pipermail/freeswitch-users/2013-May/095329.html

eafzali commented 10 years ago

@kbdfck thanks for your link, I knew that checking app name is not enough, but I couldn't find any reliable way to check. I will try this approach and send another PR if it was successful.

englercj commented 10 years ago

Following the thread you mentioned I pushed a fix that will track execute callbacks based on a generated UUID that is passed along (and hopefully back) with the event. This feature is in v1.1.0 and later, please let me know if you have issues with it.