<action application="set" data="tts_voice=kal"/>
<action application="fifo" data="callcentre_queue in nowait
E:/othersounds/holdmusic.mp3 E:/othersounds/holdmusic.mp3" />
</condition>
</extension>
Event Socket (It uses Ray's event socket php code in contrib section) : <?php
require_once('fs_sock.php');
$connectionInfo = array(
'host'=>'localhost',
'port'=>'8021',
'pass'=>'ClueCon',
'timeout'=>3,
'stream_timeout'=>0.5
);
$fsObj = new fs_sock($connectionInfo);
if ($fsObj -> auth != true) {
die(printf("Unable to authenticate\r\n"));
}
if (!$fsObj -> subscribe_events('plain CUSTOM fifo::info')) {
die(printf("Unable to subscribe to events"));
}
while(1) {
$output = $fsObj -> wait_for_event();
if($output != null && isset ($output['Body']['FIFO-Action']) &&
$output['Body']['FIFO-Action'] == "push") {
//Send the command to run the javascript.
$fsObj->bgapi_command("jsrun CallConnect.js");
}
}
$fsObj -> sock_close();
?>
JavaScript: newSession = new Session();
done = false;
var extensions = new Array('user/
1001@10.1.1.202','user/
1002@10.1.1.202','user/
1004@10.1.1.202','user/
1005@10.1.1.202');
var i = 0;
while(!done) {
result = newSession.originate(session, extensions[i] + ",user/
9999@10.1.1.202",2); //It does not originate call to 9999 but timeout works
// result = newSession.originate(session, extensions[i] ,2); //timeout does not work
if(result) {
newSession.answer();
newSession.execute( "fifo", "callcentre_queue out wait undef undef" );
done = true;
break;
}
i = (i >= extensions.length) ? 0 : i+1;
}
My
requirement is for the js to originate multiple calls simulatnously
like how bridge does it. If that is not possible, i would ring each
extension for a second until someone picks up.
Thanks.
B Karthik