Use direct routing to connect to existing telephony service

Azure Communication Services direct routing enables you to connect your existing telephony infrastructure to Azure. The article lists the high-level steps required for connecting a supported Session Border Controller (SBC) to direct routing and how voice routing works for the enabled Communication resource.

Important

Functionality described in this document is currently in public preview. This preview version is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Important

For customers using voice channel in Dynamics 365 Customer Service Enterprise, Microsoft provides GA level of support for all the direct routing related scenarios. To learn more about voice channel, see Introduction to the voice channel.

For information about whether Azure Communication Services direct routing is the right solution for your organization, see Azure telephony concepts. For information about prerequisites and planning your deployment, see Communication Services direct routing infrastructure requirements.

Connect the SBC with Azure Communication Services

Configure using Azure portal

  1. In the left navigation, select Direct routing under Voice Calling - PSTN and then select Configure from the Session Border Controller tab.

  2. Enter a fully qualified domain name and signaling port for the SBC.

    • SBC certificate must match the name; wildcard certificates are supported.
    • The *.onmicrosoft.com domain can’t be used for the FQDN of the SBC.

    For the full list of requirements, refer to Azure direct routing infrastructure requirements.

    Screenshot of Adding Session Border Controller.

  3. When you're done, select Next.

    If everything is set up correctly, you should see an exchange of OPTIONS messages between Microsoft and your Session Border Controller. Use your SBC monitoring/logs to validate the connection.

Outbound voice routing considerations

Azure Communication Services direct routing has a routing mechanism that allows a call to be sent to a specific SBC based on the called number pattern.

When you add a direct routing configuration to a resource, all calls made from this resource’s instances (identities) will try a direct routing trunk first. The routing is based on a dialed number and a match in voice routes configured for the resource.

  • If there's a match, the call goes through the direct routing trunk.
  • If there's no match, the next step is to process the alternateCallerId parameter of the callAgent.startCall method.
  • If the resource is enabled for Voice Calling (PSTN) and has at least one number purchased from Microsoft, the alternateCallerId is checked.
  • If the alternateCallerId matches a purchased number for the resource, the call is routed through the Voice Calling (PSTN) using Microsoft infrastructure.
  • If alternateCallerId parameter doesn't match any of the purchased numbers, the call will fail.

The diagram below demonstrates the Azure Communication Services voice routing logic.

Diagram of outgoing voice routing flowchart.

Voice routing examples

The following examples display voice routing in a call flow.

Note

In all examples, while the higher voice route has higher priority, the SBCs in a route are tried in random order.

One route example:

If you created one voice route with a pattern ^\+1(425|206)(\d{7})$ and added sbc1.contoso.biz and sbc2.contoso.biz to it, then when the user makes a call to +1 425 XXX XX XX or +1 206 XXX XX XX, the call is first routed to SBC sbc1.contoso.biz or sbc2.contoso.biz. If neither SBC is available, the call is dropped.

Two routes example:

If you created one voice route with a pattern ^\+1(425|206)(\d{7})$ and added sbc1.contoso.biz and sbc2.contoso.biz to it, and then created a second route with the same pattern with sbc3.contoso.biz and sbc4.contoso.biz. In this case, when the user makes a call to +1 425 XXX XX XX or +1 206 XXX XX XX, the call is first routed to SBC sbc1.contoso.biz or sbc2.contoso.biz. If both sbc1 and sbc2 are unavailable, the route with lower priority will be tried (sbc3.contoso.biz and sbc4.contoso.biz). If none of the SBCs of the second route are available, the call is dropped.

Three routes example:

If you created one voice route with a pattern ^\+1(425|206)(\d{7})$ and added sbc1.contoso.biz and sbc2.contoso.biz to it, and then created a second route with the same pattern with sbc3.contoso.biz and sbc4.contoso.biz, and created a third route with ^+1(\d[10])$ with sbc5.contoso.biz. In this case, when the user makes a call to +1 425 XXX XX XX or +1 206 XXX XX XX, the call is first routed to SBC sbc1.contoso.biz or sbc2.contoso.biz. If both sbc1 nor sbc2 are unavailable, the route with lower priority will be tried (sbc3.contoso.biz and sbc4.contoso.biz). If none of the SBCs of a second route are available, the third route will be tried. If sbc5 is also not available, the call is dropped. Also, if a user dials +1 321 XXX XX XX, the call goes to sbc5.contoso.biz, and it isn't available, the call is dropped.

Note

Failover to the next SBC in voice routing works only for response codes 408, 503, and 504.

Note

In all the examples, if the dialed number does not match the pattern, the call will be dropped unless there is a purchased number exist for the communication resource, and this number was used as alternateCallerId in the application.

Configure outbound voice routing

Configure using Azure portal

Screenshot of outgoing voice routing configuration.

Give your voice route a name, specify the number pattern using regular expressions, and select SBC for that pattern. Here are some examples of basic regular expressions:

  • ^\+\d+$ - matches a telephone number with one or more digits that start with a plus
  • ^\+1(\d{10})$ - matches a telephone number with a ten digits after a +1
  • ^\+1(425|206)(\d{7})$ - matches a telephone number that starts with +1425 or with +1206 followed by seven digits
  • ^\+0?1234$ - matches both +01234 and +1234 telephone numbers.

For more information about regular expressions, see .NET regular expressions overview.

You can select multiple SBCs for a single pattern. In such a case, the routing algorithm will choose them in random order. You may also specify the exact number pattern more than once. The higher row will have higher priority, and if all SBCs associated with that row aren't available next row will be selected. This way, you create complex routing scenarios.

Managing inbound calls

For general inbound call management use Call Automation SDKs to build an application that listen for and manage inbound calls placed to a phone number or received via ACS direct routing. Omnichannel for Customer Service customers please refer to these instructions.

Delete direct routing configuration

Delete using Azure portal

To delete a voice route:

  1. In the left navigation, go to Direct routing under Voice Calling - PSTN and then select the Voice Routes tab.
  2. Select route or routes you want to delete using a checkbox.
  3. Select Remove.

To delete an SBC:

  1. In the left navigation, go to Direct routing under Voice Calling - PSTN.
  2. On a Session Border Controllers tab, select Configure.
  3. Clear the FQDN and port fields for the SBC that you want to remove, select Next.
  4. On a Voice Routes tab, review voice routing configuration, make changes if needed. select Save.

Note

When you remove SBC associated with a voice route, you can choose a different SBC for the route on the Voice Routes tab. The voice route without an SBC will be deleted.

Next steps

Conceptual documentation

Quickstarts