I am not using this module and I don't know what are supposed to be
the right default values for flags. But it should be like it was in
the past. If you used with an older version 3.x, apart of renaming,
nothing was touched in the code for 4.x.
Cheers,
Daniel
On 1/24/13 4:27 PM, Philippe Sultan
wrote:
Thank you Daniel, your answer helped a lot.
With :
#!KAMAILIO
loadmodule "pv.so"
$avp(fd.did)
Everything works fine, but only if I turn off caching with :
modparam("uid_domain", "db_mode", 0)
Otherwise, avps are not loaded from the db. Digging into
modules/uid_domain/domain.c, I figured out that the default flag
value 0 for records in the uid_domain table would make the
load_domains function skip the records, see (in load_domains) :
/* Skip entries that are disabled/scheduled for
removal */
if (flags & SRDB_DISABLED) goto skip;
/* Skip entries that are for serweb/ser-ctl only
*/
if (!(flags & SRDB_LOAD_SER)) goto skip;
Setting the flag value to 1 does make the load_domains function
work as expected, and load the records from the db.
Maybe the uid_domain-create.sql file under utils should be
modifed.
The sript compatibility
was set to kamailio strict mode, throwing error if $xy was
not a pv. You can fetch latest master and should work like
if no pv found as $xy, then is set as avp.
Even if with your version, adding #!SER as first line should
make it work with $fd.did...
Cheers,
Daniel
On 1/24/13 10:58 AM, Daniel-Constantin Mierla
wrote:
Hi Philippe,
On 1/23/13 11:54 PM, Philippe Sultan wrote:
Hey Daniel,
Thanks a lot for your help.
do you
have #!SER as first line? This part should be
the same ... if pv not found, then it should
be considered avp. I will try to see what is
the issue.
I don't have #!SER
it should not be needed for this case, if $xyz is not
found as pv, it is considered avp.
Anyhow,
for the moment, if not working, load pv and
then try:
- $fd and $td must stay as parameters for
lookup_domain()
- for strempty() try to use $avp(fd.did) and
$avp(td.did)
I loaded pv, and modified the script
accordingly. No syntax errors anymore, but avps
are not populated from the data stored in the
db. Maybe a problem with lookup_domain?
the modules_s/domain was only renamed to uid_domain to
avoid conflict with the other domain module. No other
recent changes to my knowledge. Can you try to put IF
around it and see if returns true or false? Can you
check the sql queries in the server to see if they are
returning something?
Cheers,
Daniel
Here's the excerpt of the script (I replaced the
selects with '@' by '$sel()', and added a
dump_attrs()) :
xlog("L_INFO", "from.uri.host :
$sel(from.uri.host)\n");
xlog("L_INFO", "ruri.host :
$sel(ruri.host)\n");
if (strempty($avp(fd.did)) &&
strempty($avp(td.did))) {
# Neither the calling nor the
called domain is local
# This is a relaying attempt
which should be forbidden
sl_reply("403", "Relaying
Forbidden");
drop;
}
In the db :
+----+----------------------+----------------------+-------+
| id | did |
domain | flags |
+----+----------------------+----------------------+-------+
| 1 | ext.test.r3load.voip |
ext.test.r3load.voip | 0 |
+----+----------------------+----------------------+-------+