Built motion from commit 953226e6.|2.6.32
[motion2.git] / server / services / ami / report / userReport.js
index b6a6e14..01a6b95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae67=['format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','Local','indexOf','mobile','phone','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:'];(function(_0x264c84,_0x598700){var _0x1fd84c=function(_0x271c3d){while(--_0x271c3d){_0x264c84['push'](_0x264c84['shift']());}};_0x1fd84c(++_0x598700);}(_0xae67,0x147));var _0x7ae6=function(_0x50b476,_0x168bcd){_0x50b476=_0x50b476-0x0;var _0x6d4f8f=_0xae67[_0x50b476];return _0x6d4f8f;};'use strict';var _=require(_0x7ae6('0x0'));var moment=require(_0x7ae6('0x1'));var util=require(_0x7ae6('0x2'));var Redis=require('ioredis');var BPromise=require(_0x7ae6('0x3'));var config=require(_0x7ae6('0x4'));var logger=require(_0x7ae6('0x5'))(_0x7ae6('0x6'));var ami=require(_0x7ae6('0x7'));config[_0x7ae6('0x8')]=_['defaults'](config[_0x7ae6('0x8')],{'host':_0x7ae6('0x9'),'port':0x18eb});var io=require(_0x7ae6('0xa'))(new Redis(config[_0x7ae6('0x8')]));function UserReport(_0x33849b){this['trunks']=_0x33849b[_0x7ae6('0xb')];this[_0x7ae6('0xc')]=_0x33849b['agents'];this[_0x7ae6('0xd')]=_0x33849b[_0x7ae6('0xd')];ami['on'](_0x7ae6('0xe'),this[_0x7ae6('0xf')][_0x7ae6('0x10')](this));ami['on']('registry',this[_0x7ae6('0xf')][_0x7ae6('0x10')](this));ami['on']('devicestatechange',this[_0x7ae6('0x11')][_0x7ae6('0x10')](this));ami['on'](_0x7ae6('0x12'),this[_0x7ae6('0x13')][_0x7ae6('0x10')](this));return this[_0x7ae6('0x14')]();}function showSipRegistrations(){Promise[_0x7ae6('0x15')]()[_0x7ae6('0x16')](ami[_0x7ae6('0x17')]())[_0x7ae6('0x18')](function(_0x1dee76){logger['error'](_0x7ae6('0x19'),util[_0x7ae6('0x1a')](_0x1dee76,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7ae6('0x15')]()[_0x7ae6('0x16')](ami[_0x7ae6('0x1b')]())[_0x7ae6('0x18')](function(_0x1b72fb){logger[_0x7ae6('0x1c')](_0x7ae6('0x1d'),util[_0x7ae6('0x1a')](_0x1b72fb,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0x7ae6('0x1e')]())[_0x7ae6('0x18')](function(_0x57e8c7){logger['error'](_0x7ae6('0x1f'),util[_0x7ae6('0x1a')](_0x57e8c7,{'showHidden':![],'depth':null}));});}UserReport[_0x7ae6('0x20')][_0x7ae6('0x14')]=function(){setInterval(function(){BPromise[_0x7ae6('0x15')]()[_0x7ae6('0x16')](showSipRegistrations())[_0x7ae6('0x16')](listDeviceStates())[_0x7ae6('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x7ae6('0x20')][_0x7ae6('0x21')]=function(_0x6f835f){return _0x6f835f!==null&&!_['isUndefined'](_0x6f835f);};UserReport[_0x7ae6('0x20')][_0x7ae6('0x22')]=function(_0x2656b7,_0x4a123a,_0x176bf9){io['to'](_0x2656b7)['emit'](_0x4a123a,_0x176bf9);};UserReport[_0x7ae6('0x20')][_0x7ae6('0xf')]=function(_0x5f53e8){try{if(this[_0x7ae6('0x21')](_0x5f53e8)){logger[_0x7ae6('0x23')](_0x7ae6('0x24'),_0x5f53e8[_0x7ae6('0x25')],_0x5f53e8[_0x7ae6('0x26')]);logger[_0x7ae6('0x27')](_0x7ae6('0x28'),util[_0x7ae6('0x1a')](_0x5f53e8,{'showHidden':![],'depth':null}));var _0x3c6ed9=_[_0x7ae6('0x29')](this[_0x7ae6('0xb')],{'defaultuser':_0x5f53e8['username']});if(_0x3c6ed9){_0x5f53e8[_0x7ae6('0x2a')]=_0x5f53e8[_0x7ae6('0x26')];_[_0x7ae6('0x2b')](_0x3c6ed9,_[_0x7ae6('0x2c')](_0x5f53e8,[_0x7ae6('0x2d'),_0x7ae6('0x2e'),_0x7ae6('0x25'),'state']));logger[_0x7ae6('0x27')](_0x7ae6('0x2f'),util['inspect'](_0x3c6ed9,{'showHidden':![],'depth':null}));this[_0x7ae6('0x22')](util[_0x7ae6('0x30')](_0x7ae6('0x31'),_0x3c6ed9[_0x7ae6('0x32')]),_0x7ae6('0x33'),_0x3c6ed9);}}}catch(_0x35f9da){logger[_0x7ae6('0x1c')](_0x7ae6('0x28'),util['inspect'](_0x35f9da,{'showHidden':![],'depth':null}));}};UserReport[_0x7ae6('0x20')][_0x7ae6('0x11')]=function(_0x25af66){try{if(this[_0x7ae6('0x21')](_0x25af66)){logger[_0x7ae6('0x23')](_0x7ae6('0x34'),_0x25af66['device'],_0x25af66['state']);logger[_0x7ae6('0x27')]('[userReport][devicestatechange]',util[_0x7ae6('0x1a')](_0x25af66,{'showHidden':![],'depth':null}));if(this['agents'][_0x25af66[_0x7ae6('0x35')]]){if(!this[_0x7ae6('0xc')][_0x25af66['device']]['local']||_0x25af66[_0x7ae6('0x26')]['toLowerCase']()=='inuse'){this[_0x7ae6('0xc')][_0x25af66[_0x7ae6('0x35')]][_0x7ae6('0x36')]=![];if(this['agents'][_0x25af66[_0x7ae6('0x35')]][_0x7ae6('0x26')]!==_0x25af66[_0x7ae6('0x26')][_0x7ae6('0x37')]()){this[_0x7ae6('0xc')][_0x25af66[_0x7ae6('0x35')]][_0x7ae6('0x38')]=_[_0x7ae6('0x39')](moment()['format']('x'));}this[_0x7ae6('0xc')][_0x25af66['device']][_0x7ae6('0x26')]=_0x25af66[_0x7ae6('0x26')][_0x7ae6('0x37')]();this[_0x7ae6('0xc')][_0x25af66[_0x7ae6('0x35')]][_0x7ae6('0x3a')](_0x25af66);}}else if(this[_0x7ae6('0xd')][_0x25af66[_0x7ae6('0x35')]]){if(this[_0x7ae6('0xd')][_0x25af66[_0x7ae6('0x35')]][_0x7ae6('0x26')]!==_0x25af66['state'][_0x7ae6('0x37')]()){this[_0x7ae6('0xd')][_0x25af66['device']][_0x7ae6('0x38')]=_[_0x7ae6('0x39')](moment()[_0x7ae6('0x30')]('x'));}this[_0x7ae6('0xd')][_0x25af66['device']][_0x7ae6('0x26')]=_0x25af66[_0x7ae6('0x26')][_0x7ae6('0x37')]();logger[_0x7ae6('0x27')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x7ae6('0x1a')](this[_0x7ae6('0xd')][_0x25af66['device']],{'showHidden':![],'depth':null}));this[_0x7ae6('0x22')](util[_0x7ae6('0x30')](_0x7ae6('0x3b'),this[_0x7ae6('0xd')][_0x25af66['device']]['name']),_0x7ae6('0x3c'),this[_0x7ae6('0xd')][_0x25af66[_0x7ae6('0x35')]]);}else if(this[_0x7ae6('0xb')][_0x25af66['device']]){if(this['trunks'][_0x25af66[_0x7ae6('0x35')]][_0x7ae6('0x26')]!==_0x25af66[_0x7ae6('0x26')][_0x7ae6('0x37')]()){this[_0x7ae6('0xb')][_0x25af66[_0x7ae6('0x35')]][_0x7ae6('0x38')]=_['toNumber'](moment()[_0x7ae6('0x30')]('x'));}this[_0x7ae6('0xb')][_0x25af66['device']][_0x7ae6('0x26')]=_0x25af66[_0x7ae6('0x26')]['toLowerCase']();logger[_0x7ae6('0x27')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x7ae6('0x1a')](this[_0x7ae6('0xb')][_0x25af66['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x7ae6('0x30')](_0x7ae6('0x31'),this['trunks'][_0x25af66['device']]['name']),_0x7ae6('0x33'),this[_0x7ae6('0xb')][_0x25af66[_0x7ae6('0x35')]]);}else if(_[_0x7ae6('0x3d')](_0x25af66[_0x7ae6('0x35')],_0x7ae6('0x3e'))){var _0xc66841=_0x25af66[_0x7ae6('0x35')];var _0x12172c=_0xc66841['substring'](_0xc66841[_0x7ae6('0x3f')]('/')+0x1,_0xc66841[_0x7ae6('0x3f')]('@'));var _0x32988c=_[_0x7ae6('0x29')](this[_0x7ae6('0xc')],function(_0x87b716){return _0x87b716[_0x7ae6('0x40')]==_0x12172c||_0x87b716[_0x7ae6('0x41')]==_0x12172c||_0x87b716['accountcode']==_0x12172c;});if(_0x32988c){if(_0x32988c[_0x7ae6('0x26')]!==_0x25af66[_0x7ae6('0x26')]['toLowerCase']()){_0x32988c['stateTime']=_[_0x7ae6('0x39')](moment()[_0x7ae6('0x30')]('x'));}_0x32988c[_0x7ae6('0x26')]=_0x25af66['state'][_0x7ae6('0x37')]();_0x32988c[_0x7ae6('0x36')]=!![];_0x32988c[_0x7ae6('0x3a')](_0x25af66);}}}}catch(_0x290adf){logger[_0x7ae6('0x1c')](_0x7ae6('0x42'),util[_0x7ae6('0x1a')](_0x290adf,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x235e73){try{if(this[_0x7ae6('0x21')](_0x235e73)&&this[_0x7ae6('0x21')](_0x235e73[_0x7ae6('0x12')])){logger[_0x7ae6('0x23')](_0x7ae6('0x43'),_0x235e73[_0x7ae6('0x44')],_0x235e73[_0x7ae6('0x45')],_0x235e73[_0x7ae6('0x12')]);logger[_0x7ae6('0x27')](_0x7ae6('0x46'),util[_0x7ae6('0x1a')](_0x235e73,{'showHidden':![],'depth':null}));if(this['agents'][_0x235e73[_0x7ae6('0x44')]]){if(!this['agents'][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x36')]||_0x235e73[_0x7ae6('0x12')][_0x7ae6('0x37')]()=='registered'){this[_0x7ae6('0xc')][_0x235e73['peer']]['local']=![];this[_0x7ae6('0xc')][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x47')]=_0x235e73[_0x7ae6('0x12')]['toLowerCase']();this[_0x7ae6('0xc')][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x45')]=_0x235e73[_0x7ae6('0x45')];this[_0x7ae6('0xc')][_0x235e73['peer']][_0x7ae6('0x3a')](_0x235e73);}}else if(this['telephones'][_0x235e73[_0x7ae6('0x44')]]){this[_0x7ae6('0xd')][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x47')]=_0x235e73[_0x7ae6('0x12')][_0x7ae6('0x37')]();this[_0x7ae6('0xd')][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x45')]=_0x235e73[_0x7ae6('0x45')];logger['debug'](_0x7ae6('0x48'),util[_0x7ae6('0x1a')](this['telephones'][_0x235e73['peer']],{'showHidden':![],'depth':null}));this[_0x7ae6('0x22')](util[_0x7ae6('0x30')]('telephone:%s',this[_0x7ae6('0xd')][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x32')]),_0x7ae6('0x3c'),this[_0x7ae6('0xd')][_0x235e73['peer']]);}else if(this[_0x7ae6('0xb')][_0x235e73[_0x7ae6('0x44')]]){this['trunks'][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x47')]=_0x235e73[_0x7ae6('0x12')][_0x7ae6('0x37')]();this[_0x7ae6('0xb')][_0x235e73[_0x7ae6('0x44')]][_0x7ae6('0x45')]=_0x235e73[_0x7ae6('0x45')];logger[_0x7ae6('0x27')](_0x7ae6('0x49'),util['inspect'](this[_0x7ae6('0xb')][_0x235e73[_0x7ae6('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x7ae6('0x31'),this[_0x7ae6('0xb')][_0x235e73[_0x7ae6('0x44')]]['name']),_0x7ae6('0x33'),this['trunks'][_0x235e73[_0x7ae6('0x44')]]);}}}catch(_0xf61257){logger['error'](_0x7ae6('0x46'),util['inspect'](_0xf61257,{'showHidden':![],'depth':null}));}};module[_0x7ae6('0x4a')]=UserReport;
\ No newline at end of file
+var _0x32f4=['name','trunk:save','device','inuse','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','Local','substring','mobile','phone','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','stateRegistry','merge','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x32f4,0x187));var _0x432f=function(_0x511a04,_0x68a9b0){_0x511a04=_0x511a04-0x0;var _0x35e67e=_0x32f4[_0x511a04];return _0x35e67e;};'use strict';var _=require('lodash');var moment=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var Redis=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var config=require(_0x432f('0x4'));var logger=require(_0x432f('0x5'))(_0x432f('0x6'));var ami=require(_0x432f('0x7'));config['redis']=_[_0x432f('0x8')](config['redis'],{'host':_0x432f('0x9'),'port':0x18eb});var io=require(_0x432f('0xa'))(new Redis(config['redis']));function UserReport(_0x342fc6){this[_0x432f('0xb')]=_0x342fc6[_0x432f('0xb')];this['agents']=_0x342fc6[_0x432f('0xc')];this[_0x432f('0xd')]=_0x342fc6[_0x432f('0xd')];ami['on'](_0x432f('0xe'),this[_0x432f('0xf')][_0x432f('0x10')](this));ami['on'](_0x432f('0x11'),this['syncRegistry'][_0x432f('0x10')](this));ami['on'](_0x432f('0x12'),this[_0x432f('0x13')][_0x432f('0x10')](this));ami['on'](_0x432f('0x14'),this[_0x432f('0x15')][_0x432f('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x432f('0x16')]()[_0x432f('0x17')](ami[_0x432f('0x18')]())[_0x432f('0x19')](function(_0x2e38f5){logger[_0x432f('0x1a')](_0x432f('0x1b'),util[_0x432f('0x1c')](_0x2e38f5,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x432f('0x16')]()[_0x432f('0x17')](ami['actionDeviceStateList']())[_0x432f('0x19')](function(_0x5ae6a0){logger['error'](_0x432f('0x1d'),util[_0x432f('0x1c')](_0x5ae6a0,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0x432f('0x1e')]())[_0x432f('0x19')](function(_0x984337){logger['error'](_0x432f('0x1f'),util[_0x432f('0x1c')](_0x984337,{'showHidden':![],'depth':null}));});}UserReport[_0x432f('0x20')][_0x432f('0x21')]=function(){setInterval(function(){BPromise[_0x432f('0x16')]()[_0x432f('0x17')](showSipRegistrations())[_0x432f('0x17')](listDeviceStates())[_0x432f('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x432f('0x20')][_0x432f('0x22')]=function(_0x13dae9){return _0x13dae9!==null&&!_['isUndefined'](_0x13dae9);};UserReport[_0x432f('0x20')][_0x432f('0x23')]=function(_0x213e22,_0x585d40,_0x5c882a){io['to'](_0x213e22)[_0x432f('0x23')](_0x585d40,_0x5c882a);};UserReport[_0x432f('0x20')][_0x432f('0xf')]=function(_0x1725ff){try{if(this[_0x432f('0x22')](_0x1725ff)){logger[_0x432f('0x24')](_0x432f('0x25'),_0x1725ff[_0x432f('0x26')],_0x1725ff[_0x432f('0x27')]);logger[_0x432f('0x28')]('[userReport][registry]',util[_0x432f('0x1c')](_0x1725ff,{'showHidden':![],'depth':null}));var _0x2b3617=_['find'](this[_0x432f('0xb')],{'defaultuser':_0x1725ff['username']});if(_0x2b3617){_0x1725ff[_0x432f('0x29')]=_0x1725ff[_0x432f('0x27')];_[_0x432f('0x2a')](_0x2b3617,_['omit'](_0x1725ff,[_0x432f('0x2b'),'actionid','username','state']));logger[_0x432f('0x28')](_0x432f('0x2c'),util[_0x432f('0x1c')](_0x2b3617,{'showHidden':![],'depth':null}));this['emit'](util[_0x432f('0x2d')](_0x432f('0x2e'),_0x2b3617[_0x432f('0x2f')]),_0x432f('0x30'),_0x2b3617);}}}catch(_0x459a47){logger[_0x432f('0x1a')]('[userReport][registry]',util['inspect'](_0x459a47,{'showHidden':![],'depth':null}));}};UserReport[_0x432f('0x20')][_0x432f('0x13')]=function(_0x1bea3e){try{if(this[_0x432f('0x22')](_0x1bea3e)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x1bea3e[_0x432f('0x31')],_0x1bea3e['state']);logger[_0x432f('0x28')]('[userReport][devicestatechange]',util[_0x432f('0x1c')](_0x1bea3e,{'showHidden':![],'depth':null}));if(this['agents'][_0x1bea3e['device']]){if(!this[_0x432f('0xc')][_0x1bea3e[_0x432f('0x31')]]['local']||_0x1bea3e['state']['toLowerCase']()==_0x432f('0x32')){this[_0x432f('0xc')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x33')]=![];if(this[_0x432f('0xc')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x27')]!==_0x1bea3e[_0x432f('0x27')][_0x432f('0x34')]()){this[_0x432f('0xc')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x35')]=_[_0x432f('0x36')](moment()[_0x432f('0x2d')]('x'));}this[_0x432f('0xc')][_0x1bea3e[_0x432f('0x31')]]['state']=_0x1bea3e['state'][_0x432f('0x34')]();this[_0x432f('0xc')][_0x1bea3e['device']][_0x432f('0x37')](_0x1bea3e);}}else if(this['telephones'][_0x1bea3e[_0x432f('0x31')]]){if(this['telephones'][_0x1bea3e['device']][_0x432f('0x27')]!==_0x1bea3e[_0x432f('0x27')]['toLowerCase']()){this[_0x432f('0xd')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x35')]=_['toNumber'](moment()[_0x432f('0x2d')]('x'));}this[_0x432f('0xd')][_0x1bea3e['device']]['state']=_0x1bea3e[_0x432f('0x27')][_0x432f('0x34')]();logger['debug'](_0x432f('0x38'),util[_0x432f('0x1c')](this[_0x432f('0xd')][_0x1bea3e[_0x432f('0x31')]],{'showHidden':![],'depth':null}));this[_0x432f('0x23')](util[_0x432f('0x2d')](_0x432f('0x39'),this[_0x432f('0xd')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x2f')]),_0x432f('0x3a'),this[_0x432f('0xd')][_0x1bea3e['device']]);}else if(this[_0x432f('0xb')][_0x1bea3e[_0x432f('0x31')]]){if(this[_0x432f('0xb')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x27')]!==_0x1bea3e['state'][_0x432f('0x34')]()){this[_0x432f('0xb')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x35')]=_[_0x432f('0x36')](moment()[_0x432f('0x2d')]('x'));}this[_0x432f('0xb')][_0x1bea3e[_0x432f('0x31')]][_0x432f('0x27')]=_0x1bea3e[_0x432f('0x27')][_0x432f('0x34')]();logger[_0x432f('0x28')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x432f('0x1c')](this[_0x432f('0xb')][_0x1bea3e[_0x432f('0x31')]],{'showHidden':![],'depth':null}));this[_0x432f('0x23')](util[_0x432f('0x2d')](_0x432f('0x2e'),this['trunks'][_0x1bea3e['device']][_0x432f('0x2f')]),_0x432f('0x30'),this[_0x432f('0xb')][_0x1bea3e[_0x432f('0x31')]]);}else if(_[_0x432f('0x3b')](_0x1bea3e[_0x432f('0x31')],_0x432f('0x3c'))){var _0x355506=_0x1bea3e[_0x432f('0x31')];var _0x1e60b0=_0x355506[_0x432f('0x3d')](_0x355506['indexOf']('/')+0x1,_0x355506['indexOf']('@'));var _0x2bf26a=_['find'](this['agents'],function(_0x4f1915){return _0x4f1915[_0x432f('0x3e')]==_0x1e60b0||_0x4f1915[_0x432f('0x3f')]==_0x1e60b0||_0x4f1915['accountcode']==_0x1e60b0;});if(_0x2bf26a){if(_0x2bf26a['state']!==_0x1bea3e[_0x432f('0x27')]['toLowerCase']()){_0x2bf26a['stateTime']=_[_0x432f('0x36')](moment()['format']('x'));}_0x2bf26a['state']=_0x1bea3e['state'][_0x432f('0x34')]();_0x2bf26a[_0x432f('0x33')]=!![];_0x2bf26a['updateStatusRealtime'](_0x1bea3e);}}}}catch(_0x480192){logger[_0x432f('0x1a')](_0x432f('0x40'),util[_0x432f('0x1c')](_0x480192,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x57e788){try{if(this[_0x432f('0x22')](_0x57e788)&&this[_0x432f('0x22')](_0x57e788['peerstatus'])){logger[_0x432f('0x24')](_0x432f('0x41'),_0x57e788[_0x432f('0x42')],_0x57e788[_0x432f('0x43')],_0x57e788[_0x432f('0x14')]);logger[_0x432f('0x28')](_0x432f('0x44'),util[_0x432f('0x1c')](_0x57e788,{'showHidden':![],'depth':null}));if(this[_0x432f('0xc')][_0x57e788[_0x432f('0x42')]]){if(!this[_0x432f('0xc')][_0x57e788[_0x432f('0x42')]][_0x432f('0x33')]||_0x57e788['peerstatus']['toLowerCase']()=='registered'){this['agents'][_0x57e788[_0x432f('0x42')]]['local']=![];this[_0x432f('0xc')][_0x57e788[_0x432f('0x42')]][_0x432f('0x45')]=_0x57e788['peerstatus']['toLowerCase']();this[_0x432f('0xc')][_0x57e788['peer']][_0x432f('0x43')]=_0x57e788[_0x432f('0x43')];this['agents'][_0x57e788['peer']][_0x432f('0x37')](_0x57e788);}}else if(this[_0x432f('0xd')][_0x57e788[_0x432f('0x42')]]){this[_0x432f('0xd')][_0x57e788[_0x432f('0x42')]][_0x432f('0x45')]=_0x57e788[_0x432f('0x14')][_0x432f('0x34')]();this[_0x432f('0xd')][_0x57e788[_0x432f('0x42')]][_0x432f('0x43')]=_0x57e788[_0x432f('0x43')];logger[_0x432f('0x28')](_0x432f('0x46'),util[_0x432f('0x1c')](this[_0x432f('0xd')][_0x57e788[_0x432f('0x42')]],{'showHidden':![],'depth':null}));this[_0x432f('0x23')](util[_0x432f('0x2d')](_0x432f('0x39'),this[_0x432f('0xd')][_0x57e788[_0x432f('0x42')]][_0x432f('0x2f')]),'telephone:save',this[_0x432f('0xd')][_0x57e788['peer']]);}else if(this[_0x432f('0xb')][_0x57e788['peer']]){this[_0x432f('0xb')][_0x57e788['peer']][_0x432f('0x45')]=_0x57e788[_0x432f('0x14')]['toLowerCase']();this[_0x432f('0xb')][_0x57e788[_0x432f('0x42')]][_0x432f('0x43')]=_0x57e788['address'];logger['debug'](_0x432f('0x47'),util[_0x432f('0x1c')](this[_0x432f('0xb')][_0x57e788[_0x432f('0x42')]],{'showHidden':![],'depth':null}));this[_0x432f('0x23')](util[_0x432f('0x2d')](_0x432f('0x2e'),this['trunks'][_0x57e788['peer']][_0x432f('0x2f')]),'trunk:save',this[_0x432f('0xb')][_0x57e788[_0x432f('0x42')]]);}}}catch(_0xd12dc){logger[_0x432f('0x1a')](_0x432f('0x44'),util[_0x432f('0x1c')](_0xd12dc,{'showHidden':![],'depth':null}));}};module[_0x432f('0x48')]=UserReport;
\ No newline at end of file