5e7c4b1aff5d26e9c7aeef19bb98b7562bc750b7
[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 _0x689f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x589c2c,_0x229428){var _0xd46bd4=function(_0x303292){while(--_0x303292){_0x589c2c['push'](_0x589c2c['shift']());}};_0xd46bd4(++_0x229428);}(_0x689f,0x150));var _0xf689=function(_0x5ad546,_0x40bcea){_0x5ad546=_0x5ad546-0x0;var _0x2750be=_0x689f[_0x5ad546];return _0x2750be;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf689('0x0'));var BPromise=require(_0xf689('0x1'));var rs=require(_0xf689('0x2'));var fs=require('fs');var Redis=require(_0xf689('0x3'));var db=require(_0xf689('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf689('0x5'))(_0xf689('0x6'));var config=require('../../config/environment');var jayson=require(_0xf689('0x7'));var client=jayson[_0xf689('0x8')][_0xf689('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307b94,_0x49bb7f,_0x175805){return new BPromise(function(_0x2ab704,_0x5c3fbc){return client[_0xf689('0xa')](_0x307b94,_0x175805)['then'](function(_0x31a399){logger[_0xf689('0xb')](_0xf689('0xc'),_0x49bb7f,_0xf689('0xd'));logger[_0xf689('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x49bb7f,'request\x20sent',JSON[_0xf689('0xf')](_0x31a399));if(_0x31a399[_0xf689('0x10')]){if(_0x31a399[_0xf689('0x10')]['code']===0x1f4){logger[_0xf689('0x10')](_0xf689('0xc'),_0x49bb7f,_0x31a399[_0xf689('0x10')][_0xf689('0x11')]);return _0x5c3fbc(_0x31a399[_0xf689('0x10')][_0xf689('0x11')]);}logger[_0xf689('0x10')](_0xf689('0xc'),_0x49bb7f,_0x31a399['error'][_0xf689('0x11')]);return _0x2ab704(_0x31a399[_0xf689('0x10')]['message']);}else{logger[_0xf689('0xb')](_0xf689('0xc'),_0x49bb7f,_0xf689('0xd'));_0x2ab704(_0x31a399[_0xf689('0x12')][_0xf689('0x11')]);}})[_0xf689('0x13')](function(_0x3580f6){logger[_0xf689('0x10')](_0xf689('0xc'),_0x49bb7f,_0x3580f6);_0x5c3fbc(_0x3580f6);});});}