fc9736a48af27057258ba980ff0da54ef7345402
[motion2.git] / server / api / intDeskField / intDeskField.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 _0x1a99=['rpc','client','http','request','then','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4af757,_0xe86c18){var _0x3b65d1=function(_0x31c7f6){while(--_0x31c7f6){_0x4af757['push'](_0x4af757['shift']());}};_0x3b65d1(++_0xe86c18);}(_0x1a99,0xc1));var _0x91a9=function(_0x31236c,_0x34f702){_0x31236c=_0x31236c-0x0;var _0x12eb2f=_0x1a99[_0x31236c];return _0x12eb2f;};'use strict';var _=require(_0x91a9('0x0'));var util=require(_0x91a9('0x1'));var moment=require(_0x91a9('0x2'));var BPromise=require(_0x91a9('0x3'));var rs=require(_0x91a9('0x4'));var fs=require('fs');var Redis=require(_0x91a9('0x5'));var db=require(_0x91a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x91a9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x91a9('0x8')][_0x91a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x461e78,_0x36ab4b,_0x5b89a4){return new BPromise(function(_0x41666b,_0x158ea0){return client[_0x91a9('0xa')](_0x461e78,_0x5b89a4)[_0x91a9('0xb')](function(_0x26e9f1){logger[_0x91a9('0xc')]('DeskField,\x20%s,\x20%s',_0x36ab4b,_0x91a9('0xd'));logger['debug'](_0x91a9('0xe'),_0x36ab4b,_0x91a9('0xd'),JSON['stringify'](_0x26e9f1));if(_0x26e9f1[_0x91a9('0xf')]){if(_0x26e9f1[_0x91a9('0xf')][_0x91a9('0x10')]===0x1f4){logger[_0x91a9('0xf')](_0x91a9('0x11'),_0x36ab4b,_0x26e9f1[_0x91a9('0xf')][_0x91a9('0x12')]);return _0x158ea0(_0x26e9f1[_0x91a9('0xf')]['message']);}logger[_0x91a9('0xf')](_0x91a9('0x11'),_0x36ab4b,_0x26e9f1[_0x91a9('0xf')][_0x91a9('0x12')]);return _0x41666b(_0x26e9f1[_0x91a9('0xf')]['message']);}else{logger[_0x91a9('0xc')](_0x91a9('0x11'),_0x36ab4b,_0x91a9('0xd'));_0x41666b(_0x26e9f1[_0x91a9('0x13')][_0x91a9('0x12')]);}})['catch'](function(_0xbe1a05){logger[_0x91a9('0xf')]('DeskField,\x20%s,\x20%s',_0x36ab4b,_0xbe1a05);_0x158ea0(_0xbe1a05);});});}