mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-19 17:54:13 +00:00
mod_httapi.c -- HT-TAPI Hypertext Telephony API (Twillio FreeSWITCH style)
This commit is contained in:
1 parent
8950a78c41
commit
bc8cbee1fb
12 files changed
+3405
No files matched your search
@@ -0,0 +1,279 @@
|
||||
HT-TAPI Hyper-Text Telephony API and http file format plugin
|
||||
|
||||
This module provides an HTTP based Telephony API using a standard FreeSWITCH application interface as well as a cached http file format interface.
|
||||
|
||||
The file format plugin can be used like this:
|
||||
<action application="playback" data="http://some.com/sounds/foo.wav"/>
|
||||
|
||||
This syntax is valid anywhere a filname parameter is requested in FreeSWITCH.
|
||||
|
||||
|
||||
The application is called like this:
|
||||
|
||||
<action application="httapi" data="{url=http://some.host.com/app.cgi}"/>
|
||||
|
||||
The target url is expected to be a CGI returning text/xml using the documentation below.
|
||||
|
||||
The format is roughly as described below (We could use a DTD maybe).
|
||||
|
||||
<document type="xml/freeswitch-httapi">
|
||||
<params>
|
||||
<param name="" value=""/>
|
||||
</params>
|
||||
<variables>
|
||||
<variable name="" value=""/>
|
||||
</variables>
|
||||
<work>
|
||||
<...>
|
||||
</work>
|
||||
</document>
|
||||
|
||||
|
||||
The profile name must be chosen to bind to a preset series of settings and permissions to use as a basis for the client session.
|
||||
Its chosen from the specified params or from the channel variable using the keyname 'httapi_profile' and if not specified will default to 'default'
|
||||
Any params specified in the initial data of the application encased in brackets {} will be parsed into the initial params similar to originate.
|
||||
These params remain set until the call ends and are supplied as form elements on each hit to the HTTP server.
|
||||
If the permissions allow, a <params> tag is parsed from the resulting document and set into this data set and will be mirrored back on subsequqent http posts.
|
||||
Also if the permissions allow a <variables> tag is parsed the same way setting channel variables.
|
||||
The <work> tag is required and contains one or more of the supported command tags that generally manipulate the call behaviour.
|
||||
The application will continue to do the task in the work section until an error is encoutered or when an action from the work tag warrants it.
|
||||
If the session exits the httapi app without hanging up it can do other tasks and make another call to httapi and the session data will remain preserved.
|
||||
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
<document type="xml/freeswitch-httapi">
|
||||
<params></params>
|
||||
<work>
|
||||
<playback name="exten" file="http://my.com/sounds/exten.wav" error-file="http://my.com/sounds/invalid.wav" input-timeout="5000">
|
||||
<bind strip="#">~\d+#</bind>
|
||||
</playback>
|
||||
</work>
|
||||
</document>
|
||||
|
||||
BINDINGS
|
||||
Several of the work tags that indicate they support bindings can contain one of more bind tags that function with similar fashion to bind_digit_action
|
||||
|
||||
<bind action strip>*EXPR*</bind>
|
||||
|
||||
ATTRS:
|
||||
action : a specific url to go to next if the binding is dialed
|
||||
strip : a character to strip from in the result such as #
|
||||
|
||||
WORK TAGS:
|
||||
<work>*ACTIONS*</work>
|
||||
|
||||
|
||||
<playback file name error-file action digit-timeout input-timeout loops asr-engine asr-grammar><bind action strip>*EXPR*</bind></playback>
|
||||
: Plays a file and optionally collects input.
|
||||
|
||||
ATTRS:
|
||||
file : The file
|
||||
name : Param name to save result.
|
||||
error-file : Error file to play on invalid input.
|
||||
action : Change the new target url
|
||||
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
|
||||
input-timeout : Timeout waiting for more digits in a multi-digit input.
|
||||
loops : max times to play the file when input bindings are present.
|
||||
asr-engine : ASR engine to use
|
||||
asr-grammar : ASR grammar to use
|
||||
|
||||
|
||||
|
||||
|
||||
<record file name error-file action digit-timeout input-timeout><bind action strip>*EXPR*</bind></record>
|
||||
: Records a file, optionally collects input and posts the file back to the target url
|
||||
|
||||
ATTRS:
|
||||
file : The file
|
||||
name : Param name to save result.
|
||||
error-file : Error file to play on invalid input.
|
||||
action : Change the new target url
|
||||
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
|
||||
input-timeout : Timeout waiting for more digits in a multi-digit input.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<pause name error-file action digit-timeout input-timeout loops milliseconds><bind action strip>*EXPR*</bind></pause>
|
||||
: Waits for input for a specific amount of time.
|
||||
|
||||
ATTRS:
|
||||
milliseconds : Number of milliseconds to pause
|
||||
name : Param name to save result.
|
||||
error-file : Error file to play on invalid input.
|
||||
action : Change the new target url
|
||||
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
|
||||
input-timeout : Timeout waiting for more digits in a multi-digit input.
|
||||
loops : max times to play the file when input bindings are present.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<speak file name error-file action digit-timeout input-timeout loops engine voice><bind action strip>*EXPR*</bind></speak>
|
||||
: Read Text to Speech with optional input.
|
||||
|
||||
ATTRS:
|
||||
file : The file
|
||||
name : Param name to save result.
|
||||
error-file : Error file to play on invalid input.
|
||||
action : Change the new target url
|
||||
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
|
||||
input-timeout : Timeout waiting for more digits in a multi-digit input.
|
||||
loops : max times to play the file when input bindings are present.
|
||||
engine : tts engine to use.
|
||||
voice : tts voice to use.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<say file name error-file action digit-timeout input-timeout loops language type method gender><bind action strip>*EXPR*</bind></say>
|
||||
: Use the FS say engine to iterate sounds to similate a human speaker.
|
||||
|
||||
ATTRS:
|
||||
file : The file
|
||||
name : Param name to save result.
|
||||
error-file : Error file to play on invalid input.
|
||||
action : Change the new target url
|
||||
digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
|
||||
input-timeout : Timeout waiting for more digits in a multi-digit input.
|
||||
loops : max times to play the file when input bindings are present.
|
||||
language : language
|
||||
type : type (fs param)
|
||||
method : method (fs param)
|
||||
gender : gender (fs param)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<execute application>*DATA*</execute>
|
||||
: Execute a FreeSWITCH app.
|
||||
ATTRS:
|
||||
application : The app to run
|
||||
*DATA* : The app data
|
||||
|
||||
<sms to>DATA</sms>
|
||||
: Send a SMS message.
|
||||
ATTRS:
|
||||
to : The dest number
|
||||
*DATA* : The message data
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dial context dialplan caller-id-name caller-id-number>*DATA*</dial>
|
||||
: Place an outbound call or transfer.
|
||||
|
||||
ATTRS:
|
||||
context : Dialplan context.
|
||||
dialplan : Dialplan dialplan.
|
||||
caller-id-name : Caller ID Name.
|
||||
caller-id-number : Caller ID Number.
|
||||
*DATA* : Number to dial or originate string
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<recordCall limit name action>
|
||||
: begin recording the call. The file will be posted when the call ends.
|
||||
|
||||
ATTRS:
|
||||
limit : Timeout in seconds.
|
||||
name : Name to use for input values.
|
||||
action : URL action to use.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<conference profile>
|
||||
: Start a conference call.
|
||||
|
||||
ATTRS:
|
||||
profile : Conference profile to use.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hangup cause>
|
||||
: Hangup the call
|
||||
|
||||
ATTRS:
|
||||
cause : Hangup cause
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<break>
|
||||
: Exit the httapi application and continue in the dialplan.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<log level clean>
|
||||
: Exit the httapi application and continue in the dialplan.
|
||||
ATTRS:
|
||||
level : The log level to use.
|
||||
clean : If true do not pring log prefix.
|
||||
|
||||
|
||||
|
||||
|
||||
CONFIGURATION:
|
||||
|
||||
<settings>:
|
||||
<param name="" value="">
|
||||
debug : <true|false> false Print debug data
|
||||
file-cache-ttl : <number of sec> 300 How long to wait before checking the server to see if audio file has changed.
|
||||
file-not-found-expires : <number of sec> 300 How long to still preserve cached audio files that are not found by the server.
|
||||
|
||||
<profile name="<name>"> : CREATE NEW PROFILE TO REFERENCE BY NAME
|
||||
gateway-url : <string> "" Initial URL to connect to.
|
||||
gateway-credentials : <string> "" HTTP credentials.
|
||||
auth-scheme : <string > basic auth scheme to use. [basic|digest|NTLM|GSS-NEGOTIATE|any]
|
||||
disable-100-continue : <true|false> true Disable the 100 continue feature.
|
||||
method : <string> "" METHOD name to send.
|
||||
timeout : <number> 0 Timeout waiting for response.
|
||||
enable-cacert-check : <true|false> false Check CA/CERT.
|
||||
ssl-cert-path : <string> "" path to file.
|
||||
ssl-key-path : <string> "" path to file.
|
||||
ssl-key-password : <string> "" password to use.
|
||||
ssl-version : <string> "" ssl version
|
||||
ssl-cacert-file : <string> "" CA/CERT file.
|
||||
enable-ssl-verifyhost : <true|false> "" Verify ssl host.
|
||||
cookie-file : <string> "" Path to file to use for cookie.
|
||||
enable-post-var : <param_name> "" Specify specifc param names ok to send.
|
||||
bind-local : <string> "" Interface to bind to.
|
||||
default-profile : <string> default Profile to use when not specified.
|
||||
|
||||
|
||||
|
||||
<permissions>: * = default
|
||||
<permission name="" value="">
|
||||
|
||||
*set-params : <params> tag can be parsed for session params.
|
||||
set-vars : <variables> tag can be parsed to set channel vars.
|
||||
extended-data : Extended data is sent like full channel event data.
|
||||
execute-apps : <execute> tag is enabled to execute apps.
|
||||
expand-vars-in-tag-body : body content of tags are run trough variable expansion.
|
||||
*dial : <dial> tag is enabled allowing outbound dialing.
|
||||
dial-set-context : <dial context=""> context attribute is permitted.
|
||||
dial-set-dialplan : <dial dialplan=""> dialplan attribute is permitted.
|
||||
dial-set-cid-name : <dial cid_name=""> cid_name attribute is permitted.
|
||||
dial-set-cid-number : <dial cid_number=""> cid_number attribute is permitted.
|
||||
dial-full-originate : <dial> full originate syntax is permitted instead of just a number.
|
||||
*conference : <conference> tag is enabled allowing creation of conferences.
|
||||
conference-set-profile : <conference profile=""> attribure is permitted.
|
||||
all : all permissions are set
|
||||
none : no permissions are set
|
||||
|
||||
|
||||
Reference in new issue
Block a user