Remember all the variables must be previously defined in the Tools section (see Variables for details) or inside the IVR project using the menu file -> Variable
Syntax
The variable format is slightly different from the Asterisk one.
It must be written as:
DO NOT use the $ character before the {}.
Asterisk channel variables list
see https://wiki.asterisk.org/wiki/display/AST/Asterisk+Standard+Channel+Variables for Asterisk Standard Channel Variables
Set a variable
The common operation is set a value to a variable. The value can be a constant (string, number, etc.) or another variable (Asterisk variables or custom variables).
Example: the usual Asterisk variable ${CALLERID(num)} MUST be defined just as {CALLERID(num)} in the Cally Square environment.
The variable {CALLER_NUMBER} now contains the caller number
DB Query Result
Using the IVR Blocks DATABASE you need to specify the variable where the query result will be saved.
For example, we want to retrieve the customer name from the orders table where the order number is previously inserted by the caller.
The result set is stored into a matrix as:
{VARIABLENAME[row][column name]}
that is
The first row has the index 0 (zero)
Asterisk Dialplan Functions
Using the Asterisk dialplan functions can be useful to get some information about the agents or queue status before to send the calls to a queue.
An example about using function is:
In the GOTOIF block we run a function to get the number of the current waiting calls in the queue.
If there are more than 5 waiting calls. the new callers will hear a message (playback block) that invite them to call later.
Here is the function we used into the GOTOIF block:
{QUEUE_WAITING_COUNT(queuename)} >= 5
** replace "queuename" with the name of the queue you want to check.
Asterisk dialplan functions list
see https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Dialplan+Functions for Standard Asterisk Dialplan Functions
Javascript Methods
CallySquare is able to manage also the javascript methods.
For example, we need to check the caller prefix in order to send the call to the correct queue (local or UK callers)
The GOTOIF condition is:
'{CALLER_NUMBER}.substr(0,4) == 0044'
Javascript string methods
see http://www.w3schools.com/jsref/jsref_obj_string.asp for JavaScript String Methods
Array Handler
With the MATH block we are able to execute mathematical operations, javascript methods (as described in the previous section) and handle an array of values.
Example:
A variable called INPUT_DATA contains a separated string:
John,Doe,998,john.doe@xcally.com
We want to set each value to a different variable ({FIRST_NAME}, {LAST_NAME},{EXTENSION},{EMAIL})
'{INPUT_DATA}'.split(",")
FIRST_NAME = {RESULT[0]} (John)
LAST_NAME = {RESULT[1]} (Doe)
EXTENSION = {RESULT[2]} (998)
EMAIL = {RESULT[3]} (john.doe@xcally.com)