Trouble registering. Endpoint exceeds max_contacts

So how do I unregister the extension when it reaches the maximum?

Assuming the status of [FREEPBX-16216] PJSIP "remove_existing" endpoint option can not be set in GUI - Sangoma Issue Tracker is correct, you will need to add custom lines to the type=aor section, to set remove_existing to yes.,

Where is that setting. Sorry

The issue says it isn’t accessible through the GUI. The Asterisk documentation for it is:asterisk/pjsip.conf.sample at master · asterisk/asterisk · GitHub

The general way of customising the configuration is given in Best way to add missing GUI configuration options to PJSIP endpoint - #2 by billsimon although I think a slightly different file is needed for an AOR, and I would suggest adding type=aor, after the +.

You might also want to set the max contacts to 1, which I think can be done from the GUI, and just might default to remove existing.

This renders the extension unreachable

The rtp_timeout options were the options that the author of the other post wanted to set; they are not the ones you want to set.

type=aor, as I said, is something that should go after the “+”, not in the body of the settings. Basically the [302] selects the section, the “+” means you are appending to section, and the type would indicate that you were appending to the one of that name that already contained that type setting.

As I said, I suspect that is the wrong file for an aor. If I understand the naming conventions, used by FreePBX, I would expect the file to be called pjsip_aor_custom_post.conf, but I’m really an Asterisk person, not a FreePBX one.

As it says in a more general answer to the question of dealing with options missing from the GUI (Change PJSIP settings - #4 by lgaetz), you need to change the appropriate file. I didn’t use that example because the example I used was more concrete, but it still has to be treated as an example of general principles, not something to be copied blindly. The other option listed there has already been used, as there is an issue requesting the addition of the option.

All very confusing.

I would fix this on the softphone.

The “unregister before new registration” setting would probably help (image stolen from support section):

Try toggling that setting. I don’t use this software so I don’t know. I’m just trying to help you avoid editing custom files on FreePBX.

1 Like

So your saying it should be set to “Do not unregister”?

And, what about on the Yealink?

No, I’m saying try some alternate settings on the softphone until it works properly. If you can’t figure out GSWave then use Sangoma Connect which handles the provisioning for you.


And remove the type parameter she value below that


Like that?

Yes .

I wrote a patch for asterisk called remove_unavailable that will solve this problem more elegantly than remove_existing, if you are using the newer versions of asterisk (I think 16.21 and 18.5).

IMHO it should be the FreePBX default setting to have remove_unavailable enabled. The use case for having unavailable contacts persisting to the point that they block new registrations is very limited, and out of scope for most FreePBX users.

Has this patch been accepted?

This link is the patch for 16
This link is the patch for 18.

Merged and accepted into 16, 18, 19 and master. Check the changelog for the actual release that this showed up. I think for 16 is was 16.22, and for 18 is was 18.8 (correcting what I said before)

I’m running 18.11.0

So replace remove_existing in your instructions above with remove_unavailable.


What’s a good way to test this?