Built motion from commit ffdca78c.|2.6.24
[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 _0x9f39=['title','jsonrpc','2.0','method','login','stringify','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','push','urlOnAnswer','?params='];(function(_0x1e90b4,_0x14ce86){var _0x4d52f8=function(_0x1dc612){while(--_0x1dc612){_0x1e90b4['push'](_0x1e90b4['shift']());}};_0x4d52f8(++_0x14ce86);}(_0x9f39,0xac));var _0x99f3=function(_0xc96ef,_0x396a9e){_0xc96ef=_0xc96ef-0x0;var _0x6d4288=_0x9f39[_0xc96ef];return _0x6d4288;};'use strict';var rp=require(_0x99f3('0x0'));var logger=require(_0x99f3('0x1'))(_0x99f3('0x2'));var _=require(_0x99f3('0x3'));var arr=[];exports[_0x99f3('0x4')]=function(_0x53c49b,_0x2ac712){return function(_0x5cf0de){var _0x424b1d=_0x2ac712[0xa];var _0x155f0f=_0x2ac712[0xb];var _0x3d22d5=_0x2ac712[0xc];var _0x40e7f4=_0x2ac712[0xd];var _0x17ab6c=_0x2ac712[0xe];var _0x227b3e=_0x2ac712[0xf]['replace'](/\n/g,'\x20-\x20');var _0x84294e=_0x2ac712[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x155f0f)){arr[_0x99f3('0x5')](_0x155f0f);var _0xfd2198=_0x2ac712[0x3];var _0x3c9070=_0x2ac712[0x4];var _0x14df06=_0x2ac712[0x1];var _0x7d925d=_0x2ac712[0x0];var _0x21c3e6={};_0x21c3e6[_0x99f3('0x6')]=_0x2ac712[0x8]+_0x99f3('0x7')+_0x3d22d5+'|'+_0x424b1d+'|'+_0x40e7f4+'|'+_0x155f0f+'|'+_0x17ab6c;_0x21c3e6['urlOnRing']=_0x2ac712[0x7]+_0x99f3('0x7')+_0x3d22d5+'|'+_0x424b1d+'|'+_0x40e7f4+'|'+_0x155f0f+'|'+_0x17ab6c+'|'+_0x227b3e+'|'+_0x84294e;_0x21c3e6[_0x99f3('0x8')]=_0x2ac712[0x9];var _0x50f8f9={};_0x50f8f9[_0x99f3('0x9')]=_0x99f3('0xa');_0x50f8f9[_0x99f3('0xb')]=_0x99f3('0xc');var _0x55f6a7=[];_0x55f6a7[_0x99f3('0x5')](_0x2ac712[0x2]);_0x55f6a7['push'](_0x2ac712[0x5]);_0x55f6a7[_0x99f3('0x5')](_0x2ac712[0x6]);_0x50f8f9['params']=_0x55f6a7;_0x50f8f9['id']=0x1;var _0x38f611=JSON[_0x99f3('0xd')](_0x50f8f9);var _0x219dc9={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0xfd2198,'headers':{'Content-Type':_0x99f3('0xe')},'body':_0x38f611};return rp(_0x219dc9)['then'](function(_0x55215a){const _0x394a0c=JSON[_0x99f3('0xf')](_0x55215a);if(!_0x394a0c[_0x99f3('0x10')][_0x99f3('0x11')]){throw new Error(_0x99f3('0x12'));}var _0x17aed6=_0x155f0f;var _0x1e5d4d='channelId='+_0x14df06+_0x99f3('0x13')+_0x7d925d+_0x99f3('0x14')+_0x17aed6+'&data='+JSON[_0x99f3('0xd')](_0x21c3e6);var _0x2fc510=_0x3c9070+'?'+_0x1e5d4d;return rp(_0x2fc510);})['then'](function(_0x26224f){logger[_0x99f3('0x15')](_0x99f3('0x16'),_0x53c49b,_0x26224f);_0x5cf0de[_0x99f3('0x17')]();})[_0x99f3('0x18')](function(_0x50354f){logger[_0x99f3('0x19')](_0x99f3('0x1a'),_0x53c49b,_[_0x99f3('0x1b')](_0x50354f)?JSON[_0x99f3('0xd')](_0x50354f):_0x50354f);_0x5cf0de[_0x99f3('0x17')]();});}else{logger[_0x99f3('0x15')](_0x99f3('0x1c'),_0x53c49b);_0x5cf0de[_0x99f3('0x1d')]();}};};