Module core_actions

Actions provided by Jester core.

This module provides actions that are closely tied to the core functionality of Jester.

Info:

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

Actions

api_command Execute a FreeSWITCH API command.
call_sequence Call a new sequence from the currently running sequence.
clear_storage Remove storage values from a given storage area.
conditional Call a new sequence based on a simple conditional check.
copy_storage Copy storage values from one storage area to another.
exit_sequence Registers a sequence to be executed on exit.
load_profile Load a profile dynamically.
none Dummy action which does nothing.
set_storage Set storage values in a given storage area.
set_variable Set channel variables.
wait Wait before performing the next action.


Actions

api_command
Execute a FreeSWITCH API command.

This action allows you to execute a FreeSWITCH API command, as if from the console command line. The command result is stored in the specified key.

  • action string api_command
  • command string The command to execute.
  • storage_key string (Optional) The key to store the command result under in the 'api_command' storage area. Default is 'result'.

Usage:

    {
      action = "api_command",
      command = "uptime",
      storage_key = "uptime_result",
    }
call_sequence
Call a new sequence from the currently running sequence.

This action calls a new sequence from the currently running sequence.

  • action string call_sequence
  • sequence string The new sequence to call. By default the original sequence is not resumed when the new sequence completes. To resume the old sequence (effectively making the new sequence a subroutine of the original), prefix the sequence with 'sub:'. See Subroutines for more information.

Usage:

    {
      action = "call_sequence",
      sequence = "foo_sequence arg1",
    }
    -- or...
    {
      action = "call_sequence",
      sequence = "sub:foo_sequence arg1,arg2",
    }
clear_storage
Remove storage values from a given storage area.

This action removes key/value pairs from the given storage area.

  • action string clear_storage
  • data_keys tab (Optional) A table of keys to remove from the storage area. If this parameter is not given, then the entire storage area is cleared, use caution!
  • storage_area string (Optional) The area to clear. Defaults to 'default'.

Usage:

    {
      action = "clear_storage",
      data_keys = {
        "key1",
        "key2",
      },
      storage_area = "someplace",
    }
conditional
Call a new sequence based on a simple conditional check.

This action allows simple comparison of a value against another value, and can call another sequence based on if the comparison returns true or false. It's really only meant for fairly simple sequence logic -- for more complex logic see Advanced tricks for more information.

  • action string conditional
  • compare_to string The value that you expect it to be, or for pattern matching, any valid Lua pattern (see the Lua manual for more information on Lua patterns).
  • comparison string (Optional) The kind of comparison to perform. Valid values are "equal", "match", "greater_than", and "less_than". Default is "equal".
  • if_false string (Optional) The sequence to call if the comparison is false.
  • if_true string (Optional) The sequence to call if the comparison is true.
  • value string The value that you want to compare.

Usage:

    {
      action = "conditional",
      value = number_of_messages,
      compare_to = 0,
      comparison = "equal",
      if_true = "exit",
      if_false = "play_messages",
    }
    -- or...
    {
      action = "conditional",
      value = name,
      compare_to = "^bob",
      comparison = "match",
      if_true = "its_bob",
      if_false = "not_bob",
    }
copy_storage
Copy storage values from one storage area to another.

This action performs a complete copy of all keys in a storage area, placing them in the specified new storage area. Note that only basic data types (string, number, boolean) are copied -- all others are ignored.

  • action string copy_storage
  • copy_to string The storage area to copy the data to. Note that any data already existing in this area will be removed prior to the copy.
  • move bool (Optional) If set to true, clears the data from the original storage area, which effectively makes the operation a move. Default is false.
  • storage_area string (Optional) The area to copy. Defaults to 'default'.

Usage:

    {
      action = "copy_storage",
      copy_to = "new_place",
      move = true,
      storage_area = "old_place",
    }
exit_sequence
Registers a sequence to be executed on exit.

This action registers a sequence to be executed after Jester has finished running all sequences related to the active call. Channel variables and storage values are available when the registered sequence is run.

Sequences registered here are run before the sequences registered on hangup, and are always run, regardless if the user actively hung up the call. If you want to guarantee that the sequence will run regardless of user hangup, it's best to put it here instead of in the hangup loop.

  • action string exit_sequence
  • sequence string The sequence to execute.

See also:

Usage:

    {
      action = "exit_sequence",
      sequence = "perform_maintenance",
    }
load_profile
Load a profile dynamically.

This action allows you to load a profile dynamically from within a sequence. This can be useful for loading a 'heavier' profile only when needed from within a 'lighter' profile.

  • action string load_profile
  • profile string The new profile to load.
  • sequence string (Optional) A sequence to execute after loading the profile. If this is provided, any running sequences in the current loop will be discarded, and this sequence will be run from the top of a new sequence stack.

Usage:

    {
      action = "load_profile",
      profile = "another_profile",
      sequence = "start",
    }
none
Dummy action which does nothing.

This action is just a placeholder. It can be used to skip taking any action, or to provide a way to call another sequence without taking any other action.

Usage:

    {
      action = "none",
    }
set_storage
Set storage values in a given storage area.

This action sets key/value pairs in the given storage area.

  • action string set_storage
  • data tab A table of data to store in the storage area. Keys are the storage keys, values are the storage values.
  • storage_area string (Optional) The area to store the value in. Defaults to 'default'.

Usage:

    {
      action = "set_storage",
      data = {
        foo = "bar",
        baz = "bang",
      },
      storage_area = "some_storage",
    }
set_variable
Set channel variables.

This action sets FreeSWITCH channel variables on the channel that Jester is currently running.

  • action string set_variable
  • data tab A table of channel variables to set. Keys are the variable names, values are the variable values.

Usage:

    {
      action = "set_variable",
      data = {
        foo = "bar",
        baz = "bang",
      },
    }
wait
Wait before performing the next action.

This action causes Jester to wait before continuing on. Silence is streamed on the channel during the wait period.

  • action string wait
  • keys tab (Optional) See keys documentation.
  • milliseconds int The number of milliseconds to wait.

Usage:

    {
      action = "wait",
      keys = profile.some_keys_setting,
      milliseconds = 3000,
    }
generated by LDoc 1.4.6 Last updated 2018-11-07 21:33:15