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@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?