3fd813839a94262eba471e71e9511031d7b4ff76
[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 _0x32a4=['../../config/utils','rpc','../../config/environment','jayson/promise','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x32a4,0x1d6));var _0x432a=function(_0x155882,_0x240858){_0x155882=_0x155882-0x0;var _0x5aaf42=_0x32a4[_0x155882];return _0x5aaf42;};'use strict';var _=require(_0x432a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x432a('0x1'));var rs=require(_0x432a('0x2'));var fs=require('fs');var Redis=require(_0x432a('0x3'));var db=require(_0x432a('0x4'))['db'];var utils=require(_0x432a('0x5'));var logger=require('../../config/logger')(_0x432a('0x6'));var config=require(_0x432a('0x7'));var jayson=require(_0x432a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11be09,_0x10321a,_0x4813b1){return new BPromise(function(_0x58cd90,_0x2b42e1){return client[_0x432a('0x9')](_0x11be09,_0x4813b1)[_0x432a('0xa')](function(_0x253eef){logger['info'](_0x432a('0xb'),_0x10321a,_0x432a('0xc'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x10321a,'request\x20sent',JSON['stringify'](_0x253eef));if(_0x253eef[_0x432a('0xd')]){if(_0x253eef[_0x432a('0xd')][_0x432a('0xe')]===0x1f4){logger[_0x432a('0xd')](_0x432a('0xb'),_0x10321a,_0x253eef[_0x432a('0xd')][_0x432a('0xf')]);return _0x2b42e1(_0x253eef['error']['message']);}logger[_0x432a('0xd')](_0x432a('0xb'),_0x10321a,_0x253eef[_0x432a('0xd')][_0x432a('0xf')]);return _0x58cd90(_0x253eef[_0x432a('0xd')][_0x432a('0xf')]);}else{logger[_0x432a('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x10321a,_0x432a('0xc'));_0x58cd90(_0x253eef[_0x432a('0x11')]['message']);}})[_0x432a('0x12')](function(_0x30ba9c){logger[_0x432a('0xd')](_0x432a('0xb'),_0x10321a,_0x30ba9c);_0x2b42e1(_0x30ba9c);});});}