<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Hi,<br><br>I am writing a calling card app using lua and java. <br><br>As advised, Java will predominatley do all the billing side of things (via ESL) leaving lua do simple things like asking for the calling card pin number etc.<br><br>When a call comes in, my lua script answers the call and asks the user for a pin. Instead of querying the DB inline from within lua, I would like my app server to do this (please let me know if this should be done inline instead). I understand my app server (Java ESL inbound socket) can register for a pin checking custom event and I can generate such an event from within my lua script. My lua script would then wait for an appropriate repsonse event:<br><br>-- Check if pin is valid<br>local event = freeswitch.Event("CUSTOM", "check_pin_request");<br>event:addHeader("pin_number", digits);<br>event:fire();<br><br>-- wait for response<br>con = freeswitch.EventConsumer("CUSTOM", "check_pin_reponse");<br>con:pop(1);<br>print("event\n" .. e:serialize("xml"));<br><br>I was wondering if the above is the right way of doing things, or should I be using ESLOutboundSocket and have lua script do something like this instead:<br><br>session:execute("set", "pin_to_check=12345");<br>session:execute("socket", "192.168.0.2:8084");<br><br>Not sure how lua will be told whether the pin is valid or not in this scenario.<br><br>I appreciate FreeSWITCH is very flexible and would like to make sure I develop a scalable and performant application.<br><br>Any help will be much appreciated.<br><br>Cheers<br><br>Raf<br><br><br><br>                                            </body>
</html>