PGSQL command

Hi,

I want to know where i can get PGSQL app?
Because I can’t find it on standard release 1.4 nor in google.

postgresql.org

pgsql is not asterisk related. It is the command line tool for PostgreSQL

I know that.

But I’am looking for asterisk application called PGSQL which let me connect to SQL database in dialplan. In 1.4 release I can only see MYSQL app but there is no app called PGSQL.

Look into using ODBC. You can connect to any ODBC compliant data source using it. res_odbc.conf and func_odbc.conf

But that don’t give me a chance to select records and use them in dial plan or insert into another table information for example for CRM application.

I’m already using ODBC but it’s for dynamic config not for use with dial plan. I don’t know a way using ODBC in dial plan.

Look at func_odbc.conf. You can read/write from a database. I’m using it to read/write to a MySQL database currently but could just as easily use PostgreSQL. The asterisk book “The Future of Telephony” has a decent example using it in its Hot-Desking example.

Can you give me a link to that e-book or paste me a short example od func_odbc.conf and it’s use in extensions.conf?

downloads.oreilly.com/books/9780596510480.pdf

This is taken out of a dialplan I have. ${i} is a loop count which I’m using to loop through multiple results. ${ID} is some ID for which I am doing a lookup on. I changed the variable names and

exten => s,n,Set(ARRAY(TMP_ID,TMP_START,TMP_ABVR)=${CLIENT_GET_EVENTS(${ID},${i})})

func_odbc.conf has this
[GET_EVENTS]
prefix=CLIENT
dsn=asterisk
read=select id, start, abvr from some_table where some_field = ${ARG1} order by start, id limit ${ARG2},1

It sound pretty easy.

Like normal function definition. Thanks for help.