Built motion from commit 88aa8522.|2.5.37
[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 _0x4c7f=['GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x4c7f,0x10e));var _0xf4c7=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4c7f[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xf4c7('0x0'));var util=require(_0xf4c7('0x1'));var moment=require(_0xf4c7('0x2'));var BPromise=require(_0xf4c7('0x3'));var rs=require(_0xf4c7('0x4'));var fs=require('fs');var Redis=require(_0xf4c7('0x5'));var db=require(_0xf4c7('0x6'))['db'];var utils=require(_0xf4c7('0x7'));var logger=require('../../config/logger')(_0xf4c7('0x8'));var config=require(_0xf4c7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf4c7('0xa')][_0xf4c7('0xb')]({'port':0x232a});config[_0xf4c7('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf4c7('0xd'))(new Redis(config[_0xf4c7('0xc')]));require('./userVoiceQueueRt.socket')[_0xf4c7('0xe')](socket);function respondWithRpcPromise(_0x278547,_0x3ed63c,_0x462272){return new BPromise(function(_0x3943d4,_0xe83eaa){return client['request'](_0x278547,_0x462272)[_0xf4c7('0xf')](function(_0x44921e){logger[_0xf4c7('0x10')](_0xf4c7('0x11'),_0x3ed63c,'request\x20sent');logger['debug'](_0xf4c7('0x12'),_0x3ed63c,_0xf4c7('0x13'),JSON[_0xf4c7('0x14')](_0x44921e));if(_0x44921e[_0xf4c7('0x15')]){if(_0x44921e['error'][_0xf4c7('0x16')]===0x1f4){logger[_0xf4c7('0x15')](_0xf4c7('0x11'),_0x3ed63c,_0x44921e[_0xf4c7('0x15')][_0xf4c7('0x17')]);return _0xe83eaa(_0x44921e[_0xf4c7('0x15')][_0xf4c7('0x17')]);}logger[_0xf4c7('0x15')](_0xf4c7('0x11'),_0x3ed63c,_0x44921e[_0xf4c7('0x15')][_0xf4c7('0x17')]);return _0x3943d4(_0x44921e[_0xf4c7('0x15')][_0xf4c7('0x17')]);}else{logger['info'](_0xf4c7('0x11'),_0x3ed63c,_0xf4c7('0x13'));_0x3943d4(_0x44921e[_0xf4c7('0x18')][_0xf4c7('0x17')]);}})[_0xf4c7('0x19')](function(_0x39b368){logger[_0xf4c7('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3ed63c,_0x39b368);_0xe83eaa(_0x39b368);});});}exports[_0xf4c7('0x1a')]=function(_0x2d33af){var _0xfafb70=this;return new Promise(function(_0x34601c,_0x60cc2e){return db[_0xf4c7('0x1b')][_0xf4c7('0x1c')]({'raw':_0x2d33af[_0xf4c7('0x1d')]?_0x2d33af['options'][_0xf4c7('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d33af[_0xf4c7('0x1d')]?_0x2d33af[_0xf4c7('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf4c7('0x1f'),db[_0xf4c7('0x20')]['fn']('IF',db['sequelize'][_0xf4c7('0x21')](_0xf4c7('0x22')))),_0xf4c7('0x23')]]})['then'](function(_0xe7aa3e){logger[_0xf4c7('0x10')](_0xf4c7('0x1a'),_0x2d33af);logger[_0xf4c7('0x24')](_0xf4c7('0x1a'),_0x2d33af,JSON[_0xf4c7('0x14')](_0xe7aa3e));_0x34601c(_0xe7aa3e);})[_0xf4c7('0x19')](function(_0x586e94){logger[_0xf4c7('0x15')]('GetVoiceQueueRtPauses',_0x586e94[_0xf4c7('0x17')],_0x2d33af);_0x60cc2e(_0xfafb70[_0xf4c7('0x15')](0x1f4,_0x586e94[_0xf4c7('0x17')]));});});};