Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / services / xdr / members.controller.js
index 98fdc9b..b92fcb9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7539=['lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','name','internal','request','CreateMemberReport','getUserByName','split','then','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','type'];(function(_0x235356,_0x523789){var _0x1ecede=function(_0x14ad63){while(--_0x14ad63){_0x235356['push'](_0x235356['shift']());}};_0x1ecede(++_0x523789);}(_0x7539,0x1cb));var _0x9753=function(_0x5bf8be,_0x1a37ea){_0x5bf8be=_0x5bf8be-0x0;var _0x5c74d1=_0x7539[_0x5bf8be];return _0x5c74d1;};'use strict';var _=require(_0x9753('0x0'));var util=require(_0x9753('0x1'));var utils=require(_0x9753('0x2'));var members={};var exclude=[_0x9753('0x3'),'Queue:'];function writeDB(_0x356e7f){utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x6'),_0x356e7f[_0x9753('0x7')],_0x356e7f[_0x9753('0x8')],_0x356e7f['channel'],_0x356e7f[_0x9753('0x9')],_0x356e7f[_0x9753('0xa')],_0x356e7f['type']));if(_0x356e7f[_0x9753('0x8')]){utils['getUserByInterface'](_0x356e7f['interface'])['then'](function(_0x18e958){if(_0x18e958){_0x356e7f['membername']=_0x18e958[_0x9753('0xb')];_0x356e7f['internal']=_0x18e958[_0x9753('0xc')];utils[_0x9753('0xd')](_0x9753('0xe'),_0x356e7f);}else{utils[_0x9753('0xf')](_0x356e7f[_0x9753('0x8')][_0x9753('0x10')]('/')[0x1])[_0x9753('0x11')](function(_0x58cd90){if(_0x58cd90){_0x356e7f[_0x9753('0xa')]=_0x58cd90[_0x9753('0xb')];_0x356e7f[_0x9753('0xc')]=_0x58cd90['internal'];utils[_0x9753('0xd')](_0x9753('0xe'),_0x356e7f);}});}})['catch'](function(_0x4a7355){utils['error'](util['format']('[%s][members][writeDB]',_0x356e7f[_0x9753('0x7')]),_0x4a7355);});}delete members[_0x356e7f[_0x9753('0x8')]];}function startsWith(_0x41a2f8,_0x33d341){return _['some'](_0x41a2f8,function(_0x3425f6){return _[_0x9753('0x12')](_0x33d341,_0x3425f6);});}exports[_0x9753('0x13')]=function(_0x200ae8){try{utils['debug'](util[_0x9753('0x5')](_0x9753('0x14'),members[_0x200ae8['device']]?members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x7')]:_0x200ae8[_0x9753('0x15')]),_0x200ae8);utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x16'),members[_0x200ae8[_0x9753('0x15')]]?members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x7')]:_0x200ae8[_0x9753('0x15')],_0x200ae8[_0x9753('0x17')],_0x200ae8[_0x9753('0x15')]));switch(_0x200ae8[_0x9753('0x17')]){case _0x9753('0x18'):case'BUSY':if(!startsWith(exclude,_0x200ae8[_0x9753('0x15')])){members[_0x200ae8['device']]={'channel':_0x9753('0x19'),'interface':_0x200ae8[_0x9753('0x15')],'type':_0x9753('0x1a'),'enterAt':utils[_0x9753('0x1b')](),'role':_0x9753('0x1c')};}break;case _0x9753('0x1d'):if(!_[_0x9753('0x1e')](members[_0x200ae8[_0x9753('0x15')]])){members[_0x200ae8['device']][_0x9753('0x1f')]=utils['now']();members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x20')]=utils[_0x9753('0x21')](members[_0x200ae8['device']][_0x9753('0x1f')],members[_0x200ae8['device']][_0x9753('0x22')]);if(members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x7')]){writeDB(members[_0x200ae8[_0x9753('0x15')]]);}}break;default:break;}}catch(_0x5aa6af){utils[_0x9753('0x23')](util['format'](_0x9753('0x14'),members[_0x200ae8[_0x9753('0x15')]]?members[_0x200ae8['device']][_0x9753('0x7')]:_0x200ae8[_0x9753('0x15')]),_0x5aa6af);}};exports[_0x9753('0x24')]=function(_0x3ab91a){try{if(!_[_0x9753('0x1e')](members[_0x3ab91a['interface']])){utils['debug'](util[_0x9753('0x5')](_0x9753('0x25'),_0x3ab91a[_0x9753('0x7')]),_0x3ab91a);utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x26'),_0x3ab91a['uniqueid'],_0x3ab91a['interface'],_0x3ab91a[_0x9753('0x27')]));members[_0x3ab91a[_0x9753('0x8')]]=_[_0x9753('0x28')](members[_0x3ab91a[_0x9753('0x8')]],{'data4':_0x3ab91a[_0x9753('0x27')],'uniqueid':_0x3ab91a['uniqueid']});}}catch(_0x1e1d71){utils[_0x9753('0x23')](util[_0x9753('0x5')](_0x9753('0x25'),_0x3ab91a[_0x9753('0x7')]),_0x1e1d71);}};exports[_0x9753('0x29')]=function(_0x5b25ac){try{utils['debug'](util[_0x9753('0x5')](_0x9753('0x2a'),_0x5b25ac[_0x9753('0x7')]),_0x5b25ac);if(_0x5b25ac[_0x9753('0x2b')]){var _0x1c4a25=_0x5b25ac['channel'][_0x9753('0x10')]('-')[0x0];if(!_[_0x9753('0x1e')](members[_0x1c4a25])){members[_0x1c4a25]=_['assign'](members[_0x1c4a25],{'data1':members[_0x1c4a25]['data1']||_0x5b25ac['type'],'data2':members[_0x1c4a25][_0x9753('0x9')]||_0x5b25ac[_0x9753('0x2c')],'data3':members[_0x1c4a25][_0x9753('0x2d')]||_0x5b25ac[_0x9753('0x2e')],'uniqueid':members[_0x1c4a25][_0x9753('0x7')]||_0x5b25ac['uniqueid']});utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x2f'),_0x5b25ac['uniqueid'],members[_0x1c4a25][_0x9753('0x30')],members[_0x1c4a25]['data2'],members[_0x1c4a25][_0x9753('0x2d')]));if(members[_0x1c4a25][_0x9753('0x1f')]){writeDB(members[_0x1c4a25]);}}}if(_0x5b25ac[_0x9753('0x31')]){var _0x287268=_0x5b25ac['destinationchannel'][_0x9753('0x10')]('-')[0x0];if(!_['isNil'](members[_0x287268])){members[_0x287268]=_[_0x9753('0x28')](members[_0x287268],{'data1':members[_0x287268][_0x9753('0x30')]||_0x5b25ac[_0x9753('0x32')],'data2':members[_0x287268][_0x9753('0x9')]||_0x5b25ac[_0x9753('0x2c')],'data3':members[_0x287268][_0x9753('0x2d')]||_0x5b25ac[_0x9753('0x2e')],'uniqueid':members[_0x287268][_0x9753('0x7')]||_0x5b25ac['uniqueid']});utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x2f'),_0x5b25ac[_0x9753('0x7')],members[_0x287268]['data1'],members[_0x287268][_0x9753('0x9')],members[_0x287268][_0x9753('0x2d')]));if(members[_0x287268][_0x9753('0x1f')]){writeDB(members[_0x287268]);}}}}catch(_0x4b2c25){utils['error'](util[_0x9753('0x5')](_0x9753('0x2a'),_0x5b25ac[_0x9753('0x7')]),_0x4b2c25);}};
\ No newline at end of file
+var _0x38c3=['exitAt','duration','diffTime','agentcomplete','debug','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','channel','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','getUserByInterface','name','internal','request','CreateMemberReport','split','catch','error','[%s][members][writeDB]','uniqueid','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x38c3,0x13d));var _0x338c=function(_0x188905,_0x398fac){_0x188905=_0x188905-0x0;var _0x2bf735=_0x38c3[_0x188905];return _0x2bf735;};'use strict';var _=require(_0x338c('0x0'));var util=require(_0x338c('0x1'));var utils=require('./utils');var members={};var exclude=[_0x338c('0x2'),_0x338c('0x3')];function writeDB(_0x36a187){utils[_0x338c('0x4')](util[_0x338c('0x5')](_0x338c('0x6'),_0x36a187['uniqueid'],_0x36a187[_0x338c('0x7')],_0x36a187['channel'],_0x36a187[_0x338c('0x8')],_0x36a187[_0x338c('0x9')],_0x36a187['type']));if(_0x36a187[_0x338c('0x7')]){utils[_0x338c('0xa')](_0x36a187[_0x338c('0x7')])['then'](function(_0x2f3652){if(_0x2f3652){_0x36a187[_0x338c('0x9')]=_0x2f3652[_0x338c('0xb')];_0x36a187[_0x338c('0xc')]=_0x2f3652[_0x338c('0xc')];utils[_0x338c('0xd')](_0x338c('0xe'),_0x36a187);}else{utils['getUserByName'](_0x36a187[_0x338c('0x7')][_0x338c('0xf')]('/')[0x1])['then'](function(_0x2e17b8){if(_0x2e17b8){_0x36a187['membername']=_0x2e17b8[_0x338c('0xb')];_0x36a187[_0x338c('0xc')]=_0x2e17b8['internal'];utils[_0x338c('0xd')](_0x338c('0xe'),_0x36a187);}});}})[_0x338c('0x10')](function(_0x3f3c08){utils[_0x338c('0x11')](util[_0x338c('0x5')](_0x338c('0x12'),_0x36a187[_0x338c('0x13')]),_0x3f3c08);});}delete members[_0x36a187[_0x338c('0x7')]];}function startsWith(_0x127cd1,_0x512b38){return _['some'](_0x127cd1,function(_0x26a6dd){return _[_0x338c('0x14')](_0x512b38,_0x26a6dd);});}exports[_0x338c('0x15')]=function(_0x21cbd4){try{utils['debug'](util[_0x338c('0x5')](_0x338c('0x16'),members[_0x21cbd4[_0x338c('0x17')]]?members[_0x21cbd4[_0x338c('0x17')]][_0x338c('0x13')]:_0x21cbd4[_0x338c('0x17')]),_0x21cbd4);utils[_0x338c('0x4')](util[_0x338c('0x5')](_0x338c('0x18'),members[_0x21cbd4[_0x338c('0x17')]]?members[_0x21cbd4[_0x338c('0x17')]][_0x338c('0x13')]:_0x21cbd4[_0x338c('0x17')],_0x21cbd4['state'],_0x21cbd4['device']));switch(_0x21cbd4[_0x338c('0x19')]){case _0x338c('0x1a'):case _0x338c('0x1b'):if(!startsWith(exclude,_0x21cbd4[_0x338c('0x17')])){members[_0x21cbd4['device']]={'channel':_0x338c('0x1c'),'interface':_0x21cbd4['device'],'type':_0x338c('0x1d'),'enterAt':utils[_0x338c('0x1e')](),'role':'agent'};}break;case _0x338c('0x1f'):if(!_[_0x338c('0x20')](members[_0x21cbd4['device']])){members[_0x21cbd4[_0x338c('0x17')]][_0x338c('0x21')]=utils[_0x338c('0x1e')]();members[_0x21cbd4[_0x338c('0x17')]][_0x338c('0x22')]=utils[_0x338c('0x23')](members[_0x21cbd4[_0x338c('0x17')]][_0x338c('0x21')],members[_0x21cbd4[_0x338c('0x17')]]['enterAt']);if(members[_0x21cbd4[_0x338c('0x17')]][_0x338c('0x13')]){writeDB(members[_0x21cbd4[_0x338c('0x17')]]);}}break;default:break;}}catch(_0x4d78a5){utils[_0x338c('0x11')](util[_0x338c('0x5')]('[%s][members][devicestatechange]',members[_0x21cbd4[_0x338c('0x17')]]?members[_0x21cbd4[_0x338c('0x17')]][_0x338c('0x13')]:_0x21cbd4[_0x338c('0x17')]),_0x4d78a5);}};exports[_0x338c('0x24')]=function(_0x2ae332){try{if(!_['isNil'](members[_0x2ae332['interface']])){utils[_0x338c('0x25')](util[_0x338c('0x5')](_0x338c('0x26'),_0x2ae332[_0x338c('0x13')]),_0x2ae332);utils[_0x338c('0x4')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2ae332[_0x338c('0x13')],_0x2ae332['interface'],_0x2ae332[_0x338c('0x27')]));members[_0x2ae332[_0x338c('0x7')]]=_[_0x338c('0x28')](members[_0x2ae332[_0x338c('0x7')]],{'data4':_0x2ae332[_0x338c('0x27')],'uniqueid':_0x2ae332[_0x338c('0x13')]});}}catch(_0x4a148e){utils['error'](util['format'](_0x338c('0x26'),_0x2ae332[_0x338c('0x13')]),_0x4a148e);}};exports['cdr']=function(_0x1656c6){try{utils[_0x338c('0x25')](util[_0x338c('0x5')](_0x338c('0x29'),_0x1656c6[_0x338c('0x13')]),_0x1656c6);if(_0x1656c6[_0x338c('0x2a')]){var _0x579073=_0x1656c6[_0x338c('0x2a')][_0x338c('0xf')]('-')[0x0];if(!_[_0x338c('0x20')](members[_0x579073])){members[_0x579073]=_['assign'](members[_0x579073],{'data1':members[_0x579073][_0x338c('0x2b')]||_0x1656c6[_0x338c('0x2c')],'data2':members[_0x579073][_0x338c('0x8')]||_0x1656c6[_0x338c('0x2d')],'data3':members[_0x579073][_0x338c('0x2e')]||_0x1656c6[_0x338c('0x2f')],'uniqueid':members[_0x579073][_0x338c('0x13')]||_0x1656c6[_0x338c('0x13')]});utils['info'](util[_0x338c('0x5')](_0x338c('0x30'),_0x1656c6[_0x338c('0x13')],members[_0x579073][_0x338c('0x2b')],members[_0x579073]['data2'],members[_0x579073][_0x338c('0x2e')]));if(members[_0x579073][_0x338c('0x21')]){writeDB(members[_0x579073]);}}}if(_0x1656c6[_0x338c('0x31')]){var _0x314015=_0x1656c6['destinationchannel'][_0x338c('0xf')]('-')[0x0];if(!_[_0x338c('0x20')](members[_0x314015])){members[_0x314015]=_[_0x338c('0x28')](members[_0x314015],{'data1':members[_0x314015][_0x338c('0x2b')]||_0x1656c6[_0x338c('0x2c')],'data2':members[_0x314015][_0x338c('0x8')]||_0x1656c6[_0x338c('0x2d')],'data3':members[_0x314015][_0x338c('0x2e')]||_0x1656c6[_0x338c('0x2f')],'uniqueid':members[_0x314015][_0x338c('0x13')]||_0x1656c6[_0x338c('0x13')]});utils[_0x338c('0x4')](util[_0x338c('0x5')](_0x338c('0x30'),_0x1656c6[_0x338c('0x13')],members[_0x314015][_0x338c('0x2b')],members[_0x314015][_0x338c('0x8')],members[_0x314015][_0x338c('0x2e')]));if(members[_0x314015][_0x338c('0x21')]){writeDB(members[_0x314015]);}}}}catch(_0x17f520){utils[_0x338c('0x11')](util[_0x338c('0x5')](_0x338c('0x29'),_0x1656c6[_0x338c('0x13')]),_0x17f520);}};
\ No newline at end of file