0b6d32e494036cb0570ce6bb9f1cfac209cf6f5d
[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 _0x4a94=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20501d,_0x5cd8ed){var _0x3b23eb=function(_0x3a7dbf){while(--_0x3a7dbf){_0x20501d['push'](_0x20501d['shift']());}};_0x3b23eb(++_0x5cd8ed);}(_0x4a94,0x13e));var _0x44a9=function(_0x4bed24,_0x5a2b7){_0x4bed24=_0x4bed24-0x0;var _0xd9e3f0=_0x4a94[_0x4bed24];return _0xd9e3f0;};'use strict';var _=require(_0x44a9('0x0'));var util=require(_0x44a9('0x1'));var moment=require(_0x44a9('0x2'));var BPromise=require(_0x44a9('0x3'));var rs=require(_0x44a9('0x4'));var fs=require('fs');var Redis=require(_0x44a9('0x5'));var db=require(_0x44a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x44a9('0x7'));var config=require(_0x44a9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x44a9('0x9')][_0x44a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xae85a1,_0x3db890,_0xbbffff){return new BPromise(function(_0x5be0eb,_0x59806b){return client[_0x44a9('0xb')](_0xae85a1,_0xbbffff)[_0x44a9('0xc')](function(_0x409dd2){logger['info'](_0x44a9('0xd'),_0x3db890,_0x44a9('0xe'));logger[_0x44a9('0xf')](_0x44a9('0x10'),_0x3db890,_0x44a9('0xe'),JSON[_0x44a9('0x11')](_0x409dd2));if(_0x409dd2[_0x44a9('0x12')]){if(_0x409dd2[_0x44a9('0x12')][_0x44a9('0x13')]===0x1f4){logger[_0x44a9('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x3db890,_0x409dd2[_0x44a9('0x12')][_0x44a9('0x14')]);return _0x59806b(_0x409dd2[_0x44a9('0x12')][_0x44a9('0x14')]);}logger[_0x44a9('0x12')](_0x44a9('0xd'),_0x3db890,_0x409dd2[_0x44a9('0x12')]['message']);return _0x5be0eb(_0x409dd2[_0x44a9('0x12')][_0x44a9('0x14')]);}else{logger[_0x44a9('0x15')](_0x44a9('0xd'),_0x3db890,_0x44a9('0xe'));_0x5be0eb(_0x409dd2[_0x44a9('0x16')]['message']);}})[_0x44a9('0x17')](function(_0x5572bf){logger['error'](_0x44a9('0xd'),_0x3db890,_0x5572bf);_0x59806b(_0x5572bf);});});}