Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Операторы

if

Оператор if управляет условным ветвлением.

Code Block
    {
        "if": {
            "expression": "${myVar} == '1'",
            "then": [],
            "else": []
        }
    }

switch

Операторы switch и case помогают управлять сложными условными операциями и операциями ветвления.

Code Block
  {
    "switch": {
      "variable": "${getIvrDigit}",
      "case": {
        "1": [],
        "2": [],
        "3": [],
        "default": []
      }
    }
  }

while

Логика работы такая же, как и в языках программирования. Первый раз аппликейшены в блоке [do] выполняются без проверки условия. Последующие разы выполняются только если условие истинно.

Code Block
  {
    "while": {
        "condition": "${myVar} < 10",
        "maxSteps": "1000",
        "do": [
            {
                "log": "log is ${myVar}"
            },
            {
                "js": {
                    "data": "+${myVar} + 1",
                    "setVar": "myVar"
                }
            }
        ]
    }
}

condition - условие, написанное с учетом синтаксиса js;

maxSteps -глобальный параметр отвечает за максимальное количество шагов в непосредственно блоке (сделано для того чтобы если где-то дальше например в конце схемы цикл будет снова вызван из goto то схема не зациклилась) если не указывать по умолчанию будет 1000;

do – массив аппликейшенов, которые будут выполняться в цикле.

Триггеры

disconnected

Выполняет набор приложений после завершение основного скрипта. Объявляется единожды вначале скрипта.

Code Block
{
   "trigger": {
       "disconnected": []
    }
}

Функции

function

Объединить набор приложений в именную функцию. Объявляется вначале скрипта

commands

Commands влиять пока только на все recvMessage в схеме, если будет выполнена команда, тогда recvMessage таймаут обновляется.

Code Block
{
        "functiontrigger": {
            "namecommands": "myFunction",
{
          "actions      "/queue": []
        }
}

execute

Выполнение предварительно объявленной функции по имени.

Code Block
{
       "execute": {
    {
     "name": "myFunction"
     }
}

Переменные

set

Назначение переменных на канал.

Code Block
{
    "set": {
        "hangup_after_bridgesendText": "truequeue",
        "ivrLang": "en"
            }
}

export

Экспорт переменных на сторону оператора, а также в статистику.

Code Block
       {
        "export": [
 ],
                "reverted_caller_id_number"
/show map": [
          ]
    },

unSet

Разустанавливает переменную.

Code Block
      {
      "unSet": [
        "reverted_caller_id_number"
     ]
}

Служебные приложения

calendar

Приложение позволяет проверить текущее время с рабочим календарем. Значение сохраняется в переменную.

Code Block
{
    "calendarsendText": {"map"
        "extended": false,
           "name": "WorkDay", }
        "setVar": "isWorkDay"
        }
}

httpRequest

Выполнение HTTP REST запроса и обработка результата (get JSON)

Code Block
{
],
     "httpRequest": {
          "press button "url1": "https://sales.bpmonline.com/${id}/dataservice/json/reply/SelectQuery",[
            "method": "POST",
          {
          "timeout": 1000,
			"insecureSkipVerify": false,
            "parsersendText": "application/jsonbutton",
             "responseCode": "http_response_code",
       }
       "headers": {
        ]
        "Content-Type":"application/json",
    },
            "Cookiedisconnected": "${my_cookie}"[
            },
    {
        "path": {
           "dump": true
    "id": 0
            },
            "data": {]
        }
        "Name": "Supervisor"},
     {
           "UserIDsendText": "Supervisorstart"
            },
    {
        "exportVariablesrecvMessage": {
                "effective_caller_id_nameset": "callerIdNameтекст",
                "owner_caller_id_number": "callerIdOwner"
 "timeout": 20
           }
    },
}

js

   

Функции

function

Объединить набор приложений в именную функцию. Объявляется вначале скрипта.Выполнение произвольного JavaScript кода с возвращением результата в переменную

