Built motion from commit (unavailable).|2.3.91
[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 _0xac9f=['bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','moment'];(function(_0x251dd,_0x337816){var _0x1a421b=function(_0x1674ba){while(--_0x1674ba){_0x251dd['push'](_0x251dd['shift']());}};_0x1a421b(++_0x337816);}(_0xac9f,0x1db));var _0xfac9=function(_0x50358a,_0x3b048d){_0x50358a=_0x50358a-0x0;var _0x15844e=_0xac9f[_0x50358a];return _0x15844e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfac9('0x0'));var BPromise=require(_0xfac9('0x1'));var rs=require(_0xfac9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfac9('0x3'))(_0xfac9('0x4'));var config=require('../../config/environment');var jayson=require(_0xfac9('0x5'));var client=jayson[_0xfac9('0x6')][_0xfac9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cf759,_0x9c5758,_0x272959){return new BPromise(function(_0x454cd4,_0x2472f9){return client[_0xfac9('0x8')](_0x4cf759,_0x272959)['then'](function(_0x18fb40){logger['info'](_0xfac9('0x9'),_0x9c5758,_0xfac9('0xa'));logger[_0xfac9('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x9c5758,_0xfac9('0xa'),JSON[_0xfac9('0xc')](_0x18fb40));if(_0x18fb40[_0xfac9('0xd')]){if(_0x18fb40['error']['code']===0x1f4){logger[_0xfac9('0xd')](_0xfac9('0x9'),_0x9c5758,_0x18fb40[_0xfac9('0xd')]['message']);return _0x2472f9(_0x18fb40[_0xfac9('0xd')][_0xfac9('0xe')]);}logger[_0xfac9('0xd')](_0xfac9('0x9'),_0x9c5758,_0x18fb40[_0xfac9('0xd')][_0xfac9('0xe')]);return _0x454cd4(_0x18fb40['error'][_0xfac9('0xe')]);}else{logger[_0xfac9('0xf')](_0xfac9('0x9'),_0x9c5758,_0xfac9('0xa'));_0x454cd4(_0x18fb40[_0xfac9('0x10')][_0xfac9('0xe')]);}})['catch'](function(_0x38bd6f){logger[_0xfac9('0xd')](_0xfac9('0x9'),_0x9c5758,_0x38bd6f);_0x2472f9(_0x38bd6f);});});}