Built motion from commit 87cd5f02.|2.5.48
[motion2.git] / server / services / xdr / agents.controller.js
index e80f7d6..0fccfe0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf684=['cause','rejected','indexOf','splice','agent','lodash','util','./utils','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','abandoned','agentconnect','agentconnectAt','connectedlinenum','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','blindtransfer','transfer','transfereruniqueid','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','transfertype','secondtransfererexten','transfertargetuniqueid','hangup'];(function(_0x21fa7d,_0x20098f){var _0x3a3f4d=function(_0x28feb1){while(--_0x28feb1){_0x21fa7d['push'](_0x21fa7d['shift']());}};_0x3a3f4d(++_0x20098f);}(_0xf684,0x1c1));var _0x4f68=function(_0x30007a,_0x21909a){_0x30007a=_0x30007a-0x0;var _0x8f45dd=_0xf684[_0x30007a];return _0x8f45dd;};'use strict';var _=require(_0x4f68('0x0'));var util=require(_0x4f68('0x1'));var utils=require(_0x4f68('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x414f99,_0x25c4de){utils['info'](util['format'](_0x4f68('0x3'),_0x414f99[_0x4f68('0x4')],_0x414f99[_0x4f68('0x5')],_0x414f99[_0x4f68('0x6')],_0x414f99[_0x4f68('0x7')],_0x414f99[_0x4f68('0x8')],_0x414f99['calleridnum'],_0x414f99['connectedlinenum'],_0x414f99[_0x4f68('0x9')]));if(_0x414f99[_0x4f68('0x6')]){utils[_0x4f68('0xa')](_0x414f99[_0x4f68('0x6')])[_0x4f68('0xb')](function(_0x4af506){if(_0x4af506){_0x414f99[_0x4f68('0xc')]=_0x4af506[_0x4f68('0xc')];_0x414f99[_0x4f68('0xd')]=_0x414f99[_0x4f68('0xe')]?_0x4af506['acw']:![];_0x414f99[_0x4f68('0xf')]=_0x414f99[_0x4f68('0xd')]?_0x4af506[_0x4f68('0x10')]:0x0;}utils[_0x4f68('0x11')](_0x4f68('0x12'),_0x414f99);});}else{utils[_0x4f68('0x11')](_0x4f68('0x12'),_0x414f99);}if(_0x25c4de){delete transfers[_0x414f99[_0x4f68('0x4')]];}else{delete agents[_0x414f99[_0x4f68('0x13')]];}}exports[_0x4f68('0x14')]=function(_0x4d6501){try{agents[_0x4d6501[_0x4f68('0x13')]]=_0x4d6501;agents[_0x4d6501[_0x4f68('0x13')]][_0x4f68('0x15')]=utils[_0x4f68('0x16')]();agents[_0x4d6501[_0x4f68('0x13')]][_0x4f68('0x9')]=_0x4f68('0x17');agents[_0x4d6501[_0x4f68('0x13')]]['connectedlinenum']=null;agents[_0x4d6501[_0x4f68('0x13')]][_0x4f68('0x18')]=null;}catch(_0x15fca7){utils[_0x4f68('0x19')](_0x15fca7[_0x4f68('0x1a')]);}};exports[_0x4f68('0x1b')]=function(_0x1aa92e){try{if(!_[_0x4f68('0x1c')](agents[_0x1aa92e[_0x4f68('0x13')]])){agents[_0x1aa92e['destuniqueid']][_0x4f68('0x1b')]=!![];agents[_0x1aa92e['destuniqueid']][_0x4f68('0x1d')]=utils[_0x4f68('0x16')]();agents[_0x1aa92e[_0x4f68('0x13')]][_0x4f68('0x9')]=_0x4f68('0x1e');agents[_0x1aa92e[_0x4f68('0x13')]][_0x4f68('0x1f')]=_0x4f68('0x1e');agents[_0x1aa92e[_0x4f68('0x13')]][_0x4f68('0x20')]=_0x1aa92e['ringtime']?parseInt(_0x1aa92e[_0x4f68('0x21')])/0x3e8:0x0;agents[_0x1aa92e['destuniqueid']][_0x4f68('0x22')]=0x0;unanswered[_0x4f68('0x23')](_0x1aa92e[_0x4f68('0x13')]);}}catch(_0x26abf7){utils['error'](_0x26abf7['stack']);}};exports['queuecallerabandon']=function(_0xaadd87){try{_[_0x4f68('0x24')](agents,function(_0x773779,_0x5ccd74){if(_0x773779[_0x4f68('0x4')]==_0xaadd87[_0x4f68('0x4')]&&!_[_0x4f68('0x25')](unanswered,_0x773779['destuniqueid'])){_0x773779[_0x4f68('0x1b')]=!![];_0x773779[_0x4f68('0x1d')]=utils['now']();_0x773779[_0x4f68('0x9')]=_0x4f68('0x26');_0x773779['reason']=_0x4f68('0x26');_0x773779[_0x4f68('0x20')]=_0xaadd87['holdtime'];_0x773779[_0x4f68('0x22')]=0x0;writeDB(_0x773779);}});}catch(_0xda2958){utils[_0x4f68('0x19')](_0xda2958[_0x4f68('0x1a')]);}};exports[_0x4f68('0x27')]=function(_0x14d99a){try{if(agents[_0x14d99a[_0x4f68('0x13')]]){agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x28')]=utils[_0x4f68('0x16')]();agents[_0x14d99a[_0x4f68('0x13')]]['connectedlinenum']=_0x14d99a[_0x4f68('0x29')];agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x18')]=_0x14d99a[_0x4f68('0x18')];agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x20')]=_0x14d99a['ringtime'];agents[_0x14d99a[_0x4f68('0x13')]][_0x4f68('0x9')]=_0x4f68('0x2a');_[_0x4f68('0x24')](agents,function(_0x3201a8,_0x48b006){if(_0x3201a8[_0x4f68('0x13')]!=_0x14d99a[_0x4f68('0x13')]&&_0x3201a8[_0x4f68('0x4')]==_0x14d99a[_0x4f68('0x4')]){_0x3201a8[_0x4f68('0x22')]=0x0;_0x3201a8[_0x4f68('0x20')]=_0x14d99a[_0x4f68('0x21')];_0x3201a8['agentringnoanswer']=!![];_0x3201a8['agentringnoanswerAt']=utils[_0x4f68('0x16')]();_0x3201a8['lastevent']=_0x4f68('0x2b');_0x3201a8[_0x4f68('0x1f')]=_0x4f68('0x2b');_0x3201a8['answeredelsewheredestinationuniqueid']=_0x14d99a[_0x4f68('0x13')];_0x3201a8[_0x4f68('0x2c')]=_0x14d99a[_0x4f68('0x7')];writeDB(_0x3201a8);}});}}catch(_0x2024d6){utils['error'](_0x2024d6[_0x4f68('0x1a')]);}};exports[_0x4f68('0xe')]=function(_0x475612){try{if(!_[_0x4f68('0x1c')](agents[_0x475612[_0x4f68('0x13')]])){agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0xe')]=!![];agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0x2d')]=utils[_0x4f68('0x16')]();agents[_0x475612[_0x4f68('0x13')]]['talktime']=utils[_0x4f68('0x2e')](agents[_0x475612[_0x4f68('0x13')]]['agentcompleteAt'],agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0x28')]);agents[_0x475612[_0x4f68('0x13')]][_0x4f68('0x1f')]=_0x475612[_0x4f68('0x1f')];agents[_0x475612['destuniqueid']][_0x4f68('0x9')]=_0x4f68('0x2f');writeDB(agents[_0x475612['destuniqueid']]);}}catch(_0x1cd9ee){utils['error'](_0x1cd9ee[_0x4f68('0x1a')]);}};exports[_0x4f68('0x30')]=function(_0x25a175){try{if(!_[_0x4f68('0x1c')](agents[_0x25a175['transfereruniqueid']])){agents[_0x25a175['transfereruniqueid']][_0x4f68('0x31')]=!![];agents[_0x25a175[_0x4f68('0x32')]]['transfertype']=_0x4f68('0x33');agents[_0x25a175[_0x4f68('0x32')]]['transferexten']=_0x25a175[_0x4f68('0x34')];agents[_0x25a175['transfereruniqueid']][_0x4f68('0x35')]=agents[_0x25a175[_0x4f68('0x32')]][_0x4f68('0x4')];}}catch(_0x5e5f67){utils['error'](_0x5e5f67[_0x4f68('0x1a')]);}};exports[_0x4f68('0x36')]=function(_0x27ad16){try{if(_0x27ad16[_0x4f68('0x37')]==_0x27ad16[_0x4f68('0x38')]){if(!_[_0x4f68('0x1c')](agents[_0x27ad16['secondtransfereruniqueid']])){agents[_0x27ad16[_0x4f68('0x39')]]['transfer']=!![];agents[_0x27ad16[_0x4f68('0x39')]]['transfertype']=_0x4f68('0x3a');agents[_0x27ad16[_0x4f68('0x39')]][_0x4f68('0x3b')]=_0x27ad16['origtransfererexten'];agents[_0x27ad16[_0x4f68('0x39')]][_0x4f68('0x35')]=_0x27ad16[_0x4f68('0x37')];}if(_0x27ad16[_0x4f68('0x3c')]&&agents[_0x27ad16[_0x4f68('0x3c')]]){agents[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x3d')]=0x1;transfers[_0x27ad16[_0x4f68('0x3c')]]=_[_0x4f68('0x3e')](agents[_0x27ad16['transfereeuniqueid']]);transfers[_0x27ad16[_0x4f68('0x3c')]]['calleridnum']=agents[_0x27ad16['secondtransfereruniqueid']][_0x4f68('0x3f')];transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x40')]=agents[_0x27ad16[_0x4f68('0x39')]][_0x4f68('0x40')];transfers[_0x27ad16['transfereeuniqueid']]['agentcalledAt']=utils[_0x4f68('0x16')]();transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x28')]=utils[_0x4f68('0x16')]();transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x20')]=0x0;transfers[_0x27ad16[_0x4f68('0x3c')]][_0x4f68('0x3d')]=0x2;}}else if(_0x27ad16[_0x4f68('0x39')]==_0x27ad16['secondtransfererlinkedid']){if(!_[_0x4f68('0x1c')](agents[_0x27ad16[_0x4f68('0x37')]])){agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x31')]=!![];agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x41')]=_0x4f68('0x3a');agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x3b')]=_0x27ad16[_0x4f68('0x42')];agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x35')]=_0x27ad16['secondtransfereruniqueid'];}if(_0x27ad16[_0x4f68('0x43')]&&agents[_0x27ad16['transfertargetuniqueid']]){agents[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x3d')]=0x1;transfers[_0x27ad16['transfertargetuniqueid']]=_[_0x4f68('0x3e')](agents[_0x27ad16[_0x4f68('0x43')]]);transfers[_0x27ad16[_0x4f68('0x43')]]['calleridnum']=agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x3f')];transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x40')]=agents[_0x27ad16[_0x4f68('0x37')]][_0x4f68('0x40')];transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x15')]=utils[_0x4f68('0x16')]();transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x28')]=utils[_0x4f68('0x16')]();transfers[_0x27ad16[_0x4f68('0x43')]][_0x4f68('0x20')]=0x0;transfers[_0x27ad16['transfertargetuniqueid']][_0x4f68('0x3d')]=0x2;}}}catch(_0x5563d2){utils[_0x4f68('0x19')](_0x5563d2[_0x4f68('0x1a')]);}};exports[_0x4f68('0x44')]=function(_0x21eedf){try{if(agents[_0x21eedf[_0x4f68('0x4')]]&&agents[_0x21eedf['uniqueid']][_0x4f68('0x1f')]===_0x4f68('0x1e')){if(_0x21eedf[_0x4f68('0x45')]==='21'){agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x1f')]='rejected';agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x9')]=_0x4f68('0x46');}writeDB(agents[_0x21eedf['uniqueid']]);var _0x17ac6a=unanswered[_0x4f68('0x47')](_0x21eedf['uniqueid']);if(_0x17ac6a>-0x1)unanswered[_0x4f68('0x48')](_0x17ac6a,0x1);}if(transfers[_0x21eedf[_0x4f68('0x4')]]){transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0xe')]=!![];transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x2d')]=utils[_0x4f68('0x16')]();transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x22')]=utils[_0x4f68('0x2e')](transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x2d')],transfers[_0x21eedf['uniqueid']][_0x4f68('0x28')]);transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x1f')]=_0x4f68('0x49');transfers[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x9')]=_0x4f68('0x2f');writeDB(transfers[_0x21eedf[_0x4f68('0x4')]],!![]);}if(agents[_0x21eedf['uniqueid']]&&agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x28')]){agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0xe')]=!![];agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x2d')]=utils['now']();agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x22')]=utils['diffTime'](agents[_0x21eedf['uniqueid']][_0x4f68('0x2d')],agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x28')]);agents[_0x21eedf['uniqueid']][_0x4f68('0x1f')]=agents[_0x21eedf[_0x4f68('0x4')]][_0x4f68('0x31')]?_0x4f68('0x31'):'agent';agents[_0x21eedf['uniqueid']]['lastevent']=_0x4f68('0x2f');writeDB(agents[_0x21eedf[_0x4f68('0x4')]]);}}catch(_0x420555){utils[_0x4f68('0x19')](_0x420555[_0x4f68('0x1a')]);}};
\ No newline at end of file
+var _0x2bc6=['lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum'];(function(_0x1bc33e,_0x1f6479){var _0x2ebee8=function(_0x50c6c2){while(--_0x50c6c2){_0x1bc33e['push'](_0x1bc33e['shift']());}};_0x2ebee8(++_0x1f6479);}(_0x2bc6,0x163));var _0x62bc=function(_0x3bd608,_0x4983d3){_0x3bd608=_0x3bd608-0x0;var _0x538339=_0x2bc6[_0x3bd608];return _0x538339;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var utils=require(_0x62bc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x56939b,_0x4b4e73){utils['info'](util['format'](_0x62bc('0x3'),_0x56939b['uniqueid'],_0x56939b[_0x62bc('0x4')],_0x56939b[_0x62bc('0x5')],_0x56939b['membername'],_0x56939b[_0x62bc('0x6')],_0x56939b[_0x62bc('0x7')],_0x56939b[_0x62bc('0x8')],_0x56939b[_0x62bc('0x9')]));if(_0x56939b[_0x62bc('0x5')]){utils[_0x62bc('0xa')](_0x56939b['queue'])[_0x62bc('0xb')](function(_0x762c71){if(_0x762c71){_0x56939b[_0x62bc('0xc')]=_0x762c71[_0x62bc('0xc')];_0x56939b['agentacw']=_0x56939b[_0x62bc('0xd')]?_0x762c71[_0x62bc('0xe')]:![];_0x56939b[_0x62bc('0xf')]=_0x56939b['agentacw']?_0x762c71[_0x62bc('0x10')]:0x0;}utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);});}else{utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);}if(_0x4b4e73){delete transfers[_0x56939b[_0x62bc('0x13')]];}else{delete agents[_0x56939b[_0x62bc('0x14')]];}}exports['agentcalled']=function(_0x2a96ae){try{utils[_0x62bc('0x15')](util['format'](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x2a96ae);agents[_0x2a96ae[_0x62bc('0x14')]]=_0x2a96ae;agents[_0x2a96ae['destuniqueid']][_0x62bc('0x17')]=utils[_0x62bc('0x18')]();agents[_0x2a96ae['destuniqueid']]['lastevent']=_0x62bc('0x19');agents[_0x2a96ae[_0x62bc('0x14')]]['connectedlinenum']=null;agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1a')]=null;utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1d'),_0x2a96ae[_0x62bc('0x13')],agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x2a96ae[_0x62bc('0x14')]));}catch(_0x5ed51c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x5ed51c);}};exports['agentringnoanswer']=function(_0x380621){try{if(!_['isNil'](agents[_0x380621[_0x62bc('0x14')]])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')]('[%s][agents][agentringnoanswer]',_0x380621[_0x62bc('0x13')]),_0x380621);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1f'),_0x380621[_0x62bc('0x13')],agents[_0x380621[_0x62bc('0x14')]]['membername'],_0x380621[_0x62bc('0x14')]));agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x20')]=!![];agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x21')]=utils['now']();agents[_0x380621['destuniqueid']][_0x62bc('0x9')]='timeout';agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x22')]=_0x62bc('0x23');agents[_0x380621['destuniqueid']][_0x62bc('0x24')]=_0x380621[_0x62bc('0x25')]?parseInt(_0x380621[_0x62bc('0x25')])/0x3e8:0x0;agents[_0x380621['destuniqueid']]['talktime']=0x0;unanswered[_0x62bc('0x26')](_0x380621[_0x62bc('0x14')]);}}catch(_0x23817c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x27'),_0x380621[_0x62bc('0x13')]),_0x23817c);}};exports[_0x62bc('0x28')]=function(_0x5a9302){try{_[_0x62bc('0x29')](agents,function(_0x5e4491,_0x26701b){if(_0x5e4491[_0x62bc('0x13')]==_0x5a9302[_0x62bc('0x13')]&&!_[_0x62bc('0x2a')](unanswered,_0x5e4491[_0x62bc('0x14')])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x2b'),_0x5a9302[_0x62bc('0x13')]),_0x5a9302);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x2c'),_0x5a9302[_0x62bc('0x13')],_0x5e4491[_0x62bc('0x1e')],_0x5e4491[_0x62bc('0x14')]));_0x5e4491[_0x62bc('0x20')]=!![];_0x5e4491[_0x62bc('0x21')]=utils['now']();_0x5e4491[_0x62bc('0x9')]='abandoned';_0x5e4491['reason']=_0x62bc('0x2d');_0x5e4491['holdtime']=_0x5a9302['holdtime'];_0x5e4491['talktime']=0x0;writeDB(_0x5e4491);}});}catch(_0x3f22c1){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][queuecallerabandon]',_0x5a9302['uniqueid']),_0x3f22c1);}};exports['agentconnect']=function(_0x3c938d){try{if(agents[_0x3c938d[_0x62bc('0x14')]]){utils['debug'](util['format'](_0x62bc('0x2f'),_0x3c938d[_0x62bc('0x13')]),_0x3c938d);utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x30'),_0x3c938d[_0x62bc('0x13')],agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x3c938d['destuniqueid']));agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x31')]=utils['now']();agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x8')]=_0x3c938d[_0x62bc('0x8')];agents[_0x3c938d[_0x62bc('0x14')]]['connectedlinename']=_0x3c938d[_0x62bc('0x1a')];agents[_0x3c938d['destuniqueid']][_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x9')]='connect';_[_0x62bc('0x29')](agents,function(_0x5c806b,_0x392550){if(_0x5c806b[_0x62bc('0x14')]!=_0x3c938d[_0x62bc('0x14')]&&_0x5c806b[_0x62bc('0x13')]==_0x3c938d[_0x62bc('0x13')]){_0x5c806b[_0x62bc('0x32')]=0x0;_0x5c806b[_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];_0x5c806b[_0x62bc('0x20')]=!![];_0x5c806b['agentringnoanswerAt']=utils['now']();_0x5c806b[_0x62bc('0x9')]=_0x62bc('0x33');_0x5c806b['reason']=_0x62bc('0x33');_0x5c806b[_0x62bc('0x34')]=_0x3c938d[_0x62bc('0x14')];_0x5c806b[_0x62bc('0x35')]=_0x3c938d[_0x62bc('0x1e')];writeDB(_0x5c806b);}});}}catch(_0x5f3752){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][agentconnect]',_0x3c938d['uniqueid']),_0x5f3752);}};exports[_0x62bc('0xd')]=function(_0xdbd9ee){try{if(!_[_0x62bc('0x36')](agents[_0xdbd9ee['destuniqueid']])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0xdbd9ee);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xdbd9ee[_0x62bc('0x13')],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x1e')],_0xdbd9ee[_0x62bc('0x14')]));agents[_0xdbd9ee[_0x62bc('0x14')]]['agentcomplete']=!![];agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt']=utils[_0x62bc('0x18')]();agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt'],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x31')]);agents[_0xdbd9ee[_0x62bc('0x14')]][_0x62bc('0x22')]=_0xdbd9ee[_0x62bc('0x22')];agents[_0xdbd9ee[_0x62bc('0x14')]]['lastevent']=_0x62bc('0x39');writeDB(agents[_0xdbd9ee[_0x62bc('0x14')]]);}}catch(_0x4859fc){utils[_0x62bc('0x2e')](util['format'](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0x4859fc);}};exports[_0x62bc('0x3a')]=function(_0xca6190){try{if(!_[_0x62bc('0x36')](agents[_0xca6190[_0x62bc('0x3b')]])){utils[_0x62bc('0x15')](util['format'](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0xca6190);utils['info'](util[_0x62bc('0x1c')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0xca6190[_0x62bc('0x13')],agents[_0xca6190[_0x62bc('0x3b')]]['membername'],agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')]));agents[_0xca6190[_0x62bc('0x3b')]]['transfer']=!![];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3d')]=_0x62bc('0x3e');agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3f')]=_0xca6190[_0x62bc('0x40')];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x41')]=agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')];}}catch(_0x44d2a2){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0x44d2a2);}};exports[_0x62bc('0x42')]=function(_0x5b0e9b){try{utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x5b0e9b);if(_0x5b0e9b[_0x62bc('0x44')]==_0x5b0e9b[_0x62bc('0x45')]){if(!_[_0x62bc('0x36')](agents[_0x5b0e9b[_0x62bc('0x46')]])){utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x47'),_0x5b0e9b[_0x62bc('0x44')],agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x1e')]));agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3f')]=_0x5b0e9b[_0x62bc('0x4a')];agents[_0x5b0e9b[_0x62bc('0x46')]]['transferuniqueid']=_0x5b0e9b['origtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x4b')]&&agents[_0x5b0e9b[_0x62bc('0x4b')]]){agents[_0x5b0e9b[_0x62bc('0x4b')]]['agententerreason']=0x1;transfers[_0x5b0e9b[_0x62bc('0x4b')]]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x4b')]]);transfers[_0x5b0e9b[_0x62bc('0x4b')]]['calleridnum']=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x7')];transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4d')]=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x4b')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b['transfereeuniqueid']][_0x62bc('0x24')]=0x0;transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4e')]=0x2;}}else if(_0x5b0e9b['secondtransfereruniqueid']==_0x5b0e9b[_0x62bc('0x4f')]){if(!_['isNil'](agents[_0x5b0e9b[_0x62bc('0x44')]])){utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x47'),_0x5b0e9b['origtransfereruniqueid'],agents[_0x5b0e9b[_0x62bc('0x44')]]['membername']));agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x44')]]['transferexten']=_0x5b0e9b[_0x62bc('0x50')];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x41')]=_0x5b0e9b['secondtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x51')]&&agents[_0x5b0e9b[_0x62bc('0x51')]]){agents[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x1;transfers[_0x5b0e9b['transfertargetuniqueid']]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x51')]]);transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x7')]=agents[_0x5b0e9b[_0x62bc('0x44')]]['calleridnum'];transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x4d')]=agents[_0x5b0e9b['origtransfereruniqueid']][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x51')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b[_0x62bc('0x51')]]['holdtime']=0x0;transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x2;}}}catch(_0x6bb64b){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x6bb64b);}};exports[_0x62bc('0x52')]=function(_0x177fba){try{utils['debug'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba[_0x62bc('0x13')]),_0x177fba);if(agents[_0x177fba[_0x62bc('0x13')]]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]===_0x62bc('0x23')){if(_0x177fba[_0x62bc('0x54')]==='21'){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]=_0x62bc('0x55');agents[_0x177fba['uniqueid']][_0x62bc('0x9')]=_0x62bc('0x55');}utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);var _0x5698a4=unanswered[_0x62bc('0x56')](_0x177fba[_0x62bc('0x13')]);if(_0x5698a4>-0x1){unanswered[_0x62bc('0x57')](_0x5698a4,0x1);}}if(transfers[_0x177fba[_0x62bc('0x13')]]){transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](transfers[_0x177fba['uniqueid']][_0x62bc('0x58')],transfers[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);transfers[_0x177fba[_0x62bc('0x13')]]['reason']=_0x62bc('0x59');transfers[_0x177fba[_0x62bc('0x13')]]['lastevent']=_0x62bc('0x39');utils['info'](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],transfers[_0x177fba['uniqueid']][_0x62bc('0x1e')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(transfers[_0x177fba[_0x62bc('0x13')]],!![]);}if(agents[_0x177fba['uniqueid']]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x31')]){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')],agents[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);agents[_0x177fba['uniqueid']]['reason']=agents[_0x177fba[_0x62bc('0x13')]]['transfer']?_0x62bc('0x48'):_0x62bc('0x59');agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]=_0x62bc('0x39');utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x5a'),_0x177fba['uniqueid'],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]]['reason'],agents[_0x177fba[_0x62bc('0x13')]]['lastevent']));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);}}catch(_0x3aa295){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba['uniqueid']),_0x3aa295);}};
\ No newline at end of file