[Kamailio-Users] registrar module enhancements

Alex Balashov abalashov at evaristesys.com
Thu Oct 2 00:49:13 CEST 2008


Excellent enhancements!

Is there any hope to have a feature developed where the authentication 
user, password, and domain can be supplied directly to the 
save()/lookup() function via script instead of using either a database 
structure of a certain schema as a persistence layer or doing it purely 
in memory?

This is mainly desired when implementing a registrar that uses database 
persistence but obtains its information from an outside database that 
requires some sort of middleware or API to access and cannot be tailored 
to work with the schema requirements of auth_db/usrloc.

Daniel-Constantin Mierla wrote:

> Hello,
> 
> in the last time several enhancements were added to registrar module to 
> help in dealing with user location records. This correlated with the new 
> modue pv shall give lot of control over the destination set for calls.
> 
> To get the latest devel version, check out the latest svn -  svn co 
> https://openser.svn.sourceforge.net/svnroot/openser/trunk kamailio
> 
> The news in registrar module are:
> - ability to unregister all contacts for a SIP addres - there is a new 
> function: unregister(table, uri)
> - ability to store and maintain single contact per user - the save() 
> function accepts a new value for flags parameter (0x04) to restrict to 
> one single record in location table
> - ability to access the attributes of all contacts for a user - there 
> are two new functions: reg_fetch_contacts(table, uri, profile) and 
> reg_free_contacts(profile) to make available/release the contacts for a 
> SIP uri. After fetching the contacts, the attributes can be accessed via 
> pseudo variable $ulc(profile=>attr)
> 
> For more details see the README:
> http://www.kamailio.org/docs/modules/devel/registrar.html
> 
> Here are couple of use cases:
> 
> 1) only one contact per user
> 
> save("location", "0x04");
> 
> Note that if you have couple of phones registering for same user, the 
> one that sent last REGISTER message will be the only ringing.
> 
> 2) check if a user is calling from a registered device and if not, deny 
> the call
> 
> if(!reg_fetch_contacts("location", "$fu", "caller"))
> {
>    sl_send_reply("403", "Please register first");
>    exit;
> }
> $var(i) = 0;
> $var(found) = 0;
> $var(contact) = $(ct{nameaddr.uri});
> while($var(found) == 0 && $var(i) < $(ulc(caller=>count)))
> {
>    $if($var(contact)==$(ulc(caller=>addr)[$var(i)]))
>      $var(found) = 1;
>    else
>      $var(i) = $var(i) + 1;
> }
> if($var(found) == 0)
> {
>    sl_send_reply("403", "Please register first");
>    exit;
> }
> 
> Testing and feedback is very much appreciated.
> 
> For the future:
> - unregister() to get a $ulc(...) variable as parameter to unregister a specific contact
> - drop a branch via pv module
> 
> Cheers,
> Daniel
>  
> 


-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599




More information about the Users mailing list