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

Jeff Pyle jeff at ugnd.org
Wed Oct 7 21:42:10 EST 2020

Interesting!  I'm now storing $ct.fields(uri) before fix_nated_contact()
and it's working better, but it's revealed a new problem.

The registered contact of a user is
"sip:+12162454107 at;rinstance=946433DE".
When I place a call from that user, its INVITE's Contact is "
sip:+12162454107 at".  is_contact_registered() fails.  Is
that caused by the lack of the rinstance param, or something else?

- Jeff

On Wed, Oct 7, 2020 at 3:11 PM Liviu Chircu <liviu at opensips.org> wrote:

> On 07.10.2020 21:15, Jeff Pyle wrote:
> At call time:
>   $ct = <sip:+12162450000 at>
>   $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 Chircuwww.twitter.com/liviuchircu | www.opensips-solutions.com
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201007/84f10602/attachment.html>

More information about the Users mailing list