Hello,
On 3/13/12 5:05 PM, Simpson Chua wrote:
Hi,
I'm trying to use avp_db_load to check for some IPs but I'm getting
bad avp flags errors. As far as I understand, the syntax is correct.
TableName: labservers
uuid username domain attribute value type
"" "" "domain1" "lab1"
"192.168.55.1" 0
"" "" "domain1" "lab1"
"192.168.55.2" 0
"" "" "domain2" "lab2"
"192.168.55.3" 0
"" "" "domain2" "lab2"
"192.168.55.4" 0
if ((avp_db_load("$ruri/domain","s:lab1/labservers") &&
avp_check("s:lab1", "eq/$Ri/gi"))) {
# Do something
}
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: DEBUG: <core>
[rvalue.c:2857]: RV fixing type 3
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: DEBUG: <core>
[rvalue.c:2857]: RV fixing type 2
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: DEBUG: <core>
[rvalue.c:2865]: RV is str: "REGISTER"
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: DEBUG: <core>
[route.c:506]: right EXP optimized: op10(O51, _ST22_) => op10(O51, _ST1_)
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: DEBUG: <core>
[rvalue.c:2857]: RV fixing type 4
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: DEBUG: <core>
[route.c:929]: fixing avp_db_load()
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: ERROR: avpops
[avpops_parse.c:129]: error - bad avp flags
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: ERROR: avpops
[avpops.c:299]: parse failed
Mar 13 10:55:24 ubuntu /usr/local/sbin/kamailio[12012]: ERROR: <core>
[route.c:1216]: fixing failed (code=-1) at
cfg:/usr/local/etc/kamailio//kamailio.cfg:71
Line 71 is the "if" statement above. Could someone see could be the issue?
first problem is that you use a very old avp name syntax for
avp_db_load() -- for many version the avp names have to be provided as
full avp specs. So instead of "s:lab1" you have to use $avp(s:lab1) (you
can even omit the 's:' if you run 3.x.
Try with these changes and if you get other errors, paste the messages
back to an email to the list.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/