Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-30 Thread John Quick
Liviu,

Unfortunately, the scenario you hypothesise does not match. We have not yet 
commissioned the Push Notification mechanism.
Furthermore, I can see the registrations from the WebRTC device in a log file 
and they are well spaced apart - minimum 40 secs, up to a few minutes.
In the most recent tests, I removed the modparam line that set 
"pn_skip_pn_interval".

I have tried a lot of variations and tinkered with several modparam settings, 
but mid_registrar_lookup() always returns 1. Just once I managed to get a 
return value of 2.

I will send you the DEBUG log output which looks quite different in the one 
example where lookup returned 2. Perhaps it will provide a vital clue.

John Quick
Smartvox Limited



-Original Message-
From: Liviu Chircu  
Sent: 30 July 2021 12:23
To: john.qu...@smartvox.co.uk; 'OpenSIPS users mailling list' 

Subject: Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

On 30.07.2021 14:16, John Quick wrote:
> The next time I made a test call, it reverted to the previous behaviour and 
> lookup returns 1 again.
> So I have just once seen it return 2, but I don't know what was different.

Most likely, it's because of that "pn_skip_pn_interval" you enabled, since it 
looks like the device is re-registering quite often and resetting the 6s 
interval.  Try setting it to 0 and things should stabilize.  In time, you will 
tell if you really need to re-enable it or not.

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2021 Distributed | www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-30 Thread Liviu Chircu

On 30.07.2021 14:16, John Quick wrote:

The next time I made a test call, it reverted to the previous behaviour and 
lookup returns 1 again.
So I have just once seen it return 2, but I don't know what was different.


Most likely, it's because of that "pn_skip_pn_interval" you enabled, 
since it looks like the device is re-registering quite often and 
resetting the 6s interval.  Try setting it to 0 and things should 
stabilize.  In time, you will tell if you really need to re-enable it or 
not.


--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2021 Distributed | www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-30 Thread Liviu Chircu

On 30.07.2021 13:59, John Quick wrote:

I found the problem: In the usrloc module I had "contact_refresh_timer" set to 
true. When I change it to false, lookup returns 2.
I had not understood the relationship between the two mechanisms - should I use 
either one or the other, not both?


Quite unexpected, indeed.  Disabling this setting would only have an 
effect if you've gone the entire way of setting up the 
E_UL_CONTACT_REFRESH route + the full Push Notification generation 
logic, per your PN provider.  But if that's in place in your 
opensips.cfg and PNs are properly getting triggered, assuming the WebRTC 
device registers with a small expiration interval (say 60 seconds), then 
PNs would be continuously generated for it, as I notice you have not 
customized the "pn_trigger_interval" [1], which defaults to raising an 
event with 120s prior to contact expiration.  Here's how it would work:


* 0s: contact registers for 60s, detected as PN-enabled
* 1s: refresh timer runs, sees contact has only 60s before expiry, 
raises E_UL_CONTACT_REFRESH (for a reg refresh)

* 1s: PN gets sent
* 2s: WebRTC device re-registers for 60s, detected as PN-enabled
* 3s: refresh timer runs, sees contact has only 60s before expiry, 
raises E_UL_CONTACT_REFRESH (for a reg refresh)

* 3s: PN gets sent
* ...

And because of your custom "pn_skip_pn_interval" [2] setting, the device 
temporarily does not need a PN on an incoming INVITE, since it's freshly 
registered (within the 6s window you configured).


Again: this is what I ASSUME to be happening, let me know if it 
resembles your setup.  As a recommendation, I would configure the WebRTC 
phone to use a LARGE expiration interval (1 week?  1 month?), so we can 
awake it at any time.



By the way, the Contact header is very large and exceeds the varchar(255) field in the 
DB. I've set the usrloc working mode preset to "single-instance-no-db" as a 
workaround.
I'm not sure if the WebRTC app being tested here is exceptional or if this 
could be a more widespread ongoing problem that other people will encounter.
Yes, you are right!  I had this extension at some point on the TODO list 
during development, but it slip between the cracks.  I will push a fix 
for this on 3.3, maybe even backport it to 3.2.


[1]: 
https://opensips.org/docs/modules/3.2.x/mid_registrar.html#param_pn_trigger_interval
[2]: 
https://opensips.org/docs/modules/3.2.x/mid_registrar.html#param_pn_skip_pn_interval


Best Regards,

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2021 Distributed | www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-30 Thread John Quick
Liviu,

Something else is going on here. The next time I made a test call, it reverted 
to the previous behaviour and lookup returns 1 again.
So I have just once seen it return 2, but I don't know what was different. I 
cannot get a repeatable result. Could the big Contact header be overwriting 
memory?

I will check back through the logs and packet captures to see if I can spot 
anything different there.

John Quick
Smartvox Limited


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-30 Thread John Quick
Liviu,

I found the problem: In the usrloc module I had "contact_refresh_timer" set to 
true. When I change it to false, lookup returns 2.
I had not understood the relationship between the two mechanisms - should I use 
either one or the other, not both?

By the way, the Contact header is very large and exceeds the varchar(255) field 
in the DB. I've set the usrloc working mode preset to "single-instance-no-db" 
as a workaround.
I'm not sure if the WebRTC app being tested here is exceptional or if this 
could be a more widespread ongoing problem that other people will encounter.

John Quick
Smartvox Limited


-Original Message-
From: Liviu Chircu  
Sent: 29 July 2021 18:22
To: john.qu...@smartvox.co.uk; 'OpenSIPS users mailling list' 

Subject: Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

On 29.07.2021 19:07, John Quick wrote:
> modparam("mid_registrar", "pn_skip_pn_interval", 6)

