1
Yate users hangout place / Yate outgoing call connected to javascript IVR
« on: March 21, 2018, 02:22:00 PM »
Hi,
I want yate to make an outgoing call to a party and once this party answers the call, it should be connected to an internal javascript that runs an IVR.
I know that via javascript routing I can connect an incoming call to a javascript-ivr, but in this scenario it is an outgoing call.
What I have so far is a javascript registered in javascript.conf
with the following content, which causes Yate to create an outgoing call (in this case to my SIP phone which address is in m.getResult(0,1)).
Now after establishing this call I want to connect it to a javascript that plays a sound file and can handle DTMF. The problem right now is connecting it to this file. Once it is connected, I guess I can simply install handlers for chan.dtmf and receive the buttons pressed.
Is this even possible or do I need to connect it via
I want yate to make an outgoing call to a party and once this party answers the call, it should be connected to an internal javascript that runs an IVR.
I know that via javascript routing I can connect an incoming call to a javascript-ivr, but in this scenario it is an outgoing call.
What I have so far is a javascript registered in javascript.conf
Code: [Select]
jstrigger=trigger.js
with the following content, which causes Yate to create an outgoing call (in this case to my SIP phone which address is in m.getResult(0,1)).
Now after establishing this call I want to connect it to a javascript that plays a sound file and can handle DTMF. The problem right now is connecting it to this file. Once it is connected, I guess I can simply install handlers for chan.dtmf and receive the buttons pressed.
Code: [Select]
function onTimer(msg)
{
//Engine.debug(Engine.DebugInfo,"Got Engine.Timer");
// Get DB Object
var m = new Message("database");
// Specify connection to use
m.account = "ivrcon";
// Define Query
m.query = "SELECT OK, number, call FROM get_next_call();";
// Run the Query
if (m.dispatch())
{
if (m.rows > 0)
{
Engine.debug(Engine.DebugInfo, "Got " + m.rows + " records of " + m.columns + " fields");
var executeMsg = new Message("call.execute", msg);
executeMsg.id = Math.random(10000,10000000);
//executeMsg.callto = "wave/play//usr/share/yate/sounds/prompt_for_destination.alaw";
executeMsg.callto = "wave/play/-"; // silence
executeMsg.called = m.getResult(0,1);
executeMsg.caller = "Hans";
executeMsg.callername = "Hans";
executeMsg.dispatch();
}
}
else
{
Engine.output("Query failed");
}
return false;
}
Engine.debugName("ivr-call-trigger");
Message.trackName("ivr-call-trigger");
Engine.debugEnabled(true);
Message.install(onTimer,"engine.timer",80);
Is this even possible or do I need to connect it via
Code: [Select]
external
to a PHP script?