Built motion from commit (unavailable).|2.5.13
[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 _0xec35=['./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UserVoiceQueueRt','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5c913c,_0x1b3d33){var _0xc05c00=function(_0x2f18e2){while(--_0x2f18e2){_0x5c913c['push'](_0x5c913c['shift']());}};_0xc05c00(++_0x1b3d33);}(_0xec35,0x1ac));var _0x5ec3=function(_0x3b70f6,_0x10a3e7){_0x3b70f6=_0x3b70f6-0x0;var _0x4e9758=_0xec35[_0x3b70f6];return _0x4e9758;};'use strict';var _=require(_0x5ec3('0x0'));var util=require(_0x5ec3('0x1'));var moment=require(_0x5ec3('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ec3('0x3'));var fs=require('fs');var Redis=require(_0x5ec3('0x4'));var db=require(_0x5ec3('0x5'))['db'];var utils=require(_0x5ec3('0x6'));var logger=require(_0x5ec3('0x7'))(_0x5ec3('0x8'));var config=require(_0x5ec3('0x9'));var jayson=require(_0x5ec3('0xa'));var client=jayson[_0x5ec3('0xb')][_0x5ec3('0xc')]({'port':0x232a});config[_0x5ec3('0xd')]=_[_0x5ec3('0xe')](config['redis'],{'host':_0x5ec3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ec3('0xd')]));require(_0x5ec3('0x10'))['register'](socket);function respondWithRpcPromise(_0x40cd24,_0x31a0a9,_0x2c92d0){return new BPromise(function(_0xe019bf,_0x316777){return client[_0x5ec3('0x11')](_0x40cd24,_0x2c92d0)[_0x5ec3('0x12')](function(_0x4a62b8){logger[_0x5ec3('0x13')](_0x5ec3('0x14'),_0x31a0a9,_0x5ec3('0x15'));logger[_0x5ec3('0x16')](_0x5ec3('0x17'),_0x31a0a9,'request\x20sent',JSON[_0x5ec3('0x18')](_0x4a62b8));if(_0x4a62b8['error']){if(_0x4a62b8[_0x5ec3('0x19')]['code']===0x1f4){logger[_0x5ec3('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x31a0a9,_0x4a62b8['error'][_0x5ec3('0x1a')]);return _0x316777(_0x4a62b8['error'][_0x5ec3('0x1a')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x31a0a9,_0x4a62b8[_0x5ec3('0x19')][_0x5ec3('0x1a')]);return _0xe019bf(_0x4a62b8['error']['message']);}else{logger['info'](_0x5ec3('0x14'),_0x31a0a9,_0x5ec3('0x15'));_0xe019bf(_0x4a62b8[_0x5ec3('0x1b')][_0x5ec3('0x1a')]);}})[_0x5ec3('0x1c')](function(_0x38ae22){logger[_0x5ec3('0x19')](_0x5ec3('0x14'),_0x31a0a9,_0x38ae22);_0x316777(_0x38ae22);});});}exports['GetVoiceQueueRtPauses']=function(_0x1bfb61){var _0x36fab8=this;return new Promise(function(_0x15e9fc,_0x5b68d7){return db[_0x5ec3('0x1d')]['findAll']({'raw':_0x1bfb61[_0x5ec3('0x1e')]?_0x1bfb61[_0x5ec3('0x1e')][_0x5ec3('0x1f')]===undefined?!![]:![]:!![],'where':_0x1bfb61[_0x5ec3('0x1e')]?_0x1bfb61[_0x5ec3('0x1e')]['where']||null:null,'attributes':[[db[_0x5ec3('0x20')]['fn']('COUNT',db[_0x5ec3('0x20')]['fn']('IF',db['sequelize'][_0x5ec3('0x21')](_0x5ec3('0x22')))),_0x5ec3('0x23')]]})[_0x5ec3('0x12')](function(_0x41bdd5){logger['info'](_0x5ec3('0x24'),_0x1bfb61);logger[_0x5ec3('0x16')]('GetVoiceQueueRtPauses',_0x1bfb61,JSON[_0x5ec3('0x18')](_0x41bdd5));_0x15e9fc(_0x41bdd5);})[_0x5ec3('0x1c')](function(_0x1d3741){logger[_0x5ec3('0x19')](_0x5ec3('0x24'),_0x1d3741[_0x5ec3('0x1a')],_0x1bfb61);_0x5b68d7(_0x36fab8[_0x5ec3('0x19')](0x1f4,_0x1d3741[_0x5ec3('0x1a')]));});});};