Built motion from commit da617fac.|2.6.6
[motion2.git] / server / services / xdr / members.controller.js
index 86f66b6..88e2186 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8af9=['[%s][members][writeDB]','some','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','duration','exitAt','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','assign','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','isNil','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','name','internal','request','CreateMemberReport','getUserByName','split','error'];(function(_0x2886bc,_0x46347e){var _0x208052=function(_0x480783){while(--_0x480783){_0x2886bc['push'](_0x2886bc['shift']());}};_0x208052(++_0x46347e);}(_0x8af9,0xa8));var _0x98af=function(_0x25d0a5,_0xbca7c9){_0x25d0a5=_0x25d0a5-0x0;var _0x300bc6=_0x8af9[_0x25d0a5];return _0x300bc6;};'use strict';var _=require(_0x98af('0x0'));var util=require('util');var utils=require(_0x98af('0x1'));var members={};var exclude=[_0x98af('0x2'),_0x98af('0x3')];function writeDB(_0x23077f){utils[_0x98af('0x4')](util[_0x98af('0x5')](_0x98af('0x6'),_0x23077f[_0x98af('0x7')],_0x23077f[_0x98af('0x8')],_0x23077f[_0x98af('0x9')],_0x23077f[_0x98af('0xa')],_0x23077f[_0x98af('0xb')],_0x23077f[_0x98af('0xc')]));if(_0x23077f[_0x98af('0x8')]){utils['getUserByInterface'](_0x23077f[_0x98af('0x8')])['then'](function(_0x33f42a){if(_0x33f42a){_0x23077f['membername']=_0x33f42a[_0x98af('0xd')];_0x23077f[_0x98af('0xe')]=_0x33f42a[_0x98af('0xe')];utils[_0x98af('0xf')](_0x98af('0x10'),_0x23077f);}else{utils[_0x98af('0x11')](_0x23077f['interface'][_0x98af('0x12')]('/')[0x1])['then'](function(_0x109d07){if(_0x109d07){_0x23077f[_0x98af('0xb')]=_0x109d07['name'];_0x23077f[_0x98af('0xe')]=_0x109d07[_0x98af('0xe')];utils['request'](_0x98af('0x10'),_0x23077f);}});}})['catch'](function(_0x373c78){utils[_0x98af('0x13')](util['format'](_0x98af('0x14'),_0x23077f['uniqueid']),_0x373c78);});}delete members[_0x23077f[_0x98af('0x8')]];}function startsWith(_0x2acff6,_0x2b3f0b){return _[_0x98af('0x15')](_0x2acff6,function(_0x4319e9){return _['startsWith'](_0x2b3f0b,_0x4319e9);});}exports[_0x98af('0x16')]=function(_0x3aeb87){try{utils['debug'](util['format'](_0x98af('0x17'),members[_0x3aeb87[_0x98af('0x18')]]?members[_0x3aeb87[_0x98af('0x18')]][_0x98af('0x7')]:_0x3aeb87['device']),_0x3aeb87);utils[_0x98af('0x4')](util['format'](_0x98af('0x19'),members[_0x3aeb87[_0x98af('0x18')]]?members[_0x3aeb87[_0x98af('0x18')]][_0x98af('0x7')]:_0x3aeb87[_0x98af('0x18')],_0x3aeb87[_0x98af('0x1a')],_0x3aeb87['device']));switch(_0x3aeb87[_0x98af('0x1a')]){case _0x98af('0x1b'):case _0x98af('0x1c'):if(!startsWith(exclude,_0x3aeb87[_0x98af('0x18')])){members[_0x3aeb87['device']]={'channel':'voice','interface':_0x3aeb87[_0x98af('0x18')],'type':_0x98af('0x1d'),'enterAt':utils[_0x98af('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x3aeb87[_0x98af('0x18')]])){members[_0x3aeb87['device']]['exitAt']=utils['now']();members[_0x3aeb87[_0x98af('0x18')]][_0x98af('0x1f')]=utils['diffTime'](members[_0x3aeb87['device']][_0x98af('0x20')],members[_0x3aeb87[_0x98af('0x18')]][_0x98af('0x21')]);if(members[_0x3aeb87[_0x98af('0x18')]][_0x98af('0x7')]){writeDB(members[_0x3aeb87[_0x98af('0x18')]]);}}break;default:break;}}catch(_0xc82d38){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x3aeb87[_0x98af('0x18')]]?members[_0x3aeb87[_0x98af('0x18')]][_0x98af('0x7')]:_0x3aeb87[_0x98af('0x18')]),_0xc82d38);}};exports[_0x98af('0x22')]=function(_0x20555b){try{if(!_['isNil'](members[_0x20555b[_0x98af('0x8')]])){utils[_0x98af('0x23')](util[_0x98af('0x5')](_0x98af('0x24'),_0x20555b[_0x98af('0x7')]),_0x20555b);utils[_0x98af('0x4')](util[_0x98af('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x20555b['uniqueid'],_0x20555b['interface'],_0x20555b['queue']));members[_0x20555b['interface']]=_[_0x98af('0x25')](members[_0x20555b[_0x98af('0x8')]],{'data4':_0x20555b['queue'],'uniqueid':_0x20555b[_0x98af('0x7')]});}}catch(_0x5a03dc){utils[_0x98af('0x13')](util['format'](_0x98af('0x24'),_0x20555b[_0x98af('0x7')]),_0x5a03dc);}};exports[_0x98af('0x26')]=function(_0x2679d6){try{utils[_0x98af('0x23')](util[_0x98af('0x5')]('[%s][members][cdr]',_0x2679d6['uniqueid']),_0x2679d6);if(_0x2679d6[_0x98af('0x9')]){var _0x149a1a=_0x2679d6[_0x98af('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x149a1a])){members[_0x149a1a]=_['assign'](members[_0x149a1a],{'data1':members[_0x149a1a][_0x98af('0x27')]||_0x2679d6[_0x98af('0xc')],'data2':members[_0x149a1a]['data2']||_0x2679d6[_0x98af('0x28')],'data3':members[_0x149a1a][_0x98af('0x29')]||_0x2679d6[_0x98af('0x2a')],'uniqueid':members[_0x149a1a][_0x98af('0x7')]||_0x2679d6[_0x98af('0x7')]});utils[_0x98af('0x4')](util[_0x98af('0x5')](_0x98af('0x2b'),_0x2679d6[_0x98af('0x7')],members[_0x149a1a]['data1'],members[_0x149a1a][_0x98af('0xa')],members[_0x149a1a][_0x98af('0x29')]));if(members[_0x149a1a]['exitAt']){writeDB(members[_0x149a1a]);}}}if(_0x2679d6['destinationchannel']){var _0x560010=_0x2679d6[_0x98af('0x2c')]['split']('-')[0x0];if(!_[_0x98af('0x2d')](members[_0x560010])){members[_0x560010]=_[_0x98af('0x25')](members[_0x560010],{'data1':members[_0x560010][_0x98af('0x27')]||_0x2679d6[_0x98af('0xc')],'data2':members[_0x560010]['data2']||_0x2679d6[_0x98af('0x28')],'data3':members[_0x560010][_0x98af('0x29')]||_0x2679d6[_0x98af('0x2a')],'uniqueid':members[_0x560010][_0x98af('0x7')]||_0x2679d6[_0x98af('0x7')]});utils['info'](util['format'](_0x98af('0x2b'),_0x2679d6['uniqueid'],members[_0x560010][_0x98af('0x27')],members[_0x560010]['data2'],members[_0x560010][_0x98af('0x29')]));if(members[_0x560010]['exitAt']){writeDB(members[_0x560010]);}}}}catch(_0xd23bdf){utils[_0x98af('0x13')](util[_0x98af('0x5')](_0x98af('0x2e'),_0x2679d6[_0x98af('0x7')]),_0xd23bdf);}};
\ No newline at end of file
+var _0x208d=['assign','error','cdr','data1','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','[%s][members][writeDB]','startsWith','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x181589,_0x1eedd9){var _0x2e4edd=function(_0x3d574a){while(--_0x3d574a){_0x181589['push'](_0x181589['shift']());}};_0x2e4edd(++_0x1eedd9);}(_0x208d,0xa4));var _0xd208=function(_0x55c307,_0x22b2ce){_0x55c307=_0x55c307-0x0;var _0xcca0a9=_0x208d[_0x55c307];return _0xcca0a9;};'use strict';var _=require(_0xd208('0x0'));var util=require(_0xd208('0x1'));var utils=require(_0xd208('0x2'));var members={};var exclude=[_0xd208('0x3'),'Queue:'];function writeDB(_0x4dc46e){utils['info'](util[_0xd208('0x4')](_0xd208('0x5'),_0x4dc46e[_0xd208('0x6')],_0x4dc46e[_0xd208('0x7')],_0x4dc46e[_0xd208('0x8')],_0x4dc46e['data2'],_0x4dc46e[_0xd208('0x9')],_0x4dc46e[_0xd208('0xa')]));if(_0x4dc46e[_0xd208('0x7')]){utils['getUserByInterface'](_0x4dc46e[_0xd208('0x7')])[_0xd208('0xb')](function(_0x5b5f42){if(_0x5b5f42){_0x4dc46e[_0xd208('0x9')]=_0x5b5f42[_0xd208('0xc')];_0x4dc46e['internal']=_0x5b5f42[_0xd208('0xd')];utils[_0xd208('0xe')](_0xd208('0xf'),_0x4dc46e);}else{utils[_0xd208('0x10')](_0x4dc46e['interface'][_0xd208('0x11')]('/')[0x1])[_0xd208('0xb')](function(_0x57f362){if(_0x57f362){_0x4dc46e[_0xd208('0x9')]=_0x57f362[_0xd208('0xc')];_0x4dc46e[_0xd208('0xd')]=_0x57f362[_0xd208('0xd')];utils[_0xd208('0xe')](_0xd208('0xf'),_0x4dc46e);}});}})[_0xd208('0x12')](function(_0x4ff72e){utils['error'](util[_0xd208('0x4')](_0xd208('0x13'),_0x4dc46e[_0xd208('0x6')]),_0x4ff72e);});}delete members[_0x4dc46e[_0xd208('0x7')]];}function startsWith(_0x324bac,_0x14e6c5){return _['some'](_0x324bac,function(_0x21a27b){return _[_0xd208('0x14')](_0x14e6c5,_0x21a27b);});}exports['devicestatechange']=function(_0x6ac23e){try{utils['debug'](util[_0xd208('0x4')](_0xd208('0x15'),members[_0x6ac23e[_0xd208('0x16')]]?members[_0x6ac23e[_0xd208('0x16')]][_0xd208('0x6')]:_0x6ac23e[_0xd208('0x16')]),_0x6ac23e);utils[_0xd208('0x17')](util[_0xd208('0x4')](_0xd208('0x18'),members[_0x6ac23e['device']]?members[_0x6ac23e[_0xd208('0x16')]]['uniqueid']:_0x6ac23e[_0xd208('0x16')],_0x6ac23e['state'],_0x6ac23e[_0xd208('0x16')]));switch(_0x6ac23e[_0xd208('0x19')]){case _0xd208('0x1a'):case _0xd208('0x1b'):if(!startsWith(exclude,_0x6ac23e[_0xd208('0x16')])){members[_0x6ac23e['device']]={'channel':_0xd208('0x1c'),'interface':_0x6ac23e[_0xd208('0x16')],'type':'TALKING','enterAt':utils[_0xd208('0x1d')](),'role':_0xd208('0x1e')};}break;case _0xd208('0x1f'):if(!_[_0xd208('0x20')](members[_0x6ac23e[_0xd208('0x16')]])){members[_0x6ac23e[_0xd208('0x16')]]['exitAt']=utils[_0xd208('0x1d')]();members[_0x6ac23e[_0xd208('0x16')]][_0xd208('0x21')]=utils[_0xd208('0x22')](members[_0x6ac23e[_0xd208('0x16')]][_0xd208('0x23')],members[_0x6ac23e['device']]['enterAt']);if(members[_0x6ac23e['device']]['uniqueid']){writeDB(members[_0x6ac23e[_0xd208('0x16')]]);}}break;default:break;}}catch(_0x4b29c0){utils['error'](util['format'](_0xd208('0x15'),members[_0x6ac23e[_0xd208('0x16')]]?members[_0x6ac23e['device']][_0xd208('0x6')]:_0x6ac23e['device']),_0x4b29c0);}};exports[_0xd208('0x24')]=function(_0x2d8562){try{if(!_[_0xd208('0x20')](members[_0x2d8562[_0xd208('0x7')]])){utils[_0xd208('0x25')](util[_0xd208('0x4')](_0xd208('0x26'),_0x2d8562[_0xd208('0x6')]),_0x2d8562);utils[_0xd208('0x17')](util['format'](_0xd208('0x27'),_0x2d8562[_0xd208('0x6')],_0x2d8562[_0xd208('0x7')],_0x2d8562['queue']));members[_0x2d8562[_0xd208('0x7')]]=_[_0xd208('0x28')](members[_0x2d8562['interface']],{'data4':_0x2d8562['queue'],'uniqueid':_0x2d8562[_0xd208('0x6')]});}}catch(_0x1b343a){utils[_0xd208('0x29')](util['format'](_0xd208('0x26'),_0x2d8562[_0xd208('0x6')]),_0x1b343a);}};exports[_0xd208('0x2a')]=function(_0x13726b){try{utils[_0xd208('0x25')](util['format']('[%s][members][cdr]',_0x13726b[_0xd208('0x6')]),_0x13726b);if(_0x13726b[_0xd208('0x8')]){var _0xffe4b5=_0x13726b[_0xd208('0x8')][_0xd208('0x11')]('-')[0x0];if(!_[_0xd208('0x20')](members[_0xffe4b5])){members[_0xffe4b5]=_[_0xd208('0x28')](members[_0xffe4b5],{'data1':members[_0xffe4b5][_0xd208('0x2b')]||_0x13726b[_0xd208('0xa')],'data2':members[_0xffe4b5][_0xd208('0x2c')]||_0x13726b[_0xd208('0x2d')],'data3':members[_0xffe4b5][_0xd208('0x2e')]||_0x13726b['destination'],'uniqueid':members[_0xffe4b5][_0xd208('0x6')]||_0x13726b[_0xd208('0x6')]});utils[_0xd208('0x17')](util[_0xd208('0x4')](_0xd208('0x2f'),_0x13726b[_0xd208('0x6')],members[_0xffe4b5][_0xd208('0x2b')],members[_0xffe4b5][_0xd208('0x2c')],members[_0xffe4b5][_0xd208('0x2e')]));if(members[_0xffe4b5][_0xd208('0x23')]){writeDB(members[_0xffe4b5]);}}}if(_0x13726b[_0xd208('0x30')]){var _0x5c0646=_0x13726b[_0xd208('0x30')][_0xd208('0x11')]('-')[0x0];if(!_[_0xd208('0x20')](members[_0x5c0646])){members[_0x5c0646]=_['assign'](members[_0x5c0646],{'data1':members[_0x5c0646]['data1']||_0x13726b[_0xd208('0xa')],'data2':members[_0x5c0646]['data2']||_0x13726b[_0xd208('0x2d')],'data3':members[_0x5c0646][_0xd208('0x2e')]||_0x13726b[_0xd208('0x31')],'uniqueid':members[_0x5c0646][_0xd208('0x6')]||_0x13726b[_0xd208('0x6')]});utils[_0xd208('0x17')](util['format'](_0xd208('0x2f'),_0x13726b[_0xd208('0x6')],members[_0x5c0646][_0xd208('0x2b')],members[_0x5c0646][_0xd208('0x2c')],members[_0x5c0646][_0xd208('0x2e')]));if(members[_0x5c0646][_0xd208('0x23')]){writeDB(members[_0x5c0646]);}}}}catch(_0x56b48f){utils['error'](util[_0xd208('0x4')](_0xd208('0x32'),_0x13726b[_0xd208('0x6')]),_0x56b48f);}};
\ No newline at end of file