Code Block
{
    "jsfunction": {
        "dataname": "myFunction"var,
 time = LocalDate(); time.setDate(time.getDate() + (+${dpd}*-1)); return time.getMonth() + '-' + time.getDate() + '-' + time.getFullYear()",
     "actions": []
    }
}

execute

Выполнение предварительно объявленной функции по имени.

Code Block
{
     "execute": {
         "setVarname": "myVarmyFunction"
     }
}

math

Переменные

set

Назначение переменных на канал.Приложение для работы с математическими функциями

Code Block
{
    "mathset": {
      "data  "hangup_after_bridge": "${caller_id_array}true",
        "setVarivrLang": "new_random_caller_id",
"en"
    }
}

export

Экспорт переменных на сторону оператора, а также в статистику.

Code Block
    {
        "fnexport": "random"
[
            "reverted_caller_id_number"
        }
}

fn

  • random: returns a random number from array
  • min and max: can be used to find the lowest or highest value in a list of arguments
  • round: rounds a number to the nearest integer
  • ceil: rounds a number up to the nearest integer
  • floor: rounds a number down to the nearest integer

JavaScript Math

string

]
    },

unSet

Разустанавливает переменную.

Code Block
{
     "unSet": [
        "reverted_caller_id_number"
     ]
}

Служебные приложения

calendar

Приложение позволяет проверить текущее время с рабочим календарем. Значение сохраняется в переменнуюПриложение для работы со строкой.

Code Block
{
    "stringcalendar": {
        "dataextended": "${caller_id_number}"false,
        "fnname": "replaceWorkDay",
        "setVar": "reverted_caller_id_number",
  		"args": isWorkDay"
   }
}

cache

Приложение позволяет работать с данными в памяти либо Redis сервере.

Code Block
[
    {
        "/^0/",cache": {
            "+84"action": "set",
        ],
     }
}

fn

  • length: returns the length of a string
  • indexOf and lastIndexOf: returns the index of (the position of) the first or last occurrence of a specified text in a string
  • search: searches a string for a specified value and returns the position of the match
  • slice: extracts a part of a string and returns the extracted part in a new string
  • substring: is similar to slice. The difference is that substring cannot accept negative indexes.
  • substr: is similar to slice. The difference is that the second parameter specifies the length of the extracted part.
  • replace: replaces a specified value with another value in a string
  • toUpperCase or toLowerCase: A string is converted to upper case or to lower case
  • charAt: returns the character at a specified index (position) in a string
  • charCodeAt: returns the unicode of the character at a specified index in a string
  • split: A string can be converted to an array with the split function
  • reverse: Reverse the provided string
  • base64: base64 encoder / decoder
  • MD5: Computes a digest from a string using MD5 algorithm
  • SHA-256: Computes a digest from a string using SHA-256 algorithm
  • SHA-512: Computes a digest from a string using SHA-512 algorithm

JavaScript String

markIVR

Позволяет сохранить массив значений в переменную, которая будет доступна в истории

    "set": {
                "data": {
                    "key": "value"
                },
                "ttl": "10000"
            },
            "type": "memory"
        }
    },
    {
        "cache": {
            "action": "get",
            "get": {
                "myVar": "key"
            },
            "type": "redis"
        }
    },
    {
        "cache": {
            "action": "delete",
            "delete": {
                "keys": [
                    "key",
                    "key1"
                ]
            },
            "type": "redis"
        }
    }
]

httpRequest

Выполнение HTTP REST запроса и обработка результата (get JSON)

Code Block
{
    "httpRequest": {
            "url": "https://sales.bpmonline.com/${id}/dataservice/json/reply/SelectQuery",
            "method": "POST",
            "timeout": 1000,
			"insecureSkipVerify": false,
            "parser": "application/json",
            "cacheCookie": false,
            "responseCode": "http_response_code",
            "headers": {
                "Content-Type":"application/json",
                "Cookie": "${my_cookie}"
            },
            "path": {
                "id": 0
            },
            "data": {
                "Name": "Supervisor",
                "UserID": "Supervisor"
            },
            "exportVariables": {
                "effective_caller_id_name": "callerIdName",
                "owner_caller_id_number": "callerIdOwner"
            }
    }
}

