Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / services / ami / report / userReport.js
index 532ec96..3bebcb5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6afe=['prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','[userReport][devicestatechange]','syncPeerStatus','peer','[userReport][peerstatus]','registered','address','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]'];(function(_0x2f43f4,_0x2428b1){var _0x4f4223=function(_0x5b4c1a){while(--_0x5b4c1a){_0x2f43f4['push'](_0x2f43f4['shift']());}};_0x4f4223(++_0x2428b1);}(_0x6afe,0x107));var _0xe6af=function(_0x29f31c,_0x46bbdf){_0x29f31c=_0x29f31c-0x0;var _0x3b6b8a=_0x6afe[_0x29f31c];return _0x3b6b8a;};'use strict';var _=require('lodash');var moment=require(_0xe6af('0x0'));var util=require('util');var Redis=require(_0xe6af('0x1'));var BPromise=require(_0xe6af('0x2'));var config=require(_0xe6af('0x3'));var logger=require(_0xe6af('0x4'))(_0xe6af('0x5'));var ami=require(_0xe6af('0x6'));config[_0xe6af('0x7')]=_['defaults'](config[_0xe6af('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe6af('0x8'))(new Redis(config[_0xe6af('0x7')]));function UserReport(_0x28fa1d){this['trunks']=_0x28fa1d[_0xe6af('0x9')];this[_0xe6af('0xa')]=_0x28fa1d[_0xe6af('0xa')];this[_0xe6af('0xb')]=_0x28fa1d['telephones'];ami['on']('registryentry',this[_0xe6af('0xc')][_0xe6af('0xd')](this));ami['on'](_0xe6af('0xe'),this['syncRegistry'][_0xe6af('0xd')](this));ami['on'](_0xe6af('0xf'),this[_0xe6af('0x10')][_0xe6af('0xd')](this));ami['on'](_0xe6af('0x11'),this['syncPeerStatus']['bind'](this));return this[_0xe6af('0x12')]();}function showSipRegistrations(){Promise[_0xe6af('0x13')]()[_0xe6af('0x14')](ami[_0xe6af('0x15')]())[_0xe6af('0x16')](function(_0x593ef2){logger[_0xe6af('0x17')]('[userReport][sipshowregistry]',util[_0xe6af('0x18')](_0x593ef2,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe6af('0x13')]()[_0xe6af('0x14')](ami[_0xe6af('0x19')]())[_0xe6af('0x16')](function(_0x4c6a95){logger['error'](_0xe6af('0x1a'),util['inspect'](_0x4c6a95,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xe6af('0x14')](ami[_0xe6af('0x1b')]())[_0xe6af('0x16')](function(_0x3e6933){logger['error'](_0xe6af('0x1c'),util[_0xe6af('0x18')](_0x3e6933,{'showHidden':![],'depth':null}));});}UserReport[_0xe6af('0x1d')][_0xe6af('0x12')]=function(){setInterval(function(){BPromise['resolve']()[_0xe6af('0x14')](showSipRegistrations())['then'](listDeviceStates())[_0xe6af('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xe6af('0x1d')][_0xe6af('0x1e')]=function(_0x59e83b){return _0x59e83b!==null&&!_[_0xe6af('0x1f')](_0x59e83b);};UserReport[_0xe6af('0x1d')][_0xe6af('0x20')]=function(_0x47aa2e,_0x4dcefb,_0x4cd475){io['to'](_0x47aa2e)[_0xe6af('0x20')](_0x4dcefb,_0x4cd475);};UserReport[_0xe6af('0x1d')][_0xe6af('0xc')]=function(_0x12acab){try{if(this[_0xe6af('0x1e')](_0x12acab)){logger[_0xe6af('0x21')](_0xe6af('0x22'),_0x12acab[_0xe6af('0x23')],_0x12acab[_0xe6af('0x24')]);logger[_0xe6af('0x25')](_0xe6af('0x26'),util['inspect'](_0x12acab,{'showHidden':![],'depth':null}));var _0x5d8652=_[_0xe6af('0x27')](this[_0xe6af('0x9')],{'defaultuser':_0x12acab['username']});if(_0x5d8652){_0x12acab[_0xe6af('0x28')]=_0x12acab['state'];_[_0xe6af('0x29')](_0x5d8652,_['omit'](_0x12acab,[_0xe6af('0x2a'),'actionid','username',_0xe6af('0x24')]));logger[_0xe6af('0x25')](_0xe6af('0x2b'),util[_0xe6af('0x18')](_0x5d8652,{'showHidden':![],'depth':null}));this[_0xe6af('0x20')](util[_0xe6af('0x2c')](_0xe6af('0x2d'),_0x5d8652[_0xe6af('0x2e')]),_0xe6af('0x2f'),_0x5d8652);}}}catch(_0x499d49){logger['error'](_0xe6af('0x26'),util[_0xe6af('0x18')](_0x499d49,{'showHidden':![],'depth':null}));}};UserReport[_0xe6af('0x1d')][_0xe6af('0x10')]=function(_0x107395){try{if(this[_0xe6af('0x1e')](_0x107395)){logger[_0xe6af('0x21')](_0xe6af('0x30'),_0x107395['device'],_0x107395['state']);logger['debug']('[userReport][devicestatechange]',util[_0xe6af('0x18')](_0x107395,{'showHidden':![],'depth':null}));if(this[_0xe6af('0xa')][_0x107395[_0xe6af('0x31')]]){if(!this[_0xe6af('0xa')][_0x107395['device']][_0xe6af('0x32')]||_0x107395[_0xe6af('0x24')][_0xe6af('0x33')]()==_0xe6af('0x34')){this[_0xe6af('0xa')][_0x107395['device']][_0xe6af('0x32')]=![];if(this['agents'][_0x107395[_0xe6af('0x31')]]['state']!==_0x107395['state']['toLowerCase']()){this[_0xe6af('0xa')][_0x107395[_0xe6af('0x31')]]['stateTime']=_[_0xe6af('0x35')](moment()[_0xe6af('0x2c')]('x'));}this[_0xe6af('0xa')][_0x107395['device']][_0xe6af('0x24')]=_0x107395[_0xe6af('0x24')]['toLowerCase']();this[_0xe6af('0xa')][_0x107395['device']][_0xe6af('0x36')](_0x107395);}}else if(this[_0xe6af('0xb')][_0x107395['device']]){if(this[_0xe6af('0xb')][_0x107395[_0xe6af('0x31')]][_0xe6af('0x24')]!==_0x107395[_0xe6af('0x24')]['toLowerCase']()){this[_0xe6af('0xb')][_0x107395['device']][_0xe6af('0x37')]=_[_0xe6af('0x35')](moment()[_0xe6af('0x2c')]('x'));}this[_0xe6af('0xb')][_0x107395['device']][_0xe6af('0x24')]=_0x107395[_0xe6af('0x24')]['toLowerCase']();logger[_0xe6af('0x25')](_0xe6af('0x38'),util[_0xe6af('0x18')](this[_0xe6af('0xb')][_0x107395['device']],{'showHidden':![],'depth':null}));this[_0xe6af('0x20')](util[_0xe6af('0x2c')](_0xe6af('0x39'),this[_0xe6af('0xb')][_0x107395[_0xe6af('0x31')]]['name']),_0xe6af('0x3a'),this['telephones'][_0x107395[_0xe6af('0x31')]]);}else if(this['trunks'][_0x107395[_0xe6af('0x31')]]){if(this[_0xe6af('0x9')][_0x107395['device']][_0xe6af('0x24')]!==_0x107395['state']['toLowerCase']()){this[_0xe6af('0x9')][_0x107395['device']]['stateTime']=_[_0xe6af('0x35')](moment()[_0xe6af('0x2c')]('x'));}this['trunks'][_0x107395[_0xe6af('0x31')]][_0xe6af('0x24')]=_0x107395['state'][_0xe6af('0x33')]();logger[_0xe6af('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xe6af('0x18')](this[_0xe6af('0x9')][_0x107395[_0xe6af('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xe6af('0x2c')](_0xe6af('0x2d'),this[_0xe6af('0x9')][_0x107395[_0xe6af('0x31')]][_0xe6af('0x2e')]),'trunk:save',this[_0xe6af('0x9')][_0x107395['device']]);}else if(_[_0xe6af('0x3b')](_0x107395[_0xe6af('0x31')],_0xe6af('0x3c'))){var _0x57669f=_0x107395[_0xe6af('0x31')];var _0x234e06=_0x57669f[_0xe6af('0x3d')](_0x57669f[_0xe6af('0x3e')]('/')+0x1,_0x57669f[_0xe6af('0x3e')]('@'));var _0x245a37=_['find'](this[_0xe6af('0xa')],function(_0x2f664a){return _0x2f664a[_0xe6af('0x3f')]==_0x234e06||_0x2f664a[_0xe6af('0x40')]==_0x234e06||_0x2f664a['accountcode']==_0x234e06;});if(_0x245a37){if(_0x245a37['state']!==_0x107395['state'][_0xe6af('0x33')]()){_0x245a37['stateTime']=_[_0xe6af('0x35')](moment()[_0xe6af('0x2c')]('x'));}_0x245a37['state']=_0x107395[_0xe6af('0x24')][_0xe6af('0x33')]();_0x245a37['local']=!![];_0x245a37[_0xe6af('0x36')](_0x107395);}}}}catch(_0x2953af){logger[_0xe6af('0x17')](_0xe6af('0x41'),util[_0xe6af('0x18')](_0x2953af,{'showHidden':![],'depth':null}));}};UserReport[_0xe6af('0x1d')][_0xe6af('0x42')]=function(_0x2a0477){try{if(this[_0xe6af('0x1e')](_0x2a0477)&&this[_0xe6af('0x1e')](_0x2a0477[_0xe6af('0x11')])){logger[_0xe6af('0x21')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x2a0477[_0xe6af('0x43')],_0x2a0477['address'],_0x2a0477['peerstatus']);logger['debug'](_0xe6af('0x44'),util['inspect'](_0x2a0477,{'showHidden':![],'depth':null}));if(this[_0xe6af('0xa')][_0x2a0477[_0xe6af('0x43')]]){if(!this[_0xe6af('0xa')][_0x2a0477['peer']][_0xe6af('0x32')]||_0x2a0477[_0xe6af('0x11')][_0xe6af('0x33')]()==_0xe6af('0x45')){this[_0xe6af('0xa')][_0x2a0477['peer']][_0xe6af('0x32')]=![];this[_0xe6af('0xa')][_0x2a0477[_0xe6af('0x43')]]['status']=_0x2a0477[_0xe6af('0x11')][_0xe6af('0x33')]();this[_0xe6af('0xa')][_0x2a0477['peer']][_0xe6af('0x46')]=_0x2a0477[_0xe6af('0x46')];this['agents'][_0x2a0477[_0xe6af('0x43')]][_0xe6af('0x36')](_0x2a0477);}}else if(this[_0xe6af('0xb')][_0x2a0477[_0xe6af('0x43')]]){this[_0xe6af('0xb')][_0x2a0477[_0xe6af('0x43')]][_0xe6af('0x47')]=_0x2a0477[_0xe6af('0x11')][_0xe6af('0x33')]();this[_0xe6af('0xb')][_0x2a0477[_0xe6af('0x43')]][_0xe6af('0x46')]=_0x2a0477[_0xe6af('0x46')];logger[_0xe6af('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xe6af('0x18')](this[_0xe6af('0xb')][_0x2a0477[_0xe6af('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xe6af('0x2c')]('telephone:%s',this[_0xe6af('0xb')][_0x2a0477['peer']][_0xe6af('0x2e')]),_0xe6af('0x3a'),this['telephones'][_0x2a0477[_0xe6af('0x43')]]);}else if(this[_0xe6af('0x9')][_0x2a0477[_0xe6af('0x43')]]){this[_0xe6af('0x9')][_0x2a0477[_0xe6af('0x43')]][_0xe6af('0x47')]=_0x2a0477[_0xe6af('0x11')][_0xe6af('0x33')]();this[_0xe6af('0x9')][_0x2a0477[_0xe6af('0x43')]][_0xe6af('0x46')]=_0x2a0477[_0xe6af('0x46')];logger[_0xe6af('0x25')](_0xe6af('0x48'),util[_0xe6af('0x18')](this[_0xe6af('0x9')][_0x2a0477[_0xe6af('0x43')]],{'showHidden':![],'depth':null}));this[_0xe6af('0x20')](util[_0xe6af('0x2c')](_0xe6af('0x2d'),this[_0xe6af('0x9')][_0x2a0477[_0xe6af('0x43')]][_0xe6af('0x2e')]),_0xe6af('0x2f'),this[_0xe6af('0x9')][_0x2a0477[_0xe6af('0x43')]]);}}}catch(_0x2c30b8){logger[_0xe6af('0x17')](_0xe6af('0x44'),util['inspect'](_0x2c30b8,{'showHidden':![],'depth':null}));}};module['exports']=UserReport;
\ No newline at end of file
+var _0x802a=['[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','status','exports','lodash','util','ioredis','bluebird','../../../config/logger','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','actionSipPeerStatus','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','debug','startsWith','Local','indexOf','mobile','phone'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x802a,0x93));var _0xa802=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x802a[_0x556927];return _0x5f1235;};'use strict';var _=require(_0xa802('0x0'));var moment=require('moment');var util=require(_0xa802('0x1'));var Redis=require(_0xa802('0x2'));var BPromise=require(_0xa802('0x3'));var config=require('../../../config/environment');var logger=require(_0xa802('0x4'))('ami');var ami=require('../ami');config['redis']=_['defaults'](config['redis'],{'host':_0xa802('0x5'),'port':0x18eb});var io=require(_0xa802('0x6'))(new Redis(config['redis']));function UserReport(_0x2a2d8c){this[_0xa802('0x7')]=_0x2a2d8c[_0xa802('0x7')];this[_0xa802('0x8')]=_0x2a2d8c[_0xa802('0x8')];this[_0xa802('0x9')]=_0x2a2d8c['telephones'];ami['on'](_0xa802('0xa'),this['syncRegistry'][_0xa802('0xb')](this));ami['on'](_0xa802('0xc'),this[_0xa802('0xd')][_0xa802('0xb')](this));ami['on'](_0xa802('0xe'),this[_0xa802('0xf')][_0xa802('0xb')](this));ami['on'](_0xa802('0x10'),this[_0xa802('0x11')][_0xa802('0xb')](this));return this[_0xa802('0x12')]();}function showSipRegistrations(){Promise[_0xa802('0x13')]()[_0xa802('0x14')](ami[_0xa802('0x15')]())[_0xa802('0x16')](function(_0x1fb01a){logger[_0xa802('0x17')](_0xa802('0x18'),util['inspect'](_0x1fb01a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xa802('0x13')]()[_0xa802('0x14')](ami[_0xa802('0x19')]())[_0xa802('0x16')](function(_0x3b800f){logger[_0xa802('0x17')]('[userReport][devicestatelist]',util[_0xa802('0x1a')](_0x3b800f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xa802('0x14')](ami[_0xa802('0x1b')]())[_0xa802('0x16')](function(_0x4376c3){logger['error']('[userReport][sippeerstatus]',util[_0xa802('0x1a')](_0x4376c3,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xa802('0x13')]()['then'](showSipRegistrations())[_0xa802('0x14')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xa802('0x1c')][_0xa802('0x1d')]=function(_0x3bd1b1){return _0x3bd1b1!==null&&!_['isUndefined'](_0x3bd1b1);};UserReport[_0xa802('0x1c')][_0xa802('0x1e')]=function(_0x2c3bc1,_0x12eb10,_0x35d4f4){io['to'](_0x2c3bc1)[_0xa802('0x1e')](_0x12eb10,_0x35d4f4);};UserReport[_0xa802('0x1c')][_0xa802('0xd')]=function(_0x2477d7){try{if(this[_0xa802('0x1d')](_0x2477d7)){logger[_0xa802('0x1f')](_0xa802('0x20'),_0x2477d7[_0xa802('0x21')],_0x2477d7['state']);logger['debug'](_0xa802('0x22'),util['inspect'](_0x2477d7,{'showHidden':![],'depth':null}));var _0x3d72e6=_[_0xa802('0x23')](this[_0xa802('0x7')],{'defaultuser':_0x2477d7[_0xa802('0x21')]});if(_0x3d72e6){_0x2477d7['stateRegistry']=_0x2477d7[_0xa802('0x24')];_[_0xa802('0x25')](_0x3d72e6,_[_0xa802('0x26')](_0x2477d7,[_0xa802('0x27'),_0xa802('0x28'),'username',_0xa802('0x24')]));logger['debug'](_0xa802('0x29'),util[_0xa802('0x1a')](_0x3d72e6,{'showHidden':![],'depth':null}));this['emit'](util[_0xa802('0x2a')](_0xa802('0x2b'),_0x3d72e6[_0xa802('0x2c')]),_0xa802('0x2d'),_0x3d72e6);}}}catch(_0x3cca4e){logger[_0xa802('0x17')](_0xa802('0x22'),util[_0xa802('0x1a')](_0x3cca4e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xa802('0xf')]=function(_0x52e1c6){try{if(this[_0xa802('0x1d')](_0x52e1c6)){logger[_0xa802('0x1f')](_0xa802('0x2e'),_0x52e1c6['device'],_0x52e1c6[_0xa802('0x24')]);logger['debug']('[userReport][devicestatechange]',util[_0xa802('0x1a')](_0x52e1c6,{'showHidden':![],'depth':null}));if(this[_0xa802('0x8')][_0x52e1c6[_0xa802('0x2f')]]){if(!this[_0xa802('0x8')][_0x52e1c6['device']][_0xa802('0x30')]||_0x52e1c6[_0xa802('0x24')][_0xa802('0x31')]()==_0xa802('0x32')){this[_0xa802('0x8')][_0x52e1c6[_0xa802('0x2f')]]['local']=![];if(this[_0xa802('0x8')][_0x52e1c6[_0xa802('0x2f')]][_0xa802('0x24')]!==_0x52e1c6[_0xa802('0x24')][_0xa802('0x31')]()){this[_0xa802('0x8')][_0x52e1c6[_0xa802('0x2f')]][_0xa802('0x33')]=_[_0xa802('0x34')](moment()['format']('x'));}this[_0xa802('0x8')][_0x52e1c6[_0xa802('0x2f')]][_0xa802('0x24')]=_0x52e1c6[_0xa802('0x24')][_0xa802('0x31')]();this[_0xa802('0x8')][_0x52e1c6['device']][_0xa802('0x35')](_0x52e1c6);}}else if(this['telephones'][_0x52e1c6[_0xa802('0x2f')]]){if(this[_0xa802('0x9')][_0x52e1c6[_0xa802('0x2f')]]['state']!==_0x52e1c6['state'][_0xa802('0x31')]()){this['telephones'][_0x52e1c6[_0xa802('0x2f')]][_0xa802('0x33')]=_[_0xa802('0x34')](moment()[_0xa802('0x2a')]('x'));}this[_0xa802('0x9')][_0x52e1c6[_0xa802('0x2f')]][_0xa802('0x24')]=_0x52e1c6[_0xa802('0x24')][_0xa802('0x31')]();logger['debug'](_0xa802('0x36'),util[_0xa802('0x1a')](this[_0xa802('0x9')][_0x52e1c6[_0xa802('0x2f')]],{'showHidden':![],'depth':null}));this[_0xa802('0x1e')](util['format'](_0xa802('0x37'),this['telephones'][_0x52e1c6['device']][_0xa802('0x2c')]),_0xa802('0x38'),this[_0xa802('0x9')][_0x52e1c6[_0xa802('0x2f')]]);}else if(this[_0xa802('0x7')][_0x52e1c6[_0xa802('0x2f')]]){if(this['trunks'][_0x52e1c6[_0xa802('0x2f')]][_0xa802('0x24')]!==_0x52e1c6[_0xa802('0x24')]['toLowerCase']()){this['trunks'][_0x52e1c6[_0xa802('0x2f')]]['stateTime']=_['toNumber'](moment()[_0xa802('0x2a')]('x'));}this[_0xa802('0x7')][_0x52e1c6['device']][_0xa802('0x24')]=_0x52e1c6[_0xa802('0x24')][_0xa802('0x31')]();logger[_0xa802('0x39')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xa802('0x1a')](this[_0xa802('0x7')][_0x52e1c6['device']],{'showHidden':![],'depth':null}));this[_0xa802('0x1e')](util[_0xa802('0x2a')]('trunk:%s',this[_0xa802('0x7')][_0x52e1c6[_0xa802('0x2f')]]['name']),_0xa802('0x2d'),this[_0xa802('0x7')][_0x52e1c6[_0xa802('0x2f')]]);}else if(_[_0xa802('0x3a')](_0x52e1c6[_0xa802('0x2f')],_0xa802('0x3b'))){var _0x26a6d1=_0x52e1c6[_0xa802('0x2f')];var _0x597b00=_0x26a6d1['substring'](_0x26a6d1[_0xa802('0x3c')]('/')+0x1,_0x26a6d1[_0xa802('0x3c')]('@'));var _0x28b906=_['find'](this['agents'],function(_0xff1694){return _0xff1694[_0xa802('0x3d')]==_0x597b00||_0xff1694[_0xa802('0x3e')]==_0x597b00||_0xff1694['accountcode']==_0x597b00;});if(_0x28b906){if(_0x28b906[_0xa802('0x24')]!==_0x52e1c6[_0xa802('0x24')][_0xa802('0x31')]()){_0x28b906[_0xa802('0x33')]=_[_0xa802('0x34')](moment()['format']('x'));}_0x28b906[_0xa802('0x24')]=_0x52e1c6[_0xa802('0x24')]['toLowerCase']();_0x28b906[_0xa802('0x30')]=!![];_0x28b906[_0xa802('0x35')](_0x52e1c6);}}}}catch(_0x4eba39){logger['error']('[userReport][devicestatechange]',util[_0xa802('0x1a')](_0x4eba39,{'showHidden':![],'depth':null}));}};UserReport[_0xa802('0x1c')][_0xa802('0x11')]=function(_0x51d352){try{if(this[_0xa802('0x1d')](_0x51d352)&&this[_0xa802('0x1d')](_0x51d352[_0xa802('0x10')])){logger[_0xa802('0x1f')](_0xa802('0x3f'),_0x51d352[_0xa802('0x40')],_0x51d352['address'],_0x51d352[_0xa802('0x10')]);logger['debug'](_0xa802('0x41'),util['inspect'](_0x51d352,{'showHidden':![],'depth':null}));if(this['agents'][_0x51d352[_0xa802('0x40')]]){if(!this['agents'][_0x51d352[_0xa802('0x40')]][_0xa802('0x30')]||_0x51d352['peerstatus']['toLowerCase']()=='registered'){this[_0xa802('0x8')][_0x51d352[_0xa802('0x40')]][_0xa802('0x30')]=![];this[_0xa802('0x8')][_0x51d352[_0xa802('0x40')]]['status']=_0x51d352[_0xa802('0x10')][_0xa802('0x31')]();this[_0xa802('0x8')][_0x51d352[_0xa802('0x40')]]['address']=_0x51d352[_0xa802('0x42')];this['agents'][_0x51d352[_0xa802('0x40')]][_0xa802('0x35')](_0x51d352);}}else if(this[_0xa802('0x9')][_0x51d352['peer']]){this[_0xa802('0x9')][_0x51d352['peer']]['status']=_0x51d352['peerstatus'][_0xa802('0x31')]();this[_0xa802('0x9')][_0x51d352[_0xa802('0x40')]]['address']=_0x51d352[_0xa802('0x42')];logger[_0xa802('0x39')](_0xa802('0x43'),util[_0xa802('0x1a')](this[_0xa802('0x9')][_0x51d352[_0xa802('0x40')]],{'showHidden':![],'depth':null}));this[_0xa802('0x1e')](util[_0xa802('0x2a')](_0xa802('0x37'),this[_0xa802('0x9')][_0x51d352[_0xa802('0x40')]][_0xa802('0x2c')]),_0xa802('0x38'),this['telephones'][_0x51d352[_0xa802('0x40')]]);}else if(this['trunks'][_0x51d352[_0xa802('0x40')]]){this[_0xa802('0x7')][_0x51d352['peer']][_0xa802('0x44')]=_0x51d352['peerstatus'][_0xa802('0x31')]();this[_0xa802('0x7')][_0x51d352['peer']][_0xa802('0x42')]=_0x51d352[_0xa802('0x42')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xa802('0x1a')](this[_0xa802('0x7')][_0x51d352['peer']],{'showHidden':![],'depth':null}));this[_0xa802('0x1e')](util[_0xa802('0x2a')](_0xa802('0x2b'),this[_0xa802('0x7')][_0x51d352[_0xa802('0x40')]][_0xa802('0x2c')]),'trunk:save',this[_0xa802('0x7')][_0x51d352[_0xa802('0x40')]]);}}}catch(_0x53ca19){logger[_0xa802('0x17')]('[userReport][peerstatus]',util['inspect'](_0x53ca19,{'showHidden':![],'depth':null}));}};module[_0xa802('0x45')]=UserReport;
\ No newline at end of file