[OpenSIPS-Users] is_contact_registered - not working as expected
Bogdan-Andrei Iancu
bogdan at opensips.org
Fri Aug 23 04:34:11 EDT 2019
Hi Peter,
Indeed, that's a good point - the `fix_nated_contact()` is changing the
contact (with the IP and port from the network level), messing up the
matching.
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
OpenSIPS Summit 2019
https://www.opensips.org/events/Summit-2019Amsterdam/
On 8/22/19 10:16 PM, Peter Pulham wrote:
> Hi,
>
> A bit more testing and I realised that if I xlog the contact $ct it
> printed the value of the contact in the INVITE:
>
> <sip:5001 at y.y.y.y:49710;ob>
>
> Which looked fine and matched the usrloc table. However, if I xlog
> $ct.field(uri) it printed a value with the public IP:
>
> sip:5001 at x.x.x.x:49710;ob
>
> So it looks like I need to do my checking before I do any NAT contact
> fixup.
>
> This also explains why non NAT'd contacts were working.
>
> Thanks for the help, set me on the right path to finally get to the issue.
>
> Many thanks
>
> On Thu, Aug 22, 2019 at 10:33 AM Bogdan-Andrei Iancu
> <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>
> In this case, the function will perform a string matching between
> the first valid contact URI from the message and the registered
> contacts (the `Contact` field). Again, it is a string matching
> over the entire SIP URI.
>
> So far, based on your logs, I would say they should match. Could
> you doublecheck again ?
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
> https://www.opensips-solutions.com
> OpenSIPS Summit 2019
> https://www.opensips.org/events/Summit-2019Amsterdam/
>
> On 8/22/19 12:07 PM, Peter Pulham wrote:
>> Hi,
>>
>> I am calling is_contact_registered("location")
>>
>> For the mi command, I used "mi ul_show_contact location
>> 5001 at domain.net <mailto:5001 at domain.net>" in opensips-cli
>>
>> Many thanks
>>
>> On Thu, Aug 22, 2019 at 10:00 AM Bogdan-Andrei Iancu
>> <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>
>> Hi Peter,
>>
>> How exactly do you invoke the is_contact_registered()
>> function (as params) for your script?
>>
>> Regards,
>>
>> Bogdan-Andrei Iancu
>>
>> OpenSIPS Founder and Developer
>> https://www.opensips-solutions.com
>> OpenSIPS Summit 2019
>> https://www.opensips.org/events/Summit-2019Amsterdam/
>>
>> On 8/21/19 10:34 PM, Peter Pulham wrote:
>>> Hi,
>>>
>>> Thanks for the input.
>>>
>>> Adding the logging of $ct before call is_contact_registered
>>> show this (also added a log for when it returned false):
>>>
>>> Aug 21 19:24:52 ip-10-100-100-62
>>> /usr/local/sbin/opensips[21114]: CONTACT OF REGISTER: "Peter
>>> Pulham" <sip:5001 at y.y.y.y:49710;ob>
>>> Aug 21 19:24:52 ip-10-100-100-62
>>> /usr/local/sbin/opensips[21114]: IS CONTACT REGISTERED
>>> RETURNED FALSE
>>>
>>> The contact from the ul_show_contact command shows the same
>>> contact:
>>>
>>> {
>>> "AOR": "5001 at domain.net <mailto:5001 at domain.net>",
>>> "Contacts": [
>>> {
>>> "Contact": "sip:5001 at y.y.y.y:49710;ob",
>>> "ContactID": "1491535901589791905",
>>> "Expires": 18,
>>> "Q": "",
>>> "Callid": "8..5AzWHdLmUQNXHdQhwDR3qMwOGPaWH",
>>> "Cseq": 56286,
>>> "User-agent": "Telephone 1.4",
>>> "Received": "sip:x.x.x.x:49710",
>>> "State": "CS_NEW",
>>> "Flags": 0,
>>> "Cflags": "NAT",
>>> "Socket": "udp:z.z.z.z:5060",
>>> "Methods": 8063
>>> }
>>> ]
>>> }
>>>
>>> y.y.y.y is the same in the log as the mi output.
>>>
>>> Through testing, I have realised that if the contact is not
>>> NAT'd then the is_contact_registered returns true.
>>>
>>> Any input appreciated.
>>>
>>> On Wed, Aug 21, 2019 at 11:56 AM Bogdan-Andrei Iancu
>>> <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>>
>>> Hi Peter,
>>>
>>> To doublecheck, do this:
>>>
>>> * before calling the is_contact_registered(), use xlog()
>>> to print the contact you are testing (use $ct).
>>>
>>> * before running the test, use the ul_show_contact MI
>>> function [1] to print the in-memory contacts for the
>>> desired AOR.
>>>
>>>
>>> [1]
>>> https://opensips.org/html/docs/modules/2.4.x/usrloc.html#mi_ul_show_contact
>>>
>>> Regards,
>>>
>>> Bogdan-Andrei Iancu
>>>
>>> OpenSIPS Founder and Developer
>>> https://www.opensips-solutions.com
>>> OpenSIPS Summit 2019
>>> https://www.opensips.org/events/Summit-2019Amsterdam/
>>>
>>> On 08/16/2019 06:38 PM, Peter Pulham wrote:
>>>> Hi,
>>>>
>>>> I am using mid_registrar to save registrations to the
>>>> location table.
>>>>
>>>> If I use is_registered - everything works as expected.
>>>> So AOR matching is working.
>>>>
>>>> However, when I use is_contact_registered - it returns
>>>> false.
>>>>
>>>> I have checked the contact header in the request
>>>> against the contact value of the AOR in the db and they
>>>> match (the request has a display name but I am
>>>> presuming only the uri is checked.
>>>>
>>>> The endpoint is behind NAT, but the contacts match in
>>>> the db and request. Can some explain what is actually
>>>> checked when using is_contact_registered?
>>>>
>>>> Many thanks
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org <mailto: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/20190823/960b0622/attachment.html>
More information about the Users
mailing list