[OpenSIPS-Users] can't get is_contact_registered() to return true

Liviu Chircu liviu at opensips.org
Wed Oct 7 19:10:25 EST 2020


On 07.10.2020 21:15, Jeff Pyle wrote:
> At call time:
>
>   $ct = <sip:+12162450000 at 192.168.0.91 
> <mailto:sip%3A%2B12162450000 at 192.168.0.91>>
>   $ct.fields(uri) = sip:+12162450000@[PUBLIC_IP]:8490
>
> Am I expecting the wrong thing?

Absolutely not.  You actually discovered an interesting, wacky effect of 
fix_nated_contact(), which does an in-place replacement of the private 
Contact with the public IP that has sourced the INVITE.  However, the 
original header pointers and data still stay unchanged (!!), hence why 
each variable now returns different pieces of data...

To mitigate this effect, just make a backup of that $ct.fields(uri) 
value earlier in the INVITE processing, before calling fix_nated_contact().

>
> The only difference between $ct and the registered Contact is that $ct 
> is wrapped in <>.  I wrote a nasty regex to strip the <> characters 
> and it works with is_contact_registered(), at least from this phone.
>
Probably $(ct{nameaddr.uri}) would have gotten the job done as well, 
however I'm not so sure it's equipped to ignore Contact header field 
parameters -- which makes the regexp-based approach more solid.

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201007/d4ccd06b/attachment.html>


More information about the Users mailing list