Built motion from commit f3da74b7.|2.5.36
[motion2.git] / server / services / ami / report / userReport.js
index c192c3f..cab9a4b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedf7=['actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','emit','format','trunk:%s','name','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','substring','indexOf','find','mobile','accountcode','updateStatusRealtime','[userReport][devicestatechange]','peer','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../ami','defaults','redis','localhost','trunks','agents','telephones','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]'];(function(_0x4f21cd,_0x30f06f){var _0x1af331=function(_0x51145e){while(--_0x51145e){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x1af331(++_0x30f06f);}(_0xedf7,0x15d));var _0x7edf=function(_0x5aad20,_0x185dcb){_0x5aad20=_0x5aad20-0x0;var _0x589727=_0xedf7[_0x5aad20];return _0x589727;};'use strict';var _=require(_0x7edf('0x0'));var moment=require(_0x7edf('0x1'));var util=require(_0x7edf('0x2'));var Redis=require(_0x7edf('0x3'));var BPromise=require(_0x7edf('0x4'));var config=require(_0x7edf('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x7edf('0x6'));config['redis']=_[_0x7edf('0x7')](config[_0x7edf('0x8')],{'host':_0x7edf('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7edf('0x8')]));function UserReport(_0x16e1c9){this[_0x7edf('0xa')]=_0x16e1c9[_0x7edf('0xa')];this['agents']=_0x16e1c9[_0x7edf('0xb')];this[_0x7edf('0xc')]=_0x16e1c9['telephones'];ami['on']('registryentry',this[_0x7edf('0xd')]['bind'](this));ami['on']('registry',this[_0x7edf('0xd')][_0x7edf('0xe')](this));ami['on'](_0x7edf('0xf'),this['syncDeviceState']['bind'](this));ami['on'](_0x7edf('0x10'),this[_0x7edf('0x11')][_0x7edf('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x7edf('0x12')]()[_0x7edf('0x13')](ami[_0x7edf('0x14')]())['catch'](function(_0x4b6dd4){logger['error'](_0x7edf('0x15'),util[_0x7edf('0x16')](_0x4b6dd4,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7edf('0x12')]()[_0x7edf('0x13')](ami[_0x7edf('0x17')]())['catch'](function(_0x14c431){logger[_0x7edf('0x18')](_0x7edf('0x19'),util[_0x7edf('0x16')](_0x14c431,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x7edf('0x13')](ami[_0x7edf('0x1a')]())[_0x7edf('0x1b')](function(_0xdaa6c4){logger[_0x7edf('0x18')](_0x7edf('0x1c'),util['inspect'](_0xdaa6c4,{'showHidden':![],'depth':null}));});}UserReport[_0x7edf('0x1d')][_0x7edf('0x1e')]=function(){setInterval(function(){BPromise[_0x7edf('0x12')]()[_0x7edf('0x13')](showSipRegistrations())['then'](listDeviceStates())[_0x7edf('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x7edf('0x1d')][_0x7edf('0x1f')]=function(_0x65c99d){return _0x65c99d!==null&&!_[_0x7edf('0x20')](_0x65c99d);};UserReport[_0x7edf('0x1d')]['emit']=function(_0x15151b,_0x404881,_0xcd4a0){io['to'](_0x15151b)['emit'](_0x404881,_0xcd4a0);};UserReport[_0x7edf('0x1d')][_0x7edf('0xd')]=function(_0x403aa6){try{if(this['isNotNull'](_0x403aa6)){logger[_0x7edf('0x21')](_0x7edf('0x22'),_0x403aa6[_0x7edf('0x23')],_0x403aa6[_0x7edf('0x24')]);logger[_0x7edf('0x25')](_0x7edf('0x26'),util[_0x7edf('0x16')](_0x403aa6,{'showHidden':![],'depth':null}));var _0x215cda=_['find'](this[_0x7edf('0xa')],{'defaultuser':_0x403aa6[_0x7edf('0x23')]});if(_0x215cda){_0x403aa6['stateRegistry']=_0x403aa6[_0x7edf('0x24')];_['merge'](_0x215cda,_[_0x7edf('0x27')](_0x403aa6,[_0x7edf('0x28'),_0x7edf('0x29'),_0x7edf('0x23'),'state']));logger['debug'](_0x7edf('0x2a'),util[_0x7edf('0x16')](_0x215cda,{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')](_0x7edf('0x2d'),_0x215cda[_0x7edf('0x2e')]),'trunk:save',_0x215cda);}}}catch(_0x47b01c){logger[_0x7edf('0x18')](_0x7edf('0x26'),util[_0x7edf('0x16')](_0x47b01c,{'showHidden':![],'depth':null}));}};UserReport[_0x7edf('0x1d')][_0x7edf('0x2f')]=function(_0xc91d9c){try{if(this[_0x7edf('0x1f')](_0xc91d9c)){logger[_0x7edf('0x21')](_0x7edf('0x30'),_0xc91d9c[_0x7edf('0x31')],_0xc91d9c['state']);logger[_0x7edf('0x25')]('[userReport][devicestatechange]',util[_0x7edf('0x16')](_0xc91d9c,{'showHidden':![],'depth':null}));if(this[_0x7edf('0xb')][_0xc91d9c[_0x7edf('0x31')]]){if(!this[_0x7edf('0xb')][_0xc91d9c['device']][_0x7edf('0x32')]||_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()==_0x7edf('0x34')){this[_0x7edf('0xb')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x32')]=![];if(this['agents'][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x24')]!==_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()){this[_0x7edf('0xb')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x35')]=_[_0x7edf('0x36')](moment()[_0x7edf('0x2c')]('x'));}this[_0x7edf('0xb')][_0xc91d9c['device']]['state']=_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]();this[_0x7edf('0xb')][_0xc91d9c['device']]['updateStatusRealtime'](_0xc91d9c);}}else if(this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]]){if(this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x24')]!==_0xc91d9c[_0x7edf('0x24')]['toLowerCase']()){this['telephones'][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x35')]=_[_0x7edf('0x36')](moment()[_0x7edf('0x2c')]('x'));}this[_0x7edf('0xc')][_0xc91d9c['device']]['state']=_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]();logger[_0x7edf('0x25')](_0x7edf('0x37'),util[_0x7edf('0x16')](this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]],{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')](_0x7edf('0x38'),this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x2e')]),_0x7edf('0x39'),this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]]);}else if(this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]]){if(this['trunks'][_0xc91d9c[_0x7edf('0x31')]]['state']!==_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()){this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x35')]=_[_0x7edf('0x36')](moment()[_0x7edf('0x2c')]('x'));}this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]]['state']=_0xc91d9c['state'][_0x7edf('0x33')]();logger[_0x7edf('0x25')](_0x7edf('0x3a'),util[_0x7edf('0x16')](this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7edf('0x2c')]('trunk:%s',this['trunks'][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x2e')]),_0x7edf('0x3b'),this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]]);}else if(_['startsWith'](_0xc91d9c[_0x7edf('0x31')],_0x7edf('0x3c'))){var _0x4f9231=_0xc91d9c[_0x7edf('0x31')];var _0x448259=_0x4f9231[_0x7edf('0x3d')](_0x4f9231[_0x7edf('0x3e')]('/')+0x1,_0x4f9231[_0x7edf('0x3e')]('@'));var _0x398643=_[_0x7edf('0x3f')](this[_0x7edf('0xb')],function(_0x3b509d){return _0x3b509d[_0x7edf('0x40')]==_0x448259||_0x3b509d['phone']==_0x448259||_0x3b509d[_0x7edf('0x41')]==_0x448259;});if(_0x398643){if(_0x398643[_0x7edf('0x24')]!==_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()){_0x398643[_0x7edf('0x35')]=_['toNumber'](moment()[_0x7edf('0x2c')]('x'));}_0x398643[_0x7edf('0x24')]=_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]();_0x398643[_0x7edf('0x32')]=!![];_0x398643[_0x7edf('0x42')](_0xc91d9c);}}}}catch(_0xcbc056){logger[_0x7edf('0x18')](_0x7edf('0x43'),util[_0x7edf('0x16')](_0xcbc056,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x7edf('0x11')]=function(_0x49f159){try{if(this[_0x7edf('0x1f')](_0x49f159)&&this[_0x7edf('0x1f')](_0x49f159[_0x7edf('0x10')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x49f159[_0x7edf('0x44')],_0x49f159[_0x7edf('0x45')],_0x49f159[_0x7edf('0x10')]);logger[_0x7edf('0x25')]('[userReport][peerstatus]',util[_0x7edf('0x16')](_0x49f159,{'showHidden':![],'depth':null}));if(this['agents'][_0x49f159['peer']]){if(!this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x32')]||_0x49f159[_0x7edf('0x10')][_0x7edf('0x33')]()=='registered'){this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x32')]=![];this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x46')]=_0x49f159['peerstatus'][_0x7edf('0x33')]();this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x45')]=_0x49f159[_0x7edf('0x45')];this['agents'][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x42')](_0x49f159);}}else if(this[_0x7edf('0xc')][_0x49f159[_0x7edf('0x44')]]){this[_0x7edf('0xc')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x46')]=_0x49f159[_0x7edf('0x10')][_0x7edf('0x33')]();this['telephones'][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x45')]=_0x49f159[_0x7edf('0x45')];logger['debug'](_0x7edf('0x47'),util[_0x7edf('0x16')](this[_0x7edf('0xc')][_0x49f159['peer']],{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')](_0x7edf('0x38'),this[_0x7edf('0xc')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x2e')]),_0x7edf('0x39'),this['telephones'][_0x49f159[_0x7edf('0x44')]]);}else if(this[_0x7edf('0xa')][_0x49f159['peer']]){this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x46')]=_0x49f159[_0x7edf('0x10')][_0x7edf('0x33')]();this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]]['address']=_0x49f159[_0x7edf('0x45')];logger[_0x7edf('0x25')](_0x7edf('0x48'),util['inspect'](this['trunks'][_0x49f159[_0x7edf('0x44')]],{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')]('trunk:%s',this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x2e')]),_0x7edf('0x3b'),this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]]);}}}catch(_0x87f141){logger[_0x7edf('0x18')](_0x7edf('0x49'),util[_0x7edf('0x16')](_0x87f141,{'showHidden':![],'depth':null}));}};module[_0x7edf('0x4a')]=UserReport;
\ No newline at end of file
+var _0xf739=['[userReport][registry]','omit','event','actionid','emit','format','trunk:%s','trunk:save','device','agents','local','inuse','toLowerCase','stateTime','updateStatusRealtime','toNumber','telephone:%s','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','find','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','trunks','telephones','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug'];(function(_0x30e33c,_0x3969eb){var _0x30dff0=function(_0x303cde){while(--_0x303cde){_0x30e33c['push'](_0x30e33c['shift']());}};_0x30dff0(++_0x3969eb);}(_0xf739,0xb5));var _0x9f73=function(_0x3fae9c,_0x34a6d0){_0x3fae9c=_0x3fae9c-0x0;var _0x2ce598=_0xf739[_0x3fae9c];return _0x2ce598;};'use strict';var _=require(_0x9f73('0x0'));var moment=require('moment');var util=require(_0x9f73('0x1'));var Redis=require(_0x9f73('0x2'));var BPromise=require('bluebird');var config=require(_0x9f73('0x3'));var logger=require(_0x9f73('0x4'))(_0x9f73('0x5'));var ami=require('../ami');config['redis']=_[_0x9f73('0x6')](config[_0x9f73('0x7')],{'host':_0x9f73('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9f73('0x7')]));function UserReport(_0x108897){this[_0x9f73('0x9')]=_0x108897[_0x9f73('0x9')];this['agents']=_0x108897['agents'];this[_0x9f73('0xa')]=_0x108897['telephones'];ami['on']('registryentry',this[_0x9f73('0xb')]['bind'](this));ami['on'](_0x9f73('0xc'),this[_0x9f73('0xb')][_0x9f73('0xd')](this));ami['on'](_0x9f73('0xe'),this[_0x9f73('0xf')][_0x9f73('0xd')](this));ami['on'](_0x9f73('0x10'),this[_0x9f73('0x11')][_0x9f73('0xd')](this));return this[_0x9f73('0x12')]();}function showSipRegistrations(){Promise[_0x9f73('0x13')]()[_0x9f73('0x14')](ami[_0x9f73('0x15')]())[_0x9f73('0x16')](function(_0x26d424){logger[_0x9f73('0x17')](_0x9f73('0x18'),util[_0x9f73('0x19')](_0x26d424,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9f73('0x13')]()[_0x9f73('0x14')](ami[_0x9f73('0x1a')]())[_0x9f73('0x16')](function(_0x11321c){logger['error'](_0x9f73('0x1b'),util[_0x9f73('0x19')](_0x11321c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x9f73('0x14')](ami[_0x9f73('0x1c')]())[_0x9f73('0x16')](function(_0x55b650){logger[_0x9f73('0x17')](_0x9f73('0x1d'),util[_0x9f73('0x19')](_0x55b650,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x9f73('0x13')]()[_0x9f73('0x14')](showSipRegistrations())['then'](listDeviceStates())[_0x9f73('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x9f73('0x1e')]['isNotNull']=function(_0x20b704){return _0x20b704!==null&&!_[_0x9f73('0x1f')](_0x20b704);};UserReport[_0x9f73('0x1e')]['emit']=function(_0x1a6087,_0x1847e2,_0xd01b27){io['to'](_0x1a6087)['emit'](_0x1847e2,_0xd01b27);};UserReport[_0x9f73('0x1e')]['syncRegistry']=function(_0x3b8045){try{if(this[_0x9f73('0x20')](_0x3b8045)){logger[_0x9f73('0x21')](_0x9f73('0x22'),_0x3b8045[_0x9f73('0x23')],_0x3b8045[_0x9f73('0x24')]);logger[_0x9f73('0x25')](_0x9f73('0x26'),util[_0x9f73('0x19')](_0x3b8045,{'showHidden':![],'depth':null}));var _0xd854fa=_['find'](this[_0x9f73('0x9')],{'defaultuser':_0x3b8045[_0x9f73('0x23')]});if(_0xd854fa){_0x3b8045['stateRegistry']=_0x3b8045['state'];_['merge'](_0xd854fa,_[_0x9f73('0x27')](_0x3b8045,[_0x9f73('0x28'),_0x9f73('0x29'),'username',_0x9f73('0x24')]));logger[_0x9f73('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0xd854fa,{'showHidden':![],'depth':null}));this[_0x9f73('0x2a')](util[_0x9f73('0x2b')](_0x9f73('0x2c'),_0xd854fa['name']),_0x9f73('0x2d'),_0xd854fa);}}}catch(_0x54b200){logger[_0x9f73('0x17')]('[userReport][registry]',util[_0x9f73('0x19')](_0x54b200,{'showHidden':![],'depth':null}));}};UserReport[_0x9f73('0x1e')]['syncDeviceState']=function(_0x1f1725){try{if(this[_0x9f73('0x20')](_0x1f1725)){logger[_0x9f73('0x21')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x1f1725[_0x9f73('0x2e')],_0x1f1725[_0x9f73('0x24')]);logger[_0x9f73('0x25')]('[userReport][devicestatechange]',util[_0x9f73('0x19')](_0x1f1725,{'showHidden':![],'depth':null}));if(this['agents'][_0x1f1725[_0x9f73('0x2e')]]){if(!this[_0x9f73('0x2f')][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x30')]||_0x1f1725['state']['toLowerCase']()==_0x9f73('0x31')){this[_0x9f73('0x2f')][_0x1f1725['device']][_0x9f73('0x30')]=![];if(this[_0x9f73('0x2f')][_0x1f1725[_0x9f73('0x2e')]]['state']!==_0x1f1725['state'][_0x9f73('0x32')]()){this[_0x9f73('0x2f')][_0x1f1725['device']][_0x9f73('0x33')]=_['toNumber'](moment()[_0x9f73('0x2b')]('x'));}this[_0x9f73('0x2f')][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x24')]=_0x1f1725[_0x9f73('0x24')][_0x9f73('0x32')]();this[_0x9f73('0x2f')][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x34')](_0x1f1725);}}else if(this[_0x9f73('0xa')][_0x1f1725[_0x9f73('0x2e')]]){if(this['telephones'][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x24')]!==_0x1f1725[_0x9f73('0x24')]['toLowerCase']()){this['telephones'][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x33')]=_[_0x9f73('0x35')](moment()[_0x9f73('0x2b')]('x'));}this[_0x9f73('0xa')][_0x1f1725[_0x9f73('0x2e')]]['state']=_0x1f1725[_0x9f73('0x24')][_0x9f73('0x32')]();logger[_0x9f73('0x25')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x9f73('0xa')][_0x1f1725['device']],{'showHidden':![],'depth':null}));this[_0x9f73('0x2a')](util[_0x9f73('0x2b')](_0x9f73('0x36'),this[_0x9f73('0xa')][_0x1f1725['device']][_0x9f73('0x37')]),_0x9f73('0x38'),this[_0x9f73('0xa')][_0x1f1725[_0x9f73('0x2e')]]);}else if(this[_0x9f73('0x9')][_0x1f1725[_0x9f73('0x2e')]]){if(this[_0x9f73('0x9')][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x24')]!==_0x1f1725[_0x9f73('0x24')][_0x9f73('0x32')]()){this[_0x9f73('0x9')][_0x1f1725[_0x9f73('0x2e')]]['stateTime']=_['toNumber'](moment()[_0x9f73('0x2b')]('x'));}this[_0x9f73('0x9')][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x24')]=_0x1f1725[_0x9f73('0x24')][_0x9f73('0x32')]();logger[_0x9f73('0x25')](_0x9f73('0x39'),util[_0x9f73('0x19')](this[_0x9f73('0x9')][_0x1f1725[_0x9f73('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9f73('0x2b')](_0x9f73('0x2c'),this[_0x9f73('0x9')][_0x1f1725[_0x9f73('0x2e')]][_0x9f73('0x37')]),_0x9f73('0x2d'),this[_0x9f73('0x9')][_0x1f1725[_0x9f73('0x2e')]]);}else if(_[_0x9f73('0x3a')](_0x1f1725[_0x9f73('0x2e')],_0x9f73('0x3b'))){var _0x4cc74e=_0x1f1725[_0x9f73('0x2e')];var _0x21bb4e=_0x4cc74e['substring'](_0x4cc74e[_0x9f73('0x3c')]('/')+0x1,_0x4cc74e[_0x9f73('0x3c')]('@'));var _0x17a0fb=_[_0x9f73('0x3d')](this[_0x9f73('0x2f')],function(_0x4a43bd){return _0x4a43bd[_0x9f73('0x3e')]==_0x21bb4e||_0x4a43bd[_0x9f73('0x3f')]==_0x21bb4e||_0x4a43bd[_0x9f73('0x40')]==_0x21bb4e;});if(_0x17a0fb){if(_0x17a0fb['state']!==_0x1f1725[_0x9f73('0x24')][_0x9f73('0x32')]()){_0x17a0fb[_0x9f73('0x33')]=_[_0x9f73('0x35')](moment()[_0x9f73('0x2b')]('x'));}_0x17a0fb['state']=_0x1f1725[_0x9f73('0x24')]['toLowerCase']();_0x17a0fb[_0x9f73('0x30')]=!![];_0x17a0fb[_0x9f73('0x34')](_0x1f1725);}}}}catch(_0x79c8ab){logger['error'](_0x9f73('0x41'),util[_0x9f73('0x19')](_0x79c8ab,{'showHidden':![],'depth':null}));}};UserReport[_0x9f73('0x1e')][_0x9f73('0x11')]=function(_0x5b2776){try{if(this[_0x9f73('0x20')](_0x5b2776)&&this[_0x9f73('0x20')](_0x5b2776['peerstatus'])){logger[_0x9f73('0x21')](_0x9f73('0x42'),_0x5b2776[_0x9f73('0x43')],_0x5b2776[_0x9f73('0x44')],_0x5b2776['peerstatus']);logger[_0x9f73('0x25')](_0x9f73('0x45'),util[_0x9f73('0x19')](_0x5b2776,{'showHidden':![],'depth':null}));if(this['agents'][_0x5b2776[_0x9f73('0x43')]]){if(!this[_0x9f73('0x2f')][_0x5b2776['peer']][_0x9f73('0x30')]||_0x5b2776[_0x9f73('0x10')][_0x9f73('0x32')]()==_0x9f73('0x46')){this[_0x9f73('0x2f')][_0x5b2776[_0x9f73('0x43')]]['local']=![];this['agents'][_0x5b2776[_0x9f73('0x43')]]['status']=_0x5b2776['peerstatus']['toLowerCase']();this[_0x9f73('0x2f')][_0x5b2776[_0x9f73('0x43')]][_0x9f73('0x44')]=_0x5b2776[_0x9f73('0x44')];this[_0x9f73('0x2f')][_0x5b2776[_0x9f73('0x43')]]['updateStatusRealtime'](_0x5b2776);}}else if(this[_0x9f73('0xa')][_0x5b2776[_0x9f73('0x43')]]){this['telephones'][_0x5b2776[_0x9f73('0x43')]][_0x9f73('0x47')]=_0x5b2776[_0x9f73('0x10')]['toLowerCase']();this[_0x9f73('0xa')][_0x5b2776[_0x9f73('0x43')]][_0x9f73('0x44')]=_0x5b2776['address'];logger[_0x9f73('0x25')](_0x9f73('0x48'),util['inspect'](this[_0x9f73('0xa')][_0x5b2776[_0x9f73('0x43')]],{'showHidden':![],'depth':null}));this[_0x9f73('0x2a')](util[_0x9f73('0x2b')](_0x9f73('0x36'),this['telephones'][_0x5b2776[_0x9f73('0x43')]]['name']),_0x9f73('0x38'),this['telephones'][_0x5b2776[_0x9f73('0x43')]]);}else if(this[_0x9f73('0x9')][_0x5b2776[_0x9f73('0x43')]]){this[_0x9f73('0x9')][_0x5b2776['peer']][_0x9f73('0x47')]=_0x5b2776['peerstatus']['toLowerCase']();this['trunks'][_0x5b2776[_0x9f73('0x43')]][_0x9f73('0x44')]=_0x5b2776[_0x9f73('0x44')];logger[_0x9f73('0x25')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x9f73('0x19')](this[_0x9f73('0x9')][_0x5b2776[_0x9f73('0x43')]],{'showHidden':![],'depth':null}));this[_0x9f73('0x2a')](util[_0x9f73('0x2b')](_0x9f73('0x2c'),this[_0x9f73('0x9')][_0x5b2776['peer']][_0x9f73('0x37')]),'trunk:save',this['trunks'][_0x5b2776[_0x9f73('0x43')]]);}}}catch(_0x1aa803){logger[_0x9f73('0x17')](_0x9f73('0x45'),util[_0x9f73('0x19')](_0x1aa803,{'showHidden':![],'depth':null}));}};module['exports']=UserReport;
\ No newline at end of file