Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / services / ami / acw / index.js
index 3af1d09..7435aa3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac9d=['name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[TIMER][STOP][AGENT:%s]','catch','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x8ada9f,_0x11139a){var _0x296518=function(_0x2429bc){while(--_0x2429bc){_0x8ada9f['push'](_0x8ada9f['shift']());}};_0x296518(++_0x11139a);}(_0xac9d,0x14d));var _0xdac9=function(_0xf8ef4a,_0x34a9d5){_0xf8ef4a=_0xf8ef4a-0x0;var _0x1869c9=_0xac9d[_0xf8ef4a];return _0x1869c9;};'use strict';var util=require(_0xdac9('0x0'));var _=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var ami=require(_0xdac9('0x3'));var logger=require(_0xdac9('0x4'))(_0xdac9('0x5'));var RpcUser=require(_0xdac9('0x6'));var RpcVoiceAgentReport=require(_0xdac9('0x7'));function Acw(_0x51a5d7){this[_0xdac9('0x8')]=_0x51a5d7['voiceQueues'];this[_0xdac9('0x9')]=_0x51a5d7[_0xdac9('0x9')];this[_0xdac9('0xa')]=_0x51a5d7[_0xdac9('0xa')];this[_0xdac9('0xb')]={};ami['on'](_0xdac9('0xc'),this['syncAgentConnect'][_0xdac9('0xd')](this));ami['on']('hanguprequest',this[_0xdac9('0xe')][_0xdac9('0xd')](this));ami['on'](_0xdac9('0xf'),this[_0xdac9('0x10')][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x11'),this[_0xdac9('0x12')][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x13'),this['syncAttendedTransfer'][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x14'),this['syncBlindTransfer'][_0xdac9('0xd')](this));ami['on'](_0xdac9('0x15'),this[_0xdac9('0x16')]['bind'](this));}function getDiff(_0x16063f){var _0x33ba20=moment()[_0xdac9('0x17')](0x0);var _0x5f0bbd=moment(_0x16063f)['milliseconds'](0x0);return _0x33ba20[_0xdac9('0x18')](_0x5f0bbd,_0xdac9('0x19'));}Acw['prototype'][_0xdac9('0x1a')]=function(_0x36cbe4){try{var _0x152ea5=this;var _0x5b2f1b=this[_0xdac9('0xb')][_0x36cbe4][_0xdac9('0x1b')];var _0x34a85a=this[_0xdac9('0xb')][_0x36cbe4]['queue'];var _0x283343=this[_0xdac9('0x8')][_0x34a85a];var _0x571e07=![];var _0x1cd239=_0xdac9('0x1c');if(_0x283343[_0xdac9('0x1d')]){if(_0x283343[_0xdac9('0x1e')]['name']){_0x571e07=!![];_0x1cd239=_0x283343['mandatoryDispositionPause'][_0xdac9('0x1f')];}}ami[_0xdac9('0x20')]({'action':_0xdac9('0x21'),'interface':_0x5b2f1b,'paused':!![],'reason':_0x1cd239})[_0xdac9('0x22')](function(_0x52fb18){if(_0x152ea5[_0xdac9('0x9')][_0x5b2f1b]){return RpcUser[_0xdac9('0x23')](_0x152ea5[_0xdac9('0x9')][_0x5b2f1b]['id'])[_0xdac9('0x22')](function(_0xe7bd10){if(_0xe7bd10&&!_0xe7bd10[_0xdac9('0x24')]){logger[_0xdac9('0x25')](_0xdac9('0x26'),_0x36cbe4,_0x5b2f1b,_0x34a85a);var _0x419f0c=_0x152ea5[_0xdac9('0xb')][_0x36cbe4]['attended']&&_0x152ea5[_0xdac9('0xb')][_0x36cbe4][_0xdac9('0x27')]?_0x152ea5[_0xdac9('0xb')][_0x36cbe4][_0xdac9('0x27')]:_0x36cbe4;return RpcUser['savePause'](_0x152ea5[_0xdac9('0x9')][_0x5b2f1b],_0x1cd239,_0x419f0c)['then'](function(_0x3ce475){if(!_0x571e07){_0x152ea5[_0xdac9('0xa')][_0x5b2f1b]={};logger['info'](_0xdac9('0x28'),_0x36cbe4,_0x152ea5['voiceQueues'][_0x34a85a][_0xdac9('0x29')],_0x5b2f1b,_0x34a85a);_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2a')]=setTimeout(_0x152ea5[_0xdac9('0x2b')]['bind'](_0x152ea5,_0x5b2f1b),_0x152ea5['voiceQueues'][_0x34a85a][_0xdac9('0x29')]*0x3e8);_0x152ea5[_0xdac9('0xa')][_0x5b2f1b]['lastPauseAt']=moment()['format'](_0xdac9('0x2c'));_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2d')]=_0x36cbe4;_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2e')]=_0x34a85a;_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2f')]=function(){var _0x2cda4d=getDiff(_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x30')]);clearTimeout(_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2a')]);_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2a')]=![];RpcVoiceAgentReport[_0xdac9('0x31')]({'acwtime':_0x2cda4d},_0x152ea5[_0xdac9('0xa')][_0x5b2f1b][_0xdac9('0x2d')],_0x5b2f1b)[_0xdac9('0x22')](function(_0x339f31){logger[_0xdac9('0x25')](_0xdac9('0x32'),_0x36cbe4,_0x2cda4d,_0x339f31);})['catch'](function(_0x5e7ebe){logger[_0xdac9('0x33')](_0xdac9('0x34'),_0x36cbe4,_0x5e7ebe);});delete _0x152ea5[_0xdac9('0xa')][_0x5b2f1b];};}});}else{logger[_0xdac9('0x25')](_0xdac9('0x35'),_0x36cbe4,_0x5b2f1b,_0x34a85a);}});}})['catch'](function(_0x1d125a){logger['error'](_0xdac9('0x28'),_0x36cbe4,_0x152ea5[_0xdac9('0x8')][_0x34a85a]['acwTimeout'],_0x5b2f1b,_0x34a85a);})[_0xdac9('0x36')](function(){delete _0x152ea5['channels'][_0x36cbe4];});}catch(_0x52d758){logger[_0xdac9('0x33')](_0xdac9('0x37'),_0x52d758[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x2b')]=function(_0x363d93){try{var _0x51cde6=this;if(_0x51cde6[_0xdac9('0xa')][_0x363d93]){_0x51cde6[_0xdac9('0xa')][_0x363d93]['timer']=![];var _0x244d1f=_0x51cde6[_0xdac9('0xa')][_0x363d93][_0xdac9('0x2d')];var _0x27bdfb=_0x51cde6[_0xdac9('0xa')][_0x363d93][_0xdac9('0x2e')];var _0x3ac9ae=_0x51cde6['voiceQueues'][_0x27bdfb][_0xdac9('0x29')];logger[_0xdac9('0x25')](_0xdac9('0x3a'),_0x363d93);RpcUser['saveUnpause'](this[_0xdac9('0x9')][_0x363d93]);RpcVoiceAgentReport[_0xdac9('0x31')]({'acwtime':_0x3ac9ae,'agentacw':!![]},_0x244d1f,_0x363d93)[_0xdac9('0x22')](function(_0x1d6f88){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x244d1f,_0x3ac9ae,_0x1d6f88);})[_0xdac9('0x3b')](function(_0xe47a3c){logger[_0xdac9('0x33')](_0xdac9('0x34'),_0x244d1f,_0xe47a3c);});}else{logger[_0xdac9('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x363d93);if(_0x51cde6[_0xdac9('0xa')]){logger['info'](_0xdac9('0x3c'),JSON[_0xdac9('0x3d')](_0x51cde6[_0xdac9('0xa')]));}}}catch(_0x1898e1){logger[_0xdac9('0x33')](_0xdac9('0x3e'),_0x1898e1[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x3f')]=function(_0x8a0538){try{if(this[_0xdac9('0x8')][_0x8a0538[_0xdac9('0x2e')]]&&(this[_0xdac9('0x8')][_0x8a0538[_0xdac9('0x2e')]]['acw']||this[_0xdac9('0x8')][_0x8a0538[_0xdac9('0x2e')]]['mandatoryDisposition'])){if(this[_0xdac9('0x9')][_0x8a0538[_0xdac9('0x1b')]]){this[_0xdac9('0xb')][_0x8a0538[_0xdac9('0x2d')]]={'queue':_0x8a0538[_0xdac9('0x2e')],'interface':_0x8a0538[_0xdac9('0x1b')],'destlinkedid':_0x8a0538['destlinkedid']};}}}catch(_0x1c3f15){logger['error'](_0xdac9('0x40'),_0x1c3f15[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x16')]=function(_0x5e61ac){try{if(this['voiceQueues'][_0x5e61ac['queue']]&&(this[_0xdac9('0x8')][_0x5e61ac['queue']]['acw']||this[_0xdac9('0x8')][_0x5e61ac[_0xdac9('0x2e')]]['mandatoryDisposition'])){if(this['agents'][_0x5e61ac[_0xdac9('0x1b')]]){this[_0xdac9('0xb')][_0x5e61ac[_0xdac9('0x2d')]]={'queue':_0x5e61ac[_0xdac9('0x2e')],'interface':_0x5e61ac[_0xdac9('0x1b')]};}}}catch(_0x2e07bc){logger[_0xdac9('0x33')](_0xdac9('0x41'),_0x2e07bc['message']);}};Acw[_0xdac9('0x39')][_0xdac9('0xe')]=function(_0xfa104f){try{if(this[_0xdac9('0xb')][_0xfa104f[_0xdac9('0x2d')]]&&_[_0xdac9('0x42')](this[_0xdac9('0xb')][_0xfa104f[_0xdac9('0x2d')]][_0xdac9('0x43')])){logger[_0xdac9('0x25')](_0xdac9('0x44'),_0xfa104f[_0xdac9('0x2d')]);this[_0xdac9('0x1a')](_0xfa104f[_0xdac9('0x2d')]);}else if(this['channels'][_0xfa104f['linkedid']]&&_['isUndefined'](this[_0xdac9('0xb')][_0xfa104f[_0xdac9('0x45')]]['attended'])){logger[_0xdac9('0x25')](_0xdac9('0x46'),_0xfa104f[_0xdac9('0x45')]);this['startAcw'](_0xfa104f[_0xdac9('0x45')]);}}catch(_0x9f6e4){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x9f6e4[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x10')]=function(_0x370532){try{if(this[_0xdac9('0xb')][_0x370532[_0xdac9('0x2d')]]&&this[_0xdac9('0xb')][_0x370532[_0xdac9('0x2d')]][_0xdac9('0x43')]){logger[_0xdac9('0x25')](_0xdac9('0x47'),_0x370532[_0xdac9('0x2d')]);this[_0xdac9('0x1a')](_0x370532[_0xdac9('0x2d')]);}else if(this[_0xdac9('0xb')][_0x370532['linkedid']]&&this[_0xdac9('0xb')][_0x370532[_0xdac9('0x45')]][_0xdac9('0x43')]){logger[_0xdac9('0x25')](_0xdac9('0x48'),_0x370532[_0xdac9('0x45')]);this['startAcw'](_0x370532[_0xdac9('0x45')]);}}catch(_0x401ab6){logger[_0xdac9('0x33')](_0xdac9('0x49'),_0x401ab6[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x4a')]=function(_0x243862){try{if(!_[_0xdac9('0x4b')](this['channels'][_0x243862[_0xdac9('0x4c')]])){this[_0xdac9('0x1a')](_0x243862[_0xdac9('0x4c')]);if(this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4d')]]){this[_0xdac9('0xb')][_0x243862['secondtransfereruniqueid']]['attended']=!![];this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4e')]]=this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4d')]];delete this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4d')]];}}else if(!_['isNil'](this['channels'][_0x243862['transfertargetuniqueid']])){this[_0xdac9('0x1a')](_0x243862[_0xdac9('0x4e')]);if(this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4f')]]){this['channels'][_0x243862[_0xdac9('0x4f')]][_0xdac9('0x43')]=!![];this[_0xdac9('0xb')][_0x243862[_0xdac9('0x4c')]]=this[_0xdac9('0xb')][_0x243862['origtransfereruniqueid']];delete this[_0xdac9('0xb')][_0x243862['origtransfereruniqueid']];}}}catch(_0x60b64e){logger['error'](_0xdac9('0x50'),_0x60b64e[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x51')]=function(_0x303008){try{if(this[_0xdac9('0xb')][_0x303008[_0xdac9('0x52')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x303008[_0xdac9('0x52')]));this[_0xdac9('0x1a')](_0x303008[_0xdac9('0x52')]);}else if(this[_0xdac9('0xb')][_0x303008[_0xdac9('0x53')]]){logger[_0xdac9('0x25')](_0xdac9('0x54'),JSON['stringify'](_0x303008[_0xdac9('0x53')]));this['startAcw'](_0x303008['transfererlinkedid']);}}catch(_0x461c96){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x461c96[_0xdac9('0x38')]);}};Acw[_0xdac9('0x39')][_0xdac9('0x12')]=function(_0x55ce14){try{if(this['voiceQueues'][_0x55ce14[_0xdac9('0x2e')]]&&this[_0xdac9('0x8')][_0x55ce14['queue']][_0xdac9('0x55')]===_0xdac9('0x56')){if(this[_0xdac9('0x9')][_0x55ce14[_0xdac9('0x1b')]]){logger[_0xdac9('0x25')](_0xdac9('0x57'),_0x55ce14[_0xdac9('0x2d')],_0x55ce14[_0xdac9('0x1b')],_0x55ce14[_0xdac9('0x2e')]);return RpcUser[_0xdac9('0x58')](this[_0xdac9('0x9')][_0x55ce14[_0xdac9('0x1b')]],'Auto-Pause',_0x55ce14[_0xdac9('0x2d')]);}}}catch(_0x4df310){logger[_0xdac9('0x33')](_0xdac9('0x59'),_0x4df310['message']);}};module[_0xdac9('0x5a')]=Acw;
\ No newline at end of file
+var _0x9842=['transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','blindtransfer','milliseconds','diff','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','info','destlinkedid','timer','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x3cc765,_0x59490a){var _0x12da47=function(_0x17cefe){while(--_0x17cefe){_0x3cc765['push'](_0x3cc765['shift']());}};_0x12da47(++_0x59490a);}(_0x9842,0x1a5));var _0x2984=function(_0x1f1cd4,_0x4a52c9){_0x1f1cd4=_0x1f1cd4-0x0;var _0x2c4bac=_0x9842[_0x1f1cd4];return _0x2c4bac;};'use strict';var util=require(_0x2984('0x0'));var _=require(_0x2984('0x1'));var moment=require('moment');var ami=require(_0x2984('0x2'));var logger=require(_0x2984('0x3'))('acw');var RpcUser=require(_0x2984('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x24db76){this[_0x2984('0x5')]=_0x24db76['voiceQueues'];this[_0x2984('0x6')]=_0x24db76[_0x2984('0x6')];this['timers']=_0x24db76[_0x2984('0x7')];this[_0x2984('0x8')]={};ami['on'](_0x2984('0x9'),this[_0x2984('0xa')][_0x2984('0xb')](this));ami['on'](_0x2984('0xc'),this[_0x2984('0xd')][_0x2984('0xb')](this));ami['on'](_0x2984('0xe'),this['syncHangup']['bind'](this));ami['on'](_0x2984('0xf'),this['syncAgentRingNoAnswer'][_0x2984('0xb')](this));ami['on'](_0x2984('0x10'),this['syncAttendedTransfer'][_0x2984('0xb')](this));ami['on'](_0x2984('0x11'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x2984('0xb')](this));}function getDiff(_0x305090){var _0x173c60=moment()[_0x2984('0x12')](0x0);var _0x25b554=moment(_0x305090)[_0x2984('0x12')](0x0);return _0x173c60[_0x2984('0x13')](_0x25b554,'seconds');}Acw[_0x2984('0x14')][_0x2984('0x15')]=function(_0x419718){try{var _0xaf7aa=this;var _0x17a0b7=this[_0x2984('0x8')][_0x419718][_0x2984('0x16')];var _0x140caa=this[_0x2984('0x8')][_0x419718][_0x2984('0x17')];var _0x1d78dc=this[_0x2984('0x5')][_0x140caa];var _0x65bef9=![];var _0x571ad1=_0x2984('0x18');if(_0x1d78dc[_0x2984('0x19')]){if(_0x1d78dc[_0x2984('0x1a')]['name']){_0x65bef9=!![];_0x571ad1=_0x1d78dc['mandatoryDispositionPause'][_0x2984('0x1b')];}}ami['Action']({'action':_0x2984('0x1c'),'interface':_0x17a0b7,'paused':!![],'reason':_0x571ad1})[_0x2984('0x1d')](function(_0x4721a5){if(_0xaf7aa[_0x2984('0x6')][_0x17a0b7]){return RpcUser['getAgent'](_0xaf7aa[_0x2984('0x6')][_0x17a0b7]['id'])[_0x2984('0x1d')](function(_0x55b1f6){if(_0x55b1f6&&!_0x55b1f6[_0x2984('0x1e')]){logger[_0x2984('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x419718,_0x17a0b7,_0x140caa);var _0xe6944e=_0xaf7aa[_0x2984('0x8')][_0x419718]['attended']&&_0xaf7aa['channels'][_0x419718][_0x2984('0x20')]?_0xaf7aa[_0x2984('0x8')][_0x419718][_0x2984('0x20')]:_0x419718;return RpcUser['savePause'](_0xaf7aa[_0x2984('0x6')][_0x17a0b7],_0x571ad1,_0xe6944e)['then'](function(_0x7e5bb7){if(!_0x65bef9){_0xaf7aa[_0x2984('0x7')][_0x17a0b7]={};logger[_0x2984('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x419718,_0xaf7aa[_0x2984('0x5')][_0x140caa]['acwTimeout'],_0x17a0b7,_0x140caa);_0xaf7aa[_0x2984('0x7')][_0x17a0b7][_0x2984('0x21')]=setTimeout(_0xaf7aa[_0x2984('0x22')][_0x2984('0xb')](_0xaf7aa,_0x17a0b7),_0xaf7aa[_0x2984('0x5')][_0x140caa][_0x2984('0x23')]*0x3e8);_0xaf7aa['timers'][_0x17a0b7][_0x2984('0x24')]=moment()['format'](_0x2984('0x25'));_0xaf7aa[_0x2984('0x7')][_0x17a0b7][_0x2984('0x26')]=_0x419718;_0xaf7aa['timers'][_0x17a0b7][_0x2984('0x17')]=_0x140caa;_0xaf7aa[_0x2984('0x7')][_0x17a0b7][_0x2984('0x27')]=function(){var _0x4cd0bb=getDiff(_0xaf7aa['timers'][_0x17a0b7]['lastPauseAt']);clearTimeout(_0xaf7aa[_0x2984('0x7')][_0x17a0b7][_0x2984('0x21')]);_0xaf7aa['timers'][_0x17a0b7][_0x2984('0x21')]=![];RpcVoiceAgentReport[_0x2984('0x28')]({'acwtime':_0x4cd0bb},_0xaf7aa[_0x2984('0x7')][_0x17a0b7][_0x2984('0x26')],_0x17a0b7)[_0x2984('0x1d')](function(_0x372329){logger[_0x2984('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x419718,_0x4cd0bb,_0x372329);})[_0x2984('0x29')](function(_0x1808c4){logger[_0x2984('0x2a')](_0x2984('0x2b'),_0x419718,_0x1808c4);});delete _0xaf7aa[_0x2984('0x7')][_0x17a0b7];};}});}else{logger[_0x2984('0x1f')](_0x2984('0x2c'),_0x419718,_0x17a0b7,_0x140caa);}});}})[_0x2984('0x29')](function(_0x32ef89){logger[_0x2984('0x2a')](_0x2984('0x2d'),_0x419718,_0xaf7aa[_0x2984('0x5')][_0x140caa][_0x2984('0x23')],_0x17a0b7,_0x140caa);})[_0x2984('0x2e')](function(){delete _0xaf7aa['channels'][_0x419718];});}catch(_0x233142){logger[_0x2984('0x2a')]('[ACW][START]\x20%s',_0x233142[_0x2984('0x2f')]);}};Acw[_0x2984('0x14')]['stopAcw']=function(_0x10e345){try{var _0x1bc1a9=this;if(_0x1bc1a9['timers'][_0x10e345]){_0x1bc1a9[_0x2984('0x7')][_0x10e345][_0x2984('0x21')]=![];var _0x474496=_0x1bc1a9['timers'][_0x10e345][_0x2984('0x26')];var _0x257c92=_0x1bc1a9[_0x2984('0x7')][_0x10e345][_0x2984('0x17')];var _0x377aef=_0x1bc1a9[_0x2984('0x5')][_0x257c92][_0x2984('0x23')];logger['info'](_0x2984('0x30'),_0x474496,_0x10e345);RpcUser[_0x2984('0x31')](this[_0x2984('0x6')][_0x10e345]);RpcVoiceAgentReport[_0x2984('0x28')]({'acwtime':_0x377aef,'agentacw':!![]},_0x474496,_0x10e345)[_0x2984('0x1d')](function(_0x303e6d){logger[_0x2984('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x474496,_0x377aef,_0x303e6d);})['catch'](function(_0x1a243b){logger[_0x2984('0x2a')](_0x2984('0x2b'),_0x474496,_0x1a243b);});}else{logger[_0x2984('0x2a')](_0x2984('0x32'),_0x10e345);if(_0x1bc1a9['timers']){logger['info'](_0x2984('0x33'),JSON['stringify'](_0x1bc1a9['timers']));}}}catch(_0x2e87d3){logger['error'](_0x2984('0x34'),_0x2e87d3[_0x2984('0x2f')]);}};Acw[_0x2984('0x14')][_0x2984('0xa')]=function(_0x10b8c1){try{if(this[_0x2984('0x5')][_0x10b8c1['queue']]&&(this[_0x2984('0x5')][_0x10b8c1[_0x2984('0x17')]][_0x2984('0x35')]||this[_0x2984('0x5')][_0x10b8c1[_0x2984('0x17')]]['mandatoryDisposition'])){if(this['agents'][_0x10b8c1[_0x2984('0x16')]]){this[_0x2984('0x8')][_0x10b8c1['uniqueid']]={'queue':_0x10b8c1['queue'],'interface':_0x10b8c1[_0x2984('0x16')],'destlinkedid':_0x10b8c1['destlinkedid']};}}}catch(_0x1a3c83){logger[_0x2984('0x2a')]('[ACW][syncAgentConnect]\x20%s',_0x1a3c83['message']);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x4e0b76){try{if(this[_0x2984('0x5')][_0x4e0b76[_0x2984('0x17')]]&&(this['voiceQueues'][_0x4e0b76[_0x2984('0x17')]]['acw']||this['voiceQueues'][_0x4e0b76[_0x2984('0x17')]][_0x2984('0x19')])){if(this['agents'][_0x4e0b76['interface']]){this[_0x2984('0x8')][_0x4e0b76[_0x2984('0x26')]]={'queue':_0x4e0b76['queue'],'interface':_0x4e0b76[_0x2984('0x16')]};}}}catch(_0x2a7313){logger[_0x2984('0x2a')](_0x2984('0x36'),_0x2a7313[_0x2984('0x2f')]);}};Acw[_0x2984('0x14')]['syncHangupRequest']=function(_0x4e1cf0){try{if(this[_0x2984('0x8')][_0x4e1cf0[_0x2984('0x26')]]&&_[_0x2984('0x37')](this[_0x2984('0x8')][_0x4e1cf0[_0x2984('0x26')]][_0x2984('0x38')])){logger[_0x2984('0x1f')](_0x2984('0x39'),_0x4e1cf0[_0x2984('0x26')]);this['startAcw'](_0x4e1cf0['uniqueid']);}else if(this[_0x2984('0x8')][_0x4e1cf0['linkedid']]&&_[_0x2984('0x37')](this[_0x2984('0x8')][_0x4e1cf0[_0x2984('0x3a')]][_0x2984('0x38')])){logger[_0x2984('0x1f')]('[%s][HANGUP:LINKEDID]',_0x4e1cf0[_0x2984('0x3a')]);this[_0x2984('0x15')](_0x4e1cf0[_0x2984('0x3a')]);}}catch(_0x3de74a){logger[_0x2984('0x2a')](_0x2984('0x3b'),_0x3de74a[_0x2984('0x2f')]);}};Acw['prototype']['syncHangup']=function(_0x322206){try{if(this['channels'][_0x322206[_0x2984('0x26')]]&&this[_0x2984('0x8')][_0x322206['uniqueid']][_0x2984('0x38')]){logger[_0x2984('0x1f')](_0x2984('0x3c'),_0x322206[_0x2984('0x26')]);this[_0x2984('0x15')](_0x322206[_0x2984('0x26')]);}else if(this[_0x2984('0x8')][_0x322206[_0x2984('0x3a')]]&&this[_0x2984('0x8')][_0x322206[_0x2984('0x3a')]][_0x2984('0x38')]){logger[_0x2984('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x322206['linkedid']);this['startAcw'](_0x322206[_0x2984('0x3a')]);}}catch(_0x21d34d){logger[_0x2984('0x2a')](_0x2984('0x3d'),_0x21d34d[_0x2984('0x2f')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x1eadaa){try{if(!_[_0x2984('0x3e')](this['channels'][_0x1eadaa[_0x2984('0x3f')]])){this['startAcw'](_0x1eadaa['transfereeuniqueid']);if(this['channels'][_0x1eadaa[_0x2984('0x40')]]){this['channels'][_0x1eadaa[_0x2984('0x40')]][_0x2984('0x38')]=!![];this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x41')]]=this['channels'][_0x1eadaa['secondtransfereruniqueid']];delete this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x40')]];}}else if(!_[_0x2984('0x3e')](this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x41')]])){this[_0x2984('0x15')](_0x1eadaa['transfertargetuniqueid']);if(this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x42')]]){this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x42')]][_0x2984('0x38')]=!![];this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x3f')]]=this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x42')]];delete this[_0x2984('0x8')][_0x1eadaa[_0x2984('0x42')]];}}}catch(_0x32d6c6){logger[_0x2984('0x2a')](_0x2984('0x43'),_0x32d6c6[_0x2984('0x2f')]);}};Acw[_0x2984('0x14')][_0x2984('0x44')]=function(_0x39c7f0){try{if(this[_0x2984('0x8')][_0x39c7f0[_0x2984('0x45')]]){logger[_0x2984('0x1f')](_0x2984('0x46'),JSON[_0x2984('0x47')](_0x39c7f0[_0x2984('0x45')]));this[_0x2984('0x15')](_0x39c7f0[_0x2984('0x45')]);}else if(this[_0x2984('0x8')][_0x39c7f0[_0x2984('0x48')]]){logger['info'](_0x2984('0x49'),JSON[_0x2984('0x47')](_0x39c7f0[_0x2984('0x48')]));this[_0x2984('0x15')](_0x39c7f0['transfererlinkedid']);}}catch(_0x1ee7d1){logger[_0x2984('0x2a')](_0x2984('0x4a'),_0x1ee7d1[_0x2984('0x2f')]);}};Acw[_0x2984('0x14')][_0x2984('0x4b')]=function(_0x35af0b){try{if(this['voiceQueues'][_0x35af0b[_0x2984('0x17')]]&&this[_0x2984('0x5')][_0x35af0b['queue']][_0x2984('0x4c')]===_0x2984('0x4d')){if(this[_0x2984('0x6')][_0x35af0b['interface']]){logger['info'](_0x2984('0x4e'),_0x35af0b[_0x2984('0x26')],_0x35af0b[_0x2984('0x16')],_0x35af0b[_0x2984('0x17')]);return RpcUser[_0x2984('0x4f')](this[_0x2984('0x6')][_0x35af0b['interface']],'Auto-Pause',_0x35af0b[_0x2984('0x26')]);}}}catch(_0x4761a2){logger[_0x2984('0x2a')](_0x2984('0x50'),_0x4761a2[_0x2984('0x2f')]);}};module['exports']=Acw;
\ No newline at end of file