[Freeswitch-users] php + js

Czaderna pawel.czaderna at mainseek.com
Mon Jun 16 23:41:12 PDT 2008


Hello.

How to display uuid of channel from js script in php script ?
My js script looks like this:


//----------------------------------------
function MakeFirstCall(caller_number)
{
 var gateway = "sofia/gateway/myGateway/";

     session_leg_a = new Session();
 session_leg_a.originate(session_leg_a, gateway + caller_number); 
 session_leg_a.execute("park()");  
 session_leg_a.streamFile("msg.wav");

 var leg_a_uuid = session_leg_a.uuid;
 // How return leg_a_uuid to php script ????
}

if(argv[0] != "")
{
 MakeFirstCall(argv[0]);
}

exit();
//----------------------------------------


In php I have following lines:


//----------------------------------------
$handle = fsockopen('127.0.0.1', '8021', $erno, $errstr, 30); 
if(!$handle) 
{
 die("Connect failed with erno $erno and errstr $errstr\n");
}
else 
{
 $response= fread($handle, 1024);
 $authMessage = "auth myFSpassword\r\n\r\n";
 fwrite($handle, "$authMessage");
  
      
 $response = fread($handle, 1024);
 echo "<BR>First response $response<BR>";
 $command = "api jsrun firstCall.js 0048xxxxxxxx1\r\n\r\n";     
 fwrite($handle, $command);
        
 $response = fread($handle, 1024);
 echo "<BR>Second response $response<BR>";
 $response = fread($handle, 1024);
 echo "<BR>Third response $response<BR>";
}
//----------------------------------------


After I run php script I get OK+ result but I want uuid.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080617/01cda629/attachment-0002.html 


More information about the FreeSWITCH-users mailing list