On this page |
|
\uD83D\uDCCB What’s about
This group provides the capabilities to connect the IVR application with a remote DB Schema to perform queries and operations.
◾ Database
This box lets you perform a query to a DB schema. You must define a DB connection according to the instructions (please refer to the V3 ODBC section)
Label: here you can type e a brief description
Database: select the DB you want to connect to
Query: here you can perform a DB query (SQL statement)
Variable: here you can choose a variable from a pick-up list where you want to store the query results. Please, consider the variable to be a matrix where the columns are mapped to the fields you put in the SELECT clause of your SQL statement, and the rows are the records returned by the query. The first row is addressed with the 0 index and the next ones are addressed with 1, 2, etc, etc
Panel | ||
---|---|---|
| ||
Examples: the variable name is RESULT and the query is "SELECT order_num FROM orders" the query result will be saved into a matrix as follows: RESULT[0][order_num] RESULT[1][order_num] RESULT[2][order_num] RESULT[3][order_num] RESULT[n][order_num] |
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
Exit Arrows
This box provides just one arrow out to the next step
◾ SendMail
This box lets you send an email to a specified email address(es). Before using this block, please configure the email accounts under the Email channel or the SMTP section.
Label: here you can type a brief description
Account: select an email account you have configured under the Email channel or in the SMTP section.
To: Recipient email address. You can put multiple email addresses separated by a comma.
CC: Recipient in copy. You can put multiple email addresses separated by a comma.
Subject: Subject of the email.
Text: Body of the email. You can use channel variables to customize your text.
Exit Arrows
This box provides just one arrow out to the next step
Info |
---|
If you notice IVR hangs on Cally Square projects with a Send Mail block, you need to go in Cally Square projects with SendMail, place a new Send Mail block, copy parameters from old Send Mail block and place it instead of it. Disable “Wait for email to be sent” for avoiding the IVR to wait for STMP server response, which won’t return on STMP relay services |
◾SendSMS
This box lets you send a text message (SMS) to one recipient
Account: select an SMS account from the list you have configured.
To: recipient of the SMS
Info |
---|
The recipient number must be:
|
Text: body of the SMS (you can use channel variables to customize your text)
Exit Arrows
This box provides just one arrow out to the next step
◾ SestekNDA
Status | ||||
---|---|---|---|---|
|
Panel | ||
---|---|---|
| ||
|
Info |
---|
Remember: This software is managed by others. Check if it works properly. |
◾ RestAPI
This box allows you to use Restful API to GET, POST, PUT, DELETE data from external applications or sources (for example: ticketing systems, CRM, order systems, and so on). The result of the API request (Body) can also be stored in a Variable
Panel | ||
---|---|---|
| ||
|
Info |
---|
About REST API A RESTful API (REST is an acronym for Representational State Transfer) is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data: the client requests the server for the required information, via an API, and then, the server sends a response to the client. |
Label: here you can type a brief description
URL: request URL
Method: HTTP method (GET, POST, PUT or DELETE)
Timeout: request timeout (in seconds: it must be greater than 1 and the default value is 5)
Computed Variables Script Path: absolute path of a NodeJS script able to compute variables to pass in the URL, Headers and Bod
Headers: request headers (it must be in RAW JSON format, i.e. {"key": "value"})
Body: request body (it must be in RAW JSON format, i.e. {"key": "value"})
Variable: here you can choose a variable from a pick up list where you want to store the body of the response. The system will parse the body of the response and it will create a variable for each key-value pair using the format variable name + <key> (e.g. variablename.key, variablename.index.key or variablename.key[0].subkey if key is an array, and so on)
Custom script guidelines
You can valorize custom variables to use in you request using a nodejs script located on your server.
You can insert the absolute path to the script inside the Computed Variables Script Path input.
Remember to follow these important rules:
insert the absolute path to the file
write the path without quotes
the motion user must have both read and write and execution privileges on the js file (or it won't work once required).
The js script must be written in javascript ECMA5, and follow the NodeJs 6.x framework syntax based on this template:
Code Block |
---|
module.exports = function({options_object}){
// custom code
const variables = { code output as object }; // it must be an object, not an array
return variables
}
The script also receives the options you inserted in the restAPI block, including URL and method, so you can use them in the script if needed.
e.g.
const { URL } = require('url');
module.exports = function(options){
const request = options;
Const method = request.method;
const uri = request.uri;
const myURL = new URL(uri);
const host = myURL.host;
const hostname = myURL.hostname;
const href = myURL.href;
const pathname = myURL.pathname;
// etc...
// additional custom code
const variables = { code output as object };
return variables
} |
Variables and custom (script) variables
To include asterisk variables in your URL, you must include them in curly brackets.
e.g.
https://myurl.com?phone={CALLERID(num)}
The same apply if you want to include them in the body of your request, or in your headers ( pay attention to the quotes "").
e.g.
Code Block |
---|
{
"phone":"{CALLERID(num)}"
} |
To include custom (script) variables, you must include them in double dollar $$ symbols.
e.g.
Your script returns an object like this:
Code Block |
---|
{
key1: "value1",
key2: "value2"
} |
To use them in your URL you can write:
https://myurl.com?myvar1=$$key1$$&myvar2=$$key2$$
and it will be completed like this:
https://myurl.com?myvar1=value1&myvar2=value2
The same apply if you want to include them in the body of your request, or in your headers ( pay attention to the quotes "").
So, if your body/header object is written like this:
Code Block |
---|
{
"myvar1":"$$key1$$",
"myvar2":"$$key2$$"
} |
it will be completed like this:
Code Block |
---|
{
"myvar1":"value1",
"myvar2":"value2"
} |
NOTE: All special chars in the returned strings from the script are escaped ( e.g. the slash / character is translated to ', so if you want to avoid that you need to in clude an & symbol before the variable name:
e.g.
Code Block |
---|
{
"myvar1":"$$&key1$$",
"myvar2":"$$&key2$$"
} |
Built-in variables
We provide the following Asterisk channels variables named
variable name + _STATUS_CODE: shows the HTTP request status code
variable name + _STATUS_MESSAGE: shows the HTTP request status message
Example: RESULT_STATUS_CODE
Exit Arrows
This box provides just one arrow out to the next step
Related topics
Filter by label (Content by label) | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|