248a0104d0bd442772e252c97f4066240edcad03
[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 _0xbcb9=['client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x15f1cc,_0x1e99c9){var _0x3549d7=function(_0x3e2e04){while(--_0x3e2e04){_0x15f1cc['push'](_0x15f1cc['shift']());}};_0x3549d7(++_0x1e99c9);}(_0xbcb9,0x1da));var _0x9bcb=function(_0x355d77,_0x43e1ad){_0x355d77=_0x355d77-0x0;var _0x198553=_0xbcb9[_0x355d77];return _0x198553;};'use strict';var _=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var moment=require(_0x9bcb('0x2'));var BPromise=require(_0x9bcb('0x3'));var rs=require(_0x9bcb('0x4'));var fs=require('fs');var Redis=require(_0x9bcb('0x5'));var db=require(_0x9bcb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bcb('0x7'))(_0x9bcb('0x8'));var config=require(_0x9bcb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9bcb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357858,_0x53ff8b,_0x25eb6d){return new BPromise(function(_0x106373,_0x44ba34){return client[_0x9bcb('0xb')](_0x357858,_0x25eb6d)[_0x9bcb('0xc')](function(_0x538fd2){logger[_0x9bcb('0xd')](_0x9bcb('0xe'),_0x53ff8b,_0x9bcb('0xf'));logger[_0x9bcb('0x10')](_0x9bcb('0x11'),_0x53ff8b,_0x9bcb('0xf'),JSON[_0x9bcb('0x12')](_0x538fd2));if(_0x538fd2['error']){if(_0x538fd2['error'][_0x9bcb('0x13')]===0x1f4){logger['error'](_0x9bcb('0xe'),_0x53ff8b,_0x538fd2[_0x9bcb('0x14')][_0x9bcb('0x15')]);return _0x44ba34(_0x538fd2[_0x9bcb('0x14')]['message']);}logger[_0x9bcb('0x14')]('DeskField,\x20%s,\x20%s',_0x53ff8b,_0x538fd2[_0x9bcb('0x14')]['message']);return _0x106373(_0x538fd2[_0x9bcb('0x14')][_0x9bcb('0x15')]);}else{logger[_0x9bcb('0xd')](_0x9bcb('0xe'),_0x53ff8b,_0x9bcb('0xf'));_0x106373(_0x538fd2['result'][_0x9bcb('0x15')]);}})['catch'](function(_0x360705){logger[_0x9bcb('0x14')](_0x9bcb('0xe'),_0x53ff8b,_0x360705);_0x44ba34(_0x360705);});});}