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

Peter Olsson peter.olsson at visionutveckling.se
Fri Mar 2 08:31:35 MSK 2012


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

________________________________
Från: freeswitch-users-bounces at lists.freeswitch.org [freeswitch-users-bounces at lists.freeswitch.org] för Shahzad Bhatti [shahzad.bhatti at g-r-v.com]
Skickat: den 1 mars 2012 20:10
Till: freeswitch-users at lists.freeswitch.org
Ämne: [Freeswitch-users] Use of ESL and PHP for Call

Hi,

I am a new user and want to create an application to play a message using mod_tts (cepstral) like we have a meeting on Monday at 9 are you available, if yes press 1 and no then press 2 then record the key pressed in a variable or store it in the database.

but when i originate call the call hangup after speak, but i need to make call continue so the caller press the key and then call hangup.
now what i do, can i make it simple or make an IVR for it. i searched alot but not manage to get the solution.

so far i get the digit pressed using $digit = getHeader("DTMF-Digit"); but i need to control the call to park it after playing the message till called press the digit.

my code is as:

<?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';

 $cmd1 = "bgapi originate {origination_uuid=$uuid}user/$user &speak('cepstral|william|Hi, we have a meeting on Monday at nine, are you joining us, if yes then press one and if not press two')";

 $e = $esl->sendRecv($cmd1);

 $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();
    }
 }

?>


please help me to solve the problem


Regards

Shahzad Bhatti

!DSPAM:4f50163132762123817623!



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