Music
![]() |
Used to play built-in music files from the platform, typically for hold music in a Queue or Holding scenario. Allows you to choose a starting position and play time. Does not work with custom files of any kind. Agent cannot ever hear a music action, it only plays audio to the caller. Does not work after onAnswer unless the onHold event has fired. |
Supported Script Types
![]() |
Phone |
Properties
Property | Details |
---|---|
MusicFile | Allows you to select a pre-recorded music file to be played by the action. Studio includes 20 different music files, in WAV format, from which to choose. If you want to play a music file that you have uploaded, you can do so by using the Playlog action instead. |
StartOffset | Allows you to configure music to resume from the point at which it was interrupted. For example, you play a music file for 30 seconds, followed by a 5 second pause. Setting this property to 31 causes music playback to continue from where it stopped instead of starting over at the beginning of the file. The default value for this property is 0, which causes the file to replay from the beginning each time. There is no maximum value, but if you enter a value greater than the length of the music file, the file also resumes play at the beginning each time. |
SecondstoPlay |
Allows you to set the amount of time the script plays the WAV file. The default value is 0. The OnComplete branch is taken when a WAV file is played from start to finish. If the value is 0, the file plays from start to finish. If you enter a value greater than the duration of the file, this branch will be taken as the file is able to play from start to finish. The Default branch is taken when a number is entered in this property that is greater than 0 and less than the total duration of the WAV file. |
InterruptMessages |
Allows you to enter a string expression that periodically interrupts music with one or more short messages in the form of .wav files. Your expression, as shown in the following example, should use this syntax: Name of message file;SecondsToPlay. Message1.wav;45 Message2.wav;60 Message3.wav;60 While this method works, it can cause issues. For example, if a message is later re-recorded and is longer than the original message, it is possible for one message to begin playing before the previous message has finished. Therefore, the preferred method to play music interrupted by periodic messages is to alternate Music actions with Playlog actions that provide the appropriate messages or prompts. |
RepeatIndex | When the list of messages you have set in the InterruptMessages property has finished running, you can use this property to repeat the messages again. |
DetectDTMF |
Determines whether DTMF![]() |
ClearDigits | When a contact presses a key on their telephone keypad, the generated DTMF tone is stored in a buffer. When the ClearDigits property is set to True (the default value), that buffer is cleared when the action begins. Otherwise, the action would immediately detect a DTMF tone and invoke the OnDigit or OnDTMF branch even if the key press was associated with an earlier action. |
Branches
Branch | Details |
---|---|
Default |
Path taken unless the script meets a condition that requires it to take one of the other branches. It is also taken if the other branches are not defined. |
OnComplete | Path taken if your selected MusicFile finishes playing. |
OnPaused | This path is not currently used. |
OnDigit | Path taken if DTMF detection is set to True and the contact presses a key during the action. |
Tips & Tricks
- You should never loop a Music action back on itself (that is, connect a Music action to itself with no other action in between).
Similar Solutions
Music, Play, Playlog, and Whisper are similar actions that are best used in different scenarios. The main differences are:
- TTS capabilities, including the use of variables
- Selecting a starting position and play time
- If the agent, contact, or both can hear what is played
- Events that affect when the action can/will fire
- Custom or CXone-provided WAV files
Phone Script Example Using Music
In this partial script example, music is played while the contact waits for an agent to take the call. After music plays for the period established in the SecondstoPlay property, the Wait action introduces a pause before the music resumes. The Music action has been renamed, using the Caption property, to indicate the .wav file specified in the MusicFile property (CruisingJazz.wav).
You could alternatively use the Playlog action instead of the Wait action, as described previously.
Would you like to download this example?