Mod abstraction

From FreeSWITCH Wiki
Jump to: navigation, search


Warning

Superseded by https://confluence.freeswitch.org/display/FREESWITCH/mod_abstraction

 


mod_abstraction provide an abstraction to API call(and more in the future).

Contents

Description

It simply link an new API function to another using a regex parser to adapt the provided arguments. It allow for simplified, standardize, script replacement api.

Example Usage

Here a few example:

  • tts_path(<text>) could be rewritten to python(tts2wav <text>)
  • user_password(<id>) could be rewritten to user_data(<id> param password)

Security

With mod_event_socket per user API restriction, this can be useful to limit capability a user can have over some API command by restricting certain parameters a user can do.

Configuration

reload

You MUST do a reload mod_abstraction when changing the XML to add or remove new API, or else, they wont be created/removed. For the destination settings and parsing, it can be changed in real time.

api

This define what API link should be created and what to do once executed.

<api name="user_name" description="Return Name for extension" syntax="<exten>" parse="(.*)" destination="user_data" argument="$1@default var effective_caller_id_name"/>
  • name - API name
  • description - API description
  • syntax - API Syntax
  • parse - Regex parsing the original argument provided
  • destination - The API name of the final api execution
  • argument - Format for the argument sent to the final API. You can use $1 $2 $3... from the () result of the parse regex