By default, Kamailio employs the user portion of the SIP Address for authentication purposes or to locate the contact header. This default configuration restricts its functionality to a single domain,For example here Alice @ CompanyA.omid.blog can register and call to Bob @ companyA.omid.blog
However, Kamailio's architecture is specifically designed to handle thousands of calls per second. Lets say I want to implement a multi-tenant environment, such as a hosted PBX or call center system and I want to service multiple customers with different domains.
In the context of our example, I am looking to provide services to both Company A and Company B, that some employees may have the same names in both companies. For instance, Alice and Bob are present in both organisations. However, it's important to clarify that even though they share a name, they are distinct individuals with unique SIP usernames and passwords.
Kamailio multi domain configuration
Multi tenant functionality can be provided in 2 ways . Statically in config by using aliases .. Or a more dynamic way by using a domain module that can read domains from a database such as mysql or postgresql.
Method 1: alias in kamailio.cfg
with alias keyword in kamailio configuration you can define multiple domains for your kamailio. It will be the preferred method for small installation that you may not have so many domains. It has two downside .
You need to restart your kamailio everytime you want to change or add a new domain
Its not very easy to to add or edit if you want to have web panel or some sort of API for managing the domains
In order to configure our domains we need to edit kamailio.cfg file and add our domains
/* add local domain aliases - it can be set many times */