Jump to content

HoldMusic


KlausH

Recommended Posts

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


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


  • Most Valued User

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


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.