Built motion from commit 25580385.|2.6.2
[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 _0x7099=['ioredis','../../mysqldb','../../config/logger','../../config/environment','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','randomstring'];(function(_0x9faf49,_0x51c0a4){var _0x3d3179=function(_0x49791c){while(--_0x49791c){_0x9faf49['push'](_0x9faf49['shift']());}};_0x3d3179(++_0x51c0a4);}(_0x7099,0x107));var _0x9709=function(_0x36b0d7,_0x3044c7){_0x36b0d7=_0x36b0d7-0x0;var _0x3ec0c9=_0x7099[_0x36b0d7];return _0x3ec0c9;};'use strict';var _=require(_0x9709('0x0'));var util=require(_0x9709('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9709('0x2'));var fs=require('fs');var Redis=require(_0x9709('0x3'));var db=require(_0x9709('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9709('0x5'))('rpc');var config=require(_0x9709('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7b57,_0x3d7e86,_0x50be83){return new BPromise(function(_0x308872,_0x27af6e){return client['request'](_0x3a7b57,_0x50be83)[_0x9709('0x7')](function(_0x1a9891){logger[_0x9709('0x8')](_0x9709('0x9'),_0x3d7e86,_0x9709('0xa'));logger[_0x9709('0xb')](_0x9709('0xc'),_0x3d7e86,'request\x20sent',JSON[_0x9709('0xd')](_0x1a9891));if(_0x1a9891['error']){if(_0x1a9891['error'][_0x9709('0xe')]===0x1f4){logger[_0x9709('0xf')](_0x9709('0x9'),_0x3d7e86,_0x1a9891['error']['message']);return _0x27af6e(_0x1a9891[_0x9709('0xf')]['message']);}logger[_0x9709('0xf')](_0x9709('0x9'),_0x3d7e86,_0x1a9891[_0x9709('0xf')][_0x9709('0x10')]);return _0x308872(_0x1a9891[_0x9709('0xf')][_0x9709('0x10')]);}else{logger[_0x9709('0x8')](_0x9709('0x9'),_0x3d7e86,_0x9709('0xa'));_0x308872(_0x1a9891[_0x9709('0x11')][_0x9709('0x10')]);}})[_0x9709('0x12')](function(_0x4f1b77){logger[_0x9709('0xf')](_0x9709('0x9'),_0x3d7e86,_0x4f1b77);_0x27af6e(_0x4f1b77);});});}