Exchange, Office 365, Powershell, Scripts, Skype for Business

Duplicating Auto Attendants in O365

As you know in June of 2019 Microsoft is getting rid of the UMIPGateway functionality.  As we all struggle with this, you know from the two major solutions, AudioCodes (XUM) and Anynode.  The basic change for all of these is changing from TelEXT or E.164 to SIP based policies.  This script jumps the gun a little because first you have to create a DialPlan.  I’ll do another post on that later, but the concept of that will be the same.  One of the reasons I wrote this is because like most companies we did not have many of the original audio files, and I was struggling with exporting and importing of settings.

  • You need to connect to Exchange Online
  • You need the SfB Powershell Tools Installed

Step 1: Export the current data (Mode:Report)

  1. It exports all the needed settings into a CSV File
  2. Downloads all the greetings for the auto attendants
  3. Look that the Report section, you may want to edit the get-umdialplan filter to match your needs, or just get rid of it or use * (though deleting it would be quicker)

So here is the neat stuff here.  Downloading the file.  Two simple statements, export-UMPrompt and Set-COntent.  The Export-UMPrompt is a little confusing.  Because with most PowerShell Scripts you use a -{tab} to get options.  However, that does not work here.  Depending on what you want to export, the options are different.

$Prompt = Export-UMPrompt -PromptFileName $aa.BusinessHoursWelcomeGreetingFilename -UMAutoAttendant $aa.Identity
Set-Content -path $($BasePath+"\"+$aa.BusinessHoursWelcomeGreetingFilename) -Value $prompt.AudioData  -Encoding Byte -Force
    

Step 2: Update the CSV File

The CSV will create columns for everything you need for the next two steps.  In my case though I added two more columns for testing and just modified the fields in the script to accommodate for that.  I should write a post on what I went through to get AudioCodes XUM done, not tricky, but not designed for companies running both CUCM and SfB at the same time. Once the have exported the data, this is where the hard part begins.  Having to figure out new names for your AA (can’t have two with the same name), the E.164 number, SIP Addresses and OUs for the exumcontact object.  I spent more time figuring this out than writing the script (you should of seen the mess I had to deal with)

You will also need to change the bit depth to 16.  I recommend using ffmpeg for this because you can do it in batch.  So download ffmpeg from https://ffmpeg.zeranoe.com/builds/ Then in a command line you need to change the bit rate.  This is done as follows  ffmpeg -i (input file name) -sample_fmt s16 (output file) so for example ffmpeg -I c:\logs\OldUMDialplans\welcome.wav –sample_fmt s16 c:\logs\OldUMDialplans\updated\welcome.wav.  Just make sure that you copy the files back or update the log file with the new filepath.  So a script to do this would look something like this

foreach ($file in Get-item "C:\logs\OldDialPlans\*.wav") {
$file.FullName
[string]$commandline = '"C:\Scripts\ffmpeg-20180518-8e7b13b-win64-static\bin\ffmpeg.exe" -i "' + $file.FullName + '" -sample_fmt s16 "C:\logs\OldDialPlans\Updated\' + $File.Name +'"'
$commandline
Invoke-Expression  "& $commandline"
}

Step 3: Create the Auto Attendants (Mode:”Create-Auto-Attendents” )

So now that we have everything ready, I would first recommend doing some testing, by adding -what to the end of each line, or just doing | Select -first 1 filter in the foreach.  So this is where a lot of the long manual work is done.  By getting the old Auto Attendant that I want to duplicate I can easily jus mirror those settings into the new AA.  You see where I have the Set-UMAutoAttendant, notice how each parameter that I know I need is retrieved from there.  Try doing an import from an export and set the schedule, or key mappings, not easy.  Mind you though that if you have a key mapping that sends to voicemail that is not present, it will barf and not set correctly.  See this example, it’s pretty straight forward.  What I did is run the script without doing any new or set, then I could just .{tab} through everything.  Or you can just copy the parameter into the setting.

Set-UMAutoAttendant -Identity $line.NewAAName -BusinessHoursWelcomeGreetingFilename $FileName -BusinessHoursSchedule $oldAA.BusinessHoursSchedule

Then I enable the AA.

Last I upload the file.  Notice that I have to cast the content to byte (just like I had to export it as a byte.  Then I import it.

[byte[]]$umfile = Get-content -Path $($line.Filepath) -Encoding Byte -ReadCount 0
Import-UMPrompt -UMAutoAttendant $line.NewAAName -PromptFileName $FileName -PromptFileData $umfile

Step 4: Create the Contacts (Mode:”Create-CS-EXUMContacts” )

This is the most basic of steps, I just create the contact, not very fancy at all.

Like I said, I am working on the counter part for Subscriber Access, and Dial Plans, and Voicemail Policies, but all of those kind of just mimic the same process.

And the File Download greetings

4 thoughts on “Duplicating Auto Attendants in O365

  1. Cod Generic Levaquin Drugs Direct Mastercard Accepted Store Cheap Propecia Without Prescription Buy Prevacid Bulk [url=http://cialibuy.com]cialis no prescription[/url] Order Propecia Online Progynova Sildalis For Sale Online Pharmacy

Leave a Reply

Your email address will not be published. Required fields are marked *