[Freeswitch-users] Lua session originate - freeswitch crash

Michael Collins msc at freeswitch.org
Wed Apr 13 19:01:23 MSD 2011


On Wed, Apr 13, 2011 at 6:59 AM, Eric Beard <eric at loopfx.com> wrote:

> I've been fiddling around with things this morning and I am using a
> combination of PHP and Lua.
>
> 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.
>
> I'm using the PHP functions described here:
>
> http://wiki.freeswitch.org/wiki/PHP_Event_Socket
>
> My PHP:
>
>
>  $fp = event_socket_create("127.0.0.1", 8021, "ClueCon");
>  $channelVars =
> "{ignore_early_media=true,origination_caller_id_number=18778502010}";
>  $phoneNum = "17277762768";
>  $notificationId = "x";
>  $cmd = "bgapi originate $channelVars".
>   "sofia/gateway/affinity/".$phoneNum." &lua('test2.lua $notificationId')";
>  echo "Sending command: $cmd";
>  $response = event_socket_request($fp, $cmd);
>  echo $response;
>  fclose($fp);
>
> My Lua:
>
>
> prompt = "/home/eric/test1.wav"
> session:streamFile(prompt)
> session:hangup()
>
> 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?
>

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.

-MC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110413/1729d173/attachment.html 


More information about the FreeSWITCH-users mailing list