Hi,
I am just getting started with openser (using openser-1.2.1) and have
run across a problem I cannot seem to solve. When using db_mode=2 for
the usrloc module, everything works fine. However, when db_mode is set
to 3, calls are not able to be made - it seems that lookup("location")
always fails. I see this in the log:
Jun 25 16:35:17 cobalt1 /usr/local/sbin/openser[10084]:
check_response(): Authorization is OK
Jun 25 16:35:17 cobalt1 /usr/local/sbin/openser[10084]:
check_username(): Digest username and URI username match
Jun 25 16:35:17 cobalt1 /usr/local/sbin/openser[10084]:
DEBUG:usrloc:db_load_urecord: aor not found in DB
Jun 25 16:35:17 cobalt1 /usr/local/sbin/openser[10084]: lookup(): '1002'
Not found in usrloc
Having checked the mysql query log, the query that was run is:
130 Query select
contact,expires,q,callid,cseq,flags,cflags,user_agent,received,path,sock
et,methods,
last_modified from location where username='1001'order by q
If I run this query myself at the mysql command prompt, I get exactly
one row returned:
+-----------------------------------------------------+-----------------
----+-------+-------------------------------+-------+-------+--------+--
----------------------------+----------+------+---------------------+---
------+---------------------+
| contact | expires
| q | callid | cseq | flags | cflags |
user_agent | received | path | socket |
methods | last_modified |
+-----------------------------------------------------+-----------------
----+-------+-------------------------------+-------+-------+--------+--
----------------------------+----------+------+---------------------+---
------+---------------------+
| sip:1001@192.168.0.25:5062;transport=udp;user=phone | 2007-06-25
17:34:59 | -1.00 | bd348eeee82e4349(a)192.168.0.25 | 20092 | 0 |
0 | Grandstream GXP2000 1.1.2.27 | NULL | NULL | udp:172.16.1.1:5060
| 8063 | 2007-06-25 16:34:59 |
+-----------------------------------------------------+-----------------
----+-------+-------------------------------+-------+-------+--------+--
----------------------------+----------+------+---------------------+---
------+---------------------+
1 row in set (0.00 sec)
Having followed through the code, in modules/usrloc/udomain.c (about
line 550), things seem to be going wrong for me in this bit of code:
if (ul_dbf.query(_c, keys, 0, vals, columns, (use_domain)?2:1,
13, order,
&res) < 0) {
LOG(L_ERR, "ERROR:usrloc:db_load_urecord: db_query
failed\n");
return 0;
}
if (RES_ROW_N(res) == 0) {
DBG("DEBUG:usrloc:db_load_urecord: aor not found in
DB\n");
ul_dbf.free_result(_c, res);
return 0;
}
I tried to find out why this is happening by attaching with gdb, but
when I try to view res or res->n, I get a message that variable res is
currently unavailable - I'm not sure if this is something to do with the
way I'm using gdb though. When I step through, RES_ROW_N(res) == 0 must
be true as it enters the code within the {} instead of skipping over it.
Could anyone point me in the right direction as to why this doesn't work
please?
Many thanks,
Graham Markall