62aec9dfa883f4acd0801862b626378e4944bccc
[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 _0xfd63=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2d2fdc,_0x1b2c38){var _0x999f15=function(_0x44105b){while(--_0x44105b){_0x2d2fdc['push'](_0x2d2fdc['shift']());}};_0x999f15(++_0x1b2c38);}(_0xfd63,0x1c6));var _0x3fd6=function(_0x2c1d83,_0x1d22ce){_0x2c1d83=_0x2c1d83-0x0;var _0x1c1019=_0xfd63[_0x2c1d83];return _0x1c1019;};'use strict';var _=require(_0x3fd6('0x0'));var util=require(_0x3fd6('0x1'));var moment=require(_0x3fd6('0x2'));var BPromise=require(_0x3fd6('0x3'));var rs=require(_0x3fd6('0x4'));var fs=require('fs');var Redis=require(_0x3fd6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3fd6('0x6'))('rpc');var config=require(_0x3fd6('0x7'));var jayson=require(_0x3fd6('0x8'));var client=jayson[_0x3fd6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb326d6,_0x3bd98f,_0x3d213e){return new BPromise(function(_0x44782e,_0x3a60b6){return client[_0x3fd6('0xa')](_0xb326d6,_0x3d213e)[_0x3fd6('0xb')](function(_0x4e40d1){logger[_0x3fd6('0xc')](_0x3fd6('0xd'),_0x3bd98f,_0x3fd6('0xe'));logger['debug'](_0x3fd6('0xf'),_0x3bd98f,_0x3fd6('0xe'),JSON[_0x3fd6('0x10')](_0x4e40d1));if(_0x4e40d1[_0x3fd6('0x11')]){if(_0x4e40d1[_0x3fd6('0x11')][_0x3fd6('0x12')]===0x1f4){logger[_0x3fd6('0x11')](_0x3fd6('0xd'),_0x3bd98f,_0x4e40d1[_0x3fd6('0x11')][_0x3fd6('0x13')]);return _0x3a60b6(_0x4e40d1['error']['message']);}logger[_0x3fd6('0x11')](_0x3fd6('0xd'),_0x3bd98f,_0x4e40d1[_0x3fd6('0x11')]['message']);return _0x44782e(_0x4e40d1['error']['message']);}else{logger[_0x3fd6('0xc')](_0x3fd6('0xd'),_0x3bd98f,_0x3fd6('0xe'));_0x44782e(_0x4e40d1['result'][_0x3fd6('0x13')]);}})['catch'](function(_0x38efea){logger['error'](_0x3fd6('0xd'),_0x3bd98f,_0x38efea);_0x3a60b6(_0x38efea);});});}