Microsoft Tech Community Live:  Microsoft Teams Edition
November 09, 2021, 08:00 AM - 12:00 PM (PST)
SOLVED

Teams Voice - sending 3 digit numbers to one SBC and everything else to another...

%3CLINGO-SUB%20id%3D%22lingo-sub-2211501%22%20slang%3D%22en-US%22%3ETeams%20Voice%20-%20sending%203%20digit%20numbers%20to%20one%20SBC%20and%20everything%20else%20to%20another...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2211501%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%20a%20very%20simple%20setup%20but%20I'm%20not%20sure%20how%20to%20succeed%20in%20what%20we%20need%20to%20do.%20We%20have%20SBC%231%20which%20is%20in%20the%20cloud%20and%20connected%20to%20the%20PSTN%20using%20SIP%20trunks.%20We%20have%20SBC%232%20which%20is%20on-premises%20and%20connected%20to%20an%20IP-PBX%20in%20an%20office.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20we%20need%20is%20for%20everything%20dialled%20in%20Teams%20to%20go%20to%20SBC%231%20unless%20it's%20a%203%20digit%20extension%20such%20as%202xx%2C%203xx%2C%204xx.%20In%20that%20case%20we%20would%20like%20the%20call%20to%20go%20to%20SBC%232%20which%20will%20route%20the%20call%20to%20the%20IP-PBX.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20sure%20the%20simplest%20way%20to%20achieve%20this.%20Currently%20we%20simply%20have%20a%20Routing%20Policy%20which%20has%20a%20single%20voice%20route%20sending%20.*%20to%20SBC%231%20and%20onwards%20to%20the%20PSTN.%20How%20can%20we%20make%20M365%20notice%20a%202xx%20number%20and%20route%20it%20to%20SBC%232%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2211501%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECalling%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2217973%22%20slang%3D%22en-US%22%3ERe%3A%20Teams%20Voice%20-%20sending%203%20digit%20numbers%20to%20one%20SBC%20and%20everything%20else%20to%20another...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2217973%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F998056%22%20target%3D%22_blank%22%3E%40solidpro380%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I'm%20presuming%20you%20have%20your%202%20SBC's%20already%20setup%20as%20CsOnlinePSTNGateways.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20so%2C%20then%20you%20just%20need%20to%20use%20Voice%20Routes.%20It%20sounds%20like%20you%20just%20have%201%20voice%20route%20which%20picks%20up%20everything%20.*%20and%20sends%20to%20SBC1%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20just%20need%20to%20add%20a%20new%20voice%20route%20putting%20it%20a%20higher%20priority%20than%20your%20wildcard%2C%20The%20voice%20route%20will%20look%20something%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENew-CsOnlineVoiceRoute%20-Name%20%22ExtensionCalling%22%20-Priority%200%20-OnlinePstnUsages%20%22%3F%3F%3F%22%20-OnlinePstnGatewayList%20sbc2.contoso.com%20-NumberPattern%20'%5B2-4%5D%5B0-9%5D%5B0-9%5D%24'%20-Description%20%22Extension%20routing%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20will%20match%20anything%20being%20called%20that%20starts%20with%202%2C3%20or%204%20and%20then%20any%20digit%20for%20the%20next%203%20numbers%20and%20send%20to%20sbc2.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEnsure%20the%20OnlinePSTNUsage%20used%20is%20assigned%20to%20users%20in%20your%20onlinevoiceroutingpolicy%20who%20you%20want%20to%20be%20able%20to%20call%20those%203%20digit%20extension%20numbers.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eor%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENew-CsOnlineVoiceRoute%20-Name%20%22ExtensionCalling%22%20-Priority%200%20-OnlinePstnUsages%20%22%3F%3F%3F%22%20-OnlinePstnGatewayList%20sbc2.contoso.com%20-NumberPattern%20'%5E(%5Cd%7B3%7D)%24'%20-Description%20%223%20digit%20extension%20calling%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20simpler%20and%20just%20matches%20a%203%20digit%20number%20and%20sends%20to%20sbc2.%20However%2C%20be%20careful%20with%20this%20as%20you%20may%20not%20want%20emergency%20calls.e.g.%20112%2F999%20going%20to%20sbc2%3F%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20you%20will%20what%20to%20do%20is%20add%20a%20new%20rule%20into%20your%20dial%20plan%20as%20you%20may%20find%20that%20by%20calling%20a%203%20digit%20extension%20number%20from%20Teams%20is%20that%20Teams%20will%20add%20a%20normalisation%20rule%20to%20it%20which%20would%20then%20not%20match%20your%20voice%20route.%20e.g%20234%20could%20turn%20into%20%2B44234%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20just%20add%20a%20dial%20plan%20normalization%20rule%20via%20Teams%20Admin%20Centre%2C%20accepting%20a%203%20digit%20number%20and%20passing%20it%20through%20as%20is.%20It%20would%20look%20like%20this%20in%20Advanced%20View%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20Condition%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5E(%5B2-4%5D%5B0-9%5D%5B0-9%5D)%24%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20do%20this%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%241%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoing%20this%20will%20for%20example%20accept%20234%20from%20Teams%2C%20not%20change%20it%2C%20will%20look%20at%20your%20Voice%20Route%20and%20then%20match%20the%20ExtensionCalling%20route%20and%20send%20234%20to%20SBC2.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi

 

