Skip to main content

mod_abstraction

About

mod_abstraction links a new API function to another using a regular expression parser to adapt the provided arguments. It allows for simplified, standardized script replacement API.

You MUST reload mod_abstraction when changing the XML to add or remove an API, or else they won't be created or removed. Destination settings and parsing can be changed in real time.

Usage

This defines 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

Security

With mod_event_socket per-user API restriction, this can be useful to limit the capabilities a user can have over some API commands by restricting certain parameters a user can do.

Examples

Here are 2 examples:

tts_path(<text>) could be rewritten to python(tts2wav <text>)

user_password(<id>) could be rewritten to user_data(<id> param password)

Comments:

Shouldn't the XML attribute syntax be escaped since it contains < and > to be valid? If so, would the below be correct? <api name="user_name" description="Return Name for extension" syntax="<exten>" parse="(.*)" destination="user_data" argument="$1@default var effective_caller_id_name"/> Posted by wralphcook at Jun 14, 2015 11:23