[Freeswitch-users] Postgres support in Core

Iwada Eja iwada.bassey at gmail.com
Wed Jun 4 22:49:53 MSD 2014


 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 at 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 at 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 at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.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://wiki.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
>
>


-- 
Kind Regards
Iwada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140604/dfe92990/attachment.html 


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