[Freeswitch-users] SIP router/switch only configuratoin advice?

Vitalie Colosov vetali100 at gmail.com
Tue Apr 26 21:20:41 MSD 2011


You can work directly on the database from the Lua scripts.

Example of Lua script:

-----------------------------------------------------------------------------------------------------
called_number = argv[1];
local dbh = assert(freeswitch.Dbh("my_db","my_user","my_password"));

dbh:query("select price_buy,price_sell,whatever_else from my_numbers
where called_number like 'xxx%'",
function(row)

price_buy=row.price_buy;
price_sell=row.price_sell;
whatever_else=row.whatever_else;

end);

dbh:release();

--use your variables, execute bridge app, etc

-----------------------------------------------------------------------------------------------------

Just call the Lua script from your dialplan and you can implement whatever
logic you want.

Example for default dialplan:

<extension name="international">
      <condition field="destination_number" expression="^(00|\+)(\d+)">
       <action application="lua" data="process_call.lua $2"/>
      </condition>
    </extension>

See this page for more info:
http://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh


Vitalie



2011/4/26 Georgy Goshin <gosha at inbox.ee>

> David wrote:
>
> > Then check http://wiki.freeswitch.org/wiki/Xml_curl :)
>
> It's interesting module, I think that with this module we can support and
> use ANY routing scheme, why to use Web/PHP layer? Why not to work directly
> with the database?
>
>
>
>
> _______________________________________________
> 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/20110426/06621a49/attachment-0001.html 


More information about the FreeSWITCH-users mailing list