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:[email protected]:4135;rinstance=946433DE". When I place a call from that user, its INVITE's Contact is " sip:[email protected]:4135". 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 <[email protected]> wrote: > On 07.10.2020 21:15, Jeff Pyle wrote: > > At call time: > > $ct = <sip:[email protected]> > $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 > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users >
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
