3d9e33dc38cb15736c72d5e01abe82830e3e1257
[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 _0xf9c7=['result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x519ebf,_0x362a83){var _0x4f72e6=function(_0x557eb7){while(--_0x557eb7){_0x519ebf['push'](_0x519ebf['shift']());}};_0x4f72e6(++_0x362a83);}(_0xf9c7,0xf9));var _0x7f9c=function(_0x517358,_0x347981){_0x517358=_0x517358-0x0;var _0x35cb8c=_0xf9c7[_0x517358];return _0x35cb8c;};'use strict';var _=require(_0x7f9c('0x0'));var util=require(_0x7f9c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7f9c('0x2'));var fs=require('fs');var Redis=require(_0x7f9c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f9c('0x4'));var logger=require(_0x7f9c('0x5'))(_0x7f9c('0x6'));var config=require(_0x7f9c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7f9c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3190aa,_0x370cbe,_0xdc0fef){return new BPromise(function(_0xad8687,_0x4affd1){return client[_0x7f9c('0x9')](_0x3190aa,_0xdc0fef)[_0x7f9c('0xa')](function(_0x54db77){logger[_0x7f9c('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x370cbe,_0x7f9c('0xc'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x370cbe,_0x7f9c('0xc'),JSON[_0x7f9c('0xd')](_0x54db77));if(_0x54db77[_0x7f9c('0xe')]){if(_0x54db77['error']['code']===0x1f4){logger[_0x7f9c('0xe')](_0x7f9c('0xf'),_0x370cbe,_0x54db77['error']['message']);return _0x4affd1(_0x54db77['error']['message']);}logger[_0x7f9c('0xe')](_0x7f9c('0xf'),_0x370cbe,_0x54db77['error'][_0x7f9c('0x10')]);return _0xad8687(_0x54db77[_0x7f9c('0xe')][_0x7f9c('0x10')]);}else{logger['info'](_0x7f9c('0xf'),_0x370cbe,'request\x20sent');_0xad8687(_0x54db77[_0x7f9c('0x11')][_0x7f9c('0x10')]);}})[_0x7f9c('0x12')](function(_0x58a6ec){logger[_0x7f9c('0xe')](_0x7f9c('0xf'),_0x370cbe,_0x58a6ec);_0x4affd1(_0x58a6ec);});});}