41f189e59915f0b4831799858b347f1b8e750e28
[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 _0x583d=['../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4bc063,_0x2e9d5c){var _0x482ad0=function(_0x7e1794){while(--_0x7e1794){_0x4bc063['push'](_0x4bc063['shift']());}};_0x482ad0(++_0x2e9d5c);}(_0x583d,0x176));var _0xd583=function(_0x345344,_0x451196){_0x345344=_0x345344-0x0;var _0x4a5881=_0x583d[_0x345344];return _0x4a5881;};'use strict';var _=require('lodash');var util=require(_0xd583('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd583('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd583('0x2'))['db'];var utils=require(_0xd583('0x3'));var logger=require(_0xd583('0x4'))(_0xd583('0x5'));var config=require(_0xd583('0x6'));var jayson=require(_0xd583('0x7'));var client=jayson['client'][_0xd583('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5aeeb6,_0x41b2c0,_0x1e8fe4){return new BPromise(function(_0x4098ab,_0x27fca7){return client[_0xd583('0x9')](_0x5aeeb6,_0x1e8fe4)['then'](function(_0x1f2034){logger[_0xd583('0xa')](_0xd583('0xb'),_0x41b2c0,_0xd583('0xc'));logger[_0xd583('0xd')](_0xd583('0xe'),_0x41b2c0,'request\x20sent',JSON[_0xd583('0xf')](_0x1f2034));if(_0x1f2034[_0xd583('0x10')]){if(_0x1f2034[_0xd583('0x10')][_0xd583('0x11')]===0x1f4){logger['error'](_0xd583('0xb'),_0x41b2c0,_0x1f2034[_0xd583('0x10')][_0xd583('0x12')]);return _0x27fca7(_0x1f2034['error']['message']);}logger[_0xd583('0x10')](_0xd583('0xb'),_0x41b2c0,_0x1f2034[_0xd583('0x10')][_0xd583('0x12')]);return _0x4098ab(_0x1f2034['error'][_0xd583('0x12')]);}else{logger[_0xd583('0xa')](_0xd583('0xb'),_0x41b2c0,_0xd583('0xc'));_0x4098ab(_0x1f2034[_0xd583('0x13')][_0xd583('0x12')]);}})['catch'](function(_0x134bb2){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x41b2c0,_0x134bb2);_0x27fca7(_0x134bb2);});});}