Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / userVoiceQueueRt / userVoiceQueueRt.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 _0x91b0=['outboundQueuePauses','debug','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal'];(function(_0x4454ec,_0x3e464e){var _0x345444=function(_0x36b8de){while(--_0x36b8de){_0x4454ec['push'](_0x4454ec['shift']());}};_0x345444(++_0x3e464e);}(_0x91b0,0x19a));var _0x091b=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x91b0[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x091b('0x0'));var rs=require(_0x091b('0x1'));var fs=require('fs');var Redis=require(_0x091b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x091b('0x3'))(_0x091b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x091b('0x5')][_0x091b('0x6')]({'port':0x232a});config[_0x091b('0x7')]=_['defaults'](config[_0x091b('0x7')],{'host':_0x091b('0x8'),'port':0x18eb});var socket=require(_0x091b('0x9'))(new Redis(config[_0x091b('0x7')]));require(_0x091b('0xa'))[_0x091b('0xb')](socket);function respondWithRpcPromise(_0x27d33e,_0xb03125,_0xad7c9a){return new BPromise(function(_0x1009a8,_0x5921dd){return client[_0x091b('0xc')](_0x27d33e,_0xad7c9a)[_0x091b('0xd')](function(_0x33582f){logger[_0x091b('0xe')](_0x091b('0xf'),_0xb03125,_0x091b('0x10'));logger['debug'](_0x091b('0x11'),_0xb03125,_0x091b('0x10'),JSON[_0x091b('0x12')](_0x33582f));if(_0x33582f[_0x091b('0x13')]){if(_0x33582f[_0x091b('0x13')][_0x091b('0x14')]===0x1f4){logger[_0x091b('0x13')](_0x091b('0xf'),_0xb03125,_0x33582f[_0x091b('0x13')][_0x091b('0x15')]);return _0x5921dd(_0x33582f['error']['message']);}logger[_0x091b('0x13')](_0x091b('0xf'),_0xb03125,_0x33582f[_0x091b('0x13')][_0x091b('0x15')]);return _0x1009a8(_0x33582f[_0x091b('0x13')][_0x091b('0x15')]);}else{logger[_0x091b('0xe')](_0x091b('0xf'),_0xb03125,_0x091b('0x10'));_0x1009a8(_0x33582f['result'][_0x091b('0x15')]);}})[_0x091b('0x16')](function(_0x45c247){logger[_0x091b('0x13')](_0x091b('0xf'),_0xb03125,_0x45c247);_0x5921dd(_0x45c247);});});}exports[_0x091b('0x17')]=function(_0x59614a){var _0x3947fa=this;return new Promise(function(_0x21320f,_0x39c7d2){return db[_0x091b('0x18')][_0x091b('0x19')]({'raw':_0x59614a[_0x091b('0x1a')]?_0x59614a['options'][_0x091b('0x1b')]===undefined?!![]:![]:!![],'where':_0x59614a[_0x091b('0x1a')]?_0x59614a[_0x091b('0x1a')][_0x091b('0x1c')]||null:null,'attributes':[[db[_0x091b('0x1d')]['fn'](_0x091b('0x1e'),db[_0x091b('0x1d')]['fn']('IF',db[_0x091b('0x1d')][_0x091b('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0x091b('0x20')]]})[_0x091b('0xd')](function(_0x2cb92a){logger[_0x091b('0xe')]('GetVoiceQueueRtPauses',_0x59614a);logger[_0x091b('0x21')]('GetVoiceQueueRtPauses',_0x59614a,JSON[_0x091b('0x12')](_0x2cb92a));_0x21320f(_0x2cb92a);})['catch'](function(_0x14828b){logger['error'](_0x091b('0x17'),_0x14828b[_0x091b('0x15')],_0x59614a);_0x39c7d2(_0x3947fa[_0x091b('0x13')](0x1f4,_0x14828b[_0x091b('0x15')]));});});};