Built motion from commit (unavailable).|2.6.0
[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 _0x699f=['where','sequelize','COUNT','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw'];(function(_0x1c55f1,_0x3669ca){var _0x44dd27=function(_0x531d3e){while(--_0x531d3e){_0x1c55f1['push'](_0x1c55f1['shift']());}};_0x44dd27(++_0x3669ca);}(_0x699f,0x80));var _0xf699=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x699f[_0x5cbd7b];return _0x3fdfb8;};'use strict';var _=require(_0xf699('0x0'));var util=require(_0xf699('0x1'));var moment=require(_0xf699('0x2'));var BPromise=require(_0xf699('0x3'));var rs=require(_0xf699('0x4'));var fs=require('fs');var Redis=require(_0xf699('0x5'));var db=require(_0xf699('0x6'))['db'];var utils=require(_0xf699('0x7'));var logger=require(_0xf699('0x8'))(_0xf699('0x9'));var config=require(_0xf699('0xa'));var jayson=require(_0xf699('0xb'));var client=jayson[_0xf699('0xc')][_0xf699('0xd')]({'port':0x232a});config[_0xf699('0xe')]=_[_0xf699('0xf')](config[_0xf699('0xe')],{'host':_0xf699('0x10'),'port':0x18eb});var socket=require(_0xf699('0x11'))(new Redis(config['redis']));require(_0xf699('0x12'))[_0xf699('0x13')](socket);function respondWithRpcPromise(_0x3e3232,_0x1c7725,_0x33a3d2){return new BPromise(function(_0x5f15a3,_0x2a6800){return client[_0xf699('0x14')](_0x3e3232,_0x33a3d2)[_0xf699('0x15')](function(_0x4a2784){logger[_0xf699('0x16')](_0xf699('0x17'),_0x1c7725,_0xf699('0x18'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x1c7725,'request\x20sent',JSON[_0xf699('0x19')](_0x4a2784));if(_0x4a2784[_0xf699('0x1a')]){if(_0x4a2784[_0xf699('0x1a')][_0xf699('0x1b')]===0x1f4){logger['error'](_0xf699('0x17'),_0x1c7725,_0x4a2784[_0xf699('0x1a')][_0xf699('0x1c')]);return _0x2a6800(_0x4a2784[_0xf699('0x1a')]['message']);}logger['error'](_0xf699('0x17'),_0x1c7725,_0x4a2784[_0xf699('0x1a')]['message']);return _0x5f15a3(_0x4a2784[_0xf699('0x1a')][_0xf699('0x1c')]);}else{logger[_0xf699('0x16')](_0xf699('0x17'),_0x1c7725,_0xf699('0x18'));_0x5f15a3(_0x4a2784[_0xf699('0x1d')]['message']);}})[_0xf699('0x1e')](function(_0x258e7c){logger[_0xf699('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c7725,_0x258e7c);_0x2a6800(_0x258e7c);});});}exports[_0xf699('0x1f')]=function(_0x389aa3){var _0x49d43f=this;return new Promise(function(_0xf42726,_0xc05449){return db[_0xf699('0x20')][_0xf699('0x21')]({'raw':_0x389aa3['options']?_0x389aa3[_0xf699('0x22')][_0xf699('0x23')]===undefined?!![]:![]:!![],'where':_0x389aa3[_0xf699('0x22')]?_0x389aa3['options'][_0xf699('0x24')]||null:null,'attributes':[[db[_0xf699('0x25')]['fn'](_0xf699('0x26'),db[_0xf699('0x25')]['fn']('IF',db[_0xf699('0x25')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xf699('0x27')]]})['then'](function(_0x1bf948){logger[_0xf699('0x16')](_0xf699('0x1f'),_0x389aa3);logger[_0xf699('0x28')]('GetVoiceQueueRtPauses',_0x389aa3,JSON[_0xf699('0x19')](_0x1bf948));_0xf42726(_0x1bf948);})[_0xf699('0x1e')](function(_0x89076c){logger[_0xf699('0x1a')](_0xf699('0x1f'),_0x89076c[_0xf699('0x1c')],_0x389aa3);_0xc05449(_0x49d43f[_0xf699('0x1a')](0x1f4,_0x89076c[_0xf699('0x1c')]));});});};