0207f644673900b2c52c4bc538b16c34970a16e8
[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 _0xfc79=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird'];(function(_0x4c2f92,_0x12c051){var _0x2ac334=function(_0x2d4e5d){while(--_0x2d4e5d){_0x4c2f92['push'](_0x4c2f92['shift']());}};_0x2ac334(++_0x12c051);}(_0xfc79,0x89));var _0x9fc7=function(_0x3c4c61,_0x9908ef){_0x3c4c61=_0x3c4c61-0x0;var _0x3a487f=_0xfc79[_0x3c4c61];return _0x3a487f;};'use strict';var _=require('lodash');var util=require(_0x9fc7('0x0'));var moment=require(_0x9fc7('0x1'));var BPromise=require(_0x9fc7('0x2'));var rs=require(_0x9fc7('0x3'));var fs=require('fs');var Redis=require(_0x9fc7('0x4'));var db=require(_0x9fc7('0x5'))['db'];var utils=require(_0x9fc7('0x6'));var logger=require('../../config/logger')(_0x9fc7('0x7'));var config=require(_0x9fc7('0x8'));var jayson=require(_0x9fc7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x105d2f,_0x468d92,_0x34d808){return new BPromise(function(_0x580add,_0x136b12){return client['request'](_0x105d2f,_0x34d808)['then'](function(_0x3920c9){logger['info'](_0x9fc7('0xa'),_0x468d92,_0x9fc7('0xb'));logger[_0x9fc7('0xc')](_0x9fc7('0xd'),_0x468d92,_0x9fc7('0xb'),JSON[_0x9fc7('0xe')](_0x3920c9));if(_0x3920c9['error']){if(_0x3920c9[_0x9fc7('0xf')][_0x9fc7('0x10')]===0x1f4){logger[_0x9fc7('0xf')](_0x9fc7('0xa'),_0x468d92,_0x3920c9[_0x9fc7('0xf')][_0x9fc7('0x11')]);return _0x136b12(_0x3920c9['error'][_0x9fc7('0x11')]);}logger[_0x9fc7('0xf')](_0x9fc7('0xa'),_0x468d92,_0x3920c9['error'][_0x9fc7('0x11')]);return _0x580add(_0x3920c9[_0x9fc7('0xf')]['message']);}else{logger[_0x9fc7('0x12')](_0x9fc7('0xa'),_0x468d92,_0x9fc7('0xb'));_0x580add(_0x3920c9[_0x9fc7('0x13')]['message']);}})['catch'](function(_0x41be35){logger[_0x9fc7('0xf')](_0x9fc7('0xa'),_0x468d92,_0x41be35);_0x136b12(_0x41be35);});});}