36ceead8921375b5672d6ff5ad0c297eef3db2d2
[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 _0x4159=['request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x8666fa,_0x56fc4b){var _0x253a9a=function(_0x5e3604){while(--_0x5e3604){_0x8666fa['push'](_0x8666fa['shift']());}};_0x253a9a(++_0x56fc4b);}(_0x4159,0x1c2));var _0x9415=function(_0x197176,_0x384510){_0x197176=_0x197176-0x0;var _0x4ec777=_0x4159[_0x197176];return _0x4ec777;};'use strict';var _=require(_0x9415('0x0'));var util=require(_0x9415('0x1'));var moment=require('moment');var BPromise=require(_0x9415('0x2'));var rs=require(_0x9415('0x3'));var fs=require('fs');var Redis=require(_0x9415('0x4'));var db=require(_0x9415('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9415('0x6'))(_0x9415('0x7'));var config=require('../../config/environment');var jayson=require(_0x9415('0x8'));var client=jayson['client'][_0x9415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x312313,_0xb3e569,_0x17121c){return new BPromise(function(_0x4c01df,_0x3a10ac){return client[_0x9415('0xa')](_0x312313,_0x17121c)[_0x9415('0xb')](function(_0x14764d){logger[_0x9415('0xc')](_0x9415('0xd'),_0xb3e569,_0x9415('0xe'));logger['debug'](_0x9415('0xf'),_0xb3e569,'request\x20sent',JSON[_0x9415('0x10')](_0x14764d));if(_0x14764d[_0x9415('0x11')]){if(_0x14764d['error']['code']===0x1f4){logger[_0x9415('0x11')](_0x9415('0xd'),_0xb3e569,_0x14764d['error'][_0x9415('0x12')]);return _0x3a10ac(_0x14764d[_0x9415('0x11')][_0x9415('0x12')]);}logger[_0x9415('0x11')](_0x9415('0xd'),_0xb3e569,_0x14764d['error'][_0x9415('0x12')]);return _0x4c01df(_0x14764d[_0x9415('0x11')][_0x9415('0x12')]);}else{logger[_0x9415('0xc')](_0x9415('0xd'),_0xb3e569,_0x9415('0xe'));_0x4c01df(_0x14764d[_0x9415('0x13')][_0x9415('0x12')]);}})['catch'](function(_0x5f5c3b){logger['error'](_0x9415('0xd'),_0xb3e569,_0x5f5c3b);_0x3a10ac(_0x5f5c3b);});});}