Built motion from commit bab6f49e.|2.6.17
[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 _0x89c5=['stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x89c5,0x192));var _0x589c=function(_0x3588d4,_0x4d5ebf){_0x3588d4=_0x3588d4-0x0;var _0x4849af=_0x89c5[_0x3588d4];return _0x4849af;};'use strict';var _=require(_0x589c('0x0'));var util=require(_0x589c('0x1'));var moment=require(_0x589c('0x2'));var BPromise=require(_0x589c('0x3'));var rs=require(_0x589c('0x4'));var fs=require('fs');var Redis=require(_0x589c('0x5'));var db=require(_0x589c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x589c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x589c('0x8')][_0x589c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x431526,_0x1c85e2,_0x59ffd0){return new BPromise(function(_0x1c2261,_0x1aeb48){return client['request'](_0x431526,_0x59ffd0)[_0x589c('0xa')](function(_0x229718){logger[_0x589c('0xb')](_0x589c('0xc'),_0x1c85e2,_0x589c('0xd'));logger[_0x589c('0xe')](_0x589c('0xf'),_0x1c85e2,_0x589c('0xd'),JSON[_0x589c('0x10')](_0x229718));if(_0x229718[_0x589c('0x11')]){if(_0x229718[_0x589c('0x11')]['code']===0x1f4){logger[_0x589c('0x11')](_0x589c('0xc'),_0x1c85e2,_0x229718[_0x589c('0x11')][_0x589c('0x12')]);return _0x1aeb48(_0x229718[_0x589c('0x11')]['message']);}logger[_0x589c('0x11')](_0x589c('0xc'),_0x1c85e2,_0x229718['error'][_0x589c('0x12')]);return _0x1c2261(_0x229718[_0x589c('0x11')][_0x589c('0x12')]);}else{logger[_0x589c('0xb')](_0x589c('0xc'),_0x1c85e2,_0x589c('0xd'));_0x1c2261(_0x229718['result'][_0x589c('0x12')]);}})['catch'](function(_0x3956db){logger[_0x589c('0x11')](_0x589c('0xc'),_0x1c85e2,_0x3956db);_0x1aeb48(_0x3956db);});});}