Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / services / xdr / agents.controller.js
index ec43a10..ccab22a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x146f=['forIn','answered_elsewhere','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','extension','transferuniqueid','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','format','agentringnoanswerAt','lastevent','timeout','holdtime','ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','[%s][agents][agentconnect]','agentconnectAt'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x146f,0x164));var _0xf146=function(_0x4e21b8,_0x746758){_0x4e21b8=_0x4e21b8-0x0;var _0x18289c=_0x146f[_0x4e21b8];return _0x18289c;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf146('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x283857,_0x44134f){utils[_0xf146('0x1')](util['format'](_0xf146('0x2'),_0x283857['uniqueid'],_0x283857[_0xf146('0x3')],_0x283857['queue'],_0x283857[_0xf146('0x4')],_0x283857['interface'],_0x283857[_0xf146('0x5')],_0x283857[_0xf146('0x6')],_0x283857['lastevent']));if(_0x283857[_0xf146('0x7')]){utils[_0xf146('0x8')](_0x283857[_0xf146('0x7')])[_0xf146('0x9')](function(_0x995dd5){if(_0x995dd5){_0x283857[_0xf146('0xa')]=_0x995dd5[_0xf146('0xa')];_0x283857[_0xf146('0xb')]=_0x283857[_0xf146('0xc')]?_0x995dd5['acw']:![];_0x283857[_0xf146('0xd')]=_0x283857[_0xf146('0xb')]?_0x995dd5['acwTimeout']:0x0;}utils[_0xf146('0xe')]('CreateVoiceAgentReport',_0x283857);});}else{utils[_0xf146('0xe')](_0xf146('0xf'),_0x283857);}if(_0x44134f){delete transfers[_0x283857[_0xf146('0x10')]];}else{delete agents[_0x283857[_0xf146('0x11')]];}}exports[_0xf146('0x12')]=function(_0x5bfe96){try{utils[_0xf146('0x13')](util['format'](_0xf146('0x14'),_0x5bfe96[_0xf146('0x10')]),_0x5bfe96);agents[_0x5bfe96[_0xf146('0x11')]]=_0x5bfe96;agents[_0x5bfe96['destuniqueid']][_0xf146('0x15')]=utils[_0xf146('0x16')]();agents[_0x5bfe96['destuniqueid']]['lastevent']=_0xf146('0x17');agents[_0x5bfe96['destuniqueid']][_0xf146('0x6')]=null;agents[_0x5bfe96[_0xf146('0x11')]][_0xf146('0x18')]=null;utils[_0xf146('0x1')](util['format'](_0xf146('0x19'),_0x5bfe96[_0xf146('0x10')],agents[_0x5bfe96[_0xf146('0x11')]][_0xf146('0x4')],_0x5bfe96['destuniqueid']));}catch(_0x2815fa){utils[_0xf146('0x1a')](util['format'](_0xf146('0x14'),_0x5bfe96[_0xf146('0x10')]),_0x2815fa);}};exports[_0xf146('0x1b')]=function(_0xa0f9e5){try{if(!_[_0xf146('0x1c')](agents[_0xa0f9e5['destuniqueid']])){utils[_0xf146('0x13')](util[_0xf146('0x1d')]('[%s][agents][agentringnoanswer]',_0xa0f9e5[_0xf146('0x10')]),_0xa0f9e5);utils[_0xf146('0x1')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0xa0f9e5[_0xf146('0x10')],agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x4')],_0xa0f9e5[_0xf146('0x11')]));agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x1b')]=!![];agents[_0xa0f9e5['destuniqueid']][_0xf146('0x1e')]=utils[_0xf146('0x16')]();agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x1f')]=_0xf146('0x20');agents[_0xa0f9e5[_0xf146('0x11')]]['reason']=_0xf146('0x20');agents[_0xa0f9e5[_0xf146('0x11')]][_0xf146('0x21')]=_0xa0f9e5[_0xf146('0x22')]?parseInt(_0xa0f9e5[_0xf146('0x22')])/0x3e8:0x0;agents[_0xa0f9e5['destuniqueid']][_0xf146('0x23')]=0x0;unanswered['push'](_0xa0f9e5[_0xf146('0x11')]);}}catch(_0x88efbe){utils['error'](util[_0xf146('0x1d')](_0xf146('0x24'),_0xa0f9e5[_0xf146('0x10')]),_0x88efbe);}};exports[_0xf146('0x25')]=function(_0x29417e){try{_['forIn'](agents,function(_0x4e678f,_0x814671){if(_0x4e678f['uniqueid']==_0x29417e[_0xf146('0x10')]&&!_[_0xf146('0x26')](unanswered,_0x4e678f['destuniqueid'])){utils[_0xf146('0x13')](util[_0xf146('0x1d')](_0xf146('0x27'),_0x29417e[_0xf146('0x10')]),_0x29417e);utils['info'](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x29417e[_0xf146('0x10')],_0x4e678f['membername'],_0x4e678f['destuniqueid']));_0x4e678f[_0xf146('0x1b')]=!![];_0x4e678f[_0xf146('0x1e')]=utils['now']();_0x4e678f[_0xf146('0x1f')]=_0xf146('0x28');_0x4e678f[_0xf146('0x29')]=_0xf146('0x28');_0x4e678f[_0xf146('0x21')]=_0x29417e['holdtime'];_0x4e678f['talktime']=0x0;writeDB(_0x4e678f);}});}catch(_0x296775){utils[_0xf146('0x1a')](util['format'](_0xf146('0x27'),_0x29417e['uniqueid']),_0x296775);}};exports['agentconnect']=function(_0x27ceaa){try{if(agents[_0x27ceaa['destuniqueid']]){utils['debug'](util[_0xf146('0x1d')](_0xf146('0x2a'),_0x27ceaa[_0xf146('0x10')]),_0x27ceaa);utils['info'](util[_0xf146('0x1d')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x27ceaa[_0xf146('0x10')],agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x4')],_0x27ceaa[_0xf146('0x11')]));agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x2b')]=utils[_0xf146('0x16')]();agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x6')]=_0x27ceaa[_0xf146('0x6')];agents[_0x27ceaa['destuniqueid']][_0xf146('0x18')]=_0x27ceaa['connectedlinename'];agents[_0x27ceaa[_0xf146('0x11')]][_0xf146('0x21')]=_0x27ceaa[_0xf146('0x22')];agents[_0x27ceaa['destuniqueid']][_0xf146('0x1f')]='connect';_[_0xf146('0x2c')](agents,function(_0x263ba3,_0x4b98da){if(_0x263ba3[_0xf146('0x11')]!=_0x27ceaa[_0xf146('0x11')]&&_0x263ba3[_0xf146('0x10')]==_0x27ceaa[_0xf146('0x10')]){_0x263ba3[_0xf146('0x23')]=0x0;_0x263ba3[_0xf146('0x21')]=_0x27ceaa[_0xf146('0x22')];_0x263ba3[_0xf146('0x1b')]=!![];_0x263ba3[_0xf146('0x1e')]=utils[_0xf146('0x16')]();_0x263ba3['lastevent']=_0xf146('0x2d');_0x263ba3['reason']=_0xf146('0x2d');_0x263ba3['answeredelsewheredestinationuniqueid']=_0x27ceaa[_0xf146('0x11')];_0x263ba3['answeredelsewheremembername']=_0x27ceaa[_0xf146('0x4')];writeDB(_0x263ba3);}});}}catch(_0x4c16b7){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x2a'),_0x27ceaa[_0xf146('0x10')]),_0x4c16b7);}};exports[_0xf146('0xc')]=function(_0x3e7a94){try{if(!_[_0xf146('0x1c')](agents[_0x3e7a94[_0xf146('0x11')]])){utils[_0xf146('0x13')](util[_0xf146('0x1d')](_0xf146('0x2e'),_0x3e7a94[_0xf146('0x10')]),_0x3e7a94);utils['info'](util[_0xf146('0x1d')](_0xf146('0x2f'),_0x3e7a94[_0xf146('0x10')],agents[_0x3e7a94['destuniqueid']][_0xf146('0x4')],_0x3e7a94[_0xf146('0x11')]));agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0xc')]=!![];agents[_0x3e7a94['destuniqueid']][_0xf146('0x30')]=utils[_0xf146('0x16')]();agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x23')]=utils[_0xf146('0x31')](agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x30')],agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x2b')]);agents[_0x3e7a94[_0xf146('0x11')]][_0xf146('0x29')]=_0x3e7a94[_0xf146('0x29')];agents[_0x3e7a94['destuniqueid']][_0xf146('0x1f')]=_0xf146('0x32');writeDB(agents[_0x3e7a94['destuniqueid']]);}}catch(_0x1baf0f){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x2e'),_0x3e7a94['uniqueid']),_0x1baf0f);}};exports[_0xf146('0x33')]=function(_0x4b67f2){try{if(!_[_0xf146('0x1c')](agents[_0x4b67f2[_0xf146('0x34')]])){utils[_0xf146('0x13')](util[_0xf146('0x1d')](_0xf146('0x35'),_0x4b67f2[_0xf146('0x10')]),_0x4b67f2);utils[_0xf146('0x1')](util['format'](_0xf146('0x36'),_0x4b67f2[_0xf146('0x10')],agents[_0x4b67f2[_0xf146('0x34')]][_0xf146('0x4')],agents[_0x4b67f2[_0xf146('0x34')]]['uniqueid']));agents[_0x4b67f2[_0xf146('0x34')]][_0xf146('0x37')]=!![];agents[_0x4b67f2[_0xf146('0x34')]]['transfertype']=_0xf146('0x38');agents[_0x4b67f2[_0xf146('0x34')]]['transferexten']=_0x4b67f2[_0xf146('0x39')];agents[_0x4b67f2['transfereruniqueid']][_0xf146('0x3a')]=agents[_0x4b67f2[_0xf146('0x34')]][_0xf146('0x10')];}}catch(_0x28ba38){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x35'),_0x4b67f2[_0xf146('0x10')]),_0x28ba38);}};exports['attendedtransfer']=function(_0x5d1f8a){try{utils['debug'](util[_0xf146('0x1d')]('[%s][agents][attendedtransfer]',_0x5d1f8a['origtransfereruniqueid']),_0x5d1f8a);if(_0x5d1f8a[_0xf146('0x3b')]==_0x5d1f8a['origtransfererlinkedid']){if(!_[_0xf146('0x1c')](agents[_0x5d1f8a[_0xf146('0x3c')]])){utils['info'](util[_0xf146('0x1d')](_0xf146('0x3d'),_0x5d1f8a[_0xf146('0x3b')],agents[_0x5d1f8a['secondtransfereruniqueid']][_0xf146('0x4')]));agents[_0x5d1f8a['secondtransfereruniqueid']][_0xf146('0x37')]=!![];agents[_0x5d1f8a[_0xf146('0x3c')]][_0xf146('0x3e')]=_0xf146('0x3f');agents[_0x5d1f8a[_0xf146('0x3c')]][_0xf146('0x40')]=_0x5d1f8a[_0xf146('0x41')];agents[_0x5d1f8a[_0xf146('0x3c')]]['transferuniqueid']=_0x5d1f8a[_0xf146('0x3b')];}if(_0x5d1f8a[_0xf146('0x42')]&&agents[_0x5d1f8a[_0xf146('0x42')]]){agents[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x43')]=0x1;transfers[_0x5d1f8a[_0xf146('0x42')]]=_[_0xf146('0x44')](agents[_0x5d1f8a[_0xf146('0x42')]]);transfers[_0x5d1f8a['transfereeuniqueid']][_0xf146('0x5')]=agents[_0x5d1f8a['secondtransfereruniqueid']][_0xf146('0x5')];transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x45')]=agents[_0x5d1f8a[_0xf146('0x3c')]]['calleridname'];transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x15')]=utils['now']();transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x2b')]=utils[_0xf146('0x16')]();transfers[_0x5d1f8a[_0xf146('0x42')]][_0xf146('0x21')]=0x0;transfers[_0x5d1f8a['transfereeuniqueid']][_0xf146('0x43')]=0x2;}}else if(_0x5d1f8a[_0xf146('0x3c')]==_0x5d1f8a['secondtransfererlinkedid']){if(!_[_0xf146('0x1c')](agents[_0x5d1f8a[_0xf146('0x3b')]])){utils[_0xf146('0x1')](util['format'](_0xf146('0x3d'),_0x5d1f8a[_0xf146('0x3b')],agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x4')]));agents[_0x5d1f8a[_0xf146('0x3b')]]['transfer']=!![];agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x3e')]=_0xf146('0x3f');agents[_0x5d1f8a[_0xf146('0x3b')]]['transferexten']=_0x5d1f8a['secondtransfererexten'];agents[_0x5d1f8a['origtransfereruniqueid']][_0xf146('0x3a')]=_0x5d1f8a['secondtransfereruniqueid'];}if(_0x5d1f8a['transfertargetuniqueid']&&agents[_0x5d1f8a[_0xf146('0x46')]]){agents[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x43')]=0x1;transfers[_0x5d1f8a[_0xf146('0x46')]]=_[_0xf146('0x44')](agents[_0x5d1f8a[_0xf146('0x46')]]);transfers[_0x5d1f8a[_0xf146('0x46')]]['calleridnum']=agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x5')];transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x45')]=agents[_0x5d1f8a[_0xf146('0x3b')]][_0xf146('0x45')];transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x15')]=utils[_0xf146('0x16')]();transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x2b')]=utils[_0xf146('0x16')]();transfers[_0x5d1f8a[_0xf146('0x46')]][_0xf146('0x21')]=0x0;transfers[_0x5d1f8a[_0xf146('0x46')]]['agententerreason']=0x2;}}}catch(_0x3d8428){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x47'),_0x5d1f8a['origtransfereruniqueid']),_0x3d8428);}};exports[_0xf146('0x48')]=function(_0x2fe0f4){try{utils['debug'](util[_0xf146('0x1d')](_0xf146('0x49'),_0x2fe0f4[_0xf146('0x10')]),_0x2fe0f4);if(agents[_0x2fe0f4[_0xf146('0x10')]]&&agents[_0x2fe0f4['uniqueid']][_0xf146('0x29')]===_0xf146('0x20')){if(_0x2fe0f4[_0xf146('0x4a')]==='21'){agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')]=_0xf146('0x4b');agents[_0x2fe0f4['uniqueid']][_0xf146('0x1f')]=_0xf146('0x4b');}utils[_0xf146('0x1')](util[_0xf146('0x1d')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2fe0f4[_0xf146('0x10')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x4')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')],agents[_0x2fe0f4['uniqueid']][_0xf146('0x1f')]));writeDB(agents[_0x2fe0f4[_0xf146('0x10')]]);var _0x400a8f=unanswered[_0xf146('0x4c')](_0x2fe0f4['uniqueid']);if(_0x400a8f>-0x1){unanswered[_0xf146('0x4d')](_0x400a8f,0x1);}}if(transfers[_0x2fe0f4[_0xf146('0x10')]]){transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0xc')]=!![];transfers[_0x2fe0f4['uniqueid']][_0xf146('0x30')]=utils['now']();transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x23')]=utils[_0xf146('0x31')](transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x30')],transfers[_0x2fe0f4['uniqueid']]['agentconnectAt']);transfers[_0x2fe0f4[_0xf146('0x10')]]['reason']=_0xf146('0x4e');transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x1f')]=_0xf146('0x32');utils[_0xf146('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2fe0f4[_0xf146('0x10')],transfers[_0x2fe0f4['uniqueid']][_0xf146('0x4')],transfers[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')],transfers[_0x2fe0f4['uniqueid']][_0xf146('0x1f')]));writeDB(transfers[_0x2fe0f4[_0xf146('0x10')]],!![]);}if(agents[_0x2fe0f4['uniqueid']]&&agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x2b')]){agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0xc')]=!![];agents[_0x2fe0f4[_0xf146('0x10')]]['agentcompleteAt']=utils[_0xf146('0x16')]();agents[_0x2fe0f4[_0xf146('0x10')]]['talktime']=utils[_0xf146('0x31')](agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x30')],agents[_0x2fe0f4['uniqueid']][_0xf146('0x2b')]);agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')]=agents[_0x2fe0f4[_0xf146('0x10')]]['transfer']?_0xf146('0x37'):'agent';agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x1f')]=_0xf146('0x32');utils['info'](util['format'](_0xf146('0x4f'),_0x2fe0f4[_0xf146('0x10')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x4')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x29')],agents[_0x2fe0f4[_0xf146('0x10')]][_0xf146('0x1f')]));writeDB(agents[_0x2fe0f4[_0xf146('0x10')]]);}}catch(_0x2c99ea){utils[_0xf146('0x1a')](util[_0xf146('0x1d')](_0xf146('0x49'),_0x2fe0f4[_0xf146('0x10')]),_0x2c99ea);}};
\ No newline at end of file
+var _0x9480=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x230513,_0x3c7ea1){var _0x316f48=function(_0x5e8dcc){while(--_0x5e8dcc){_0x230513['push'](_0x230513['shift']());}};_0x316f48(++_0x3c7ea1);}(_0x9480,0xc6));var _0x0948=function(_0x5613de,_0x479c93){_0x5613de=_0x5613de-0x0;var _0x5b40cb=_0x9480[_0x5613de];return _0x5b40cb;};'use strict';var _=require(_0x0948('0x0'));var util=require('util');var utils=require(_0x0948('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f39ab,_0x273326){utils[_0x0948('0x2')](util['format'](_0x0948('0x3'),_0x5f39ab['uniqueid'],_0x5f39ab[_0x0948('0x4')],_0x5f39ab[_0x0948('0x5')],_0x5f39ab[_0x0948('0x6')],_0x5f39ab[_0x0948('0x7')],_0x5f39ab['calleridnum'],_0x5f39ab[_0x0948('0x8')],_0x5f39ab['lastevent']));if(_0x5f39ab['queue']){utils[_0x0948('0x9')](_0x5f39ab['queue'])['then'](function(_0x17a62c){if(_0x17a62c){_0x5f39ab[_0x0948('0xa')]=_0x17a62c[_0x0948('0xa')];_0x5f39ab[_0x0948('0xb')]=_0x5f39ab[_0x0948('0xc')]?_0x17a62c['acw']:![];_0x5f39ab[_0x0948('0xd')]=_0x5f39ab['agentacw']?_0x17a62c[_0x0948('0xe')]:0x0;}utils[_0x0948('0xf')](_0x0948('0x10'),_0x5f39ab);});}else{utils[_0x0948('0xf')](_0x0948('0x10'),_0x5f39ab);}if(_0x273326){delete transfers[_0x5f39ab[_0x0948('0x11')]];}else{delete agents[_0x5f39ab[_0x0948('0x12')]];}}exports[_0x0948('0x13')]=function(_0x264d0f){try{utils[_0x0948('0x14')](util[_0x0948('0x15')](_0x0948('0x16'),_0x264d0f[_0x0948('0x11')]),_0x264d0f);agents[_0x264d0f[_0x0948('0x12')]]=_0x264d0f;agents[_0x264d0f[_0x0948('0x12')]][_0x0948('0x17')]=utils[_0x0948('0x18')]();agents[_0x264d0f['destuniqueid']][_0x0948('0x19')]='called';agents[_0x264d0f['destuniqueid']][_0x0948('0x8')]=null;agents[_0x264d0f['destuniqueid']][_0x0948('0x1a')]=null;utils['info'](util[_0x0948('0x15')](_0x0948('0x1b'),_0x264d0f[_0x0948('0x11')],agents[_0x264d0f[_0x0948('0x12')]][_0x0948('0x6')],_0x264d0f[_0x0948('0x12')]));}catch(_0x5b74c8){utils['error'](util['format'](_0x0948('0x16'),_0x264d0f['uniqueid']),_0x5b74c8);}};exports[_0x0948('0x1c')]=function(_0x3a2666){try{if(!_['isNil'](agents[_0x3a2666[_0x0948('0x12')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x3a2666[_0x0948('0x11')]),_0x3a2666);utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x1d'),_0x3a2666['uniqueid'],agents[_0x3a2666[_0x0948('0x12')]]['membername'],_0x3a2666[_0x0948('0x12')]));agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x1c')]=!![];agents[_0x3a2666[_0x0948('0x12')]]['agentringnoanswerAt']=utils['now']();agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x19')]=_0x0948('0x1e');agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x1f')]=_0x0948('0x1e');agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x20')]=_0x3a2666[_0x0948('0x21')]?parseInt(_0x3a2666[_0x0948('0x21')])/0x3e8:0x0;agents[_0x3a2666[_0x0948('0x12')]][_0x0948('0x22')]=0x0;unanswered[_0x0948('0x23')](_0x3a2666[_0x0948('0x12')]);}}catch(_0x3e569b){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x25'),_0x3a2666[_0x0948('0x11')]),_0x3e569b);}};exports[_0x0948('0x26')]=function(_0x2c1385){try{_[_0x0948('0x27')](agents,function(_0x4f2067,_0x52527d){if(_0x4f2067[_0x0948('0x11')]==_0x2c1385['uniqueid']&&!_['includes'](unanswered,_0x4f2067[_0x0948('0x12')])){utils[_0x0948('0x14')](util[_0x0948('0x15')](_0x0948('0x28'),_0x2c1385['uniqueid']),_0x2c1385);utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x29'),_0x2c1385[_0x0948('0x11')],_0x4f2067['membername'],_0x4f2067[_0x0948('0x12')]));_0x4f2067[_0x0948('0x1c')]=!![];_0x4f2067[_0x0948('0x2a')]=utils[_0x0948('0x18')]();_0x4f2067[_0x0948('0x19')]=_0x0948('0x2b');_0x4f2067[_0x0948('0x1f')]=_0x0948('0x2b');_0x4f2067[_0x0948('0x20')]=_0x2c1385[_0x0948('0x20')];_0x4f2067[_0x0948('0x22')]=0x0;writeDB(_0x4f2067);}});}catch(_0x202c70){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x28'),_0x2c1385[_0x0948('0x11')]),_0x202c70);}};exports['agentconnect']=function(_0x2cd787){try{if(agents[_0x2cd787['destuniqueid']]){utils[_0x0948('0x14')](util[_0x0948('0x15')]('[%s][agents][agentconnect]',_0x2cd787[_0x0948('0x11')]),_0x2cd787);utils[_0x0948('0x2')](util[_0x0948('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2cd787['uniqueid'],agents[_0x2cd787[_0x0948('0x12')]]['membername'],_0x2cd787[_0x0948('0x12')]));agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x2c')]=utils['now']();agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x8')]=_0x2cd787[_0x0948('0x8')];agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x1a')]=_0x2cd787[_0x0948('0x1a')];agents[_0x2cd787[_0x0948('0x12')]][_0x0948('0x20')]=_0x2cd787[_0x0948('0x21')];agents[_0x2cd787['destuniqueid']][_0x0948('0x19')]=_0x0948('0x2d');_[_0x0948('0x27')](agents,function(_0x157b46,_0x5514c8){if(_0x157b46[_0x0948('0x12')]!=_0x2cd787[_0x0948('0x12')]&&_0x157b46[_0x0948('0x11')]==_0x2cd787[_0x0948('0x11')]){_0x157b46[_0x0948('0x22')]=0x0;_0x157b46[_0x0948('0x20')]=_0x2cd787[_0x0948('0x21')];_0x157b46['agentringnoanswer']=!![];_0x157b46[_0x0948('0x2a')]=utils[_0x0948('0x18')]();_0x157b46['lastevent']=_0x0948('0x2e');_0x157b46[_0x0948('0x1f')]='answered_elsewhere';_0x157b46[_0x0948('0x2f')]=_0x2cd787[_0x0948('0x12')];_0x157b46[_0x0948('0x30')]=_0x2cd787[_0x0948('0x6')];writeDB(_0x157b46);}});}}catch(_0x23ee32){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x31'),_0x2cd787[_0x0948('0x11')]),_0x23ee32);}};exports[_0x0948('0xc')]=function(_0x748f4c){try{if(!_[_0x0948('0x32')](agents[_0x748f4c['destuniqueid']])){utils['debug'](util['format'](_0x0948('0x33'),_0x748f4c['uniqueid']),_0x748f4c);utils['info'](util[_0x0948('0x15')](_0x0948('0x34'),_0x748f4c[_0x0948('0x11')],agents[_0x748f4c[_0x0948('0x12')]]['membername'],_0x748f4c[_0x0948('0x12')]));agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0xc')]=!![];agents[_0x748f4c['destuniqueid']][_0x0948('0x35')]=utils['now']();agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x22')]=utils[_0x0948('0x36')](agents[_0x748f4c['destuniqueid']][_0x0948('0x35')],agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x2c')]);agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x1f')]=_0x748f4c[_0x0948('0x1f')];agents[_0x748f4c[_0x0948('0x12')]][_0x0948('0x19')]=_0x0948('0x37');writeDB(agents[_0x748f4c['destuniqueid']]);}}catch(_0x10056c){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x33'),_0x748f4c['uniqueid']),_0x10056c);}};exports[_0x0948('0x38')]=function(_0x3a3f5c){try{if(!_[_0x0948('0x32')](agents[_0x3a3f5c[_0x0948('0x39')]])){utils['debug'](util[_0x0948('0x15')](_0x0948('0x3a'),_0x3a3f5c[_0x0948('0x11')]),_0x3a3f5c);utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x3b'),_0x3a3f5c[_0x0948('0x11')],agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x6')],agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x11')]));agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x3c')]=!![];agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x3d')]=_0x0948('0x3e');agents[_0x3a3f5c['transfereruniqueid']][_0x0948('0x3f')]=_0x3a3f5c[_0x0948('0x40')];agents[_0x3a3f5c['transfereruniqueid']][_0x0948('0x41')]=agents[_0x3a3f5c[_0x0948('0x39')]][_0x0948('0x11')];}}catch(_0x2ee3f0){utils['error'](util[_0x0948('0x15')](_0x0948('0x3a'),_0x3a3f5c[_0x0948('0x11')]),_0x2ee3f0);}};exports['attendedtransfer']=function(_0x9963fb){try{utils[_0x0948('0x14')](util[_0x0948('0x15')](_0x0948('0x42'),_0x9963fb[_0x0948('0x43')]),_0x9963fb);if(_0x9963fb[_0x0948('0x43')]==_0x9963fb[_0x0948('0x44')]){if(!_[_0x0948('0x32')](agents[_0x9963fb[_0x0948('0x45')]])){utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x46'),_0x9963fb[_0x0948('0x43')],agents[_0x9963fb['secondtransfereruniqueid']][_0x0948('0x6')]));agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x3c')]=!![];agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x3d')]=_0x0948('0x47');agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x3f')]=_0x9963fb[_0x0948('0x48')];agents[_0x9963fb[_0x0948('0x45')]]['transferuniqueid']=_0x9963fb['origtransfereruniqueid'];}if(_0x9963fb[_0x0948('0x49')]&&agents[_0x9963fb[_0x0948('0x49')]]){agents[_0x9963fb[_0x0948('0x49')]][_0x0948('0x4a')]=0x1;transfers[_0x9963fb[_0x0948('0x49')]]=_[_0x0948('0x4b')](agents[_0x9963fb[_0x0948('0x49')]]);transfers[_0x9963fb[_0x0948('0x49')]][_0x0948('0x4c')]=agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x4c')];transfers[_0x9963fb[_0x0948('0x49')]][_0x0948('0x4d')]=agents[_0x9963fb[_0x0948('0x45')]][_0x0948('0x4d')];transfers[_0x9963fb[_0x0948('0x49')]][_0x0948('0x17')]=utils['now']();transfers[_0x9963fb[_0x0948('0x49')]]['agentconnectAt']=utils['now']();transfers[_0x9963fb[_0x0948('0x49')]]['holdtime']=0x0;transfers[_0x9963fb[_0x0948('0x49')]]['agententerreason']=0x2;}}else if(_0x9963fb[_0x0948('0x45')]==_0x9963fb[_0x0948('0x4e')]){if(!_[_0x0948('0x32')](agents[_0x9963fb[_0x0948('0x43')]])){utils[_0x0948('0x2')](util[_0x0948('0x15')](_0x0948('0x46'),_0x9963fb['origtransfereruniqueid'],agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x6')]));agents[_0x9963fb['origtransfereruniqueid']][_0x0948('0x3c')]=!![];agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x3d')]=_0x0948('0x47');agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x3f')]=_0x9963fb[_0x0948('0x4f')];agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x41')]=_0x9963fb[_0x0948('0x45')];}if(_0x9963fb['transfertargetuniqueid']&&agents[_0x9963fb['transfertargetuniqueid']]){agents[_0x9963fb[_0x0948('0x50')]][_0x0948('0x4a')]=0x1;transfers[_0x9963fb[_0x0948('0x50')]]=_['clone'](agents[_0x9963fb[_0x0948('0x50')]]);transfers[_0x9963fb[_0x0948('0x50')]][_0x0948('0x4c')]=agents[_0x9963fb[_0x0948('0x43')]]['calleridnum'];transfers[_0x9963fb['transfertargetuniqueid']]['calleridname']=agents[_0x9963fb[_0x0948('0x43')]][_0x0948('0x4d')];transfers[_0x9963fb[_0x0948('0x50')]]['agentcalledAt']=utils['now']();transfers[_0x9963fb['transfertargetuniqueid']][_0x0948('0x2c')]=utils[_0x0948('0x18')]();transfers[_0x9963fb[_0x0948('0x50')]][_0x0948('0x20')]=0x0;transfers[_0x9963fb[_0x0948('0x50')]]['agententerreason']=0x2;}}}catch(_0x39cb18){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x42'),_0x9963fb['origtransfereruniqueid']),_0x39cb18);}};exports[_0x0948('0x51')]=function(_0x1ee102){try{utils[_0x0948('0x14')](util['format'](_0x0948('0x52'),_0x1ee102[_0x0948('0x11')]),_0x1ee102);if(agents[_0x1ee102['uniqueid']]&&agents[_0x1ee102[_0x0948('0x11')]]['reason']===_0x0948('0x1e')){if(_0x1ee102[_0x0948('0x53')]==='21'){agents[_0x1ee102[_0x0948('0x11')]]['reason']=_0x0948('0x54');agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]=_0x0948('0x54');}utils[_0x0948('0x2')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1ee102[_0x0948('0x11')],agents[_0x1ee102['uniqueid']][_0x0948('0x6')],agents[_0x1ee102[_0x0948('0x11')]]['reason'],agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]));writeDB(agents[_0x1ee102[_0x0948('0x11')]]);var _0x4ca29=unanswered[_0x0948('0x55')](_0x1ee102[_0x0948('0x11')]);if(_0x4ca29>-0x1){unanswered[_0x0948('0x56')](_0x4ca29,0x1);}}if(transfers[_0x1ee102[_0x0948('0x11')]]){transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0xc')]=!![];transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')]=utils[_0x0948('0x18')]();transfers[_0x1ee102['uniqueid']][_0x0948('0x22')]=utils[_0x0948('0x36')](transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')],transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x2c')]);transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x1f')]=_0x0948('0x57');transfers[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]=_0x0948('0x37');utils[_0x0948('0x2')](util['format'](_0x0948('0x58'),_0x1ee102[_0x0948('0x11')],transfers[_0x1ee102['uniqueid']][_0x0948('0x6')],transfers[_0x1ee102[_0x0948('0x11')]]['reason'],transfers[_0x1ee102[_0x0948('0x11')]]['lastevent']));writeDB(transfers[_0x1ee102[_0x0948('0x11')]],!![]);}if(agents[_0x1ee102[_0x0948('0x11')]]&&agents[_0x1ee102['uniqueid']][_0x0948('0x2c')]){agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0xc')]=!![];agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')]=utils[_0x0948('0x18')]();agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x22')]=utils[_0x0948('0x36')](agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x35')],agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x2c')]);agents[_0x1ee102['uniqueid']][_0x0948('0x1f')]=agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x3c')]?_0x0948('0x3c'):_0x0948('0x57');agents[_0x1ee102['uniqueid']]['lastevent']=_0x0948('0x37');utils[_0x0948('0x2')](util[_0x0948('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1ee102[_0x0948('0x11')],agents[_0x1ee102[_0x0948('0x11')]]['membername'],agents[_0x1ee102[_0x0948('0x11')]]['reason'],agents[_0x1ee102[_0x0948('0x11')]][_0x0948('0x19')]));writeDB(agents[_0x1ee102[_0x0948('0x11')]]);}}catch(_0x5933d9){utils[_0x0948('0x24')](util[_0x0948('0x15')](_0x0948('0x52'),_0x1ee102['uniqueid']),_0x5933d9);}};
\ No newline at end of file