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

Shahzad Bhatti shahzad.bhatti at g-r-v.com
Mon Mar 5 15:47:45 MSK 2012


Hi,


Thanks for the tip but i want to know that what hsndler.php code is and
where to put that file i means path of file.

second i have an error on this example and log show like that in fs_cli

2012-03-05 22:36:53.293238 [ERR] mod_native_file.c:74 Error opening
/usr/local/freeswitch/sounds/en/us/callie/&speak:cepstral|callie|Hi,.PCMU
2012-03-05 22:36:53.293238 [ERR] mod_native_file.c:74 Error opening
/usr/local/freeswitch/sounds/en/us/callie/we.PCMU
2012-03-05 22:36:53.293238 [ERR] mod_native_file.c:74 Error opening
/usr/local/freeswitch/sounds/en/us/callie/&speak:cepstral|callie|Hi,.PCMU
2012-03-05 22:36:53.293238 [ERR] mod_native_file.c:74 Error opening
/usr/local/freeswitch/sounds/en/us/callie/we.PCMU
2012-03-05 22:36:53.293238 [ERR] mod_native_file.c:74 Error opening
/usr/local/freeswitch/sounds/en/us/callie/&speak:cepstral|callie|Hi,.PCMU
2012-03-05 22:36:53.293238 [ERR] mod_native_file.c:74 Error opening
/usr/local/freeswitch/sounds/en/us/callie/we.PCMU
2012-03-05 22:36:53.293238 [WARNING] switch_ivr_play_say.c:2072 PAGD
failure! Transfer to: on / Monday / at


Please Guide me

Regards
Shahzad Bhatti


On Sat, Mar 3, 2012 at 5:02 AM, <
freeswitch-users-request at lists.freeswitch.org> wrote:

