How to have fault-tolerant routes to PSTN/PBX?

In OCS 2007 we use the Mediation Server role as the routing end-point for voice calls going outside the OCS environment, ie. to the PSTN or to a PBX. For more information about voice in OCS 2007 see here.

When routing to PSTN/PBX you sometimes would like to have fault-tolerant routes, ie. if one Mediation Server goes down another can take over. Let's assume we have the network below.

sample network

We have UC end-points and an OCS pool in Paris and we have Mediation Servers in Copenhagen (DK-MS-1 and DK-MS-2) and we have a Mediation Server in Stockholm (SE-MS-1). The network between Paris, Copenhagen and Stockholm is a triangle as shown with Link 1, Link 2 and Link 3.  Let's also assume that calls from Paris to numbers in Denmark (+45) should break-out in Copenhagen and you have configured OCS 2007 routing to that effect.

So what happens if the network link (Link 1) between Paris and Copenhagen goes down? Can user in Paris still call numbers in Denmark?

If the network connectivity is such that IP packets from Paris to Copenhagen can flow via Stockholm then calls from Paris will break-out in Copenhagen as normal. The only difference is that the packets travel via Stockholm. The reason is that media will travel directly from the UC end-point to the Mediation Server. So what happens if both Link 1 and Link 3 are down? Now the IP packets can't travel to Copenhagen via Stockholm.

This leads to the wish to configure OCS 2007 routing such that calls to Denmark should break-out in Stockholm in case Link 1 and Link 3 are down. In the normal situation calls to Denmark should still break-out in Copenhagen. How to configure routing to support this requirement?

You start by configuring your normal route to Denmark (+45 calls). This route has the two Mediation Servers (dk-ms-1 and dk-ms-2) in it. Having the two Mediation Servers in the route mean OCS 2007 will round-robin the calls between the two servers, and in case one is not working use the other one. The next thing is you configure a route for +45 calls to go via the Mediation Server in Stockholm (se-ms-1).

The trick is to designate one route as primary and the other as secondary. The way you do that is by creating corresponding phone usage records. You have a phone usage record for primary route (dk primary) and a phone usage record for secondary route (dk secondary). You then make sure that in the policy the primary phone usage record is listed before the secondary phone usage record. 

Multiple

In the screen shot I have used Enterprise Voice Route Helper (part of the OCS 2007 Resource Kit Tools) to show the configuration. You can see I have a policy called mb. The policy contains two phone usage records with dk primary first and dk secondary second. You can also see that I have two routes both with the pattern +45 for calls to Denmark. The first route has phone usage dk primary and the second has dk secondary. The way it will work is this.

A UC user in Paris with the policy mb calls a number in Denmark. Routing will first select dk primary route because both the pattern and phone usage are matching. Routing will try to contact dk-ms-1 and dk-ms-2 and realize that it can't communicate with any of them. It will then continue down the routing table to find a new match. It will find a match on the dk secondary route, since both pattern and phone usage matches. It will then send the call to se-ms-1 and the call will break-out in Stockholm and call the PSTN number in Denmark.