So all looks good except for this condition [1] which returns false, otherwise 
the lookup() result would immediately be 2.  Now, that condition will only 
return false if the contact had registered within the last 6 seconds, case in 
which your custom "pn_skip_pn_interval" 
kicks in, effectively skipping sending a PN to that device.

Have you automated this test scenario to the point where the INVITE always 
lands within 6 seconds of the registration, or does the problem happen even 
long after the WebRTC phone registers?

[1]: https://github.com/OpenSIPS/opensips/blob/master/lib/reg/lookup.c#L426

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com OpenSIPS Summit 2021 
Distributed | www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-29 Thread Liviu Chircu

On 29.07.2021 19:07, John Quick wrote:

modparam("mid_registrar", "pn_skip_pn_interval", 6)


So all looks good except for this condition [1] which returns false, 
otherwise the lookup() result would immediately be 2.  Now, that 
condition will only return false if the contact had registered within 
the last 6 seconds, case in which your custom "pn_skip_pn_interval" 
kicks in, effectively skipping sending a PN to that device.


Have you automated this test scenario to the point where the INVITE 
always lands within 6 seconds of the registration, or does the problem 
happen even long after the WebRTC phone registers?


[1]: https://github.com/OpenSIPS/opensips/blob/master/lib/reg/lookup.c#L426

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2021 Distributed | www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-29 Thread John Quick
Liviu,

Mid-registrar mode = 1

Here are all the modparam entries:
loadmodule "mid_registrar.so"
modparam("mid_registrar", "mode", 1)
modparam("mid_registrar", "contact_id_insertion", "ct-username")
modparam("mid_registrar", "outgoing_expires", 1800)
modparam("mid_registrar", "min_expires", 60)
modparam("mid_registrar", "default_expires", 1800)
modparam("mid_registrar", "max_expires", 3600)
modparam("mid_registrar", "tcp_persistent_flag", "TCP_PERSIST")
modparam("mid_registrar", "received_avp", "$avp(regrcvd)")
modparam("mid_registrar", "pn_enable", true)
modparam("mid_registrar", "pn_providers", "fcm")
modparam("mid_registrar", "pn_skip_pn_interval", 6)

John Quick
Smartvox Limited


-Original Message-
From: Liviu Chircu  
Sent: 29 July 2021 15:40
To: john.qu...@smartvox.co.uk; OpenSIPS users mailling list 

Subject: Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

Hi John,

On 28.07.2021 19:35, John Quick wrote:
> Using version 3.1.3. OpenSIPS is acting as a mid-registrar proxy.
Which mid-registrar mode are you using? (0, 1 or 2)
> One thought I had: Should mid_registrar_lookup() always return 2 for a 
> device that has Flags = 4?

If your SIP user only has a single, PN-enabled device registered, then
yes: I would expect it to always return 2.  So we may definitely be dealing 
with a bug here - my current idea is to attempt to reproduce it in a lab 
environment.

Best regards,

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com OpenSIPS Summit 2021 
Distributed | www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-29 Thread Liviu Chircu

Hi John,

On 28.07.2021 19:35, John Quick wrote:

Using version 3.1.3. OpenSIPS is acting as a mid-registrar proxy.

Which mid-registrar mode are you using? (0, 1 or 2)

One thought I had: Should mid_registrar_lookup() always return 2 for a
device that has Flags = 4?


If your SIP user only has a single, PN-enabled device registered, then 
yes: I would expect it to always return 2.  So we may definitely be 
dealing with a bug here - my current idea is to attempt to reproduce it 
in a lab environment.


Best regards,

--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS Summit 2021 Distributed | www.opensips.org/events


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Push Notification - lookup not returning 2

2021-07-28 Thread John Quick
Using version 3.1.3. OpenSIPS is acting as a mid-registrar proxy.
The WebRTC client app registers okay and I'm sure it is being detected as a
PN enabled device during registration because the value of Flags is 4
(viewed from the CLI using "mi ul_dump") and the Feature-Caps header is
added to the 200 OK when it registers.
However, when I make a call towards the WebRTC device and
mid_registrar_lookup() is called, I was expecting it to return 2, but it
does not. It returns 1.
There is only one device registered on this test server.

This is the code in my script where the lookup is done:
$log_level = 4;
mid_registrar_lookup("location","m");
$var(rc) = $retcode;
if ($var(rc) == 1) {
# Destination is a registered user and at least one contact is not
PN enabled
xlog("L_WARN", " [$var(sectname)] Standard User
$var(myuser)@$var(mydom) was found in location table  Src=$pr:$si:$sp
Call-ID=$ci\n");
} else if ($var(rc) == 2) {
# Destination is a registered user and all contacts are PN enabled
xlog("L_WARN", " [$var(sectname)] PN User
$var(myuser)@$var(mydom) was found in location table  Src=$pr:$si:$sp
Call-ID=$ci\n");

It always reports "Standard User" in my log file.

...and this is what I get in the debug log:
2021-07-28 17:16:35  DBG:registrar:parse_lookup_flags: final flags: 1
2021-07-28 17:16:35  DBG:mid_registrar:mid_reg_lookup: getting ucontact from
contact_id 286330420458939875
2021-07-28 17:16:35  DBG:mid_registrar:pn_remove_uri_params: trimmed URI:
'sip:xzxfze2l@ncuz14613i0n.invalid;transport=wss'
2021-07-28 17:16:35  DBG:registrar:push_branch: setting msg R-URI

2021-07-28 17:16:35  DBG:core:comp_scriptvar: int 20 : 1 / 1

One thought I had: Should mid_registrar_lookup() always return 2 for a
device that has Flags = 4? Or does it depend on whether the TCP network
connection to the device is still active?

John Quick
Smartvox Limited



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users