Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / services / xdr / members.controller.js
index 864aa8f..f188faf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3890=['destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','membername','type','interface','getUserByInterface','name','internal','request','getUserByName','split','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','TALKING','agent','isNil','exitAt','now','duration','enterAt','error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','data2','source','data3'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3890,0x161));var _0x0389=function(_0x110a4f,_0x43014f){_0x110a4f=_0x110a4f-0x0;var _0x2c36ac=_0x3890[_0x110a4f];return _0x2c36ac;};'use strict';var _=require(_0x0389('0x0'));var util=require('util');var utils=require(_0x0389('0x1'));var members={};var exclude=[_0x0389('0x2'),_0x0389('0x3')];function writeDB(_0x2e7322){utils[_0x0389('0x4')](util[_0x0389('0x5')](_0x0389('0x6'),_0x2e7322['uniqueid'],_0x2e7322['interface'],_0x2e7322[_0x0389('0x7')],_0x2e7322['data2'],_0x2e7322[_0x0389('0x8')],_0x2e7322[_0x0389('0x9')]));if(_0x2e7322[_0x0389('0xa')]){utils[_0x0389('0xb')](_0x2e7322[_0x0389('0xa')])['then'](function(_0x1fb934){if(_0x1fb934){_0x2e7322[_0x0389('0x8')]=_0x1fb934[_0x0389('0xc')];_0x2e7322['internal']=_0x1fb934[_0x0389('0xd')];utils[_0x0389('0xe')]('CreateMemberReport',_0x2e7322);}else{utils[_0x0389('0xf')](_0x2e7322[_0x0389('0xa')][_0x0389('0x10')]('/')[0x1])['then'](function(_0x581f72){if(_0x581f72){_0x2e7322[_0x0389('0x8')]=_0x581f72[_0x0389('0xc')];_0x2e7322[_0x0389('0xd')]=_0x581f72[_0x0389('0xd')];utils[_0x0389('0xe')]('CreateMemberReport',_0x2e7322);}});}})['catch'](function(_0x1e9d62){utils['error'](util['format'](_0x0389('0x11'),_0x2e7322[_0x0389('0x12')]),_0x1e9d62);});}delete members[_0x2e7322[_0x0389('0xa')]];}function startsWith(_0x22eb43,_0x517aa4){return _[_0x0389('0x13')](_0x22eb43,function(_0xaca031){return _[_0x0389('0x14')](_0x517aa4,_0xaca031);});}exports[_0x0389('0x15')]=function(_0x2eeafb){try{utils[_0x0389('0x16')](util[_0x0389('0x5')](_0x0389('0x17'),members[_0x2eeafb[_0x0389('0x18')]]?members[_0x2eeafb[_0x0389('0x18')]][_0x0389('0x12')]:_0x2eeafb[_0x0389('0x18')]),_0x2eeafb);utils[_0x0389('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x2eeafb[_0x0389('0x18')]]?members[_0x2eeafb['device']][_0x0389('0x12')]:_0x2eeafb[_0x0389('0x18')],_0x2eeafb[_0x0389('0x19')],_0x2eeafb['device']));switch(_0x2eeafb[_0x0389('0x19')]){case'INUSE':case _0x0389('0x1a'):if(!startsWith(exclude,_0x2eeafb[_0x0389('0x18')])){members[_0x2eeafb['device']]={'channel':_0x0389('0x1b'),'interface':_0x2eeafb[_0x0389('0x18')],'type':_0x0389('0x1c'),'enterAt':utils['now'](),'role':_0x0389('0x1d')};}break;case'NOT_INUSE':if(!_[_0x0389('0x1e')](members[_0x2eeafb[_0x0389('0x18')]])){members[_0x2eeafb[_0x0389('0x18')]][_0x0389('0x1f')]=utils[_0x0389('0x20')]();members[_0x2eeafb[_0x0389('0x18')]][_0x0389('0x21')]=utils['diffTime'](members[_0x2eeafb['device']][_0x0389('0x1f')],members[_0x2eeafb['device']][_0x0389('0x22')]);if(members[_0x2eeafb[_0x0389('0x18')]]['uniqueid']){writeDB(members[_0x2eeafb['device']]);}}break;default:break;}}catch(_0x4ac840){utils[_0x0389('0x23')](util[_0x0389('0x5')](_0x0389('0x17'),members[_0x2eeafb[_0x0389('0x18')]]?members[_0x2eeafb[_0x0389('0x18')]][_0x0389('0x12')]:_0x2eeafb[_0x0389('0x18')]),_0x4ac840);}};exports[_0x0389('0x24')]=function(_0x257877){try{if(!_[_0x0389('0x1e')](members[_0x257877[_0x0389('0xa')]])){utils[_0x0389('0x16')](util['format']('[%s][members][agentcomplete]',_0x257877[_0x0389('0x12')]),_0x257877);utils[_0x0389('0x4')](util[_0x0389('0x5')](_0x0389('0x25'),_0x257877[_0x0389('0x12')],_0x257877[_0x0389('0xa')],_0x257877[_0x0389('0x26')]));members[_0x257877[_0x0389('0xa')]]=_[_0x0389('0x27')](members[_0x257877['interface']],{'data4':_0x257877['queue'],'uniqueid':_0x257877[_0x0389('0x12')]});}}catch(_0x5e3d62){utils[_0x0389('0x23')](util[_0x0389('0x5')](_0x0389('0x28'),_0x257877[_0x0389('0x12')]),_0x5e3d62);}};exports[_0x0389('0x29')]=function(_0xbba27){try{utils['debug'](util['format'](_0x0389('0x2a'),_0xbba27['uniqueid']),_0xbba27);if(_0xbba27['channel']){var _0x4da19b=_0xbba27[_0x0389('0x7')][_0x0389('0x10')]('-')[0x0];if(!_[_0x0389('0x1e')](members[_0x4da19b])){members[_0x4da19b]=_['assign'](members[_0x4da19b],{'data1':members[_0x4da19b][_0x0389('0x2b')]||_0xbba27[_0x0389('0x9')],'data2':members[_0x4da19b][_0x0389('0x2c')]||_0xbba27[_0x0389('0x2d')],'data3':members[_0x4da19b][_0x0389('0x2e')]||_0xbba27[_0x0389('0x2f')],'uniqueid':members[_0x4da19b][_0x0389('0x12')]||_0xbba27[_0x0389('0x12')]});utils['info'](util['format'](_0x0389('0x30'),_0xbba27[_0x0389('0x12')],members[_0x4da19b]['data1'],members[_0x4da19b]['data2'],members[_0x4da19b]['data3']));if(members[_0x4da19b][_0x0389('0x1f')]){writeDB(members[_0x4da19b]);}}}if(_0xbba27[_0x0389('0x31')]){var _0x23e31d=_0xbba27[_0x0389('0x31')][_0x0389('0x10')]('-')[0x0];if(!_[_0x0389('0x1e')](members[_0x23e31d])){members[_0x23e31d]=_[_0x0389('0x27')](members[_0x23e31d],{'data1':members[_0x23e31d][_0x0389('0x2b')]||_0xbba27['type'],'data2':members[_0x23e31d][_0x0389('0x2c')]||_0xbba27[_0x0389('0x2d')],'data3':members[_0x23e31d][_0x0389('0x2e')]||_0xbba27[_0x0389('0x2f')],'uniqueid':members[_0x23e31d]['uniqueid']||_0xbba27[_0x0389('0x12')]});utils['info'](util[_0x0389('0x5')](_0x0389('0x30'),_0xbba27[_0x0389('0x12')],members[_0x23e31d][_0x0389('0x2b')],members[_0x23e31d][_0x0389('0x2c')],members[_0x23e31d][_0x0389('0x2e')]));if(members[_0x23e31d][_0x0389('0x1f')]){writeDB(members[_0x23e31d]);}}}}catch(_0x111cd9){utils[_0x0389('0x23')](util[_0x0389('0x5')](_0x0389('0x2a'),_0xbba27[_0x0389('0x12')]),_0x111cd9);}};
\ No newline at end of file
+var _0x05c6=['catch','uniqueid','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','exitAt','now','diffTime','error','agentcomplete','isNil','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','split','assign','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','membername','type','interface','getUserByInterface','then','name','internal','request','getUserByName','CreateMemberReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x05c6,0x125));var _0x605c=function(_0x529e17,_0x47f3e5){_0x529e17=_0x529e17-0x0;var _0x45c535=_0x05c6[_0x529e17];return _0x45c535;};'use strict';var _=require(_0x605c('0x0'));var util=require(_0x605c('0x1'));var utils=require(_0x605c('0x2'));var members={};var exclude=[_0x605c('0x3'),_0x605c('0x4')];function writeDB(_0xca2a45){utils[_0x605c('0x5')](util[_0x605c('0x6')](_0x605c('0x7'),_0xca2a45['uniqueid'],_0xca2a45['interface'],_0xca2a45[_0x605c('0x8')],_0xca2a45['data2'],_0xca2a45[_0x605c('0x9')],_0xca2a45[_0x605c('0xa')]));if(_0xca2a45[_0x605c('0xb')]){utils[_0x605c('0xc')](_0xca2a45[_0x605c('0xb')])[_0x605c('0xd')](function(_0x3db01d){if(_0x3db01d){_0xca2a45[_0x605c('0x9')]=_0x3db01d[_0x605c('0xe')];_0xca2a45[_0x605c('0xf')]=_0x3db01d[_0x605c('0xf')];utils[_0x605c('0x10')]('CreateMemberReport',_0xca2a45);}else{utils[_0x605c('0x11')](_0xca2a45[_0x605c('0xb')]['split']('/')[0x1])[_0x605c('0xd')](function(_0x5c1729){if(_0x5c1729){_0xca2a45['membername']=_0x5c1729[_0x605c('0xe')];_0xca2a45[_0x605c('0xf')]=_0x5c1729['internal'];utils[_0x605c('0x10')](_0x605c('0x12'),_0xca2a45);}});}})[_0x605c('0x13')](function(_0x450bc0){utils['error'](util[_0x605c('0x6')]('[%s][members][writeDB]',_0xca2a45[_0x605c('0x14')]),_0x450bc0);});}delete members[_0xca2a45['interface']];}function startsWith(_0x5e4b3c,_0x1659e2){return _['some'](_0x5e4b3c,function(_0x183dbd){return _[_0x605c('0x15')](_0x1659e2,_0x183dbd);});}exports['devicestatechange']=function(_0xf8acc7){try{utils['debug'](util[_0x605c('0x6')](_0x605c('0x16'),members[_0xf8acc7[_0x605c('0x17')]]?members[_0xf8acc7[_0x605c('0x17')]]['uniqueid']:_0xf8acc7[_0x605c('0x17')]),_0xf8acc7);utils['info'](util[_0x605c('0x6')](_0x605c('0x18'),members[_0xf8acc7[_0x605c('0x17')]]?members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x14')]:_0xf8acc7['device'],_0xf8acc7[_0x605c('0x19')],_0xf8acc7[_0x605c('0x17')]));switch(_0xf8acc7[_0x605c('0x19')]){case _0x605c('0x1a'):case _0x605c('0x1b'):if(!startsWith(exclude,_0xf8acc7['device'])){members[_0xf8acc7['device']]={'channel':_0x605c('0x1c'),'interface':_0xf8acc7[_0x605c('0x17')],'type':_0x605c('0x1d'),'enterAt':utils['now'](),'role':_0x605c('0x1e')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0xf8acc7[_0x605c('0x17')]])){members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x1f')]=utils[_0x605c('0x20')]();members[_0xf8acc7[_0x605c('0x17')]]['duration']=utils[_0x605c('0x21')](members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x1f')],members[_0xf8acc7['device']]['enterAt']);if(members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x14')]){writeDB(members[_0xf8acc7[_0x605c('0x17')]]);}}break;default:break;}}catch(_0x9c996b){utils[_0x605c('0x22')](util[_0x605c('0x6')](_0x605c('0x16'),members[_0xf8acc7['device']]?members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x14')]:_0xf8acc7[_0x605c('0x17')]),_0x9c996b);}};exports[_0x605c('0x23')]=function(_0xf2197){try{if(!_[_0x605c('0x24')](members[_0xf2197[_0x605c('0xb')]])){utils[_0x605c('0x25')](util[_0x605c('0x6')](_0x605c('0x26'),_0xf2197['uniqueid']),_0xf2197);utils['info'](util[_0x605c('0x6')](_0x605c('0x27'),_0xf2197[_0x605c('0x14')],_0xf2197[_0x605c('0xb')],_0xf2197[_0x605c('0x28')]));members[_0xf2197['interface']]=_['assign'](members[_0xf2197[_0x605c('0xb')]],{'data4':_0xf2197[_0x605c('0x28')],'uniqueid':_0xf2197[_0x605c('0x14')]});}}catch(_0x510746){utils[_0x605c('0x22')](util[_0x605c('0x6')]('[%s][members][agentcomplete]',_0xf2197[_0x605c('0x14')]),_0x510746);}};exports[_0x605c('0x29')]=function(_0x447b5a){try{utils['debug'](util[_0x605c('0x6')]('[%s][members][cdr]',_0x447b5a[_0x605c('0x14')]),_0x447b5a);if(_0x447b5a[_0x605c('0x8')]){var _0x107fb7=_0x447b5a[_0x605c('0x8')][_0x605c('0x2a')]('-')[0x0];if(!_[_0x605c('0x24')](members[_0x107fb7])){members[_0x107fb7]=_[_0x605c('0x2b')](members[_0x107fb7],{'data1':members[_0x107fb7]['data1']||_0x447b5a[_0x605c('0xa')],'data2':members[_0x107fb7][_0x605c('0x2c')]||_0x447b5a[_0x605c('0x2d')],'data3':members[_0x107fb7][_0x605c('0x2e')]||_0x447b5a[_0x605c('0x2f')],'uniqueid':members[_0x107fb7][_0x605c('0x14')]||_0x447b5a[_0x605c('0x14')]});utils[_0x605c('0x5')](util['format'](_0x605c('0x30'),_0x447b5a[_0x605c('0x14')],members[_0x107fb7][_0x605c('0x31')],members[_0x107fb7][_0x605c('0x2c')],members[_0x107fb7][_0x605c('0x2e')]));if(members[_0x107fb7][_0x605c('0x1f')]){writeDB(members[_0x107fb7]);}}}if(_0x447b5a[_0x605c('0x32')]){var _0x1671dd=_0x447b5a['destinationchannel'][_0x605c('0x2a')]('-')[0x0];if(!_[_0x605c('0x24')](members[_0x1671dd])){members[_0x1671dd]=_[_0x605c('0x2b')](members[_0x1671dd],{'data1':members[_0x1671dd][_0x605c('0x31')]||_0x447b5a['type'],'data2':members[_0x1671dd][_0x605c('0x2c')]||_0x447b5a[_0x605c('0x2d')],'data3':members[_0x1671dd]['data3']||_0x447b5a[_0x605c('0x2f')],'uniqueid':members[_0x1671dd]['uniqueid']||_0x447b5a['uniqueid']});utils[_0x605c('0x5')](util[_0x605c('0x6')](_0x605c('0x30'),_0x447b5a[_0x605c('0x14')],members[_0x1671dd][_0x605c('0x31')],members[_0x1671dd][_0x605c('0x2c')],members[_0x1671dd][_0x605c('0x2e')]));if(members[_0x1671dd]['exitAt']){writeDB(members[_0x1671dd]);}}}}catch(_0x1774dc){utils['error'](util['format'](_0x605c('0x33'),_0x447b5a[_0x605c('0x14')]),_0x1774dc);}};
\ No newline at end of file