3aadbeaf88dab3a8324a670a0dde78f876a0540d
[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 _0x727b=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x5dad72,_0x1ed3fa){var _0x53b5df=function(_0x1de009){while(--_0x1de009){_0x5dad72['push'](_0x5dad72['shift']());}};_0x53b5df(++_0x1ed3fa);}(_0x727b,0xd8));var _0xb727=function(_0x3d319f,_0x518937){_0x3d319f=_0x3d319f-0x0;var _0x25749d=_0x727b[_0x3d319f];return _0x25749d;};'use strict';var _=require(_0xb727('0x0'));var util=require(_0xb727('0x1'));var moment=require(_0xb727('0x2'));var BPromise=require(_0xb727('0x3'));var rs=require(_0xb727('0x4'));var fs=require('fs');var Redis=require(_0xb727('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb727('0x6'));var logger=require('../../config/logger')(_0xb727('0x7'));var config=require(_0xb727('0x8'));var jayson=require(_0xb727('0x9'));var client=jayson[_0xb727('0xa')][_0xb727('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18106a,_0x218a6d,_0x432c32){return new BPromise(function(_0x447b9b,_0x1ee13b){return client[_0xb727('0xc')](_0x18106a,_0x432c32)[_0xb727('0xd')](function(_0x2a5cc0){logger[_0xb727('0xe')](_0xb727('0xf'),_0x218a6d,_0xb727('0x10'));logger['debug'](_0xb727('0x11'),_0x218a6d,_0xb727('0x10'),JSON[_0xb727('0x12')](_0x2a5cc0));if(_0x2a5cc0[_0xb727('0x13')]){if(_0x2a5cc0[_0xb727('0x13')]['code']===0x1f4){logger[_0xb727('0x13')](_0xb727('0xf'),_0x218a6d,_0x2a5cc0[_0xb727('0x13')][_0xb727('0x14')]);return _0x1ee13b(_0x2a5cc0[_0xb727('0x13')][_0xb727('0x14')]);}logger[_0xb727('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x218a6d,_0x2a5cc0[_0xb727('0x13')][_0xb727('0x14')]);return _0x447b9b(_0x2a5cc0[_0xb727('0x13')]['message']);}else{logger[_0xb727('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x218a6d,_0xb727('0x10'));_0x447b9b(_0x2a5cc0[_0xb727('0x15')][_0xb727('0x14')]);}})['catch'](function(_0x11a63a){logger['error'](_0xb727('0xf'),_0x218a6d,_0x11a63a);_0x1ee13b(_0x11a63a);});});}