The scenario is that a customer is moving several different AD environments to a new Office 365 tenant as a step towards consolidating all resources in one place. This will take place over a long period of time. In one of the environments, they have a Skype for Business Server with enterprise voice activated for many users. A subset/category of these users is being moved over to the new tenant. New users of other subsets/categories will still be created in the old environment, and therefore they rely on unassigned number ranges in Skype for Business to assign numbers to new Skype for Business users automatically.
They have an SBC connected to Teams Direct Routing. The mediation server of the Skype for Business environment is connected to the SBC. All the numbers for the users that are being moved are not in a set range, its very fragmented. The complicated part is then for each number you move, you need to split the number range the user’s number is part of in two. This so the number is moved out of the range. When you have over 300 numbers you don’t want to do this manually! After being able to wrap my head around the problem I managed to write a script that automates this whole process. It also adds the moved number to a voice route on the mediation server so all incoming calls to that number are pointed towards the SBC and Direct Routing. The script also activates enterprise voice and assigns the number to a Teams user in the new tenant.