Hello,
I'm having problems with avpops module that looks to me
as a bug. I'm using Postgres as database backend.
Here's the table structure:
users=# \d usr_preferences
Table "ser.usr_preferences"
Column | Type | Modifiers
-----------+-----------------------------+----------------------------------------
uuid | character varying(64) | not null default ''::character varying
username | character varying(100) | not null default ''::character varying
domain | character varying(128) | not null default ''::character varying
attribute | character varying(32) | not null default ''::character varying
value | character varying(128) | not null default ''::character varying
type | integer | not null default 0
modified | timestamp without time zone | not null default now()
Indexes:
"usr_preferences_pkey" primary key, btree (attribute, username,
"domain")
As you can see all fields defined as NOT NULL and there can't
be any NULL values.
Here's what I do in ser.cfg:
# -- avpops params --
modparam("avpops", "avp_url",
"postgres://SERDB_USER:SERDB_PW@DBHOST/users")
modparam("avpops","avp_aliases","alias_p=I:100;alias_s=I:101")
modparam("avpops","avp_table","usr_preferences")
route {
if (!avp_db_load("$ruri","$alias_p/usr_preferences")) {
log(1,"avp not found");
} else {
avp_print();
}
sl_reply_error();
}
When I'm sending the following INVITE:
INVITE sip:12128121207@myserbox.com SIP/2.0
...
Here's the query that's sent to the database:
select value,attribute,type from usr_preferences
where username='12128121207' AND attribute='100'
Here's the result of the query in psql:
users=# select value,attribute,type from usr_preferences where
username='12128121207' AND attribute='100';
value | attribute | type
-------------------------------------+-----------+------
sip:12128121207@anotherbox.com | 100 | 2
(1 row)
As you can see there's no NULL values and everything looks correct so far.
But here's what I get in ser log:
0(12042) val2str(): converting 100, 3
0(12042) PG[217] str2valp got string sip:12128121207@anotherbox.com
0(12042) PG[217] str2valp got string 100
0(12042) PG[193] str2valp got int 2
0(12042) ERROR:avpops:dbrow2avp: dbrow contains NULL fields
I tried it with ser 0.9.0, cvs stable and cvs head all with the same result.
If this is not a bug, please point me to what I'm doing wrong.
Otherwise please consider it a bug report. I assume that this is PostgreSQL
support related as it seems people on the list were able to get it work
with MySQL.
Thank you,
Michael