We have a very simple setup but I'm not sure how to succeed in what we need to do. We have SBC#1 which is in the cloud and connected to the PSTN using SIP trunks. We have SBC#2 which is on-premises and connected to an IP-PBX in an office.

 

All we need is for everything dialled in Teams to go to SBC#1 unless it's a 3 digit extension such as 2xx, 3xx, 4xx. In that case we would like the call to go to SBC#2 which will route the call to the IP-PBX.

 

I'm not sure the simplest way to achieve this. Currently we simply have a Routing Policy which has a single voice route sending .* to SBC#1 and onwards to the PSTN. How can we make M365 notice a 2xx number and route it to SBC#2?

 

Thanks!

4 Replies
best response confirmed by solidpro380 (New Contributor)
Solution

Hi @solidpro380 

 

So I'm presuming you have your 2 SBC's already setup as CsOnlinePSTNGateways.

 

If so, then you just need to use Voice Routes. It sounds like you just have 1 voice route which picks up everything .* and sends to SBC1

 

You just need to add a new voice route putting it a higher priority than your wildcard, The voice route will look something like this:

 

New-CsOnlineVoiceRoute -Name "ExtensionCalling" -Priority 0 -OnlinePstnUsages "???" -OnlinePstnGatewayList sbc2.contoso.com -NumberPattern '[2-4][0-9][0-9]$' -Description "Extension routing"

 

This will match anything being called that starts with 2,3 or 4 and then any digit for the next 3 numbers and send to sbc2.

 

Ensure the OnlinePSTNUsage used is assigned to users in your onlinevoiceroutingpolicy who you want to be able to call those 3 digit extension numbers.

 

or this:

 

New-CsOnlineVoiceRoute -Name "ExtensionCalling" -Priority 0 -OnlinePstnUsages "???" -OnlinePstnGatewayList sbc2.contoso.com -NumberPattern '^(\d{3})$' -Description "3 digit extension calling"

 

This is simpler and just matches a 3 digit number and sends to sbc2. However, be careful with this as you may not want emergency calls.e.g. 112/999 going to sbc2??

 

What you will what to do is add a new rule into your dial plan as you may find that by calling a 3 digit extension number from Teams is that Teams will add a normalisation rule to it which would then not match your voice route. e.g 234 could turn into +44234

 

So just add a dial plan normalization rule via Teams Admin Centre, accepting a 3 digit number and passing it through as is. It would look like this in Advanced View

 

If Condition

 

^([2-4][0-9][0-9])$

 

Then do this

 

$1

 

Doing this will for example accept 234 from Teams, not change it, will look at your Voice Route and then match the ExtensionCalling route and send 234 to SBC2.

 

Hope this helps.

Hi

That's brilliant help thank you. I managed to get this working exactly as I intended and applied the same theory to also passing 2-digit extensions starting with 5 and 1 digit extensions starting with 7-8 through to the IP-PBX SBC.

I did this ultimately by having 3 normalization rules and 4 voice routes.



Normalization Rules:



1) ^([2-4][0-9][0-9])$ | $1
2) ^([5][0-9])$ | $1
3) ^([7-8])$ | $1


On the Voice Routes - each with the different dialled number pattern to the IPPBX SBC and finally a catch all .* to go to the PSTN SBC.

Out of interest is there a way I could incorporate these 3 dial patterns into one?

P1 - 7-8 Dialling - [7-8]$ - SBC1
P2 - 2 Digit dialling - [5][0-9]$ - SBC1
P3 - 3 Digit Dialling - [2-4][0-9][0-9]$ - SBC1
P4 - Everything else - .* - SBC2

I tried various combinations of syntax to try and accept it in one Priority Voice route but I couldn't get anything to work, so went for 3 separate ones for internal dialling...
This 1 rule should cover the normalization rule:
^(([2-4][0-9][0-9])|^([5][0-9])|^([7-8]))$

Then do this
$1

using this | is saying this OR this OR this

Would work the same way in your voice routes really. So would look like this:
^(([7-8])|([5][0-9])|([2-4][0-9][0-9]))$ - SBC1

Think that would do it but test it using the test facility in Dial Plans and then something like regexr.com (change flags to multiline)
Ah, thank you. I didn't know I could use the | as an OR.... I've incorporated that into my M365 and all looks good. Thanks a lot for you help!