[Freeswitch-users] ESL outbound /inbound

Michael Collins msc at freeswitch.org
Thu Dec 23 23:37:26 MSK 2010


What is wrong with having Lua do the db lookup?
-MC

On Thu, Dec 23, 2010 at 9:42 AM, Rafqat . <rafonline at hotmail.com> wrote:

>  Hi,
>
> I am writing a calling card app using lua and java.
>
> 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.
>
> 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:
>
> -- Check if pin is valid
> local event = freeswitch.Event("CUSTOM", "check_pin_request");
> event:addHeader("pin_number", digits);
> event:fire();
>
> -- wait for response
> con = freeswitch.EventConsumer("CUSTOM", "check_pin_reponse");
> con:pop(1);
> print("event\n" .. e:serialize("xml"));
>
> 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:
>
> session:execute("set", "pin_to_check=12345");
> session:execute("socket", "192.168.0.2:8084");
>
> Not sure how lua will be told whether the pin is valid or not in this
> scenario.
>
> I appreciate FreeSWITCH is very flexible and would like to make sure I
> develop a scalable and performant application.
>
> Any help will be much appreciated.
>
> Cheers
>
> Raf
>
>
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101223/c53edaab/attachment.html 


More information about the FreeSWITCH-users mailing list