[Freeswitch-users] Dialplan/PHP esl variable problem.

Peter Olsson peter.olsson at visionutveckling.se
Thu Mar 29 19:08:37 MSD 2012


ESL execute is async, so you will need to wait for the correct event to be returned, that tells you it's finished. EXECUTE_COMPLETE I think the event is called..

/Peter

29 mar 2012 kl. 16:57 skrev "Alex Crow" <acrow at integrafin.co.uk>:

> Hi all,
> 
> I have a dialplan that calls a PHP script through CURL:
> 
> <extension name="test" continue="false">
> <condition field="destination_number" expression="^669$">
> <action application="answer"/>
> <action application="sleep" data="1000"/>
> <!--<action application="play_and_get_digits" data="4 11 1 5000 # 
> ivr/ivr-please_enter_the_phone_number.wav 
> ivr/ivr-that_was_an_invalid_entry.wav target_num"/>-->
> <action application="curl" 
> data="http://localhost/provision/index.php?action=test&uuid=${uuid}&exten=${caller_id_number}" 
> />
> <action application="sleep" data="1000"/>
> <action application="log" data="INFO ${curl_response_data}"/>
> <action application="hangup" data="NORMAL_CLEARING"/>
> </condition>
> </extension>
> 
> (notice the play_and_get_digits is commented out)
> 
> and in PHP I connect via ESL via this function and code:
> 
> function saySomething($uuid) {
> 
> $sock = new ESLconnection('localhost','8021','ClueCon');
> 
> sleep (2);
> 
> $res = $sock->execute("play_and_get_digits","4 11 1 5000 # 
> ivr/ivr-please_enter_the_phone_number.wav 
> ivr/ivr-that_was_an_invalid_entry.wav target_num \d+", "$uuid");
> 
> //$foo = $uuid . ' target_num';
> 
> sleep (2);
> 
> $res=$sock->sendRecv("api uuid_getvar $uuid target_num");
> 
> 
> $ret = $res->getBody();
> 
> $sock->disconnect();
> 
> //echo $ret;
> 
> return ($ret);
> 
> }
> 
>         if ($action == 'test') {
>                 $res = saySomething($_REQUEST['uuid']);
>                 echo $res;
>         }
> 
> However if I run the play_and_get_digits from the PHP the subsequent 
> uuid_getvar returns _undef_.
> 
> If I comment out the play_and_get_digits in PHP and uncomment it in the 
> dialplan, the uuid_getvar *does* return the digits pressed.
> 
> Is there something I'm doing wrong here?
> 
> Thanks
> 
> Alex
> 
> -- 
> This message is intended only for the addressee and may contain
> confidential information.  Unless you are that person, you may not
> disclose its contents or use it in any way and are requested to delete
> the message along with any attachments and notify us immediately.
> 
> "Transact" is operated by Integrated Financial Arrangements plc
> Domain House, 5-7 Singer Street, London  EC2A 4BQ
> Tel: (020) 7608 4900 Fax: (020) 7608 5300
> (Registered office: as above; Registered in England and Wales under number: 3727592)
> Authorised and regulated by the Financial Services Authority (entered on the FSA Register; number: 190856)
> 
> 
> _________________________________________________________________________
> 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
> 
> !DSPAM:4f7475d932769462314482!
> 



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