I don't think your message is appropriate for serdev, so I removed it from
the recipient list.
See inline comments.
Charles Wang wrote:
Dear ALL:
I have defined these lines at my ser.cfg.
modparam("avpops", "avp_url",
"mysql://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "usr_preferences")
modparam("avpops", "uuid_column", "uuid")
modparam("avpops", "username_column", "username")
modparam("avpops", "domain_column", "domain")
modparam("avpops", "attribute_column", "attribute")
modparam("avpops", "value_column", "value")
modparam("avpops", "type_column", "type")
modparam("avpops", "avp_aliases",
"voicemail=i:500;calltype=i:700;fwd_no_answer_type=i:701;fwd_busy_type=i:702")
Q1: If I use usr_preferences as default table, should I insert some
initial data to it?
Can you give me some example?
Yes, you should. Let's say you want user a(a)b.com to have voicemail as an
option. Add:
username=a
domain=b.com
attribute=voicemail
value=y
type=0 (default string)
And I have refered to
http://www.voice-system.ro/docs/avpops
And find many examples in it.
But I still can't understand what it mean about avp_db_load().
avp_db_load() will load a certain value from your usr_preferences table.
avp_db_load("$ruri","s:voicemail");
will use to request uri (i.e. somebody is calling a(a)b.com) to lookup the
attribute voicemail. Instead of "$ruri", you can use "$ruri/username"
or
"$ruri/domain" and only the username or domain part of $ruri, respectively,
will be used to look up the attribute voicemail in the table.
avp_check("s:voicemail", "eq/y/i") can then be used to check if value
from
the usr_preferences table is "y".
my avp table is named as "usr_preferences"
and it is empty before I
use avpops modules.
For this web page said:
avp_db_load("$ruri/domain","i:/domain_preferences");
- loads all AVPs with ID from 'domain_preferences'
table for domain from RURI
Q2: Is "$ruri" the caller user's URI? and the "domain" is the
same?
Yes.
Is "domain_preferences" table name?
Yes, you can opt to select a different table. It is not necessary though.
Is it equal to my
"usr_preferences"? Or it is just a virtual table in memory?
No and
no.
avpops is a very powerful module with various ways of using tables, loading
av pairs and doing tests. Remember that avpairs are no more than pairs of
attribute names (either string names as above or integer values i:34) and
values (either string values or integer values). These avpairs must be
loaded from somewhere, using avp_db_load avp_radius_load, etc using $from or
$ruri for looking up the correct pair.
g-)