37d6f4cbda9fac595e32180a9233ce8d3c7cd973
[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 _0x0cc7=['client','request','then','DeskField,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0cc7,0x1af));var _0x70cc=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x0cc7[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x70cc('0x0'));var util=require(_0x70cc('0x1'));var moment=require('moment');var BPromise=require(_0x70cc('0x2'));var rs=require(_0x70cc('0x3'));var fs=require('fs');var Redis=require(_0x70cc('0x4'));var db=require(_0x70cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x70cc('0x6'))('rpc');var config=require(_0x70cc('0x7'));var jayson=require(_0x70cc('0x8'));var client=jayson[_0x70cc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f2fbf,_0x137099,_0x2b2e43){return new BPromise(function(_0x3f5a5b,_0x33a789){return client[_0x70cc('0xa')](_0x2f2fbf,_0x2b2e43)[_0x70cc('0xb')](function(_0x13d571){logger['info'](_0x70cc('0xc'),_0x137099,_0x70cc('0xd'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x137099,_0x70cc('0xd'),JSON['stringify'](_0x13d571));if(_0x13d571[_0x70cc('0xe')]){if(_0x13d571[_0x70cc('0xe')][_0x70cc('0xf')]===0x1f4){logger[_0x70cc('0xe')](_0x70cc('0xc'),_0x137099,_0x13d571['error'][_0x70cc('0x10')]);return _0x33a789(_0x13d571[_0x70cc('0xe')][_0x70cc('0x10')]);}logger[_0x70cc('0xe')]('DeskField,\x20%s,\x20%s',_0x137099,_0x13d571[_0x70cc('0xe')][_0x70cc('0x10')]);return _0x3f5a5b(_0x13d571[_0x70cc('0xe')]['message']);}else{logger[_0x70cc('0x11')](_0x70cc('0xc'),_0x137099,_0x70cc('0xd'));_0x3f5a5b(_0x13d571[_0x70cc('0x12')][_0x70cc('0x10')]);}})[_0x70cc('0x13')](function(_0xfcb1a1){logger[_0x70cc('0xe')](_0x70cc('0xc'),_0x137099,_0xfcb1a1);_0x33a789(_0xfcb1a1);});});}