Built motion from commit fda31434.|2.5.44
[motion2.git] / server / services / ami / report / userReport.js
index b547d8b..eb91921 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa181=['peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','localhost','socket.io-emitter','trunks','bind','registry','syncRegistry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','state','[userReport][registry]','username','stateRegistry','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','device','agents','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephones','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s'];(function(_0x293a47,_0x2991c2){var _0x4e2baf=function(_0x41907b){while(--_0x41907b){_0x293a47['push'](_0x293a47['shift']());}};_0x4e2baf(++_0x2991c2);}(_0xa181,0x16c));var _0x1a18=function(_0xf35638,_0x2b8487){_0xf35638=_0xf35638-0x0;var _0x1972c7=_0xa181[_0xf35638];return _0x1972c7;};'use strict';var _=require(_0x1a18('0x0'));var moment=require(_0x1a18('0x1'));var util=require(_0x1a18('0x2'));var Redis=require(_0x1a18('0x3'));var BPromise=require(_0x1a18('0x4'));var config=require(_0x1a18('0x5'));var logger=require(_0x1a18('0x6'))(_0x1a18('0x7'));var ami=require('../ami');config['redis']=_['defaults'](config[_0x1a18('0x8')],{'host':_0x1a18('0x9'),'port':0x18eb});var io=require(_0x1a18('0xa'))(new Redis(config['redis']));function UserReport(_0xd1bd3f){this[_0x1a18('0xb')]=_0xd1bd3f[_0x1a18('0xb')];this['agents']=_0xd1bd3f['agents'];this['telephones']=_0xd1bd3f['telephones'];ami['on']('registryentry',this['syncRegistry'][_0x1a18('0xc')](this));ami['on'](_0x1a18('0xd'),this[_0x1a18('0xe')][_0x1a18('0xc')](this));ami['on']('devicestatechange',this[_0x1a18('0xf')][_0x1a18('0xc')](this));ami['on'](_0x1a18('0x10'),this[_0x1a18('0x11')]['bind'](this));return this[_0x1a18('0x12')]();}function showSipRegistrations(){Promise[_0x1a18('0x13')]()[_0x1a18('0x14')](ami[_0x1a18('0x15')]())[_0x1a18('0x16')](function(_0x3e97ad){logger[_0x1a18('0x17')](_0x1a18('0x18'),util[_0x1a18('0x19')](_0x3e97ad,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x1a18('0x14')](ami['actionDeviceStateList']())[_0x1a18('0x16')](function(_0x1d144d){logger[_0x1a18('0x17')](_0x1a18('0x1a'),util[_0x1a18('0x19')](_0x1d144d,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1a18('0x13')]()[_0x1a18('0x14')](ami['actionSipPeerStatus']())[_0x1a18('0x16')](function(_0x33f2ea){logger[_0x1a18('0x17')](_0x1a18('0x1b'),util[_0x1a18('0x19')](_0x33f2ea,{'showHidden':![],'depth':null}));});}UserReport[_0x1a18('0x1c')][_0x1a18('0x12')]=function(){setInterval(function(){BPromise['resolve']()[_0x1a18('0x14')](showSipRegistrations())[_0x1a18('0x14')](listDeviceStates())[_0x1a18('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x1a18('0x1c')][_0x1a18('0x1d')]=function(_0xf97e90){return _0xf97e90!==null&&!_[_0x1a18('0x1e')](_0xf97e90);};UserReport[_0x1a18('0x1c')][_0x1a18('0x1f')]=function(_0x3c472f,_0x12f2fe,_0x126449){io['to'](_0x3c472f)[_0x1a18('0x1f')](_0x12f2fe,_0x126449);};UserReport['prototype']['syncRegistry']=function(_0x3992ce){try{if(this[_0x1a18('0x1d')](_0x3992ce)){logger[_0x1a18('0x20')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x3992ce['username'],_0x3992ce[_0x1a18('0x21')]);logger['debug'](_0x1a18('0x22'),util[_0x1a18('0x19')](_0x3992ce,{'showHidden':![],'depth':null}));var _0x5f3953=_['find'](this[_0x1a18('0xb')],{'defaultuser':_0x3992ce[_0x1a18('0x23')]});if(_0x5f3953){_0x3992ce[_0x1a18('0x24')]=_0x3992ce[_0x1a18('0x21')];_['merge'](_0x5f3953,_[_0x1a18('0x25')](_0x3992ce,[_0x1a18('0x26'),_0x1a18('0x27'),_0x1a18('0x23'),_0x1a18('0x21')]));logger[_0x1a18('0x28')](_0x1a18('0x29'),util[_0x1a18('0x19')](_0x5f3953,{'showHidden':![],'depth':null}));this[_0x1a18('0x1f')](util[_0x1a18('0x2a')](_0x1a18('0x2b'),_0x5f3953[_0x1a18('0x2c')]),_0x1a18('0x2d'),_0x5f3953);}}}catch(_0x57b272){logger[_0x1a18('0x17')](_0x1a18('0x22'),util[_0x1a18('0x19')](_0x57b272,{'showHidden':![],'depth':null}));}};UserReport[_0x1a18('0x1c')][_0x1a18('0xf')]=function(_0x3ef243){try{if(this[_0x1a18('0x1d')](_0x3ef243)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3ef243[_0x1a18('0x2e')],_0x3ef243['state']);logger[_0x1a18('0x28')]('[userReport][devicestatechange]',util[_0x1a18('0x19')](_0x3ef243,{'showHidden':![],'depth':null}));if(this[_0x1a18('0x2f')][_0x3ef243[_0x1a18('0x2e')]]){if(!this[_0x1a18('0x2f')][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x30')]||_0x3ef243[_0x1a18('0x21')][_0x1a18('0x31')]()=='inuse'){this['agents'][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x30')]=![];if(this[_0x1a18('0x2f')][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x21')]!==_0x3ef243[_0x1a18('0x21')][_0x1a18('0x31')]()){this[_0x1a18('0x2f')][_0x3ef243['device']][_0x1a18('0x32')]=_[_0x1a18('0x33')](moment()['format']('x'));}this[_0x1a18('0x2f')][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x21')]=_0x3ef243[_0x1a18('0x21')][_0x1a18('0x31')]();this[_0x1a18('0x2f')][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x34')](_0x3ef243);}}else if(this[_0x1a18('0x35')][_0x3ef243[_0x1a18('0x2e')]]){if(this[_0x1a18('0x35')][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x21')]!==_0x3ef243[_0x1a18('0x21')][_0x1a18('0x31')]()){this[_0x1a18('0x35')][_0x3ef243['device']][_0x1a18('0x32')]=_['toNumber'](moment()['format']('x'));}this[_0x1a18('0x35')][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x21')]=_0x3ef243[_0x1a18('0x21')][_0x1a18('0x31')]();logger[_0x1a18('0x28')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x1a18('0x19')](this[_0x1a18('0x35')][_0x3ef243[_0x1a18('0x2e')]],{'showHidden':![],'depth':null}));this[_0x1a18('0x1f')](util['format']('telephone:%s',this[_0x1a18('0x35')][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x2c')]),_0x1a18('0x36'),this[_0x1a18('0x35')][_0x3ef243[_0x1a18('0x2e')]]);}else if(this[_0x1a18('0xb')][_0x3ef243[_0x1a18('0x2e')]]){if(this['trunks'][_0x3ef243[_0x1a18('0x2e')]]['state']!==_0x3ef243[_0x1a18('0x21')]['toLowerCase']()){this[_0x1a18('0xb')][_0x3ef243[_0x1a18('0x2e')]]['stateTime']=_[_0x1a18('0x33')](moment()[_0x1a18('0x2a')]('x'));}this['trunks'][_0x3ef243[_0x1a18('0x2e')]][_0x1a18('0x21')]=_0x3ef243[_0x1a18('0x21')][_0x1a18('0x31')]();logger[_0x1a18('0x28')](_0x1a18('0x37'),util[_0x1a18('0x19')](this[_0x1a18('0xb')][_0x3ef243[_0x1a18('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1a18('0x2b'),this[_0x1a18('0xb')][_0x3ef243['device']][_0x1a18('0x2c')]),'trunk:save',this[_0x1a18('0xb')][_0x3ef243[_0x1a18('0x2e')]]);}else if(_[_0x1a18('0x38')](_0x3ef243['device'],_0x1a18('0x39'))){var _0x4f32df=_0x3ef243[_0x1a18('0x2e')];var _0x4590da=_0x4f32df[_0x1a18('0x3a')](_0x4f32df[_0x1a18('0x3b')]('/')+0x1,_0x4f32df[_0x1a18('0x3b')]('@'));var _0xc0746a=_['find'](this['agents'],function(_0x277d0e){return _0x277d0e['mobile']==_0x4590da||_0x277d0e[_0x1a18('0x3c')]==_0x4590da||_0x277d0e['accountcode']==_0x4590da;});if(_0xc0746a){if(_0xc0746a[_0x1a18('0x21')]!==_0x3ef243[_0x1a18('0x21')][_0x1a18('0x31')]()){_0xc0746a['stateTime']=_[_0x1a18('0x33')](moment()[_0x1a18('0x2a')]('x'));}_0xc0746a[_0x1a18('0x21')]=_0x3ef243['state'][_0x1a18('0x31')]();_0xc0746a['local']=!![];_0xc0746a[_0x1a18('0x34')](_0x3ef243);}}}}catch(_0x4fcced){logger[_0x1a18('0x17')]('[userReport][devicestatechange]',util[_0x1a18('0x19')](_0x4fcced,{'showHidden':![],'depth':null}));}};UserReport[_0x1a18('0x1c')][_0x1a18('0x11')]=function(_0x1f5f10){try{if(this[_0x1a18('0x1d')](_0x1f5f10)&&this[_0x1a18('0x1d')](_0x1f5f10[_0x1a18('0x10')])){logger['info'](_0x1a18('0x3d'),_0x1f5f10[_0x1a18('0x3e')],_0x1f5f10['address'],_0x1f5f10['peerstatus']);logger[_0x1a18('0x28')](_0x1a18('0x3f'),util[_0x1a18('0x19')](_0x1f5f10,{'showHidden':![],'depth':null}));if(this[_0x1a18('0x2f')][_0x1f5f10[_0x1a18('0x3e')]]){if(!this[_0x1a18('0x2f')][_0x1f5f10['peer']][_0x1a18('0x30')]||_0x1f5f10['peerstatus']['toLowerCase']()==_0x1a18('0x40')){this[_0x1a18('0x2f')][_0x1f5f10[_0x1a18('0x3e')]][_0x1a18('0x30')]=![];this['agents'][_0x1f5f10[_0x1a18('0x3e')]][_0x1a18('0x41')]=_0x1f5f10[_0x1a18('0x10')][_0x1a18('0x31')]();this[_0x1a18('0x2f')][_0x1f5f10[_0x1a18('0x3e')]][_0x1a18('0x42')]=_0x1f5f10[_0x1a18('0x42')];this[_0x1a18('0x2f')][_0x1f5f10[_0x1a18('0x3e')]][_0x1a18('0x34')](_0x1f5f10);}}else if(this['telephones'][_0x1f5f10[_0x1a18('0x3e')]]){this[_0x1a18('0x35')][_0x1f5f10[_0x1a18('0x3e')]]['status']=_0x1f5f10[_0x1a18('0x10')]['toLowerCase']();this[_0x1a18('0x35')][_0x1f5f10[_0x1a18('0x3e')]][_0x1a18('0x42')]=_0x1f5f10['address'];logger[_0x1a18('0x28')](_0x1a18('0x43'),util[_0x1a18('0x19')](this[_0x1a18('0x35')][_0x1f5f10[_0x1a18('0x3e')]],{'showHidden':![],'depth':null}));this[_0x1a18('0x1f')](util[_0x1a18('0x2a')](_0x1a18('0x44'),this[_0x1a18('0x35')][_0x1f5f10['peer']]['name']),_0x1a18('0x36'),this[_0x1a18('0x35')][_0x1f5f10[_0x1a18('0x3e')]]);}else if(this[_0x1a18('0xb')][_0x1f5f10['peer']]){this[_0x1a18('0xb')][_0x1f5f10[_0x1a18('0x3e')]][_0x1a18('0x41')]=_0x1f5f10[_0x1a18('0x10')][_0x1a18('0x31')]();this['trunks'][_0x1f5f10[_0x1a18('0x3e')]]['address']=_0x1f5f10[_0x1a18('0x42')];logger[_0x1a18('0x28')](_0x1a18('0x45'),util[_0x1a18('0x19')](this['trunks'][_0x1f5f10[_0x1a18('0x3e')]],{'showHidden':![],'depth':null}));this[_0x1a18('0x1f')](util['format'](_0x1a18('0x2b'),this['trunks'][_0x1f5f10[_0x1a18('0x3e')]][_0x1a18('0x2c')]),_0x1a18('0x2d'),this['trunks'][_0x1f5f10['peer']]);}}}catch(_0x3ce5b3){logger[_0x1a18('0x17')](_0x1a18('0x3f'),util[_0x1a18('0x19')](_0x3ce5b3,{'showHidden':![],'depth':null}));}};module[_0x1a18('0x46')]=UserReport;
\ No newline at end of file
+var _0x6d2b=['agents','telephones','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isUndefined','emit','info','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','isNotNull','device','[userReport][devicestatechange]','inuse','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','name','telephone:save','trunk:%s','startsWith','indexOf','mobile','phone','accountcode','peer','registered','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','trunk:save','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','trunks'];(function(_0x300cd1,_0x42db96){var _0x1c583b=function(_0x2fd85e){while(--_0x2fd85e){_0x300cd1['push'](_0x300cd1['shift']());}};_0x1c583b(++_0x42db96);}(_0x6d2b,0x115));var _0xb6d2=function(_0x1e3b0a,_0x372650){_0x1e3b0a=_0x1e3b0a-0x0;var _0x43bf8c=_0x6d2b[_0x1e3b0a];return _0x43bf8c;};'use strict';var _=require(_0xb6d2('0x0'));var moment=require(_0xb6d2('0x1'));var util=require(_0xb6d2('0x2'));var Redis=require(_0xb6d2('0x3'));var BPromise=require('bluebird');var config=require(_0xb6d2('0x4'));var logger=require('../../../config/logger')(_0xb6d2('0x5'));var ami=require(_0xb6d2('0x6'));config[_0xb6d2('0x7')]=_[_0xb6d2('0x8')](config[_0xb6d2('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb6d2('0x9'))(new Redis(config[_0xb6d2('0x7')]));function UserReport(_0x2d8bf9){this[_0xb6d2('0xa')]=_0x2d8bf9[_0xb6d2('0xa')];this['agents']=_0x2d8bf9[_0xb6d2('0xb')];this[_0xb6d2('0xc')]=_0x2d8bf9[_0xb6d2('0xc')];ami['on'](_0xb6d2('0xd'),this[_0xb6d2('0xe')][_0xb6d2('0xf')](this));ami['on']('registry',this[_0xb6d2('0xe')][_0xb6d2('0xf')](this));ami['on']('devicestatechange',this[_0xb6d2('0x10')]['bind'](this));ami['on'](_0xb6d2('0x11'),this[_0xb6d2('0x12')][_0xb6d2('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xb6d2('0x13')]()['then'](ami[_0xb6d2('0x14')]())[_0xb6d2('0x15')](function(_0xe5b3f3){logger[_0xb6d2('0x16')](_0xb6d2('0x17'),util[_0xb6d2('0x18')](_0xe5b3f3,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xb6d2('0x13')]()[_0xb6d2('0x19')](ami[_0xb6d2('0x1a')]())['catch'](function(_0x172c93){logger['error'](_0xb6d2('0x1b'),util['inspect'](_0x172c93,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb6d2('0x13')]()[_0xb6d2('0x19')](ami[_0xb6d2('0x1c')]())[_0xb6d2('0x15')](function(_0x1caf80){logger['error']('[userReport][sippeerstatus]',util['inspect'](_0x1caf80,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xb6d2('0x13')]()['then'](showSipRegistrations())[_0xb6d2('0x19')](listDeviceStates())[_0xb6d2('0x19')](showPeersStatus());},0x32c8);};UserReport[_0xb6d2('0x1d')]['isNotNull']=function(_0x555e6b){return _0x555e6b!==null&&!_[_0xb6d2('0x1e')](_0x555e6b);};UserReport[_0xb6d2('0x1d')][_0xb6d2('0x1f')]=function(_0x55638b,_0x5aaf1f,_0x48d9f7){io['to'](_0x55638b)[_0xb6d2('0x1f')](_0x5aaf1f,_0x48d9f7);};UserReport[_0xb6d2('0x1d')]['syncRegistry']=function(_0x5c4515){try{if(this['isNotNull'](_0x5c4515)){logger[_0xb6d2('0x20')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x5c4515[_0xb6d2('0x21')],_0x5c4515[_0xb6d2('0x22')]);logger[_0xb6d2('0x23')](_0xb6d2('0x24'),util['inspect'](_0x5c4515,{'showHidden':![],'depth':null}));var _0x6d4840=_[_0xb6d2('0x25')](this[_0xb6d2('0xa')],{'defaultuser':_0x5c4515['username']});if(_0x6d4840){_0x5c4515[_0xb6d2('0x26')]=_0x5c4515[_0xb6d2('0x22')];_[_0xb6d2('0x27')](_0x6d4840,_[_0xb6d2('0x28')](_0x5c4515,[_0xb6d2('0x29'),_0xb6d2('0x2a'),'username',_0xb6d2('0x22')]));logger[_0xb6d2('0x23')](_0xb6d2('0x2b'),util[_0xb6d2('0x18')](_0x6d4840,{'showHidden':![],'depth':null}));this[_0xb6d2('0x1f')](util[_0xb6d2('0x2c')]('trunk:%s',_0x6d4840['name']),'trunk:save',_0x6d4840);}}}catch(_0x35e836){logger[_0xb6d2('0x16')](_0xb6d2('0x24'),util['inspect'](_0x35e836,{'showHidden':![],'depth':null}));}};UserReport[_0xb6d2('0x1d')][_0xb6d2('0x10')]=function(_0x56438d){try{if(this[_0xb6d2('0x2d')](_0x56438d)){logger[_0xb6d2('0x20')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x56438d[_0xb6d2('0x2e')],_0x56438d[_0xb6d2('0x22')]);logger[_0xb6d2('0x23')](_0xb6d2('0x2f'),util[_0xb6d2('0x18')](_0x56438d,{'showHidden':![],'depth':null}));if(this[_0xb6d2('0xb')][_0x56438d[_0xb6d2('0x2e')]]){if(!this[_0xb6d2('0xb')][_0x56438d[_0xb6d2('0x2e')]]['local']||_0x56438d[_0xb6d2('0x22')]['toLowerCase']()==_0xb6d2('0x30')){this['agents'][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x31')]=![];if(this[_0xb6d2('0xb')][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x22')]!==_0x56438d[_0xb6d2('0x22')][_0xb6d2('0x32')]()){this['agents'][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x33')]=_[_0xb6d2('0x34')](moment()[_0xb6d2('0x2c')]('x'));}this[_0xb6d2('0xb')][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x22')]=_0x56438d[_0xb6d2('0x22')]['toLowerCase']();this[_0xb6d2('0xb')][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x35')](_0x56438d);}}else if(this[_0xb6d2('0xc')][_0x56438d[_0xb6d2('0x2e')]]){if(this[_0xb6d2('0xc')][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x22')]!==_0x56438d[_0xb6d2('0x22')][_0xb6d2('0x32')]()){this[_0xb6d2('0xc')][_0x56438d[_0xb6d2('0x2e')]]['stateTime']=_[_0xb6d2('0x34')](moment()[_0xb6d2('0x2c')]('x'));}this[_0xb6d2('0xc')][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x22')]=_0x56438d[_0xb6d2('0x22')]['toLowerCase']();logger[_0xb6d2('0x23')](_0xb6d2('0x36'),util['inspect'](this[_0xb6d2('0xc')][_0x56438d[_0xb6d2('0x2e')]],{'showHidden':![],'depth':null}));this[_0xb6d2('0x1f')](util[_0xb6d2('0x2c')](_0xb6d2('0x37'),this['telephones'][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x38')]),_0xb6d2('0x39'),this[_0xb6d2('0xc')][_0x56438d['device']]);}else if(this['trunks'][_0x56438d[_0xb6d2('0x2e')]]){if(this['trunks'][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x22')]!==_0x56438d['state'][_0xb6d2('0x32')]()){this['trunks'][_0x56438d[_0xb6d2('0x2e')]]['stateTime']=_[_0xb6d2('0x34')](moment()[_0xb6d2('0x2c')]('x'));}this['trunks'][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x22')]=_0x56438d[_0xb6d2('0x22')]['toLowerCase']();logger[_0xb6d2('0x23')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xb6d2('0x18')](this[_0xb6d2('0xa')][_0x56438d[_0xb6d2('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xb6d2('0x2c')](_0xb6d2('0x3a'),this[_0xb6d2('0xa')][_0x56438d[_0xb6d2('0x2e')]][_0xb6d2('0x38')]),'trunk:save',this[_0xb6d2('0xa')][_0x56438d[_0xb6d2('0x2e')]]);}else if(_[_0xb6d2('0x3b')](_0x56438d['device'],'Local')){var _0x2dd360=_0x56438d[_0xb6d2('0x2e')];var _0x18f73b=_0x2dd360['substring'](_0x2dd360[_0xb6d2('0x3c')]('/')+0x1,_0x2dd360[_0xb6d2('0x3c')]('@'));var _0x1c3cba=_['find'](this[_0xb6d2('0xb')],function(_0x32cca9){return _0x32cca9[_0xb6d2('0x3d')]==_0x18f73b||_0x32cca9[_0xb6d2('0x3e')]==_0x18f73b||_0x32cca9[_0xb6d2('0x3f')]==_0x18f73b;});if(_0x1c3cba){if(_0x1c3cba['state']!==_0x56438d[_0xb6d2('0x22')][_0xb6d2('0x32')]()){_0x1c3cba[_0xb6d2('0x33')]=_[_0xb6d2('0x34')](moment()[_0xb6d2('0x2c')]('x'));}_0x1c3cba['state']=_0x56438d[_0xb6d2('0x22')][_0xb6d2('0x32')]();_0x1c3cba[_0xb6d2('0x31')]=!![];_0x1c3cba[_0xb6d2('0x35')](_0x56438d);}}}}catch(_0x3e9969){logger[_0xb6d2('0x16')](_0xb6d2('0x2f'),util[_0xb6d2('0x18')](_0x3e9969,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xb6d2('0x12')]=function(_0x21452e){try{if(this[_0xb6d2('0x2d')](_0x21452e)&&this[_0xb6d2('0x2d')](_0x21452e['peerstatus'])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x21452e[_0xb6d2('0x40')],_0x21452e['address'],_0x21452e[_0xb6d2('0x11')]);logger[_0xb6d2('0x23')]('[userReport][peerstatus]',util[_0xb6d2('0x18')](_0x21452e,{'showHidden':![],'depth':null}));if(this['agents'][_0x21452e['peer']]){if(!this[_0xb6d2('0xb')][_0x21452e[_0xb6d2('0x40')]][_0xb6d2('0x31')]||_0x21452e[_0xb6d2('0x11')][_0xb6d2('0x32')]()==_0xb6d2('0x41')){this[_0xb6d2('0xb')][_0x21452e[_0xb6d2('0x40')]][_0xb6d2('0x31')]=![];this['agents'][_0x21452e[_0xb6d2('0x40')]]['status']=_0x21452e[_0xb6d2('0x11')][_0xb6d2('0x32')]();this[_0xb6d2('0xb')][_0x21452e['peer']][_0xb6d2('0x42')]=_0x21452e['address'];this[_0xb6d2('0xb')][_0x21452e['peer']]['updateStatusRealtime'](_0x21452e);}}else if(this['telephones'][_0x21452e[_0xb6d2('0x40')]]){this[_0xb6d2('0xc')][_0x21452e['peer']][_0xb6d2('0x43')]=_0x21452e[_0xb6d2('0x11')][_0xb6d2('0x32')]();this[_0xb6d2('0xc')][_0x21452e[_0xb6d2('0x40')]][_0xb6d2('0x42')]=_0x21452e[_0xb6d2('0x42')];logger['debug'](_0xb6d2('0x44'),util[_0xb6d2('0x18')](this[_0xb6d2('0xc')][_0x21452e[_0xb6d2('0x40')]],{'showHidden':![],'depth':null}));this[_0xb6d2('0x1f')](util[_0xb6d2('0x2c')]('telephone:%s',this[_0xb6d2('0xc')][_0x21452e[_0xb6d2('0x40')]][_0xb6d2('0x38')]),_0xb6d2('0x39'),this[_0xb6d2('0xc')][_0x21452e[_0xb6d2('0x40')]]);}else if(this[_0xb6d2('0xa')][_0x21452e[_0xb6d2('0x40')]]){this[_0xb6d2('0xa')][_0x21452e[_0xb6d2('0x40')]][_0xb6d2('0x43')]=_0x21452e['peerstatus'][_0xb6d2('0x32')]();this[_0xb6d2('0xa')][_0x21452e[_0xb6d2('0x40')]][_0xb6d2('0x42')]=_0x21452e[_0xb6d2('0x42')];logger[_0xb6d2('0x23')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xb6d2('0x18')](this['trunks'][_0x21452e[_0xb6d2('0x40')]],{'showHidden':![],'depth':null}));this[_0xb6d2('0x1f')](util[_0xb6d2('0x2c')](_0xb6d2('0x3a'),this['trunks'][_0x21452e[_0xb6d2('0x40')]][_0xb6d2('0x38')]),_0xb6d2('0x45'),this[_0xb6d2('0xa')][_0x21452e[_0xb6d2('0x40')]]);}}}catch(_0x96bed6){logger[_0xb6d2('0x16')](_0xb6d2('0x46'),util['inspect'](_0x96bed6,{'showHidden':![],'depth':null}));}};module[_0xb6d2('0x47')]=UserReport;
\ No newline at end of file