Seeking Advice on Managing Multi-Customer SIP Trunks in FreePBX

Hello everyone!

I’d like to ask for some advice regarding a solution my company is trying to implement.
My boss recently contracted a large VoIP trunk and wants to “share” it among multiple customers.
We have already implemented something similar, and here is how I set it up:

I have a FreePBX instance in the cloud acting as an “SBC”.
On it, I have our main VoIP provider trunk configured. It’s a standard SIP trunk without registration — it works via sending OPTIONS and IP address whitelisting, just like a typical setup.

For each customer, I create trunks with the following settings:

  • Authentication: both
  • Registration: receive
  • Username and AuthName: the trunk’s name
  • Password: set by me

On the “SBC” side, the context of the trunk looks like this:

[from-client]
exten => _X.,1,NoOp(*** Forwarding client call to VOIP PROVIDER ***)
exten => _X.,n,Set(CALLERID(num)=XXXXXXXXXX) ; customer’s number
exten => _X.,n,Dial(PJSIP/${EXTEN}@MyVoipProviderAccount,,r)
exten => _X.,n,Hangup()

For inbound calls, the customer’s DID is routed to their specific trunk, so their PBX receives the calls normally.
On the customer side, the context is from-pstn: outgoing calls go to my “FreePBX SBC”, which routes them to the provider; incoming calls come from the provider and are forwarded back to the customer.

This setup has been working, but I’ve encountered some sporadic issues.
For example, sometimes the trunk drops, and when the customer PBX tries to register again, I get a max_contacts reached error, forcing me to manually remove the registration from the Asterisk database.

Sample log event:

16372 [2025-05-20 12:10:34] WARNING[20374] res_pjsip_registrar.c: AOR 'MyClient' has no configured max_contacts. Endpoint 'MyClient' (XXX.XXX.XXX.XX:5060) unable to register

I know FreePBX isn’t really the ideal platform for this use case, and that something like Kamailio or OpenSIPS would be better suited for managing SIP trunks in this way.
But due to the urgency of this project (which, honestly, landed on me to deliver, lol), I had to make it work with FreePBX.

Is there a better way to configure FreePBX or Asterisk to reduce these issues?
Or should I push for moving to a more specialized SIP proxy platform like Kamailio?

Thanks in advance for any guidance!