Tag \n"; echo " \n"; switch (htmlspecialchars($pconfig['tag'])) { case "condition": echo " \n"; echo " \n"; echo " \n"; //echo " \n"; break; case "action": echo " \n"; echo " \n"; echo " \n"; //echo " \n"; break; case "antiaction": echo " \n"; echo " \n"; echo " \n"; //echo " \n"; break; case "param": echo " \n"; echo " \n"; echo " \n"; //echo " \n"; break; default: echo " \n"; echo " \n"; echo " \n"; //echo " \n"; } echo " \n"; //condition //field expression //action //application //data //antiaction //application //data //param //name //value ?>
Type
Data
 


Example

If the inbound call matches the DID 12085551234 then proceed to the action.

Tag:condition
Type:destination_number
Data:^(12085551234)$


Transfer the inbound call to an IVR with extension of 5000.

Tag:action
Application:transfer
Data:5000 XML default


Or transfer the inbound call to extension 1001.

Tag:action
Application:transfer
Data:1001 XML default




Conditions

Conditions are pattern matching tags that help FreeSwitch decide if the current call should be processed in this extension or not. When matching conditions against the current call you have several fields that you can compare against.
  • context
  • rdnis Redirected Number, the directory number to which the call was last presented.
  • destination_number Called Number, the number this call is trying to reach (within a given context)
  • public Name of the public module that are used, the name is provided by each public module. Example: XML
  • caller_id_name Name of the caller (provided by the User Agent that has called us).
  • caller_id_number Directory Number of the party who called (callee) -- can be masked (hidden)
  • ani Automatic Number Identification, the number of the calling party (callee) -- cannot be masked
  • ani2 The type of device placing the call [1]
  • uuid Unique identifier of the current call? (looks like a GUID)
  • source Name of the FreeSwitch module that received the call (e.g. PortAudio)
  • chan_name Name of the current channel (Example: PortAudio/1234). Give us examples when this one can be used.
  • network_addr IP address of the signalling source for a VoIP call.
In addition to the above you can also do variables using the syntax ${variable} or api functions using the syntax %{api} {args}

Variables may be used in either the field or the expression, as follows



Action and Anti-Actions

Actions are executed when the condition matches. Anti-Actions are executed when the condition does NOT match. Additional information on applications for Actions and Anti-Actions.
http://wiki.freeswitch.org/wiki/Modules#Applications
http://wiki.freeswitch.org/wiki/public_Functions


The following is a partial list of applications.
  • answer answer the call
  • bridge bridge the call
  • cond
  • db is a a runtime database either sqlite by default or odbc
  • global_set allows setting of global vars similar to the ones found in vars.xml
  • group allows grouping of several extensions for things like ring groups
  • expr
  • hangup hangs up the call
  • info sends call info to the console
  • javascript run javascript .js files
  • playback
  • reject reject the call
  • respond
  • ring_ready
  • set set a variable
  • set_user
  • sleep
  • sofia_contact
  • transfer transfer the call to another extension or number
  • voicemail send the call to voicemail