Built motion from commit 0900f080.|2.5.45
[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 _0xc52a=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug'];(function(_0x5783c4,_0x2c053c){var _0x7a9746=function(_0x1d6fbd){while(--_0x1d6fbd){_0x5783c4['push'](_0x5783c4['shift']());}};_0x7a9746(++_0x2c053c);}(_0xc52a,0x16f));var _0xac52=function(_0x1cbaa2,_0x16f4d8){_0x1cbaa2=_0x1cbaa2-0x0;var _0x114440=_0xc52a[_0x1cbaa2];return _0x114440;};'use strict';var _=require(_0xac52('0x0'));var util=require(_0xac52('0x1'));var moment=require(_0xac52('0x2'));var BPromise=require(_0xac52('0x3'));var rs=require(_0xac52('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac52('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xac52('0x6'));var jayson=require(_0xac52('0x7'));var client=jayson[_0xac52('0x8')][_0xac52('0x9')]({'port':0x232a});config[_0xac52('0xa')]=_[_0xac52('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xac52('0xc'))(new Redis(config[_0xac52('0xa')]));require(_0xac52('0xd'))['register'](socket);function respondWithRpcPromise(_0x3cf19e,_0x4bbc3a,_0x58b9d3){return new BPromise(function(_0x235f5e,_0x5a1a2d){return client[_0xac52('0xe')](_0x3cf19e,_0x58b9d3)['then'](function(_0x51c712){logger[_0xac52('0xf')](_0xac52('0x10'),_0x4bbc3a,'request\x20sent');logger[_0xac52('0x11')](_0xac52('0x12'),_0x4bbc3a,'request\x20sent',JSON[_0xac52('0x13')](_0x51c712));if(_0x51c712[_0xac52('0x14')]){if(_0x51c712[_0xac52('0x14')]['code']===0x1f4){logger[_0xac52('0x14')](_0xac52('0x10'),_0x4bbc3a,_0x51c712['error'][_0xac52('0x15')]);return _0x5a1a2d(_0x51c712[_0xac52('0x14')][_0xac52('0x15')]);}logger[_0xac52('0x14')](_0xac52('0x10'),_0x4bbc3a,_0x51c712[_0xac52('0x14')][_0xac52('0x15')]);return _0x235f5e(_0x51c712['error'][_0xac52('0x15')]);}else{logger[_0xac52('0xf')](_0xac52('0x10'),_0x4bbc3a,_0xac52('0x16'));_0x235f5e(_0x51c712[_0xac52('0x17')][_0xac52('0x15')]);}})[_0xac52('0x18')](function(_0x2465f2){logger['error'](_0xac52('0x10'),_0x4bbc3a,_0x2465f2);_0x5a1a2d(_0x2465f2);});});}exports[_0xac52('0x19')]=function(_0x484193){var _0x10da96=this;return new Promise(function(_0x436ea1,_0x10b45f){return db[_0xac52('0x1a')][_0xac52('0x1b')]({'raw':_0x484193[_0xac52('0x1c')]?_0x484193['options']['raw']===undefined?!![]:![]:!![],'where':_0x484193[_0xac52('0x1c')]?_0x484193[_0xac52('0x1c')][_0xac52('0x1d')]||null:null,'attributes':[[db[_0xac52('0x1e')]['fn'](_0xac52('0x1f'),db[_0xac52('0x1e')]['fn']('IF',db[_0xac52('0x1e')][_0xac52('0x20')](_0xac52('0x21')))),'outboundQueuePauses']]})[_0xac52('0x22')](function(_0x28c3e1){logger[_0xac52('0xf')]('GetVoiceQueueRtPauses',_0x484193);logger[_0xac52('0x11')]('GetVoiceQueueRtPauses',_0x484193,JSON['stringify'](_0x28c3e1));_0x436ea1(_0x28c3e1);})[_0xac52('0x18')](function(_0x82954c){logger[_0xac52('0x14')](_0xac52('0x19'),_0x82954c[_0xac52('0x15')],_0x484193);_0x10b45f(_0x10da96[_0xac52('0x14')](0x1f4,_0x82954c[_0xac52('0x15')]));});});};