Blog · Multiple companies sharing one phone system

Multiple companies sharing one phone system

See for which company the call is coming in

Recently the question came up, how you can deal with having multiple companies tied into one phone system. The crucial point is that you might want the phones to show which of the companies the call is coming in for.

If you are using different providers, Askozia allows you to prepend a string for each provider (Company A, Company B etc.), telling you which of the companies the call is coming in for. This is also described in our wiki.

However, if the companies are also sharing the same provider, it is getting sticky. This means you can only differentiate between the different companies by looking at the called extension.

In my example, I’ll assume that a SIP Trunk with 10 numbers is used: xxxxxxx0 to xxxxxxx9.
Now we need to check for every incoming call what the last digit of the called extension is to assign it to the right company.
This is done in the regular expression below. xxxxxxx0 to xxxxxxx3 are assinged to Company A, xxxxxxx4 to xxxxxxx6 to Company B and xxxxxxx7 to xxxxxxx9 to Company C.

Set(BUSINESS=${EXTEN:-1}); get last digit
ExecIf($[${BUSINESS} >= 0  & ${BUSINESS} <= 3]?Set(CALLERID(name)=Business A ${CALLERID(name)})) ; Company A
ExecIf($[${BUSINESS} >= 4  & ${BUSINESS} <= 6]?Set(CALLERID(name)=Business B ${CALLERID(name)})) ; Company B
ExecIf($[${BUSINESS} >= 7  & ${BUSINESS} <= 9]?Set(CALLERID(name)=Business C ${CALLERID(name)})) ; Company C

Of course this also works with the last two or more digits, depending on the size of your SIP trunk. To change the number of digits, e.g. from one to two, change EXTEN:-1 to EXTEN:-2.

Adjust the code to your needs. Then open Askozia's GUI and go to Accounts->Your Provider->Advanced Options-> Manual Dialplan Incoming and paste the code.

Don't forget to hit "Save" in the end.