cf072f16e22f7ed4839c7f939fa36aae8f21e9d6
[motion2.git] / server / api / userChatQueue / userChatQueue.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 _0xe460=['jayson/promise','client','request','info','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2f31bd,_0x45d349){var _0x517ad8=function(_0x1e6691){while(--_0x1e6691){_0x2f31bd['push'](_0x2f31bd['shift']());}};_0x517ad8(++_0x45d349);}(_0xe460,0x162));var _0x0e46=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xe460[_0x53abe5];return _0xc1c37e;};'use strict';var _=require(_0x0e46('0x0'));var util=require(_0x0e46('0x1'));var moment=require(_0x0e46('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e46('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e46('0x4'));var logger=require(_0x0e46('0x5'))('rpc');var config=require(_0x0e46('0x6'));var jayson=require(_0x0e46('0x7'));var client=jayson[_0x0e46('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3a8a,_0x118b3b,_0x28f839){return new BPromise(function(_0x520778,_0xd3a5a0){return client[_0x0e46('0x9')](_0x5a3a8a,_0x28f839)['then'](function(_0x5e7efb){logger[_0x0e46('0xa')](_0x0e46('0xb'),_0x118b3b,'request\x20sent');logger[_0x0e46('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x118b3b,_0x0e46('0xd'),JSON[_0x0e46('0xe')](_0x5e7efb));if(_0x5e7efb['error']){if(_0x5e7efb[_0x0e46('0xf')]['code']===0x1f4){logger['error'](_0x0e46('0xb'),_0x118b3b,_0x5e7efb['error'][_0x0e46('0x10')]);return _0xd3a5a0(_0x5e7efb[_0x0e46('0xf')][_0x0e46('0x10')]);}logger[_0x0e46('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x118b3b,_0x5e7efb[_0x0e46('0xf')][_0x0e46('0x10')]);return _0x520778(_0x5e7efb[_0x0e46('0xf')][_0x0e46('0x10')]);}else{logger[_0x0e46('0xa')](_0x0e46('0xb'),_0x118b3b,_0x0e46('0xd'));_0x520778(_0x5e7efb[_0x0e46('0x11')]['message']);}})[_0x0e46('0x12')](function(_0x4c9a0b){logger[_0x0e46('0xf')](_0x0e46('0xb'),_0x118b3b,_0x4c9a0b);_0xd3a5a0(_0x4c9a0b);});});}