> Send FreeSWITCH-users mailing list submissions to
>        freeswitch-users at lists.freeswitch.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> or, via email, send a message with subject or body 'help' to
>        freeswitch-users-request at lists.freeswitch.org
>
> You can reach the person managing the list at
>        freeswitch-users-owner at lists.freeswitch.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of FreeSWITCH-users digest..."
>
> Today's Topics:
>
>   1. Re: Use of ESL and PHP for Call (Michael Collins)
>   2. Re: a question about freeswitch conference        caller-controls
>      (Michael Collins)
>   3. Re: *** No rule to make target `tport/libtport.la', needed by
>      `libsofia-sip-ua.la'. (Ken Rice)
>
>
> ---------- Forwarded message ----------
> From: Michael Collins <msc at freeswitch.org>
> To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
> Cc:
> Date: Fri, 2 Mar 2012 15:49:10 -0800
> Subject: Re: [Freeswitch-users] Use of ESL and PHP for Call
> Shahzad,
>
> I think you may have taken an unnecessarily complicated approach to this.
> If I were you I would simply use the play_and_get_digits application which
> does all the work for you. I would also handle that in the XML dialplan and
> then use the api_hangup_hook to call your script to process the result.
> (I.e. did the user press 1 or 2 or something else...)
>
> I recommend you start with something simple like a basic originate command
> that calls the user and then drops that call to a dialplan extension:
>
> originate user/1500 meeting_request_1500
>
> Then create that extension:
>
> <extension name="meeting request">
>   <condition field="destination_number" expression="^meeting_request_(
> \d+)$">
>     <action application="set" data="target_user=$1"/>
>     <action application="set" data="text=cepstral|callie|Hi, we have a
> meeting on Monday at 9, are you joining us, if yes then press, 1. and if
> not press, 2."/>
>      <action application="answer"/>
>     <action application="sleep" data="1000"/>
>     <action application="play_and_get_digits"
>       data="1 1 3 5000 # speak:${text}
> ivr/ivr-that_was_an_invalid_entry.wav answer \d"/>
>     <action application="set" data="api_hangup_hook=system handler.php
> ${target_user} ${answer}"/>
>      <action application="log" data="INFO User ${target_user} responded
> with ${answer}"/>
>     <action application="playback" data="ivr/ivr-Thank_you.wav"/>
>     <action application="hangup"/>
>   </condition>
> </extension>
>
> Then you just need to write your handler.php script (or whatever you want
> to call it) and have it parse the command line args - the first one is the
> user and the second one is the digit pressed. PHP scripts will work for
> hangup hooks but they aren't the best choice since there isn't a "mod_php"
> like there is a mod_lua or mod_perl. Those modules let you do cool things
> like "session_in_hangup_hook." However, what you're doing doesn't look like
> it's very difficult so the example I've given should get you going. Please
> note that I just did this off the top of my head w/o testing it so be sure
> double-check everything if you run into any unusual or unexpected behavior.
>
> Keep in mind that in this example you will need two different PHP scripts
> - one that actually initiates the ESL connection and does the originate and
> one that handles the call results. Instead of one semi-complicated script
> you will have two very easy scripts.
>
> Hope this helps...
> -MC
>
> On Fri, Mar 2, 2012 at 4:14 AM, Shahzad Bhatti <shahzad.bhatti at g-r-v.com>wrote:
>
>>
>> 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
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
>
> ---------- Forwarded message ----------
> From: Michael Collins <msc at freeswitch.org>
> To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
> Cc:
> Date: Fri, 2 Mar 2012 16:01:44 -0800
> Subject: Re: [Freeswitch-users] a question about freeswitch conference
> caller-controls
> Try this in your dialplan before sending the call to the conference:
> http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_start_dtmf
> -MC
>
> On Thu, Mar 1, 2012 at 5:30 PM, Erjian Li <eli at netspectrum.com> wrote:
>
>> When I press cellphone's key, although Freeswitch can't see this DTMF,
>> but the the other participant of the conference call can hear my DTMF tone.
>> Does this situation indicates that the DTMF tone has been forwarded by SIP
>> provider's server?
>>
>>
>
> ---------- Forwarded message ----------
> From: Ken Rice <krice at freeswitch.org>
> To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
> Cc:
> Date: Fri, 02 Mar 2012 18:02:02 -0600
> Subject: Re: [Freeswitch-users] *** No rule to make target `tport/
> libtport.la', needed by `libsofia-sip-ua.la'.
>  This is because Apple Deprecated SSL on Lion... They don’t want you
> using it...
>
> Configure ‘--without-openssl’ and the problem goes away...
>
> There is an open jira on this issue I just cant recall the bug number off
> the top of my head
>
>
> On 3/2/12 4:57 PM, "Stéphane Lux" <stephane at lux.io> wrote:
>
> I have tried to compile it again:
>
>
> tport_tls.c: In function 'tls_error':
> tport_tls.c:665: warning: 'SSL_get_error' is deprecated (declared at
> /usr/include/openssl/ssl.h:1501)
> tport_tls.c:680: warning: 'SSL_get_shutdown' is deprecated (declared at
> /usr/include/openssl/ssl.h:1568)
> tport_tls.c: In function 'tls_read':
> tport_tls.c:723: warning: 'SSL_read' is deprecated (declared at
> /usr/include/openssl/ssl.h:1493)
> tport_tls.c: In function 'tls_pending':
> tport_tls.c:739: warning: 'SSL_pending' is deprecated (declared at
> /usr/include/openssl/ssl.h:1368)
> tport_tls.c: In function 'tls_write':
> tport_tls.c:807: warning: 'SSL_write' is deprecated (declared at
> /usr/include/openssl/ssl.h:1495)
> tport_tls.c: In function 'tls_connect':
> tport_tls.c:899: warning: 'SSL_accept' is deprecated (declared at
> /usr/include/openssl/ssl.h:1491)
> tport_tls.c:899: warning: 'SSL_connect' is deprecated (declared at
> /usr/include/openssl/ssl.h:1492)
> tport_tls.c:900: warning: 'SSL_get_error' is deprecated (declared at
> /usr/include/openssl/ssl.h:1501)
> tport_tls.c:954: warning: 'ERR_error_string_n' is deprecated (declared at
> /usr/include/openssl/err.h:280)
> make[9]: *** [tport_tls.lo] Error 1
> make[8]: *** [all] Error 2
> Making all in nta
> Making all in nth
> Making all in nea
> Making all in iptsec
> Making all in nua
> make[8]: *** No rule to make target `tport/libtport.la', needed by `
> libsofia-sip-ua.la'.  Stop.
> make[7]: *** [all-recursive] Error 1
> Making all in packages
> make[6]: *** [all-recursive] Error 1
> make[5]: *** [all] Error 2
> make[4]: *** [/usr/local/src/freeswitch/libs/sofia-sip/libsofia-sip-ua/
> libsofia-sip-ua.la] Error 2
> make[3]: *** [mod_sofia-all] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
>
>
> On 02.03.2012, at 23:42, Michael Collins wrote:
>
> We need to see the output that comes prior to this error. Grab the
> previous 20+ lines of output prior to this error and let us take a look.
> Hopefully the true cause will be apparent.
>
> -MC
>
> 2012/3/2 Stéphane Lux <stephane at lux.io>
>
> Hi,
>
> when compiling FS on Mac OS 10.7.3 I get this error:
>
> make[8]: *** No rule to make target `tport/libtport.la <
> http://libtport.la/> ', needed by `libsofia-sip-ua.la <
> http://libsofia-sip-ua.la/> '.  Stop.
>
> How can I solve it?
>
> Kind Regards,
> Stephane
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com <http://www.freeswitchsolutions.com/>
>
> 
>  </>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org <http://www.freeswitch.org/>
> http://wiki.freeswitch.org <http://wiki.freeswitch.org/>
> http://www.cluecon.com <http://www.cluecon.com/>
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org <http://www.freeswitch.org/>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
>
> ------------------------------
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120305/c667afd2/attachment-0001.html 


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