Forum Discussion
solidpro380
Mar 15, 2021Copper Contributor
Teams Voice - sending 3 digit numbers to one SBC and everything else to another...
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-pre...
- Mar 17, 2021
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.
fowler_23
Mar 17, 2021Iron Contributor
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.
solidpro380
Mar 19, 2021Copper Contributor
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...
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...
- fowler_23Mar 19, 2021Iron ContributorThis 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)- solidpro380Mar 19, 2021Copper ContributorAh, 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!