Most Valued User KlausH Posted November 24, 2016 Most Valued User #1 Share Posted November 24, 2016 Hi, I would like to change the holdmusic automatically at a time. Is there a possibility? Link to comment Share on other sites More sharing options...
Tom Wellige Posted November 24, 2016 #2 Share Posted November 24, 2016 Hello Klaus, after our phone call yesterday I asked a colleague if he could help, and he came up with this # Connect to the local SwyxServer via Windows Authentication Connect-IpPbx # Ask for the music on hold file name $messageText = "Please enter the filename of the new 'Music on Hold'. " + ` "Please note that the file must be already in the " + ` "IpPbx database (Scope: Global / Category: Music on Hold)" $fileName = Read-Host $messageText # Check if file really exists in database $fileEntry = Get-IpPbxFile -FileName $fileName -Scope Global -Category HoldMusic if (!$fileEntry) { Write-Warning "A file with the name $($fileName) could be found in the IpPbx database." if (!$psISE) { Write-Host Read-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } exit } # Change the "Music On Hold" $globalConfigEntry = $Global:LibManager.GetGlobalConfigEntry() $globalConfigEntry.HoldMusicFile = $fileName $globalConfigEntry.Update($true) Write-Host "MusicOnHold changed successfully -> Have a nice day ;-)" # Check for PowerShell ISE usage and avoid ReadKey call in this case, because # it fails with an error message. if (!$psISE) { Write-Host Read-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } ChangeMusicOnHold.ps1 To completely automate it you simply hard code the $filename variable. Link to comment Share on other sites More sharing options...
Pascal Barth1 Posted November 24, 2016 #3 Share Posted November 24, 2016 Hello Together, I solved it once with a Windows Service. The Service uses the CDS API for updating the Holdmusic. You can use although a folder where you place the .wav files. The Service reads this folder an puts the missing musicfiles into the database. You could configure a random or sequential row for the music. The service should look like this: Timeout(30 minutes)>Read Folder>Put missing Files to DB>Change musiconhold>start new Timer. Best regards Pascal Link to comment Share on other sites More sharing options...
Most Valued User KlausH Posted November 24, 2016 Author Most Valued User #4 Share Posted November 24, 2016 Hello, thanks for the answers. So I have set it up now: # Connect to the local SwyxServer via Windows Authentication Connect-IpPbx $Path = "C:\wav\" $fileName = "XMAS.wav" # Copy File into the database Import-IpPbxFile -Path $Path$fileName -Scope Global -Category HoldMusic -Overwrite -confirm:$false # Change the "Music On Hold" $globalConfigEntry = $Global:LibManager.GetGlobalConfigEntry() $globalConfigEntry.HoldMusicFile = $fileName $globalConfigEntry.Update($true) Via the task scheduler I start this script at a certain time. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.