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": []
}
} |
commands
Commands влиять пока только на все recvMessage в схеме, если будет выполнена команда, тогда recvMessage таймаут обновляется.
Code Block |
---|
{ "trigger": { "commands": { "/queue": [], "/show map": [], { "press button 1": [] }, "sendText": "disconnectedqueue": [] } } |
Функции
function
Объединить набор приложений в именную функцию. Объявляется вначале скрипта.
Code Block |
---|
{ "function": { } "name": "myFunction", "actions": [] } } |
execute
Выполнение предварительно объявленной функции по имени.
Code Block |
---|
{], "execute": { "name/show map": "myFunction"[ } } |
Переменные
set
Назначение переменных на канал.
Code Block |
---|
{ "set": { "hangup_after_bridge": "true",{ "ivrLang": "en" } } |
export
Экспорт переменных на сторону оператора, а также в статистику.
Code Block |
---|
{ "sendText": "map" "export": [ } "reverted_caller_id_number" ], }, |
unSet
Разустанавливает переменную.
Code Block |
---|
{ "unSetpress button 1": [ "reverted_caller_id_number" ] } |
Служебные приложения
calendar
Приложение позволяет проверить текущее время с рабочим календарем. Значение сохраняется в переменную.
Code Block |
---|
{{ "calendar": { "extended": false, "namesendText": "WorkDay",button" "setVar": "isWorkDay" } } |
cache
Приложение позволяет работать с данными в памяти либо Redis сервере.
Code Block |
---|
[ { "cache": { ] "action": "set" }, "setdisconnected": {[ "data": { "keydump": "value"true }, ] "ttl": "10000" } }, { "typesendText": "memorystart" } }, { "cacherecvMessage": { "actionset": "getтекст", "gettimeout": {20 } }, "myVar": "key" |
Функции
function
Объединить набор приложений в именную функцию. Объявляется вначале скрипта.
Code Block |
---|
{ "function": { }, "name": "myFunction", "typeactions": "redis"[] } } } |
execute
Выполнение предварительно объявленной функции по имени.
Code Block |
---|
{ }, "execute": { { "cachename": "myFunction" } } |
Переменные
set
Назначение переменных на канал.
Code Block |
---|
{ "set": { "action "hangup_after_bridge": "deletetrue", "deleteivrLang": {"en" } } |
export
Экспорт переменных на сторону оператора, а также в статистику.
Code Block |
---|
{ "keysexport": [ "key","reverted_caller_id_number" ] }, |
unSet
Разустанавливает переменную.
Code Block |
---|
{ "key1unSet": [ "reverted_caller_id_number" ] } |
Служебные приложения
calendar
Приложение позволяет проверить текущее время с рабочим календарем. Значение сохраняется в переменную.
Code Block |
---|
{ "calendar": { }, "extended": false, "typename": "redisWorkDay", } "setVar": "isWorkDay" } ]} |
httpRequest
Выполнение HTTP REST запроса и обработка результата (get JSON)
cache
Приложение позволяет работать с данными в памяти либо Redis сервере.
Code Block |
---|
[ { "httpRequestcache": { "urlaction": "https://sales.bpmonline.com/${id}/dataservice/json/reply/SelectQuery",set", "set": { "method": "POST", "timeoutdata": 1000, "insecureSkipVerify": false,{ "parserkey": "application/json",value" "cacheCookie": false}, "responseCode": "http_response_code", "headersttl": {"10000" "Content-Type":"application/json", }, "Cookietype": "${my_cookie}memory" } }, { "pathcache": { "action": "get", "id": 0 "get": { }, "datamyVar": {"key" "Name": "Supervisor", }, "UserIDtype": "Supervisorredis" } }, { "exportVariablescache": { "effective_caller_id_name"action": "callerIdNamedelete", "delete": { "owner_caller_id_number": "callerIdOwner" "keys": [ } } } |
js
Выполнение произвольного JavaScript кода с возвращением результата в переменную
Code Block |
---|
{ "js": { "datakey":, "var time = LocalDate(); time.setDate(time.getDate() + (+${dpd}*-1)); return time.getMonth() + '-' + time.getDate() + '-' + time.getFullYear()", "key1" "setVar": "myVar" } } |
math
Приложение для работы с математическими функциями
Code Block |
---|
{ "math": { ] "data": "${caller_id_array}", "setVar": "new_random_caller_id" }, "fn": "random "type": "redis" } } ] |
fn
random
: returns a random number from arraymin
andmax
: can be used to find the lowest or highest value in a list of argumentsround
: rounds a number to the nearest integerceil
: rounds a number up to the nearest integerfloor
: rounds a number down to the nearest integer
string
Приложение для работы со строкой.
httpRequest
Выполнение HTTP REST запроса и обработка результата (get JSON)
Code Block |
---|
{ "httpRequest": { "string": { "dataurl": "https://sales.bpmonline.com/${caller_id_number}}/dataservice/json/reply/SelectQuery", "fnmethod": "replacePOST", "setVartimeout": "reverted_caller_id_number"1000, "argsinsecureSkipVerify": [false, "/^0/parser": "application/json", "+84cacheCookie": false, ] "responseCode": "http_response_code", } } |
fn
length
: returns the length of a stringindexOf
andlastIndexOf
: returns the index of (the position of) the first or last occurrence of a specified text in a stringsearch
: searches a string for a specified value and returns the position of the matchslice
: extracts a part of a string and returns the extracted part in a new stringsubstring
: is similar to slice. The difference is thatsubstring
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 stringtoUpperCase
ortoLowerCase
: A string is converted to upper case or to lower casecharAt
: returns the character at a specified index (position) in a stringcharCodeAt
: returns the unicode of the character at a specified index in a stringsplit
: A string can be converted to an array with thesplit
functionreverse
: Reverse the provided stringbase64
: base64 encoder / decoderMD5
: Computes a digest from a string usingMD5
algorithmSHA-256
: Computes a digest from a string usingSHA-256
algorithmSHA-512
: Computes a digest from a string usingSHA-512
algorithm
markIVR
Позволяет сохранить массив значений в переменную, которая будет доступна в истории "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"
}
} |
joinAgent
Постановка абонента в личную очередь оператора. Работает только для звонков.
Code Block |
---|
{
"joinAgent": {
"agent": {
"extension": "1008"
},
"processing": {
"sec": 30,
"form": {
"id": 604
},
"enabled": true,
"renewal_sec": 10
},
"queue_name": "${cc_queue_name}",
"cancel_distribute": false
}
} |
processing.form.id
- идентификатор формы. Если пусто, или 0 - без формы.
joinAgentToTask
Возможность из схемы оператору назначить таску (join task новая очередь task)
Code Block |
---|
{
"joinAgentToTask": {
"agent": {
"extension": "1008",
"id": "OR AGENT ID"
},
"communication": {
"description": "bla bla bla description",
"destination": "bla bla",
"type": {
"id": 1
}
},
"processing": {
"enabled": true,
"form": {
"id": 604
},
"renewal_sec": 10,
"sec": 30
},
"queue_name": "Igor test queue",
"timeout": 20
}
} |
Работает для всех типов схем.
agent.id
oragent.extension
- обязательные поля, на какого оператора нужно назначить задачу;communication.description
- не обязательно, описание типа связи (см. Абоненты);communication.destination
- не обязательно, номер или любой текст типа связи (см. Абоненты);communication.type.id
- ид типа связи (Swagger UI здесь список);processing
- настройки постобработки:enabled
- включена или выключена постобработка;form.id
- ид формы (не обязательно);sec
- время в секундах постобработки в секундах;renewal_sec
- время возможности добавить постобработку;
queue_name
- название очередиtimeout
- время в секундах сколько ожидать ответа оператора (по умолчанию включено автоподнятие, поэтому этот параметр нужен больше для случаев, когда оператор не в Workspace).
math
Приложение для работы с математическими функциями
Code Block |
---|
{
"math": {
"data": "${caller_id_array}",
"setVar": "new_random_caller_id",
"fn": "random"
}
} |
fn
random
: returns a random number from arraymin
andmax
: can be used to find the lowest or highest value in a list of argumentsround
: rounds a number to the nearest integerceil
: rounds a number up to the nearest integerfloor
: rounds a number down to the nearest integer
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 stringindexOf
andlastIndexOf
: returns the index of (the position of) the first or last occurrence of a specified text in a stringsearch
: searches a string for a specified value and returns the position of the matchslice
: extracts a part of a string and returns the extracted part in a new stringsubstring
: is similar to slice. The difference is thatsubstring
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 stringtoUpperCase
ortoLowerCase
: A string is converted to upper case or to lower casecharAt
: returns the character at a specified index (position) in a stringcharCodeAt
: returns the unicode of the character at a specified index in a stringsplit
: A string can be converted to an array with thesplit
functionreverse
: Reverse the provided stringbase64
: base64 encoder / decoderMD5
: Computes a digest from a string usingMD5
algorithmSHA-256
: Computes a digest from a string usingSHA-256
algorithmSHA-512
: Computes a digest from a string usingSHA-512
algorithm
markIVR
Позволяет сохранить массив значений в переменную, которая будет доступна в истории
Code Block |
---|
{
"markIVR": {
"name": "Log",
"value": "Входящий звонок"
}
} |
topicExtraction
Для определение тематики полученного сообщения: сообщение в чате, speech-to-text на IVR
Code Block |
---|
{
"topicExtraction": {
"connection": "http://10.10.10.222:3333/extract_topics/",
"limit": 2,
"messages": [
{
"message": "интересует ли вас покупка авто?",
"sender": "operator"
},
{
"message": "Вы мне надоели, я же сказал так",
"sender": "user"
}
],
"possibleTopics": [
"заинтересованный",
"не заинтересованный",
"неудобно говорить"
],
"definedTopic": "topicResponse",
"score": "confidenceResponse"
}
} |
где,
limit
- не обязательно, по умолчанию 4, это последние сообщения из чата или из распознавания в звонке
definedTopic
- в какую переменную записать ответ (topic)
score
- в какую переменную записать сonfidence
messages
- используется только для всех типов кроме chat / call
userInfo
Приложение позволяет получить значение из объекта пользователя по номеру телефона
Code Block |
---|
{
"userInfo": {
"set": {
"usrId": "id",
"email": "email",
"mob": "variables.fwd_mob",
"out": "variables.out_cid"
},
"user": {
"extension": "${ext}"
}
}
} |
setGrantee
Передать права на канал пользователю с идентификатором указанным в id
Code Block |
---|
{
"setGrantee": {
"id": 10
}
} |
schema
Выполнить внешнюю схему по идентификатору
Code Block |
---|
{
"schema": {
"id": 1
}
} |
softSleep
Пауза выполнения скрипта в миллисекундах
Code Block |
---|
{ "markIVRsoftSleep": { 1000 } |
sql
Приложение доступно исключительно для выделенных либо собственных серверов Webitel, позволяет выполнить запрос в базу данных и вернуть результат в переменную
Code Block |
---|
[ { "name": "Log", "valuesql": { "Входящий звонок" } } |
userInfo
Приложение позволяет получить значение из объекта пользователя по номеру телефона
Code Block |
---|
{ "userInfo": { "set": {dns": "admin:123Webitel4@tcp(database-1.cluster-cnvuzqnsxvyv.eu-central-1.rds.amazonaws.com:3306)/mysql", "usrIddriver": "idmysql", "email": "email", "mobparams": "variables.fwd_mob",[ "out": "variables.out_cid" "db" }, "user": {], "extensionquery": "${ext}"select 1 as tst_number, true as tst_bool, table_name, last_update } } } |
setGrantee
Передать права на канал пользователю с идентификатором указанным в id
Code Block |
---|
{ "setGrantee": {from mysql.innodb_index_stats where table_name = ? order by rand() limit 1" } "id": 10 }, } } |
schema
Выполнить внешнюю схему по идентификатору
Code Block |
---|
{{ "schemasql": { "iddns": 1"user=webitel password=webitel host=10.9.8.111 dbname=webitel sslmode=disable", } } |
softSleep
Пауза выполнения скрипта в миллисекундах
Code Block |
---|
{ "softSleepdriver": 1000 } |
sql
Приложение доступно исключительно для выделенных либо собственных серверов Webitel, позволяет выполнить запрос в базу данных и вернуть результат в переменную
Code Block |
---|
["postgres", { "sqlparams": {[ 12 "dns": "admin:123Webitel4@tcp(database-1.cluster-cnvuzqnsxvyv.eu-central-1.rds.amazonaws.com:3306)/mysql" ], "driverquery": "mysqlselect user_id from call_center.cc_agent where id = $1", "paramstimeout": [5000 } }, { "db"sql": { ]"dns": "/opt/DataGripProjects/default/identifier.sqlite", "querydriver": "selectsqlite3", 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" } "query": "select count(*) as ss from storage where key like 'mph_%'", }, { "timeout": 5000 "sql": { } } ] |
list
Проверка на наличие абонента в списке с выполнением действий
Code Block |
---|
{ "dnslist": "user=webitel password=webitel host=10.9.8.111 dbname=webitel sslmode=disable", { "name": "StopList_Chat_bot", "driverdestination": "postgres${user}", "paramsactions": [ { 12 ], "sendText": "BAN: ${from} ⛔️", "query": "select user_id from call_center.cc_agent where id = $1", "break": true "timeout":} 5000 ] } } } ] |
listAdd
Проверка на наличие Добавить абонента в списке с выполнением действийсписок
Code Block |
---|
{ "listlistAdd": { "namedestination": "StopList${caller_Chatid_botnumber}", "destinationdescription": "${usercaller_id_name}", "actions": ["expireAt": "${expired_at}", "list": { { "id": 16 "sendText": "BAN: ${from} ⛔️", } } } |
log
Вывод дополнительной информации в лог файл приложений
Code Block |
---|
{ "breaklog": true" >> ${Hold} <<<" } |
goto
Перейти к именной метке
Code Block |
---|
{ "goto": "tagName" } } |
monoPay
Перейти к именной метке
Code Block |
---|
{ "monoPay":{ ] "invoice":{ } } |
listAdd
Добавить абонента в список
Code Block |
---|
{ "listAddaction":"create", { "destinationbody": "${caller_id_number}",{ "descriptionamount": "${caller_id_name}"1", "expireAt": "${expired_at}", "listpaymentType":"debit", { "setVar":"monoInvoice", "id": 16 "validity":"3600" } } } |
log
Вывод дополнительной информации в лог файл приложений
Code Block |
---|
{ } "log": " >> ${Hold}, <<<" } |
goto
Перейти к именной метке
Code Block |
---|
{ "gototoken": "tagNameuLRpgdn9yE5JP11NuXVqdvWpKk6TbSiQnquzS2BxtiCw" } |
Параметры приложений
Данные приложения могут вызываться как самостоятельно, так и как параметр другого приложения.
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 |
---|