[Freeswitch-users] Use of ESL and PHP for Call

Shahzad Bhatti shahzad.bhatti at g-r-v.com
Fri Mar 2 15:14:02 MSK 2012


Hi,

i park the call and then execute the speak command as but execute is not
working any idea ?

 $cmd  = "api originate {origination_uuid=$uuid}user/$user &park()";
 $text = "Hi, we have a meeting on Monday at 9, are you joining us, if yes
then press, 1. and if not press, 2.";

 $e = $esl->sendRecv($cmd);
 $esl->execute('speak',"(cepstral|callie|$text)",$uuid);



my complete code is

<?php

 require_once('ESL.php');

 $host_name      =       'localhost';
 $port           =       '8021';
 $password       =       'ClueCon';

 $esl           =       new ESLconnection($host_name,$port,$password);

 $e = $esl->sendRecv("api create_uuid");
 $uuid = $e->getBody();
 $user = '1500';

 $cmd  = "bgapi originate {origination_uuid=$uuid}user/$user &park()";
 $text = "Hi, we have a meeting on Monday at 9, are you joining us, if yes
then press, 1. and if not press, 2.";

 $e = $esl->sendRecv($cmd);
 $esl->execute('speak',"(cepstral|callie|$text)",$uuid);


 $e = $esl->sendRecv("events plain all");
 $e = $esl->filter("Unique-ID",$uuid);

 while ($esl->connected())
 {
   $e = $esl->recvEvent();
   $result = $e->getType();
       if($result=='CHANNEL_EXECUTE_COMPLETE')
       {
                       //      what i do here...!
               $esl->execute("&sleep",10000);
       }
       $digit          = $e->getHeader("DTMF-Digit");
       $state_no       = $e->getHeader("Channel-State-Number");
       $curr_uuid      = $e->getHeader("Channel-Call-UUID");

 /*
       $ans_state      = $e->getHeader("Answer-State");
       $state_no       = $e->getHeader("Channel-State-Number");
       $core_id        = $e->getHeader("Core-UUID");
*/
       if($curr_uuid==$uuid && $digit!=NULL)
       {
               print "input number is " . $digit . "\n";
       }
   $state = $e->getHeader("Channel-Call-State");
   if ($state == 'HANGUP') {
       print "\n\nHangup Cause Number: " . $state_no;
       $esl->disconnect();
   }
 }

?>


Regards

Shahzad Bhatti


---------- Forwarded message ----------
From: Peter Olsson <peter.olsson at visionutveckling.se>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Cc:
Date: Fri, 2 Mar 2012 05:31:35 +0000
Subject: Re: [Freeswitch-users] Use of ESL and PHP for Call
You should pass the originate command to &park() instead.

Right now you originate the call and then execute the application speak.
After this (when speak is finished) FS has no more instructions so it will
hangup the call.

If you execute &park() instead, the call will be "parked" and wait for
furter instructions. Then you will also need to execute the speak from ESL
instead - and afther that you continue to do whatever you want to do with
the call.

/Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120302/0e9e6de2/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list