Built motion from commit 953226e6.|2.6.32
[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 _0xc553=['../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x3f9a81,_0x53550b){var _0x22112c=function(_0xfb425f){while(--_0xfb425f){_0x3f9a81['push'](_0x3f9a81['shift']());}};_0x22112c(++_0x53550b);}(_0xc553,0x152));var _0x3c55=function(_0x159902,_0x2f808c){_0x159902=_0x159902-0x0;var _0x128878=_0xc553[_0x159902];return _0x128878;};'use strict';var _=require(_0x3c55('0x0'));var util=require('util');var moment=require(_0x3c55('0x1'));var BPromise=require(_0x3c55('0x2'));var rs=require(_0x3c55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c55('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c55('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c55('0x6'));var client=jayson[_0x3c55('0x7')][_0x3c55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ef47,_0x3c89b3,_0x25ef00){return new BPromise(function(_0x46b551,_0x5edafe){return client[_0x3c55('0x9')](_0x18ef47,_0x25ef00)['then'](function(_0x40d071){logger[_0x3c55('0xa')](_0x3c55('0xb'),_0x3c89b3,_0x3c55('0xc'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3c89b3,_0x3c55('0xc'),JSON[_0x3c55('0xd')](_0x40d071));if(_0x40d071['error']){if(_0x40d071['error'][_0x3c55('0xe')]===0x1f4){logger[_0x3c55('0xf')](_0x3c55('0xb'),_0x3c89b3,_0x40d071[_0x3c55('0xf')]['message']);return _0x5edafe(_0x40d071[_0x3c55('0xf')][_0x3c55('0x10')]);}logger['error'](_0x3c55('0xb'),_0x3c89b3,_0x40d071[_0x3c55('0xf')][_0x3c55('0x10')]);return _0x46b551(_0x40d071[_0x3c55('0xf')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x3c89b3,_0x3c55('0xc'));_0x46b551(_0x40d071['result'][_0x3c55('0x10')]);}})[_0x3c55('0x11')](function(_0x490b39){logger['error'](_0x3c55('0xb'),_0x3c89b3,_0x490b39);_0x5edafe(_0x490b39);});});}