js

Выполнение произвольного JavaScript кода с возвращением результата в переменную

Code Block
{
   "js": {
     "data": "var time = LocalDate(); time.setDate(time.getDate() + (+${dpd}*-1)); return time.getMonth() + '-' + time.getDate() + '-' + time.getFullYear()",
     "setVar": "myVar"
   }
}

math

Приложение для работы с математическими функциями

Code Block
{
    "math": {
      "data": "${caller_id_array}",
      "setVar": "new_random_caller_id",
      "fn": "random"
    }
}

fn

  • random: returns a random number from array
  • min and max: can be used to find the lowest or highest value in a list of arguments
  • round: rounds a number to the nearest integer
  • ceil: rounds a number up to the nearest integer
  • floor: rounds a number down to the nearest integer

JavaScript Math

string

Приложение для работы со строкой.

Code Block
{
    "string": {
       "data": "${caller_id_number}",
       "fn": "replace",
       "setVar": "reverted_caller_id_number",
  		"args": [
            "/^0/",
            "+84"
        ],
     }
}

fn

  • length: returns the length of a string
  • indexOf and lastIndexOf: returns the index of (the position of) the first or last occurrence of a specified text in a string
  • search: searches a string for a specified value and returns the position of the match
  • slice: extracts a part of a string and returns the extracted part in a new string
  • substring: is similar to slice. The difference is that substring cannot accept negative indexes.
  • substr: is similar to slice. The difference is that the second parameter specifies the length of the extracted part.
  • replace: replaces a specified value with another value in a string
  • toUpperCase or toLowerCase: A string is converted to upper case or to lower case
  • charAt: returns the character at a specified index (position) in a string
  • charCodeAt: returns the unicode of the character at a specified index in a string
  • split: A string can be converted to an array with the split function
  • reverse: Reverse the provided string
  • base64: base64 encoder / decoder
  • MD5: Computes a digest from a string using MD5 algorithm
  • SHA-256: Computes a digest from a string using SHA-256 algorithm
  • SHA-512: Computes a digest from a string using SHA-512 algorithm

JavaScript String

markIVR

Позволяет сохранить массив значений в переменную, которая будет доступна в истории

Code Block
{
    "markIVR": {
        "name": "Log",
        "value": "Входящий звонок"
    }
}

userInfo

Приложение позволяет получить значение из объекта пользователя по номеру телефона

Code Block
{
    "userInfo": {
        "set": {
            "usrId": "id",
            "email": "email",
            "mob": "variables.fwd_mob",
            "out": "variables.out_cid"
        },
Code Block
{
    "markIVR": {
        "nameuser": "Log",{
            "valueextension": "Входящий звонок"${ext}"
        }
    }
}

userInfo

setGrantee

Передать права на канал пользователю с идентификатором указанным в id Приложение позволяет получить значение из объекта пользователя по номеру телефона

Code Block
{
    "userInfosetGrantee": {
        "setid": {10
    }
}

schema

Выполнить внешнюю схему по идентификатору

Code Block
{
        "usrIdschema": "id",
     {
       "mob": "variables.fwd_mob",
    "id": 1
    }
}

softSleep

Пауза выполнения скрипта в миллисекундах 

Code Block
{
    "outsoftSleep": "variables.out_cid"
    1000
}

sql

Приложение доступно исключительно для выделенных либо собственных серверов Webitel, позволяет выполнить запрос в базу данных и вернуть результат в переменную

Code Block
[
    },{
        "usersql": {
            "extensiondns": "${ext}"admin:123Webitel4@tcp(database-1.cluster-cnvuzqnsxvyv.eu-central-1.rds.amazonaws.com:3306)/mysql",
        }
    }
}

setGrantee

Передать права на канал пользователю с идентификатором указанным в id 

Code Block
{"driver": "mysql",
   "setGrantee         "params": {[
       "id": 10
    }
}

schema

Выполнить внешнюю схему по идентификатору

Code Block
{
    "schemadb":
   {
        "id": 1
 ],
     }
}

