Built motion from commit 14588770.|2.5.38
[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 _0xa1c7=['result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4946e2,_0x37f730){var _0x42953f=function(_0x523708){while(--_0x523708){_0x4946e2['push'](_0x4946e2['shift']());}};_0x42953f(++_0x37f730);}(_0xa1c7,0x1cd));var _0x7a1c=function(_0x2fc20a,_0x5e2fb5){_0x2fc20a=_0x2fc20a-0x0;var _0x1aa57c=_0xa1c7[_0x2fc20a];return _0x1aa57c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7a1c('0x0'));var rs=require(_0x7a1c('0x1'));var fs=require('fs');var Redis=require(_0x7a1c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a1c('0x3'));var logger=require(_0x7a1c('0x4'))(_0x7a1c('0x5'));var config=require(_0x7a1c('0x6'));var jayson=require(_0x7a1c('0x7'));var client=jayson[_0x7a1c('0x8')][_0x7a1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53459a,_0x15083c,_0x2fcbad){return new BPromise(function(_0x41abf0,_0x19426a){return client[_0x7a1c('0xa')](_0x53459a,_0x2fcbad)['then'](function(_0x9d4292){logger[_0x7a1c('0xb')](_0x7a1c('0xc'),_0x15083c,_0x7a1c('0xd'));logger['debug'](_0x7a1c('0xe'),_0x15083c,_0x7a1c('0xd'),JSON[_0x7a1c('0xf')](_0x9d4292));if(_0x9d4292[_0x7a1c('0x10')]){if(_0x9d4292[_0x7a1c('0x10')][_0x7a1c('0x11')]===0x1f4){logger[_0x7a1c('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x15083c,_0x9d4292[_0x7a1c('0x10')][_0x7a1c('0x12')]);return _0x19426a(_0x9d4292['error'][_0x7a1c('0x12')]);}logger['error'](_0x7a1c('0xc'),_0x15083c,_0x9d4292[_0x7a1c('0x10')]['message']);return _0x41abf0(_0x9d4292[_0x7a1c('0x10')]['message']);}else{logger[_0x7a1c('0xb')](_0x7a1c('0xc'),_0x15083c,'request\x20sent');_0x41abf0(_0x9d4292[_0x7a1c('0x13')][_0x7a1c('0x12')]);}})['catch'](function(_0x2105db){logger[_0x7a1c('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x15083c,_0x2105db);_0x19426a(_0x2105db);});});}