Built motion from commit b5413ace.|2.6.9
[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 _0xfe34=['&sessionId=','&data=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId='];(function(_0x4c14bb,_0x2b7c73){var _0x8a288f=function(_0xb5a4c4){while(--_0xb5a4c4){_0x4c14bb['push'](_0x4c14bb['shift']());}};_0x8a288f(++_0x2b7c73);}(_0xfe34,0x1a2));var _0x4fe3=function(_0x5b0db7,_0x2304ce){_0x5b0db7=_0x5b0db7-0x0;var _0x25ac88=_0xfe34[_0x5b0db7];return _0x25ac88;};'use strict';var rp=require(_0x4fe3('0x0'));var logger=require('../../../../config/logger')(_0x4fe3('0x1'));var _=require(_0x4fe3('0x2'));var arr=[];exports[_0x4fe3('0x3')]=function(_0x4bbd6c,_0x212bd8){return function(_0x4cb125){var _0x20ce51=_0x212bd8[0xa];var _0x5031b6=_0x212bd8[0xb];var _0x32416b=_0x212bd8[0xc];var _0x98907c=_0x212bd8[0xd];var _0x4dc19b=_0x212bd8[0xe];var _0x3df5c6=_0x212bd8[0xf][_0x4fe3('0x4')](/\n/g,_0x4fe3('0x5'));var _0x442a10=_0x212bd8[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x4fe3('0x6')](_0x5031b6)){arr[_0x4fe3('0x7')](_0x5031b6);var _0x14526c=_0x212bd8[0x3];var _0xd59245=_0x212bd8[0x4];var _0x4f7847=_0x212bd8[0x1];var _0x836650=_0x212bd8[0x0];var _0x389f5f={};_0x389f5f[_0x4fe3('0x8')]=_0x212bd8[0x8]+_0x4fe3('0x9')+_0x32416b+'|'+_0x20ce51+'|'+_0x98907c+'|'+_0x5031b6+'|'+_0x4dc19b;_0x389f5f[_0x4fe3('0xa')]=_0x212bd8[0x7]+_0x4fe3('0x9')+_0x32416b+'|'+_0x20ce51+'|'+_0x98907c+'|'+_0x5031b6+'|'+_0x4dc19b+'|'+_0x3df5c6+'|'+_0x442a10;_0x389f5f[_0x4fe3('0xb')]=_0x212bd8[0x9];var _0x29d7a5={};_0x29d7a5[_0x4fe3('0xc')]=_0x4fe3('0xd');_0x29d7a5[_0x4fe3('0xe')]=_0x4fe3('0xf');var _0x19a353=[];_0x19a353[_0x4fe3('0x7')](_0x212bd8[0x2]);_0x19a353[_0x4fe3('0x7')](_0x212bd8[0x5]);_0x19a353[_0x4fe3('0x7')](_0x212bd8[0x6]);_0x29d7a5[_0x4fe3('0x10')]=_0x19a353;_0x29d7a5['id']=0x1;var _0x219140=JSON['stringify'](_0x29d7a5);var _0x329589={'encoding':'utf8','method':_0x4fe3('0x11'),'timeout':0x2710,'url':_0x14526c,'headers':{'Content-Type':_0x4fe3('0x12')},'body':_0x219140};return rp(_0x329589)[_0x4fe3('0x13')](function(_0x457d38){const _0x58669e=JSON[_0x4fe3('0x14')](_0x457d38);if(!_0x58669e[_0x4fe3('0x15')][_0x4fe3('0x16')]){throw new Error(_0x4fe3('0x17'));}var _0x223a85=_0x5031b6;var _0x38f805=_0x4fe3('0x18')+_0x4f7847+_0x4fe3('0x19')+_0x836650+_0x4fe3('0x1a')+_0x223a85+_0x4fe3('0x1b')+JSON[_0x4fe3('0x1c')](_0x389f5f);var _0x1ea78b=_0xd59245+'?'+_0x38f805;return rp(_0x1ea78b);})[_0x4fe3('0x13')](function(_0x2559ee){logger['info'](_0x4fe3('0x1d'),_0x4bbd6c,_0x2559ee);_0x4cb125[_0x4fe3('0x1e')]();})[_0x4fe3('0x1f')](function(_0x2da897){logger['error'](_0x4fe3('0x20'),_0x4bbd6c,_[_0x4fe3('0x21')](_0x2da897)?JSON[_0x4fe3('0x1c')](_0x2da897):_0x2da897);_0x4cb125[_0x4fe3('0x1e')]();});}else{logger[_0x4fe3('0x22')](_0x4fe3('0x23'),_0x4bbd6c);_0x4cb125[_0x4fe3('0x24')]();}};};