Thanks Markus, I understand better now and my Issue has been Solved! On Wed, Jun 4, 2014 at 3:02 PM, Markus Lindenberg < markus.lindenberg@gmail.com> wrote:
Hi Iwada,
in switch.conf.xml I have:
<param name="core-db-dsn" value="pgsql://dbname=freeswitch user=freeswitch options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
I also use freeswitch's Dbh to connect to different databases in postgres. This is a code snippet from a reverse lookup script which looks up callerids in a postgresql table. Note that I connect to a different database than the core here ("freeswitch" in the core vs. "reverselookup" in this lua script):
-- connect to db using freeswitch core local dbh = freeswitch.Dbh("pgsql://dbname=reverselookup user=freeswitch options='-c client_min_messages=NOTICE' application_name='freeswitch'") assert(dbh:connected())
local name
dbh:query("SELECT displayname, company FROM names WHERE number='" .. cidnum_e164 .. "'", function(row) --name = row.displayname .. " (" .. row.company .. ")" name = row.displayname return 1 end)
if name == nil then freeswitch.consoleLog("info", "reverselookup.lua: No match found for " .. cidnum .. " (" .. cidnum_e164 .. ")\n") name = cidnum end
I don't use passwords here because freeswitch and postgresql run on the same machine and can use psql's ident authentication. you have to have a user/role in postgresql for the uid that is running freeswitch.
best regards,
markus
On Wed, Jun 4, 2014 at 12:38 PM, Iwada Eja <iwada.bassey@gmail.com> wrote:
Please how do i use Postgre in Freeswitch Core. I've been reading the wonderful Freeswitch 1.2 Book. Examples there on connecting to a database. It uses LauScript for the database example - loading luasql.postgres. It's my thought that since Postgres is now in the core, the example might not be a best practice again. I ./configure --enable-core-pgsql-support to enable Postgres Support and edited my switch.conf.xml. I've also seen a couple of freeswitch.Dbh examples but non with Postgre Core. Please can someone point me to the right Docs or offer some directions.
Thank You
--
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@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@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Kind Regards Iwada