我正在使用nodejs实现freeswitch ESL,为此我使用了modesl模块,它工作得很好,并且我可以使用execute函数调用拨号方案工具。
然而,execute function是nodejs modesl模块中的异步实现。
我需要的是一个同步调用,这样当我调用execute function时,执行应该等到freeswitch完成执行该应用程序。
在下面的代码示例中,在回放完成之前,我得到了输出"ivr finished“。
exports.process_ivr = function (conn, id)
{
conn.execute('answer');
conn.execute('playback','/root/before.wav');
console.log('ivr finished');
}; 根据modesl的说法,没有异步方式调用freeswitch命令,有没有其他方法可以使用nodejs实现这一点?
发布于 2014-02-12 17:44:50
尝尝这个。
conn.execute('answer',function(){
conn.execute('playback','/root/before.wav',function(){
console.log('ivr finished');
});
});https://stackoverflow.com/questions/20971087
复制相似问题