I've been (trying) to play with OpenSIPS with the Postgres database. 
Unfortunately, I've come to an unhappy conclusion. osipconsole doesn't actually 
work with Postgres. However, opensipctl works fine.

The problem is the use of the double & single quote characters to enclose 
strings in SQL queries. osipconsole uses double quotes: e.g.

SELECT * FROM SUBSCRIBERS WHERE username = "1234";

Whereas opensipctl uses single quotes:

SELECT * FROM SUBSCRIBERS WHERE username = '1234';

For postgres, string values need to be enclosed in single quotes, not double 
quotes. Double quotes indicates a column name.

Look at the simple command below:

OpenSIPS$:add 1...@blah 1234
Used database is PostgreSQL
1234 blah
Entry could not be retrieved from tableERROR:  column "1234" does not exist

        Query results:
================================================

Retrieving user 1...@blah from dbaliases failedERROR:  column "1234" does not 
exist

        Query results:
================================================
Alias 1...@blah does not exist!
Introducing the new user 1...@blah to subscriber table failedERROR:  column 
"1234" does not exist


Doing the same with opensipctl:

vm3:~ # /usr/local/sbin/opensipsctl add 2...@blah 1234
pgsql_query: /usr/bin/psql  -A -q -t -P fieldsep='      ' -h localhost -U 
opensips opensips -c 'insert into subscriber (username,                         
      domain,ha1,ha1b,password)                       values 
('2345','blah','6bc52aec50b4af97f338b0d406234afa','5cb004acd453ef4e8548dfb19ab23ae4','1234');'
new user '2...@blah' added


I manually changed a couple of SQL queries in osipconsole to prove this 
hypotheses, and with the quote characters changes, osipconsole works fine.

I've logged this as a bug in the tracker (ID 2815413)

GTG
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to