Built motion from commit e1760111.|2.6.18
[motion2.git] / server / services / ami / preview / index.js
index 7cb5c7b..7111e73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x692d=['trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','starttime','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','preview','../../../config/logger','../ami','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','newexten','syncVarSet','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','hasOwnProperty','booked','type','outbound','clearZombieChannels','dialMethod','dialActive','recallMe','clearZombieChannel','isNil','Queue','queue','pick','UserId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','run','then','logger2','[RecallMe]','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','setMessage','loggedIn','NO_AGENTS_LOGGED','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','dialAnswer','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','originated:\x20','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','VoiceQueueId','phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix'];(function(_0x737650,_0x3de47e){var _0x3e4091=function(_0xe27699){while(--_0xe27699){_0x737650['push'](_0x737650['shift']());}};_0x3e4091(++_0x3de47e);}(_0x692d,0x175));var _0xd692=function(_0x40af8c,_0x54b629){_0x40af8c=_0x40af8c-0x0;var _0x4c8cd7=_0x692d[_0x40af8c];return _0x4c8cd7;};'use strict';var util=require(_0xd692('0x0'));var _=require(_0xd692('0x1'));var uuid=require(_0xd692('0x2'));var moment=require(_0xd692('0x3'));var Redis=require(_0xd692('0x4'));var config=require(_0xd692('0x5'));var logger=require('../../../config/logger')(_0xd692('0x6'));var loggerAction=require(_0xd692('0x7'))('actionPreview');var ami=require(_0xd692('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xd692('0x9'));var Action=require(_0xd692('0xa'));var ut=require('./util/util');var utils=require('../dialer/utils');config[_0xd692('0xb')]=_[_0xd692('0xc')](config[_0xd692('0xb')],{'host':_0xd692('0xd'),'port':0x18eb});var io=require(_0xd692('0xe'))(new Redis(config[_0xd692('0xb')]));var Sequence=function(){};Sequence[_0xd692('0xf')][_0xd692('0x10')]=function(_0x2db0ca){this[_0xd692('0x11')]=this[_0xd692('0x11')]?this[_0xd692('0x11')][_0xd692('0x12')](_0x2db0ca):_0x2db0ca();};function Preview(_0xc0322d){this[_0xd692('0x13')]=new Sequence();this[_0xd692('0x14')]=_0xc0322d[_0xd692('0x15')];this['trunks']=_0xc0322d[_0xd692('0x16')];this[_0xd692('0x17')]={};this['agents']=_0xc0322d[_0xd692('0x18')];this[_0xd692('0x19')]=0x0;ami['on'](_0xd692('0x1a'),this[_0xd692('0x1b')][_0xd692('0x1c')](this));ami['on'](_0xd692('0x1d'),this['syncHangup'][_0xd692('0x1c')](this));ami['on'](_0xd692('0x1e'),this[_0xd692('0x1f')][_0xd692('0x1c')](this));ami['on'](_0xd692('0x20'),this['syncDialEnd'][_0xd692('0x1c')](this));ami['on'](_0xd692('0x21'),this['syncNewExten'][_0xd692('0x1c')](this));ami['on']('varset',this[_0xd692('0x22')][_0xd692('0x1c')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xd692('0x1c')](this));ami['on'](_0xd692('0x23'),this[_0xd692('0x24')][_0xd692('0x1c')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x3d67d0,_0x228c50,_0x3931b5){io['to'](_0x3d67d0)[_0xd692('0x25')](_0x228c50,_0x3931b5);}function emitVoiceQueueChannelRemove(_0x5b20c9){logger[_0xd692('0x26')](_0xd692('0x27'),JSON[_0xd692('0x28')](_0x5b20c9));emit(util['format'](_0xd692('0x29'),_0x5b20c9[_0xd692('0x2a')]),_0xd692('0x2b'),_0x5b20c9);io[_0xd692('0x25')](_0xd692('0x2c'),_0x5b20c9);}function notSendMessagesQueue(_0x489cc8){if(_0x489cc8[_0xd692('0x2d')]){if(_0x489cc8[_0xd692('0x2e')]===0x0&&_0x489cc8[_0xd692('0x2f')]===0x0){_0x489cc8['sendMessageOneNotActive']=![];_0x489cc8[_0xd692('0x30')]=0x0;_0x489cc8[_0xd692('0x31')]=0x0;_0x489cc8[_0xd692('0x32')]=utils[_0xd692('0x33')]['INACTIVE'];ut[_0xd692('0x34')](_0xd692('0x35'),_0x489cc8[_0xd692('0x2a')]+_0xd692('0x36'));}else{_0x489cc8[_0xd692('0x32')]=utils[_0xd692('0x33')]['DEACTIVATED'];ut[_0xd692('0x34')](_0xd692('0x35'),_0x489cc8['name']+_0xd692('0x37'));}}}Preview[_0xd692('0xf')]['loopCampaigns']=function(){var _0x248bfd=this;setInterval(function(){_0x248bfd['syncCampaigns']();},0x7cf);};Preview[_0xd692('0xf')]['syncCampaigns']=function(){var _0x30e441=this[_0xd692('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x592a92 in _0x30e441){if(_0x30e441[_0xd692('0x38')](_0x592a92)&&(_0x30e441[_0x592a92]['dialMethod']===_0xd692('0x6')||_0x30e441[_0x592a92]['dialMethod']===_0xd692('0x39'))&&_0x30e441[_0x592a92][_0xd692('0x3a')]===_0xd692('0x3b')){if(this[_0xd692('0x19')]>0x7){this[_0xd692('0x19')]=0x0;this[_0xd692('0x3c')]();}}if(_0x30e441[_0xd692('0x38')](_0x592a92)&&_0x30e441[_0x592a92][_0xd692('0x3d')]==='preview'&&_0x30e441[_0x592a92][_0xd692('0x3a')]==='outbound'){if(_0x30e441[_0x592a92][_0xd692('0x3e')]){this['setMessage'](_0x30e441[_0x592a92]);if(_0x30e441[_0x592a92]['dialPreviewAutoRecallMe'])this[_0xd692('0x3f')](_0x30e441[_0x592a92]);}else{notSendMessagesQueue(_0x30e441[_0x592a92]);}}}};Preview['prototype'][_0xd692('0x40')]=function(_0x3bcc33){var _0x4ff0a5=this;this['sequence']['enqueue'](function(){if(!_[_0xd692('0x41')](_0x4ff0a5[_0xd692('0x17')][_0x3bcc33])){loggerAction[_0xd692('0x26')]('[clearZombieChannels][talking]',_0x3bcc33,_0xd692('0x42'),_0x4ff0a5[_0xd692('0x17')][_0x3bcc33][_0xd692('0x43')],'originated:\x20',JSON[_0xd692('0x28')](_0x4ff0a5[_0xd692('0x14')][_0x4ff0a5['actions'][_0x3bcc33][_0xd692('0x43')]][_0xd692('0x2e')]),'pTalking:\x20',JSON['stringify'](_0x4ff0a5[_0xd692('0x14')][_0x4ff0a5[_0xd692('0x17')][_0x3bcc33][_0xd692('0x43')]][_0xd692('0x2f')]),JSON['stringify'](_0x4ff0a5['actions'][_0x3bcc33]['dialAnswer']),JSON[_0xd692('0x28')](_[_0xd692('0x44')](_0x4ff0a5[_0xd692('0x17')][_0x3bcc33],['contactId',_0xd692('0x45'),'VoiceQueueId',_0xd692('0x46')])));return ami['Action']({'action':_0xd692('0x47'),'channel':_0x4ff0a5['actions'][_0x3bcc33][_0xd692('0x48')]})[_0xd692('0x49')](function(_0x910edc){if(_0x910edc[_0xd692('0x32')]===_0xd692('0x4a')){setTimeout(function(){if(_0x4ff0a5[_0xd692('0x17')][_0x3bcc33]){ut[_0xd692('0x4b')](_0x4ff0a5['campaignsPreview'][_0x4ff0a5['actions'][_0x3bcc33][_0xd692('0x43')]],_0xd692('0x4c'));if(_0x4ff0a5[_0xd692('0x17')][_0x3bcc33]['dialAnswer']===!![]){ut[_0xd692('0x4d')](_0x4ff0a5[_0xd692('0x14')][_0x4ff0a5['actions'][_0x3bcc33][_0xd692('0x43')]],_0xd692('0x4c'));ut[_0xd692('0x4e')](_0xd692('0x4f')+_0x3bcc33,_0x4ff0a5[_0xd692('0x17')][_0x3bcc33][_0xd692('0x43')]);}ut['loggerError'](_0xd692('0x50')+_0x3bcc33,_0x4ff0a5['actions'][_0x3bcc33][_0xd692('0x43')]);delete _0x4ff0a5['actions'][_0x3bcc33];}},0x2328);}});}});};Preview[_0xd692('0xf')]['clearZombieChannels']=function(){var _0x39d2f5=this;loggerAction['info'](_0xd692('0x51'),_[_0xd692('0x52')](this[_0xd692('0x17')]));for(var _0xc70f56 in this[_0xd692('0x17')]){if(_0x39d2f5['actions'][_0xd692('0x38')](_0xc70f56)){_0x39d2f5[_0xd692('0x40')](_0xc70f56);}}};Preview[_0xd692('0xf')][_0xd692('0x3f')]=function(_0x3f8c13){var _0x4a5001=this;rpcDb[_0xd692('0x53')](_0x3f8c13['id'],ut[_0xd692('0x54')](this[_0xd692('0x18')]))['then'](function(_0x91a05){if(!_['isNil'](_0x91a05)){for(var _0x13b66f=0x0;_0x13b66f<_0x91a05[_0xd692('0x55')];_0x13b66f+=0x1){if(ut[_0xd692('0x56')](_0x91a05[_0x13b66f][_0xd692('0x57')])<_0x3f8c13['dialRecallMeTimeout']*0x3c){if(_0x91a05[_0x13b66f][_0xd692('0x58')]&&!_0x91a05[_0x13b66f][_0xd692('0x58')]['voicePause']){_0x4a5001[_0xd692('0x59')](_0x91a05[_0x13b66f]['id'])[_0xd692('0x5a')](ut[_0xd692('0x5b')]('[RecallMe]'))[_0xd692('0x49')](ut[_0xd692('0x5b')](_0xd692('0x5c')));}else{rpcDb['disableContact'](_0x91a05[_0x13b66f]['id']);}}else{var _0x23e1d4=new Action(_0x91a05[_0x13b66f],_0x3f8c13);_0x23e1d4['starttime']=moment()[_0xd692('0x5d')](_0xd692('0x5e'));_0x3f8c13['outboundReCallsDay']+=0x1;ut[_0xd692('0x5f')](_0x23e1d4,0x17,_0xd692('0x60'));if(_0x3f8c13[_0xd692('0x61')]){rpcDb[_0xd692('0x62')](ut['createBody'](_0x91a05[_0x13b66f]));rpcDb[_0xd692('0x63')](_0x23e1d4,_0xd692('0x64'));}else{ut[_0xd692('0x5f')](_0x23e1d4,0x16,'RecallFailedTimeout');rpcDb[_0xd692('0x63')](_0x23e1d4,_0xd692('0x65'));rpcDb[_0xd692('0x66')](_0x23e1d4,_0xd692('0x65'));}}}}})[_0xd692('0x49')](ut[_0xd692('0x5b')]('[getContactRecallMe]'));};Preview[_0xd692('0xf')][_0xd692('0x67')]=function(_0x1513ce){_0x1513ce[_0xd692('0x2d')]=!![];if(ut['IsNotLoggedIn'](_0x1513ce[_0xd692('0x68')])){_0x1513ce[_0xd692('0x32')]=utils['CAMPAIGN_STATUS'][_0xd692('0x69')];}else if(!ut['isActive'](_0x1513ce[_0xd692('0x3e')])){_0x1513ce['message']=utils[_0xd692('0x33')][_0xd692('0x6a')];}else if(!this[_0xd692('0x6b')](_0x1513ce[_0xd692('0x6c')])){if(!this['isTrunkReachable'](_0x1513ce[_0xd692('0x6d')])){_0x1513ce[_0xd692('0x32')]=utils[_0xd692('0x33')][_0xd692('0x6e')];}else{_0x1513ce[_0xd692('0x32')]=utils[_0xd692('0x33')][_0xd692('0x6f')];}}else{_0x1513ce[_0xd692('0x32')]=utils[_0xd692('0x33')][_0xd692('0x6f')];}};Preview['prototype']['callProgressDetectingCustomer']=function(_0x7355f7,_0x5946a9,_0x5ec941){var _0x327b07=this;var _0x1db568=this[_0xd692('0x17')][_0x5946a9];var _0x530c0b=this[_0xd692('0x14')][_0x1db568[_0xd692('0x43')]];var _0x38a35a;var _0x4dcd32=![];var _0x2979ae=0x2;var _0x332f0f=0x3;if(_0x530c0b){switch(_0x5ec941){case'1':_0x530c0b['outboundNoSuchCallsDay']+=0x1;_0x1db568[_0xd692('0x70')]+=0x1;_0x1db568[_0xd692('0x71')]=ut['totalGlobal'](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0x0,'NoSuchNumber');ami[_0xd692('0x25')](_0xd692('0x72'),ut[_0xd692('0x73')](_0x1db568,_0xd692('0x74')));rpcDb[_0xd692('0x63')](_0x1db568,'[callProgressDetectingCustomer][logNoSuch]');_0x327b07[_0xd692('0x75')](_0x1db568,'0',_0x530c0b)[_0xd692('0x5a')](function(_0x33e0d5){_0x4dcd32=_0x33e0d5[_0xd692('0x76')]==0x1;_0x2979ae=_0x530c0b[_0xd692('0x77')];_0x332f0f=_0x530c0b[_0xd692('0x78')];if(!_0x4dcd32){if(ut[_0xd692('0x79')](_0x1db568)>=_0x530c0b[_0xd692('0x7a')]){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0xf,_0xd692('0x7c'));rpcDb['createCustomerFinal'](_0x38a35a,_0xd692('0x7d'));}else{if(_0x1db568[_0xd692('0x70')]>=_0x530c0b[_0xd692('0x7e')]){rpcDb['createCustomerFinal'](_0x1db568,_0xd692('0x7d'));}else{rpcDb[_0xd692('0x7f')](ut[_0xd692('0x80')](_0x1db568,_0xd692('0x70'),_0x530c0b['dialNoSuchNumberRetryFrequency']),_0x1db568[_0xd692('0x81')],_0x1db568[_0xd692('0x82')]);}}delete this[_0xd692('0x17')][_0x7355f7[_0xd692('0x83')]];}else{_0x1db568[_0xd692('0x70')]++;logger[_0xd692('0x26')](_0xd692('0x84'),_0x1db568[_0xd692('0x70')]);logger['info']('id',_0x1db568['idContact']);_0x327b07[_0xd692('0x85')]({'id':_0x1db568['idContact'],'field':{'countnosuchnumberretry':_0x1db568['countnosuchnumberretry']}})[_0xd692('0x5a')](function(){_0x327b07[_0xd692('0x86')](_0x1db568,_0x2979ae,_0x332f0f)['then'](function(){});});}});break;case _0xd692('0x87'):var _0x1847fe=moment()[_0xd692('0x5d')](_0xd692('0x5e'));_0x1db568[_0xd692('0x88')]=_0x1847fe;_0x1db568[_0xd692('0x89')]=_0x1847fe;_0x1db568[_0xd692('0x8a')]=!![];_0x530c0b['pTalking']+=0x1;logger[_0xd692('0x26')](_0xd692('0x8b'),_0x1db568[_0xd692('0x8c')],'\x20Queue',_0x530c0b[_0xd692('0x2a')],_0xd692('0x8d'),_0x530c0b[_0xd692('0x2f')]);ami[_0xd692('0x25')](_0xd692('0x8e'),ut[_0xd692('0x73')](_0x1db568,_0xd692('0x8f'),this[_0xd692('0x14')][_0x1db568[_0xd692('0x43')]]));if(_0x530c0b[_0xd692('0x90')]){ami[_0xd692('0x25')](_0xd692('0x91'),ut[_0xd692('0x92')](_0x1db568));}break;case'16':ami[_0xd692('0x25')](_0xd692('0x93'),ut['buildObj'](_0x1db568,_0xd692('0x94'),this[_0xd692('0x14')][_0x1db568['queue']]));emitVoiceQueueChannelRemove(ut[_0xd692('0x73')](_0x1db568,'complete'));_0x530c0b[_0xd692('0x95')]+=0x1;_0x530c0b[_0xd692('0x96')]+=0x1;_0x530c0b['answered']+=0x1;ut['decrementTalkink'](_0x530c0b,_0xd692('0x97'));_0x1db568[_0xd692('0x71')]=ut[_0xd692('0x79')](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0x4,_0xd692('0x98'));rpcDb[_0xd692('0x63')](_0x1db568,_0xd692('0x99'));rpcDb[_0xd692('0x66')](_0x1db568,_0xd692('0x9a'));rpcDb[_0xd692('0x9b')](_0x1db568);_0x530c0b[_0xd692('0x9c')]+=_0x1db568['talktime'];_0x530c0b[_0xd692('0x9d')]+=_0x1db568['talktime'];logger[_0xd692('0x26')](_0xd692('0x9e'),_0x1db568[_0xd692('0x8c')],_0xd692('0x9f'),_0x530c0b[_0xd692('0x2a')],_0xd692('0x8d'),_0x530c0b[_0xd692('0x2f')]);delete this[_0xd692('0x17')][_0x7355f7[_0xd692('0x83')]];break;case'BUSY':_0x530c0b[_0xd692('0xa0')]+=0x1;_0x1db568[_0xd692('0xa1')]+=0x1;_0x1db568[_0xd692('0x71')]=ut['totalGlobal'](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0x5,_0xd692('0xa2'));_0x2979ae=_0x530c0b[_0xd692('0xa3')];_0x332f0f=_0x530c0b[_0xd692('0x78')];ami[_0xd692('0x25')]('custom:agentbusy',ut[_0xd692('0x73')](_0x1db568,'busy'));rpcDb[_0xd692('0x63')](_0x1db568,'[callProgressDetectingCustomer][logBusy]');_0x327b07[_0xd692('0x75')](_0x1db568,'5',_0x530c0b)[_0xd692('0x5a')](function(_0x43781e){_0x4dcd32=_0x43781e['additional']==0x1;if(!_0x4dcd32){if(ut[_0xd692('0x79')](_0x1db568)>=_0x530c0b['dialGlobalMaxRetry']){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0xf,_0xd692('0x7c'));rpcDb['createCustomerFinal'](_0x38a35a,_0xd692('0xa4'));}else{if(_0x1db568[_0xd692('0xa1')]>=_0x530c0b[_0xd692('0xa5')]){rpcDb[_0xd692('0x66')](_0x1db568,_0xd692('0xa6'));}else{rpcDb[_0xd692('0x7f')](ut[_0xd692('0x80')](_0x1db568,_0xd692('0xa1'),_0x530c0b[_0xd692('0xa3')]),_0x1db568['unlockAgent'],_0x1db568[_0xd692('0x82')]);}}}else{_0x1db568[_0xd692('0xa1')]++;_0x327b07['incrementPreviewCounters']({'id':_0x1db568[_0xd692('0xa7')],'field':{'countbusyretry':_0x1db568[_0xd692('0xa1')]}})['then'](function(){_0x327b07[_0xd692('0x86')](_0x1db568,_0x2979ae,_0x332f0f)['then'](function(){});});}});break;case _0xd692('0xa8'):_0x530c0b[_0xd692('0xa9')]+=0x1;_0x1db568[_0xd692('0xaa')]+=0x1;_0x1db568[_0xd692('0x71')]=ut['totalGlobal'](_0x1db568);ut['logCustomer'](_0x1db568,0x3,_0xd692('0xab'));_0x2979ae=_0x530c0b['dialNoAnswerRetryFrequency'];_0x332f0f=_0x530c0b['callAdditionalPhoneAfterMin'];var _0x320d63=ut[_0xd692('0xac')](_0x1db568,_0x530c0b);ami[_0xd692('0x25')](_0xd692('0xad'),_0x320d63);rpcDb['createCustomerHistory'](_0x1db568,_0xd692('0xae'));_0x327b07[_0xd692('0x75')](_0x1db568,'3',_0x530c0b)['then'](function(_0x2d8f3a){_0x4dcd32=_0x2d8f3a[_0xd692('0x76')]==0x1;if(!_0x4dcd32){if(ut[_0xd692('0x79')](_0x1db568)>=_0x530c0b[_0xd692('0x7a')]){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0xf,'Global');rpcDb[_0xd692('0x66')](_0x38a35a,_0xd692('0xaf'));}else{if(_0x1db568['countnoanswerretry']>=_0x530c0b[_0xd692('0xb0')]){rpcDb[_0xd692('0x66')](_0x1db568,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xd692('0x7f')](ut[_0xd692('0x80')](_0x1db568,'countnoanswerretry',_0x530c0b['dialNoAnswerRetryFrequency']),_0x1db568['unlockAgent'],_0x1db568['activeContact']);}}}else{_0x1db568[_0xd692('0xaa')]++;_0x327b07[_0xd692('0x85')]({'id':_0x1db568[_0xd692('0xa7')],'field':{'countnoanswerretry':_0x1db568['countnoanswerretry']}})['then'](function(){_0x327b07['swapAdditionalPhones'](_0x1db568,_0x2979ae,_0x332f0f)[_0xd692('0x5a')](function(){});});}});break;case _0xd692('0xb1'):_0x530c0b[_0xd692('0xb2')]+=0x1;_0x1db568[_0xd692('0xb3')]+=0x1;_0x1db568[_0xd692('0x71')]=ut[_0xd692('0x79')](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0x8,_0xd692('0xb4'));_0x2979ae=_0x530c0b[_0xd692('0xb5')];_0x332f0f=_0x530c0b['callAdditionalPhoneAfterMin'];ami[_0xd692('0x25')](_0xd692('0xb6'),ut['buildObj'](_0x1db568,_0xd692('0xb7')));rpcDb[_0xd692('0x63')](_0x1db568,'[callProgressDetectingCustomer][logCongestion]');_0x327b07['verifyAdditionalPhones'](_0x1db568,'8',_0x530c0b)[_0xd692('0x5a')](function(_0x664f03){_0x4dcd32=_0x664f03[_0xd692('0x76')]==0x1;if(!_0x4dcd32){if(ut[_0xd692('0x79')](_0x1db568)>=_0x530c0b['dialGlobalMaxRetry']){_0x38a35a=ut['cloneAction'](_0x1db568,0xf,_0xd692('0x7c'));rpcDb[_0xd692('0x66')](_0x38a35a,_0xd692('0xb8'));}else{if(_0x1db568[_0xd692('0xb3')]>=_0x530c0b[_0xd692('0xb9')]){rpcDb[_0xd692('0x66')](_0x1db568,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0xd692('0x80')](_0x1db568,'countcongestionretry',_0x530c0b[_0xd692('0xa3')]),_0x1db568['unlockAgent'],_0x1db568[_0xd692('0x82')]);}}}else{_0x1db568['countcongestionretry']++;_0x327b07[_0xd692('0x85')]({'id':_0x1db568['idContact'],'field':{'countcongestionretry':_0x1db568[_0xd692('0xb3')]}})[_0xd692('0x5a')](function(){_0x327b07[_0xd692('0x86')](_0x1db568,_0x2979ae,_0x332f0f)[_0xd692('0x5a')](function(){});});}});break;case'CANCEL':_0x530c0b[_0xd692('0xba')]+=0x1;_0x1db568['countagentrejectretry']+=0x1;_0x1db568[_0xd692('0x71')]=ut[_0xd692('0x79')](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0x14,'AgentReject');_0x2979ae=_0x530c0b[_0xd692('0xbb')];_0x332f0f=_0x530c0b[_0xd692('0x78')];ami[_0xd692('0x25')](_0xd692('0xbc'),ut[_0xd692('0x73')](_0x1db568,_0xd692('0xbd')));rpcDb['createCustomerHistory'](_0x1db568,_0xd692('0xbe'));_0x327b07['verifyAdditionalPhones'](_0x1db568,'20',_0x530c0b)[_0xd692('0x5a')](function(_0x3b2a14){_0x4dcd32=_0x3b2a14[_0xd692('0x76')]==0x1;if(!_0x4dcd32){if(ut[_0xd692('0x79')](_0x1db568)>=_0x530c0b[_0xd692('0x7a')]){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0x14,_0xd692('0xbf'));rpcDb[_0xd692('0x66')](_0x38a35a,_0xd692('0xc0'));}else{if(_0x1db568[_0xd692('0xc1')]>=_0x530c0b[_0xd692('0xc2')]){rpcDb[_0xd692('0x66')](_0x1db568,_0xd692('0xc0'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1db568,_0xd692('0xc1'),_0x530c0b[_0xd692('0xbb')]),_0x1db568[_0xd692('0x81')],_0x1db568['activeContact']);}}}else{_0x1db568['countnoanswerretry']++;_0x327b07[_0xd692('0x85')]({'id':_0x1db568[_0xd692('0xa7')],'field':{'countnoanswerretry':_0x1db568['countnoanswerretry']}})['then'](function(){_0x327b07[_0xd692('0x86')](_0x1db568,_0x2979ae,_0x332f0f)[_0xd692('0x5a')](function(){});});}});break;case'ABANDONED':_0x530c0b[_0xd692('0xc3')]+=0x1;_0x1db568[_0xd692('0xc4')]+=0x1;_0x1db568[_0xd692('0x71')]=ut[_0xd692('0x79')](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0xb,'Abandoned');rpcDb[_0xd692('0x63')](_0x1db568,_0xd692('0xc5'));_0x327b07['verifyAdditionalPhones'](_0x1db568,'11',_0x530c0b)[_0xd692('0x5a')](function(_0x52f2b3){_0x4dcd32=_0x52f2b3[_0xd692('0x76')]==0x1;if(!_0x4dcd32){if(ut['totalGlobal'](_0x1db568)>=_0x530c0b[_0xd692('0x7a')]){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0xf,_0xd692('0x7c'));rpcDb[_0xd692('0x66')](_0x38a35a,_0xd692('0xc5'));}else{if(_0x1db568[_0xd692('0xc6')]>=_0x530c0b[_0xd692('0xc7')]){rpcDb[_0xd692('0x66')](_0x1db568,_0xd692('0xc5'));}else{rpcDb['rescheduleContact'](ut[_0xd692('0x80')](_0x1db568,_0xd692('0xc4'),_0x530c0b[_0xd692('0xc8')]),_0x1db568['unlockAgent'],_0x1db568[_0xd692('0x82')]);}}}else{_0x1db568[_0xd692('0xaa')]++;_0x327b07[_0xd692('0x85')]({'id':_0x1db568[_0xd692('0xa7')],'field':{'countnoanswerretry':_0x1db568[_0xd692('0xaa')]}})['then'](function(){_0x327b07['swapAdditionalPhones'](_0x1db568,_0x2979ae,_0x332f0f)[_0xd692('0x5a')](function(){});});}});break;case'18':_0x530c0b['outboundUnknownCallsDay']+=0x1;_0x1db568['countmachineretry']+=0x1;_0x1db568['countglobal']=ut['totalGlobal'](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0x12,_0x7355f7['cause-txt']||_0x7355f7[_0xd692('0xc9')]);ami[_0xd692('0x25')]('custom:amd',ut['buildObj'](_0x1db568,_0xd692('0xca')));rpcDb['createCustomerHistory'](_0x1db568,_0xd692('0xcb'));_0x327b07[_0xd692('0x75')](_0x1db568,'18',_0x530c0b)['then'](function(_0x1f2dcb){_0x4dcd32=_0x1f2dcb[_0xd692('0x76')]==0x1;if(!_0x4dcd32){if(ut[_0xd692('0x79')](_0x1db568)>=_0x530c0b['dialGlobalMaxRetry']){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0x12,'Global');rpcDb['createCustomerFinal'](_0x38a35a,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xd692('0x66')](_0x1db568,_0xd692('0xcb'));}}else{_0x1db568[_0xd692('0xaa')]++;_0x327b07[_0xd692('0x85')]({'id':_0x1db568[_0xd692('0xa7')],'field':{'countnoanswerretry':_0x1db568[_0xd692('0xaa')]}})[_0xd692('0x5a')](function(){_0x327b07[_0xd692('0x86')](_0x1db568,_0x2979ae,_0x332f0f)['then'](function(){});});}});delete this[_0xd692('0x17')][_0x7355f7[_0xd692('0x83')]];break;case'19':_0x530c0b['outboundUnknownCallsDay']+=0x1;_0x1db568[_0xd692('0x71')]=ut[_0xd692('0x79')](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0x13,_0x7355f7[_0xd692('0xcc')]||_0x7355f7['dialstatus']);ami['emit'](_0xd692('0xcd'),ut['buildObj'](_0x1db568,'amd'));rpcDb[_0xd692('0x63')](_0x1db568,_0xd692('0xce'));_0x327b07[_0xd692('0x75')](_0x1db568,'18',_0x530c0b)[_0xd692('0x5a')](function(_0x30a2e9){_0x4dcd32=_0x30a2e9['additional']==0x1;if(!_0x4dcd32){if(ut['totalGlobal'](_0x1db568)>=_0x530c0b[_0xd692('0x7a')]){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0xf,_0xd692('0x7c'));rpcDb[_0xd692('0x66')](_0x38a35a,_0xd692('0xce'));}else{rpcDb[_0xd692('0x66')](_0x1db568,_0xd692('0xce'));}}else{_0x1db568[_0xd692('0xaa')]++;_0x327b07[_0xd692('0x85')]({'id':_0x1db568[_0xd692('0xa7')],'field':{'countnoanswerretry':_0x1db568[_0xd692('0xaa')]}})['then'](function(){_0x327b07[_0xd692('0x86')](_0x1db568,_0x2979ae,_0x332f0f)[_0xd692('0x5a')](function(){});});}});delete this['actions'][_0x7355f7[_0xd692('0x83')]];break;default:if(_0x1db568['dialAnswer']){ut[_0xd692('0x4d')](_0x530c0b,_0xd692('0xcf'));ut[_0xd692('0x4e')](_0xd692('0xd0')+_0x530c0b[_0xd692('0x2a')],_0x7355f7);}_0x530c0b[_0xd692('0xd1')]+=0x1;_0x1db568['countglobal']=ut['totalGlobal'](_0x1db568);ut[_0xd692('0x5f')](_0x1db568,0xc,_0x7355f7[_0xd692('0xcc')]||_0x7355f7['dialstatus']);_0x2979ae=_0x530c0b['dialAgentRejectRetryFrequency'];_0x332f0f=_0x530c0b['callAdditionalPhoneAfterMin'];rpcDb[_0xd692('0x63')](_0x1db568,_0xd692('0xd2'));_0x327b07['verifyAdditionalPhones'](_0x1db568,'20',_0x530c0b)['then'](function(_0x45cfdb){_0x4dcd32=_0x45cfdb[_0xd692('0x76')]==0x1;if(!_0x4dcd32){if(ut[_0xd692('0x79')](_0x1db568)>=_0x530c0b[_0xd692('0x7a')]){_0x38a35a=ut[_0xd692('0x7b')](_0x1db568,0xf,_0xd692('0x7c'));rpcDb[_0xd692('0x66')](_0x38a35a,_0xd692('0xd3'));}else{rpcDb['createCustomerFinal'](_0x1db568,_0xd692('0xd3'));}delete this['actions'][_0x7355f7[_0xd692('0x83')]];}else{_0x327b07['swapAdditionalPhones'](_0x1db568,_0x2979ae,_0x332f0f)[_0xd692('0x5a')](function(){});}});}if(!(_0x1db568['dialAnswer']&&_0x5ec941==='16')){ut[_0xd692('0x4b')](_0x530c0b,_0xd692('0xd4'));logger[_0xd692('0x26')](_0xd692('0xd5'),_0x1db568[_0xd692('0x8c')],'\x20Queue',_0x530c0b[_0xd692('0x2a')],'originated:\x20',_0x530c0b[_0xd692('0x2e')]);}if(_0x5ec941!==_0xd692('0x87')){delete this['actions'][_0x7355f7[_0xd692('0x83')]];delete this[_0xd692('0x17')][_0x7355f7['destlinkedid']];}_0x530c0b[_0xd692('0xd6')]=!![];}};Preview[_0xd692('0xf')][_0xd692('0xd7')]=function(_0x27d2a0,_0x3e2919,_0x250aff){if(_[_0xd692('0xd8')](_0x3e2919)&&_0xd692('0xd9')!==typeof _0x3e2919){return;}if(_[_0xd692('0xd8')](_0x250aff)&&'object'!==typeof _0x250aff){return;}switch(_0x250aff[_0xd692('0xda')]){case'0':ut[_0xd692('0xdb')](_0x27d2a0,0x0,_0xd692('0xdc'));rpcDb['createAgentHistory'](_0x27d2a0,_0xd692('0xdd'));break;case'3':ut[_0xd692('0xdb')](_0x27d2a0,0x3,'NoAnswer');rpcDb[_0xd692('0xde')](_0x27d2a0,_0xd692('0xdf'));break;case'5':ut['logAgent'](_0x27d2a0,0x5,_0xd692('0xa2'));rpcDb[_0xd692('0xde')](_0x27d2a0,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xd692('0xdb')](_0x27d2a0,0x8,_0xd692('0xb4'));rpcDb['createAgentHistory'](_0x27d2a0,_0xd692('0xe0'));break;case'22':ut[_0xd692('0xdb')](_0x27d2a0,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x27d2a0,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x27d2a0,0xc,_0x250aff[_0xd692('0xda')]);rpcDb[_0xd692('0xde')](_0x27d2a0,_0xd692('0xe0'));}ut['updateOriginated'](_0x3e2919,_0xd692('0xe1'));logger[_0xd692('0x26')]('[originated][decrement][callProgressDetectingAgent]',_0x27d2a0[_0xd692('0x8c')],_0xd692('0x9f'),_0x3e2919[_0xd692('0x2a')],_0xd692('0xe2'),_0x3e2919[_0xd692('0x2e')]);delete this['actions'][_0x27d2a0[_0xd692('0x8c')]];};Preview[_0xd692('0xf')][_0xd692('0x75')]=function(_0x24e9e4,_0x1fe755,_0x2b1594){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x24e9e4,_0x1fe755,_0x2b1594)[_0xd692('0x49')](logger[_0xd692('0x26')](_0xd692('0xe3')));};Preview[_0xd692('0xf')][_0xd692('0x86')]=function(_0x34852e,_0x1c1be7,_0x38b9e5){return cmHopperAdditionalPhone[_0xd692('0x86')](_0x34852e,_0x1c1be7,_0x38b9e5)[_0xd692('0x49')](logger[_0xd692('0x26')](_0xd692('0xe4')));};Preview[_0xd692('0xf')][_0xd692('0x85')]=function(_0x4355bf){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xd692('0x85')](_0x4355bf))[_0xd692('0x49')](logger['info']('[incrementPreviewCounters]\x20'));};Preview[_0xd692('0xf')][_0xd692('0xe5')]=function(_0x53ae87,_0x1925c4,_0xd1e1a8,_0x536ab1,_0x589c2c){var _0x4432f6=this;return new Promise(function(_0x1ff82e,_0x3ebd6d){if(_[_0xd692('0x41')](_0x1925c4)||_['isNil'](_0x1925c4[_0xd692('0xe6')])||_['isNil'](_0x1925c4['phone'])||_[_0xd692('0x41')](_0x1925c4['VoiceQueueId'])){_0x3ebd6d(ut['message']('Contact\x20is\x20undefined',_0x536ab1,_0x589c2c));return;}var _0x4541c1=uuid['v4']();var _0xf44174=_0x4432f6[_0xd692('0x14')][_0x1925c4[_0xd692('0x42')][_0xd692('0x2a')]];var _0x2cdeeb=_0xd1e1a8?_0x4432f6[_0xd692('0x18')][_0xd1e1a8]['id']:undefined;_0x4432f6[_0xd692('0x17')][_0x4541c1]=new Action(_0x1925c4,_0xf44174,_0x4541c1,_0xd1e1a8,_0x2cdeeb);var _0x41591a=_0x4432f6[_0xd692('0x17')][_0x4541c1];_0x41591a[_0xd692('0x81')]=_0x536ab1;_0x41591a['activeContact']=_0x589c2c;_0x41591a[_0xd692('0xe7')]=_0xd1e1a8;if(_[_0xd692('0xe8')](_0x53ae87)){_0x4432f6[_0xd692('0xe9')](_0x41591a,_0xf44174,_0x1925c4,_0xd1e1a8)[_0xd692('0x5a')](function(_0x9a13b7){logger['info'](_0xd692('0xea'),'Queue:\x20'+_0x41591a[_0xd692('0x43')]+_0xd692('0xeb')+_0x41591a[_0xd692('0xa7')],JSON[_0xd692('0x28')](_0x9a13b7));ami[_0xd692('0x25')](_0xd692('0xec'),ut[_0xd692('0x73')](_0x41591a,_0xd692('0xed'),_0x4432f6[_0xd692('0x14')][_0x41591a[_0xd692('0x43')]]));_0x1ff82e(ut[_0xd692('0x32')]('Calling'));})[_0xd692('0x49')](function(_0xed459c){ut[_0xd692('0x34')](_0xd692('0xee'),_0xed459c);_0x3ebd6d(ut[_0xd692('0x32')]('Call\x20failed',_0x536ab1,_0x589c2c));});}else{_0xf44174[_0xd692('0xef')]+=0x1;ut[_0xd692('0xf0')](_0x41591a);rpcDb[_0xd692('0xf1')](_0x41591a,_0xd692('0xf2'));delete _0x4432f6['actions'][_0x4541c1];_0x3ebd6d(ut[_0xd692('0x32')]('Contact\x20in\x20black\x20List',_0x536ab1,_0x589c2c));}});};Preview[_0xd692('0xf')][_0xd692('0x6b')]=function(_0x2b06ec){return!_['isNil'](_0x2b06ec)&&!_[_0xd692('0x41')](_0x2b06ec['name'])&&!_[_0xd692('0x41')](_0x2b06ec[_0xd692('0xf3')])&&_0x2b06ec[_0xd692('0xf3')]&&!_[_0xd692('0x41')](this[_0xd692('0x16')][util['format']('SIP/%s',_0x2b06ec['name'])])&&!_[_0xd692('0x41')](this[_0xd692('0x16')][util[_0xd692('0x5d')](_0xd692('0xf4'),_0x2b06ec['name'])][_0xd692('0x47')])&&(this[_0xd692('0x16')][util['format']('SIP/%s',_0x2b06ec[_0xd692('0x2a')])][_0xd692('0x47')]==='reachable'||this[_0xd692('0x16')][util[_0xd692('0x5d')]('SIP/%s',_0x2b06ec[_0xd692('0x2a')])]['status']===_0xd692('0xf5'));};Preview['prototype'][_0xd692('0x59')]=function(_0x517e4b,_0xbb8008){return this[_0xd692('0xf6')](_0x517e4b,_0xbb8008)[_0xd692('0x5a')](function(_0x3e6b3c){return _[_0xd692('0x44')](_0x3e6b3c,[_0xd692('0x32')]);})[_0xd692('0x49')](function(_0x1b9c93){if(_0x1b9c93[_0xd692('0xf7')]){rpcDb[_0xd692('0xf8')](_0x517e4b);}if(_0x1b9c93[_0xd692('0xf3')]){rpcDb[_0xd692('0xf9')](_0x517e4b);}throw _[_0xd692('0x44')](_0x1b9c93,[_0xd692('0x32')]);});};Preview[_0xd692('0xf')][_0xd692('0xf6')]=function(_0x38360b,_0x333bac){var _0x41d1ba=this;var _0x182a2d,_0x2e5da0;return rpcDb[_0xd692('0xfa')](_0x38360b)[_0xd692('0x5a')](function(_0x560547){if(!_[_0xd692('0x41')](_0x560547[0x0])){_0x2e5da0=_0x560547[0x0]['recallme']?![]:!![];_0x182a2d=_0x560547[0x0][_0xd692('0xfb')]?!![]:![];_0x182a2d=_0x333bac?!![]:_0x182a2d;}var _0x341a0f=_0x41d1ba[_0xd692('0xfc')](_0x560547);if(_0x341a0f['isValid']){rpcDb['checkIsBlackList'](_[_0xd692('0x44')](_0x560547[0x0],[_0xd692('0xfd'),_0xd692('0xfe')]))[_0xd692('0x5a')](function(_0x1e9a76){_0x41d1ba[_0xd692('0xe5')](_0x1e9a76,_0x560547[0x0],_0x333bac,_0x2e5da0,_0x182a2d)[_0xd692('0x5a')](function(_0x13ada0){return _0x13ada0;})[_0xd692('0x49')](function(_0x2c1ae5){throw _0x2c1ae5;});})[_0xd692('0x49')](function(_0x19e6b0){ut[_0xd692('0x34')](_0xd692('0xff'),_0x19e6b0);throw ut[_0xd692('0x32')]('Call\x20unsuccessful',_0x2e5da0,_0x182a2d);});}else{throw ut['message'](_0x341a0f[_0xd692('0x32')],_0x2e5da0,_0x182a2d);}})[_0xd692('0x49')](function(_0x3f39ac){ut['logger'](_0xd692('0x100'),_0x3f39ac);throw ut[_0xd692('0x32')](_0xd692('0x101'),![],!![]);});};Preview[_0xd692('0xf')][_0xd692('0xfc')]=function(_0xfd9e59){if(_[_0xd692('0x41')](_0xfd9e59)||_[_0xd692('0xe8')](_0xfd9e59)||!_[_0xd692('0x41')](_0xfd9e59[0x0][_0xd692('0x58')])&&_['isNil'](_0xfd9e59[0x0][_0xd692('0x58')][_0xd692('0x2a')])){ut['logger'](_0xd692('0x102'),_0xfd9e59);return{'isValid':![],'message':_0xd692('0x103')};}var _0x4d8643=this[_0xd692('0x14')][_0xfd9e59[0x0]['Queue'][_0xd692('0x2a')]];_0x4d8643['message']=utils[_0xd692('0x33')][_0xd692('0x6f')];if(_[_0xd692('0x41')](_0x4d8643)){ut[_0xd692('0x34')]('[Preview][validateContact][Empty\x20Campaign]',_0x4d8643);return{'isValid':![],'message':_0xd692('0x104')};}if(!this[_0xd692('0x6b')](_0x4d8643[_0xd692('0x6c')])){ut[_0xd692('0x34')](_0xd692('0x105'),_0xd692('0x106')+_0x4d8643[_0xd692('0x2a')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xd692('0x6b')](_0x4d8643[_0xd692('0x6d')])){ut[_0xd692('0x34')](_0xd692('0x105'),_0x4d8643[_0xd692('0x2a')]+_0xd692('0x107'));return{'isValid':![],'message':_0xd692('0x108')};}}if(!ut[_0xd692('0x109')](_0x4d8643[_0xd692('0x3e')])){ut[_0xd692('0x34')](_0xd692('0x10a'),_0x4d8643[_0xd692('0x2a')]+_0xd692('0x10b'));return{'isValid':![],'message':_0xd692('0x106')+_0x4d8643[_0xd692('0x2a')]+_0xd692('0x10b')};}return{'isValid':!![],'message':_0xd692('0x10c')};};Preview['prototype'][_0xd692('0xe9')]=function(_0x3ef654,_0x26239c,_0x4c9ac1,_0x4dbf9b){var _0x3b34b7=this;return new Promise(function(_0x5f11e8,_0x16914b){var _0x7e35c2=_0x3ef654[_0xd692('0x8c')];var _0x59c85c=_0x3b34b7[_0xd692('0x6b')](_0x26239c[_0xd692('0x6c')])?util['format'](_0xd692('0x10d'),_0x26239c[_0xd692('0x6c')][_0xd692('0x2a')],_[_0xd692('0x41')](_0x26239c[_0xd692('0x10e')])?'':_0x26239c[_0xd692('0x10e')][_0xd692('0x10f')]()||'',_0x26239c[_0xd692('0x110')]>0x0?_0x4c9ac1[_0xd692('0xfe')][_0xd692('0x111')](_0x26239c[_0xd692('0x110')]):_0x4c9ac1[_0xd692('0xfe')]):util[_0xd692('0x5d')]('SIP/%s/%s%s',_[_0xd692('0x41')](_0x26239c[_0xd692('0x6d')])?_0x26239c[_0xd692('0x6c')][_0xd692('0x2a')]:_0x26239c[_0xd692('0x6d')][_0xd692('0x2a')],_['isNil'](_0x26239c['dialPrefix'])?'':_0x26239c[_0xd692('0x10e')]['trim']()||'',_0x26239c[_0xd692('0x110')]>0x0?_0x4c9ac1[_0xd692('0xfe')][_0xd692('0x111')](_0x26239c[_0xd692('0x110')]):_0x4c9ac1[_0xd692('0xfe')]);var _0x3e79ee=_0x3b34b7[_0xd692('0x6b')](_0x26239c[_0xd692('0x6c')])?ut[_0xd692('0x112')](_0x26239c[_0xd692('0x6c')][_0xd692('0x113')],_0x26239c[_0xd692('0x114')],_0x26239c[_0xd692('0x115')]>0x0?ut['getCallerIdRandom'](_0x26239c[_0xd692('0x116')],_0x26239c[_0xd692('0x115')]):_0x26239c[_0xd692('0x116')]):ut[_0xd692('0x112')](_[_0xd692('0x41')](_0x26239c['TrunkBackup'])?_0x26239c[_0xd692('0x6c')]['callerid']:_0x26239c[_0xd692('0x6d')]['callerid'],_0x26239c[_0xd692('0x114')],_0x26239c[_0xd692('0x115')]>0x0?ut[_0xd692('0x117')](_0x26239c[_0xd692('0x116')],_0x26239c[_0xd692('0x115')]):_0x26239c[_0xd692('0x116')]);if(_0x3e79ee){_0x3ef654['originatecalleridname']=ut[_0xd692('0x118')](_0x3e79ee);_0x3ef654[_0xd692('0x119')]=ut[_0xd692('0x11a')](_0x3e79ee);}var _0x2071ff=ut[_0xd692('0x11b')](_0x26239c,_0x4c9ac1,_0x59c85c,_0x3e79ee,_0x7e35c2,_0x3ef654);var _0x383095=utils['setXMDContactVariables'](_0x4c9ac1[_0xd692('0xe6')]);Object[_0xd692('0x11c')](_0x2071ff,_0x383095);_[_0xd692('0x11d')](_0x3ef654,ut[_0xd692('0x11e')](_0x2071ff));_0x3ef654[_0xd692('0x11f')]=moment()[_0xd692('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x26239c['variables']=_0x2071ff;var _0x48afa6=ut[_0xd692('0x120')](_0x3ef654,_0x26239c,_0x2071ff,_0x3ef654['activeContact'],_0x4dbf9b);return ami[_0xd692('0x121')](_0x48afa6)[_0xd692('0x5a')](function(_0x2c1507){_0x26239c[_0xd692('0x2e')]+=0x1;logger[_0xd692('0x26')](_0xd692('0x122'),_0x7e35c2,_0xd692('0x9f'),_0x26239c[_0xd692('0x2a')],'originated:\x20',_0x26239c[_0xd692('0x2e')]);_0x5f11e8(_0x2c1507);})[_0xd692('0x49')](function(_0x3d7e1c){ut['logAgent'](_0x3ef654,0xe,_0xd692('0x123'));rpcDb[_0xd692('0xde')](_0x3ef654,_0xd692('0x124'));_0x16914b(_0x3d7e1c);});});};Preview[_0xd692('0xf')][_0xd692('0x125')]=function(_0x5d5e03){if(this[_0xd692('0x17')][_0x5d5e03[_0xd692('0x83')]]){this[_0xd692('0x17')][_0x5d5e03[_0xd692('0x83')]][_0xd692('0x48')]=_0x5d5e03['channel'];}};Preview[_0xd692('0xf')][_0xd692('0x1b')]=function(_0x1db0e4){var _0x569f2f=this;var _0x5c5d32=this[_0xd692('0x17')][_0x1db0e4[_0xd692('0x126')]];if(_0x5c5d32){if(_0x5c5d32[_0xd692('0xe7')]&&this[_0xd692('0x18')][_0x5c5d32['lookAgent']]){ut[_0xd692('0x127')](_0x5c5d32,this[_0xd692('0x18')][_0x5c5d32[_0xd692('0xe7')]]['name'],this[_0xd692('0x18')][_0x5c5d32[_0xd692('0xe7')]]['id']);}var _0x5d3175=_[_0xd692('0x128')](_0x5c5d32);_0x5d3175[_0xd692('0x88')]=moment()[_0xd692('0x5d')](_0xd692('0x5e'));var _0xb6f7ae=_0x569f2f['campaignsPreview'][_0x5c5d32['queue']];if(ut[_0xd692('0x129')](_0x1db0e4[_0xd692('0x12a')])){if(_0x5c5d32[_0xd692('0x81')]){rpcDb[_0xd692('0xf8')](_0x5c5d32['idContact']);}if(_0x5c5d32[_0xd692('0x82')]){rpcDb[_0xd692('0xf9')](_0x5c5d32[_0xd692('0xa7')]);}ami[_0xd692('0x25')]('custom:agentringnoanswer',ut[_0xd692('0x73')](_0x5c5d32,_0xd692('0x12b'),this['campaignsPreview'][_0x5c5d32[_0xd692('0x43')]]));this[_0xd692('0xd7')](_0x5d3175,_0xb6f7ae,_0x1db0e4);}else{_0x5c5d32[_0xd692('0x11f')]=moment()[_0xd692('0x5d')](_0xd692('0x5e'));ut['logAgent'](_0x5d3175,0x4,_0xd692('0x98'));rpcDb[_0xd692('0xde')](_0x5d3175,_0xd692('0x12c'));}}};Preview['prototype'][_0xd692('0x12d')]=function(_0xd0f6d4){var _0x239a47=this[_0xd692('0x17')][_0xd0f6d4[_0xd692('0x83')]];var _0x3a4e5d;if(_0x239a47){_0x3a4e5d=this['campaignsPreview'][_0x239a47[_0xd692('0x43')]];logger[_0xd692('0x26')](_0xd692('0x12e'),_0xd0f6d4['linkedid'],_0xd692('0x9f'),_0x3a4e5d[_0xd692('0x2a')],_0xd692('0x8d'),_0x3a4e5d[_0xd692('0x2f')]);}if(this[_0xd692('0x17')][_0xd0f6d4['linkedid']]&&_0xd0f6d4[_0xd692('0x83')]!==_0xd0f6d4[_0xd692('0x8c')]){if(_0xd0f6d4['cause']==='16'&&this['actions'][_0xd0f6d4[_0xd692('0x83')]][_0xd692('0x8a')]){this[_0xd692('0x12f')](_0xd0f6d4,_0xd0f6d4[_0xd692('0x83')],_0xd0f6d4['cause']);}else if(this[_0xd692('0x17')][_0xd0f6d4[_0xd692('0x83')]][_0xd692('0x8a')]){logger[_0xd692('0x26')](_0xd692('0x130'),_0xd0f6d4[_0xd692('0x83')],_0xd0f6d4[_0xd692('0x131')],_0xd692('0x9f'),_0x3a4e5d[_0xd692('0x2a')],_0xd692('0x8d'),_0x3a4e5d[_0xd692('0x2f')]);this[_0xd692('0x12f')](_0xd0f6d4,_0xd0f6d4['linkedid'],_0xd0f6d4['cause']);}}else if(_0x239a47&&_[_0xd692('0x41')](_0x239a47['statedesc'])&&_0x3a4e5d['dialQueueProject']&&_0xd0f6d4[_0xd692('0x83')]===_0xd0f6d4[_0xd692('0x8c')]&&_['isNil'](_0xd0f6d4['reason'])&&_0xd0f6d4[_0xd692('0x131')]==='16'&&_0xd0f6d4[_0xd692('0x132')]==='6'&&_['isUndefined'](_0x239a47[_0xd692('0x133')])){if(_0x239a47[_0xd692('0x81')]){rpcDb[_0xd692('0xf8')](_0x239a47['idContact']);}if(_0x239a47['activeContact']){rpcDb[_0xd692('0xf9')](_0x239a47[_0xd692('0xa7')]);}_0xd0f6d4[_0xd692('0xda')]='22';this['callProgressDetectingAgent'](_0x239a47,_0x3a4e5d,_0xd0f6d4);}else if(_0x239a47&&_0x239a47[_0xd692('0x133')]){if(_0xd0f6d4[_0xd692('0x131')]==='16'&&this[_0xd692('0x17')][_0xd0f6d4[_0xd692('0x83')]][_0xd692('0x8a')]){logger[_0xd692('0x26')](_0xd692('0x134'),_0xd0f6d4[_0xd692('0x83')],_0xd0f6d4['cause'],_0xd692('0x9f'),_0x3a4e5d[_0xd692('0x2a')],_0xd692('0x8d'),_0x3a4e5d['pTalking']);this['callProgressDetectingCustomer'](_0xd0f6d4,_0xd0f6d4['linkedid'],_0xd0f6d4['cause']);}else if(this[_0xd692('0x17')][_0xd0f6d4[_0xd692('0x83')]]['dialAnswer']){logger[_0xd692('0x26')]('[syncHangup][talking][cause]',_0xd0f6d4['linkedid'],_0xd0f6d4['cause'],_0xd692('0x9f'),_0x3a4e5d['name'],_0xd692('0x8d'),_0x3a4e5d['pTalking']);this[_0xd692('0x12f')](_0xd0f6d4,_0xd0f6d4[_0xd692('0x83')],_0xd0f6d4[_0xd692('0x131')]);}}};Preview[_0xd692('0xf')][_0xd692('0x135')]=function(_0x49b802){if(this[_0xd692('0x17')][_0x49b802[_0xd692('0x136')]]&&_0x49b802[_0xd692('0x136')]!==_0x49b802[_0xd692('0x137')]){this['callProgressDetectingCustomer'](_0x49b802,_0x49b802[_0xd692('0x136')],_0x49b802['dialstatus']);}};Preview['prototype'][_0xd692('0x1f')]=function(_0x2d5972){if(this[_0xd692('0x17')][_0x2d5972[_0xd692('0x83')]]&&_0x2d5972[_0xd692('0x83')]!==_0x2d5972[_0xd692('0x8c')]&&!this['actions'][_0x2d5972[_0xd692('0x83')]]['dialAnswer']){if(_0x2d5972[_0xd692('0x131')]==='1'){this[_0xd692('0x12f')](_0x2d5972,_0x2d5972[_0xd692('0x83')],_0x2d5972['cause']);}}};Preview[_0xd692('0xf')][_0xd692('0x138')]=function(_0xc760a4,_0x36af47,_0x3c0bcd){if(this[_0xd692('0x17')][_0xc760a4]){if(_[_0xd692('0x41')](this[_0xd692('0x17')][_0xc760a4][_0xd692('0x139')])){this[_0xd692('0x17')][_0xc760a4][_0xd692('0x139')]={};}this['actions'][_0xc760a4][_0xd692('0x139')][_0x36af47]=_0x3c0bcd;}};Preview[_0xd692('0xf')][_0xd692('0x22')]=function(_0x3a3cb8){try{if(!_[_0xd692('0x41')](_0x3a3cb8)){if(ut[_0xd692('0x13a')](_[_0xd692('0x13b')](_0x3a3cb8[_0xd692('0x13c')])[0x0])){this[_0xd692('0x138')](_0x3a3cb8[_0xd692('0x8c')],_[_0xd692('0x13b')](_0x3a3cb8[_0xd692('0x13c')])[0x0],_0x3a3cb8['value']);}}}catch(_0x3653b7){logger[_0xd692('0x13d')]('[syncVarSet][Preview]',util[_0xd692('0x13e')](_0x3653b7,{'showHidden':![],'depth':null}));}};Preview[_0xd692('0xf')]['syncAttendedTransfer']=function(_0x3e2ab2){if(_0x3e2ab2){if(this[_0xd692('0x17')][_0x3e2ab2[_0xd692('0x13f')]]){this[_0xd692('0x17')][_0x3e2ab2['transfertargetlinkedid']][_0xd692('0x133')]=!![];}}};Preview[_0xd692('0xf')][_0xd692('0x24')]=function(_0x1e9967){if(_0x1e9967){if(this['actions'][_0x1e9967['transfererlinkedid']]){this[_0xd692('0x17')][_0x1e9967[_0xd692('0x140')]][_0xd692('0x133')]=!![];}}};module[_0xd692('0x141')]=Preview;
\ No newline at end of file
+var _0xf213=['countcongestionretry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','run','execRun','pick','unlockContact','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','variables','variablesAction','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncDialEnd','keys','variable','addVariable','inspect','syncBlindTransfer','transfererlinkedid','util','lodash','uuid','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','emit','info','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','prototype','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','ListId','Action','status','channel','catch','message','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','format','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay'];(function(_0x2834ce,_0x221c08){var _0x4249ca=function(_0x236322){while(--_0x236322){_0x2834ce['push'](_0x2834ce['shift']());}};_0x4249ca(++_0x221c08);}(_0xf213,0x84));var _0x3f21=function(_0x30df08,_0x5292bc){_0x30df08=_0x30df08-0x0;var _0x3a5535=_0xf213[_0x30df08];return _0x3a5535;};'use strict';var util=require(_0x3f21('0x0'));var _=require(_0x3f21('0x1'));var uuid=require(_0x3f21('0x2'));var moment=require('moment');var Redis=require(_0x3f21('0x3'));var config=require('../../../config/environment');var logger=require(_0x3f21('0x4'))(_0x3f21('0x5'));var loggerAction=require(_0x3f21('0x4'))(_0x3f21('0x6'));var ami=require(_0x3f21('0x7'));var rpcDb=require(_0x3f21('0x8'));var cmHopperAdditionalPhone=require(_0x3f21('0x9'));var Action=require(_0x3f21('0xa'));var ut=require(_0x3f21('0xb'));var utils=require(_0x3f21('0xc'));config[_0x3f21('0xd')]=_[_0x3f21('0xe')](config[_0x3f21('0xd')],{'host':_0x3f21('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f21('0xd')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x27de67){this[_0x3f21('0x10')]=this[_0x3f21('0x10')]?this[_0x3f21('0x10')][_0x3f21('0x11')](_0x27de67):_0x27de67();};function Preview(_0x5d8952){this[_0x3f21('0x12')]=new Sequence();this[_0x3f21('0x13')]=_0x5d8952['voiceQueues'];this[_0x3f21('0x14')]=_0x5d8952[_0x3f21('0x14')];this[_0x3f21('0x15')]={};this[_0x3f21('0x16')]=_0x5d8952['agents'];this[_0x3f21('0x17')]=0x0;ami['on'](_0x3f21('0x18'),this['syncOriginateResponse'][_0x3f21('0x19')](this));ami['on']('hangup',this[_0x3f21('0x1a')][_0x3f21('0x19')](this));ami['on'](_0x3f21('0x1b'),this[_0x3f21('0x1c')]['bind'](this));ami['on'](_0x3f21('0x1d'),this['syncDialEnd']['bind'](this));ami['on'](_0x3f21('0x1e'),this[_0x3f21('0x1f')][_0x3f21('0x19')](this));ami['on']('varset',this[_0x3f21('0x20')][_0x3f21('0x19')](this));ami['on'](_0x3f21('0x21'),this[_0x3f21('0x22')][_0x3f21('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x3f21('0x19')](this));this[_0x3f21('0x23')](this[_0x3f21('0x13')]);}function emit(_0x170231,_0x2e022e,_0x379102){io['to'](_0x170231)[_0x3f21('0x24')](_0x2e022e,_0x379102);}function emitVoiceQueueChannelRemove(_0x3a53f5){logger[_0x3f21('0x25')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x3f21('0x26')](_0x3a53f5));emit(util['format'](_0x3f21('0x27'),_0x3a53f5[_0x3f21('0x28')]),_0x3f21('0x29'),_0x3a53f5);io['emit'](_0x3f21('0x2a'),_0x3a53f5);}function notSendMessagesQueue(_0x55b0b5){if(_0x55b0b5[_0x3f21('0x2b')]){if(_0x55b0b5[_0x3f21('0x2c')]===0x0&&_0x55b0b5[_0x3f21('0x2d')]===0x0){_0x55b0b5[_0x3f21('0x2b')]=![];_0x55b0b5[_0x3f21('0x2e')]=0x0;_0x55b0b5[_0x3f21('0x2f')]=0x0;_0x55b0b5['message']=utils[_0x3f21('0x30')][_0x3f21('0x31')];ut[_0x3f21('0x32')](_0x3f21('0x33'),_0x55b0b5[_0x3f21('0x28')]+'\x20is\x20not\x20active');}else{_0x55b0b5['message']=utils[_0x3f21('0x30')][_0x3f21('0x34')];ut[_0x3f21('0x32')](_0x3f21('0x33'),_0x55b0b5['name']+_0x3f21('0x35'));}}}Preview[_0x3f21('0x36')][_0x3f21('0x23')]=function(){var _0x8f50d7=this;setInterval(function(){_0x8f50d7[_0x3f21('0x37')]();},0x7cf);};Preview[_0x3f21('0x36')]['syncCampaigns']=function(){var _0x27a8b3=this[_0x3f21('0x13')];this[_0x3f21('0x17')]+=0x1;for(var _0x4253a7 in _0x27a8b3){if(_0x27a8b3[_0x3f21('0x38')](_0x4253a7)&&(_0x27a8b3[_0x4253a7][_0x3f21('0x39')]===_0x3f21('0x5')||_0x27a8b3[_0x4253a7]['dialMethod']===_0x3f21('0x3a'))&&_0x27a8b3[_0x4253a7][_0x3f21('0x3b')]===_0x3f21('0x3c')){if(this['clockClearZombieChannels']>0x7){this[_0x3f21('0x17')]=0x0;this[_0x3f21('0x3d')]();}}if(_0x27a8b3[_0x3f21('0x38')](_0x4253a7)&&_0x27a8b3[_0x4253a7]['dialMethod']===_0x3f21('0x5')&&_0x27a8b3[_0x4253a7][_0x3f21('0x3b')]==='outbound'){if(_0x27a8b3[_0x4253a7]['dialActive']){this[_0x3f21('0x3e')](_0x27a8b3[_0x4253a7]);if(_0x27a8b3[_0x4253a7][_0x3f21('0x3f')])this[_0x3f21('0x40')](_0x27a8b3[_0x4253a7]);}else{notSendMessagesQueue(_0x27a8b3[_0x4253a7]);}}}};Preview[_0x3f21('0x36')][_0x3f21('0x41')]=function(_0x229568){var _0x535264=this;this[_0x3f21('0x12')][_0x3f21('0x42')](function(){if(!_[_0x3f21('0x43')](_0x535264[_0x3f21('0x15')][_0x229568])){loggerAction[_0x3f21('0x25')](_0x3f21('0x44'),_0x229568,_0x3f21('0x45'),_0x535264['actions'][_0x229568][_0x3f21('0x46')],_0x3f21('0x47'),JSON[_0x3f21('0x26')](_0x535264[_0x3f21('0x13')][_0x535264['actions'][_0x229568]['queue']][_0x3f21('0x2c')]),_0x3f21('0x48'),JSON[_0x3f21('0x26')](_0x535264['campaignsPreview'][_0x535264[_0x3f21('0x15')][_0x229568][_0x3f21('0x46')]][_0x3f21('0x2d')]),JSON[_0x3f21('0x26')](_0x535264[_0x3f21('0x15')][_0x229568][_0x3f21('0x49')]),JSON[_0x3f21('0x26')](_['pick'](_0x535264[_0x3f21('0x15')][_0x229568],['contactId',_0x3f21('0x4a'),'VoiceQueueId',_0x3f21('0x4b')])));return ami[_0x3f21('0x4c')]({'action':_0x3f21('0x4d'),'channel':_0x535264[_0x3f21('0x15')][_0x229568][_0x3f21('0x4e')]})[_0x3f21('0x4f')](function(_0x4c4e42){if(_0x4c4e42[_0x3f21('0x50')]===_0x3f21('0x51')){setTimeout(function(){if(_0x535264['actions'][_0x229568]){ut[_0x3f21('0x52')](_0x535264[_0x3f21('0x13')][_0x535264['actions'][_0x229568][_0x3f21('0x46')]],_0x3f21('0x53'));if(_0x535264[_0x3f21('0x15')][_0x229568][_0x3f21('0x49')]===!![]){ut['decrementTalkink'](_0x535264[_0x3f21('0x13')][_0x535264[_0x3f21('0x15')][_0x229568]['queue']],_0x3f21('0x53'));ut['loggerError'](_0x3f21('0x54')+_0x229568,_0x535264[_0x3f21('0x15')][_0x229568][_0x3f21('0x46')]);}ut[_0x3f21('0x55')](_0x3f21('0x56')+_0x229568,_0x535264[_0x3f21('0x15')][_0x229568][_0x3f21('0x46')]);delete _0x535264[_0x3f21('0x15')][_0x229568];}},0x2328);}});}});};Preview[_0x3f21('0x36')][_0x3f21('0x3d')]=function(){var _0x585116=this;loggerAction[_0x3f21('0x25')](_0x3f21('0x57'),_[_0x3f21('0x58')](this[_0x3f21('0x15')]));for(var _0x1bc4b7 in this[_0x3f21('0x15')]){if(_0x585116[_0x3f21('0x15')][_0x3f21('0x38')](_0x1bc4b7)){_0x585116[_0x3f21('0x41')](_0x1bc4b7);}}};Preview['prototype'][_0x3f21('0x40')]=function(_0xb0b2dd){var _0x5c68d9=this;rpcDb[_0x3f21('0x59')](_0xb0b2dd['id'],ut[_0x3f21('0x5a')](this[_0x3f21('0x16')]))[_0x3f21('0x5b')](function(_0x518891){if(!_['isNil'](_0x518891)){for(var _0x592d5c=0x0;_0x592d5c<_0x518891[_0x3f21('0x5c')];_0x592d5c+=0x1){if(ut[_0x3f21('0x5d')](_0x518891[_0x592d5c][_0x3f21('0x5e')])<_0xb0b2dd[_0x3f21('0x5f')]*0x3c){if(_0x518891[_0x592d5c][_0x3f21('0x60')]&&!_0x518891[_0x592d5c][_0x3f21('0x60')][_0x3f21('0x61')]){_0x5c68d9['run'](_0x518891[_0x592d5c]['id'])[_0x3f21('0x5b')](ut[_0x3f21('0x62')](_0x3f21('0x63')))['catch'](ut[_0x3f21('0x62')](_0x3f21('0x63')));}else{rpcDb[_0x3f21('0x64')](_0x518891[_0x592d5c]['id']);}}else{var _0x4bc5f2=new Action(_0x518891[_0x592d5c],_0xb0b2dd);_0x4bc5f2[_0x3f21('0x65')]=moment()[_0x3f21('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0xb0b2dd[_0x3f21('0x67')]+=0x1;ut[_0x3f21('0x68')](_0x4bc5f2,0x17,_0x3f21('0x69'));if(_0xb0b2dd[_0x3f21('0x6a')]){rpcDb[_0x3f21('0x6b')](ut['createBody'](_0x518891[_0x592d5c]));rpcDb[_0x3f21('0x6c')](_0x4bc5f2,_0x3f21('0x6d'));}else{ut[_0x3f21('0x68')](_0x4bc5f2,0x16,_0x3f21('0x6e'));rpcDb[_0x3f21('0x6c')](_0x4bc5f2,_0x3f21('0x6f'));rpcDb[_0x3f21('0x70')](_0x4bc5f2,'[HistoryRecallClose]');}}}}})[_0x3f21('0x4f')](ut[_0x3f21('0x62')](_0x3f21('0x71')));};Preview[_0x3f21('0x36')]['setMessage']=function(_0x3904ac){_0x3904ac[_0x3f21('0x2b')]=!![];if(ut[_0x3f21('0x72')](_0x3904ac[_0x3f21('0x73')])){_0x3904ac[_0x3f21('0x50')]=utils[_0x3f21('0x30')][_0x3f21('0x74')];}else if(!ut[_0x3f21('0x75')](_0x3904ac[_0x3f21('0x76')])){_0x3904ac[_0x3f21('0x50')]=utils[_0x3f21('0x30')][_0x3f21('0x31')];}else if(!this['isTrunkReachable'](_0x3904ac['Trunk'])){if(!this[_0x3f21('0x77')](_0x3904ac[_0x3f21('0x78')])){_0x3904ac[_0x3f21('0x50')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x3904ac[_0x3f21('0x50')]=utils['CAMPAIGN_STATUS'][_0x3f21('0x79')];}}else{_0x3904ac[_0x3f21('0x50')]=utils[_0x3f21('0x30')]['ACTIVE'];}};Preview[_0x3f21('0x36')][_0x3f21('0x7a')]=function(_0x283e81,_0x2d0f08,_0x38e00a){var _0x4ae961=this;var _0x5d3d5f=this['actions'][_0x2d0f08];var _0x49a623=this[_0x3f21('0x13')][_0x5d3d5f['queue']];var _0x588867;var _0x207406=![];var _0x108716=0x2;var _0x414184=0x3;if(_0x49a623){switch(_0x38e00a){case'1':_0x49a623[_0x3f21('0x7b')]+=0x1;_0x5d3d5f[_0x3f21('0x7c')]+=0x1;_0x5d3d5f[_0x3f21('0x7d')]=ut[_0x3f21('0x7e')](_0x5d3d5f);ut['logCustomer'](_0x5d3d5f,0x0,_0x3f21('0x7f'));ami[_0x3f21('0x24')](_0x3f21('0x80'),ut['buildObj'](_0x5d3d5f,_0x3f21('0x81')));rpcDb[_0x3f21('0x6c')](_0x5d3d5f,_0x3f21('0x82'));_0x4ae961[_0x3f21('0x83')](_0x5d3d5f,'0',_0x49a623)[_0x3f21('0x5b')](function(_0x4062f3){_0x207406=_0x4062f3[_0x3f21('0x84')]==0x1;_0x108716=_0x49a623[_0x3f21('0x85')];_0x414184=_0x49a623[_0x3f21('0x86')];if(!_0x207406){if(ut['totalGlobal'](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0xf,'Global');rpcDb['createCustomerFinal'](_0x588867,_0x3f21('0x89'));}else{if(_0x5d3d5f[_0x3f21('0x7c')]>=_0x49a623['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x5d3d5f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3f21('0x8a')](ut[_0x3f21('0x8b')](_0x5d3d5f,_0x3f21('0x7c'),_0x49a623[_0x3f21('0x85')]),_0x5d3d5f[_0x3f21('0x8c')],_0x5d3d5f[_0x3f21('0x8d')]);}}delete this[_0x3f21('0x15')][_0x283e81[_0x3f21('0x8e')]];}else{_0x5d3d5f[_0x3f21('0x7c')]++;logger[_0x3f21('0x25')](_0x3f21('0x8f'),_0x5d3d5f[_0x3f21('0x7c')]);logger[_0x3f21('0x25')]('id',_0x5d3d5f[_0x3f21('0x90')]);_0x4ae961[_0x3f21('0x91')]({'id':_0x5d3d5f[_0x3f21('0x90')],'field':{'countnosuchnumberretry':_0x5d3d5f['countnosuchnumberretry']}})[_0x3f21('0x5b')](function(){_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)['then'](function(){});});}});break;case _0x3f21('0x93'):var _0x194300=moment()[_0x3f21('0x66')](_0x3f21('0x94'));_0x5d3d5f['responsetime']=_0x194300;_0x5d3d5f[_0x3f21('0x95')]=_0x194300;_0x5d3d5f[_0x3f21('0x49')]=!![];_0x49a623[_0x3f21('0x2d')]+=0x1;logger[_0x3f21('0x25')](_0x3f21('0x96'),_0x5d3d5f[_0x3f21('0x97')],_0x3f21('0x98'),_0x49a623[_0x3f21('0x28')],_0x3f21('0x48'),_0x49a623[_0x3f21('0x2d')]);ami['emit'](_0x3f21('0x99'),ut[_0x3f21('0x9a')](_0x5d3d5f,_0x3f21('0x9b'),this[_0x3f21('0x13')][_0x5d3d5f[_0x3f21('0x46')]]));if(_0x49a623['acw']){ami[_0x3f21('0x24')](_0x3f21('0x9c'),ut[_0x3f21('0x9d')](_0x5d3d5f));}break;case'16':ami[_0x3f21('0x24')](_0x3f21('0x9e'),ut[_0x3f21('0x9a')](_0x5d3d5f,_0x3f21('0x9f'),this[_0x3f21('0x13')][_0x5d3d5f[_0x3f21('0x46')]]));emitVoiceQueueChannelRemove(ut[_0x3f21('0x9a')](_0x5d3d5f,_0x3f21('0x9f')));_0x49a623[_0x3f21('0xa0')]+=0x1;_0x49a623[_0x3f21('0xa1')]+=0x1;_0x49a623[_0x3f21('0xa2')]+=0x1;ut[_0x3f21('0xa3')](_0x49a623,_0x3f21('0xa4'));_0x5d3d5f['countglobal']=ut[_0x3f21('0x7e')](_0x5d3d5f);ut[_0x3f21('0x68')](_0x5d3d5f,0x4,_0x3f21('0xa5'));rpcDb['createCustomerHistory'](_0x5d3d5f,_0x3f21('0xa6'));rpcDb[_0x3f21('0x70')](_0x5d3d5f,_0x3f21('0xa7'));rpcDb[_0x3f21('0xa8')](_0x5d3d5f);_0x49a623['sumDuration']+=_0x5d3d5f[_0x3f21('0xa9')];_0x49a623[_0x3f21('0xaa')]+=_0x5d3d5f[_0x3f21('0xa9')];logger[_0x3f21('0x25')](_0x3f21('0xab'),_0x5d3d5f[_0x3f21('0x97')],_0x3f21('0x98'),_0x49a623['name'],_0x3f21('0x48'),_0x49a623[_0x3f21('0x2d')]);delete this[_0x3f21('0x15')][_0x283e81[_0x3f21('0x8e')]];break;case _0x3f21('0xac'):_0x49a623[_0x3f21('0xad')]+=0x1;_0x5d3d5f[_0x3f21('0xae')]+=0x1;_0x5d3d5f[_0x3f21('0x7d')]=ut['totalGlobal'](_0x5d3d5f);ut[_0x3f21('0x68')](_0x5d3d5f,0x5,_0x3f21('0xaf'));_0x108716=_0x49a623[_0x3f21('0xb0')];_0x414184=_0x49a623[_0x3f21('0x86')];ami['emit'](_0x3f21('0xb1'),ut[_0x3f21('0x9a')](_0x5d3d5f,'busy'));rpcDb[_0x3f21('0x6c')](_0x5d3d5f,_0x3f21('0xb2'));_0x4ae961[_0x3f21('0x83')](_0x5d3d5f,'5',_0x49a623)[_0x3f21('0x5b')](function(_0x3d839b){_0x207406=_0x3d839b[_0x3f21('0x84')]==0x1;if(!_0x207406){if(ut[_0x3f21('0x7e')](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0xf,_0x3f21('0xb3'));rpcDb[_0x3f21('0x70')](_0x588867,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5d3d5f[_0x3f21('0xae')]>=_0x49a623[_0x3f21('0xb4')]){rpcDb[_0x3f21('0x70')](_0x5d3d5f,_0x3f21('0xb2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d3d5f,_0x3f21('0xae'),_0x49a623[_0x3f21('0xb0')]),_0x5d3d5f[_0x3f21('0x8c')],_0x5d3d5f[_0x3f21('0x8d')]);}}}else{_0x5d3d5f[_0x3f21('0xae')]++;_0x4ae961[_0x3f21('0x91')]({'id':_0x5d3d5f['idContact'],'field':{'countbusyretry':_0x5d3d5f[_0x3f21('0xae')]}})[_0x3f21('0x5b')](function(){_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)[_0x3f21('0x5b')](function(){});});}});break;case _0x3f21('0xb5'):_0x49a623[_0x3f21('0xb6')]+=0x1;_0x5d3d5f[_0x3f21('0xb7')]+=0x1;_0x5d3d5f['countglobal']=ut['totalGlobal'](_0x5d3d5f);ut['logCustomer'](_0x5d3d5f,0x3,'NoAnswer');_0x108716=_0x49a623[_0x3f21('0xb8')];_0x414184=_0x49a623[_0x3f21('0x86')];var _0x4fd778=ut[_0x3f21('0xb9')](_0x5d3d5f,_0x49a623);ami[_0x3f21('0x24')](_0x3f21('0xba'),_0x4fd778);rpcDb['createCustomerHistory'](_0x5d3d5f,'[callProgressDetectingCustomer][logNoAnswer]');_0x4ae961[_0x3f21('0x83')](_0x5d3d5f,'3',_0x49a623)['then'](function(_0x531df0){_0x207406=_0x531df0[_0x3f21('0x84')]==0x1;if(!_0x207406){if(ut[_0x3f21('0x7e')](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0xf,'Global');rpcDb[_0x3f21('0x70')](_0x588867,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5d3d5f[_0x3f21('0xb7')]>=_0x49a623['dialNoAnswerMaxRetry']){rpcDb[_0x3f21('0x70')](_0x5d3d5f,_0x3f21('0xbb'));}else{rpcDb[_0x3f21('0x8a')](ut['scheduledAt'](_0x5d3d5f,'countnoanswerretry',_0x49a623['dialNoAnswerRetryFrequency']),_0x5d3d5f[_0x3f21('0x8c')],_0x5d3d5f['activeContact']);}}}else{_0x5d3d5f['countnoanswerretry']++;_0x4ae961[_0x3f21('0x91')]({'id':_0x5d3d5f[_0x3f21('0x90')],'field':{'countnoanswerretry':_0x5d3d5f[_0x3f21('0xb7')]}})['then'](function(){_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)[_0x3f21('0x5b')](function(){});});}});break;case _0x3f21('0xbc'):_0x49a623[_0x3f21('0xbd')]+=0x1;_0x5d3d5f[_0x3f21('0xbe')]+=0x1;_0x5d3d5f[_0x3f21('0x7d')]=ut[_0x3f21('0x7e')](_0x5d3d5f);ut[_0x3f21('0x68')](_0x5d3d5f,0x8,'Congestion');_0x108716=_0x49a623['dialCongestionRetryFrequency'];_0x414184=_0x49a623['callAdditionalPhoneAfterMin'];ami[_0x3f21('0x24')]('custom:agentcongestion',ut['buildObj'](_0x5d3d5f,'congestion'));rpcDb[_0x3f21('0x6c')](_0x5d3d5f,_0x3f21('0xbf'));_0x4ae961[_0x3f21('0x83')](_0x5d3d5f,'8',_0x49a623)[_0x3f21('0x5b')](function(_0x5edba7){_0x207406=_0x5edba7[_0x3f21('0x84')]==0x1;if(!_0x207406){if(ut[_0x3f21('0x7e')](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0xf,_0x3f21('0xb3'));rpcDb[_0x3f21('0x70')](_0x588867,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5d3d5f[_0x3f21('0xbe')]>=_0x49a623['dialCongestionMaxRetry']){rpcDb[_0x3f21('0x70')](_0x5d3d5f,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3f21('0x8a')](ut[_0x3f21('0x8b')](_0x5d3d5f,_0x3f21('0xbe'),_0x49a623[_0x3f21('0xb0')]),_0x5d3d5f[_0x3f21('0x8c')],_0x5d3d5f['activeContact']);}}}else{_0x5d3d5f[_0x3f21('0xbe')]++;_0x4ae961['incrementPreviewCounters']({'id':_0x5d3d5f['idContact'],'field':{'countcongestionretry':_0x5d3d5f[_0x3f21('0xbe')]}})[_0x3f21('0x5b')](function(){_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)[_0x3f21('0x5b')](function(){});});}});break;case _0x3f21('0xc0'):_0x49a623['outboundRejectCallsDay']+=0x1;_0x5d3d5f[_0x3f21('0xc1')]+=0x1;_0x5d3d5f[_0x3f21('0x7d')]=ut[_0x3f21('0x7e')](_0x5d3d5f);ut[_0x3f21('0x68')](_0x5d3d5f,0x14,_0x3f21('0xc2'));_0x108716=_0x49a623[_0x3f21('0xc3')];_0x414184=_0x49a623[_0x3f21('0x86')];ami[_0x3f21('0x24')](_0x3f21('0xc4'),ut[_0x3f21('0x9a')](_0x5d3d5f,_0x3f21('0xc5')));rpcDb[_0x3f21('0x6c')](_0x5d3d5f,_0x3f21('0xc6'));_0x4ae961['verifyAdditionalPhones'](_0x5d3d5f,'20',_0x49a623)[_0x3f21('0x5b')](function(_0x4d5024){_0x207406=_0x4d5024['additional']==0x1;if(!_0x207406){if(ut[_0x3f21('0x7e')](_0x5d3d5f)>=_0x49a623['dialGlobalMaxRetry']){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0x14,'AgentReject');rpcDb[_0x3f21('0x70')](_0x588867,_0x3f21('0xc7'));}else{if(_0x5d3d5f[_0x3f21('0xc1')]>=_0x49a623[_0x3f21('0xc8')]){rpcDb[_0x3f21('0x70')](_0x5d3d5f,_0x3f21('0xc7'));}else{rpcDb[_0x3f21('0x8a')](ut[_0x3f21('0x8b')](_0x5d3d5f,_0x3f21('0xc1'),_0x49a623[_0x3f21('0xc3')]),_0x5d3d5f[_0x3f21('0x8c')],_0x5d3d5f[_0x3f21('0x8d')]);}}}else{_0x5d3d5f['countnoanswerretry']++;_0x4ae961['incrementPreviewCounters']({'id':_0x5d3d5f[_0x3f21('0x90')],'field':{'countnoanswerretry':_0x5d3d5f[_0x3f21('0xb7')]}})[_0x3f21('0x5b')](function(){_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)[_0x3f21('0x5b')](function(){});});}});break;case _0x3f21('0xc9'):_0x49a623['outboundAbandonedCallsDay']+=0x1;_0x5d3d5f['countabandonedretry']+=0x1;_0x5d3d5f[_0x3f21('0x7d')]=ut[_0x3f21('0x7e')](_0x5d3d5f);ut['logCustomer'](_0x5d3d5f,0xb,_0x3f21('0xca'));rpcDb['createCustomerHistory'](_0x5d3d5f,_0x3f21('0xcb'));_0x4ae961['verifyAdditionalPhones'](_0x5d3d5f,'11',_0x49a623)[_0x3f21('0x5b')](function(_0x1795e5){_0x207406=_0x1795e5['additional']==0x1;if(!_0x207406){if(ut['totalGlobal'](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0xf,_0x3f21('0xb3'));rpcDb[_0x3f21('0x70')](_0x588867,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5d3d5f[_0x3f21('0xcc')]>=_0x49a623[_0x3f21('0xcd')]){rpcDb['createCustomerFinal'](_0x5d3d5f,_0x3f21('0xcb'));}else{rpcDb[_0x3f21('0x8a')](ut[_0x3f21('0x8b')](_0x5d3d5f,'countabandonedretry',_0x49a623['dialAbandonedRetryFrequency']),_0x5d3d5f[_0x3f21('0x8c')],_0x5d3d5f['activeContact']);}}}else{_0x5d3d5f[_0x3f21('0xb7')]++;_0x4ae961[_0x3f21('0x91')]({'id':_0x5d3d5f[_0x3f21('0x90')],'field':{'countnoanswerretry':_0x5d3d5f[_0x3f21('0xb7')]}})[_0x3f21('0x5b')](function(){_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)[_0x3f21('0x5b')](function(){});});}});break;case'18':_0x49a623[_0x3f21('0xce')]+=0x1;_0x5d3d5f['countmachineretry']+=0x1;_0x5d3d5f['countglobal']=ut[_0x3f21('0x7e')](_0x5d3d5f);ut['logCustomer'](_0x5d3d5f,0x12,_0x283e81[_0x3f21('0xcf')]||_0x283e81[_0x3f21('0xd0')]);ami[_0x3f21('0x24')](_0x3f21('0xd1'),ut[_0x3f21('0x9a')](_0x5d3d5f,_0x3f21('0xd2')));rpcDb['createCustomerHistory'](_0x5d3d5f,_0x3f21('0xd3'));_0x4ae961[_0x3f21('0x83')](_0x5d3d5f,'18',_0x49a623)[_0x3f21('0x5b')](function(_0x4d1391){_0x207406=_0x4d1391[_0x3f21('0x84')]==0x1;if(!_0x207406){if(ut[_0x3f21('0x7e')](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0x12,_0x3f21('0xb3'));rpcDb['createCustomerFinal'](_0x588867,_0x3f21('0xd3'));}else{rpcDb[_0x3f21('0x70')](_0x5d3d5f,_0x3f21('0xd3'));}}else{_0x5d3d5f[_0x3f21('0xb7')]++;_0x4ae961['incrementPreviewCounters']({'id':_0x5d3d5f[_0x3f21('0x90')],'field':{'countnoanswerretry':_0x5d3d5f[_0x3f21('0xb7')]}})[_0x3f21('0x5b')](function(){_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)[_0x3f21('0x5b')](function(){});});}});delete this['actions'][_0x283e81[_0x3f21('0x8e')]];break;case'19':_0x49a623['outboundUnknownCallsDay']+=0x1;_0x5d3d5f[_0x3f21('0x7d')]=ut['totalGlobal'](_0x5d3d5f);ut[_0x3f21('0x68')](_0x5d3d5f,0x13,_0x283e81[_0x3f21('0xcf')]||_0x283e81['dialstatus']);ami[_0x3f21('0x24')](_0x3f21('0xd1'),ut['buildObj'](_0x5d3d5f,_0x3f21('0xd2')));rpcDb[_0x3f21('0x6c')](_0x5d3d5f,_0x3f21('0xd4'));_0x4ae961[_0x3f21('0x83')](_0x5d3d5f,'18',_0x49a623)[_0x3f21('0x5b')](function(_0xd6ac0e){_0x207406=_0xd6ac0e[_0x3f21('0x84')]==0x1;if(!_0x207406){if(ut['totalGlobal'](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut[_0x3f21('0x88')](_0x5d3d5f,0xf,_0x3f21('0xb3'));rpcDb[_0x3f21('0x70')](_0x588867,_0x3f21('0xd4'));}else{rpcDb[_0x3f21('0x70')](_0x5d3d5f,_0x3f21('0xd4'));}}else{_0x5d3d5f[_0x3f21('0xb7')]++;_0x4ae961['incrementPreviewCounters']({'id':_0x5d3d5f[_0x3f21('0x90')],'field':{'countnoanswerretry':_0x5d3d5f[_0x3f21('0xb7')]}})[_0x3f21('0x5b')](function(){_0x4ae961['swapAdditionalPhones'](_0x5d3d5f,_0x108716,_0x414184)[_0x3f21('0x5b')](function(){});});}});delete this[_0x3f21('0x15')][_0x283e81[_0x3f21('0x8e')]];break;default:if(_0x5d3d5f['dialAnswer']){ut['decrementTalkink'](_0x49a623,_0x3f21('0xd5'));ut[_0x3f21('0x55')](_0x3f21('0xd6')+_0x49a623[_0x3f21('0x28')],_0x283e81);}_0x49a623['outboundUnknownCallsDay']+=0x1;_0x5d3d5f[_0x3f21('0x7d')]=ut['totalGlobal'](_0x5d3d5f);ut[_0x3f21('0x68')](_0x5d3d5f,0xc,_0x283e81[_0x3f21('0xcf')]||_0x283e81[_0x3f21('0xd0')]);_0x108716=_0x49a623[_0x3f21('0xc3')];_0x414184=_0x49a623[_0x3f21('0x86')];rpcDb[_0x3f21('0x6c')](_0x5d3d5f,_0x3f21('0xd7'));_0x4ae961[_0x3f21('0x83')](_0x5d3d5f,'20',_0x49a623)['then'](function(_0x43c2f){_0x207406=_0x43c2f[_0x3f21('0x84')]==0x1;if(!_0x207406){if(ut[_0x3f21('0x7e')](_0x5d3d5f)>=_0x49a623[_0x3f21('0x87')]){_0x588867=ut['cloneAction'](_0x5d3d5f,0xf,'Global');rpcDb[_0x3f21('0x70')](_0x588867,_0x3f21('0xd8'));}else{rpcDb[_0x3f21('0x70')](_0x5d3d5f,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x3f21('0x15')][_0x283e81[_0x3f21('0x8e')]];}else{_0x4ae961[_0x3f21('0x92')](_0x5d3d5f,_0x108716,_0x414184)['then'](function(){});}});}if(!(_0x5d3d5f['dialAnswer']&&_0x38e00a==='16')){ut[_0x3f21('0x52')](_0x49a623,'[callProgressDetectingCustomer]');logger[_0x3f21('0x25')](_0x3f21('0xd9'),_0x5d3d5f[_0x3f21('0x97')],_0x3f21('0x98'),_0x49a623[_0x3f21('0x28')],_0x3f21('0x47'),_0x49a623[_0x3f21('0x2c')]);}if(_0x38e00a!==_0x3f21('0x93')){delete this[_0x3f21('0x15')][_0x283e81['linkedid']];delete this['actions'][_0x283e81[_0x3f21('0xda')]];}_0x49a623[_0x3f21('0xdb')]=!![];}};Preview[_0x3f21('0x36')]['callProgressDetectingAgent']=function(_0x5a1bfe,_0x21608a,_0x2f63c9){if(_['isUndefined'](_0x21608a)&&_0x3f21('0xdc')!==typeof _0x21608a){return;}if(_[_0x3f21('0xdd')](_0x2f63c9)&&_0x3f21('0xdc')!==typeof _0x2f63c9){return;}switch(_0x2f63c9[_0x3f21('0xde')]){case'0':ut[_0x3f21('0xdf')](_0x5a1bfe,0x0,_0x3f21('0x7f'));rpcDb[_0x3f21('0xe0')](_0x5a1bfe,_0x3f21('0xe1'));break;case'3':ut[_0x3f21('0xdf')](_0x5a1bfe,0x3,'NoAnswer');rpcDb[_0x3f21('0xe0')](_0x5a1bfe,_0x3f21('0xe2'));break;case'5':ut[_0x3f21('0xdf')](_0x5a1bfe,0x5,'Busy');rpcDb['createAgentHistory'](_0x5a1bfe,_0x3f21('0xe3'));break;case'8':ut[_0x3f21('0xdf')](_0x5a1bfe,0x8,'Congestion');rpcDb['createAgentHistory'](_0x5a1bfe,_0x3f21('0xe4'));break;case'22':ut[_0x3f21('0xdf')](_0x5a1bfe,0x16,_0x3f21('0xe5'));rpcDb[_0x3f21('0xe0')](_0x5a1bfe,_0x3f21('0xe6'));break;default:ut[_0x3f21('0xdf')](_0x5a1bfe,0xc,_0x2f63c9[_0x3f21('0xde')]);rpcDb[_0x3f21('0xe0')](_0x5a1bfe,_0x3f21('0xe4'));}ut[_0x3f21('0x52')](_0x21608a,_0x3f21('0xe7'));logger[_0x3f21('0x25')](_0x3f21('0xe8'),_0x5a1bfe[_0x3f21('0x97')],_0x3f21('0x98'),_0x21608a[_0x3f21('0x28')],_0x3f21('0x47'),_0x21608a['originated']);delete this[_0x3f21('0x15')][_0x5a1bfe[_0x3f21('0x97')]];};Preview[_0x3f21('0x36')][_0x3f21('0x83')]=function(_0x42b4e8,_0x122de0,_0x68673f){return cmHopperAdditionalPhone[_0x3f21('0x83')](_0x42b4e8,_0x122de0,_0x68673f)['catch'](logger[_0x3f21('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x3f21('0x36')][_0x3f21('0x92')]=function(_0x1de643,_0x24e69e,_0x4ec229){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1de643,_0x24e69e,_0x4ec229)['catch'](logger[_0x3f21('0x25')](_0x3f21('0xe9')));};Preview[_0x3f21('0x36')][_0x3f21('0x91')]=function(_0x4b29cb){return Promise['resolve']()[_0x3f21('0x5b')](cmHopperAdditionalPhone[_0x3f21('0x91')](_0x4b29cb))[_0x3f21('0x4f')](logger['info'](_0x3f21('0xea')));};Preview[_0x3f21('0x36')][_0x3f21('0xeb')]=function(_0x3252bd,_0x36da5a,_0x29d828,_0x22f871,_0x3b36e9){var _0x3da144=this;return new Promise(function(_0xe87366,_0x51a77c){if(_[_0x3f21('0x43')](_0x36da5a)||_[_0x3f21('0x43')](_0x36da5a[_0x3f21('0xec')])||_['isNil'](_0x36da5a['phone'])||_[_0x3f21('0x43')](_0x36da5a[_0x3f21('0xed')])){_0x51a77c(ut[_0x3f21('0x50')](_0x3f21('0xee'),_0x22f871,_0x3b36e9));return;}var _0x2535bb=uuid['v4']();var _0x80a8=_0x3da144[_0x3f21('0x13')][_0x36da5a[_0x3f21('0x45')][_0x3f21('0x28')]];var _0x21c12e=_0x29d828?_0x3da144[_0x3f21('0x16')][_0x29d828]['id']:undefined;_0x3da144['actions'][_0x2535bb]=new Action(_0x36da5a,_0x80a8,_0x2535bb,_0x29d828,_0x21c12e);var _0x1393e3=_0x3da144[_0x3f21('0x15')][_0x2535bb];_0x1393e3[_0x3f21('0x8c')]=_0x22f871;_0x1393e3['activeContact']=_0x3b36e9;_0x1393e3[_0x3f21('0xef')]=_0x29d828;if(_['isEmpty'](_0x3252bd)){_0x3da144[_0x3f21('0xf0')](_0x1393e3,_0x80a8,_0x36da5a,_0x29d828)[_0x3f21('0x5b')](function(_0xfa8413){logger['info'](_0x3f21('0xf1'),_0x3f21('0xf2')+_0x1393e3[_0x3f21('0x46')]+_0x3f21('0xf3')+_0x1393e3['idContact'],JSON[_0x3f21('0x26')](_0xfa8413));ami['emit'](_0x3f21('0xf4'),ut[_0x3f21('0x9a')](_0x1393e3,_0x3f21('0xf5'),_0x3da144[_0x3f21('0x13')][_0x1393e3[_0x3f21('0x46')]]));_0xe87366(ut[_0x3f21('0x50')](_0x3f21('0xf6')));})['catch'](function(_0x2a4fb0){ut[_0x3f21('0x32')](_0x3f21('0xf7'),_0x2a4fb0);_0x51a77c(ut[_0x3f21('0x50')](_0x3f21('0xf8'),_0x22f871,_0x3b36e9));});}else{_0x80a8['outboundBlacklistCallsDay']+=0x1;ut[_0x3f21('0xf9')](_0x1393e3);rpcDb[_0x3f21('0xfa')](_0x1393e3,_0x3f21('0xfb'));delete _0x3da144['actions'][_0x2535bb];_0x51a77c(ut[_0x3f21('0x50')](_0x3f21('0xfc'),_0x22f871,_0x3b36e9));}});};Preview[_0x3f21('0x36')][_0x3f21('0x77')]=function(_0x5a61b1){return!_[_0x3f21('0x43')](_0x5a61b1)&&!_[_0x3f21('0x43')](_0x5a61b1[_0x3f21('0x28')])&&!_[_0x3f21('0x43')](_0x5a61b1[_0x3f21('0xfd')])&&_0x5a61b1[_0x3f21('0xfd')]&&!_['isNil'](this['trunks'][util['format'](_0x3f21('0xfe'),_0x5a61b1[_0x3f21('0x28')])])&&!_[_0x3f21('0x43')](this[_0x3f21('0x14')][util['format'](_0x3f21('0xfe'),_0x5a61b1['name'])]['status'])&&(this[_0x3f21('0x14')][util[_0x3f21('0x66')](_0x3f21('0xfe'),_0x5a61b1[_0x3f21('0x28')])][_0x3f21('0x4d')]===_0x3f21('0xff')||this[_0x3f21('0x14')][util[_0x3f21('0x66')]('SIP/%s',_0x5a61b1[_0x3f21('0x28')])]['status']==='unmonitored');};Preview[_0x3f21('0x36')][_0x3f21('0x100')]=function(_0x3a4287,_0x5b2b22){return this[_0x3f21('0x101')](_0x3a4287,_0x5b2b22)[_0x3f21('0x5b')](function(_0x3fd536){return _[_0x3f21('0x102')](_0x3fd536,[_0x3f21('0x50')]);})[_0x3f21('0x4f')](function(_0x3fc170){if(_0x3fc170['unlock']){rpcDb[_0x3f21('0x103')](_0x3a4287);}if(_0x3fc170[_0x3f21('0xfd')]){rpcDb[_0x3f21('0x64')](_0x3a4287);}throw _[_0x3f21('0x102')](_0x3fc170,['message']);});};Preview[_0x3f21('0x36')][_0x3f21('0x101')]=function(_0x1c2116,_0x2a6ddf){var _0x529aa9=this;var _0x4bd59e,_0x11249d;return rpcDb['getContactPreview'](_0x1c2116)['then'](function(_0x1d0d88){if(!_[_0x3f21('0x43')](_0x1d0d88[0x0])){_0x11249d=_0x1d0d88[0x0][_0x3f21('0x104')]?![]:!![];_0x4bd59e=_0x1d0d88[0x0][_0x3f21('0x104')]?!![]:![];_0x4bd59e=_0x2a6ddf?!![]:_0x4bd59e;}var _0x139394=_0x529aa9[_0x3f21('0x105')](_0x1d0d88);if(_0x139394[_0x3f21('0x106')]){rpcDb[_0x3f21('0x107')](_['pick'](_0x1d0d88[0x0],['VoiceQueueId',_0x3f21('0x108')]))[_0x3f21('0x5b')](function(_0x430460){_0x529aa9[_0x3f21('0xeb')](_0x430460,_0x1d0d88[0x0],_0x2a6ddf,_0x11249d,_0x4bd59e)['then'](function(_0x3f0305){return _0x3f0305;})[_0x3f21('0x4f')](function(_0x15c45c){throw _0x15c45c;});})[_0x3f21('0x4f')](function(_0x3155fb){ut[_0x3f21('0x32')](_0x3f21('0x109'),_0x3155fb);throw ut[_0x3f21('0x50')](_0x3f21('0x10a'),_0x11249d,_0x4bd59e);});}else{throw ut[_0x3f21('0x50')](_0x139394[_0x3f21('0x50')],_0x11249d,_0x4bd59e);}})[_0x3f21('0x4f')](function(_0x47284e){ut[_0x3f21('0x32')](_0x3f21('0x10b'),_0x47284e);throw ut['message'](_0x3f21('0x10a'),![],!![]);});};Preview[_0x3f21('0x36')]['validateContact']=function(_0xbdbb67){if(_[_0x3f21('0x43')](_0xbdbb67)||_[_0x3f21('0x10c')](_0xbdbb67)||!_['isNil'](_0xbdbb67[0x0]['Agent'])&&_[_0x3f21('0x43')](_0xbdbb67[0x0]['Agent'][_0x3f21('0x28')])){ut[_0x3f21('0x32')](_0x3f21('0x10d'),_0xbdbb67);return{'isValid':![],'message':_0x3f21('0x10e')};}var _0x571246=this['campaignsPreview'][_0xbdbb67[0x0][_0x3f21('0x45')][_0x3f21('0x28')]];_0x571246['message']=utils[_0x3f21('0x30')]['ACTIVE'];if(_['isNil'](_0x571246)){ut[_0x3f21('0x32')](_0x3f21('0x10f'),_0x571246);return{'isValid':![],'message':_0x3f21('0x110')};}if(!this['isTrunkReachable'](_0x571246[_0x3f21('0x111')])){ut[_0x3f21('0x32')](_0x3f21('0x112'),_0x3f21('0x113')+_0x571246['name']+_0x3f21('0x114'));if(!this['isTrunkReachable'](_0x571246[_0x3f21('0x78')])){ut[_0x3f21('0x32')](_0x3f21('0x112'),_0x571246['name']+_0x3f21('0x115'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x3f21('0x75')](_0x571246[_0x3f21('0x76')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x571246['name']+_0x3f21('0x116'));return{'isValid':![],'message':_0x3f21('0x113')+_0x571246[_0x3f21('0x28')]+_0x3f21('0x116')};}return{'isValid':!![],'message':_0x3f21('0x117')};};Preview[_0x3f21('0x36')][_0x3f21('0xf0')]=function(_0xf5ae9d,_0x330394,_0xdda9c9,_0x3c046b){var _0x1d15f5=this;return new Promise(function(_0x198ba2,_0x263702){var _0x8d57d5=_0xf5ae9d[_0x3f21('0x97')];var _0x40847a=_0x1d15f5['isTrunkReachable'](_0x330394['Trunk'])?util[_0x3f21('0x66')](_0x3f21('0x118'),_0x330394[_0x3f21('0x111')][_0x3f21('0x28')],_['isNil'](_0x330394[_0x3f21('0x119')])?'':_0x330394['dialPrefix'][_0x3f21('0x11a')]()||'',_0x330394['dialCutDigit']>0x0?_0xdda9c9[_0x3f21('0x108')][_0x3f21('0x11b')](_0x330394['dialCutDigit']):_0xdda9c9[_0x3f21('0x108')]):util['format'](_0x3f21('0x118'),_[_0x3f21('0x43')](_0x330394[_0x3f21('0x78')])?_0x330394['Trunk'][_0x3f21('0x28')]:_0x330394['TrunkBackup'][_0x3f21('0x28')],_[_0x3f21('0x43')](_0x330394[_0x3f21('0x119')])?'':_0x330394['dialPrefix'][_0x3f21('0x11a')]()||'',_0x330394['dialCutDigit']>0x0?_0xdda9c9[_0x3f21('0x108')][_0x3f21('0x11b')](_0x330394[_0x3f21('0x11c')]):_0xdda9c9[_0x3f21('0x108')]);var _0x2cb563=_0x1d15f5[_0x3f21('0x77')](_0x330394['Trunk'])?ut['getCallerId'](_0x330394[_0x3f21('0x111')][_0x3f21('0x11d')],_0x330394[_0x3f21('0x11e')],_0x330394[_0x3f21('0x11f')]>0x0?ut['getCallerIdRandom'](_0x330394[_0x3f21('0x120')],_0x330394[_0x3f21('0x11f')]):_0x330394[_0x3f21('0x120')]):ut[_0x3f21('0x121')](_['isNil'](_0x330394[_0x3f21('0x78')])?_0x330394['Trunk'][_0x3f21('0x11d')]:_0x330394['TrunkBackup'][_0x3f21('0x11d')],_0x330394[_0x3f21('0x11e')],_0x330394[_0x3f21('0x11f')]>0x0?ut['getCallerIdRandom'](_0x330394['dialOriginateCallerIdNumber'],_0x330394[_0x3f21('0x11f')]):_0x330394[_0x3f21('0x120')]);if(_0x2cb563){_0xf5ae9d[_0x3f21('0x122')]=ut[_0x3f21('0x123')](_0x2cb563);_0xf5ae9d[_0x3f21('0x124')]=ut[_0x3f21('0x125')](_0x2cb563);}var _0x257c6e=ut[_0x3f21('0x126')](_0x330394,_0xdda9c9,_0x40847a,_0x2cb563,_0x8d57d5,_0xf5ae9d);var _0x2c7830=utils[_0x3f21('0x127')](_0xdda9c9[_0x3f21('0xec')]);Object[_0x3f21('0x128')](_0x257c6e,_0x2c7830);_['merge'](_0xf5ae9d,ut[_0x3f21('0x129')](_0x257c6e));_0xf5ae9d['starttime']=moment()[_0x3f21('0x66')](_0x3f21('0x94'));_0x330394[_0x3f21('0x12a')]=_0x257c6e;var _0x19ebc2=ut[_0x3f21('0x12b')](_0xf5ae9d,_0x330394,_0x257c6e,_0xf5ae9d['activeContact'],_0x3c046b);return ami['Action'](_0x19ebc2)['then'](function(_0x1f14b8){_0x330394[_0x3f21('0x2c')]+=0x1;logger['info']('[originated][increment]',_0x8d57d5,_0x3f21('0x98'),_0x330394[_0x3f21('0x28')],_0x3f21('0x47'),_0x330394[_0x3f21('0x2c')]);_0x198ba2(_0x1f14b8);})[_0x3f21('0x4f')](function(_0x100292){ut[_0x3f21('0xdf')](_0xf5ae9d,0xe,'OriginateError');rpcDb[_0x3f21('0xe0')](_0xf5ae9d,'[originateFailure][logOriginateFailure]');_0x263702(_0x100292);});});};Preview[_0x3f21('0x36')][_0x3f21('0x1f')]=function(_0x185f01){if(this[_0x3f21('0x15')][_0x185f01['linkedid']]){this[_0x3f21('0x15')][_0x185f01['linkedid']][_0x3f21('0x4e')]=_0x185f01[_0x3f21('0x4e')];}};Preview[_0x3f21('0x36')][_0x3f21('0x12c')]=function(_0x36a8cf){var _0x466ca3=this;var _0x429405=this[_0x3f21('0x15')][_0x36a8cf[_0x3f21('0x12d')]];if(_0x429405){if(_0x429405[_0x3f21('0xef')]&&this[_0x3f21('0x16')][_0x429405[_0x3f21('0xef')]]){ut[_0x3f21('0x12e')](_0x429405,this['agents'][_0x429405[_0x3f21('0xef')]][_0x3f21('0x28')],this[_0x3f21('0x16')][_0x429405[_0x3f21('0xef')]]['id']);}var _0xa7ef72=_[_0x3f21('0x12f')](_0x429405);_0xa7ef72['responsetime']=moment()[_0x3f21('0x66')](_0x3f21('0x94'));var _0x26584c=_0x466ca3[_0x3f21('0x13')][_0x429405[_0x3f21('0x46')]];if(ut[_0x3f21('0x130')](_0x36a8cf['response'])){if(_0x429405[_0x3f21('0x8c')]){rpcDb[_0x3f21('0x103')](_0x429405['idContact']);}if(_0x429405['activeContact']){rpcDb[_0x3f21('0x64')](_0x429405[_0x3f21('0x90')]);}ami[_0x3f21('0x24')](_0x3f21('0x131'),ut['buildObj'](_0x429405,_0x3f21('0x132'),this['campaignsPreview'][_0x429405[_0x3f21('0x46')]]));this['callProgressDetectingAgent'](_0xa7ef72,_0x26584c,_0x36a8cf);}else{_0x429405[_0x3f21('0x65')]=moment()['format'](_0x3f21('0x94'));ut[_0x3f21('0xdf')](_0xa7ef72,0x4,_0x3f21('0xa5'));rpcDb[_0x3f21('0xe0')](_0xa7ef72,_0x3f21('0x133'));}}};Preview[_0x3f21('0x36')][_0x3f21('0x1a')]=function(_0x574d16){var _0x669355=this[_0x3f21('0x15')][_0x574d16['linkedid']];var _0x4fa397;if(_0x669355){_0x4fa397=this['campaignsPreview'][_0x669355['queue']];logger[_0x3f21('0x25')]('[syncHangup][talking]',_0x574d16[_0x3f21('0x8e')],'\x20Queue',_0x4fa397[_0x3f21('0x28')],_0x3f21('0x48'),_0x4fa397['pTalking']);}if(this[_0x3f21('0x15')][_0x574d16[_0x3f21('0x8e')]]&&_0x574d16[_0x3f21('0x8e')]!==_0x574d16['uniqueid']){if(_0x574d16[_0x3f21('0x134')]==='16'&&this[_0x3f21('0x15')][_0x574d16['linkedid']][_0x3f21('0x49')]){this[_0x3f21('0x7a')](_0x574d16,_0x574d16[_0x3f21('0x8e')],_0x574d16[_0x3f21('0x134')]);}else if(this[_0x3f21('0x15')][_0x574d16[_0x3f21('0x8e')]][_0x3f21('0x49')]){logger[_0x3f21('0x25')]('[syncHangup][talking][cause]',_0x574d16['linkedid'],_0x574d16[_0x3f21('0x134')],'\x20Queue',_0x4fa397[_0x3f21('0x28')],_0x3f21('0x48'),_0x4fa397['pTalking']);this[_0x3f21('0x7a')](_0x574d16,_0x574d16['linkedid'],_0x574d16[_0x3f21('0x134')]);}}else if(_0x669355&&_[_0x3f21('0x43')](_0x669355[_0x3f21('0x135')])&&_0x4fa397[_0x3f21('0x136')]&&_0x574d16[_0x3f21('0x8e')]===_0x574d16[_0x3f21('0x97')]&&_[_0x3f21('0x43')](_0x574d16[_0x3f21('0xde')])&&_0x574d16[_0x3f21('0x134')]==='16'&&_0x574d16[_0x3f21('0x137')]==='6'&&_['isUndefined'](_0x669355[_0x3f21('0x138')])){if(_0x669355[_0x3f21('0x8c')]){rpcDb['unlockContact'](_0x669355[_0x3f21('0x90')]);}if(_0x669355[_0x3f21('0x8d')]){rpcDb['disableContact'](_0x669355['idContact']);}_0x574d16[_0x3f21('0xde')]='22';this[_0x3f21('0x139')](_0x669355,_0x4fa397,_0x574d16);}else if(_0x669355&&_0x669355['transfer']){if(_0x574d16['cause']==='16'&&this[_0x3f21('0x15')][_0x574d16['linkedid']][_0x3f21('0x49')]){logger['info'](_0x3f21('0x13a'),_0x574d16['linkedid'],_0x574d16[_0x3f21('0x134')],_0x3f21('0x98'),_0x4fa397['name'],_0x3f21('0x48'),_0x4fa397[_0x3f21('0x2d')]);this[_0x3f21('0x7a')](_0x574d16,_0x574d16['linkedid'],_0x574d16['cause']);}else if(this[_0x3f21('0x15')][_0x574d16['linkedid']]['dialAnswer']){logger[_0x3f21('0x25')]('[syncHangup][talking][cause]',_0x574d16[_0x3f21('0x8e')],_0x574d16[_0x3f21('0x134')],_0x3f21('0x98'),_0x4fa397['name'],'pTalking:\x20',_0x4fa397[_0x3f21('0x2d')]);this[_0x3f21('0x7a')](_0x574d16,_0x574d16[_0x3f21('0x8e')],_0x574d16['cause']);}}};Preview[_0x3f21('0x36')][_0x3f21('0x13b')]=function(_0x294c7e){if(this['actions'][_0x294c7e['destlinkedid']]&&_0x294c7e[_0x3f21('0xda')]!==_0x294c7e['destuniqueid']){this[_0x3f21('0x7a')](_0x294c7e,_0x294c7e[_0x3f21('0xda')],_0x294c7e['dialstatus']);}};Preview[_0x3f21('0x36')][_0x3f21('0x1c')]=function(_0x34e1ff){if(this['actions'][_0x34e1ff[_0x3f21('0x8e')]]&&_0x34e1ff[_0x3f21('0x8e')]!==_0x34e1ff[_0x3f21('0x97')]&&!this[_0x3f21('0x15')][_0x34e1ff[_0x3f21('0x8e')]][_0x3f21('0x49')]){if(_0x34e1ff[_0x3f21('0x134')]==='1'){this[_0x3f21('0x7a')](_0x34e1ff,_0x34e1ff[_0x3f21('0x8e')],_0x34e1ff[_0x3f21('0x134')]);}}};Preview[_0x3f21('0x36')]['addVariable']=function(_0x4c1713,_0x2616b2,_0x58c81d){if(this[_0x3f21('0x15')][_0x4c1713]){if(_[_0x3f21('0x43')](this[_0x3f21('0x15')][_0x4c1713][_0x3f21('0x12a')])){this[_0x3f21('0x15')][_0x4c1713][_0x3f21('0x12a')]={};}this[_0x3f21('0x15')][_0x4c1713][_0x3f21('0x12a')][_0x2616b2]=_0x58c81d;}};Preview[_0x3f21('0x36')]['syncVarSet']=function(_0x47bcea){try{if(!_[_0x3f21('0x43')](_0x47bcea)){if(ut['filterKey'](_[_0x3f21('0x13c')](_0x47bcea[_0x3f21('0x13d')])[0x0])){this[_0x3f21('0x13e')](_0x47bcea[_0x3f21('0x97')],_['keys'](_0x47bcea[_0x3f21('0x13d')])[0x0],_0x47bcea['value']);}}}catch(_0x40082b){logger['error']('[syncVarSet][Preview]',util[_0x3f21('0x13f')](_0x40082b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x3f21('0x22')]=function(_0x9b0789){if(_0x9b0789){if(this[_0x3f21('0x15')][_0x9b0789['transfertargetlinkedid']]){this['actions'][_0x9b0789['transfertargetlinkedid']][_0x3f21('0x138')]=!![];}}};Preview[_0x3f21('0x36')][_0x3f21('0x140')]=function(_0x453acd){if(_0x453acd){if(this[_0x3f21('0x15')][_0x453acd[_0x3f21('0x141')]]){this[_0x3f21('0x15')][_0x453acd[_0x3f21('0x141')]][_0x3f21('0x138')]=!![];}}};module['exports']=Preview;
\ No newline at end of file