[Freeswitch-users] javascript to get the status

Gopalakrishnan A.N saigop at gmail.com
Tue Feb 10 00:30:11 PST 2009


Hi,
   I am trying to execute the following script, its working fine for call
origination, but cant able to get the status for dialed numbers, able to get
only the last dialed number not for both the numbers. The script as follows,

Javascript

var array = [2];

array[0]="39841799874";

array[1]="39894929942";

for(var i=0;i<array.length;i++)

{

session = new Session();

session.originate(session,
"{ignore_early_media=true}sofia/default/"+array[i]+"@172.20.191.228");

if (session.ready())

{

//session.setVariable("session.uuid", "Session OUTPUT: " + session.uuid);

//session.setVariable("notice", "Disconnect cause: " + session.cause);

//session.setVariable("info", "Disconnect cause: " + session.causecode);

console_log("notice", "Session UUID: " + session.uuid + "\n");

console_log("info", "Disconnect cause: " + session.cause + "\n");

console_log("notice", "Disconnect Code: " + session.causecode + "\n");

}

}

if (session.answer())

{

session.execute("sleep","5000000");

console_log("notice", "Session UUID: " + session.uuid + "\n");

console_log("info", "Disconnect cause: " + session.cause + "\n");

console_log("notice", "Disconnect Code: " + session.causecode + "\n");

}

The steps as follows,

1. enter into the array - working fine

2. take each number to the originate session via for loop - working fine

3. the call has to be answered by the session - working fine

4. the call status need to be printed in console for each call - printing
only for the last dialed call


Any suggestion would help us.
-- 
Thank you  with regards,
Gopal,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090210/a7aaa77f/attachment-0002.html 


More information about the FreeSWITCH-users mailing list