I'm trying to convert my SER 0.9.x config file to a 0.10.x file. I need some help converting AVPs. I use to use rules such as " if (avp_db_load("$ruri/username", "s:callfwdall"))..." however this now generates a syntax error. Is there a how-to which describes how to convert these types of statements to the new format?
Thanks,steve
Senior Network Engineer, Information Systems and Computing Networking and Telecommunications , Suite 221A /6228 University of Pennsylvania Voice:215-573-8396 FAX:215-898-9348
Steven C. Blair wrote:
I'm trying to convert my SER 0.9.x config file to a 0.10.x file. I need some help converting AVPs. I use to use rules such as " if (avp_db_load("$ruri/username", "s:callfwdall"))..." however this now generates a syntax error.
First, be aware that the database schema has changed. You will probably have to convert your database for the new version.
Assuming your avp_db_load() thing up there does what I think it does, then this all works a bit differently now. Essentially, you now follow the following "checklist"
1) Find the caller domain
lookup_domain("$fd", "@from.uri.host");
This checks if the domain name stored in the hostport of the From URI is a known from the database table domain.
If so, this returns true and puts the domain ID into the attribute $fd.did.
2) Find the callee domain
lookup_domain("$td", "@ruri.host");
Same game, except that the hostport of the Request-URI is checked. The domain ID ends up in $td.did.
With this information you do some routing decisions, like do I have to do authentication?
If you know the caller domain, you do
3) Load the caller
lookup_user("$fu.uid", "@from");
This checks the database table uri if the From URI is assigned to a certain user ID. Returns true if so and stores the user ID in $fu.uid.
If you know the callee domain, you do the same again
4) Load callee
lookup_user("$tu.uid", "@ruri");
Note that things are a bit different for REGISTER and note also that {proxy_,www_}authenticate also set $fu.uri if they successfully authenticate the user.
Now you can finally load the attributes for your users. Assuming you know them both, that makes:
5) Load attributes (I am too lazy to make lots of sub-section here, so this is all in one):
load_attrs("$fu", "$fu.uid"); # from user load_attrs("$tu", "$tu.uid"); # to user load_attrs("$fr", "@from.uri"); # from uri load_attrs("$tr", "@ruri"); # to uri
Now you have everything from the database and can start checking stuff. Your "s:callfwdall" from above was for the to user, so you check:#
if ($tu.callfwdall) { ; }
You can forget about the i: and s: prefixes. They don't exist anymore.
HTH and best regards, Martin