Setup of Multiple SBCs in an Active/Active mode for different regions, but failover between them.

When we have a scenario whereby a customer has offices in two main global regions, we want to ensure traffic remains within the region where possible. For this post we assume our two regions are the US and the EU. We create and deploy a separate SBC in each region. We want to keep  24*7 phone availability so we install one SBC in Azure US and another in Azure EU. This way we provide the customer with very highly available base for the SBCs.

The deployment of the SBC itself is outside the scope of this post but will be covered in another separate post.

We configure the SBCs in a failover scenario in that if the primary SBC for the site is unavailable, then the call will automatically route (after 5 seconds – using the -FailoverTimeSeconds parameter) to the SBC in the opposite site. We do this through the use of the -FailoverResponseCodes in the Set-CsOnlinePSTNGateway command.

We can find a full list of SIP response codes here: https://www.3cx.com/pbx/sip-responses/

A complete script for this process is available on my GITHUB site.

To set up the gateways and associated routes and routing policies, we follow the steps below in the order shown below. All steps will be done for each of the SBCs.

1.       1. PSTN GATEWAY

This is the first step, we must define the configuration of the SBC/Gateway itself. Here the default -FailoverResponseCodes are set with the following:

 

408: Request Timeout – Couldn’t find the user in time

503: Service Unavailable – The server is in maintenance or is temporarily overloaded and cannot process the request.

504: Server Time-out – The server tried to access another server while trying  to process a request, no timely response.

 

We set the -MaxConcurrentSessions to 100 here, it should be the number of SIP channels available on the outbound trunk (We will reset this later) and it can be configured in the script global variables section.

(First one in North Europe Azure Region)

New-CsOnlinePSTNGateway -Identity "sbc-EU.domain.com" -Enabled $true -SipSignalingPort 5067 -MaxConcurrentSessions 100


(Second one in North America Azure Region)

New-CsOnlinePSTNGateway -Identity "sbc-US.domain.com" -Enabled $true -SipSignalingPort 5067 -MaxConcurrentSessions 100


Now when we run a Get-CSOnlinePSTNGateway we can see the output

 


2.      2. PSTN Usage

Next, we will create a PSTN Usage for the region and add it to the Global policy. A Public Switched Telephone Network (PSTN) usage record specifies a class of call (such as internal, local, or long distance) that can be made by various users or groups of users in an organization. We do not restrict the class of calls which can be made so we just give a generic regional name to this PSTNUsage. You can add more as required.

 

Set-CsOnlinePstnUsage  -Identity Global -Usage @{Add="EU"}



Set-CsOnlinePstnUsage  -Identity Global -Usage @{Add="US"}



 3.       Route

The most important part now is to create a route and backup route for each site. We do this using the priority attribute. Once the priority is a smaller number for each PSTN Usage then it will only fail over once the lower priority gateway is unreachable.

 

New-CsOnlineVoiceRoute -Identity "US Route" -NumberPattern ".*" -OnlinePstnGatewayList sbc-US.domain.com -Priority 1 -Description “Route 1 for US Users” -OnlinePSTNUsages US



New-CsOnlineVoiceRoute -Identity "US Backup Route" -NumberPattern ".*" -OnlinePstnGatewayList sbc-EU.domain.com -Priority 2 -Description “Backup route (Via sbc-EU)  for US Users” -OnlinePSTNUsages US



 

New-CsOnlineVoiceRoute -Identity "EU Route" -NumberPattern ".*" -OnlinePstnGatewayList sbc-EU.domain.com -Priority 3 -Description “Route 1 for EU Users” -OnlinePSTNUsages EU



 New-CsOnlineVoiceRoute -Identity "EU Backup Route" -NumberPattern ".*" -OnlinePstnGatewayList sbc-US.domain.com -Priority 4 -Description “Backup route (Via sbc-US)  for EU Users” -OnlinePSTNUsages EU



 

We can see all Voice Routes by running Get-CSOnlineVoiceRoute:



4.       4. Routing Policy

Finally we create routing policies which we point to the Online PSTN Usage. This way the policy will point to either SBC available depending on priority setting. We create one for each region:

 

New-CsOnlineVoiceRoutingPolicy "EU Routing Policy" -OnlinePstnUsages "EU"



 New-CsOnlineVoiceRoutingPolicy "US Routing Policy" -OnlinePstnUsages "US"



 Lets check all Policies now using Get-CSOnlineVoiceRoutingPolicy:



5.       5. Grant User Policy

We can now assign users the correct policy depending on their region. We can do this through the Teams Admin Center (TAC) or via PowerShell below:

 

Grant-CsonlineVoiceRoutingPolicy -PolicyName "EU Routing Policy" -Identity "user1@domain.com"

 

 

 

Comments

Popular posts from this blog

Unassigned Numbers in Microsoft Teams using Audiocodes SBC

Communicator ports used for communication

Teams Device Health Monitoring and Reporting