2c8590bea0936ee492cd78c273be19f3f6873a1d
[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 _0x4338=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0x4338,0x173));var _0x8433=function(_0x4cffa0,_0x1cfca6){_0x4cffa0=_0x4cffa0-0x0;var _0x2a2679=_0x4338[_0x4cffa0];return _0x2a2679;};'use strict';var _=require(_0x8433('0x0'));var util=require('util');var moment=require(_0x8433('0x1'));var BPromise=require(_0x8433('0x2'));var rs=require(_0x8433('0x3'));var fs=require('fs');var Redis=require(_0x8433('0x4'));var db=require(_0x8433('0x5'))['db'];var utils=require(_0x8433('0x6'));var logger=require('../../config/logger')(_0x8433('0x7'));var config=require(_0x8433('0x8'));var jayson=require(_0x8433('0x9'));var client=jayson['client'][_0x8433('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x97a2ee,_0x192e0e,_0x34072f){return new BPromise(function(_0x4d3d68,_0x2f8ed8){return client['request'](_0x97a2ee,_0x34072f)[_0x8433('0xb')](function(_0x424ac5){logger[_0x8433('0xc')](_0x8433('0xd'),_0x192e0e,'request\x20sent');logger[_0x8433('0xe')](_0x8433('0xf'),_0x192e0e,_0x8433('0x10'),JSON[_0x8433('0x11')](_0x424ac5));if(_0x424ac5[_0x8433('0x12')]){if(_0x424ac5[_0x8433('0x12')][_0x8433('0x13')]===0x1f4){logger[_0x8433('0x12')](_0x8433('0xd'),_0x192e0e,_0x424ac5[_0x8433('0x12')][_0x8433('0x14')]);return _0x2f8ed8(_0x424ac5[_0x8433('0x12')][_0x8433('0x14')]);}logger[_0x8433('0x12')](_0x8433('0xd'),_0x192e0e,_0x424ac5[_0x8433('0x12')][_0x8433('0x14')]);return _0x4d3d68(_0x424ac5[_0x8433('0x12')]['message']);}else{logger[_0x8433('0xc')](_0x8433('0xd'),_0x192e0e,_0x8433('0x10'));_0x4d3d68(_0x424ac5[_0x8433('0x15')][_0x8433('0x14')]);}})[_0x8433('0x16')](function(_0x15aaff){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x192e0e,_0x15aaff);_0x2f8ed8(_0x15aaff);});});}