fe1b852b8b247ba19b0d8527b6e9128b082021e3
[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 _0x8a78=['rpc','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x8a78,0x158));var _0x88a7=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x8a78[_0x13ed69];return _0x50c72e;};'use strict';var _=require(_0x88a7('0x0'));var util=require(_0x88a7('0x1'));var moment=require(_0x88a7('0x2'));var BPromise=require(_0x88a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a7('0x4'));var db=require(_0x88a7('0x5'))['db'];var utils=require(_0x88a7('0x6'));var logger=require(_0x88a7('0x7'))(_0x88a7('0x8'));var config=require('../../config/environment');var jayson=require(_0x88a7('0x9'));var client=jayson['client'][_0x88a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x443560,_0x118b71,_0x38201b){return new BPromise(function(_0x585571,_0xd25e66){return client[_0x88a7('0xb')](_0x443560,_0x38201b)[_0x88a7('0xc')](function(_0x2ef7f8){logger[_0x88a7('0xd')](_0x88a7('0xe'),_0x118b71,_0x88a7('0xf'));logger[_0x88a7('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x118b71,_0x88a7('0xf'),JSON[_0x88a7('0x11')](_0x2ef7f8));if(_0x2ef7f8['error']){if(_0x2ef7f8[_0x88a7('0x12')]['code']===0x1f4){logger[_0x88a7('0x12')](_0x88a7('0xe'),_0x118b71,_0x2ef7f8[_0x88a7('0x12')]['message']);return _0xd25e66(_0x2ef7f8[_0x88a7('0x12')][_0x88a7('0x13')]);}logger[_0x88a7('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x118b71,_0x2ef7f8[_0x88a7('0x12')][_0x88a7('0x13')]);return _0x585571(_0x2ef7f8['error'][_0x88a7('0x13')]);}else{logger['info'](_0x88a7('0xe'),_0x118b71,_0x88a7('0xf'));_0x585571(_0x2ef7f8[_0x88a7('0x14')][_0x88a7('0x13')]);}})[_0x88a7('0x15')](function(_0x38f265){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x118b71,_0x38f265);_0xd25e66(_0x38f265);});});}