[Kamailio-Users] Question about registrar lookup() and branching.

Daniel-Constantin Mierla miconda at gmail.com
Wed Aug 6 07:47:05 CEST 2008


Hello Alex,

On 08/06/08 02:55, Alex Balashov wrote:
> Greetings,
>
> I've got a small problem with how registration lookups work.
>
> I have several concurrent registrations from one PBX that have multiple 
> contact URIs that they declare that aren't the same;  they contain the 
> DIDs to route a call to.  So, for instance, in Asterisk:
>
>    register => user:pass at registrar/DID1
>    register => user:pass at registrar/DID2
>
> Of course, lookup() doesn't care what those contacts actually are.  If 
> it sees multiple contacts for one username, t_relay() will simply create 
> branches for all of them and and ring them all.  I can't actually have 
> that happen.
>
> I'm looking for suggestions on how to handle this most elegantly.  The 
> two options I've got in mind are:
>
> 1. Stop using lookup() and do my own URI rewrites and branch forking (if 
> the contact URIs are identical) with attention to the contact.
>   
This is a bit more complex if you still want to use registrar to save 
location entries. Perhaps by using selects in the location table, you 
can achieve directly in the script.  or using a shell/perl script.

> 2. Use BRANCH-ROUTEs to arrest the call leg if it is going to an RURI 
> user part that does not match the user part of the contact URI, and... 
> drop() the branches?
>   

That is more elegant to be done in the configuration file.
> I also need to build in some other logic, such that for example if a 
> user has only one contact registered and it does not match the DID, or 
> none of the contacts match the DID, proceed as normal anyway.
>   
Here you get back in complexity. Perhaps if you play with $bR, 
transformations and script operations you will achieve that. As I 
understood it is about selecting the branches to be dropped. You can go 
through the addresses returned by $bR, test your conditions and 
accumulate what branches are to be dropped in AVP, checking again in 
branch route for actually dropping.

Just early morning opinion ...

Cheers,
Daniel

> Is it possible there is a better way?  Recommendations welcome.
>
> Cheers,
>
> -- Alex
>
>   

-- 
Daniel-Constantin Mierla
http://www.asipto.com





More information about the Users mailing list