Note |
---|
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 |
Panel | ||
---|---|---|
| ||
|
Syntax
The variable format is slightly different from the Asterisk one.
It must be written as:
Panel | ||||
---|---|---|---|---|
| ||||
{VARIABLENAME} |
DO NOT use the $ character before the {}.
Info | ||
---|---|---|
| ||
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 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:
Panel | ||
---|---|---|
| ||
{VARIABLENAME[row][column name]} |
that is
Panel | ||
---|---|---|
| ||
{DBRESULT[0][customer_name]} |
The first row has the index 0 (zero)
Built-in variables
We provide the following Asterisk channels variables named
variable name + _ROWS_COUNT:shows the number of affected rows (only for SELECT statements).
Example: {RESULT_ROWS_COUNT}
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:
Panel | ||
---|---|---|
| ||
{QUEUE_WAITING_COUNT(queuename)} >= 5 |
** replace "queuename" with the name of the queue you want to check.
Info | ||
---|---|---|
| ||
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:
Panel | ||
---|---|---|
| ||
'{CALLER_NUMBER}.substr(0,4) == 0044' |
Info | ||
---|---|---|
| ||
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:
Panel | ||
---|---|---|
| ||
John,Doe,998,john.doe@xcally.com |
We want to set each value to a different variable ({FIRST_NAME}, {LAST_NAME},{EXTENSION},{EMAIL})
Panel | ||||
---|---|---|---|---|
| ||||
'{INPUT_DATA}'.split(",") |
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
FIRST_NAME = {RESULT[0]} (John) LAST_NAME = {RESULT[1]} (Doe) EXTENSION = {RESULT[2]} (998) EMAIL = {RESULT[3]} (john.doe@xcally.com) |
Page Properties | ||
---|---|---|
| ||
|