Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / services / ami / report / userReport.js
index e9934e0..fce3928 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf933=['device','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','phone','local','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s'];(function(_0x26e2f4,_0x7fdf9){var _0x472524=function(_0x5e5b0b){while(--_0x5e5b0b){_0x26e2f4['push'](_0x26e2f4['shift']());}};_0x472524(++_0x7fdf9);}(_0xf933,0x17b));var _0x3f93=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0xf933[_0x409deb];return _0x15a4f7;};'use strict';var _=require(_0x3f93('0x0'));var moment=require(_0x3f93('0x1'));var util=require(_0x3f93('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x3f93('0x3'));var logger=require('../../../config/logger')(_0x3f93('0x4'));var ami=require(_0x3f93('0x5'));config[_0x3f93('0x6')]=_['defaults'](config[_0x3f93('0x6')],{'host':_0x3f93('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f93('0x6')]));function UserReport(_0x34e72b){this[_0x3f93('0x8')]=_0x34e72b[_0x3f93('0x8')];this[_0x3f93('0x9')]=_0x34e72b[_0x3f93('0x9')];this[_0x3f93('0xa')]=_0x34e72b['telephones'];ami['on'](_0x3f93('0xb'),this[_0x3f93('0xc')][_0x3f93('0xd')](this));ami['on'](_0x3f93('0xe'),this['syncRegistry']['bind'](this));ami['on'](_0x3f93('0xf'),this[_0x3f93('0x10')][_0x3f93('0xd')](this));ami['on'](_0x3f93('0x11'),this['syncPeerStatus'][_0x3f93('0xd')](this));return this[_0x3f93('0x12')]();}function showSipRegistrations(){Promise[_0x3f93('0x13')]()[_0x3f93('0x14')](ami['actionSipShowRegistry']())[_0x3f93('0x15')](function(_0x1c2d8a){logger[_0x3f93('0x16')](_0x3f93('0x17'),util['inspect'](_0x1c2d8a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x3f93('0x18')]())[_0x3f93('0x15')](function(_0x2965a4){logger['error']('[userReport][devicestatelist]',util[_0x3f93('0x19')](_0x2965a4,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3f93('0x13')]()['then'](ami[_0x3f93('0x1a')]())[_0x3f93('0x15')](function(_0x4bb962){logger[_0x3f93('0x16')](_0x3f93('0x1b'),util['inspect'](_0x4bb962,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x3f93('0x13')]()['then'](showSipRegistrations())[_0x3f93('0x14')](listDeviceStates())[_0x3f93('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x3f93('0x1c')][_0x3f93('0x1d')]=function(_0x2cb56d){return _0x2cb56d!==null&&!_[_0x3f93('0x1e')](_0x2cb56d);};UserReport[_0x3f93('0x1c')][_0x3f93('0x1f')]=function(_0xf9b900,_0x2aaf5b,_0x2d3f99){io['to'](_0xf9b900)['emit'](_0x2aaf5b,_0x2d3f99);};UserReport[_0x3f93('0x1c')]['syncRegistry']=function(_0x3d5585){try{if(this[_0x3f93('0x1d')](_0x3d5585)){logger[_0x3f93('0x20')](_0x3f93('0x21'),_0x3d5585[_0x3f93('0x22')],_0x3d5585[_0x3f93('0x23')]);logger[_0x3f93('0x24')](_0x3f93('0x25'),util[_0x3f93('0x19')](_0x3d5585,{'showHidden':![],'depth':null}));var _0x124b91=_[_0x3f93('0x26')](this['trunks'],{'defaultuser':_0x3d5585['username']});if(_0x124b91){_0x3d5585[_0x3f93('0x27')]=_0x3d5585['state'];_['merge'](_0x124b91,_[_0x3f93('0x28')](_0x3d5585,['event',_0x3f93('0x29'),_0x3f93('0x22'),_0x3f93('0x23')]));logger[_0x3f93('0x24')](_0x3f93('0x2a'),util[_0x3f93('0x19')](_0x124b91,{'showHidden':![],'depth':null}));this['emit'](util[_0x3f93('0x2b')]('trunk:%s',_0x124b91[_0x3f93('0x2c')]),_0x3f93('0x2d'),_0x124b91);}}}catch(_0x382d9b){logger[_0x3f93('0x16')](_0x3f93('0x25'),util[_0x3f93('0x19')](_0x382d9b,{'showHidden':![],'depth':null}));}};UserReport[_0x3f93('0x1c')]['syncDeviceState']=function(_0x3f623d){try{if(this[_0x3f93('0x1d')](_0x3f623d)){logger[_0x3f93('0x20')](_0x3f93('0x2e'),_0x3f623d[_0x3f93('0x2f')],_0x3f623d[_0x3f93('0x23')]);logger[_0x3f93('0x24')]('[userReport][devicestatechange]',util[_0x3f93('0x19')](_0x3f623d,{'showHidden':![],'depth':null}));if(this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]){if(!this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['local']||_0x3f623d['state'][_0x3f93('0x30')]()==_0x3f93('0x31')){this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['local']=![];if(this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['state']!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x32')]=_[_0x3f93('0x33')](moment()[_0x3f93('0x2b')]('x'));}this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]=_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]();this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x34')](_0x3f623d);}}else if(this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]]){if(this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]]['stateTime']=_[_0x3f93('0x33')](moment()[_0x3f93('0x2b')]('x'));}this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]=_0x3f623d[_0x3f93('0x23')]['toLowerCase']();logger[_0x3f93('0x24')](_0x3f93('0x35'),util[_0x3f93('0x19')](this['telephones'][_0x3f623d['device']],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')](_0x3f93('0x36'),this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x2c')]),'telephone:save',this[_0x3f93('0xa')][_0x3f623d['device']]);}else if(this['trunks'][_0x3f623d[_0x3f93('0x2f')]]){if(this[_0x3f93('0x8')][_0x3f623d['device']]['state']!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0x8')][_0x3f623d[_0x3f93('0x2f')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x3f623d['device']][_0x3f93('0x23')]=_0x3f623d['state'][_0x3f93('0x30')]();logger[_0x3f93('0x24')](_0x3f93('0x37'),util[_0x3f93('0x19')](this[_0x3f93('0x8')][_0x3f623d[_0x3f93('0x2f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('trunk:%s',this[_0x3f93('0x8')][_0x3f623d['device']][_0x3f93('0x2c')]),_0x3f93('0x2d'),this[_0x3f93('0x8')][_0x3f623d['device']]);}else if(_[_0x3f93('0x38')](_0x3f623d[_0x3f93('0x2f')],'Local')){var _0x23e868=_0x3f623d[_0x3f93('0x2f')];var _0x99980f=_0x23e868[_0x3f93('0x39')](_0x23e868[_0x3f93('0x3a')]('/')+0x1,_0x23e868[_0x3f93('0x3a')]('@'));var _0x57ac99=_[_0x3f93('0x26')](this[_0x3f93('0x9')],function(_0xe51853){return _0xe51853['mobile']==_0x99980f||_0xe51853[_0x3f93('0x3b')]==_0x99980f||_0xe51853['accountcode']==_0x99980f;});if(_0x57ac99){if(_0x57ac99[_0x3f93('0x23')]!==_0x3f623d['state']['toLowerCase']()){_0x57ac99[_0x3f93('0x32')]=_['toNumber'](moment()[_0x3f93('0x2b')]('x'));}_0x57ac99['state']=_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]();_0x57ac99[_0x3f93('0x3c')]=!![];_0x57ac99[_0x3f93('0x34')](_0x3f623d);}}}}catch(_0x4b38b5){logger[_0x3f93('0x16')]('[userReport][devicestatechange]',util[_0x3f93('0x19')](_0x4b38b5,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x3f93('0x3d')]=function(_0x4330cb){try{if(this[_0x3f93('0x1d')](_0x4330cb)&&this['isNotNull'](_0x4330cb[_0x3f93('0x11')])){logger[_0x3f93('0x20')](_0x3f93('0x3e'),_0x4330cb[_0x3f93('0x3f')],_0x4330cb[_0x3f93('0x40')],_0x4330cb[_0x3f93('0x11')]);logger[_0x3f93('0x24')](_0x3f93('0x41'),util['inspect'](_0x4330cb,{'showHidden':![],'depth':null}));if(this['agents'][_0x4330cb[_0x3f93('0x3f')]]){if(!this[_0x3f93('0x9')][_0x4330cb['peer']]['local']||_0x4330cb[_0x3f93('0x11')][_0x3f93('0x30')]()==_0x3f93('0x42')){this['agents'][_0x4330cb[_0x3f93('0x3f')]]['local']=![];this['agents'][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x43')]=_0x4330cb['peerstatus'][_0x3f93('0x30')]();this[_0x3f93('0x9')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x40')]=_0x4330cb[_0x3f93('0x40')];this[_0x3f93('0x9')][_0x4330cb['peer']][_0x3f93('0x34')](_0x4330cb);}}else if(this['telephones'][_0x4330cb[_0x3f93('0x3f')]]){this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x43')]=_0x4330cb[_0x3f93('0x11')][_0x3f93('0x30')]();this[_0x3f93('0xa')][_0x4330cb['peer']]['address']=_0x4330cb[_0x3f93('0x40')];logger['debug'](_0x3f93('0x44'),util[_0x3f93('0x19')](this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('telephone:%s',this[_0x3f93('0xa')][_0x4330cb['peer']][_0x3f93('0x2c')]),_0x3f93('0x45'),this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]]);}else if(this['trunks'][_0x4330cb['peer']]){this[_0x3f93('0x8')][_0x4330cb['peer']][_0x3f93('0x43')]=_0x4330cb['peerstatus'][_0x3f93('0x30')]();this[_0x3f93('0x8')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x40')]=_0x4330cb[_0x3f93('0x40')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x3f93('0x19')](this['trunks'][_0x4330cb[_0x3f93('0x3f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('trunk:%s',this[_0x3f93('0x8')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x2c')]),'trunk:save',this['trunks'][_0x4330cb[_0x3f93('0x3f')]]);}}}catch(_0x5ef731){logger[_0x3f93('0x16')]('[userReport][peerstatus]',util[_0x3f93('0x19')](_0x5ef731,{'showHidden':![],'depth':null}));}};module[_0x3f93('0x46')]=UserReport;
\ No newline at end of file
+var _0xdc11=['phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','trunk:save','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','resolve','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','then','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','stateRegistry','merge','omit','event','actionid','format','trunk:%s','name','device','state','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','find','mobile'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdc11,0x1cd));var _0x1dc1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc11[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dc1('0x0'));var moment=require(_0x1dc1('0x1'));var util=require('util');var Redis=require(_0x1dc1('0x2'));var BPromise=require(_0x1dc1('0x3'));var config=require(_0x1dc1('0x4'));var logger=require(_0x1dc1('0x5'))(_0x1dc1('0x6'));var ami=require('../ami');config['redis']=_[_0x1dc1('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1dc1('0x8'))(new Redis(config['redis']));function UserReport(_0x15b367){this[_0x1dc1('0x9')]=_0x15b367[_0x1dc1('0x9')];this[_0x1dc1('0xa')]=_0x15b367[_0x1dc1('0xa')];this[_0x1dc1('0xb')]=_0x15b367[_0x1dc1('0xb')];ami['on'](_0x1dc1('0xc'),this[_0x1dc1('0xd')][_0x1dc1('0xe')](this));ami['on'](_0x1dc1('0xf'),this[_0x1dc1('0xd')][_0x1dc1('0xe')](this));ami['on'](_0x1dc1('0x10'),this[_0x1dc1('0x11')][_0x1dc1('0xe')](this));ami['on'](_0x1dc1('0x12'),this['syncPeerStatus'][_0x1dc1('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x1dc1('0x13')]()['then'](ami['actionSipShowRegistry']())['catch'](function(_0x56caf1){logger[_0x1dc1('0x14')](_0x1dc1('0x15'),util[_0x1dc1('0x16')](_0x56caf1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1dc1('0x13')]()['then'](ami[_0x1dc1('0x17')]())['catch'](function(_0x3c812c){logger[_0x1dc1('0x14')](_0x1dc1('0x18'),util[_0x1dc1('0x16')](_0x3c812c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1dc1('0x13')]()[_0x1dc1('0x19')](ami[_0x1dc1('0x1a')]())[_0x1dc1('0x1b')](function(_0x293322){logger[_0x1dc1('0x14')](_0x1dc1('0x1c'),util[_0x1dc1('0x16')](_0x293322,{'showHidden':![],'depth':null}));});}UserReport[_0x1dc1('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x1dc1('0x13')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x1dc1('0x19')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x1dc1('0x1e')]=function(_0x483bce){return _0x483bce!==null&&!_[_0x1dc1('0x1f')](_0x483bce);};UserReport[_0x1dc1('0x1d')][_0x1dc1('0x20')]=function(_0x61c640,_0x151be1,_0x4c05a4){io['to'](_0x61c640)[_0x1dc1('0x20')](_0x151be1,_0x4c05a4);};UserReport['prototype'][_0x1dc1('0xd')]=function(_0x5e8396){try{if(this[_0x1dc1('0x1e')](_0x5e8396)){logger[_0x1dc1('0x21')](_0x1dc1('0x22'),_0x5e8396[_0x1dc1('0x23')],_0x5e8396['state']);logger[_0x1dc1('0x24')](_0x1dc1('0x25'),util[_0x1dc1('0x16')](_0x5e8396,{'showHidden':![],'depth':null}));var _0x4f9891=_['find'](this[_0x1dc1('0x9')],{'defaultuser':_0x5e8396[_0x1dc1('0x23')]});if(_0x4f9891){_0x5e8396[_0x1dc1('0x26')]=_0x5e8396['state'];_[_0x1dc1('0x27')](_0x4f9891,_[_0x1dc1('0x28')](_0x5e8396,[_0x1dc1('0x29'),_0x1dc1('0x2a'),_0x1dc1('0x23'),'state']));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x1dc1('0x16')](_0x4f9891,{'showHidden':![],'depth':null}));this[_0x1dc1('0x20')](util[_0x1dc1('0x2b')](_0x1dc1('0x2c'),_0x4f9891[_0x1dc1('0x2d')]),'trunk:save',_0x4f9891);}}}catch(_0xb7896a){logger[_0x1dc1('0x14')](_0x1dc1('0x25'),util[_0x1dc1('0x16')](_0xb7896a,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1dc1('0x11')]=function(_0x7deb37){try{if(this[_0x1dc1('0x1e')](_0x7deb37)){logger[_0x1dc1('0x21')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x7deb37[_0x1dc1('0x2e')],_0x7deb37[_0x1dc1('0x2f')]);logger[_0x1dc1('0x24')](_0x1dc1('0x30'),util[_0x1dc1('0x16')](_0x7deb37,{'showHidden':![],'depth':null}));if(this['agents'][_0x7deb37['device']]){if(!this['agents'][_0x7deb37[_0x1dc1('0x2e')]]['local']||_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]()==_0x1dc1('0x32')){this[_0x1dc1('0xa')][_0x7deb37['device']][_0x1dc1('0x33')]=![];if(this[_0x1dc1('0xa')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]!==_0x7deb37['state'][_0x1dc1('0x31')]()){this[_0x1dc1('0xa')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x34')]=_['toNumber'](moment()['format']('x'));}this[_0x1dc1('0xa')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]=_0x7deb37['state'][_0x1dc1('0x31')]();this['agents'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x35')](_0x7deb37);}}else if(this['telephones'][_0x7deb37[_0x1dc1('0x2e')]]){if(this['telephones'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]!==_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]()){this[_0x1dc1('0xb')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x34')]=_[_0x1dc1('0x36')](moment()['format']('x'));}this['telephones'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]=_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]();logger[_0x1dc1('0x24')](_0x1dc1('0x37'),util[_0x1dc1('0x16')](this[_0x1dc1('0xb')][_0x7deb37[_0x1dc1('0x2e')]],{'showHidden':![],'depth':null}));this[_0x1dc1('0x20')](util[_0x1dc1('0x2b')](_0x1dc1('0x38'),this[_0x1dc1('0xb')][_0x7deb37[_0x1dc1('0x2e')]]['name']),_0x1dc1('0x39'),this['telephones'][_0x7deb37[_0x1dc1('0x2e')]]);}else if(this[_0x1dc1('0x9')][_0x7deb37[_0x1dc1('0x2e')]]){if(this[_0x1dc1('0x9')][_0x7deb37['device']][_0x1dc1('0x2f')]!==_0x7deb37[_0x1dc1('0x2f')]['toLowerCase']()){this[_0x1dc1('0x9')][_0x7deb37['device']][_0x1dc1('0x34')]=_['toNumber'](moment()[_0x1dc1('0x2b')]('x'));}this[_0x1dc1('0x9')][_0x7deb37[_0x1dc1('0x2e')]]['state']=_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]();logger['debug'](_0x1dc1('0x3a'),util[_0x1dc1('0x16')](this[_0x1dc1('0x9')][_0x7deb37['device']],{'showHidden':![],'depth':null}));this[_0x1dc1('0x20')](util[_0x1dc1('0x2b')](_0x1dc1('0x2c'),this['trunks'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2d')]),'trunk:save',this[_0x1dc1('0x9')][_0x7deb37[_0x1dc1('0x2e')]]);}else if(_[_0x1dc1('0x3b')](_0x7deb37[_0x1dc1('0x2e')],_0x1dc1('0x3c'))){var _0x1bee2e=_0x7deb37[_0x1dc1('0x2e')];var _0x2d54fc=_0x1bee2e['substring'](_0x1bee2e[_0x1dc1('0x3d')]('/')+0x1,_0x1bee2e[_0x1dc1('0x3d')]('@'));var _0x2867b9=_[_0x1dc1('0x3e')](this[_0x1dc1('0xa')],function(_0x4c8885){return _0x4c8885[_0x1dc1('0x3f')]==_0x2d54fc||_0x4c8885[_0x1dc1('0x40')]==_0x2d54fc||_0x4c8885[_0x1dc1('0x41')]==_0x2d54fc;});if(_0x2867b9){if(_0x2867b9['state']!==_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]()){_0x2867b9[_0x1dc1('0x34')]=_[_0x1dc1('0x36')](moment()['format']('x'));}_0x2867b9[_0x1dc1('0x2f')]=_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]();_0x2867b9['local']=!![];_0x2867b9[_0x1dc1('0x35')](_0x7deb37);}}}}catch(_0x20e682){logger['error'](_0x1dc1('0x30'),util['inspect'](_0x20e682,{'showHidden':![],'depth':null}));}};UserReport[_0x1dc1('0x1d')][_0x1dc1('0x42')]=function(_0x2a47b6){try{if(this['isNotNull'](_0x2a47b6)&&this[_0x1dc1('0x1e')](_0x2a47b6[_0x1dc1('0x12')])){logger['info'](_0x1dc1('0x43'),_0x2a47b6[_0x1dc1('0x44')],_0x2a47b6['address'],_0x2a47b6[_0x1dc1('0x12')]);logger[_0x1dc1('0x24')](_0x1dc1('0x45'),util[_0x1dc1('0x16')](_0x2a47b6,{'showHidden':![],'depth':null}));if(this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]]){if(!this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x33')]||_0x2a47b6[_0x1dc1('0x12')]['toLowerCase']()=='registered'){this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x33')]=![];this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]]['status']=_0x2a47b6['peerstatus'][_0x1dc1('0x31')]();this['agents'][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x46')]=_0x2a47b6[_0x1dc1('0x46')];this['agents'][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x35')](_0x2a47b6);}}else if(this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]]){this['telephones'][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x47')]=_0x2a47b6['peerstatus'][_0x1dc1('0x31')]();this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x46')]=_0x2a47b6[_0x1dc1('0x46')];logger[_0x1dc1('0x24')](_0x1dc1('0x48'),util[_0x1dc1('0x16')](this['telephones'][_0x2a47b6[_0x1dc1('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1dc1('0x38'),this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]]['name']),_0x1dc1('0x39'),this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]]);}else if(this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]){this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]['status']=_0x2a47b6['peerstatus']['toLowerCase']();this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]['address']=_0x2a47b6[_0x1dc1('0x46')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x1dc1('0x16')](this['trunks'][_0x2a47b6[_0x1dc1('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1dc1('0x2b')]('trunk:%s',this['trunks'][_0x2a47b6[_0x1dc1('0x44')]]['name']),_0x1dc1('0x49'),this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]);}}}catch(_0x4d2686){logger['error'](_0x1dc1('0x45'),util[_0x1dc1('0x16')](_0x4d2686,{'showHidden':![],'depth':null}));}};module[_0x1dc1('0x4a')]=UserReport;
\ No newline at end of file