softSleep

Пауза выполнения скрипта в миллисекундах 

Code Block
{
       "softSleepquery": 1000
}

sql

Приложение доступно исключительно для выделенных либо собственных серверов Webitel, позволяет выполнить запрос в базу данных и вернуть результат в переменную

Code Block
[
    {
        "sql": { "select 1 as tst_number, true as tst_bool, table_name, last_update from mysql.innodb_index_stats where table_name = ? order by rand() limit 1"
        }
    "dns": "admin:123Webitel4@tcp(database-1.cluster-cnvuzqnsxvyv.eu-central-1.rds.amazonaws.com:3306)/mysql"},
    {
        "driversql": "mysql",{
            "paramsdns": [
    "user=webitel password=webitel host=10.9.8.111 dbname=webitel sslmode=disable",
            "db"driver": "postgres",
            ],
"params": [
                "query": "select 1 as tst_number, true as tst_bool, table_name, last_update from mysql.innodb_index_stats where table_name = ? order by rand() limit 1"
        }
    }12
            ],
            "query": "select user_id from call_center.cc_agent where id = $1",
    {
        "sqltimeout": {5000
        }
    "dns": "user=webitel password=webitel host=10.9.8.111 dbname=webitel sslmode=disable",
    }
]

list

Проверка на наличие абонента в списке с выполнением действий

Code Block
{
    "list": {
        "drivername": "postgresStopList_Chat_bot",
            "paramsdestination": ["${user}",
        "actions": [
       12
     {
       ],
            "querysendText": "select user_id from call_center.cc_agent where id = $1BAN: ${from} ⛔️",
                "timeoutbreak": 5000true
            }
        ]
    }
]} 
list

listAdd

Проверка на наличие Добавить абонента в списке с выполнением действийсписок

Code Block
{
    "list "listAdd": {
         "destination": "${caller_id_number}",
         "namedescription": "StopList${caller_Chatid_botname}",
	      	  "destinationexpireAt": "${userexpired_at}",
         "actionslist": [{
            {
  "id": 16
         }
   "sendText": "BAN: ${from} ⛔️", }
}

log

Вывод дополнительной информации в лог файл приложений

Code Block
{
     "log": " >>     ${Hold} <<<"
}

goto

Перейти к именной метке

Code Block
{
    "breakgoto": "tagName"
}

monoPay

Перейти к именной метке

Code Block
{true
   "monoPay":{
         }
"invoice":{
         ]"action":"create",
    }
} 

listAdd

Добавить абонента в список

Code Block
{
     "listAddbody": {
            "destinationamount": "${caller_id_number}"1",
            "descriptionpaymentType": "${caller_id_name}"debit",
            "listsetVar": {"monoInvoice",
              "idvalidity": 16"3600"
         }
      }
}

log

Вывод дополнительной информации в лог файл приложений

Code Block
{,
     "log": " >> ${Hold} <<<"
}

goto

Перейти к именной метке

Code Block
{
    "goto": "tagNametoken":"uLRpgdn9yE5JP11NuXVqdvWpKk6TbSiQnquzS2BxtiCw"
}

Параметры приложений

Данные приложения могут вызываться как самостоятельно, так и как параметр другого приложения.

tag

Установить именную метку в скрипте

Code Block
{
    "tag": "tagName"
}

async

Выполнение приложения без блокировки

Code Block
 {
     "async": true
 }

break

Прерывает выполнение скрипта

Code Block
 {
     "break": true
 }

limit

Позволяет прерывать цикл после прохождения количества указанного в атрибуте max. Выход осуществляется в именную метку, указанную в атрибуте failover.

Code Block
 {
    "limit": {
     "max": 5,
     "failover": "anotherTag"
  }
}


Table of Contents