Hi, why is the Max Contacts option in extensions not working properly ? the default value is 1, but many devices can connect to the same extension, and only one will be visible in the peers, but if you set the value to 2, then you can’t connect more than 2, i.e. works correctly, i want to limit to value at 1
PBX Version: 16.0.17
System Version: 12.7.8-2202-2.sng7
Asterisk Version: 16.24.0
That doesn’t sound right, we use that feature all the time on that same version of Asterisk (not the same version of FreePBX). Can post the result of pjsip show endpoint YOURENDPOINT that shows where the contacts are set to 1 and there is more than one contact registered?
There are options, at least in the raw Asterisk files, which control this, however replacing the the contact is normally considered desirable behaviour, as devices often fail to deregister before being moved, or being allocated a new dynamic address.
The two options starting at the highlighted line are most relevant:
then why if the value is 1, I can connect several devices to one extension, and if I change the parameter to 3, then all three devices will be displayed in the endpoints list, but the fourth and subsequent devices will have an incorrect password, why does this not work with 1 device?
Because that’s how this works in SIP. Max Contacts is how many REGISTERED contacts can happen at once. Your devices re-register every N seconds to begin with. If a new registration comes in and the Max is 1, it overwrites what is there.
I want to have one device for one extension, so that when registering to an already registered extension, it gives an error, it works if I set parameter 2, an error is generated for the third device trying to register for this extension, I need the SECOND device to give an error
Whilst I don’t know why there is as difference between 1 and 2, unless FreePBX changes the other settings, when there is more than one contact allowed, most people would want a new registration to take over. If you have more than one device with the same address of record, presumably you want to be able to register different devices at different time, but if you prevent the second registration, you will need to rely on the first device explicitly de-registering first.
let’s say I created 10 extensions and gave details to users, because of their stupidity they try to register with the same account, it turns out I don’t see their peer registration, I don’t see from which ip addresses to find these PCs
thus, I have the same internal number 100 on 6 PCs, while I see only 4 peers
this bug or my misunderstanding was in FreePBX 15 too
I assume that is because the first contact started ringing before the registration was changed.
Changing a registration won’t affect calls for which the initial INVITE has already been sent. The Asterisk implementation of Asterisk only calls one of the contacts, unless you explicitly pass multiple addresses, with explicit URIs, to Dial, e.g. ones from PJSIPDIALCONTACTS (which would only return one in this case).
@Vengeful_Blade you and @david55 are going back and forth a lot here but I think you may not be understanding a fundamental Asterisk/FreePBX concept.
First, let’s make an important distinction. Asterisk vs FreePBX. Asterisk is actual phone system handling all SIP functionality. FreePBX is an application built on top of Asterisk. It is FreePBX that builds the dialplan that makes Asterisk respond to calls the way it does but it can’t change the way Asterisk handles basic SIP functionality aside from changes settings that Asterisk exposes.
Going back to your first reply to me you said that when you have max contacts set to 1 and you run pjsip show endpoint 150 It properly shows Asterisk has recognizing the setting as being set to 1 and there is only 1 registered contact.
To the best of my knowledge this is the expected/default behavior for a FreePBX controlled Asterisk install. Regarding what happens if multiple phones are trying to register against an extension which has reached it’s max contacts (doesn’t matter what the value is). A new successful registration will cause Asterisk to replace the oldest registration with the new one. It will not fail. For example if you set the max contacts to 2 and have three phones trying to register none of them will get a failure they will simply fight over who the 2 are.
FreePBX does set remove_existing=yes on the PJSIP AOR’s it creates. If you wish to set it back to “no” you could do that in pjsip.aor_custom_post.conf using the Config Edit module in FreePBX. For example:
So now coming back to a phone with max contacts set to 1. Which ever phone attempted to register last is that phone (assuming you don’t make any config changes like mentioned above). However this doesn’t stop a dialplan from creating multiple channels (calls) to that one registration. In FreePBX this could happen for many reasons. It could be a simple as having Call Waiting enabled and two people trying to call this extension at once. Both calls would be sent to same phone, the one is listed as the only contact in pjsip show endpoint 150. You could have a single extension listed multiple time in a ringgroup or queue. You have have an extension in it’s own find-me follow-me list. In fact there are lots of ways involving FMFM. Any of those situations could cause multiple calls to go to a phone at once.
All the snippets you’ve posted point to what I’ve described as being what’s happening. There is no indication that there are actually multiple phones registered.
It is also easy to be confused about how many phones are registered because if you’re looking at physical phone and it was successfully registered but a few seconds ago another phone “stole” it’s registration the phone you’re looking at won’t know that right away so it still looks like it’s registered even though from the server’s perspective it’s not.
If you want to have 1 phone for 1 extension. The first thing you should do is ask yourself… Why are there multiple devices out there trying register as the same extension.
Second, if there is some reason that has to be the case (I can’t think of any legitimate reason that should ever be but perhaps there is) then you’ll need to make the custom changes mentioned earlier to alter the Asterisk behavior.
I admit that my English is not perfect but not to that extent. You make assumptions about how it could be, but I tell you how it is, I personally checked this situation, I describe it: I created ONE extension on the telephony server, then registered TWO softphones on TWO different computers for this extension (I explain: login 100; password XXXXXXXX; sip server 192.168.XX) same data on second computer, both online, pjsip show endpoints shows ONE last login, both softphones can make outgoing calls, when receiving an incoming call, both will ring. Same with three and four softphones.
if the Max Contacts value = 2, then the same thing happens, only pjsip show endpoints shows both contacts, BUT when trying to register more than 2 softphones, it gives a registration error “invalid login or password”
I want to show these conditions when connecting a second softphone