[Freeswitch-users] Database query from dialplan

Abdul Hakeem alhakeem at gmail.com
Wed Jan 14 18:19:16 MSK 2015


Hello,
Just out of curiosity, has anyone managed to connect to MySQL via   Handlersocket ?
If yes, would appreciate tips.
 
Cheers,
Abdul Hakeem
 
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of David Villasmil Govea
Sent: Wednesday, January 14, 2015 2:06 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Database query from dialplan
 
 
hello,
 
1- Can freeswitch.dbh be used directly as core dsn (without ODBC Like the DSN used at freeswitch startup). If yes would it support connection pooling? 
 
I believe you must use odbc. As someone said before, yes, it will use connection pooling.
 
2- Can freeswitch.dbh be used to connect to some different database (Then core database) in lua scripts?
 
Yes, you can connect to any db. In the case of MySQL it's like so:
 
/etc/odbc.ini
[freeswitch]
Driver              = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
SERVER                    = [SERVER-IP]
PORT              = 3306
DATABASE  = [DATABASE]
OPTION                     = 67108864
USER              = [USER]
PASSWORD  = [PASSWORD]
 
 
[my_other_db]
Driver              = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
SERVER                    = [SERVER-IP]
PORT              = 3306
DATABASE  = [DATABASE]
OPTION                     = 67108864
USER              = [USER]
PASSWORD  = [PASSWORD]
 
/etc/odbcinst.ini
[MySQL]
Description      = MySQL driver
Driver              = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup               = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
UsageCount    = 1
FileUsage       = 1
Threading       = 0
 
 
 
function dbConnect()
            conn = freeswitch.Dbh("odbc://my_other_db:user:passw");
            assert(conn:connected())
end
 
 
 
On Wed, Jan 14, 2015 at 8:24 AM, John Nash <john.nash778 at gmail.com> wrote:
Thank you.
I have compiled freeswitch with postgresql core as per https://freeswitch.org/confluence/display/FREESWITCH/PostgreSQL+in+the+core
I read many documentation pages but am still confused on few points...
1- Can freeswitch.dbh be used directly as core dsn (without ODBC Like the DSN used at freeswitch startup). If yes would it support connection pooling? 
2- Can freeswitch.dbh be used to connect to some different database (Then core database) in lua scripts?





 
 
On Wed, Jan 14, 2015 at 2:06 AM, Bote Man <bote_radio at botecomm.com> wrote:
Surely you mean the Confluence pages at
https://freeswitch.org/confluence/display/FREESWITCH/Lua+freeswitch+dbh
 
https://freeswitch.org/confluence/display/FREESWITCH/Databases (formerly DSN)
 
That nasty old wiki is deprecated, I don't know why people are still linking to it.
 
Bote
 
 
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Steven Ayre
Sent: Tuesday, 13 January, 2015 09:19
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Database query from dialplan
 
Use freeswitch.Dbh (https://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh)
 
It's stable and uses FreeSWITCH's connection pools.
 
It supports any FreeSWITCH DSNs - so sqlite, ODBC or postgresql native driver.
https://wiki.freeswitch.org/wiki/DSN
 
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

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
 

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

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



 
-- 
DVG

-- 
Imagination is more important than knowledge
Albert Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150114/690895a9/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list