Built motion from commit e0fa946e.|2.6.5
[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 _0x2ffb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2ffb,0x1bd));var _0xb2ff=function(_0x58df61,_0x263bda){_0x58df61=_0x58df61-0x0;var _0x2af205=_0x2ffb[_0x58df61];return _0x2af205;};'use strict';var _=require(_0xb2ff('0x0'));var util=require(_0xb2ff('0x1'));var moment=require(_0xb2ff('0x2'));var BPromise=require(_0xb2ff('0x3'));var rs=require(_0xb2ff('0x4'));var fs=require('fs');var Redis=require(_0xb2ff('0x5'));var db=require(_0xb2ff('0x6'))['db'];var utils=require(_0xb2ff('0x7'));var logger=require(_0xb2ff('0x8'))(_0xb2ff('0x9'));var config=require(_0xb2ff('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb2ff('0xb')][_0xb2ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd5306,_0x4ed45c,_0x3a741f){return new BPromise(function(_0x31a08a,_0x1966a3){return client['request'](_0xd5306,_0x3a741f)[_0xb2ff('0xd')](function(_0x1ae861){logger['info']('DeskField,\x20%s,\x20%s',_0x4ed45c,_0xb2ff('0xe'));logger[_0xb2ff('0xf')](_0xb2ff('0x10'),_0x4ed45c,_0xb2ff('0xe'),JSON[_0xb2ff('0x11')](_0x1ae861));if(_0x1ae861[_0xb2ff('0x12')]){if(_0x1ae861['error'][_0xb2ff('0x13')]===0x1f4){logger['error'](_0xb2ff('0x14'),_0x4ed45c,_0x1ae861[_0xb2ff('0x12')][_0xb2ff('0x15')]);return _0x1966a3(_0x1ae861[_0xb2ff('0x12')][_0xb2ff('0x15')]);}logger[_0xb2ff('0x12')](_0xb2ff('0x14'),_0x4ed45c,_0x1ae861[_0xb2ff('0x12')]['message']);return _0x31a08a(_0x1ae861['error'][_0xb2ff('0x15')]);}else{logger[_0xb2ff('0x16')](_0xb2ff('0x14'),_0x4ed45c,_0xb2ff('0xe'));_0x31a08a(_0x1ae861[_0xb2ff('0x17')][_0xb2ff('0x15')]);}})[_0xb2ff('0x18')](function(_0x41ed7d){logger[_0xb2ff('0x12')](_0xb2ff('0x14'),_0x4ed45c,_0x41ed7d);_0x1966a3(_0x41ed7d);});});}