Built motion from commit 5ae82ce5.|2.6.7
[motion2.git] / server / api / user / user.rpc.js
index 1461daf..cd96dee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8084=['LoginUser','mobile','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','callysquare','PAUSE','LOGININPAUSE','bulkCreate','concat','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','./user.socket','register','GetUser','options','raw','where','attributes','include','model','map','then','info','debug','stringify','catch','error','message','ShowUser','User','PauseUser','find','name','role','internal','interface','UserVoiceQueueRt','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','update','type','UnpauseUser','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','LogoutUser','push','all'];(function(_0x381455,_0x54e126){var _0x4c96ab=function(_0x109e9a){while(--_0x109e9a){_0x381455['push'](_0x381455['shift']());}};_0x4c96ab(++_0x54e126);}(_0x8084,0x15e));var _0x4808=function(_0x1caaa3,_0x10a119){_0x1caaa3=_0x1caaa3-0x0;var _0x1e3c0a=_0x8084[_0x1caaa3];return _0x1e3c0a;};'use strict';var _=require('lodash');var util=require(_0x4808('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Redis=require('ioredis');var db=require(_0x4808('0x1'))['db'];var utils=require(_0x4808('0x2'));var logger=require(_0x4808('0x3'))('rpc');var config=require(_0x4808('0x4'));config[_0x4808('0x5')]=_[_0x4808('0x6')](config[_0x4808('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4808('0x5')]));require(_0x4808('0x7'))[_0x4808('0x8')](socket);exports[_0x4808('0x9')]=function(_0x1cdc18){var _0x2ba874=this;return new Promise(function(_0x380d14,_0x1652be){return db['User']['findAll']({'raw':_0x1cdc18[_0x4808('0xa')]?_0x1cdc18[_0x4808('0xa')][_0x4808('0xb')]===undefined?!![]:![]:!![],'where':_0x1cdc18['options']?_0x1cdc18[_0x4808('0xa')][_0x4808('0xc')]||null:null,'attributes':_0x1cdc18['options']?_0x1cdc18['options'][_0x4808('0xd')]||null:null,'limit':_0x1cdc18[_0x4808('0xa')]?_0x1cdc18['options']['limit']||null:null,'include':_0x1cdc18[_0x4808('0xa')]?_0x1cdc18[_0x4808('0xa')]['include']?_['map'](_0x1cdc18[_0x4808('0xa')][_0x4808('0xe')],function(_0x16fe3a){return{'model':db[_0x16fe3a[_0x4808('0xf')]],'as':_0x16fe3a['as'],'attributes':_0x16fe3a[_0x4808('0xd')],'include':_0x16fe3a[_0x4808('0xe')]?_[_0x4808('0x10')](_0x16fe3a['include'],function(_0x3eccf9){return{'model':db[_0x3eccf9[_0x4808('0xf')]],'as':_0x3eccf9['as'],'attributes':_0x3eccf9[_0x4808('0xd')],'include':_0x3eccf9['include']?_[_0x4808('0x10')](_0x3eccf9['include'],function(_0x15e13a){return{'model':db[_0x15e13a[_0x4808('0xf')]],'as':_0x15e13a['as'],'attributes':_0x15e13a[_0x4808('0xd')]};}):[]};}):[]};}):[]:[]})[_0x4808('0x11')](function(_0x6ec72e){logger[_0x4808('0x12')](_0x4808('0x9'),_0x1cdc18);logger[_0x4808('0x13')](_0x4808('0x9'),_0x1cdc18,JSON[_0x4808('0x14')](_0x6ec72e));_0x380d14(_0x6ec72e);})[_0x4808('0x15')](function(_0x24681c){logger['error'](_0x4808('0x9'),_0x24681c['message'],_0x1cdc18);_0x1652be(_0x2ba874[_0x4808('0x16')](0x1f4,_0x24681c[_0x4808('0x17')]));});});};exports[_0x4808('0x18')]=function(_0x5d7750){var _0x4e4ece=this;return new Promise(function(_0x4a8183,_0x314946){return db[_0x4808('0x19')]['find']({'raw':_0x5d7750[_0x4808('0xa')]?_0x5d7750['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d7750['options']?_0x5d7750[_0x4808('0xa')][_0x4808('0xc')]||null:null,'attributes':_0x5d7750['options']?_0x5d7750[_0x4808('0xa')][_0x4808('0xd')]||null:null,'include':_0x5d7750['options']?_0x5d7750[_0x4808('0xa')][_0x4808('0xe')]?_[_0x4808('0x10')](_0x5d7750['options'][_0x4808('0xe')],function(_0x208b57){return{'model':db[_0x208b57['model']],'as':_0x208b57['as'],'attributes':_0x208b57['attributes'],'include':_0x208b57[_0x4808('0xe')]?_[_0x4808('0x10')](_0x208b57[_0x4808('0xe')],function(_0x5ba190){return{'model':db[_0x5ba190[_0x4808('0xf')]],'as':_0x5ba190['as'],'attributes':_0x5ba190[_0x4808('0xd')],'include':_0x5ba190[_0x4808('0xe')]?_[_0x4808('0x10')](_0x5ba190[_0x4808('0xe')],function(_0x14bc7d){return{'model':db[_0x14bc7d[_0x4808('0xf')]],'as':_0x14bc7d['as'],'attributes':_0x14bc7d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4808('0x11')](function(_0x345a26){logger[_0x4808('0x12')](_0x4808('0x18'),_0x5d7750);logger[_0x4808('0x13')]('ShowUser',_0x5d7750,JSON[_0x4808('0x14')](_0x345a26));_0x4a8183(_0x345a26);})['catch'](function(_0xed0a6c){logger[_0x4808('0x16')](_0x4808('0x18'),_0xed0a6c[_0x4808('0x17')],_0x5d7750);_0x314946(_0x4e4ece[_0x4808('0x16')](0x1f4,_0xed0a6c[_0x4808('0x17')]));});});};exports[_0x4808('0x1a')]=function(_0x6519c4){var _0x17fc08=this;return new Promise(function(_0x3ba41b,_0x1fc7f4){var _0x1206e4;return db['User'][_0x4808('0x1b')]({'where':_0x6519c4['options'][_0x4808('0xc')]||{},'attributes':['id',_0x4808('0x1c'),_0x4808('0x1d'),_0x4808('0x1e'),_0x4808('0x1f')]})[_0x4808('0x11')](function(_0x52ae52){if(_0x52ae52){_0x1206e4=_0x52ae52;return db[_0x4808('0x20')]['update']({'paused':0x1},{'where':{'UserId':_0x1206e4['id']},'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x1206e4){return db[_0x4808('0x21')][_0x4808('0x22')]({'where':{'membername':_0x1206e4['name'],'type':'PAUSE','exitAt':null}});}})[_0x4808('0x11')](function(_0x2c16c2){if(_0x1206e4){if(_0x2c16c2&&_0x2c16c2[_0x4808('0x23')]){var _0x24f2af=moment()[_0x4808('0x24')](_0x4808('0x25'));for(var _0x48c7c9=0x0,_0x329abe=_0x2c16c2[_0x4808('0x23')];_0x48c7c9<_0x329abe;_0x48c7c9++){_0x2c16c2[_0x48c7c9][_0x4808('0x26')]({'exitAt':_0x24f2af});}}}})[_0x4808('0x11')](function(){if(_0x1206e4){var _0x3e6c5e=[];var _0x139c81=utils[_0x4808('0x27')]();_0x139c81[_0x4808('0x28')](function(_0x29e259){_0x3e6c5e['push']({'channel':_0x29e259,'membername':_0x1206e4[_0x4808('0x1c')],'interface':_[_0x4808('0x29')](_0x1206e4[_0x4808('0x1f')])?util[_0x4808('0x24')](_0x4808('0x2a'),_0x1206e4[_0x4808('0x1c')]):_0x1206e4[_0x4808('0x1f')],'type':'PAUSE','enterAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'data1':_0x6519c4[_0x4808('0x2b')]['type']||_0x4808('0x2c'),'role':_0x1206e4[_0x4808('0x1d')],'internal':_0x1206e4['internal'],'uniqueid':_0x6519c4[_0x4808('0x2b')][_0x4808('0x2d')]||null});});return db['MemberReport']['bulkCreate'](_0x3e6c5e,{'individualHooks':!![]});}})['then'](function(){if(_0x1206e4){return _0x1206e4[_0x4808('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x6519c4[_0x4808('0x2b')][_0x4808('0x2f')]||_0x4808('0x2c'),'lastPauseAt':moment()[_0x4808('0x24')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x4808('0x11')](function(_0x26037e){_0x3ba41b(_0x26037e);})[_0x4808('0x15')](function(_0x382ab8){_0x1fc7f4(_0x17fc08[_0x4808('0x16')](0x1f4,_0x382ab8['message']));});});};exports[_0x4808('0x30')]=function(_0x1b82a4){var _0x31a639=this;return new Promise(function(_0x1d1b91,_0x1c1ef9){if(_0x1b82a4[_0x4808('0x2b')]['channel']&&!utils[_0x4808('0x31')](_0x1b82a4[_0x4808('0x2b')][_0x4808('0x32')])){throw new Error(util['format'](_0x4808('0x33'),_0x1b82a4['body'][_0x4808('0x32')]));}return db[_0x4808('0x19')][_0x4808('0x34')]({'where':_0x1b82a4[_0x4808('0xa')][_0x4808('0xc')]||{},'attributes':['id',_0x4808('0x1c'),_0x4808('0x1d'),_0x4808('0x1e'),'interface','online','voicePause',_0x4808('0x35'),'chatPause',_0x4808('0x36'),_0x4808('0x37'),_0x4808('0x38'),'whatsappPause',_0x4808('0x39'),_0x4808('0x3a')]})[_0x4808('0x11')](function(_0x43022e){if(!_0x43022e){throw new Error(util[_0x4808('0x24')](_0x4808('0x3b'),_0x1b82a4[_0x4808('0x3c')]['id']));}return _0x43022e[_0x4808('0x3d')](_0x1b82a4['body'][_0x4808('0x32')],'system');})['then'](function(_0xbb9960){_0x1d1b91(_0xbb9960);})[_0x4808('0x15')](function(_0x509506){_0x1c1ef9(_0x31a639[_0x4808('0x16')](0x1f4,_0x509506[_0x4808('0x17')]));});});};exports[_0x4808('0x3e')]=function(_0x1e92a0){var _0x47e483=this;return new Promise(function(_0x427b24,_0x20e9bc){var _0x45e241;return db[_0x4808('0x19')][_0x4808('0x34')]({'where':_0x1e92a0['options'][_0x4808('0xc')]||{},'attributes':['id','name']})['then'](function(_0x3dd116){if(_0x3dd116){_0x45e241=_0x3dd116;return db[_0x4808('0x20')]['destroy']({'where':{'membername':_0x45e241[_0x4808('0x1c')]},'individualHooks':!![]});}})['then'](function(){if(_0x45e241){return db[_0x4808('0x21')][_0x4808('0x22')]({'where':{'membername':_0x45e241[_0x4808('0x1c')],'exitAt':null}});}})['then'](function(_0x53ff93){if(_0x45e241){if(_0x53ff93&&_0x53ff93[_0x4808('0x23')]){var _0x5a0206=[];_0x53ff93[_0x4808('0x28')](function(_0x338fe9){_0x5a0206[_0x4808('0x3f')](_0x338fe9['update']({'exitAt':moment()['format'](_0x4808('0x25'))}));});return BPromise[_0x4808('0x40')](_0x5a0206);}}})[_0x4808('0x11')](function(){if(_0x45e241){return _0x45e241[_0x4808('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x74b490){_0x427b24(_0x74b490);})[_0x4808('0x15')](function(_0x2e892c){_0x20e9bc(_0x47e483['error'](0x1f4,_0x2e892c['message']));});});};exports[_0x4808('0x41')]=function(_0x1e3fc4){var _0x4b9eb6=this;return new Promise(function(_0x21b49e,_0x38a75d){var _0x4c7a3e;var _0x1a53bd;var _0x50fdf3;var _0x3fcb18;return db[_0x4808('0x19')][_0x4808('0x34')]({'where':_0x1e3fc4['options'][_0x4808('0xc')]||{},'attributes':['id',_0x4808('0x1c'),_0x4808('0x1d'),_0x4808('0x42'),'phone',_0x4808('0x1e'),_0x4808('0x43'),_0x4808('0x1f')]})[_0x4808('0x11')](function(_0x330b7e){if(_0x330b7e){_0x4c7a3e=_0x330b7e;_0x3fcb18=_0x1e3fc4[_0x4808('0x2b')][_0x4808('0x1f')]?_0x1e3fc4[_0x4808('0x2b')][_0x4808('0x1f')]:util[_0x4808('0x24')](_0x4808('0x2a'),_0x4c7a3e[_0x4808('0x1c')]);return db[_0x4808('0x19')][_0x4808('0x44')]({'where':{'role':_0x4808('0x45'),'online':!![],'id':{'$ne':_0x4c7a3e['id']}}});}})[_0x4808('0x11')](function(_0x5f0f00){if(_0x5f0f00){_0x50fdf3=_0x5f0f00;return require(_0x4808('0x46'))['getLicense']();}})[_0x4808('0x11')](function(_0x274637){if(_0x274637&&_0x274637['agents']&&_0x50fdf3>=_0x274637[_0x4808('0x47')]){throw new Error(_0x4808('0x48'));}})['then'](function(){if(_0x4c7a3e){return db[_0x4808('0x20')][_0x4808('0x49')]({'where':{'membername':_0x4c7a3e['name']},'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return _0x4c7a3e[_0x4808('0x4a')]({'raw':!![]});}})[_0x4808('0x11')](function(_0x3699c2){if(_0x4c7a3e){if(_0x3699c2){var _0x191b67=[];_0x1a53bd=_0x3699c2;if(_0x1a53bd[_0x4808('0x23')]){for(var _0x28c5c5=0x0;_0x28c5c5<_0x1a53bd[_0x4808('0x23')];_0x28c5c5++){_0x191b67[_0x4808('0x3f')](db[_0x4808('0x20')]['upsert']({'membername':_0x4c7a3e[_0x4808('0x1c')],'UserId':_0x4c7a3e['id'],'queue_name':_0x1a53bd[_0x28c5c5][_0x4808('0x1c')],'VoiceQueueId':_0x1a53bd[_0x28c5c5]['id'],'interface':_0x3fcb18,'paused':_0x4c7a3e[_0x4808('0x43')]||![],'penalty':_0x1a53bd[_0x28c5c5][_0x4808('0x4b')]||0x0}));}return BPromise['all'](_0x191b67);}}}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return db[_0x4808('0x21')]['findAll']({'where':{'membername':_0x4c7a3e[_0x4808('0x1c')],'exitAt':null}});}})[_0x4808('0x11')](function(_0x17ad09){if(_0x4c7a3e){if(_0x17ad09&&_0x17ad09[_0x4808('0x23')]){var _0x4439bb=[];_0x17ad09[_0x4808('0x28')](function(_0x506cfd){_0x4439bb[_0x4808('0x3f')](_0x506cfd[_0x4808('0x2e')]({'exitAt':moment()[_0x4808('0x24')](_0x4808('0x25'))}));});return BPromise[_0x4808('0x40')](_0x4439bb);}}})[_0x4808('0x11')](function(){if(_0x4c7a3e){var _0x1d1d1b=[];var _0xbb7222=[];var _0x1bbf1d=utils[_0x4808('0x27')]();var _0x4ef09f={'membername':_0x4c7a3e[_0x4808('0x1c')],'interface':_0x3fcb18,'enterAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'role':_0x4c7a3e[_0x4808('0x1d')],'internal':_0x4c7a3e[_0x4808('0x1e')]};_0x1bbf1d[_0x4808('0x28')](function(_0x33a84a){_0x1d1d1b[_0x4808('0x3f')](_[_0x4808('0x4c')]({'channel':_0x33a84a,'type':_0x4808('0x4d'),'data1':_0x4808('0x4e'),'data2':_0x3fcb18},_0x4ef09f));if(_0x4c7a3e['loginInPause']){_0xbb7222['push'](_['merge']({'channel':_0x33a84a,'type':_0x4808('0x4f'),'data1':_0x4808('0x50')},_0x4ef09f));}});return db[_0x4808('0x21')][_0x4808('0x51')](_0x1d1d1b[_0x4808('0x52')](_0xbb7222),{'individualHooks':!![]});}})[_0x4808('0x11')](function(){if(_0x4c7a3e){return _0x4c7a3e[_0x4808('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'voicePause':_0x4c7a3e[_0x4808('0x43')]||![],'mailPause':_0x4c7a3e[_0x4808('0x43')]||![],'chatPause':_0x4c7a3e[_0x4808('0x43')]||![],'faxPause':_0x4c7a3e[_0x4808('0x43')]||![],'smsPause':_0x4c7a3e['loginInPause']||![],'openchannelPause':_0x4c7a3e[_0x4808('0x43')]||![],'pauseType':_0x4c7a3e[_0x4808('0x43')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x4808('0x24')](_0x4808('0x25')),'interface':_0x3fcb18});}})[_0x4808('0x11')](function(_0x459cc8){_0x21b49e(_0x459cc8);})['catch'](function(_0x3d8559){_0x38a75d(_0x4b9eb6['error'](0x1f4,_0x3d8559[_0x4808('0x17')]));});});};
\ No newline at end of file
+var _0xf519=['concat','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','register','GetUser','User','findAll','options','where','attributes','limit','include','model','map','then','info','debug','catch','error','message','ShowUser','find','raw','stringify','PauseUser','name','role','internal','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','updateAttributes','getChannels','push','isNil','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','DEFAULT\x20PAUSE','body','uniqueid','type','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','openchannelPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','forEach','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','merge','LOGIN','LOGININPAUSE','bulkCreate'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xf519,0xb1));var _0x9f51=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xf519[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0x9f51('0x0'));var util=require(_0x9f51('0x1'));var moment=require(_0x9f51('0x2'));var BPromise=require(_0x9f51('0x3'));var Redis=require(_0x9f51('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f51('0x5'));var logger=require(_0x9f51('0x6'))(_0x9f51('0x7'));var config=require(_0x9f51('0x8'));config[_0x9f51('0x9')]=_[_0x9f51('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f51('0xb'))(new Redis(config[_0x9f51('0x9')]));require('./user.socket')[_0x9f51('0xc')](socket);exports[_0x9f51('0xd')]=function(_0x5b96cd){var _0x4e02ff=this;return new Promise(function(_0x41e085,_0x4dbf6c){return db[_0x9f51('0xe')][_0x9f51('0xf')]({'raw':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd['options'][_0x9f51('0x11')]||null:null,'attributes':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd['options'][_0x9f51('0x12')]||null:null,'limit':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd[_0x9f51('0x10')][_0x9f51('0x13')]||null:null,'include':_0x5b96cd[_0x9f51('0x10')]?_0x5b96cd[_0x9f51('0x10')][_0x9f51('0x14')]?_['map'](_0x5b96cd[_0x9f51('0x10')][_0x9f51('0x14')],function(_0x20e489){return{'model':db[_0x20e489[_0x9f51('0x15')]],'as':_0x20e489['as'],'attributes':_0x20e489['attributes'],'include':_0x20e489[_0x9f51('0x14')]?_[_0x9f51('0x16')](_0x20e489[_0x9f51('0x14')],function(_0x56d426){return{'model':db[_0x56d426[_0x9f51('0x15')]],'as':_0x56d426['as'],'attributes':_0x56d426[_0x9f51('0x12')],'include':_0x56d426[_0x9f51('0x14')]?_['map'](_0x56d426[_0x9f51('0x14')],function(_0x53e79f){return{'model':db[_0x53e79f['model']],'as':_0x53e79f['as'],'attributes':_0x53e79f['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f51('0x17')](function(_0x4266d7){logger[_0x9f51('0x18')]('GetUser',_0x5b96cd);logger[_0x9f51('0x19')](_0x9f51('0xd'),_0x5b96cd,JSON['stringify'](_0x4266d7));_0x41e085(_0x4266d7);})[_0x9f51('0x1a')](function(_0x1afe23){logger[_0x9f51('0x1b')](_0x9f51('0xd'),_0x1afe23[_0x9f51('0x1c')],_0x5b96cd);_0x4dbf6c(_0x4e02ff[_0x9f51('0x1b')](0x1f4,_0x1afe23[_0x9f51('0x1c')]));});});};exports[_0x9f51('0x1d')]=function(_0x13eba5){var _0x10a98b=this;return new Promise(function(_0x12d843,_0x503cdf){return db[_0x9f51('0xe')][_0x9f51('0x1e')]({'raw':_0x13eba5[_0x9f51('0x10')]?_0x13eba5['options'][_0x9f51('0x1f')]===undefined?!![]:![]:!![],'where':_0x13eba5[_0x9f51('0x10')]?_0x13eba5[_0x9f51('0x10')][_0x9f51('0x11')]||null:null,'attributes':_0x13eba5['options']?_0x13eba5['options']['attributes']||null:null,'include':_0x13eba5[_0x9f51('0x10')]?_0x13eba5[_0x9f51('0x10')][_0x9f51('0x14')]?_['map'](_0x13eba5['options'][_0x9f51('0x14')],function(_0x35b6dc){return{'model':db[_0x35b6dc['model']],'as':_0x35b6dc['as'],'attributes':_0x35b6dc[_0x9f51('0x12')],'include':_0x35b6dc[_0x9f51('0x14')]?_[_0x9f51('0x16')](_0x35b6dc[_0x9f51('0x14')],function(_0x521dcc){return{'model':db[_0x521dcc['model']],'as':_0x521dcc['as'],'attributes':_0x521dcc['attributes'],'include':_0x521dcc[_0x9f51('0x14')]?_[_0x9f51('0x16')](_0x521dcc[_0x9f51('0x14')],function(_0x3b79ad){return{'model':db[_0x3b79ad[_0x9f51('0x15')]],'as':_0x3b79ad['as'],'attributes':_0x3b79ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f51('0x17')](function(_0x4eb64d){logger[_0x9f51('0x18')]('ShowUser',_0x13eba5);logger['debug'](_0x9f51('0x1d'),_0x13eba5,JSON[_0x9f51('0x20')](_0x4eb64d));_0x12d843(_0x4eb64d);})[_0x9f51('0x1a')](function(_0xd60791){logger[_0x9f51('0x1b')]('ShowUser',_0xd60791[_0x9f51('0x1c')],_0x13eba5);_0x503cdf(_0x10a98b[_0x9f51('0x1b')](0x1f4,_0xd60791['message']));});});};exports[_0x9f51('0x21')]=function(_0x2409b9){var _0x5cc6a0=this;return new Promise(function(_0x234364,_0x1c8f4e){var _0x288164;return db[_0x9f51('0xe')][_0x9f51('0x1e')]({'where':_0x2409b9[_0x9f51('0x10')][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22'),_0x9f51('0x23'),_0x9f51('0x24'),'interface']})[_0x9f51('0x17')](function(_0x1ae247){if(_0x1ae247){_0x288164=_0x1ae247;return db[_0x9f51('0x25')][_0x9f51('0x26')]({'paused':0x1},{'where':{'UserId':_0x288164['id']},'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x288164){return db[_0x9f51('0x27')][_0x9f51('0xf')]({'where':{'membername':_0x288164[_0x9f51('0x22')],'type':_0x9f51('0x28'),'exitAt':null}});}})[_0x9f51('0x17')](function(_0x8de782){if(_0x288164){if(_0x8de782&&_0x8de782[_0x9f51('0x29')]){var _0x3c611a=moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x223419=0x0,_0xf288c6=_0x8de782[_0x9f51('0x29')];_0x223419<_0xf288c6;_0x223419++){_0x8de782[_0x223419][_0x9f51('0x2b')]({'exitAt':_0x3c611a});}}}})[_0x9f51('0x17')](function(){if(_0x288164){var _0x583357=[];var _0xaf2ca9=utils[_0x9f51('0x2c')]();_0xaf2ca9['forEach'](function(_0xa3fd8f){_0x583357[_0x9f51('0x2d')]({'channel':_0xa3fd8f,'membername':_0x288164['name'],'interface':_[_0x9f51('0x2e')](_0x288164[_0x9f51('0x2f')])?util['format'](_0x9f51('0x30'),_0x288164[_0x9f51('0x22')]):_0x288164[_0x9f51('0x2f')],'type':'PAUSE','enterAt':moment()['format'](_0x9f51('0x31')),'data1':_0x2409b9['body']['type']||_0x9f51('0x32'),'role':_0x288164[_0x9f51('0x23')],'internal':_0x288164[_0x9f51('0x24')],'uniqueid':_0x2409b9[_0x9f51('0x33')][_0x9f51('0x34')]||null});});return db[_0x9f51('0x27')]['bulkCreate'](_0x583357,{'individualHooks':!![]});}})['then'](function(){if(_0x288164){return _0x288164[_0x9f51('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2409b9[_0x9f51('0x33')][_0x9f51('0x35')]||_0x9f51('0x32'),'lastPauseAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31'))});}})['then'](function(_0x206d5c){_0x234364(_0x206d5c);})['catch'](function(_0x4d8dfb){_0x1c8f4e(_0x5cc6a0[_0x9f51('0x1b')](0x1f4,_0x4d8dfb[_0x9f51('0x1c')]));});});};exports['UnpauseUser']=function(_0x82f954){var _0x537531=this;return new Promise(function(_0x479dcd,_0x3ad097){if(_0x82f954[_0x9f51('0x33')]['channel']&&!utils[_0x9f51('0x36')](_0x82f954[_0x9f51('0x33')][_0x9f51('0x37')])){throw new Error(util[_0x9f51('0x2a')](_0x9f51('0x38'),_0x82f954['body']['channel']));}return db[_0x9f51('0xe')][_0x9f51('0x39')]({'where':_0x82f954['options'][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22'),_0x9f51('0x23'),'internal',_0x9f51('0x2f'),_0x9f51('0x3a'),_0x9f51('0x3b'),_0x9f51('0x3c'),_0x9f51('0x3d'),'faxPause',_0x9f51('0x3e'),'smsPause','whatsappPause',_0x9f51('0x3f'),_0x9f51('0x40')]})[_0x9f51('0x17')](function(_0x1ce157){if(!_0x1ce157){throw new Error(util['format'](_0x9f51('0x41'),_0x82f954['params']['id']));}return _0x1ce157[_0x9f51('0x42')](_0x82f954[_0x9f51('0x33')][_0x9f51('0x37')],_0x9f51('0x43'));})[_0x9f51('0x17')](function(_0x3d9ee9){_0x479dcd(_0x3d9ee9);})[_0x9f51('0x1a')](function(_0xe7e4f0){_0x3ad097(_0x537531[_0x9f51('0x1b')](0x1f4,_0xe7e4f0[_0x9f51('0x1c')]));});});};exports[_0x9f51('0x44')]=function(_0x4129f3){var _0x1f825d=this;return new Promise(function(_0x201df5,_0x4cf952){var _0x28f50c;return db[_0x9f51('0xe')]['findOne']({'where':_0x4129f3[_0x9f51('0x10')][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22')]})[_0x9f51('0x17')](function(_0x2d390d){if(_0x2d390d){_0x28f50c=_0x2d390d;return db[_0x9f51('0x25')]['destroy']({'where':{'membername':_0x28f50c[_0x9f51('0x22')]},'individualHooks':!![]});}})['then'](function(){if(_0x28f50c){return db[_0x9f51('0x27')][_0x9f51('0xf')]({'where':{'membername':_0x28f50c[_0x9f51('0x22')],'exitAt':null}});}})['then'](function(_0x4e96a3){if(_0x28f50c){if(_0x4e96a3&&_0x4e96a3[_0x9f51('0x29')]){var _0xca8b85=[];_0x4e96a3[_0x9f51('0x45')](function(_0x270198){_0xca8b85['push'](_0x270198['update']({'exitAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9f51('0x46')](_0xca8b85);}}})[_0x9f51('0x17')](function(){if(_0x28f50c){return _0x28f50c['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9f51('0x17')](function(_0x1bcf7d){_0x201df5(_0x1bcf7d);})[_0x9f51('0x1a')](function(_0x2c7ef2){_0x4cf952(_0x1f825d[_0x9f51('0x1b')](0x1f4,_0x2c7ef2[_0x9f51('0x1c')]));});});};exports[_0x9f51('0x47')]=function(_0x266c15){var _0x59a9d0=this;return new Promise(function(_0x3c170e,_0x5ecda2){var _0x52bd11;var _0x577590;var _0xdb40d4;var _0x457b37;return db['User'][_0x9f51('0x39')]({'where':_0x266c15['options'][_0x9f51('0x11')]||{},'attributes':['id',_0x9f51('0x22'),_0x9f51('0x23'),_0x9f51('0x48'),_0x9f51('0x49'),_0x9f51('0x24'),_0x9f51('0x4a'),_0x9f51('0x2f')]})[_0x9f51('0x17')](function(_0x2441be){if(_0x2441be){_0x52bd11=_0x2441be;_0x457b37=_0x266c15['body'][_0x9f51('0x2f')]?_0x266c15['body'][_0x9f51('0x2f')]:util[_0x9f51('0x2a')](_0x9f51('0x30'),_0x52bd11['name']);return db[_0x9f51('0xe')][_0x9f51('0x4b')]({'where':{'role':_0x9f51('0x4c'),'online':!![],'id':{'$ne':_0x52bd11['id']}}});}})[_0x9f51('0x17')](function(_0x1143c8){if(_0x1143c8){_0xdb40d4=_0x1143c8;return require(_0x9f51('0x4d'))[_0x9f51('0x4e')]();}})['then'](function(_0x277b36){if(_0x277b36&&_0x277b36[_0x9f51('0x4f')]&&_0xdb40d4>=_0x277b36[_0x9f51('0x4f')]){throw new Error(_0x9f51('0x50'));}})[_0x9f51('0x17')](function(){if(_0x52bd11){return db[_0x9f51('0x25')][_0x9f51('0x51')]({'where':{'membername':_0x52bd11[_0x9f51('0x22')]},'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x52bd11){return _0x52bd11[_0x9f51('0x52')]({'raw':!![]});}})['then'](function(_0x4d7634){if(_0x52bd11){if(_0x4d7634){var _0x325e22=[];_0x577590=_0x4d7634;if(_0x577590[_0x9f51('0x29')]){for(var _0x4a68fa=0x0;_0x4a68fa<_0x577590[_0x9f51('0x29')];_0x4a68fa++){_0x325e22['push'](db[_0x9f51('0x25')]['upsert']({'membername':_0x52bd11[_0x9f51('0x22')],'UserId':_0x52bd11['id'],'queue_name':_0x577590[_0x4a68fa]['name'],'VoiceQueueId':_0x577590[_0x4a68fa]['id'],'interface':_0x457b37,'paused':_0x52bd11[_0x9f51('0x4a')]||![],'penalty':_0x577590[_0x4a68fa]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x9f51('0x46')](_0x325e22);}}}})['then'](function(){if(_0x52bd11){return db[_0x9f51('0x27')][_0x9f51('0xf')]({'where':{'membername':_0x52bd11[_0x9f51('0x22')],'exitAt':null}});}})[_0x9f51('0x17')](function(_0x5234c5){if(_0x52bd11){if(_0x5234c5&&_0x5234c5[_0x9f51('0x29')]){var _0x4b4886=[];_0x5234c5[_0x9f51('0x45')](function(_0x273e75){_0x4b4886[_0x9f51('0x2d')](_0x273e75[_0x9f51('0x26')]({'exitAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31'))}));});return BPromise[_0x9f51('0x46')](_0x4b4886);}}})[_0x9f51('0x17')](function(){if(_0x52bd11){var _0x57c1c8=[];var _0x27013e=[];var _0x532bbb=utils['getChannels']();var _0x528454={'membername':_0x52bd11[_0x9f51('0x22')],'interface':_0x457b37,'enterAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x52bd11[_0x9f51('0x23')],'internal':_0x52bd11[_0x9f51('0x24')]};_0x532bbb['forEach'](function(_0x257e7b){_0x57c1c8[_0x9f51('0x2d')](_[_0x9f51('0x53')]({'channel':_0x257e7b,'type':_0x9f51('0x54'),'data1':'callysquare','data2':_0x457b37},_0x528454));if(_0x52bd11[_0x9f51('0x4a')]){_0x27013e[_0x9f51('0x2d')](_['merge']({'channel':_0x257e7b,'type':'PAUSE','data1':_0x9f51('0x55')},_0x528454));}});return db[_0x9f51('0x27')][_0x9f51('0x56')](_0x57c1c8[_0x9f51('0x57')](_0x27013e),{'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x52bd11){return _0x52bd11[_0x9f51('0x26')]({'online':!![],'lastLoginAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x52bd11[_0x9f51('0x4a')]||![],'mailPause':_0x52bd11[_0x9f51('0x4a')]||![],'chatPause':_0x52bd11[_0x9f51('0x4a')]||![],'faxPause':_0x52bd11[_0x9f51('0x4a')]||![],'smsPause':_0x52bd11[_0x9f51('0x4a')]||![],'openchannelPause':_0x52bd11[_0x9f51('0x4a')]||![],'pauseType':_0x52bd11[_0x9f51('0x4a')]?_0x9f51('0x55'):null,'lastPauseAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31')),'interface':_0x457b37});}})[_0x9f51('0x17')](function(_0x3e8679){_0x3c170e(_0x3e8679);})[_0x9f51('0x1a')](function(_0x5cb256){_0x5ecda2(_0x59a9d0[_0x9f51('0x1b')](0x1f4,_0x5cb256[_0x9f51('0x1c')]));});});};
\ No newline at end of file