6ecdeba57f71f840213edc3d653f68dddf11c894
[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 _0x247d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x14c95b,_0x4acb8d){var _0x8f9fbb=function(_0x569f5c){while(--_0x569f5c){_0x14c95b['push'](_0x14c95b['shift']());}};_0x8f9fbb(++_0x4acb8d);}(_0x247d,0x18a));var _0xd247=function(_0x462755,_0x3024fd){_0x462755=_0x462755-0x0;var _0x18bc7d=_0x247d[_0x462755];return _0x18bc7d;};'use strict';var _=require(_0xd247('0x0'));var util=require(_0xd247('0x1'));var moment=require(_0xd247('0x2'));var BPromise=require('bluebird');var rs=require(_0xd247('0x3'));var fs=require('fs');var Redis=require(_0xd247('0x4'));var db=require(_0xd247('0x5'))['db'];var utils=require(_0xd247('0x6'));var logger=require(_0xd247('0x7'))(_0xd247('0x8'));var config=require('../../config/environment');var jayson=require(_0xd247('0x9'));var client=jayson['client'][_0xd247('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x534217,_0x320a13,_0x2183e1){return new BPromise(function(_0x175dc2,_0x461305){return client[_0xd247('0xb')](_0x534217,_0x2183e1)[_0xd247('0xc')](function(_0x203803){logger[_0xd247('0xd')](_0xd247('0xe'),_0x320a13,_0xd247('0xf'));logger['debug'](_0xd247('0x10'),_0x320a13,_0xd247('0xf'),JSON[_0xd247('0x11')](_0x203803));if(_0x203803['error']){if(_0x203803[_0xd247('0x12')]['code']===0x1f4){logger['error'](_0xd247('0xe'),_0x320a13,_0x203803[_0xd247('0x12')][_0xd247('0x13')]);return _0x461305(_0x203803[_0xd247('0x12')][_0xd247('0x13')]);}logger[_0xd247('0x12')](_0xd247('0xe'),_0x320a13,_0x203803['error'][_0xd247('0x13')]);return _0x175dc2(_0x203803[_0xd247('0x12')][_0xd247('0x13')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x320a13,_0xd247('0xf'));_0x175dc2(_0x203803[_0xd247('0x14')][_0xd247('0x13')]);}})['catch'](function(_0x5f46d3){logger[_0xd247('0x12')](_0xd247('0xe'),_0x320a13,_0x5f46d3);_0x461305(_0x5f46d3);});});}