Module play

Play sounds on a channel.

This module provides actions for playing various sounds on a channel.

Info:

  • Copyright: 2011-2015 Chad Phillips
  • Author: Chad Phillips

Actions

play Play something on the channel.
play_keys Play a series of key press choices on the channel.
play_phrase Play a phrase macro.
play_valid_file From a list of files, play the first valid file found.

Handlers

file The file handler (default).


Actions

play
Play something on the channel.
  • action string play
  • file tab The name of the resource to play. It should be:

     1. A full file path
     2. A relative file path from the FreeSWITCH 'sounds' directory
     3. A phrase prefixed with 'phrase:'
    

    To play a single file, a string can be passed. To play several files together in a group, pass a table of names instead.

    Jester uses an ampersand (&) as the default delimiter for playback of mulitple files; to override this, set the 'playback_delimiter' variable in either the global or profile configuration file.

  • keys tab (Optional) See Capturing user key input.
  • repetitions int (Optional) How many times to repeat the file(s). Default is 1.
  • wait int (Optional) How long to wait between repetitions, in milliseconds. Default is no wait.
  • handler string The handler to use, see handlers. If not specified, defaults to the default handler for the module.

Usage:

    {
      action = "play",
      file = {
        "/tmp/foo.wav",
        "bar.wav",
        "phrase:goodbye",
      },
      keys = profile.play_keys,
      repititions = 3,
      wait = 2000,
    }
play_keys
Play a series of key press choices on the channel.

This action allows you to map key press choices to announcements about what each key press will do, and play these announcements in a set order on the channel.

Keys are mapped both to actions, and to phrases in the FreeSWITCH phrase engine. The phrases receive the mapped key as an argument.

You use this alongside of the standard 'keys' parameter to provide 'Press 1 for this, press 2 for that' menu selections.

The order that the announcements are made can be customized.

  • action string play_keys
  • key_announcements tab A table similar to the 'keys' table, with the value for each key being the name of a FreeSWITCH phrase macro to play for the key announcement.
  • keys tab (Optional) See Capturing user key input.
  • order tab (Optional) A list of keys representing the order to play the announcements in. If not provided, then the default order from the profile or from the global configuration is used.
  • repetitions int (Optional) How many times to repeat the file(s). Default is 1.
  • wait int (Optional) How long to wait between repetitions, in milliseconds. Default is no wait.

Usage:

    {
      action = "play_keys",
      key_announcements = {
        ["4"] = "play_previous",
        ["6"] = "play_next",
        ["#"] = "exit",
      },
      keys = {
        ["4"] = "previous_sequence",
        ["6"] = "next_sequence",
        ["#"] = "exit_sequence",
      },
      order = {"6", "4", "#"}
      repititions = 3,
      wait = 2000,
    }
play_phrase
Play a phrase macro.

This action plays a FreeSWITCH phrase macro on the channel.

  • action string play_phrase
  • keys tab (Optional) See Capturing user key input.
  • language string (Optional) Language to play the phrase in. Defaults to the language set on the channel or the default global language.
  • phrase string The name of the phrase macro to play.
  • phrase_arguments string (Optional) Arguments to pass to the phrase macro, if any.
  • repetitions int (Optional) How many times to repeat the file(s). Default is 1.
  • wait int (Optional) How long to wait between repetitions, in milliseconds. Default is no wait.

Usage:

    {
      action = "play",
      keys = profile.play_keys,
      language = "en",
      phrase = "some_phrase",
      phrase_arguments = "arg1,arg2,arg3",
      repititions = 3,
      wait = 2000,
    }
play_valid_file
From a list of files, play the first valid file found.

This action checks a list of files in order, and plays the first valid file it finds from the list. Useful for playing a custom file, but falling back to default file. Note that for speed, only basic file existence is checked -- the file must be readable by the FreeSWITCH user.

  • action string play_valid_file
  • files tab A table of resources to check for possible playback on the channel. Values in the table should be:

     1. Full file paths
     2. Relative file paths from the FreeSWITCH 'sounds' directory
     3. A phrase prefixed with 'phrase:' (note that this will always be
        considered a valid file)
    

    List the files in the order you would prefer them to be searched.

  • keys tab (Optional) See Capturing user key input.
  • repetitions int (Optional) How many times to repeat the file(s). Default is 1.
  • wait int (Optional) How long to wait between repetitions, in milliseconds. Default is no wait.
  • handler string The handler to use, see handlers. If not specified, defaults to the default handler for the module.

Usage:

    {
      action = "play_valid_file",
      files = {
        "/tmp/customgreeting.wav",
        "standardgreeting.wav",
        "phrase:invalid_entry",
      },
      keys = profile.play_keys,
      repititions = 3,
      wait = 2000,
    }

Handlers

file
The file handler (default).

The default handler for the play module, operates on files on the local filesystem.

Usage:

    {
      action = "play",
      handler = "file",
      -- other params...
    }
generated by LDoc 1.4.6 Last updated 2021-04-08 08:59:59