attention: using javascript promises
events
'variables' - on start call 'close' - on end session 'hangup' - on hangup channel
details https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+AGICommand_control+stream+file
Dispatches the EXEC
AGI command to asterisk with supplied command name and arguments.
context.exec('Dial', opt1, opt2, .., optN)
.then(function(result)
//the channel call app Dial with options
});
context.exec('RecieveFax', '/tmp/myfax.tif')
.then(function(result) {
//fax has been recieved by asterisk and written to /tmp/myfax.tif
});
Dispatches the 'HANGUP' AGI command to asterisk. Does not close the sockets automatically. callback is called with the result of the dispatch.
context.hangup().