[sr-dev] Registrar - check for local path

Olle E. Johansson oej at edvina.net
Mon Dec 8 16:09:12 CET 2014


On 08 Dec 2014, at 16:00, Charles Chance <charles.chance at sipcentric.com> wrote:

> Hi Olle,
> 
> msg_apply_changes() is for getting the Path saved the first place if adding/saving on the same instance.
> 
> My patch is for later on, to avoid looping if lookup is performed on the same instance that received the register.
> 
> Scenario is 2 x registrar/location servers, both sharing common DB - no separate edge proxies, but each adds itself as Path before saving (which is where msg_apply_changes() comes in).
Can't you sort that out in the routing script? I don't see why we need to add this in the code... 

If the topmost, leftmost routing header in the outbound INVITE points to me, remove it and move on.
You have the branch route for that kind of manipulation.

What am I missing?
/O
> 
> Cheers,
> Charles
> 
> 
> On 8 December 2014 at 14:46, Olle E. Johansson <oej at edvina.net> wrote:
> 
> On 08 Dec 2014, at 15:42, Charles Chance <charles.chance at sipcentric.com> wrote:
> 
>> Hi All,
>> 
>> Can anyone see a problem with doing (something like) the following, to handle the situation like http://lists.sip-router.org/pipermail/sr-users/2014-October/085251.html?
>> 
>> Admittedly, it is probably a less common use case, but it has been raised several times on the list so I believe it is a genuine one.
> Did you try Daniel's advice?
> 
> "See msg_apply_changes() from textopsx to get the path header visible."
> 
> Did that not work?
> 
> /O
> 
>> 
>> 
>> diff --git a/modules/registrar/lookup.c b/modules/registrar/lookup.c
>> index 794d968..66730b4 100644
>> --- a/modules/registrar/lookup.c
>> +++ b/modules/registrar/lookup.c
>> @@ -41,6 +41,7 @@
>>  #include "../../action.h"
>>  #include "../../mod_fix.h"
>>  #include "../../parser/parse_rr.h"
>> +#include "../../forward.h"
>>  #include "../usrloc/usrloc.h"
>>  #include "common.h"
>>  #include "regtime.h"
>> @@ -121,6 +122,7 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)
>>         sr_xavp_t *list=NULL;
>>         str xname = {"ruid", 4};
>>         sr_xval_t xval;
>> +       sip_uri_t path_uri;
>>  
>>         ret = -1;
>>  
>> @@ -265,6 +267,14 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode)
>>                                 ret = -3;
>>                                 goto done;
>>                         }
>> +                       if (parse_uri(path_dst.s, path_dst.len, &path_uri) < 0){
>> +                               LM_ERR("failed to parse the Path URI\n");
>> +                               ret = -3;
>> +                               goto done;
>> +                       }
>> +               }
>> +               /* Only use path-uri if non-local */
>> +               if (path_uri.host.s && !check_self(&(path_uri.host), 0, 0)) {
>>                         if (set_path_vector(_m, &ptr->path) < 0) {
>>                                 LM_ERR("failed to set path vector\n");
>>                                 ret = -3;
>> 
>> 
>> 
>> The above needs to be repeated in lookup_branches function of same file, but I wanted to check others' opinions first.
>> 
>> Best regards,
>> 
>> Charles
>> 
>> 
>> www.sipcentric.com
>> 
>> Follow us on twitter @sipcentric
>> 
>> Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB._______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> 
> 
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> 
> 
> 
> 
> -- 
> Charles Chance
> Managing Director
> 
> t. 0121 285 4400    m. 07932 063 891
> 
> www.sipcentric.com
> 
> Follow us on twitter @sipcentric
> 
> Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB._______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20141208/28290287/attachment.html>


More information about the sr-dev mailing list