Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / services / ami / preview / index.js
index 7111e73..06fc30d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0x521e=['originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','toLowerVariables','variables','variablesAction','[originateFailure][logOriginateFailure]','syncOriginateResponse','lookAgent','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','addVariable','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','agents','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','setMessage','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','buildObj','nosuchnumber','createCustomerHistory','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','buildAcw','complete','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName'];(function(_0x17df24,_0x521621){var _0x343884=function(_0xf150d8){while(--_0xf150d8){_0x17df24['push'](_0x17df24['shift']());}};_0x343884(++_0x521621);}(_0x521e,0x162));var _0xe521=function(_0x100808,_0x105106){_0x100808=_0x100808-0x0;var _0x280229=_0x521e[_0x100808];return _0x280229;};'use strict';var util=require('util');var _=require(_0xe521('0x0'));var uuid=require(_0xe521('0x1'));var moment=require(_0xe521('0x2'));var Redis=require(_0xe521('0x3'));var config=require(_0xe521('0x4'));var logger=require(_0xe521('0x5'))(_0xe521('0x6'));var loggerAction=require(_0xe521('0x5'))(_0xe521('0x7'));var ami=require('../ami');var rpcDb=require(_0xe521('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xe521('0x9'));var ut=require(_0xe521('0xa'));var utils=require('../dialer/utils');config[_0xe521('0xb')]=_[_0xe521('0xc')](config[_0xe521('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xe521('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe521('0xe')][_0xe521('0xf')]=function(_0x1a6a46){this[_0xe521('0x10')]=this[_0xe521('0x10')]?this[_0xe521('0x10')][_0xe521('0x11')](_0x1a6a46):_0x1a6a46();};function Preview(_0x4a6e5b){this[_0xe521('0x12')]=new Sequence();this[_0xe521('0x13')]=_0x4a6e5b[_0xe521('0x14')];this[_0xe521('0x15')]=_0x4a6e5b[_0xe521('0x15')];this[_0xe521('0x16')]={};this['agents']=_0x4a6e5b['agents'];this[_0xe521('0x17')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe521('0x18')](this));ami['on'](_0xe521('0x19'),this[_0xe521('0x1a')]['bind'](this));ami['on'](_0xe521('0x1b'),this[_0xe521('0x1c')][_0xe521('0x18')](this));ami['on'](_0xe521('0x1d'),this['syncDialEnd'][_0xe521('0x18')](this));ami['on'](_0xe521('0x1e'),this[_0xe521('0x1f')][_0xe521('0x18')](this));ami['on']('varset',this[_0xe521('0x20')][_0xe521('0x18')](this));ami['on']('attendedtransfer',this[_0xe521('0x21')][_0xe521('0x18')](this));ami['on'](_0xe521('0x22'),this[_0xe521('0x23')][_0xe521('0x18')](this));this[_0xe521('0x24')](this[_0xe521('0x13')]);}function emit(_0x1a6bd4,_0x34335e,_0x39df02){io['to'](_0x1a6bd4)['emit'](_0x34335e,_0x39df02);}function emitVoiceQueueChannelRemove(_0x4c01c5){logger['info'](_0xe521('0x25'),JSON[_0xe521('0x26')](_0x4c01c5));emit(util[_0xe521('0x27')](_0xe521('0x28'),_0x4c01c5[_0xe521('0x29')]),_0xe521('0x2a'),_0x4c01c5);io[_0xe521('0x2b')](_0xe521('0x2c'),_0x4c01c5);}function notSendMessagesQueue(_0x5a2bd6){if(_0x5a2bd6[_0xe521('0x2d')]){if(_0x5a2bd6[_0xe521('0x2e')]===0x0&&_0x5a2bd6[_0xe521('0x2f')]===0x0){_0x5a2bd6['sendMessageOneNotActive']=![];_0x5a2bd6[_0xe521('0x30')]=0x0;_0x5a2bd6[_0xe521('0x31')]=0x0;_0x5a2bd6[_0xe521('0x32')]=utils[_0xe521('0x33')][_0xe521('0x34')];ut[_0xe521('0x35')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5a2bd6[_0xe521('0x29')]+_0xe521('0x36'));}else{_0x5a2bd6[_0xe521('0x32')]=utils['CAMPAIGN_STATUS'][_0xe521('0x37')];ut[_0xe521('0x35')](_0xe521('0x38'),_0x5a2bd6[_0xe521('0x29')]+_0xe521('0x39'));}}}Preview[_0xe521('0xe')][_0xe521('0x24')]=function(){var _0x5b6836=this;setInterval(function(){_0x5b6836[_0xe521('0x3a')]();},0x7cf);};Preview[_0xe521('0xe')][_0xe521('0x3a')]=function(){var _0xb9d7c3=this[_0xe521('0x13')];this['clockClearZombieChannels']+=0x1;for(var _0x300b96 in _0xb9d7c3){if(_0xb9d7c3['hasOwnProperty'](_0x300b96)&&(_0xb9d7c3[_0x300b96][_0xe521('0x3b')]===_0xe521('0x6')||_0xb9d7c3[_0x300b96][_0xe521('0x3b')]===_0xe521('0x3c'))&&_0xb9d7c3[_0x300b96][_0xe521('0x3d')]===_0xe521('0x3e')){if(this[_0xe521('0x17')]>0x7){this[_0xe521('0x17')]=0x0;this[_0xe521('0x3f')]();}}if(_0xb9d7c3[_0xe521('0x40')](_0x300b96)&&_0xb9d7c3[_0x300b96]['dialMethod']==='preview'&&_0xb9d7c3[_0x300b96][_0xe521('0x3d')]===_0xe521('0x3e')){if(_0xb9d7c3[_0x300b96]['dialActive']){this['setMessage'](_0xb9d7c3[_0x300b96]);if(_0xb9d7c3[_0x300b96]['dialPreviewAutoRecallMe'])this['recallMe'](_0xb9d7c3[_0x300b96]);}else{notSendMessagesQueue(_0xb9d7c3[_0x300b96]);}}}};Preview[_0xe521('0xe')][_0xe521('0x41')]=function(_0x1114e1){var _0x56a388=this;this['sequence'][_0xe521('0xf')](function(){if(!_[_0xe521('0x42')](_0x56a388[_0xe521('0x16')][_0x1114e1])){loggerAction[_0xe521('0x43')](_0xe521('0x44'),_0x1114e1,'Queue',_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')],'originated:\x20',JSON[_0xe521('0x26')](_0x56a388[_0xe521('0x13')][_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')]][_0xe521('0x2e')]),_0xe521('0x46'),JSON['stringify'](_0x56a388[_0xe521('0x13')][_0x56a388['actions'][_0x1114e1][_0xe521('0x45')]]['pTalking']),JSON[_0xe521('0x26')](_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x47')]),JSON[_0xe521('0x26')](_[_0xe521('0x48')](_0x56a388['actions'][_0x1114e1],[_0xe521('0x49'),'UserId',_0xe521('0x4a'),_0xe521('0x4b')])));return ami[_0xe521('0x4c')]({'action':'status','channel':_0x56a388['actions'][_0x1114e1][_0xe521('0x4d')]})[_0xe521('0x4e')](function(_0x1fa6a9){if(_0x1fa6a9[_0xe521('0x32')]===_0xe521('0x4f')){setTimeout(function(){if(_0x56a388['actions'][_0x1114e1]){ut[_0xe521('0x50')](_0x56a388[_0xe521('0x13')][_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')]],_0xe521('0x51'));if(_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x47')]===!![]){ut[_0xe521('0x52')](_0x56a388[_0xe521('0x13')][_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')]],_0xe521('0x51'));ut[_0xe521('0x53')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1114e1,_0x56a388['actions'][_0x1114e1][_0xe521('0x45')]);}ut[_0xe521('0x53')](_0xe521('0x54')+_0x1114e1,_0x56a388['actions'][_0x1114e1][_0xe521('0x45')]);delete _0x56a388[_0xe521('0x16')][_0x1114e1];}},0x2328);}});}});};Preview[_0xe521('0xe')][_0xe521('0x3f')]=function(){var _0x54dfab=this;loggerAction[_0xe521('0x43')](_0xe521('0x55'),_[_0xe521('0x56')](this[_0xe521('0x16')]));for(var _0x56ebb5 in this[_0xe521('0x16')]){if(_0x54dfab['actions'][_0xe521('0x40')](_0x56ebb5)){_0x54dfab['clearZombieChannel'](_0x56ebb5);}}};Preview[_0xe521('0xe')]['recallMe']=function(_0x29a289){var _0x3ca9f0=this;rpcDb[_0xe521('0x57')](_0x29a289['id'],ut[_0xe521('0x58')](this[_0xe521('0x59')]))[_0xe521('0x5a')](function(_0x2d1c00){if(!_[_0xe521('0x42')](_0x2d1c00)){for(var _0x5b858f=0x0;_0x5b858f<_0x2d1c00['length'];_0x5b858f+=0x1){if(ut['getDiff'](_0x2d1c00[_0x5b858f][_0xe521('0x5b')])<_0x29a289[_0xe521('0x5c')]*0x3c){if(_0x2d1c00[_0x5b858f]['Agent']&&!_0x2d1c00[_0x5b858f][_0xe521('0x5d')][_0xe521('0x5e')]){_0x3ca9f0[_0xe521('0x5f')](_0x2d1c00[_0x5b858f]['id'])[_0xe521('0x5a')](ut[_0xe521('0x60')](_0xe521('0x61')))[_0xe521('0x4e')](ut['logger2'](_0xe521('0x61')));}else{rpcDb[_0xe521('0x62')](_0x2d1c00[_0x5b858f]['id']);}}else{var _0x39f9a8=new Action(_0x2d1c00[_0x5b858f],_0x29a289);_0x39f9a8[_0xe521('0x63')]=moment()[_0xe521('0x27')](_0xe521('0x64'));_0x29a289[_0xe521('0x65')]+=0x1;ut['logCustomer'](_0x39f9a8,0x17,_0xe521('0x66'));if(_0x29a289[_0xe521('0x67')]){rpcDb[_0xe521('0x68')](ut[_0xe521('0x69')](_0x2d1c00[_0x5b858f]));rpcDb['createCustomerHistory'](_0x39f9a8,_0xe521('0x6a'));}else{ut['logCustomer'](_0x39f9a8,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x39f9a8,'[HistoryRecallClose]');rpcDb[_0xe521('0x6b')](_0x39f9a8,_0xe521('0x6c'));}}}}})[_0xe521('0x4e')](ut[_0xe521('0x60')](_0xe521('0x6d')));};Preview[_0xe521('0xe')][_0xe521('0x6e')]=function(_0x484a10){_0x484a10[_0xe521('0x2d')]=!![];if(ut['IsNotLoggedIn'](_0x484a10['loggedIn'])){_0x484a10[_0xe521('0x32')]=utils['CAMPAIGN_STATUS'][_0xe521('0x6f')];}else if(!ut[_0xe521('0x70')](_0x484a10[_0xe521('0x71')])){_0x484a10[_0xe521('0x32')]=utils[_0xe521('0x33')][_0xe521('0x34')];}else if(!this[_0xe521('0x72')](_0x484a10['Trunk'])){if(!this[_0xe521('0x72')](_0x484a10[_0xe521('0x73')])){_0x484a10[_0xe521('0x32')]=utils[_0xe521('0x33')]['UNREACHABLE_TRUNK'];}else{_0x484a10['message']=utils['CAMPAIGN_STATUS'][_0xe521('0x74')];}}else{_0x484a10[_0xe521('0x32')]=utils['CAMPAIGN_STATUS'][_0xe521('0x74')];}};Preview['prototype'][_0xe521('0x75')]=function(_0xa7f0da,_0x29fc2d,_0x1c713d){var _0x199aec=this;var _0x889b=this[_0xe521('0x16')][_0x29fc2d];var _0x3de0db=this['campaignsPreview'][_0x889b[_0xe521('0x45')]];var _0x5533f5;var _0xad4b3b=![];var _0x372d5e=0x2;var _0x3e3f95=0x3;if(_0x3de0db){switch(_0x1c713d){case'1':_0x3de0db[_0xe521('0x76')]+=0x1;_0x889b[_0xe521('0x77')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x0,'NoSuchNumber');ami[_0xe521('0x2b')]('custom:agentnosuchnumber',ut[_0xe521('0x7b')](_0x889b,_0xe521('0x7c')));rpcDb[_0xe521('0x7d')](_0x889b,'[callProgressDetectingCustomer][logNoSuch]');_0x199aec[_0xe521('0x7e')](_0x889b,'0',_0x3de0db)[_0xe521('0x5a')](function(_0x2d52b6){_0xad4b3b=_0x2d52b6[_0xe521('0x7f')]==0x1;_0x372d5e=_0x3de0db['dialNoSuchNumberRetryFrequency'];_0x3e3f95=_0x3de0db[_0xe521('0x80')];if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0x84'));}else{if(_0x889b[_0xe521('0x77')]>=_0x3de0db[_0xe521('0x85')]){rpcDb['createCustomerFinal'](_0x889b,_0xe521('0x84'));}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,'countnosuchnumberretry',_0x3de0db[_0xe521('0x88')]),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}delete this[_0xe521('0x16')][_0xa7f0da[_0xe521('0x8b')]];}else{_0x889b['countnosuchnumberretry']++;logger[_0xe521('0x43')](_0xe521('0x8c'),_0x889b[_0xe521('0x77')]);logger['info']('id',_0x889b[_0xe521('0x8d')]);_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countnosuchnumberretry':_0x889b[_0xe521('0x77')]}})[_0xe521('0x5a')](function(){_0x199aec['swapAdditionalPhones'](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});break;case'ANSWER':var _0x402137=moment()[_0xe521('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x889b[_0xe521('0x8f')]=_0x402137;_0x889b[_0xe521('0x90')]=_0x402137;_0x889b['dialAnswer']=!![];_0x3de0db[_0xe521('0x2f')]+=0x1;logger[_0xe521('0x43')](_0xe521('0x91'),_0x889b['uniqueid'],_0xe521('0x92'),_0x3de0db['name'],'pTalking:\x20',_0x3de0db[_0xe521('0x2f')]);ami[_0xe521('0x2b')](_0xe521('0x93'),ut[_0xe521('0x7b')](_0x889b,_0xe521('0x94'),this[_0xe521('0x13')][_0x889b[_0xe521('0x45')]]));if(_0x3de0db[_0xe521('0x95')]){ami[_0xe521('0x2b')]('custom:agentConnectPreview',ut[_0xe521('0x96')](_0x889b));}break;case'16':ami[_0xe521('0x2b')]('custom:agentcomplete',ut[_0xe521('0x7b')](_0x889b,_0xe521('0x97'),this[_0xe521('0x13')][_0x889b[_0xe521('0x45')]]));emitVoiceQueueChannelRemove(ut[_0xe521('0x7b')](_0x889b,_0xe521('0x97')));_0x3de0db['outboundAnswerCallsDay']+=0x1;_0x3de0db[_0xe521('0x98')]+=0x1;_0x3de0db[_0xe521('0x99')]+=0x1;ut[_0xe521('0x52')](_0x3de0db,_0xe521('0x9a'));_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x4,_0xe521('0x9b'));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0x9c'));rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xe521('0x9d')](_0x889b);_0x3de0db['sumDuration']+=_0x889b[_0xe521('0x9e')];_0x3de0db[_0xe521('0x9f')]+=_0x889b[_0xe521('0x9e')];logger[_0xe521('0x43')](_0xe521('0xa0'),_0x889b[_0xe521('0xa1')],_0xe521('0x92'),_0x3de0db[_0xe521('0x29')],_0xe521('0x46'),_0x3de0db[_0xe521('0x2f')]);delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];break;case'BUSY':_0x3de0db[_0xe521('0xa2')]+=0x1;_0x889b[_0xe521('0xa3')]+=0x1;_0x889b[_0xe521('0x78')]=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x5,_0xe521('0xa4'));_0x372d5e=_0x3de0db[_0xe521('0xa5')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];ami['emit'](_0xe521('0xa6'),ut[_0xe521('0x7b')](_0x889b,'busy'));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xa7'));_0x199aec[_0xe521('0x7e')](_0x889b,'5',_0x3de0db)[_0xe521('0x5a')](function(_0x644955){_0xad4b3b=_0x644955[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db['dialGlobalMaxRetry']){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xa8'));}else{if(_0x889b['countbusyretry']>=_0x3de0db[_0xe521('0xa9')]){rpcDb[_0xe521('0x6b')](_0x889b,_0xe521('0xa7'));}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,_0xe521('0xa3'),_0x3de0db['dialBusyRetryFrequency']),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b['countbusyretry']++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countbusyretry':_0x889b[_0xe521('0xa3')]}})[_0xe521('0x5a')](function(){_0x199aec['swapAdditionalPhones'](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});break;case _0xe521('0xaa'):_0x3de0db[_0xe521('0xab')]+=0x1;_0x889b['countnoanswerretry']+=0x1;_0x889b[_0xe521('0x78')]=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x3,_0xe521('0xac'));_0x372d5e=_0x3de0db['dialNoAnswerRetryFrequency'];_0x3e3f95=_0x3de0db['callAdditionalPhoneAfterMin'];var _0x498ebd=ut[_0xe521('0xad')](_0x889b,_0x3de0db);ami[_0xe521('0x2b')](_0xe521('0xae'),_0x498ebd);rpcDb['createCustomerHistory'](_0x889b,_0xe521('0xaf'));_0x199aec['verifyAdditionalPhones'](_0x889b,'3',_0x3de0db)['then'](function(_0x14fba9){_0xad4b3b=_0x14fba9[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db['dialGlobalMaxRetry']){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,'Global');rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xb0'));}else{if(_0x889b[_0xe521('0xb1')]>=_0x3de0db[_0xe521('0xb2')]){rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xe521('0x87')](_0x889b,_0xe521('0xb1'),_0x3de0db['dialNoAnswerRetryFrequency']),_0x889b[_0xe521('0x89')],_0x889b['activeContact']);}}}else{_0x889b['countnoanswerretry']++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b['idContact'],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})['then'](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});break;case _0xe521('0xb4'):_0x3de0db[_0xe521('0xb5')]+=0x1;_0x889b[_0xe521('0xb6')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x8,_0xe521('0xb7'));_0x372d5e=_0x3de0db[_0xe521('0xb8')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];ami[_0xe521('0x2b')](_0xe521('0xb9'),ut[_0xe521('0x7b')](_0x889b,_0xe521('0xba')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xbb'));_0x199aec[_0xe521('0x7e')](_0x889b,'8',_0x3de0db)[_0xe521('0x5a')](function(_0x5b7ee5){_0xad4b3b=_0x5b7ee5[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,'Global');rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xbc'));}else{if(_0x889b['countcongestionretry']>=_0x3de0db['dialCongestionMaxRetry']){rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,_0xe521('0xb6'),_0x3de0db['dialBusyRetryFrequency']),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b[_0xe521('0xb6')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countcongestionretry':_0x889b['countcongestionretry']}})[_0xe521('0x5a')](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});break;case _0xe521('0xbd'):_0x3de0db['outboundRejectCallsDay']+=0x1;_0x889b['countagentrejectretry']+=0x1;_0x889b['countglobal']=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x14,_0xe521('0xbe'));_0x372d5e=_0x3de0db[_0xe521('0xbf')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];ami[_0xe521('0x2b')]('custom:agentreject',ut[_0xe521('0x7b')](_0x889b,_0xe521('0xc0')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xc1'));_0x199aec[_0xe521('0x7e')](_0x889b,'20',_0x3de0db)[_0xe521('0x5a')](function(_0x577931){_0xad4b3b=_0x577931[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut['cloneAction'](_0x889b,0x14,'AgentReject');rpcDb[_0xe521('0x6b')](_0x5533f5,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x889b['countagentrejectretry']>=_0x3de0db[_0xe521('0xc2')]){rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,'countagentrejectretry',_0x3de0db[_0xe521('0xbf')]),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})['then'](function(){_0x199aec['swapAdditionalPhones'](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});break;case'ABANDONED':_0x3de0db['outboundAbandonedCallsDay']+=0x1;_0x889b[_0xe521('0xc3')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut['logCustomer'](_0x889b,0xb,_0xe521('0xc4'));rpcDb[_0xe521('0x7d')](_0x889b,'[callProgressDetectingCustomer][logAbandoned]');_0x199aec[_0xe521('0x7e')](_0x889b,'11',_0x3de0db)[_0xe521('0x5a')](function(_0x2f830d){_0xad4b3b=_0x2f830d[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x889b['countabandonedetry']>=_0x3de0db['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xe521('0x87')](_0x889b,_0xe521('0xc3'),_0x3de0db[_0xe521('0xc5')]),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})['then'](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});break;case'18':_0x3de0db[_0xe521('0xc6')]+=0x1;_0x889b[_0xe521('0xc7')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x12,_0xa7f0da[_0xe521('0xc8')]||_0xa7f0da[_0xe521('0xc9')]);ami[_0xe521('0x2b')](_0xe521('0xca'),ut[_0xe521('0x7b')](_0x889b,_0xe521('0xcb')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xcc'));_0x199aec[_0xe521('0x7e')](_0x889b,'18',_0x3de0db)[_0xe521('0x5a')](function(_0x460aa5){_0xad4b3b=_0x460aa5[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0x12,'Global');rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xcc'));}else{rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b['idContact'],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})[_0xe521('0x5a')](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});delete this[_0xe521('0x16')][_0xa7f0da[_0xe521('0x8b')]];break;case'19':_0x3de0db[_0xe521('0xc6')]+=0x1;_0x889b[_0xe521('0x78')]=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x13,_0xa7f0da[_0xe521('0xc8')]||_0xa7f0da[_0xe521('0xc9')]);ami[_0xe521('0x2b')](_0xe521('0xca'),ut['buildObj'](_0x889b,_0xe521('0xcb')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xcd'));_0x199aec[_0xe521('0x7e')](_0x889b,'18',_0x3de0db)[_0xe521('0x5a')](function(_0x146b48){_0xad4b3b=_0x146b48[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut['totalGlobal'](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb['createCustomerFinal'](_0x5533f5,_0xe521('0xcd'));}else{rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][machine]');}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b['idContact'],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})[_0xe521('0x5a')](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];break;default:if(_0x889b[_0xe521('0x47')]){ut[_0xe521('0x52')](_0x3de0db,_0xe521('0xce'));ut[_0xe521('0x53')](_0xe521('0xcf')+_0x3de0db[_0xe521('0x29')],_0xa7f0da);}_0x3de0db[_0xe521('0xc6')]+=0x1;_0x889b['countglobal']=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0xc,_0xa7f0da[_0xe521('0xc8')]||_0xa7f0da[_0xe521('0xc9')]);_0x372d5e=_0x3de0db[_0xe521('0xbf')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];rpcDb['createCustomerHistory'](_0x889b,_0xe521('0xd0'));_0x199aec['verifyAdditionalPhones'](_0x889b,'20',_0x3de0db)[_0xe521('0x5a')](function(_0x369054){_0xad4b3b=_0x369054[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xd1'));}else{rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];}else{_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});}});}if(!(_0x889b[_0xe521('0x47')]&&_0x1c713d==='16')){ut[_0xe521('0x50')](_0x3de0db,'[callProgressDetectingCustomer]');logger[_0xe521('0x43')](_0xe521('0xd2'),_0x889b['uniqueid'],_0xe521('0x92'),_0x3de0db['name'],_0xe521('0xd3'),_0x3de0db[_0xe521('0x2e')]);}if(_0x1c713d!==_0xe521('0xd4')){delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];delete this[_0xe521('0x16')][_0xa7f0da[_0xe521('0xd5')]];}_0x3de0db[_0xe521('0xd6')]=!![];}};Preview[_0xe521('0xe')][_0xe521('0xd7')]=function(_0x27b695,_0x59e5f4,_0x6fec03){if(_[_0xe521('0xd8')](_0x59e5f4)&&'object'!==typeof _0x59e5f4){return;}if(_[_0xe521('0xd8')](_0x6fec03)&&_0xe521('0xd9')!==typeof _0x6fec03){return;}switch(_0x6fec03['reason']){case'0':ut[_0xe521('0xda')](_0x27b695,0x0,_0xe521('0xdb'));rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xdd'));break;case'3':ut['logAgent'](_0x27b695,0x3,_0xe521('0xac'));rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xde'));break;case'5':ut['logAgent'](_0x27b695,0x5,_0xe521('0xa4'));rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xdf'));break;case'8':ut['logAgent'](_0x27b695,0x8,_0xe521('0xb7'));rpcDb[_0xe521('0xdc')](_0x27b695,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x27b695,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x27b695,_0xe521('0xe0'));break;default:ut[_0xe521('0xda')](_0x27b695,0xc,_0x6fec03[_0xe521('0xe1')]);rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xe2'));}ut['updateOriginated'](_0x59e5f4,_0xe521('0xe3'));logger[_0xe521('0x43')](_0xe521('0xe4'),_0x27b695[_0xe521('0xa1')],_0xe521('0x92'),_0x59e5f4[_0xe521('0x29')],_0xe521('0xd3'),_0x59e5f4[_0xe521('0x2e')]);delete this[_0xe521('0x16')][_0x27b695['uniqueid']];};Preview[_0xe521('0xe')][_0xe521('0x7e')]=function(_0x2fcd0f,_0x3d94aa,_0x44a64c){return cmHopperAdditionalPhone[_0xe521('0x7e')](_0x2fcd0f,_0x3d94aa,_0x44a64c)[_0xe521('0x4e')](logger[_0xe521('0x43')](_0xe521('0xe5')));};Preview['prototype'][_0xe521('0xb3')]=function(_0x2cf1c6,_0x347f3a,_0x1b402e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2cf1c6,_0x347f3a,_0x1b402e)[_0xe521('0x4e')](logger['info'](_0xe521('0xe6')));};Preview[_0xe521('0xe')][_0xe521('0x8e')]=function(_0x5f3e07){return Promise[_0xe521('0xe7')]()[_0xe521('0x5a')](cmHopperAdditionalPhone[_0xe521('0x8e')](_0x5f3e07))[_0xe521('0x4e')](logger['info'](_0xe521('0xe8')));};Preview[_0xe521('0xe')][_0xe521('0xe9')]=function(_0x27f224,_0x5a61f0,_0x11c786,_0x5d808b,_0x2f9e0b){var _0x51717e=this;return new Promise(function(_0x108f25,_0x188d00){if(_[_0xe521('0x42')](_0x5a61f0)||_[_0xe521('0x42')](_0x5a61f0[_0xe521('0xea')])||_[_0xe521('0x42')](_0x5a61f0[_0xe521('0xeb')])||_['isNil'](_0x5a61f0[_0xe521('0x4a')])){_0x188d00(ut[_0xe521('0x32')](_0xe521('0xec'),_0x5d808b,_0x2f9e0b));return;}var _0x11364d=uuid['v4']();var _0x37a92e=_0x51717e[_0xe521('0x13')][_0x5a61f0[_0xe521('0xed')][_0xe521('0x29')]];var _0x34d5b5=_0x11c786?_0x51717e['agents'][_0x11c786]['id']:undefined;_0x51717e[_0xe521('0x16')][_0x11364d]=new Action(_0x5a61f0,_0x37a92e,_0x11364d,_0x11c786,_0x34d5b5);var _0x1529aa=_0x51717e['actions'][_0x11364d];_0x1529aa['unlockAgent']=_0x5d808b;_0x1529aa['activeContact']=_0x2f9e0b;_0x1529aa['lookAgent']=_0x11c786;if(_[_0xe521('0xee')](_0x27f224)){_0x51717e[_0xe521('0xef')](_0x1529aa,_0x37a92e,_0x5a61f0,_0x11c786)[_0xe521('0x5a')](function(_0xabe5ac){logger[_0xe521('0x43')](_0xe521('0xf0'),'Queue:\x20'+_0x1529aa[_0xe521('0x45')]+_0xe521('0xf1')+_0x1529aa[_0xe521('0x8d')],JSON[_0xe521('0x26')](_0xabe5ac));ami[_0xe521('0x2b')](_0xe521('0xf2'),ut[_0xe521('0x7b')](_0x1529aa,_0xe521('0xf3'),_0x51717e['campaignsPreview'][_0x1529aa[_0xe521('0x45')]]));_0x108f25(ut[_0xe521('0x32')](_0xe521('0xf4')));})['catch'](function(_0xff5c20){ut[_0xe521('0x35')](_0xe521('0xf5'),_0xff5c20);_0x188d00(ut['message'](_0xe521('0xf6'),_0x5d808b,_0x2f9e0b));});}else{_0x37a92e[_0xe521('0xf7')]+=0x1;ut['logBlacklist'](_0x1529aa);rpcDb[_0xe521('0xf8')](_0x1529aa,'[Blacklist][error]');delete _0x51717e[_0xe521('0x16')][_0x11364d];_0x188d00(ut['message'](_0xe521('0xf9'),_0x5d808b,_0x2f9e0b));}});};Preview['prototype'][_0xe521('0x72')]=function(_0x583548){return!_[_0xe521('0x42')](_0x583548)&&!_[_0xe521('0x42')](_0x583548[_0xe521('0x29')])&&!_[_0xe521('0x42')](_0x583548[_0xe521('0xfa')])&&_0x583548[_0xe521('0xfa')]&&!_['isNil'](this[_0xe521('0x15')][util[_0xe521('0x27')](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])])&&!_[_0xe521('0x42')](this['trunks'][util[_0xe521('0x27')](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])]['status'])&&(this[_0xe521('0x15')][util['format'](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])][_0xe521('0xfc')]==='reachable'||this['trunks'][util[_0xe521('0x27')](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])][_0xe521('0xfc')]===_0xe521('0xfd'));};Preview[_0xe521('0xe')][_0xe521('0x5f')]=function(_0x5ad96b,_0x61303b){return this['execRun'](_0x5ad96b,_0x61303b)[_0xe521('0x5a')](function(_0x29acc7){return _[_0xe521('0x48')](_0x29acc7,[_0xe521('0x32')]);})['catch'](function(_0xc13f){if(_0xc13f[_0xe521('0xfe')]){rpcDb[_0xe521('0xff')](_0x5ad96b);}if(_0xc13f[_0xe521('0xfa')]){rpcDb['disableContact'](_0x5ad96b);}throw _['pick'](_0xc13f,[_0xe521('0x32')]);});};Preview['prototype'][_0xe521('0x100')]=function(_0x20a558,_0xf0bd7b){var _0x2d5636=this;var _0x2005b7,_0x25de1f;return rpcDb[_0xe521('0x101')](_0x20a558)['then'](function(_0x11adab){if(!_[_0xe521('0x42')](_0x11adab[0x0])){_0x25de1f=_0x11adab[0x0]['recallme']?![]:!![];_0x2005b7=_0x11adab[0x0][_0xe521('0x102')]?!![]:![];_0x2005b7=_0xf0bd7b?!![]:_0x2005b7;}var _0x3a3319=_0x2d5636[_0xe521('0x103')](_0x11adab);if(_0x3a3319[_0xe521('0x104')]){rpcDb[_0xe521('0x105')](_[_0xe521('0x48')](_0x11adab[0x0],[_0xe521('0x4a'),_0xe521('0xeb')]))['then'](function(_0x8a25f7){_0x2d5636['checkInBlack'](_0x8a25f7,_0x11adab[0x0],_0xf0bd7b,_0x25de1f,_0x2005b7)['then'](function(_0x5c1cd9){return _0x5c1cd9;})['catch'](function(_0x5da60e){throw _0x5da60e;});})[_0xe521('0x4e')](function(_0x515fdb){ut[_0xe521('0x35')](_0xe521('0x106'),_0x515fdb);throw ut[_0xe521('0x32')]('Call\x20unsuccessful',_0x25de1f,_0x2005b7);});}else{throw ut[_0xe521('0x32')](_0x3a3319[_0xe521('0x32')],_0x25de1f,_0x2005b7);}})[_0xe521('0x4e')](function(_0xfd3317){ut['logger'](_0xe521('0x107'),_0xfd3317);throw ut[_0xe521('0x32')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xe521('0xe')][_0xe521('0x103')]=function(_0x15a069){if(_[_0xe521('0x42')](_0x15a069)||_[_0xe521('0xee')](_0x15a069)||!_[_0xe521('0x42')](_0x15a069[0x0][_0xe521('0x5d')])&&_[_0xe521('0x42')](_0x15a069[0x0]['Agent']['name'])){ut[_0xe521('0x35')]('[Preview][validateContact][Empty\x20Contact]',_0x15a069);return{'isValid':![],'message':_0xe521('0x108')};}var _0x572b6a=this[_0xe521('0x13')][_0x15a069[0x0][_0xe521('0xed')]['name']];_0x572b6a[_0xe521('0x32')]=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xe521('0x42')](_0x572b6a)){ut['logger'](_0xe521('0x109'),_0x572b6a);return{'isValid':![],'message':_0xe521('0x10a')};}if(!this[_0xe521('0x72')](_0x572b6a[_0xe521('0x10b')])){ut[_0xe521('0x35')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x572b6a[_0xe521('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xe521('0x72')](_0x572b6a[_0xe521('0x73')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x572b6a[_0xe521('0x29')]+_0xe521('0x10c'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xe521('0x70')](_0x572b6a[_0xe521('0x71')])){ut[_0xe521('0x35')](_0xe521('0x10d'),_0x572b6a[_0xe521('0x29')]+_0xe521('0x10e'));return{'isValid':![],'message':_0xe521('0x10f')+_0x572b6a[_0xe521('0x29')]+_0xe521('0x10e')};}return{'isValid':!![],'message':_0xe521('0x110')};};Preview[_0xe521('0xe')][_0xe521('0xef')]=function(_0x2aa5e5,_0x33afbf,_0x250f48,_0x33ce3){var _0x4b5223=this;return new Promise(function(_0x53c2da,_0x5d3b46){var _0x1834e9=_0x2aa5e5[_0xe521('0xa1')];var _0xb05d6c=_0x4b5223[_0xe521('0x72')](_0x33afbf['Trunk'])?util[_0xe521('0x27')](_0xe521('0x111'),_0x33afbf[_0xe521('0x10b')][_0xe521('0x29')],_[_0xe521('0x42')](_0x33afbf[_0xe521('0x112')])?'':_0x33afbf[_0xe521('0x112')][_0xe521('0x113')]()||'',_0x33afbf[_0xe521('0x114')]>0x0?_0x250f48[_0xe521('0xeb')][_0xe521('0x115')](_0x33afbf[_0xe521('0x114')]):_0x250f48[_0xe521('0xeb')]):util[_0xe521('0x27')](_0xe521('0x111'),_[_0xe521('0x42')](_0x33afbf['TrunkBackup'])?_0x33afbf[_0xe521('0x10b')][_0xe521('0x29')]:_0x33afbf[_0xe521('0x73')][_0xe521('0x29')],_[_0xe521('0x42')](_0x33afbf[_0xe521('0x112')])?'':_0x33afbf[_0xe521('0x112')][_0xe521('0x113')]()||'',_0x33afbf['dialCutDigit']>0x0?_0x250f48[_0xe521('0xeb')][_0xe521('0x115')](_0x33afbf[_0xe521('0x114')]):_0x250f48[_0xe521('0xeb')]);var _0x17a669=_0x4b5223['isTrunkReachable'](_0x33afbf[_0xe521('0x10b')])?ut['getCallerId'](_0x33afbf[_0xe521('0x10b')][_0xe521('0x116')],_0x33afbf[_0xe521('0x117')],_0x33afbf[_0xe521('0x118')]>0x0?ut[_0xe521('0x119')](_0x33afbf['dialOriginateCallerIdNumber'],_0x33afbf['dialRandomLastDigitCallerIdNumber']):_0x33afbf[_0xe521('0x11a')]):ut[_0xe521('0x11b')](_[_0xe521('0x42')](_0x33afbf[_0xe521('0x73')])?_0x33afbf[_0xe521('0x10b')][_0xe521('0x116')]:_0x33afbf[_0xe521('0x73')][_0xe521('0x116')],_0x33afbf[_0xe521('0x117')],_0x33afbf[_0xe521('0x118')]>0x0?ut[_0xe521('0x119')](_0x33afbf[_0xe521('0x11a')],_0x33afbf['dialRandomLastDigitCallerIdNumber']):_0x33afbf[_0xe521('0x11a')]);if(_0x17a669){_0x2aa5e5[_0xe521('0x11c')]=ut[_0xe521('0x11d')](_0x17a669);_0x2aa5e5[_0xe521('0x11e')]=ut[_0xe521('0x11f')](_0x17a669);}var _0x191910=ut[_0xe521('0x120')](_0x33afbf,_0x250f48,_0xb05d6c,_0x17a669,_0x1834e9,_0x2aa5e5);var _0x3cf388=utils[_0xe521('0x121')](_0x250f48[_0xe521('0xea')]);Object['assign'](_0x191910,_0x3cf388);_['merge'](_0x2aa5e5,ut[_0xe521('0x122')](_0x191910));_0x2aa5e5[_0xe521('0x63')]=moment()[_0xe521('0x27')](_0xe521('0x64'));_0x33afbf[_0xe521('0x123')]=_0x191910;var _0x37bcbf=ut[_0xe521('0x124')](_0x2aa5e5,_0x33afbf,_0x191910,_0x2aa5e5['activeContact'],_0x33ce3);return ami[_0xe521('0x4c')](_0x37bcbf)[_0xe521('0x5a')](function(_0xc3626c){_0x33afbf[_0xe521('0x2e')]+=0x1;logger[_0xe521('0x43')]('[originated][increment]',_0x1834e9,_0xe521('0x92'),_0x33afbf[_0xe521('0x29')],_0xe521('0xd3'),_0x33afbf['originated']);_0x53c2da(_0xc3626c);})[_0xe521('0x4e')](function(_0x4adc81){ut[_0xe521('0xda')](_0x2aa5e5,0xe,'OriginateError');rpcDb[_0xe521('0xdc')](_0x2aa5e5,_0xe521('0x125'));_0x5d3b46(_0x4adc81);});});};Preview[_0xe521('0xe')]['syncNewExten']=function(_0x2ac963){if(this['actions'][_0x2ac963[_0xe521('0x8b')]]){this[_0xe521('0x16')][_0x2ac963['linkedid']]['channel']=_0x2ac963[_0xe521('0x4d')];}};Preview[_0xe521('0xe')][_0xe521('0x126')]=function(_0xb03d9){var _0x4e1b66=this;var _0x4c31ee=this['actions'][_0xb03d9['actionid']];if(_0x4c31ee){if(_0x4c31ee[_0xe521('0x127')]&&this[_0xe521('0x59')][_0x4c31ee[_0xe521('0x127')]]){ut['logLookAgent'](_0x4c31ee,this['agents'][_0x4c31ee[_0xe521('0x127')]][_0xe521('0x29')],this['agents'][_0x4c31ee[_0xe521('0x127')]]['id']);}var _0x47cb7c=_[_0xe521('0x128')](_0x4c31ee);_0x47cb7c[_0xe521('0x8f')]=moment()[_0xe521('0x27')](_0xe521('0x64'));var _0x3da2a9=_0x4e1b66[_0xe521('0x13')][_0x4c31ee['queue']];if(ut[_0xe521('0x129')](_0xb03d9[_0xe521('0x12a')])){if(_0x4c31ee[_0xe521('0x89')]){rpcDb['unlockContact'](_0x4c31ee[_0xe521('0x8d')]);}if(_0x4c31ee[_0xe521('0x8a')]){rpcDb['disableContact'](_0x4c31ee[_0xe521('0x8d')]);}ami[_0xe521('0x2b')](_0xe521('0x12b'),ut[_0xe521('0x7b')](_0x4c31ee,'rejected',this['campaignsPreview'][_0x4c31ee[_0xe521('0x45')]]));this[_0xe521('0xd7')](_0x47cb7c,_0x3da2a9,_0xb03d9);}else{_0x4c31ee[_0xe521('0x63')]=moment()[_0xe521('0x27')](_0xe521('0x64'));ut['logAgent'](_0x47cb7c,0x4,'Answer');rpcDb[_0xe521('0xdc')](_0x47cb7c,_0xe521('0x12c'));}}};Preview[_0xe521('0xe')][_0xe521('0x1a')]=function(_0x5cb6bc){var _0xe26682=this[_0xe521('0x16')][_0x5cb6bc[_0xe521('0x8b')]];var _0x48178d;if(_0xe26682){_0x48178d=this[_0xe521('0x13')][_0xe26682[_0xe521('0x45')]];logger[_0xe521('0x43')](_0xe521('0x12d'),_0x5cb6bc[_0xe521('0x8b')],'\x20Queue',_0x48178d['name'],_0xe521('0x46'),_0x48178d[_0xe521('0x2f')]);}if(this[_0xe521('0x16')][_0x5cb6bc['linkedid']]&&_0x5cb6bc['linkedid']!==_0x5cb6bc[_0xe521('0xa1')]){if(_0x5cb6bc[_0xe521('0x12e')]==='16'&&this['actions'][_0x5cb6bc[_0xe521('0x8b')]][_0xe521('0x47')]){this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}else if(this['actions'][_0x5cb6bc[_0xe521('0x8b')]][_0xe521('0x47')]){logger[_0xe521('0x43')]('[syncHangup][talking][cause]',_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')],'\x20Queue',_0x48178d[_0xe521('0x29')],'pTalking:\x20',_0x48178d['pTalking']);this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}}else if(_0xe26682&&_[_0xe521('0x42')](_0xe26682['statedesc'])&&_0x48178d[_0xe521('0x12f')]&&_0x5cb6bc['linkedid']===_0x5cb6bc[_0xe521('0xa1')]&&_[_0xe521('0x42')](_0x5cb6bc[_0xe521('0xe1')])&&_0x5cb6bc[_0xe521('0x12e')]==='16'&&_0x5cb6bc[_0xe521('0x130')]==='6'&&_[_0xe521('0xd8')](_0xe26682[_0xe521('0x131')])){if(_0xe26682['unlockAgent']){rpcDb[_0xe521('0xff')](_0xe26682[_0xe521('0x8d')]);}if(_0xe26682[_0xe521('0x8a')]){rpcDb[_0xe521('0x62')](_0xe26682[_0xe521('0x8d')]);}_0x5cb6bc['reason']='22';this[_0xe521('0xd7')](_0xe26682,_0x48178d,_0x5cb6bc);}else if(_0xe26682&&_0xe26682[_0xe521('0x131')]){if(_0x5cb6bc[_0xe521('0x12e')]==='16'&&this[_0xe521('0x16')][_0x5cb6bc['linkedid']][_0xe521('0x47')]){logger[_0xe521('0x43')](_0xe521('0x132'),_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')],'\x20Queue',_0x48178d[_0xe521('0x29')],_0xe521('0x46'),_0x48178d[_0xe521('0x2f')]);this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}else if(this[_0xe521('0x16')][_0x5cb6bc[_0xe521('0x8b')]][_0xe521('0x47')]){logger[_0xe521('0x43')](_0xe521('0x133'),_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')],_0xe521('0x92'),_0x48178d['name'],'pTalking:\x20',_0x48178d[_0xe521('0x2f')]);this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}}};Preview[_0xe521('0xe')][_0xe521('0x134')]=function(_0x1318c1){if(this[_0xe521('0x16')][_0x1318c1['destlinkedid']]&&_0x1318c1[_0xe521('0xd5')]!==_0x1318c1[_0xe521('0x135')]){this[_0xe521('0x75')](_0x1318c1,_0x1318c1[_0xe521('0xd5')],_0x1318c1['dialstatus']);}};Preview['prototype'][_0xe521('0x1c')]=function(_0x4d2d9b){if(this[_0xe521('0x16')][_0x4d2d9b[_0xe521('0x8b')]]&&_0x4d2d9b[_0xe521('0x8b')]!==_0x4d2d9b[_0xe521('0xa1')]&&!this[_0xe521('0x16')][_0x4d2d9b[_0xe521('0x8b')]][_0xe521('0x47')]){if(_0x4d2d9b[_0xe521('0x12e')]==='1'){this[_0xe521('0x75')](_0x4d2d9b,_0x4d2d9b['linkedid'],_0x4d2d9b[_0xe521('0x12e')]);}}};Preview[_0xe521('0xe')][_0xe521('0x136')]=function(_0x2c4fd4,_0x344503,_0x2c1f3d){if(this[_0xe521('0x16')][_0x2c4fd4]){if(_[_0xe521('0x42')](this[_0xe521('0x16')][_0x2c4fd4][_0xe521('0x123')])){this[_0xe521('0x16')][_0x2c4fd4][_0xe521('0x123')]={};}this['actions'][_0x2c4fd4][_0xe521('0x123')][_0x344503]=_0x2c1f3d;}};Preview[_0xe521('0xe')]['syncVarSet']=function(_0x29e603){try{if(!_[_0xe521('0x42')](_0x29e603)){if(ut[_0xe521('0x137')](_[_0xe521('0x138')](_0x29e603[_0xe521('0x139')])[0x0])){this['addVariable'](_0x29e603[_0xe521('0xa1')],_['keys'](_0x29e603[_0xe521('0x139')])[0x0],_0x29e603[_0xe521('0x13a')]);}}}catch(_0x10f4ad){logger[_0xe521('0x13b')]('[syncVarSet][Preview]',util[_0xe521('0x13c')](_0x10f4ad,{'showHidden':![],'depth':null}));}};Preview[_0xe521('0xe')][_0xe521('0x21')]=function(_0x1449a1){if(_0x1449a1){if(this[_0xe521('0x16')][_0x1449a1[_0xe521('0x13d')]]){this[_0xe521('0x16')][_0x1449a1[_0xe521('0x13d')]][_0xe521('0x131')]=!![];}}};Preview[_0xe521('0xe')]['syncBlindTransfer']=function(_0x54897a){if(_0x54897a){if(this[_0xe521('0x16')][_0x54897a[_0xe521('0x13e')]]){this[_0xe521('0x16')][_0x54897a[_0xe521('0x13e')]][_0xe521('0x131')]=!![];}}};module[_0xe521('0x13f')]=Preview;
\ No newline at end of file