<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 29/03/12 16:08, Peter Olsson wrote:
<blockquote
cite="mid:1A52405B-F63B-4FE7-BDAF-2AD154593485@visionutveckling.se"
type="cite">
<pre wrap="">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" <a class="moz-txt-link-rfc2396E" href="mailto:acrow@integrafin.co.uk"><acrow@integrafin.co.uk></a>:
</pre>
</blockquote>
<br>
Peter,<br>
<br>
Actually if execute is async the Wiki is wrong:<br>
<br>
<blockquote><small>"execute</small><br>
<br>
<small>execute($app[, $arg][, $uuid])</small><br>
<br>
<small>Execute a dialplan application, and wait for a response
from the server. On socket connections not anchored to a channel
(most of the time inbound), all three arguments are required --
$uuid specifies the channel to execute the application on.</small><br>
<br>
<small>Returns an ESLevent object containing the response from the
server. The getHeader("Reply-Text") method of this ESLevent
object returns the server's response. The server's response will
contain "+OK [Success Message]" on success or "-ERR [Error
Message]" on failure.</small><br>
<br>
<small>See the examples below for information on how to get a uuid
to use when calling execute().</small><br>
<small>executeAsync</small><br>
<br>
<small>executeAsync($app[, $arg][, $uuid])</small><br>
<br>
<small>Same as execute, but doesn't wait for a response from the
server.</small><br>
<br>
<small>This works by causing the underlying call to execute() to
append "async: true" header in the message sent to the channel.
"</small><br>
</blockquote>
<br>
As you can see there is a specific executeAsync call documented. Are
they both actually async?<br>
<br>
That aside, does this code look OK?<br>
<br>
<tt>$esl = new ESLconnection('localhost','8021','ClueCon');<br>
<br>
$event = $esl->events('plain', 'ALL');<br>
$event = $esl->filter("Unique-ID",$uuid);<br>
<br>
sleep (2);<br>
<br>
$event = $esl->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");<br>
<br>
//$foo = $uuid . ' target_num';<br>
<br>
<br>
while ($event->getType() != 'CHANNEL_EXECUTE_COMPLETE' ) {<br>
$esl->execute("&sleep",100);<br>
}<br>
<br>
$event=$esl->sendRecv("api uuid_getvar $uuid target_num");</tt><br>
<br>
Cheers<br>
<br>
Alex<br>
<br>
</body>
</html>