Built motion from commit e02f907f.|2.6.14
[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 _0x7927=['isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7927,0x1b6));var _0x7792=function(_0x5e0416,_0x541afd){_0x5e0416=_0x5e0416-0x0;var _0x3dfc48=_0x7927[_0x5e0416];return _0x3dfc48;};'use strict';var rp=require(_0x7792('0x0'));var logger=require(_0x7792('0x1'))('routing');var _=require(_0x7792('0x2'));var arr=[];exports[_0x7792('0x3')]=function(_0x4aab97,_0x488a1a){return function(_0x2d0109){var _0x395a2a=_0x488a1a[0xa];var _0x538530=_0x488a1a[0xb];var _0x147946=_0x488a1a[0xc];var _0x34ff9c=_0x488a1a[0xd];var _0x53fc66=_0x488a1a[0xe];var _0x19d290=_0x488a1a[0xf][_0x7792('0x4')](/\n/g,_0x7792('0x5'));var _0x357495=_0x488a1a[0x10][_0x7792('0x4')](/\n/g,'\x20');if(!arr[_0x7792('0x6')](_0x538530)){arr[_0x7792('0x7')](_0x538530);var _0x3e9b35=_0x488a1a[0x3];var _0x84a874=_0x488a1a[0x4];var _0x4436fb=_0x488a1a[0x1];var _0x5d272d=_0x488a1a[0x0];var _0x1eb33c={};_0x1eb33c[_0x7792('0x8')]=_0x488a1a[0x8]+_0x7792('0x9')+_0x147946+'|'+_0x395a2a+'|'+_0x34ff9c+'|'+_0x538530+'|'+_0x53fc66;_0x1eb33c['urlOnRing']=_0x488a1a[0x7]+_0x7792('0x9')+_0x147946+'|'+_0x395a2a+'|'+_0x34ff9c+'|'+_0x538530+'|'+_0x53fc66+'|'+_0x19d290+'|'+_0x357495;_0x1eb33c[_0x7792('0xa')]=_0x488a1a[0x9];var _0x3ac2bb={};_0x3ac2bb[_0x7792('0xb')]=_0x7792('0xc');_0x3ac2bb[_0x7792('0xd')]='login';var _0x55f162=[];_0x55f162[_0x7792('0x7')](_0x488a1a[0x2]);_0x55f162['push'](_0x488a1a[0x5]);_0x55f162[_0x7792('0x7')](_0x488a1a[0x6]);_0x3ac2bb['params']=_0x55f162;_0x3ac2bb['id']=0x1;var _0x4e101a=JSON['stringify'](_0x3ac2bb);var _0x33ca45={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3e9b35,'headers':{'Content-Type':_0x7792('0xe')},'body':_0x4e101a};return rp(_0x33ca45)[_0x7792('0xf')](function(_0x47c698){const _0x5522e8=JSON[_0x7792('0x10')](_0x47c698);if(!_0x5522e8[_0x7792('0x11')]['logged']){throw new Error(_0x7792('0x12'));}var _0x503bc3=_0x538530;var _0x1d9d3f='channelId='+_0x4436fb+_0x7792('0x13')+_0x5d272d+'&sessionId='+_0x503bc3+_0x7792('0x14')+JSON['stringify'](_0x1eb33c);var _0x34f899=_0x84a874+'?'+_0x1d9d3f;return rp(_0x34f899);})[_0x7792('0xf')](function(_0x5ef14c){logger[_0x7792('0x15')](_0x7792('0x16'),_0x4aab97,_0x5ef14c);_0x2d0109[_0x7792('0x17')]();})[_0x7792('0x18')](function(_0x382c36){logger[_0x7792('0x19')](_0x7792('0x1a'),_0x4aab97,_[_0x7792('0x1b')](_0x382c36)?JSON[_0x7792('0x1c')](_0x382c36):_0x382c36);_0x2d0109[_0x7792('0x17')]();});}else{logger[_0x7792('0x15')](_0x7792('0x1d'),_0x4aab97);_0x2d0109[_0x7792('0x1e')]();}};};