Major issue with pjsip and mobile softphone breaking registration

asterisk 13.23.1
freepbx13.

I’m running into a major issue with pjsip. I believe the issue stems from the way in which mobile softphone apps (in my case, Bria mobile or Bria teams) re-register every time the cell phone is Locked and unlocked.

With the pjsip extension with contacts 0 configured, I have no issues when using just one device. However, if I add a softphone or ip phone, it becomes a random case which device rings. Increasing contacts is where the problem enters the scene in a major buggy way that completely breaks endpoint registration.

Once I set contacts to more than 1 so that I can register an ip phone, after locking the cell phone and waking it a few times I begin to get error 403. None of the phones are able to register any longer:

[2019-02-18 00:40:09] WARNING[26883]: res_pjsip_registrar.c:597 register_aor_core: Registration attempt from endpoint '102' to AOR '102' will exceed max contacts of 6
[2019-02-18 00:40:09] WARNING[26883]: res_pjsip_registrar.c:597 register_aor_core: Registration attempt from endpoint '102' to AOR '102' will exceed max contacts of 6
[2019-02-18 00:40:10] WARNING[26883]: res_pjsip_registrar.c:597 register_aor_core: Registration attempt from endpoint '102' to AOR '102' will exceed max contacts of 6
[2019-02-18 00:40:11] WARNING[26883]: res_pjsip_registrar.c:597 register_aor_core: Registration attempt from endpoint '102' to AOR '102' will exceed max contacts of 6
    -- Contact 102/sip:[email protected]:5060 is now Reachable.  RTT: 23.866 msec
    -- Contact 102/sip:[email protected]:60793;rinstance=1e2244c6aba4ffaf is now Unreachable.  RTT: 0.000 msec
    -- Contact 102/sip:[email protected]:64788;rinstance=d72d17d6ee5f5faf is now Unreachable.  RTT: 0.000 msec

I also tested setting rewrite contact = no. With this set, the mobile app will only ring when called if the app is in the forefront and the cellphone is not locked. I have also tested with push service disabled and enabled. Not sure what else I can do. The promise of being able to ring multiple endpoints with pjsip isn’t really that useful if it doesn’t work with mobile apps.

To clarify, when the mobile app breaks AOR, it also breaks all other endpoints using that extension.

Has anyone figured out how to get this to work?

First, I don’t find putting multiple devices on the same extension to be useful. I use Follow Me instead and set a small delay before failing over to mobile. Most of the time, the desk phone is promptly answered so the mobile doesn’t ring. When on a call, the system allows a second call to be answered by call waiting but is smart enough to not ring the mobile.

Next, I usually do failover to mobile as a voice call rather than using a VoIP app, because my location when a call comes in is unpredictable, and sometimes the data connection is inadequate for acceptable voice quality.

Failover to mobile VoIP is with Groundwire push notification, which is very reliable for me. Sorry, I’ve no experience with Bria.

If the log shown is via Wi-Fi, you could avoid the changing port numbers by setting a non standard local port on Bria and configuring the router/firewall to not randomize the source port. On mobile data, you have no control but using SIP over TCP or TLS should mitigate the problem.

Thanks @Stewart1, were you using pjsip or the older chansip protocol?

My production system is old and chan_sip only, but I’ve done considerable testing with pjsip, mostly Wi-Fi, with no trouble.

The mobile app is not “breaking the AOR”. If you look at your output of the contacts you’ll see the contacts have different ports. When your Bria is dropping off the network and getting back on the network and making a new REGISTER attempt the router is setting the WAN port to something different (you could also have a new LAN IP from coming back up on the network) so the system is going to see that as another contact and if it can, register it. Your old contact will eventually expire.

I would suggest modifying the Maximum and Minimum Expiration settings in the Advanced tab for this extension. The defaults are 7200 and 60 seconds respectively. So if you have Bria set to register every 120 seconds, set the max to that and see what happens.

I can understand that if all you’ve every really used is Asterisk and Chan_SIP. Multiple contacts per AOR is a common SIP feature that SIP stacks have had for at least the last decade or more. Some PBX/voice systems refer to this as “Simultaneous Ring”, “Twining” or “Shared Line”. All of which are highly used features by those with the ability to do it.

Chan_PJSIP is finally bringing Asterisk up to the same level as pretty much every other SIP driver out there. Hell, even with the right dialplan you could even get it to allow each contact to DND themselves and not be called as part of the contact list dialed for the endpoint.

With some even more love you could get the feature really going by being able to add your cell phone or a PSTN number as a contact for endpoint. Or do ordered dialing on the contacts. Even set it up so that each contact can be ordered and their own ring time and even continue to dial them while adding more contacts in each iteration. Pretty much another way to do a ring group really.

Like I said, PJSIP gives you the ability to do things other SIP drivers have been doing for years. Don’t let the FreePBX implementation of PJSIP shape your knowledge of it.

Now if Asterisk can implement improvements on domain support with PJSIP it would be pretty on par with everyone else and allow for clean “multi-domain” users so you could have [email protected] and [email protected]

Thanks @BlazeStudios I’ll try testing out lower timeouts and see what happens. Yes, as noted with the push service enabled (whether continuous, standard, or any other subsetting), the app unregisters when the software is either minimized or the phone is locked. This is supposed to save battery life, preferable to the end user, but it’s not working well with limited contacts for the reasons you noted.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.