[Kamailio-Users] [Kamailio-Devel] registrar module enhancements

Klaus Darilion klaus.mailinglists at pernau.at
Wed Oct 1 19:41:02 CEST 2008


Hi Daniel!

I just wonder how the reg_fetch_contacts() deal with NATed clients. In 
this case the src_ip:port have to be compared with the "received" column.

regards
klaus

Daniel-Constantin Mierla schrieb:
> 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
>  
> 




More information about the Users mailing list