Built motion from commit (unavailable).|2.5.24
[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 _0x52be=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0xe5db9c,_0x450b1d){var _0xd0ae1f=function(_0x5bcc67){while(--_0x5bcc67){_0xe5db9c['push'](_0xe5db9c['shift']());}};_0xd0ae1f(++_0x450b1d);}(_0x52be,0x157));var _0xe52b=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x52be[_0x2353fe];return _0x4d43f6;};'use strict';var _=require(_0xe52b('0x0'));var util=require(_0xe52b('0x1'));var moment=require(_0xe52b('0x2'));var BPromise=require(_0xe52b('0x3'));var rs=require(_0xe52b('0x4'));var fs=require('fs');var Redis=require(_0xe52b('0x5'));var db=require(_0xe52b('0x6'))['db'];var utils=require(_0xe52b('0x7'));var logger=require(_0xe52b('0x8'))(_0xe52b('0x9'));var config=require(_0xe52b('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe52b('0xb')]({'port':0x232a});config[_0xe52b('0xc')]=_[_0xe52b('0xd')](config['redis'],{'host':_0xe52b('0xe'),'port':0x18eb});var socket=require(_0xe52b('0xf'))(new Redis(config[_0xe52b('0xc')]));require(_0xe52b('0x10'))['register'](socket);function respondWithRpcPromise(_0x467069,_0x48ec38,_0x2d3f90){return new BPromise(function(_0x5094aa,_0x3d030b){return client[_0xe52b('0x11')](_0x467069,_0x2d3f90)[_0xe52b('0x12')](function(_0x24f446){logger[_0xe52b('0x13')](_0xe52b('0x14'),_0x48ec38,_0xe52b('0x15'));logger[_0xe52b('0x16')](_0xe52b('0x17'),_0x48ec38,_0xe52b('0x15'),JSON[_0xe52b('0x18')](_0x24f446));if(_0x24f446['error']){if(_0x24f446['error'][_0xe52b('0x19')]===0x1f4){logger[_0xe52b('0x1a')](_0xe52b('0x14'),_0x48ec38,_0x24f446[_0xe52b('0x1a')]['message']);return _0x3d030b(_0x24f446[_0xe52b('0x1a')][_0xe52b('0x1b')]);}logger[_0xe52b('0x1a')](_0xe52b('0x14'),_0x48ec38,_0x24f446[_0xe52b('0x1a')]['message']);return _0x5094aa(_0x24f446[_0xe52b('0x1a')][_0xe52b('0x1b')]);}else{logger[_0xe52b('0x13')](_0xe52b('0x14'),_0x48ec38,'request\x20sent');_0x5094aa(_0x24f446[_0xe52b('0x1c')][_0xe52b('0x1b')]);}})['catch'](function(_0x190454){logger['error'](_0xe52b('0x14'),_0x48ec38,_0x190454);_0x3d030b(_0x190454);});});}exports['GetVoiceQueueRtPauses']=function(_0x832da5){var _0x347871=this;return new Promise(function(_0x2f99c0,_0x505217){return db[_0xe52b('0x1d')]['findAll']({'raw':_0x832da5[_0xe52b('0x1e')]?_0x832da5['options'][_0xe52b('0x1f')]===undefined?!![]:![]:!![],'where':_0x832da5['options']?_0x832da5['options'][_0xe52b('0x20')]||null:null,'attributes':[[db[_0xe52b('0x21')]['fn'](_0xe52b('0x22'),db[_0xe52b('0x21')]['fn']('IF',db[_0xe52b('0x21')][_0xe52b('0x23')](_0xe52b('0x24')))),'outboundQueuePauses']]})[_0xe52b('0x12')](function(_0x548302){logger[_0xe52b('0x13')]('GetVoiceQueueRtPauses',_0x832da5);logger[_0xe52b('0x16')]('GetVoiceQueueRtPauses',_0x832da5,JSON[_0xe52b('0x18')](_0x548302));_0x2f99c0(_0x548302);})[_0xe52b('0x25')](function(_0x360eb1){logger['error']('GetVoiceQueueRtPauses',_0x360eb1[_0xe52b('0x1b')],_0x832da5);_0x505217(_0x347871[_0xe52b('0x1a')](0x1f4,_0x360eb1[_0xe52b('0x1b')]));});});};