Max Contacts

you change the subject again

I’m interested in the question of why PBX allows multiple device registrations of the same extension with an explicit limit to one (Max Contacts = 1)

It is showing a single registration (the new one) with two active calls, one based on the old registration and one based on the new one.

Actually it is showing two calls on the endpoint. There is no indication as to which registration they apply. max contacts in no way controls the maximum number of simultaneous calls.

One registration:

Two calls:

I understand it

196 extension has 3 active registrations and can be more with Max Contacts = 1
with Max Contacts = 2 the third device go to offline with wrong password and fourth and fifth and …

I want to one extension on ONE device, how to explain to you ?

two calls from DIFFERENT pcs they have different mac addresses and different ip addresses

00260 1645892513 * ==>      OPTIONS sip:[email protected]:49475;ob SIP/2.0
00261 1645892513 * ==>     OPTIONS sip:[email protected]:62500;ob SIP/2.0
Endpoint:  150/150                                              In use        2 of inf
InAuth:  150-auth/150
Aor:  150                                                1
Contact:  150/sip:[email protected]:49475;ob         d99f1ccc8b Avail         0.846
Channel: PJSIP/150-00015a72/Dial                             Up            00:02:58
Exten: s                         CLCID: "CID:XXXXXXXXXXXX" <XXXXXXXXXXXX>
Channel: PJSIP/150-00015aaa/Dial                             Ring          00:00:32
Exten: s                         CLCID: "CID:XXXXXXXXXXXX" <XXXXXXXXXXXX>

@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.

@darrenhollick thank you for such a deep explanation

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

Submit a bug report. Include versions of FreePBX, Modules, and Asterisk.

Sangoma can confirm if there is an issue or not via this process.

I don’t believe there is a bug here. Setting max contacts will not do anything to block a registration.

1 Like

I believe the one thing that hasn’t been explained to you. REGISTER != INVITE. A SIP device doesn’t not have to be registered in order to make an outbound call.

Registration tells the PBX where to send requests to the endpoint. It needs to know the Location of the endpoint contacts. That’s all it does. When you make an outbound call, that is a different process, there is an auth challenge during that process and it has nothing to do with the registration.

So, you setup an endpoint with a Max Contact of 2 and then program 10 devices with those creds. At any given time TWO of those 10 can have an active registration/location with the PBX meaning those two get incoming but ALL TEN can make outbound calls.

Please stop using making outbound calls as a test for this, it doesn’t mean anything.

nope, 8 others just can not register, server just reject their credentials
but if max contacts = 1, all 10 registering successful and ring all of 10 incoming/outgoing

What are you talk about?

You can check the question above

I was explaining to you the difference between REGISTER and INVITE. They aren’t related unless you do the work to make them related.

How about this? Show us some actual debugs. I want to see the contacts registered for the endpoint. I want to see an incoming call that rings non-registered devices. Show us this actually happening. We need to see the actual proof of what you are saying is happening is happening.

So far what you are saying, I can’t replicate any place.

You can find debug info in the above posts

There is no full debug info in the above posts. I see a bunch of snippets of lines from a debug but I don’t see a full debug that I was asking for. It’s been a month now so what I am asking for is complete and current debugging of this situation. I want to see the two contacts in which one shouldn’t exist and have been replaced. I want to see debugs of actual calls ringing contacts that you said had expired and are still getting incoming calls. FULL DEBUG/TRACES.

1 Like

What will the current debug logs give you, they are identical with the previous ones

let me explain:

Endpoint:  172/172                                              In use        2 of inf
InAuth:  172-auth/172
Aor:  172                                                1
Contact:  172/sip:[email protected]:59522;ob        dc229895ea Avail         0.990
Channel: PJSIP/172-00034182/Dial                             Ring          00:00:09
Exten: s                         CLCID: "CID:XXXXXXXXXX" <XXXXXXXXXX>
Channel: PJSIP/172-00034061/Dial                             Up            00:19:12
Exten: s                         CLCID: "CID:XXXXXXXXXX" <XXXXXXXXXX>

here you can see 2 <Channels.> in use and <MaxContact.> for this extension 1

next you can see pjsip debug

01527 1649134892 * <==      REGISTER sip: SIP/2.0
00137 1649134705 * <==     REGISTER sip: SIP/2.0
00138 1649134705 * ==>     SIP/2.0 401 Unauthorized

00140 1649134705 * ==>      OPTIONS sip:[email protected]:64469;ob SIP/2.0
00141 1649134705 * ==>     OPTIONS sip:[email protected]:59522;ob SIP/2.0

00145 1649134705 * ==>     NOTIFY sip:[email protected]:59522;ob SIP/2.0
01535 1649134892 * ==>      NOTIFY sip:[email protected]:64469;ob SIP/2.0
<--- History Entry 1527 Received from at 1649134892 --->
Via: SIP/2.0/UDP;rport=64469;received=;branch=z9hG4bKPj3553cf9a431044ec938e71a4768565d5
Max-Forwards: 70
From: "172" <sip:[email protected]>;tag=cebd8a2a1aaa4934b3d76dcb3048bc5e
To: "172" <sip:[email protected]>
Call-ID: eff1fc03fbe7482ca62f96ee47f2a92f
CSeq: 44123 REGISTER
User-Agent: MicroSIP/3.20.7
Contact: "172" <sip:[email protected]:64469;ob>
Expires: 300
Content-Length: 0
Content-Length:  0

<--- History Entry 137 Received from at 1649134705 --->
Via: SIP/2.0/UDP;rport=59522;received=;branch=z9hG4bKPja167ad6396fc4bdf91fcccdb4f6a7971
Max-Forwards: 70
From: <sip:[email protected]>;tag=340af5f0ea2e46968905012acd13459a
To: <sip:[email protected]>
Call-ID: f24ab213a5a8472cb67a63bdd0f676bc
CSeq: 38812 REGISTER
User-Agent: MicroSIP/3.19.27
Contact: <sip:[email protected]:59522;ob>
Expires: 300
Content-Length: 0
Content-Length:  0

<--- History Entry 138 Sent to at 1649134705 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP;rport=59522;received=;branch=z9hG4bKPja167ad6396fc4bdf91fcccdb4f6a7971
Call-ID: f24ab213a5a8472cb67a63bdd0f676bc
From: <sip:[email protected]>;tag=340af5f0ea2e46968905012acd13459a
To: <sip:[email protected]>;tag=z9hG4bKPja167ad6396fc4bdf91fcccdb4f6a7971
CSeq: 38812 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1649134705/ac6873acac3c5710093562168460a1fc",opaque="642f860659719418",algorithm=md5,qop="auth"
Server: FPBX-16.0.19(16.24.1)
Content-Length:  0

you can see that second 172 peer was registered

if for some reason you need more debug info, please specify cli command and its arguments

So you have two MicroSIP devices registering to an AOR that only allows one contact. That is what I am seeing here and I asked why you have multiple devices trying to register to an AOR that should only have 1. This is two MicroSIP clients registering within 3 minutes of each other and I still don’t see you showing two contacts being registered.

How about we actually see something that is configured like pjsip show aor 172? And let’s stick with 172 since you haven’t shown consistent data in anything you’ve posted.

of course it will. that is what it is supposed to do.

You have a severe lack of understanding, and you are not listening to what the one person that is trying to help you is telling you to do.