e4ceecdf9352f0f5a9051c90539031ad8a6948c5
[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 _0x5539=['http','request','then','info','DeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x383da5,_0x4d042b){var _0x38343b=function(_0x36a6bb){while(--_0x36a6bb){_0x383da5['push'](_0x383da5['shift']());}};_0x38343b(++_0x4d042b);}(_0x5539,0x172));var _0x9553=function(_0x4a7bf7,_0x34ffcc){_0x4a7bf7=_0x4a7bf7-0x0;var _0xbbd36c=_0x5539[_0x4a7bf7];return _0xbbd36c;};'use strict';var _=require(_0x9553('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9553('0x1'));var rs=require(_0x9553('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9553('0x3'));var logger=require(_0x9553('0x4'))(_0x9553('0x5'));var config=require('../../config/environment');var jayson=require(_0x9553('0x6'));var client=jayson[_0x9553('0x7')][_0x9553('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd5ae6d,_0x153e3d,_0x119f5b){return new BPromise(function(_0x4ece13,_0x1af209){return client[_0x9553('0x9')](_0xd5ae6d,_0x119f5b)[_0x9553('0xa')](function(_0x45aadc){logger[_0x9553('0xb')](_0x9553('0xc'),_0x153e3d,'request\x20sent');logger[_0x9553('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x153e3d,'request\x20sent',JSON[_0x9553('0xe')](_0x45aadc));if(_0x45aadc[_0x9553('0xf')]){if(_0x45aadc[_0x9553('0xf')][_0x9553('0x10')]===0x1f4){logger[_0x9553('0xf')](_0x9553('0xc'),_0x153e3d,_0x45aadc[_0x9553('0xf')]['message']);return _0x1af209(_0x45aadc[_0x9553('0xf')][_0x9553('0x11')]);}logger['error'](_0x9553('0xc'),_0x153e3d,_0x45aadc[_0x9553('0xf')][_0x9553('0x11')]);return _0x4ece13(_0x45aadc[_0x9553('0xf')][_0x9553('0x11')]);}else{logger[_0x9553('0xb')](_0x9553('0xc'),_0x153e3d,_0x9553('0x12'));_0x4ece13(_0x45aadc[_0x9553('0x13')]['message']);}})[_0x9553('0x14')](function(_0x4c2e29){logger[_0x9553('0xf')](_0x9553('0xc'),_0x153e3d,_0x4c2e29);_0x1af209(_0x4c2e29);});});}