Hi list,
I'm playing around with avpops and custom schemas - but it doesn't work
the way I wanted - and expected.
I would like to lookup a customer in CDRTools billing_customers table.
For that purpose I've defined
modparam("avpops", "db_scheme",
"customers:table=billing_customers;username_col=subscriber;domain_col=domain;value_col=gateway;value_type=string")
For testing, let's say I have the following in the database:
id gateway domain subscriber
1
a-gate.net a-cust.net 10101010
2
b-gate.net b-cust.net 20202020
If I try
avp_db_load("$fu","$avp(s:gateway)/$customers");
xdbg(" Gateway: $avp(s:gateway)\n");
avpops will look up the gateway based on the subscriber/username_col
field only - it completely ignores the domain part. If I try explicitely
specifying
avp_db_load("$fu/uri","$avp(s:gateway)/$customers");
it still ignores the domain and use the subscriber only - but if I try
avp_db_load("$fu/domain","$avp(s:gateway)/$customers");
it _does_ lookup the gateway based on the domain-part.
What I want is an answer stating that there is _no_ gateway defined
for, say, "10101010(a)b-cust.net".net". Right now it returns "a-gate.net" as
the answer.
What am I missing?
Regards,
Lars
--
Lars Skjærlund
Skovengen 111
2980 Kokkedal
Denmark
Tel.: +45 70 25 88 10
http://www.skjaerlund.dk/lars