Built motion from commit 44b1f254.|2.6.26
[motion2.git] / server / services / ami / acw / index.js
index 55638d6..40b5e8b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc807=['uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update'];(function(_0x811740,_0x470ef0){var _0x4bb1fa=function(_0x55d4b5){while(--_0x55d4b5){_0x811740['push'](_0x811740['shift']());}};_0x4bb1fa(++_0x470ef0);}(_0xc807,0x94));var _0x7c80=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xc807[_0x9aada2];return _0x196dff;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0x7c80('0x0'));var logger=require('../../../config/logger')(_0x7c80('0x1'));var RpcUser=require(_0x7c80('0x2'));var RpcVoiceAgentReport=require(_0x7c80('0x3'));function Acw(_0x52c6ad){this[_0x7c80('0x4')]=_0x52c6ad[_0x7c80('0x4')];this[_0x7c80('0x5')]=_0x52c6ad[_0x7c80('0x5')];this[_0x7c80('0x6')]=_0x52c6ad['timers'];this[_0x7c80('0x7')]={};ami['on']('agentconnect',this[_0x7c80('0x8')][_0x7c80('0x9')](this));ami['on'](_0x7c80('0xa'),this[_0x7c80('0xb')][_0x7c80('0x9')](this));ami['on']('hangup',this['syncHangup'][_0x7c80('0x9')](this));ami['on']('agentringnoanswer',this[_0x7c80('0xc')][_0x7c80('0x9')](this));ami['on'](_0x7c80('0xd'),this[_0x7c80('0xe')][_0x7c80('0x9')](this));ami['on']('blindtransfer',this[_0x7c80('0xf')]['bind'](this));ami['on'](_0x7c80('0x10'),this[_0x7c80('0x11')]['bind'](this));}function getDiff(_0x4e0a9c){var _0x46ac56=moment()[_0x7c80('0x12')](0x0);var _0xf9327f=moment(_0x4e0a9c)['milliseconds'](0x0);return _0x46ac56[_0x7c80('0x13')](_0xf9327f,_0x7c80('0x14'));}Acw[_0x7c80('0x15')][_0x7c80('0x16')]=function(_0xd2d0b4,_0xaa98c0){var _0x2ecbbe=this;var _0x4f500f=getDiff(_0x2ecbbe[_0x7c80('0x6')][_0xd2d0b4][_0x7c80('0x17')]);clearTimeout(_0x2ecbbe[_0x7c80('0x6')][_0xd2d0b4][_0x7c80('0x18')]);_0x2ecbbe['timers'][_0xd2d0b4][_0x7c80('0x18')]=![];return RpcVoiceAgentReport[_0x7c80('0x19')]({'acwtime':_0x4f500f},_0x2ecbbe[_0x7c80('0x6')][_0xd2d0b4][_0x7c80('0x1a')],_0xd2d0b4)[_0x7c80('0x1b')](function(_0x5ddf13){logger[_0x7c80('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0xaa98c0,_0x4f500f,_0x5ddf13);})[_0x7c80('0x1d')](function(_0x2a0d1a){logger[_0x7c80('0x1e')](_0x7c80('0x1f'),_0xaa98c0,_0x2a0d1a);})[_0x7c80('0x20')](function(){delete _0x2ecbbe[_0x7c80('0x6')][_0xd2d0b4];});};Acw['prototype']['startAcw']=function(_0x1b89fe){try{var _0x11a7e2=this;var _0x53af1a=this[_0x7c80('0x7')][_0x1b89fe]['interface'];var _0x12a9e5=this['channels'][_0x1b89fe][_0x7c80('0x21')];var _0x4f5614=this[_0x7c80('0x4')][_0x12a9e5];var _0x4d070a=![];var _0x48bef7=_0x7c80('0x22');if(_0x4f5614[_0x7c80('0x23')]&&_0x4f5614[_0x7c80('0x24')][_0x7c80('0x25')]){_0x4d070a=!![];_0x48bef7=_0x4f5614[_0x7c80('0x24')][_0x7c80('0x25')];}if(!_0x11a7e2[_0x7c80('0x5')][_0x53af1a]){return Promise[_0x7c80('0x26')]();}return RpcUser[_0x7c80('0x27')](_0x11a7e2['agents'][_0x53af1a]['id'])['then'](function(_0xcbea54){if(!_0xcbea54||_0xcbea54[_0x7c80('0x28')]){logger[_0x7c80('0x1c')](_0x7c80('0x29'),_0x1b89fe,_0x53af1a,_0x12a9e5);return;}logger[_0x7c80('0x1c')](_0x7c80('0x2a'),_0x1b89fe,_0x53af1a,_0x12a9e5);var _0x51ba21=_0x11a7e2['channels'][_0x1b89fe]['attended']&&_0x11a7e2['channels'][_0x1b89fe][_0x7c80('0x2b')]?_0x11a7e2[_0x7c80('0x7')][_0x1b89fe][_0x7c80('0x2b')]:_0x1b89fe;return RpcUser[_0x7c80('0x2c')](_0x11a7e2[_0x7c80('0x5')][_0x53af1a],_0x48bef7,_0x51ba21)['then'](function(_0xd04890){_0x11a7e2[_0x7c80('0x4')][_0x12a9e5][_0x7c80('0x2d')]-=0x1;_0x11a7e2[_0x7c80('0x4')][_0x12a9e5][_0x7c80('0x2e')]+=0x1;return _0xd04890;});})[_0x7c80('0x1b')](function(_0x4dea00){if(_0x4d070a||!_0x4dea00){return;}_0x11a7e2[_0x7c80('0x6')][_0x53af1a]={};logger[_0x7c80('0x1c')](_0x7c80('0x2f'),_0x1b89fe,_0x11a7e2[_0x7c80('0x4')][_0x12a9e5][_0x7c80('0x30')],_0x53af1a,_0x12a9e5);_0x11a7e2[_0x7c80('0x6')][_0x53af1a]['timer']=setTimeout(_0x11a7e2[_0x7c80('0x31')][_0x7c80('0x9')](_0x11a7e2,_0x53af1a),_0x11a7e2[_0x7c80('0x4')][_0x12a9e5]['acwTimeout']*0x3e8);_0x11a7e2['timers'][_0x53af1a][_0x7c80('0x17')]=moment()['format'](_0x7c80('0x32'));_0x11a7e2['timers'][_0x53af1a][_0x7c80('0x1a')]=_0x1b89fe;_0x11a7e2[_0x7c80('0x6')][_0x53af1a][_0x7c80('0x21')]=_0x12a9e5;_0x11a7e2[_0x7c80('0x6')][_0x53af1a]['updateAcw']=_0x11a7e2['updateAcw']['bind'](_0x11a7e2,_0x53af1a,_0x1b89fe);})['catch'](function(){logger[_0x7c80('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1b89fe,_0x11a7e2[_0x7c80('0x4')][_0x12a9e5][_0x7c80('0x30')],_0x53af1a,_0x12a9e5);})[_0x7c80('0x20')](function(){delete _0x11a7e2[_0x7c80('0x7')][_0x1b89fe];});}catch(_0x56cfea){logger[_0x7c80('0x1e')]('[ACW][START]\x20%s',_0x56cfea[_0x7c80('0x33')]);}};Acw[_0x7c80('0x15')]['stopAcw']=function(_0x133864){try{var _0x430bba=this;if(_0x430bba[_0x7c80('0x6')][_0x133864]){_0x430bba['timers'][_0x133864][_0x7c80('0x18')]=![];var _0x567972=_0x430bba[_0x7c80('0x6')][_0x133864][_0x7c80('0x1a')];var _0x368009=_0x430bba['timers'][_0x133864][_0x7c80('0x21')];var _0x36be3d=_0x430bba[_0x7c80('0x4')][_0x368009]['acwTimeout'];logger[_0x7c80('0x1c')](_0x7c80('0x34'),_0x567972,_0x133864);RpcUser['getAgent'](this[_0x7c80('0x5')][_0x133864]['id'])[_0x7c80('0x1b')](function(_0x2f6136){if(_0x2f6136[_0x7c80('0x35')]===_0x7c80('0x22')){return RpcUser[_0x7c80('0x36')](_0x430bba[_0x7c80('0x5')][_0x133864]);}});RpcVoiceAgentReport[_0x7c80('0x19')]({'acwtime':_0x36be3d,'agentacw':!![]},_0x567972,_0x133864)[_0x7c80('0x1b')](function(_0x3f6506){logger['info'](_0x7c80('0x37'),_0x567972,_0x36be3d,_0x3f6506);})[_0x7c80('0x1d')](function(_0x7fea21){logger[_0x7c80('0x1e')](_0x7c80('0x1f'),_0x567972,_0x7fea21);});}else{logger[_0x7c80('0x1e')](_0x7c80('0x38'),_0x133864);if(_0x430bba[_0x7c80('0x6')]){logger[_0x7c80('0x1c')](_0x7c80('0x39'),JSON['stringify'](_0x430bba[_0x7c80('0x6')]));}}}catch(_0x11841a){logger[_0x7c80('0x1e')]('[ACW][STOP]\x20%s',_0x11841a['message']);}};Acw['prototype'][_0x7c80('0x8')]=function(_0x795ce){try{if(this['voiceQueues'][_0x795ce[_0x7c80('0x21')]]&&(this[_0x7c80('0x4')][_0x795ce[_0x7c80('0x21')]][_0x7c80('0x1')]||this[_0x7c80('0x4')][_0x795ce['queue']][_0x7c80('0x23')])){if(this[_0x7c80('0x5')][_0x795ce[_0x7c80('0x3a')]]){this[_0x7c80('0x7')][_0x795ce['uniqueid']]={'queue':_0x795ce[_0x7c80('0x21')],'interface':_0x795ce[_0x7c80('0x3a')],'destlinkedid':_0x795ce[_0x7c80('0x2b')]};}}}catch(_0x3e781e){logger[_0x7c80('0x1e')](_0x7c80('0x3b'),_0x3e781e[_0x7c80('0x33')]);}};Acw['prototype'][_0x7c80('0x11')]=function(_0x1c8ea6){try{if(this['voiceQueues'][_0x1c8ea6['queue']]&&(this[_0x7c80('0x4')][_0x1c8ea6[_0x7c80('0x21')]][_0x7c80('0x1')]||this[_0x7c80('0x4')][_0x1c8ea6['queue']][_0x7c80('0x23')])){if(this[_0x7c80('0x5')][_0x1c8ea6[_0x7c80('0x3a')]]){this['channels'][_0x1c8ea6[_0x7c80('0x1a')]]={'queue':_0x1c8ea6[_0x7c80('0x21')],'interface':_0x1c8ea6['interface']};}}}catch(_0x13ad31){logger[_0x7c80('0x1e')](_0x7c80('0x3c'),_0x13ad31['message']);}};Acw['prototype'][_0x7c80('0xb')]=function(_0x5201df){try{if(this[_0x7c80('0x7')][_0x5201df[_0x7c80('0x1a')]]&&_[_0x7c80('0x3d')](this['channels'][_0x5201df[_0x7c80('0x1a')]]['attended'])){logger[_0x7c80('0x1c')](_0x7c80('0x3e'),_0x5201df[_0x7c80('0x1a')]);this[_0x7c80('0x3f')](_0x5201df[_0x7c80('0x1a')]);}else if(this['channels'][_0x5201df['linkedid']]&&_[_0x7c80('0x3d')](this[_0x7c80('0x7')][_0x5201df[_0x7c80('0x40')]][_0x7c80('0x41')])){logger[_0x7c80('0x1c')](_0x7c80('0x42'),_0x5201df[_0x7c80('0x40')]);this[_0x7c80('0x3f')](_0x5201df[_0x7c80('0x40')]);}}catch(_0x35ca42){logger['error'](_0x7c80('0x43'),_0x35ca42[_0x7c80('0x33')]);}};Acw['prototype'][_0x7c80('0x44')]=function(_0x16e29a){try{if(this[_0x7c80('0x7')][_0x16e29a[_0x7c80('0x1a')]]&&this[_0x7c80('0x7')][_0x16e29a[_0x7c80('0x1a')]][_0x7c80('0x41')]){logger['info'](_0x7c80('0x45'),_0x16e29a[_0x7c80('0x1a')]);this[_0x7c80('0x3f')](_0x16e29a[_0x7c80('0x1a')]);}else if(this[_0x7c80('0x7')][_0x16e29a['linkedid']]&&this[_0x7c80('0x7')][_0x16e29a[_0x7c80('0x40')]][_0x7c80('0x41')]){logger[_0x7c80('0x1c')](_0x7c80('0x46'),_0x16e29a[_0x7c80('0x40')]);this['startAcw'](_0x16e29a['linkedid']);}}catch(_0x4526a5){logger[_0x7c80('0x1e')](_0x7c80('0x47'),_0x4526a5['message']);}};Acw[_0x7c80('0x15')][_0x7c80('0xe')]=function(_0x31b9e3){try{if(!_['isNil'](this['channels'][_0x31b9e3[_0x7c80('0x48')]])){this[_0x7c80('0x3f')](_0x31b9e3[_0x7c80('0x48')]);if(this[_0x7c80('0x7')][_0x31b9e3[_0x7c80('0x49')]]){this[_0x7c80('0x7')][_0x31b9e3[_0x7c80('0x49')]][_0x7c80('0x41')]=!![];this[_0x7c80('0x7')][_0x31b9e3[_0x7c80('0x4a')]]=this['channels'][_0x31b9e3[_0x7c80('0x49')]];delete this['channels'][_0x31b9e3[_0x7c80('0x49')]];}}else if(!_[_0x7c80('0x4b')](this[_0x7c80('0x7')][_0x31b9e3[_0x7c80('0x4a')]])){this[_0x7c80('0x3f')](_0x31b9e3[_0x7c80('0x4a')]);if(this[_0x7c80('0x7')][_0x31b9e3[_0x7c80('0x4c')]]){this['channels'][_0x31b9e3['origtransfereruniqueid']][_0x7c80('0x41')]=!![];this[_0x7c80('0x7')][_0x31b9e3[_0x7c80('0x48')]]=this[_0x7c80('0x7')][_0x31b9e3['origtransfereruniqueid']];delete this['channels'][_0x31b9e3[_0x7c80('0x4c')]];}}}catch(_0x4dec76){logger[_0x7c80('0x1e')](_0x7c80('0x4d'),_0x4dec76[_0x7c80('0x33')]);}};Acw[_0x7c80('0x15')][_0x7c80('0xf')]=function(_0x4f8db5){try{if(this[_0x7c80('0x7')][_0x4f8db5[_0x7c80('0x4e')]]){logger[_0x7c80('0x1c')](_0x7c80('0x4f'),JSON[_0x7c80('0x50')](_0x4f8db5['transfereruniqueid']));this['startAcw'](_0x4f8db5[_0x7c80('0x4e')]);}else if(this[_0x7c80('0x7')][_0x4f8db5[_0x7c80('0x51')]]){logger['info'](_0x7c80('0x52'),JSON[_0x7c80('0x50')](_0x4f8db5[_0x7c80('0x51')]));this[_0x7c80('0x3f')](_0x4f8db5[_0x7c80('0x51')]);}}catch(_0x132e92){logger['error'](_0x7c80('0x53'),_0x132e92[_0x7c80('0x33')]);}};Acw[_0x7c80('0x15')]['syncAgentRingNoAnswer']=function(_0x8de1af){try{if(this['voiceQueues'][_0x8de1af[_0x7c80('0x21')]]&&this[_0x7c80('0x4')][_0x8de1af[_0x7c80('0x21')]][_0x7c80('0x54')]===_0x7c80('0x55')){if(this[_0x7c80('0x5')][_0x8de1af[_0x7c80('0x3a')]]){logger[_0x7c80('0x1c')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x8de1af[_0x7c80('0x1a')],_0x8de1af[_0x7c80('0x3a')],_0x8de1af[_0x7c80('0x21')]);return RpcUser[_0x7c80('0x2c')](this[_0x7c80('0x5')][_0x8de1af['interface']],_0x7c80('0x56'),_0x8de1af[_0x7c80('0x1a')]);}}}catch(_0x5ca1b9){logger[_0x7c80('0x1e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5ca1b9[_0x7c80('0x33')]);}};module['exports']=Acw;
\ No newline at end of file
+var _0xf188=['syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','error','[ACW][START]\x20%s','message','pauseType','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','blindtransfer'];(function(_0x30bf8e,_0x145794){var _0x2bf17e=function(_0x447ba1){while(--_0x447ba1){_0x30bf8e['push'](_0x30bf8e['shift']());}};_0x2bf17e(++_0x145794);}(_0xf188,0x187));var _0x8f18=function(_0xcf7ca,_0x54e647){_0xcf7ca=_0xcf7ca-0x0;var _0x259582=_0xf188[_0xcf7ca];return _0x259582;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require('../ami');var logger=require(_0x8f18('0x0'))('acw');var RpcUser=require(_0x8f18('0x1'));var RpcVoiceAgentReport=require(_0x8f18('0x2'));function Acw(_0x30da46){this['voiceQueues']=_0x30da46[_0x8f18('0x3')];this[_0x8f18('0x4')]=_0x30da46[_0x8f18('0x4')];this['timers']=_0x30da46[_0x8f18('0x5')];this[_0x8f18('0x6')]={};ami['on'](_0x8f18('0x7'),this[_0x8f18('0x8')]['bind'](this));ami['on']('hanguprequest',this[_0x8f18('0x9')][_0x8f18('0xa')](this));ami['on'](_0x8f18('0xb'),this[_0x8f18('0xc')][_0x8f18('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x8f18('0xa')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x8f18('0xd'),this[_0x8f18('0xe')][_0x8f18('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0x8f18('0xf')][_0x8f18('0xa')](this));}function getDiff(_0x3ecd55){var _0x436c4e=moment()[_0x8f18('0x10')](0x0);var _0x1d14b5=moment(_0x3ecd55)[_0x8f18('0x10')](0x0);return _0x436c4e[_0x8f18('0x11')](_0x1d14b5,_0x8f18('0x12'));}Acw[_0x8f18('0x13')][_0x8f18('0x14')]=function(_0x22154a,_0x246e27){var _0xafadb7=this;var _0x439c81=getDiff(_0xafadb7['timers'][_0x22154a]['lastPauseAt']);clearTimeout(_0xafadb7[_0x8f18('0x5')][_0x22154a][_0x8f18('0x15')]);_0xafadb7[_0x8f18('0x5')][_0x22154a][_0x8f18('0x15')]=![];return RpcVoiceAgentReport[_0x8f18('0x16')]({'acwtime':_0x439c81},_0xafadb7[_0x8f18('0x5')][_0x22154a][_0x8f18('0x17')],_0x22154a)['then'](function(_0x2c4cd9){logger[_0x8f18('0x18')](_0x8f18('0x19'),_0x246e27,_0x439c81,_0x2c4cd9);})['catch'](function(_0x4082c5){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x246e27,_0x4082c5);})['finally'](function(){delete _0xafadb7[_0x8f18('0x5')][_0x22154a];});};Acw[_0x8f18('0x13')][_0x8f18('0x1a')]=function(_0x5795eb){try{var _0x4194c0=this;var _0xa4515=this[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x1b')];var _0x4ea8ee=this[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x1c')];var _0x34bf99=this[_0x8f18('0x3')][_0x4ea8ee];var _0x29e788=![];var _0x359fad=_0x8f18('0x1d');if(_0x34bf99[_0x8f18('0x1e')]&&_0x34bf99[_0x8f18('0x1f')]['name']){_0x29e788=!![];_0x359fad=_0x34bf99[_0x8f18('0x1f')][_0x8f18('0x20')];}if(!_0x4194c0[_0x8f18('0x4')][_0xa4515]){return Promise[_0x8f18('0x21')]();}return RpcUser[_0x8f18('0x22')](_0x4194c0['agents'][_0xa4515]['id'])[_0x8f18('0x23')](function(_0x2537a8){if(!_0x2537a8||_0x2537a8[_0x8f18('0x24')]){logger[_0x8f18('0x18')](_0x8f18('0x25'),_0x5795eb,_0xa4515,_0x4ea8ee);return;}logger[_0x8f18('0x18')](_0x8f18('0x26'),_0x5795eb,_0xa4515,_0x4ea8ee);var _0x2e0fb6=_0x4194c0[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x27')]&&_0x4194c0[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x28')]?_0x4194c0[_0x8f18('0x6')][_0x5795eb][_0x8f18('0x28')]:_0x5795eb;return RpcUser[_0x8f18('0x29')](_0x4194c0[_0x8f18('0x4')][_0xa4515],_0x359fad,_0x2e0fb6)[_0x8f18('0x23')](function(_0x2b8518){_0x4194c0['voiceQueues'][_0x4ea8ee][_0x8f18('0x2a')]-=0x1;_0x4194c0['voiceQueues'][_0x4ea8ee][_0x8f18('0x2b')]+=0x1;return _0x2b8518;});})[_0x8f18('0x23')](function(_0x27e925){if(_0x29e788||!_0x27e925){return;}_0x4194c0[_0x8f18('0x5')][_0xa4515]={};logger[_0x8f18('0x18')](_0x8f18('0x2c'),_0x5795eb,_0x4194c0[_0x8f18('0x3')][_0x4ea8ee][_0x8f18('0x2d')],_0xa4515,_0x4ea8ee);_0x4194c0[_0x8f18('0x5')][_0xa4515][_0x8f18('0x15')]=setTimeout(_0x4194c0[_0x8f18('0x2e')][_0x8f18('0xa')](_0x4194c0,_0xa4515),_0x4194c0[_0x8f18('0x3')][_0x4ea8ee][_0x8f18('0x2d')]*0x3e8);_0x4194c0[_0x8f18('0x5')][_0xa4515]['lastPauseAt']=moment()[_0x8f18('0x2f')](_0x8f18('0x30'));_0x4194c0[_0x8f18('0x5')][_0xa4515][_0x8f18('0x17')]=_0x5795eb;_0x4194c0['timers'][_0xa4515][_0x8f18('0x1c')]=_0x4ea8ee;_0x4194c0[_0x8f18('0x5')][_0xa4515]['updateAcw']=_0x4194c0[_0x8f18('0x14')][_0x8f18('0xa')](_0x4194c0,_0xa4515,_0x5795eb);})['catch'](function(){logger[_0x8f18('0x31')](_0x8f18('0x2c'),_0x5795eb,_0x4194c0[_0x8f18('0x3')][_0x4ea8ee][_0x8f18('0x2d')],_0xa4515,_0x4ea8ee);})['finally'](function(){delete _0x4194c0['channels'][_0x5795eb];});}catch(_0x54c78c){logger['error'](_0x8f18('0x32'),_0x54c78c[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0x2e')]=function(_0x332468){try{var _0xa531f=this;if(_0xa531f[_0x8f18('0x5')][_0x332468]){_0xa531f[_0x8f18('0x5')][_0x332468][_0x8f18('0x15')]=![];var _0x5d61d8=_0xa531f[_0x8f18('0x5')][_0x332468]['uniqueid'];var _0x4b449e=_0xa531f[_0x8f18('0x5')][_0x332468][_0x8f18('0x1c')];var _0x4bf8de=_0xa531f[_0x8f18('0x3')][_0x4b449e][_0x8f18('0x2d')];logger[_0x8f18('0x18')]('[%s][TIMER][STOP][AGENT:%s]',_0x5d61d8,_0x332468);RpcUser['getAgent'](this[_0x8f18('0x4')][_0x332468]['id'])[_0x8f18('0x23')](function(_0x1a3547){if(_0x1a3547[_0x8f18('0x34')]===_0x8f18('0x1d')){return RpcUser[_0x8f18('0x35')](_0xa531f[_0x8f18('0x4')][_0x332468]);}});RpcVoiceAgentReport['update']({'acwtime':_0x4bf8de,'agentacw':!![]},_0x5d61d8,_0x332468)['then'](function(_0x2e2b8f){logger['info'](_0x8f18('0x19'),_0x5d61d8,_0x4bf8de,_0x2e2b8f);})['catch'](function(_0x34ef66){logger[_0x8f18('0x31')](_0x8f18('0x36'),_0x5d61d8,_0x34ef66);});}else{logger['error'](_0x8f18('0x37'),_0x332468);if(_0xa531f[_0x8f18('0x5')]){logger[_0x8f18('0x18')](_0x8f18('0x38'),JSON[_0x8f18('0x39')](_0xa531f['timers']));}}}catch(_0x65f533){logger[_0x8f18('0x31')]('[ACW][STOP]\x20%s',_0x65f533['message']);}};Acw[_0x8f18('0x13')][_0x8f18('0x8')]=function(_0x2bffe7){try{if(this[_0x8f18('0x3')][_0x2bffe7[_0x8f18('0x1c')]]&&(this[_0x8f18('0x3')][_0x2bffe7[_0x8f18('0x1c')]]['acw']||this['voiceQueues'][_0x2bffe7[_0x8f18('0x1c')]][_0x8f18('0x1e')])){if(this[_0x8f18('0x4')][_0x2bffe7[_0x8f18('0x1b')]]){this['channels'][_0x2bffe7[_0x8f18('0x17')]]={'queue':_0x2bffe7[_0x8f18('0x1c')],'interface':_0x2bffe7[_0x8f18('0x1b')],'destlinkedid':_0x2bffe7[_0x8f18('0x28')]};}}}catch(_0x1d495b){logger[_0x8f18('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x1d495b[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0xf')]=function(_0x1f36f2){try{if(this[_0x8f18('0x3')][_0x1f36f2['queue']]&&(this[_0x8f18('0x3')][_0x1f36f2[_0x8f18('0x1c')]][_0x8f18('0x3a')]||this[_0x8f18('0x3')][_0x1f36f2['queue']][_0x8f18('0x1e')])){if(this[_0x8f18('0x4')][_0x1f36f2[_0x8f18('0x1b')]]){this['channels'][_0x1f36f2[_0x8f18('0x17')]]={'queue':_0x1f36f2[_0x8f18('0x1c')],'interface':_0x1f36f2[_0x8f18('0x1b')]};}}}catch(_0x385397){logger[_0x8f18('0x31')](_0x8f18('0x3b'),_0x385397[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0x9')]=function(_0x11aaea){try{if(this[_0x8f18('0x6')][_0x11aaea[_0x8f18('0x17')]]&&_[_0x8f18('0x3c')](this[_0x8f18('0x6')][_0x11aaea[_0x8f18('0x17')]]['attended'])){logger[_0x8f18('0x18')](_0x8f18('0x3d'),_0x11aaea[_0x8f18('0x17')]);this['startAcw'](_0x11aaea[_0x8f18('0x17')]);}else if(this[_0x8f18('0x6')][_0x11aaea[_0x8f18('0x3e')]]&&_['isUndefined'](this['channels'][_0x11aaea[_0x8f18('0x3e')]]['attended'])){logger[_0x8f18('0x18')]('[%s][HANGUP:LINKEDID]',_0x11aaea[_0x8f18('0x3e')]);this[_0x8f18('0x1a')](_0x11aaea[_0x8f18('0x3e')]);}}catch(_0x1b1cba){logger['error'](_0x8f18('0x3f'),_0x1b1cba[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0xc')]=function(_0x32a827){try{if(this[_0x8f18('0x6')][_0x32a827[_0x8f18('0x17')]]&&this[_0x8f18('0x6')][_0x32a827[_0x8f18('0x17')]][_0x8f18('0x27')]){logger['info'](_0x8f18('0x40'),_0x32a827[_0x8f18('0x17')]);this[_0x8f18('0x1a')](_0x32a827['uniqueid']);}else if(this['channels'][_0x32a827[_0x8f18('0x3e')]]&&this['channels'][_0x32a827[_0x8f18('0x3e')]][_0x8f18('0x27')]){logger[_0x8f18('0x18')](_0x8f18('0x41'),_0x32a827[_0x8f18('0x3e')]);this[_0x8f18('0x1a')](_0x32a827[_0x8f18('0x3e')]);}}catch(_0x191fc4){logger['error']('[ACW][syncHangup]\x20%s',_0x191fc4[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')]['syncAttendedTransfer']=function(_0x4a80be){try{if(!_[_0x8f18('0x42')](this['channels'][_0x4a80be['transfereeuniqueid']])){this[_0x8f18('0x1a')](_0x4a80be['transfereeuniqueid']);if(this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x43')]]){this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x43')]][_0x8f18('0x27')]=!![];this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x44')]]=this['channels'][_0x4a80be['secondtransfereruniqueid']];delete this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x43')]];}}else if(!_[_0x8f18('0x42')](this['channels'][_0x4a80be['transfertargetuniqueid']])){this[_0x8f18('0x1a')](_0x4a80be[_0x8f18('0x44')]);if(this[_0x8f18('0x6')][_0x4a80be['origtransfereruniqueid']]){this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x45')]]['attended']=!![];this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x46')]]=this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x45')]];delete this[_0x8f18('0x6')][_0x4a80be[_0x8f18('0x45')]];}}}catch(_0x307896){logger[_0x8f18('0x31')](_0x8f18('0x47'),_0x307896['message']);}};Acw[_0x8f18('0x13')][_0x8f18('0xe')]=function(_0x37c8d0){try{if(this[_0x8f18('0x6')][_0x37c8d0[_0x8f18('0x48')]]){logger['info'](_0x8f18('0x49'),JSON['stringify'](_0x37c8d0[_0x8f18('0x48')]));this[_0x8f18('0x1a')](_0x37c8d0['transfereruniqueid']);}else if(this[_0x8f18('0x6')][_0x37c8d0[_0x8f18('0x4a')]]){logger[_0x8f18('0x18')](_0x8f18('0x4b'),JSON[_0x8f18('0x39')](_0x37c8d0[_0x8f18('0x4a')]));this['startAcw'](_0x37c8d0[_0x8f18('0x4a')]);}}catch(_0x23758c){logger[_0x8f18('0x31')](_0x8f18('0x4c'),_0x23758c[_0x8f18('0x33')]);}};Acw[_0x8f18('0x13')][_0x8f18('0x4d')]=function(_0x43043d){try{if(this['voiceQueues'][_0x43043d[_0x8f18('0x1c')]]&&this[_0x8f18('0x3')][_0x43043d[_0x8f18('0x1c')]]['autopause']==='all'){if(this[_0x8f18('0x4')][_0x43043d[_0x8f18('0x1b')]]){logger['info'](_0x8f18('0x4e'),_0x43043d['uniqueid'],_0x43043d[_0x8f18('0x1b')],_0x43043d[_0x8f18('0x1c')]);return RpcUser[_0x8f18('0x29')](this[_0x8f18('0x4')][_0x43043d['interface']],_0x8f18('0x4f'),_0x43043d[_0x8f18('0x17')]);}}}catch(_0x30036b){logger[_0x8f18('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x30036b['message']);}};module[_0x8f18('0x50')]=Acw;
\ No newline at end of file