Built motion from commit 449495f6.|2.6.27
[motion2.git] / server / services / ami / preview / index.js
index 7111e73..61e4d7b 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[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','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x2fbb92,_0x466ca1){var _0x10778a=function(_0x20fb0f){while(--_0x20fb0f){_0x2fbb92['push'](_0x2fbb92['shift']());}};_0x10778a(++_0x466ca1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview;
\ No newline at end of file