You can work directly on the database from the Lua scripts.<div><br></div><div><div><div>Example of Lua script:</div><div><br></div><div>-----------------------------------------------------------------------------------------------------</div>
<div>called_number = argv[1];</div><div>local dbh = assert(freeswitch.Dbh(&quot;my_db&quot;,&quot;my_user&quot;,&quot;my_password&quot;));</div><div><br></div><div><div>dbh:query(&quot;select price_buy,price_sell,whatever_else from my_numbers where called_number like &#39;xxx%&#39;&quot;,</div>
<div>function(row) </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>price_buy=row.price_buy;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>price_sell=row.price_sell;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>whatever_else=row.whatever_else;</div><div><span class="Apple-tab-span" style="white-space:pre"></span></div><div><br></div><div>end);</div></div><div><br>
</div><div>dbh:release();</div><div><br></div><div>--use your variables, execute bridge app, etc</div><div><br></div><div>-----------------------------------------------------------------------------------------------------</div>
<div><br></div><div>Just call the Lua script from your dialplan and you can implement whatever logic you want.</div><div><br></div><div>Example for default dialplan:</div><div><br></div><div><div>&lt;extension name=&quot;international&quot;&gt;</div>
<div>      &lt;condition field=&quot;destination_number&quot; expression=&quot;^(00|\+)(\d+)&quot;&gt;<span class="Apple-tab-span" style="white-space:pre">                </span></div><div>      <span class="Apple-tab-span" style="white-space:pre">        </span>&lt;action application=&quot;lua&quot; data=&quot;process_call.lua $2&quot;/&gt;</div>
<div>      &lt;/condition&gt;      </div><div>    &lt;/extension&gt;</div></div><div><br></div><div><div>See this page for more info:</div><div><a href="http://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh">http://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh</a><br>
</div></div><div><br></div><div><br></div><div>Vitalie</div><div><br></div><div><br></div><div><br><div class="gmail_quote">2011/4/26 Georgy Goshin <span dir="ltr">&lt;<a href="mailto:gosha@inbox.ee">gosha@inbox.ee</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">David wrote:<br>
<br>
&gt; Then check <a href="http://wiki.freeswitch.org/wiki/Xml_curl" target="_blank">http://wiki.freeswitch.org/wiki/Xml_curl</a> :)<br>
<br>
</div>It&#39;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?<br>
<div><div></div><div class="h5"><br>
<br>
<br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br></div></div></div>