<br><br><div class="gmail_quote">On Wed, Apr 13, 2011 at 6:59 AM, Eric Beard <span dir="ltr"><<a href="mailto:eric@loopfx.com">eric@loopfx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I've been fiddling around with things this morning and I am using a combination of PHP and Lua.<br>
<br>
I use php to simply originate the call (using regular sockets to talk to 8021, not the php mod for ESL, since I can't get it to compile). In the originate command I specify a Lua script that handles the rest of the call.<br>
<br>
I'm using the PHP functions described here:<br>
<br>
<a href="http://wiki.freeswitch.org/wiki/PHP_Event_Socket" target="_blank">http://wiki.freeswitch.org/wiki/PHP_Event_Socket</a><br>
<br>
My PHP:<br>
<br>
<br>
$fp = event_socket_create("127.0.0.1", 8021, "ClueCon");<br>
$channelVars = "{ignore_early_media=true,origination_caller_id_number=18778502010}";<br>
$phoneNum = "17277762768";<br>
$notificationId = "x";<br>
$cmd = "bgapi originate $channelVars".<br>
"sofia/gateway/affinity/".$phoneNum." &lua('test2.lua $notificationId')";<br>
echo "Sending command: $cmd";<br>
$response = event_socket_request($fp, $cmd);<br>
echo $response;<br>
fclose($fp);<br>
<br>
My Lua:<br>
<div class="im"><br>
<br>
prompt = "/home/eric/test1.wav"<br>
</div>session:streamFile(prompt)<br>
session:hangup()<br>
<br>
This is working for the very basic scenario of just waiting for the number to pick up, playing a wav, and then hanging up. If anybody can point out any major showstoppers that would prevent me from handling significant user interaction, I'd love to hear about them now. One of the things I'd like to do is incorporate pocketsphinx so that I can do voice reco. Is that possible from Lua?<br>
</blockquote><div><br></div><div>You can run pretty much any dialplan application from Lua using the session:execute method. I don't see any issues with you originating the calls via event socket and then handling the answered calls with a Lua dp script.</div>
<div><br></div><div>-MC</div></div>