6d87f1614b22d078387efb595b670a6231a5b6ea
[motion2.git] / server / api / intDeskConfiguration / intDeskConfiguration.rpc.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 _0xce2f=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskConfiguration,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4f267a,_0x4d3149){var _0x3eafdf=function(_0x36ed16){while(--_0x36ed16){_0x4f267a['push'](_0x4f267a['shift']());}};_0x3eafdf(++_0x4d3149);}(_0xce2f,0x18a));var _0xfce2=function(_0x55a2b5,_0x43e83c){_0x55a2b5=_0x55a2b5-0x0;var _0x278567=_0xce2f[_0x55a2b5];return _0x278567;};'use strict';var _=require('lodash');var util=require(_0xfce2('0x0'));var moment=require(_0xfce2('0x1'));var BPromise=require(_0xfce2('0x2'));var rs=require(_0xfce2('0x3'));var fs=require('fs');var Redis=require(_0xfce2('0x4'));var db=require(_0xfce2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfce2('0x6'))('rpc');var config=require(_0xfce2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfce2('0x8')][_0xfce2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c378,_0x741a25,_0x442065){return new BPromise(function(_0x458b85,_0x27f1d1){return client[_0xfce2('0xa')](_0x13c378,_0x442065)['then'](function(_0x5ce1d6){logger[_0xfce2('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x741a25,_0xfce2('0xc'));logger['debug'](_0xfce2('0xd'),_0x741a25,'request\x20sent',JSON[_0xfce2('0xe')](_0x5ce1d6));if(_0x5ce1d6[_0xfce2('0xf')]){if(_0x5ce1d6[_0xfce2('0xf')]['code']===0x1f4){logger[_0xfce2('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x741a25,_0x5ce1d6[_0xfce2('0xf')][_0xfce2('0x10')]);return _0x27f1d1(_0x5ce1d6[_0xfce2('0xf')][_0xfce2('0x10')]);}logger[_0xfce2('0xf')](_0xfce2('0x11'),_0x741a25,_0x5ce1d6[_0xfce2('0xf')]['message']);return _0x458b85(_0x5ce1d6[_0xfce2('0xf')][_0xfce2('0x10')]);}else{logger['info'](_0xfce2('0x11'),_0x741a25,_0xfce2('0xc'));_0x458b85(_0x5ce1d6['result']['message']);}})[_0xfce2('0x12')](function(_0x4495be){logger['error'](_0xfce2('0x11'),_0x741a25,_0x4495be);_0x27f1d1(_0x4495be);});});}