98b5c9033be3bc9db51cb854f33a869c16a62e49
[motion2.git] / server / api / userOpenchannelQueue / userOpenchannelQueue.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 _0xb3c1=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0xb3c1,0xc5));var _0x1b3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3c1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1b3c('0x0'));var util=require(_0x1b3c('0x1'));var moment=require(_0x1b3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b3c('0x3'));var fs=require('fs');var Redis=require(_0x1b3c('0x4'));var db=require(_0x1b3c('0x5'))['db'];var utils=require(_0x1b3c('0x6'));var logger=require(_0x1b3c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1b3c('0x8'));var client=jayson[_0x1b3c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3033bd,_0x404557,_0x1a7d14){return new BPromise(function(_0x11c882,_0x1d3c0f){return client[_0x1b3c('0xa')](_0x3033bd,_0x1a7d14)['then'](function(_0x369515){logger['info'](_0x1b3c('0xb'),_0x404557,'request\x20sent');logger[_0x1b3c('0xc')](_0x1b3c('0xd'),_0x404557,_0x1b3c('0xe'),JSON['stringify'](_0x369515));if(_0x369515['error']){if(_0x369515[_0x1b3c('0xf')]['code']===0x1f4){logger['error'](_0x1b3c('0xb'),_0x404557,_0x369515['error']['message']);return _0x1d3c0f(_0x369515[_0x1b3c('0xf')][_0x1b3c('0x10')]);}logger[_0x1b3c('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x404557,_0x369515[_0x1b3c('0xf')]['message']);return _0x11c882(_0x369515['error'][_0x1b3c('0x10')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x404557,_0x1b3c('0xe'));_0x11c882(_0x369515[_0x1b3c('0x11')][_0x1b3c('0x10')]);}})[_0x1b3c('0x12')](function(_0x35ab20){logger[_0x1b3c('0xf')](_0x1b3c('0xb'),_0x404557,_0x35ab20);_0x1d3c0f(_0x35ab20);});});}