b181efd284179273699eb182676cb34563b9b2bd
[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 _0xbfb5=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x1ede8e,_0x2acfbd){var _0x43bb4a=function(_0x24fca7){while(--_0x24fca7){_0x1ede8e['push'](_0x1ede8e['shift']());}};_0x43bb4a(++_0x2acfbd);}(_0xbfb5,0x1bf));var _0x5bfb=function(_0x1c001a,_0x52f4b1){_0x1c001a=_0x1c001a-0x0;var _0xc83fc6=_0xbfb5[_0x1c001a];return _0xc83fc6;};'use strict';var _=require('lodash');var util=require(_0x5bfb('0x0'));var moment=require(_0x5bfb('0x1'));var BPromise=require(_0x5bfb('0x2'));var rs=require(_0x5bfb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bfb('0x4'))['db'];var utils=require(_0x5bfb('0x5'));var logger=require(_0x5bfb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bfb('0x7'));var client=jayson[_0x5bfb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3917aa,_0x5ae23f,_0x5a54cb){return new BPromise(function(_0x44ad98,_0x514892){return client[_0x5bfb('0x9')](_0x3917aa,_0x5a54cb)[_0x5bfb('0xa')](function(_0xa1e66f){logger[_0x5bfb('0xb')](_0x5bfb('0xc'),_0x5ae23f,_0x5bfb('0xd'));logger[_0x5bfb('0xe')](_0x5bfb('0xf'),_0x5ae23f,_0x5bfb('0xd'),JSON['stringify'](_0xa1e66f));if(_0xa1e66f[_0x5bfb('0x10')]){if(_0xa1e66f['error'][_0x5bfb('0x11')]===0x1f4){logger[_0x5bfb('0x10')](_0x5bfb('0xc'),_0x5ae23f,_0xa1e66f[_0x5bfb('0x10')][_0x5bfb('0x12')]);return _0x514892(_0xa1e66f[_0x5bfb('0x10')]['message']);}logger['error'](_0x5bfb('0xc'),_0x5ae23f,_0xa1e66f['error'][_0x5bfb('0x12')]);return _0x44ad98(_0xa1e66f[_0x5bfb('0x10')][_0x5bfb('0x12')]);}else{logger[_0x5bfb('0xb')](_0x5bfb('0xc'),_0x5ae23f,_0x5bfb('0xd'));_0x44ad98(_0xa1e66f[_0x5bfb('0x13')]['message']);}})['catch'](function(_0x43f257){logger[_0x5bfb('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5ae23f,_0x43f257);_0x514892(_0x43f257);});});}