[sr-dev] domain attributes

Jan Janak jan at iptel.org
Thu Jul 2 14:34:45 CEST 2009


On 02-07 15:15, Juha Heinanen wrote:
> Jan Janak writes:
> 
>  > I think that this is a good idea and also something we have already done in
>  > the ser version of domain module. What about adopting the ser version of the
>  > domain module?
> 
> jan,
> 
> good if it is already done.
> 
> however, when i look at modules_s/domain/README, it only implements one
> function:
> 
> 1.4.1. is_from_local()

Unfortunately the module README hasn't been updated. The domain module also
exports function lookup_domain. This is the function which lookups a domain
name in the table and if it finds it, it will stored the did of that domain in
an AVP.

In etc/sip-router-oob.cfg it is used like this:

route[DOMAIN]
{
        # Check whether the caller is from a local domain.
        lookup_domain("$fd", "@from.uri.host");

        # Check whether the callee is at a local domain
        lookup_domain("$td", "@ruri.host");
}

The first call will store the did of the domain in $fd.did if it finds a
match. The second call will store the did in $td.did.

We then use those two AVPs to determine the type of the call, i.e. if there is
no $fd.did and no $fd.did then this is a relaying attempts, if there is only
$fd.did then this is an outbound call, etc...

> and exported params section does not mention domain_attrs table and
> domain table section does not correspond to what you write.
> 
> the question is, it is faster to implement the attr stuff in
> modules_k/domain module than to update modules_s/domain readme?

Well, if we adopt SER version then we only have to update the README. If you
want to implement your own version then you have to write the code *and*
update the README.

And given that we try to merge both implementations, it would be make IMHO
more sense to reuse the stuff that we already have available.

But the decision is yours, I can help update the documentation if you choose
the SER version. If you decide to implement your own version, please take our
implementation into account. I would like to merge such basic stuff as
multi-domain support in the future and it would be great if our stuff could be
transformed into your without too much hassle.

>  > The contents of domain_attrs is loaded into the memory by domain
>  > module. Domain attrs are always cached and they can be reloaded from the
>  > database with a rpc/mi command.
> 
> how can i get attributes of a domain loaded to avps?

They are loaded automatically at startup. If you want to reload them then
there is domain.reload RPC command available which can be triggered with
sercmd.

Internally, domain module maintains a set of attributes in shared memory for
each virtual domain. If the script calls lookup_domain and a match is found,
then the function, in addition to storing the did of the domain in an AVP,
also makes all the AVPs for that virtual domain available to the script.

So, domain attributes of the source domain (From) are available through the
preefix $fd, thus the digest_realm attribute will be available in the AVP with
the following name:

  $fd.digest_realm

Similarly, for the called virtual domain (Request-URI):

  $td.digest_realm

Domain attributes are read only, they cannot be modified from the script
because they are stored in shared memory. The only way how one can modify the
value of a domain attribute is to modify the attribute in the database and
then call domain.reload.

  Jan.




More information about the sr-dev mailing list