ApiExecute

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

Description

Executes an API (console) command.
(To execute a dialplan application, use session.execute.)

For a list of commands that can be executed with apiExecute, see the Command reference.

Synopsis

apiExecute(api command, arguments)
  • api command - the command to execute
  • arguments - the arguments that get passed

Example

apiExecute("show", "channels");
//Plays a sound file for everyone currently residing in conference room 1.
apiExecute("conference", "1 play /usr/local/freeswitch/sounds/myfile.wav");
//Using text to speech engine speaks to everyone in conference room 1.
apiExecute("conference", "1 say Hello there");

Notes

  • apiExecute() does not have the same object hierarchy as other methods exposed via mod_spidermonkey (it is not an extension of session).
  • api (console cli) commands can be executed via a workaround. The following will set myvar with the output of apicommand()
    execute("set","myvar=${apicommand()}")