Hi Lars,
Have you set the use_domain module parameter? http://www.openser.org/docs/modules/1.3.x/avpops.html#AEN117
Regards, Bogdan
Lars Skjærlund wrote:
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@b-cust.net". Right now it returns "a-gate.net" as the answer.
What am I missing?
Regards, Lars