Hi Alex,

On 7 February 2018 at 18:05, Alex Balashov <abalashov@evaristesys.com> wrote:

(1) Most of the endpoints in question are NAT'd, and I was using
fix_nated_register() and the "received AVP" for mitigation.

Although the "Received" address is replicated by DMQ, using Path to
discover the adjacent "last hop" registrar overwrites the destination
set and stops the 'received' parameter from being utilised. Moreover,
there is no way to intercept it before the lookup() overwrites $du with
Path instead of 'received'.

I would typically append the received IP/port to the Path header before saving:

    append_hf("Path: <sip:$Ri:$Rp;received=sip:$si:$sp;lr>\r\n");

The last-hop registrar (as defined in Path uri) can then do something like...

    $du = $(hdr(Route){param.value,received});

...before sending it on its way.

I recall that we also set path_use_received parameter, although from memory I couldn't say for sure if the above depended on it.

 
(2) When multiple Contact bindings are available for the same AOR, both
local and remote, it would be desirable to have an easy way of selecting
the most adjacent one (i.e. the local one, in preference to the ones
removed by one Path hop).

Is there a nonobvious easy way to accomplish this, or am I going to have
to switch from lookup() to reg_fetch_contacts() or walk the lookup()'d
branches and find the one I want?

I'm unsure about that one, I'm afraid, since we generally just append branches for all contacts in parallel (which lookup(), combined with the above, does very well).

There may be something that can be done with dmq_usrloc and q value, to ensure that local contacts have a higher priority - and then set append_branches parameter to 0 - but I am unaware of any existing way to accomplish it without, as you suggest, switching to reg_fetch_contacts().

Cheers,

Charles

Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB.