[Serusers] ser 0.10.99 - call forwarding issue

Michal Matyska michal at iptel.org
Wed Jan 31 12:52:57 CET 2007

On Wed, 2007-01-31 at 12:32 +0100, tzieleniewski wrote:
> hi!
> I am trying to set up the call forwarding feature and I have some question bout the idea how to realize this.
> My Idea was to do it with the usage of avp's.
> First thing I do is the check if there is a call_forward parameter set in the database in user_attrs table.
> I do this by invoking load_attrs("$fu", "$f.uid");
> and then I do the check if ($tu.call_forward)

This will NOT work for sure as you load attributes for the caller
(FROM/USER based on the FROM uid attr) and then check the callees
preferences (TO/USER call_forward attribute).

It is not clear whether you have already $f.uid set (using either
lookup_user or authenticate function call).

> On the "what's new site" in the avps and selects article I found another method which performs similar task: lookup_user("$tu","@ruri")

lookup_user just creates AVP named uid with the value found in database.

If this call was successful (e.g. it is your known subscriber) you can
continue and call load_attrs which will load the user attributes.

should be used (for example):
if (!lookup_user("$tu","@ruri")) {
  t_reply("404", "Unknown user");

if (!load_attrs("$tu", "$t.uid")) {
  # might happen, that there are no attrs

if ($t.call_forward) {
  ... your code here

Check the ser.cfg from CVS, it is using this approach of handling

> What is the difference between those to methods?? Are they part of the SER core?

Pay attention to the caller/callee attributes (e.g. from/to track (the
letter before the dot in the avp name))

No, uri_db module.

> previously in ser 0.9.x I have it done by, first loading the avp by avp_db_load()
> and then in case of call forwarding by making avp_pushto("$ruri","something") or 
> rewriteuri() and then t_relay().  
> What is now a preferred way to realized similar functions. I mean can I utilize those methods like load_attrs or lookup_user() and then substitute the ruri without avp_pushto or rewriteuri??

Yes, it was intended to replace functions from the avp_db module.


More information about the sr-users mailing list