8741a495ca918afd95651688a473c002fa3242c6
[motion2.git] / server / services / routing / server / applications / tvox.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xcf98=['stringify','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&sessionId=','&data=','catch','next','shelljs','lodash','request-promise','axios','tough-cookie','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','\x20-\x20','replace','includes','push','?params=','jsonrpc','2.0','method','params'];(function(_0x2460b2,_0x260518){var _0x461956=function(_0x2ce944){while(--_0x2ce944){_0x2460b2['push'](_0x2460b2['shift']());}};_0x461956(++_0x260518);}(_0xcf98,0x8d));var _0x8cf9=function(_0xb58a1e,_0x270edf){_0xb58a1e=_0xb58a1e-0x0;var _0x302375=_0xcf98[_0xb58a1e];return _0x302375;};'use strict';var schema=require('validate');var sh=require(_0x8cf9('0x0'));var _=require(_0x8cf9('0x1'));var rp=require(_0x8cf9('0x2'));var axios=require(_0x8cf9('0x3'));var tough=require(_0x8cf9('0x4'));var utils=require('./utils');const {session}=require('passport');var logger=require(_0x8cf9('0x5'))(_0x8cf9('0x6'));var system=schema({'command':{'type':_0x8cf9('0x7'),'required':!![],'message':_0x8cf9('0x8')}});var arr=[];exports[_0x8cf9('0x9')]=function(_0x3a5463,_0x23114d){return function(_0x29fb1e){var _0x11c3b5=_0x23114d[0xa];var _0x136309=_0x23114d[0xb];var _0x7d48dc=_0x23114d[0xc];var _0x5947d3=_0x23114d[0xd];var _0x2c9b72=_0x23114d[0xe];var _0x982c65=_0x23114d[0xf]['replace'](/\n/g,_0x8cf9('0xa'));var _0x5b9daa=_0x23114d[0x10][_0x8cf9('0xb')](/\n/g,'\x20');if(!arr[_0x8cf9('0xc')](_0x136309)){arr[_0x8cf9('0xd')](_0x136309);var _0x3440f5='';var _0x236fbd=_0x23114d[0x3];var _0x42253a=_0x23114d[0x4];var _0x206b9e=_0x23114d[0x1];var _0x598c3e=_0x23114d[0x0];var _0x2bfed9={};_0x2bfed9['urlOnAnswer']=_0x23114d[0x8]+'?params='+_0x7d48dc+'|'+_0x11c3b5+'|'+_0x5947d3+'|'+_0x136309+'|'+_0x2c9b72;_0x2bfed9['urlOnRing']=_0x23114d[0x7]+_0x8cf9('0xe')+_0x7d48dc+'|'+_0x11c3b5+'|'+_0x5947d3+'|'+_0x136309+'|'+_0x2c9b72+'|'+_0x982c65+'|'+_0x5b9daa;_0x2bfed9['title']=_0x23114d[0x9];var _0x5c3482={};_0x5c3482[_0x8cf9('0xf')]=_0x8cf9('0x10');_0x5c3482[_0x8cf9('0x11')]='login';var _0x202b83=[];_0x202b83[_0x8cf9('0xd')](_0x23114d[0x2]);_0x202b83['push'](_0x23114d[0x5]);_0x202b83[_0x8cf9('0xd')](_0x23114d[0x6]);_0x5c3482[_0x8cf9('0x12')]=_0x202b83;_0x5c3482['id']=0x1;var _0x2417d8=JSON[_0x8cf9('0x13')](_0x5c3482);var _0xbba7f9={'encoding':_0x8cf9('0x14'),'method':_0x8cf9('0x15'),'timeout':0x2710,'url':_0x236fbd,'headers':{'Content-Type':_0x8cf9('0x16')},'body':_0x2417d8};return rp(_0xbba7f9)[_0x8cf9('0x17')](function(_0x3a13b7){const _0x873fec=JSON[_0x8cf9('0x18')](_0x3a13b7);if(_0x873fec[_0x8cf9('0x19')][_0x8cf9('0x1a')]){var _0xe0cda=_0x136309;_0x3440f5=_0x873fec[_0x8cf9('0x19')]['accessToken'];var _0x4ee404=_0x8cf9('0x1b')+_0x206b9e+'&serviceId='+_0x598c3e+_0x8cf9('0x1c')+_0xe0cda+_0x8cf9('0x1d')+JSON[_0x8cf9('0x13')](_0x2bfed9);var _0x275a0e=_0x42253a+'?'+_0x4ee404;return rp(_0x275a0e)[_0x8cf9('0x17')](function(_0xe7f8b4){const _0x207f32=JSON[_0x8cf9('0x18')](_0xe7f8b4);});}_0x29fb1e['next']();})[_0x8cf9('0x1e')](function(_0x56e422){console['log'](_0x56e422);});}else _0x29fb1e[_0x8cf9('0x1f')]();};};