<div dir="ltr">Hi Iwada, <div><br></div><div>in switch.conf.xml I have:</div><div><br></div><div><div> <param name="core-db-dsn" value="pgsql://dbname=freeswitch user=freeswitch options='-c client_min_messages=NOTICE' application_name='freeswitch'" /></div>
</div><div><br></div><div>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):</div>
<div><br></div><div><div> -- connect to db using freeswitch core</div><div> local dbh = freeswitch.Dbh("pgsql://dbname=reverselookup user=freeswitch options='-c client_min_messages=NOTICE' application_name='freeswitch'")</div>
<div> assert(dbh:connected())</div><div><br></div><div> local name</div><div><br></div><div> dbh:query("SELECT displayname, company FROM names WHERE number='" .. cidnum_e164 .. "'", function(row)</div>
<div> --name = row.displayname .. " (" .. row.company .. ")"</div><div> name = row.displayname</div><div> return 1</div><div> end)</div></div><div><br>
</div><div><div> if name == nil then</div><div> freeswitch.consoleLog("info", "reverselookup.lua: No match found for " .. cidnum .. " (" .. cidnum_e164 .. ")\n")</div>
<div> name = cidnum</div><div> end</div></div><div><br></div><div>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.</div>
<div><br></div><div>best regards, </div><div><br></div><div>markus</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 4, 2014 at 12:38 PM, Iwada Eja <span dir="ltr"><<a href="mailto:iwada.bassey@gmail.com" target="_blank">iwada.bassey@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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. </div>
<div><br></div><div>Thank You</div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><br>
</font></span></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><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>
<br></blockquote></div><br></div>