bc53955ca47c47fa3b010596c8efe2a90426640c
[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 _0xfc79=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0xfc79,0x155));var _0x9fc7=function(_0x15624a,_0x2c0f34){_0x15624a=_0x15624a-0x0;var _0x2a6a9b=_0xfc79[_0x15624a];return _0x2a6a9b;};'use strict';var _=require('lodash');var util=require(_0x9fc7('0x0'));var moment=require('moment');var BPromise=require(_0x9fc7('0x1'));var rs=require(_0x9fc7('0x2'));var fs=require('fs');var Redis=require(_0x9fc7('0x3'));var db=require(_0x9fc7('0x4'))['db'];var utils=require(_0x9fc7('0x5'));var logger=require(_0x9fc7('0x6'))(_0x9fc7('0x7'));var config=require('../../config/environment');var jayson=require(_0x9fc7('0x8'));var client=jayson[_0x9fc7('0x9')][_0x9fc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xac1d99,_0x7e3af1,_0x177217){return new BPromise(function(_0x43023b,_0x3c3226){return client[_0x9fc7('0xb')](_0xac1d99,_0x177217)['then'](function(_0x345258){logger['info'](_0x9fc7('0xc'),_0x7e3af1,'request\x20sent');logger['debug'](_0x9fc7('0xd'),_0x7e3af1,'request\x20sent',JSON[_0x9fc7('0xe')](_0x345258));if(_0x345258[_0x9fc7('0xf')]){if(_0x345258[_0x9fc7('0xf')][_0x9fc7('0x10')]===0x1f4){logger[_0x9fc7('0xf')](_0x9fc7('0xc'),_0x7e3af1,_0x345258[_0x9fc7('0xf')][_0x9fc7('0x11')]);return _0x3c3226(_0x345258[_0x9fc7('0xf')][_0x9fc7('0x11')]);}logger['error'](_0x9fc7('0xc'),_0x7e3af1,_0x345258['error'][_0x9fc7('0x11')]);return _0x43023b(_0x345258[_0x9fc7('0xf')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x7e3af1,_0x9fc7('0x12'));_0x43023b(_0x345258['result'][_0x9fc7('0x11')]);}})[_0x9fc7('0x13')](function(_0x78b754){logger[_0x9fc7('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x7e3af1,_0x78b754);_0x3c3226(_0x78b754);});});}