Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / services / ami / preview / index.js
index 7d7fb2d..02704ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x40ff=['IsNotLoggedIn','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','scheduledAt','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countcongestionretry','CANCEL','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','lookAgent','isEmpty','execCall','Queue:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','trunks','SIP/%s','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','VoiceQueueId','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','campaign\x20Name:\x20','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','merge','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','ioredis','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','agents','clockClearZombieChannels','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','stringify','format','voice:queue:%s','name','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','clearZombieChannels','preview','type','outbound','setMessage','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','dialAnswer','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]'];(function(_0x25e2c9,_0x503114){var _0x1e5b99=function(_0xb9a1fb){while(--_0xb9a1fb){_0x25e2c9['push'](_0x25e2c9['shift']());}};_0x1e5b99(++_0x503114);}(_0x40ff,0xd0));var _0xf40f=function(_0x207a27,_0x4dc9fc){_0x207a27=_0x207a27-0x0;var _0x41de7f=_0x40ff[_0x207a27];return _0x41de7f;};'use strict';var util=require('util');var _=require(_0xf40f('0x0'));var uuid=require(_0xf40f('0x1'));var moment=require('moment');var Redis=require(_0xf40f('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xf40f('0x3'))(_0xf40f('0x4'));var ami=require(_0xf40f('0x5'));var rpcDb=require(_0xf40f('0x6'));var cmHopperAdditionalPhone=require(_0xf40f('0x7'));var Action=require(_0xf40f('0x8'));var ut=require(_0xf40f('0x9'));var utils=require('../dialer/utils');config[_0xf40f('0xa')]=_['defaults'](config[_0xf40f('0xa')],{'host':_0xf40f('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf40f('0xa')]));var Sequence=function(){};Sequence[_0xf40f('0xc')][_0xf40f('0xd')]=function(_0x4f1ecd){this['tail']=this['tail']?this[_0xf40f('0xe')][_0xf40f('0xf')](_0x4f1ecd):_0x4f1ecd();};function Preview(_0x440a63){this[_0xf40f('0x10')]=new Sequence();this[_0xf40f('0x11')]=_0x440a63[_0xf40f('0x12')];this['trunks']=_0x440a63['trunks'];this[_0xf40f('0x13')]={};this[_0xf40f('0x14')]=_0x440a63[_0xf40f('0x14')];this[_0xf40f('0x15')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x17'),this[_0xf40f('0x18')][_0xf40f('0x16')](this));ami['on']('hanguprequest',this[_0xf40f('0x19')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x1a'),this[_0xf40f('0x1b')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x1c'),this[_0xf40f('0x1d')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x1e'),this[_0xf40f('0x1f')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x20'),this[_0xf40f('0x21')][_0xf40f('0x16')](this));ami['on'](_0xf40f('0x22'),this['syncBlindTransfer'][_0xf40f('0x16')](this));this[_0xf40f('0x23')](this['campaignsPreview']);}function emit(_0x3201fa,_0x31aebd,_0x5874a4){io['to'](_0x3201fa)[_0xf40f('0x24')](_0x31aebd,_0x5874a4);}function emitVoiceQueueChannelRemove(_0x59833f){logger[_0xf40f('0x25')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xf40f('0x26')](_0x59833f));emit(util[_0xf40f('0x27')](_0xf40f('0x28'),_0x59833f[_0xf40f('0x29')]),'voice_queue_channel:remove',_0x59833f);io[_0xf40f('0x24')](_0xf40f('0x2a'),_0x59833f);}function notSendMessagesQueue(_0x52318d){if(_0x52318d[_0xf40f('0x2b')]){if(_0x52318d[_0xf40f('0x2c')]===0x0&&_0x52318d[_0xf40f('0x2d')]===0x0){_0x52318d[_0xf40f('0x2b')]=![];_0x52318d['available']=0x0;_0x52318d[_0xf40f('0x2e')]=0x0;_0x52318d['message']=utils[_0xf40f('0x2f')][_0xf40f('0x30')];ut[_0xf40f('0x31')](_0xf40f('0x32'),_0x52318d[_0xf40f('0x29')]+_0xf40f('0x33'));}else{_0x52318d[_0xf40f('0x34')]=utils[_0xf40f('0x2f')][_0xf40f('0x35')];ut[_0xf40f('0x31')](_0xf40f('0x32'),_0x52318d[_0xf40f('0x29')]+_0xf40f('0x36'));}}}Preview[_0xf40f('0xc')][_0xf40f('0x23')]=function(){var _0x52d67a=this;setInterval(function(){_0x52d67a['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xf40f('0x37')]=function(){var _0x7f816e=this[_0xf40f('0x11')];this[_0xf40f('0x15')]+=0x1;for(var _0x95ce3 in _0x7f816e){if(_0x7f816e['hasOwnProperty'](_0x95ce3)&&(_0x7f816e[_0x95ce3][_0xf40f('0x38')]==='preview'||_0x7f816e[_0x95ce3][_0xf40f('0x38')]===_0xf40f('0x39'))&&_0x7f816e[_0x95ce3]['type']==='outbound'){if(this[_0xf40f('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xf40f('0x3a')]();}}if(_0x7f816e['hasOwnProperty'](_0x95ce3)&&_0x7f816e[_0x95ce3]['dialMethod']===_0xf40f('0x3b')&&_0x7f816e[_0x95ce3][_0xf40f('0x3c')]===_0xf40f('0x3d')){if(_0x7f816e[_0x95ce3]['dialActive']){this[_0xf40f('0x3e')](_0x7f816e[_0x95ce3]);if(_0x7f816e[_0x95ce3]['dialPreviewAutoRecallMe'])this[_0xf40f('0x3f')](_0x7f816e[_0x95ce3]);}else{notSendMessagesQueue(_0x7f816e[_0x95ce3]);}}}};Preview[_0xf40f('0xc')][_0xf40f('0x40')]=function(_0x2bca5d){var _0x4e543b=this;this[_0xf40f('0x10')]['enqueue'](function(){if(!_[_0xf40f('0x41')](_0x4e543b[_0xf40f('0x13')][_0x2bca5d])){loggerAction[_0xf40f('0x25')]('[clearZombieChannels][talking]',_0x2bca5d,_0xf40f('0x42'),_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')],_0xf40f('0x44'),JSON['stringify'](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]][_0xf40f('0x2c')]),'pTalking:\x20',JSON[_0xf40f('0x26')](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]][_0xf40f('0x2d')]),JSON[_0xf40f('0x26')](_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x45')]),JSON[_0xf40f('0x26')](_['pick'](_0x4e543b[_0xf40f('0x13')][_0x2bca5d],[_0xf40f('0x46'),_0xf40f('0x47'),'VoiceQueueId',_0xf40f('0x48')])));return ami[_0xf40f('0x49')]({'action':_0xf40f('0x4a'),'channel':_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x4b')]})[_0xf40f('0x4c')](function(_0x503af1){if(_0x503af1[_0xf40f('0x34')]===_0xf40f('0x4d')){setTimeout(function(){if(_0x4e543b[_0xf40f('0x13')][_0x2bca5d]){utils[_0xf40f('0x4e')](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]],_0xf40f('0x4f'));if(_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x45')]===!![]){ut[_0xf40f('0x50')](_0x4e543b[_0xf40f('0x11')][_0x4e543b[_0xf40f('0x13')][_0x2bca5d]['queue']],_0xf40f('0x4f'));ut[_0xf40f('0x51')](_0xf40f('0x52')+_0x2bca5d,_0x4e543b[_0xf40f('0x13')][_0x2bca5d]['queue']);}ut[_0xf40f('0x51')](_0xf40f('0x53')+_0x2bca5d,_0x4e543b[_0xf40f('0x13')][_0x2bca5d][_0xf40f('0x43')]);delete _0x4e543b['actions'][_0x2bca5d];}},0x2328);}});}});};Preview['prototype'][_0xf40f('0x3a')]=function(){var _0x3eea0f=this;loggerAction['info'](_0xf40f('0x54'),_[_0xf40f('0x55')](this[_0xf40f('0x13')]));for(var _0x359398 in this[_0xf40f('0x13')]){if(_0x3eea0f[_0xf40f('0x13')][_0xf40f('0x56')](_0x359398)){_0x3eea0f[_0xf40f('0x40')](_0x359398);}}};Preview[_0xf40f('0xc')][_0xf40f('0x3f')]=function(_0x58972d){var _0x27de23=this;rpcDb[_0xf40f('0x57')](_0x58972d['id'],ut[_0xf40f('0x58')](this[_0xf40f('0x14')]))[_0xf40f('0x59')](function(_0x508402){if(!_[_0xf40f('0x41')](_0x508402)){for(var _0x3b80f4=0x0;_0x3b80f4<_0x508402['length'];_0x3b80f4+=0x1){if(ut[_0xf40f('0x5a')](_0x508402[_0x3b80f4][_0xf40f('0x5b')])<_0x58972d[_0xf40f('0x5c')]*0x3c){if(_0x508402[_0x3b80f4]['Agent']&&!_0x508402[_0x3b80f4][_0xf40f('0x5d')][_0xf40f('0x5e')]){_0x27de23['run'](_0x508402[_0x3b80f4]['id'])[_0xf40f('0x59')](ut[_0xf40f('0x5f')](_0xf40f('0x60')))['catch'](ut[_0xf40f('0x5f')](_0xf40f('0x60')));}else{rpcDb[_0xf40f('0x61')](_0x508402[_0x3b80f4]['id']);}}else{var _0x563df3=new Action(_0x508402[_0x3b80f4],_0x58972d);_0x563df3[_0xf40f('0x62')]=moment()[_0xf40f('0x27')](_0xf40f('0x63'));_0x58972d[_0xf40f('0x64')]+=0x1;ut['logCustomer'](_0x563df3,0x17,_0xf40f('0x65'));if(_0x58972d['dialRecallInQueue']){rpcDb[_0xf40f('0x66')](ut[_0xf40f('0x67')](_0x508402[_0x3b80f4]));rpcDb[_0xf40f('0x68')](_0x563df3,_0xf40f('0x69'));}else{ut[_0xf40f('0x6a')](_0x563df3,0x16,_0xf40f('0x6b'));rpcDb[_0xf40f('0x68')](_0x563df3,_0xf40f('0x6c'));rpcDb[_0xf40f('0x6d')](_0x563df3,'[HistoryRecallClose]');}}}}})[_0xf40f('0x4c')](ut[_0xf40f('0x5f')](_0xf40f('0x6e')));};Preview[_0xf40f('0xc')][_0xf40f('0x3e')]=function(_0x39e29b){_0x39e29b[_0xf40f('0x2b')]=!![];if(ut[_0xf40f('0x6f')](_0x39e29b['loggedIn'])){_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xf40f('0x70')](_0x39e29b[_0xf40f('0x71')])){_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')]['INACTIVE'];}else if(!this['isTrunkReachable'](_0x39e29b[_0xf40f('0x72')])){if(!this[_0xf40f('0x73')](_0x39e29b[_0xf40f('0x74')])){_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')]['UNREACHABLE_TRUNK'];}else{_0x39e29b['message']=utils[_0xf40f('0x2f')]['ACTIVE'];}}else{_0x39e29b[_0xf40f('0x34')]=utils[_0xf40f('0x2f')][_0xf40f('0x75')];}};Preview[_0xf40f('0xc')][_0xf40f('0x76')]=function(_0x54f780,_0x6b9bb7,_0x3dcd34){var _0x414165=this;var _0x3bf62f=this[_0xf40f('0x13')][_0x6b9bb7];var _0xc089c4=this[_0xf40f('0x11')][_0x3bf62f[_0xf40f('0x43')]];var _0x5aa502;var _0x1dd912=![];var _0x31dbd4=0x2;var _0x3b83e9=0x3;if(_0xc089c4){switch(_0x3dcd34){case'1':_0xc089c4['outboundNoSuchCallsDay']+=0x1;_0x3bf62f[_0xf40f('0x77')]+=0x1;_0x3bf62f['countglobal']=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x0,_0xf40f('0x79'));ami[_0xf40f('0x24')](_0xf40f('0x7a'),ut['buildObj'](_0x3bf62f,_0xf40f('0x7b')));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0x7c'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'0',_0xc089c4)[_0xf40f('0x59')](function(_0xa3a813){_0x1dd912=_0xa3a813[_0xf40f('0x7e')]==0x1;_0x31dbd4=_0xc089c4[_0xf40f('0x7f')];_0x3b83e9=_0xc089c4['callAdditionalPhoneAfterMin'];if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0x83'));}else{if(_0x3bf62f[_0xf40f('0x77')]>=_0xc089c4[_0xf40f('0x84')]){rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0x83'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3bf62f,'countnosuchnumberretry',_0xc089c4[_0xf40f('0x7f')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0x87')]];}else{_0x3bf62f[_0xf40f('0x77')]++;logger[_0xf40f('0x25')](_0xf40f('0x88'),_0x3bf62f[_0xf40f('0x77')]);logger[_0xf40f('0x25')]('id',_0x3bf62f[_0xf40f('0x89')]);_0x414165['incrementPreviewCounters']({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnosuchnumberretry':_0x3bf62f['countnosuchnumberretry']}})[_0xf40f('0x59')](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case _0xf40f('0x8b'):var _0x17c9a7=moment()['format'](_0xf40f('0x63'));_0x3bf62f[_0xf40f('0x8c')]=_0x17c9a7;_0x3bf62f[_0xf40f('0x8d')]=_0x17c9a7;_0x3bf62f[_0xf40f('0x45')]=!![];_0xc089c4['pTalking']+=0x1;logger[_0xf40f('0x25')]('[syncHangup][talking][increment]',_0x3bf62f[_0xf40f('0x8e')],_0xf40f('0x8f'),_0xc089c4[_0xf40f('0x29')],_0xf40f('0x90'),_0xc089c4['pTalking']);ami['emit'](_0xf40f('0x91'),ut[_0xf40f('0x92')](_0x3bf62f,'connect',this['campaignsPreview'][_0x3bf62f[_0xf40f('0x43')]]));if(_0xc089c4['acw']||_0xc089c4[_0xf40f('0x93')]){ami[_0xf40f('0x24')](_0xf40f('0x94'),{'queue':_0x3bf62f[_0xf40f('0x43')],'interface':_0x3bf62f[_0xf40f('0x95')],'uniqueid':_0x3bf62f[_0xf40f('0x8e')]});}break;case'16':ami[_0xf40f('0x24')](_0xf40f('0x96'),ut[_0xf40f('0x92')](_0x3bf62f,_0xf40f('0x97'),this[_0xf40f('0x11')][_0x3bf62f[_0xf40f('0x43')]]));emitVoiceQueueChannelRemove(ut[_0xf40f('0x92')](_0x3bf62f,'complete'));_0xc089c4[_0xf40f('0x98')]+=0x1;_0xc089c4['total']+=0x1;_0xc089c4[_0xf40f('0x99')]+=0x1;ut[_0xf40f('0x50')](_0xc089c4,_0xf40f('0x9a'));_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x4,_0xf40f('0x9c'));rpcDb['createCustomerHistory'](_0x3bf62f,_0xf40f('0x9d'));rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0x9e'));rpcDb['crateCustomerReportQueue'](_0x3bf62f);_0xc089c4[_0xf40f('0x9f')]+=_0x3bf62f['talktime'];_0xc089c4['sumBillable']+=_0x3bf62f[_0xf40f('0xa0')];logger['info'](_0xf40f('0xa1'),_0x3bf62f[_0xf40f('0x8e')],'\x20Queue',_0xc089c4[_0xf40f('0x29')],_0xf40f('0x90'),_0xc089c4[_0xf40f('0x2d')]);delete this[_0xf40f('0x13')][_0x54f780['linkedid']];break;case _0xf40f('0xa2'):_0xc089c4[_0xf40f('0xa3')]+=0x1;_0x3bf62f['countbusyretry']+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut['totalGlobal'](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x5,_0xf40f('0xa4'));_0x31dbd4=_0xc089c4[_0xf40f('0xa5')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];ami['emit'](_0xf40f('0xa7'),ut['buildObj'](_0x3bf62f,'busy'));rpcDb[_0xf40f('0x68')](_0x3bf62f,'[callProgressDetectingCustomer][logBusy]');_0x414165[_0xf40f('0x7d')](_0x3bf62f,'5',_0xc089c4)[_0xf40f('0x59')](function(_0x4d31c9){_0x1dd912=_0x4d31c9[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xa8'));}else{if(_0x3bf62f[_0xf40f('0xa9')]>=_0xc089c4['dialBusyMaxRetry']){rpcDb[_0xf40f('0x6d')](_0x3bf62f,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3bf62f,_0xf40f('0xa9'),_0xc089c4[_0xf40f('0xa5')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f['countbusyretry']++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f['idContact'],'field':{'countbusyretry':_0x3bf62f[_0xf40f('0xa9')]}})['then'](function(){_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)['then'](function(){});});}});break;case _0xf40f('0xab'):_0xc089c4[_0xf40f('0xac')]+=0x1;_0x3bf62f[_0xf40f('0xad')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x3,_0xf40f('0xae'));_0x31dbd4=_0xc089c4[_0xf40f('0xaf')];_0x3b83e9=_0xc089c4['callAdditionalPhoneAfterMin'];var _0x38b79a=ut['buildNoAnswerEventPayload'](_0x3bf62f,_0xc089c4);ami[_0xf40f('0x24')]('custom:agentnoanswer',_0x38b79a);rpcDb[_0xf40f('0x68')](_0x3bf62f,'[callProgressDetectingCustomer][logNoAnswer]');_0x414165['verifyAdditionalPhones'](_0x3bf62f,'3',_0xc089c4)[_0xf40f('0x59')](function(_0x24f1b3){_0x1dd912=_0x24f1b3['additional']==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xb0'));}else{if(_0x3bf62f[_0xf40f('0xad')]>=_0xc089c4[_0xf40f('0xb1')]){rpcDb[_0xf40f('0x6d')](_0x3bf62f,_0xf40f('0xb2'));}else{rpcDb[_0xf40f('0xb3')](ut[_0xf40f('0xb4')](_0x3bf62f,'countnoanswerretry',_0xc089c4[_0xf40f('0xaf')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})[_0xf40f('0x59')](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case _0xf40f('0xb5'):_0xc089c4['outboundCongestionCallsDay']+=0x1;_0x3bf62f['countcongestionretry']+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x8,_0xf40f('0xb6'));_0x31dbd4=_0xc089c4[_0xf40f('0xb7')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];ami[_0xf40f('0x24')](_0xf40f('0xb8'),ut[_0xf40f('0x92')](_0x3bf62f,'congestion'));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xb9'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'8',_0xc089c4)[_0xf40f('0x59')](function(_0x267ff7){_0x1dd912=_0x267ff7[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x3bf62f['countcongestionretry']>=_0xc089c4[_0xf40f('0xba')]){rpcDb[_0xf40f('0x6d')](_0x3bf62f,_0xf40f('0xb9'));}else{rpcDb['rescheduleContact'](ut[_0xf40f('0xb4')](_0x3bf62f,_0xf40f('0xbb'),_0xc089c4[_0xf40f('0xa5')]),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f[_0xf40f('0xbb')]++;_0x414165['incrementPreviewCounters']({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countcongestionretry':_0x3bf62f[_0xf40f('0xbb')]}})[_0xf40f('0x59')](function(){_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case _0xf40f('0xbc'):_0xc089c4['outboundRejectCallsDay']+=0x1;_0x3bf62f['countagentrejectretry']+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x14,'AgentReject');_0x31dbd4=_0xc089c4[_0xf40f('0xbd')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];ami[_0xf40f('0x24')](_0xf40f('0xbe'),ut[_0xf40f('0x92')](_0x3bf62f,'agentreject'));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xbf'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'20',_0xc089c4)[_0xf40f('0x59')](function(_0x291e52){_0x1dd912=_0x291e52[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut['cloneAction'](_0x3bf62f,0x14,_0xf40f('0xc0'));rpcDb['createCustomerFinal'](_0x5aa502,_0xf40f('0xc1'));}else{if(_0x3bf62f[_0xf40f('0xc2')]>=_0xc089c4[_0xf40f('0xc3')]){rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0xc1'));}else{rpcDb[_0xf40f('0xb3')](ut[_0xf40f('0xb4')](_0x3bf62f,_0xf40f('0xc2'),_0xc089c4['dialAgentRejectRetryFrequency']),_0x3bf62f[_0xf40f('0x85')],_0x3bf62f[_0xf40f('0x86')]);}}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})[_0xf40f('0x59')](function(){_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)['then'](function(){});});}});break;case _0xf40f('0xc4'):_0xc089c4[_0xf40f('0xc5')]+=0x1;_0x3bf62f[_0xf40f('0xc6')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0xb,_0xf40f('0xc7'));rpcDb['createCustomerHistory'](_0x3bf62f,_0xf40f('0xc8'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'11',_0xc089c4)[_0xf40f('0x59')](function(_0x2a87c1){_0x1dd912=_0x2a87c1[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4['dialGlobalMaxRetry']){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,'Global');rpcDb['createCustomerFinal'](_0x5aa502,_0xf40f('0xc8'));}else{if(_0x3bf62f[_0xf40f('0xc9')]>=_0xc089c4['dialAbandonedMaxRety']){rpcDb[_0xf40f('0x6d')](_0x3bf62f,_0xf40f('0xc8'));}else{rpcDb[_0xf40f('0xb3')](ut[_0xf40f('0xb4')](_0x3bf62f,'countabandonedretry',_0xc089c4['dialAbandonedRetryFrequency']),_0x3bf62f['unlockAgent'],_0x3bf62f['activeContact']);}}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})['then'](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});break;case'18':_0xc089c4[_0xf40f('0xca')]+=0x1;_0x3bf62f[_0xf40f('0xcb')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut['totalGlobal'](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x12,_0x54f780[_0xf40f('0xcc')]||_0x54f780[_0xf40f('0xcd')]);ami['emit'](_0xf40f('0xce'),ut['buildObj'](_0x3bf62f,'amd'));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xcf'));_0x414165[_0xf40f('0x7d')](_0x3bf62f,'18',_0xc089c4)['then'](function(_0x5169c5){_0x1dd912=_0x5169c5[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0x12,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xcf'));}else{rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0xcf'));}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165['incrementPreviewCounters']({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})[_0xf40f('0x59')](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)['then'](function(){});});}});delete this['actions'][_0x54f780[_0xf40f('0x87')]];break;case'19':_0xc089c4[_0xf40f('0xca')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut[_0xf40f('0x78')](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0x13,_0x54f780[_0xf40f('0xcc')]||_0x54f780[_0xf40f('0xcd')]);ami[_0xf40f('0x24')]('custom:amd',ut[_0xf40f('0x92')](_0x3bf62f,_0xf40f('0xd0')));rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xd1'));_0x414165['verifyAdditionalPhones'](_0x3bf62f,'18',_0xc089c4)[_0xf40f('0x59')](function(_0xa350fd){_0x1dd912=_0xa350fd['additional']==0x1;if(!_0x1dd912){if(ut[_0xf40f('0x78')](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut[_0xf40f('0x81')](_0x3bf62f,0xf,'Global');rpcDb[_0xf40f('0x6d')](_0x5aa502,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x3bf62f,_0xf40f('0xd1'));}}else{_0x3bf62f[_0xf40f('0xad')]++;_0x414165[_0xf40f('0xaa')]({'id':_0x3bf62f[_0xf40f('0x89')],'field':{'countnoanswerretry':_0x3bf62f[_0xf40f('0xad')]}})['then'](function(){_0x414165[_0xf40f('0x8a')](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});});}});delete this[_0xf40f('0x13')][_0x54f780['linkedid']];break;default:if(_0x3bf62f[_0xf40f('0x45')]){ut[_0xf40f('0x50')](_0xc089c4,_0xf40f('0xd2'));ut[_0xf40f('0x51')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0xc089c4['name'],_0x54f780);}_0xc089c4[_0xf40f('0xca')]+=0x1;_0x3bf62f[_0xf40f('0x9b')]=ut['totalGlobal'](_0x3bf62f);ut[_0xf40f('0x6a')](_0x3bf62f,0xc,_0x54f780[_0xf40f('0xcc')]||_0x54f780[_0xf40f('0xcd')]);_0x31dbd4=_0xc089c4[_0xf40f('0xbd')];_0x3b83e9=_0xc089c4[_0xf40f('0xa6')];rpcDb[_0xf40f('0x68')](_0x3bf62f,_0xf40f('0xd3'));_0x414165['verifyAdditionalPhones'](_0x3bf62f,'20',_0xc089c4)[_0xf40f('0x59')](function(_0x35c42c){_0x1dd912=_0x35c42c[_0xf40f('0x7e')]==0x1;if(!_0x1dd912){if(ut['totalGlobal'](_0x3bf62f)>=_0xc089c4[_0xf40f('0x80')]){_0x5aa502=ut['cloneAction'](_0x3bf62f,0xf,_0xf40f('0x82'));rpcDb[_0xf40f('0x6d')](_0x5aa502,_0xf40f('0xd4'));}else{rpcDb[_0xf40f('0x6d')](_0x3bf62f,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0x87')]];}else{_0x414165['swapAdditionalPhones'](_0x3bf62f,_0x31dbd4,_0x3b83e9)[_0xf40f('0x59')](function(){});}});}if(!(_0x3bf62f['dialAnswer']&&_0x3dcd34==='16')){utils[_0xf40f('0x4e')](_0xc089c4,_0xf40f('0xd5'));logger['info'](_0xf40f('0xd6'),_0x3bf62f[_0xf40f('0x8e')],'\x20Queue',_0xc089c4[_0xf40f('0x29')],'originated:\x20',_0xc089c4[_0xf40f('0x2c')]);}if(_0x3dcd34!==_0xf40f('0x8b')){delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0x87')]];delete this[_0xf40f('0x13')][_0x54f780[_0xf40f('0xd7')]];}_0xc089c4[_0xf40f('0xd8')]=!![];}};Preview['prototype'][_0xf40f('0xd9')]=function(_0xc5b1cb,_0xea5eb1,_0x2e429d){if(_[_0xf40f('0xda')](_0xea5eb1)&&_0xf40f('0xdb')!==typeof _0xea5eb1){return;}if(_[_0xf40f('0xda')](_0x2e429d)&&_0xf40f('0xdb')!==typeof _0x2e429d){return;}switch(_0x2e429d['reason']){case'0':ut[_0xf40f('0xdc')](_0xc5b1cb,0x0,_0xf40f('0x79'));rpcDb[_0xf40f('0xdd')](_0xc5b1cb,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xf40f('0xdc')](_0xc5b1cb,0x3,_0xf40f('0xae'));rpcDb[_0xf40f('0xdd')](_0xc5b1cb,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xf40f('0xdc')](_0xc5b1cb,0x5,'Busy');rpcDb[_0xf40f('0xdd')](_0xc5b1cb,_0xf40f('0xde'));break;case'8':ut[_0xf40f('0xdc')](_0xc5b1cb,0x8,'Congestion');rpcDb[_0xf40f('0xdd')](_0xc5b1cb,_0xf40f('0xdf'));break;case'22':ut[_0xf40f('0xdc')](_0xc5b1cb,0x16,'AnswerAGI');rpcDb[_0xf40f('0xdd')](_0xc5b1cb,_0xf40f('0xe0'));break;default:ut[_0xf40f('0xdc')](_0xc5b1cb,0xc,_0x2e429d[_0xf40f('0xe1')]);rpcDb['createAgentHistory'](_0xc5b1cb,_0xf40f('0xdf'));}utils[_0xf40f('0x4e')](_0xea5eb1,'[callProgressDetectingAgent]');logger[_0xf40f('0x25')](_0xf40f('0xe2'),_0xc5b1cb['uniqueid'],_0xf40f('0x8f'),_0xea5eb1[_0xf40f('0x29')],_0xf40f('0x44'),_0xea5eb1[_0xf40f('0x2c')]);delete this[_0xf40f('0x13')][_0xc5b1cb['uniqueid']];};Preview['prototype']['verifyAdditionalPhones']=function(_0xbcd73b,_0x327fd1,_0x12ff27){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xbcd73b,_0x327fd1,_0x12ff27)['catch'](logger[_0xf40f('0x25')](_0xf40f('0xe3')));};Preview[_0xf40f('0xc')]['swapAdditionalPhones']=function(_0x410b5d,_0x2c6bc8,_0x2dc1e0){return cmHopperAdditionalPhone[_0xf40f('0x8a')](_0x410b5d,_0x2c6bc8,_0x2dc1e0)['catch'](logger[_0xf40f('0x25')](_0xf40f('0xe4')));};Preview['prototype'][_0xf40f('0xaa')]=function(_0x56ec97){return Promise[_0xf40f('0xe5')]()[_0xf40f('0x59')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x56ec97))[_0xf40f('0x4c')](logger[_0xf40f('0x25')](_0xf40f('0xe6')));};Preview[_0xf40f('0xc')][_0xf40f('0xe7')]=function(_0x3b29dc,_0x1314f5,_0x267d57,_0x380209,_0x34244c){var _0x41c2d9=this;return new Promise(function(_0x35f205,_0x224b20){if(_[_0xf40f('0x41')](_0x1314f5)||_[_0xf40f('0x41')](_0x1314f5['Contact'])||_['isNil'](_0x1314f5['phone'])||_[_0xf40f('0x41')](_0x1314f5['VoiceQueueId'])){_0x224b20(ut[_0xf40f('0x34')]('Contact\x20is\x20undefined',_0x380209,_0x34244c));return;}var _0x632003=uuid['v4']();var _0xa02459=_0x41c2d9[_0xf40f('0x11')][_0x1314f5['Queue']['name']];var _0x22521=_0x267d57?_0x41c2d9[_0xf40f('0x14')][_0x267d57]['id']:undefined;_0x41c2d9[_0xf40f('0x13')][_0x632003]=new Action(_0x1314f5,_0xa02459,_0x632003,_0x267d57,_0x22521);var _0x4e994a=_0x41c2d9['actions'][_0x632003];_0x4e994a['unlockAgent']=_0x380209;_0x4e994a['activeContact']=_0x34244c;_0x4e994a[_0xf40f('0xe8')]=_0x267d57;if(_[_0xf40f('0xe9')](_0x3b29dc)){_0x41c2d9[_0xf40f('0xea')](_0x4e994a,_0xa02459,_0x1314f5,_0x267d57)[_0xf40f('0x59')](function(_0x58c679){logger[_0xf40f('0x25')]('[Preview][execCall][success]',_0xf40f('0xeb')+_0x4e994a[_0xf40f('0x43')]+'\x20IdHopper:\x20'+_0x4e994a[_0xf40f('0x89')],JSON[_0xf40f('0x26')](_0x58c679));ami[_0xf40f('0x24')]('custom:agentcalled',ut[_0xf40f('0x92')](_0x4e994a,_0xf40f('0xec'),_0x41c2d9[_0xf40f('0x11')][_0x4e994a['queue']]));_0x35f205(ut[_0xf40f('0x34')](_0xf40f('0xed')));})[_0xf40f('0x4c')](function(_0x583d28){ut[_0xf40f('0x31')](_0xf40f('0xee'),_0x583d28);_0x224b20(ut[_0xf40f('0x34')](_0xf40f('0xef'),_0x380209,_0x34244c));});}else{_0xa02459[_0xf40f('0xf0')]+=0x1;ut[_0xf40f('0xf1')](_0x4e994a);rpcDb[_0xf40f('0xf2')](_0x4e994a,_0xf40f('0xf3'));delete _0x41c2d9[_0xf40f('0x13')][_0x632003];_0x224b20(ut[_0xf40f('0x34')]('Contact\x20in\x20black\x20List',_0x380209,_0x34244c));}});};Preview[_0xf40f('0xc')][_0xf40f('0x73')]=function(_0x546fba){return!_[_0xf40f('0x41')](_0x546fba)&&!_['isNil'](_0x546fba[_0xf40f('0x29')])&&!_[_0xf40f('0x41')](_0x546fba[_0xf40f('0xf4')])&&_0x546fba[_0xf40f('0xf4')]&&!_['isNil'](this[_0xf40f('0xf5')][util['format'](_0xf40f('0xf6'),_0x546fba[_0xf40f('0x29')])])&&!_['isNil'](this[_0xf40f('0xf5')][util[_0xf40f('0x27')]('SIP/%s',_0x546fba[_0xf40f('0x29')])][_0xf40f('0x4a')])&&(this[_0xf40f('0xf5')][util[_0xf40f('0x27')]('SIP/%s',_0x546fba[_0xf40f('0x29')])][_0xf40f('0x4a')]===_0xf40f('0xf7')||this['trunks'][util[_0xf40f('0x27')]('SIP/%s',_0x546fba['name'])][_0xf40f('0x4a')]===_0xf40f('0xf8'));};Preview[_0xf40f('0xc')][_0xf40f('0xf9')]=function(_0x4dc76b,_0x9896cb){return this[_0xf40f('0xfa')](_0x4dc76b,_0x9896cb)[_0xf40f('0x59')](function(_0x515c4d){return _[_0xf40f('0xfb')](_0x515c4d,[_0xf40f('0x34')]);})[_0xf40f('0x4c')](function(_0x397077){if(_0x397077[_0xf40f('0xfc')]){rpcDb[_0xf40f('0xfd')](_0x4dc76b);}if(_0x397077['active']){rpcDb[_0xf40f('0x61')](_0x4dc76b);}throw _[_0xf40f('0xfb')](_0x397077,[_0xf40f('0x34')]);});};Preview[_0xf40f('0xc')][_0xf40f('0xfa')]=function(_0x72f9ec,_0xff3d4b){var _0x149ed9=this;var _0x20fae9,_0x272e27;return rpcDb[_0xf40f('0xfe')](_0x72f9ec)['then'](function(_0x11a9bc){if(!_[_0xf40f('0x41')](_0x11a9bc[0x0])){_0x272e27=_0x11a9bc[0x0][_0xf40f('0xff')]?![]:!![];_0x20fae9=_0x11a9bc[0x0][_0xf40f('0xff')]?!![]:![];_0x20fae9=_0xff3d4b?!![]:_0x20fae9;}var _0x361821=_0x149ed9[_0xf40f('0x100')](_0x11a9bc);if(_0x361821['isValid']){rpcDb[_0xf40f('0x101')](_[_0xf40f('0xfb')](_0x11a9bc[0x0],[_0xf40f('0x102'),_0xf40f('0x103')]))['then'](function(_0x555ed6){_0x149ed9[_0xf40f('0xe7')](_0x555ed6,_0x11a9bc[0x0],_0xff3d4b,_0x272e27,_0x20fae9)['then'](function(_0x52db5d){return _0x52db5d;})['catch'](function(_0x47421d){throw _0x47421d;});})['catch'](function(_0x5805dc){ut[_0xf40f('0x31')](_0xf40f('0x104'),_0x5805dc);throw ut[_0xf40f('0x34')](_0xf40f('0x105'),_0x272e27,_0x20fae9);});}else{throw ut[_0xf40f('0x34')](_0x361821[_0xf40f('0x34')],_0x272e27,_0x20fae9);}})[_0xf40f('0x4c')](function(_0x3884b1){ut['logger'](_0xf40f('0x106'),_0x3884b1);throw ut['message'](_0xf40f('0x105'),![],!![]);});};Preview[_0xf40f('0xc')][_0xf40f('0x100')]=function(_0x352941){if(_[_0xf40f('0x41')](_0x352941)||_['isEmpty'](_0x352941)||!_['isNil'](_0x352941[0x0][_0xf40f('0x5d')])&&_['isNil'](_0x352941[0x0][_0xf40f('0x5d')]['name'])){ut[_0xf40f('0x31')](_0xf40f('0x107'),_0x352941);return{'isValid':![],'message':_0xf40f('0x108')};}var _0x7f01e3=this[_0xf40f('0x11')][_0x352941[0x0][_0xf40f('0x42')][_0xf40f('0x29')]];_0x7f01e3[_0xf40f('0x34')]=utils[_0xf40f('0x2f')][_0xf40f('0x75')];if(_['isNil'](_0x7f01e3)){ut['logger'](_0xf40f('0x109'),_0x7f01e3);return{'isValid':![],'message':_0xf40f('0x10a')};}if(!this[_0xf40f('0x73')](_0x7f01e3[_0xf40f('0x72')])){ut[_0xf40f('0x31')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x7f01e3[_0xf40f('0x29')]+_0xf40f('0x10b'));if(!this[_0xf40f('0x73')](_0x7f01e3[_0xf40f('0x74')])){ut[_0xf40f('0x31')](_0xf40f('0x10c'),_0x7f01e3[_0xf40f('0x29')]+_0xf40f('0x10d'));return{'isValid':![],'message':_0xf40f('0x10e')};}}if(!ut[_0xf40f('0x70')](_0x7f01e3[_0xf40f('0x71')])){ut[_0xf40f('0x31')]('[Preview][validateContact][Campaign\x20Active]',_0x7f01e3[_0xf40f('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xf40f('0x10f')+_0x7f01e3[_0xf40f('0x29')]+_0xf40f('0x110')};}return{'isValid':!![],'message':_0xf40f('0x111')};};Preview[_0xf40f('0xc')]['execCall']=function(_0x5eeae3,_0xcf3b8e,_0x20c99e,_0x44d99a){var _0x314dd2=this;return new Promise(function(_0x1b0843,_0x59d225){var _0x5560e0=_0x5eeae3['uniqueid'];var _0x56f68b=_0x314dd2[_0xf40f('0x73')](_0xcf3b8e[_0xf40f('0x72')])?util[_0xf40f('0x27')](_0xf40f('0x112'),_0xcf3b8e[_0xf40f('0x72')][_0xf40f('0x29')],_[_0xf40f('0x41')](_0xcf3b8e[_0xf40f('0x113')])?'':_0xcf3b8e['dialPrefix'][_0xf40f('0x114')]()||'',_0xcf3b8e[_0xf40f('0x115')]>0x0?_0x20c99e['phone']['substring'](_0xcf3b8e['dialCutDigit']):_0x20c99e[_0xf40f('0x103')]):util[_0xf40f('0x27')](_0xf40f('0x112'),_[_0xf40f('0x41')](_0xcf3b8e[_0xf40f('0x74')])?_0xcf3b8e[_0xf40f('0x72')]['name']:_0xcf3b8e['TrunkBackup'][_0xf40f('0x29')],_[_0xf40f('0x41')](_0xcf3b8e['dialPrefix'])?'':_0xcf3b8e[_0xf40f('0x113')][_0xf40f('0x114')]()||'',_0xcf3b8e['dialCutDigit']>0x0?_0x20c99e['phone']['substring'](_0xcf3b8e[_0xf40f('0x115')]):_0x20c99e[_0xf40f('0x103')]);var _0x4b93f5=_0x314dd2['isTrunkReachable'](_0xcf3b8e[_0xf40f('0x72')])?ut['getCallerId'](_0xcf3b8e[_0xf40f('0x72')][_0xf40f('0x116')],_0xcf3b8e[_0xf40f('0x117')],_0xcf3b8e[_0xf40f('0x118')]>0x0?ut['getCallerIdRandom'](_0xcf3b8e[_0xf40f('0x119')],_0xcf3b8e[_0xf40f('0x118')]):_0xcf3b8e['dialOriginateCallerIdNumber']):ut[_0xf40f('0x11a')](_[_0xf40f('0x41')](_0xcf3b8e[_0xf40f('0x74')])?_0xcf3b8e[_0xf40f('0x72')][_0xf40f('0x116')]:_0xcf3b8e[_0xf40f('0x74')][_0xf40f('0x116')],_0xcf3b8e['dialOriginateCallerIdName'],_0xcf3b8e[_0xf40f('0x118')]>0x0?ut[_0xf40f('0x11b')](_0xcf3b8e['dialOriginateCallerIdNumber'],_0xcf3b8e[_0xf40f('0x118')]):_0xcf3b8e[_0xf40f('0x119')]);if(_0x4b93f5){_0x5eeae3[_0xf40f('0x11c')]=ut[_0xf40f('0x11d')](_0x4b93f5);_0x5eeae3['originatecalleridnum']=ut[_0xf40f('0x11e')](_0x4b93f5);}var _0x196b56=ut[_0xf40f('0x11f')](_0xcf3b8e,_0x20c99e,_0x56f68b,_0x4b93f5,_0x5560e0,_0x5eeae3);var _0x44f6c4=utils[_0xf40f('0x120')](_0x20c99e['Contact']);Object['assign'](_0x196b56,_0x44f6c4);_[_0xf40f('0x121')](_0x5eeae3,ut[_0xf40f('0x122')](_0x196b56));_0x5eeae3['starttime']=moment()[_0xf40f('0x27')](_0xf40f('0x63'));_0xcf3b8e[_0xf40f('0x123')]=_0x196b56;var _0x18f13f=ut['variablesAction'](_0x5eeae3,_0xcf3b8e,_0x196b56,_0x5eeae3[_0xf40f('0x86')],_0x44d99a);return ami['Action'](_0x18f13f)[_0xf40f('0x59')](function(_0x28f62d){_0xcf3b8e['originated']+=0x1;logger[_0xf40f('0x25')](_0xf40f('0x124'),_0x5560e0,'\x20Queue',_0xcf3b8e[_0xf40f('0x29')],_0xf40f('0x44'),_0xcf3b8e[_0xf40f('0x2c')]);_0x1b0843(_0x28f62d);})[_0xf40f('0x4c')](function(_0x1f3528){ut['logAgent'](_0x5eeae3,0xe,_0xf40f('0x125'));rpcDb[_0xf40f('0xdd')](_0x5eeae3,_0xf40f('0x126'));_0x59d225(_0x1f3528);});});};Preview['prototype']['syncNewExten']=function(_0x147478){if(this[_0xf40f('0x13')][_0x147478[_0xf40f('0x87')]]){this[_0xf40f('0x13')][_0x147478[_0xf40f('0x87')]][_0xf40f('0x4b')]=_0x147478[_0xf40f('0x4b')];}};Preview[_0xf40f('0xc')][_0xf40f('0x127')]=function(_0xccce21){var _0x25fdcb=this;var _0x5a6636=this[_0xf40f('0x13')][_0xccce21[_0xf40f('0x128')]];if(_0x5a6636){if(_0x5a6636[_0xf40f('0xe8')]&&this[_0xf40f('0x14')][_0x5a6636[_0xf40f('0xe8')]]){ut[_0xf40f('0x129')](_0x5a6636,this[_0xf40f('0x14')][_0x5a6636[_0xf40f('0xe8')]][_0xf40f('0x29')],this['agents'][_0x5a6636[_0xf40f('0xe8')]]['id']);}var _0x18a714=_[_0xf40f('0x12a')](_0x5a6636);_0x18a714['responsetime']=moment()[_0xf40f('0x27')](_0xf40f('0x63'));var _0x4af3ea=_0x25fdcb[_0xf40f('0x11')][_0x5a6636['queue']];if(ut['isFailure'](_0xccce21['response'])){if(_0x5a6636[_0xf40f('0x85')]){rpcDb[_0xf40f('0xfd')](_0x5a6636[_0xf40f('0x89')]);}if(_0x5a6636['activeContact']){rpcDb[_0xf40f('0x61')](_0x5a6636[_0xf40f('0x89')]);}ami[_0xf40f('0x24')]('custom:agentringnoanswer',ut['buildObj'](_0x5a6636,_0xf40f('0x12b'),this[_0xf40f('0x11')][_0x5a6636[_0xf40f('0x43')]]));this[_0xf40f('0xd9')](_0x18a714,_0x4af3ea,_0xccce21);}else{_0x5a6636[_0xf40f('0x62')]=moment()['format'](_0xf40f('0x63'));ut['logAgent'](_0x18a714,0x4,_0xf40f('0x9c'));rpcDb[_0xf40f('0xdd')](_0x18a714,_0xf40f('0x12c'));}}};Preview['prototype'][_0xf40f('0x18')]=function(_0x63d344){var _0x4f114e=this[_0xf40f('0x13')][_0x63d344[_0xf40f('0x87')]];var _0xab2c0a;if(_0x4f114e){_0xab2c0a=this[_0xf40f('0x11')][_0x4f114e['queue']];logger[_0xf40f('0x25')](_0xf40f('0x12d'),_0x63d344['linkedid'],_0xf40f('0x8f'),_0xab2c0a[_0xf40f('0x29')],'pTalking:\x20',_0xab2c0a[_0xf40f('0x2d')]);}if(this[_0xf40f('0x13')][_0x63d344['linkedid']]&&_0x63d344['linkedid']!==_0x63d344[_0xf40f('0x8e')]){if(_0x63d344[_0xf40f('0x12e')]==='16'&&this['actions'][_0x63d344[_0xf40f('0x87')]][_0xf40f('0x45')]){this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344[_0xf40f('0x12e')]);}else if(this[_0xf40f('0x13')][_0x63d344[_0xf40f('0x87')]][_0xf40f('0x45')]){logger[_0xf40f('0x25')](_0xf40f('0x12f'),_0x63d344['linkedid'],_0x63d344[_0xf40f('0x12e')],'\x20Queue',_0xab2c0a['name'],_0xf40f('0x90'),_0xab2c0a[_0xf40f('0x2d')]);this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344['cause']);}}else if(_0x4f114e&&_[_0xf40f('0x41')](_0x4f114e[_0xf40f('0x130')])&&_0xab2c0a[_0xf40f('0x131')]&&_0x63d344[_0xf40f('0x87')]===_0x63d344[_0xf40f('0x8e')]&&_[_0xf40f('0x41')](_0x63d344[_0xf40f('0xe1')])&&_0x63d344[_0xf40f('0x12e')]==='16'&&_0x63d344[_0xf40f('0x132')]==='6'&&_[_0xf40f('0xda')](_0x4f114e[_0xf40f('0x133')])){if(_0x4f114e[_0xf40f('0x85')]){rpcDb[_0xf40f('0xfd')](_0x4f114e['idContact']);}if(_0x4f114e['activeContact']){rpcDb[_0xf40f('0x61')](_0x4f114e['idContact']);}_0x63d344[_0xf40f('0xe1')]='22';this[_0xf40f('0xd9')](_0x4f114e,_0xab2c0a,_0x63d344);}else if(_0x4f114e&&_0x4f114e['transfer']){if(_0x63d344[_0xf40f('0x12e')]==='16'&&this['actions'][_0x63d344['linkedid']][_0xf40f('0x45')]){logger[_0xf40f('0x25')](_0xf40f('0x134'),_0x63d344[_0xf40f('0x87')],_0x63d344[_0xf40f('0x12e')],_0xf40f('0x8f'),_0xab2c0a[_0xf40f('0x29')],_0xf40f('0x90'),_0xab2c0a[_0xf40f('0x2d')]);this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344['cause']);}else if(this['actions'][_0x63d344['linkedid']][_0xf40f('0x45')]){logger[_0xf40f('0x25')]('[syncHangup][talking][cause]',_0x63d344['linkedid'],_0x63d344[_0xf40f('0x12e')],_0xf40f('0x8f'),_0xab2c0a[_0xf40f('0x29')],_0xf40f('0x90'),_0xab2c0a['pTalking']);this[_0xf40f('0x76')](_0x63d344,_0x63d344[_0xf40f('0x87')],_0x63d344['cause']);}}};Preview[_0xf40f('0xc')][_0xf40f('0x1b')]=function(_0x22f48e){if(this[_0xf40f('0x13')][_0x22f48e[_0xf40f('0xd7')]]&&_0x22f48e[_0xf40f('0xd7')]!==_0x22f48e[_0xf40f('0x135')]){this[_0xf40f('0x76')](_0x22f48e,_0x22f48e['destlinkedid'],_0x22f48e[_0xf40f('0xcd')]);}};Preview[_0xf40f('0xc')]['syncHangupRequest']=function(_0x33255f){if(this['actions'][_0x33255f['linkedid']]&&_0x33255f[_0xf40f('0x87')]!==_0x33255f[_0xf40f('0x8e')]&&!this[_0xf40f('0x13')][_0x33255f[_0xf40f('0x87')]][_0xf40f('0x45')]){if(_0x33255f['cause']==='1'){this[_0xf40f('0x76')](_0x33255f,_0x33255f[_0xf40f('0x87')],_0x33255f[_0xf40f('0x12e')]);}}};Preview['prototype'][_0xf40f('0x136')]=function(_0x5c7e1d,_0x5df1e2,_0x44da08){if(this['actions'][_0x5c7e1d]){if(_[_0xf40f('0x41')](this[_0xf40f('0x13')][_0x5c7e1d][_0xf40f('0x123')])){this[_0xf40f('0x13')][_0x5c7e1d][_0xf40f('0x123')]={};}this[_0xf40f('0x13')][_0x5c7e1d]['variables'][_0x5df1e2]=_0x44da08;}};Preview['prototype'][_0xf40f('0x1f')]=function(_0x51c03f){try{if(!_[_0xf40f('0x41')](_0x51c03f)){if(ut[_0xf40f('0x137')](_[_0xf40f('0x138')](_0x51c03f[_0xf40f('0x139')])[0x0])){this[_0xf40f('0x136')](_0x51c03f[_0xf40f('0x8e')],_[_0xf40f('0x138')](_0x51c03f['variable'])[0x0],_0x51c03f['value']);}}}catch(_0x1c9ab2){logger['error'](_0xf40f('0x13a'),util[_0xf40f('0x13b')](_0x1c9ab2,{'showHidden':![],'depth':null}));}};Preview[_0xf40f('0xc')][_0xf40f('0x21')]=function(_0x222a45){if(_0x222a45){if(this[_0xf40f('0x13')][_0x222a45[_0xf40f('0x13c')]]){this[_0xf40f('0x13')][_0x222a45[_0xf40f('0x13c')]][_0xf40f('0x133')]=!![];}}};Preview[_0xf40f('0xc')]['syncBlindTransfer']=function(_0x282196){if(_0x282196){if(this[_0xf40f('0x13')][_0x282196[_0xf40f('0x13d')]]){this[_0xf40f('0x13')][_0x282196[_0xf40f('0x13d')]][_0xf40f('0x133')]=!![];}}};module[_0xf40f('0x13e')]=Preview;
\ No newline at end of file
+var _0xc35e=['custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','busy','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','incrementPreviewCounters','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','outboundRejectCallsDay','countagentrejectretry','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[callProgressDetectingCustomer]','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','run','execRun','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','toLowerVariables','starttime','variablesAction','Action','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','unlockContact','callProgressDetectingAgent','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','prototype','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','decrementTalking','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','isActive','Trunk','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','[syncHangup][talking][increment]','uniqueid','connect','acw'];(function(_0x31216b,_0x4ccdaf){var _0x24a7b3=function(_0x5977db){while(--_0x5977db){_0x31216b['push'](_0x31216b['shift']());}};_0x24a7b3(++_0x4ccdaf);}(_0xc35e,0x1e9));var _0xec35=function(_0x130375,_0x4cee28){_0x130375=_0x130375-0x0;var _0x457d9e=_0xc35e[_0x130375];return _0x457d9e;};'use strict';var util=require(_0xec35('0x0'));var _=require(_0xec35('0x1'));var uuid=require(_0xec35('0x2'));var moment=require(_0xec35('0x3'));var Redis=require(_0xec35('0x4'));var config=require(_0xec35('0x5'));var logger=require('../../../config/logger')(_0xec35('0x6'));var loggerAction=require(_0xec35('0x7'))(_0xec35('0x8'));var ami=require(_0xec35('0x9'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xec35('0xa'));var Action=require('./action');var ut=require(_0xec35('0xb'));var utils=require(_0xec35('0xc'));config[_0xec35('0xd')]=_[_0xec35('0xe')](config[_0xec35('0xd')],{'host':_0xec35('0xf'),'port':0x18eb});var io=require(_0xec35('0x10'))(new Redis(config[_0xec35('0xd')]));var Sequence=function(){};Sequence['prototype'][_0xec35('0x11')]=function(_0x4acd5d){this[_0xec35('0x12')]=this[_0xec35('0x12')]?this[_0xec35('0x12')][_0xec35('0x13')](_0x4acd5d):_0x4acd5d();};function Preview(_0x4f2510){this[_0xec35('0x14')]=new Sequence();this[_0xec35('0x15')]=_0x4f2510['voiceQueues'];this[_0xec35('0x16')]=_0x4f2510['trunks'];this[_0xec35('0x17')]={};this['agents']=_0x4f2510[_0xec35('0x18')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xec35('0x19')][_0xec35('0x1a')](this));ami['on']('hangup',this[_0xec35('0x1b')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x1c'),this[_0xec35('0x1d')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x1e'),this[_0xec35('0x1f')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x20'),this[_0xec35('0x21')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x22'),this[_0xec35('0x23')]['bind'](this));ami['on'](_0xec35('0x24'),this[_0xec35('0x25')][_0xec35('0x1a')](this));ami['on'](_0xec35('0x26'),this[_0xec35('0x27')]['bind'](this));this['loopCampaigns'](this[_0xec35('0x15')]);}function emit(_0x51f949,_0x434dce,_0x19512a){io['to'](_0x51f949)[_0xec35('0x28')](_0x434dce,_0x19512a);}function emitVoiceQueueChannelRemove(_0x33b180){logger[_0xec35('0x29')](_0xec35('0x2a'),JSON[_0xec35('0x2b')](_0x33b180));emit(util[_0xec35('0x2c')](_0xec35('0x2d'),_0x33b180[_0xec35('0x2e')]),'voice_queue_channel:remove',_0x33b180);io[_0xec35('0x28')]('voice_queue_presence:remove',_0x33b180);}function notSendMessagesQueue(_0x148553){if(_0x148553[_0xec35('0x2f')]){if(_0x148553[_0xec35('0x30')]===0x0&&_0x148553[_0xec35('0x31')]===0x0){_0x148553[_0xec35('0x2f')]=![];_0x148553[_0xec35('0x32')]=0x0;_0x148553[_0xec35('0x33')]=0x0;_0x148553[_0xec35('0x34')]=utils[_0xec35('0x35')][_0xec35('0x36')];ut[_0xec35('0x37')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x148553[_0xec35('0x2e')]+_0xec35('0x38'));}else{_0x148553['message']=utils[_0xec35('0x35')][_0xec35('0x39')];ut[_0xec35('0x37')](_0xec35('0x3a'),_0x148553[_0xec35('0x2e')]+'\x20is\x20deactivated');}}}Preview[_0xec35('0x3b')][_0xec35('0x3c')]=function(){var _0x2528d7=this;setInterval(function(){_0x2528d7[_0xec35('0x3d')]();},0x7cf);};Preview[_0xec35('0x3b')][_0xec35('0x3d')]=function(){var _0xb23958=this[_0xec35('0x15')];this[_0xec35('0x3e')]+=0x1;for(var _0x130d2d in _0xb23958){if(_0xb23958[_0xec35('0x3f')](_0x130d2d)&&(_0xb23958[_0x130d2d][_0xec35('0x40')]===_0xec35('0x6')||_0xb23958[_0x130d2d][_0xec35('0x40')]===_0xec35('0x41'))&&_0xb23958[_0x130d2d]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xec35('0x3e')]=0x0;this[_0xec35('0x42')]();}}if(_0xb23958['hasOwnProperty'](_0x130d2d)&&_0xb23958[_0x130d2d][_0xec35('0x40')]==='preview'&&_0xb23958[_0x130d2d][_0xec35('0x43')]===_0xec35('0x44')){if(_0xb23958[_0x130d2d][_0xec35('0x45')]){this[_0xec35('0x46')](_0xb23958[_0x130d2d]);if(_0xb23958[_0x130d2d][_0xec35('0x47')])this[_0xec35('0x48')](_0xb23958[_0x130d2d]);}else{notSendMessagesQueue(_0xb23958[_0x130d2d]);}}}};Preview[_0xec35('0x3b')][_0xec35('0x49')]=function(_0xb46ca5){var _0x93529=this;this['sequence'][_0xec35('0x11')](function(){if(!_[_0xec35('0x4a')](_0x93529[_0xec35('0x17')][_0xb46ca5])){loggerAction[_0xec35('0x29')](_0xec35('0x4b'),_0xb46ca5,_0xec35('0x4c'),_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')],_0xec35('0x4e'),JSON[_0xec35('0x2b')](_0x93529['campaignsPreview'][_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')]][_0xec35('0x30')]),_0xec35('0x4f'),JSON[_0xec35('0x2b')](_0x93529[_0xec35('0x15')][_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')]]['pTalking']),JSON[_0xec35('0x2b')](_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x50')]),JSON[_0xec35('0x2b')](_[_0xec35('0x51')](_0x93529[_0xec35('0x17')][_0xb46ca5],['contactId',_0xec35('0x52'),_0xec35('0x53'),'ListId'])));return ami['Action']({'action':_0xec35('0x54'),'channel':_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x55')]})[_0xec35('0x56')](function(_0x28238e){if(_0x28238e['message']===_0xec35('0x57')){setTimeout(function(){if(_0x93529[_0xec35('0x17')][_0xb46ca5]){utils['decrementOriginate'](_0x93529['campaignsPreview'][_0x93529['actions'][_0xb46ca5][_0xec35('0x4d')]],'[clearZombieChannel]');if(_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x50')]===!![]){ut[_0xec35('0x58')](_0x93529[_0xec35('0x15')][_0x93529[_0xec35('0x17')][_0xb46ca5][_0xec35('0x4d')]],_0xec35('0x59'));ut[_0xec35('0x5a')](_0xec35('0x5b')+_0xb46ca5,_0x93529[_0xec35('0x17')][_0xb46ca5]['queue']);}ut[_0xec35('0x5a')](_0xec35('0x5c')+_0xb46ca5,_0x93529[_0xec35('0x17')][_0xb46ca5]['queue']);delete _0x93529[_0xec35('0x17')][_0xb46ca5];}},0x2328);}});}});};Preview[_0xec35('0x3b')][_0xec35('0x42')]=function(){var _0x4dac1b=this;loggerAction['info']('[action]',_[_0xec35('0x5d')](this[_0xec35('0x17')]));for(var _0x2f1d3e in this[_0xec35('0x17')]){if(_0x4dac1b[_0xec35('0x17')][_0xec35('0x3f')](_0x2f1d3e)){_0x4dac1b['clearZombieChannel'](_0x2f1d3e);}}};Preview[_0xec35('0x3b')][_0xec35('0x48')]=function(_0x935ada){var _0x292a25=this;rpcDb[_0xec35('0x5e')](_0x935ada['id'],ut[_0xec35('0x5f')](this[_0xec35('0x18')]))[_0xec35('0x60')](function(_0x32c41c){if(!_[_0xec35('0x4a')](_0x32c41c)){for(var _0x59ddf1=0x0;_0x59ddf1<_0x32c41c[_0xec35('0x61')];_0x59ddf1+=0x1){if(ut[_0xec35('0x62')](_0x32c41c[_0x59ddf1][_0xec35('0x63')])<_0x935ada[_0xec35('0x64')]*0x3c){if(_0x32c41c[_0x59ddf1]['Agent']&&!_0x32c41c[_0x59ddf1][_0xec35('0x65')]['voicePause']){_0x292a25['run'](_0x32c41c[_0x59ddf1]['id'])[_0xec35('0x60')](ut[_0xec35('0x66')](_0xec35('0x67')))['catch'](ut['logger2']('[RecallMe]'));}else{rpcDb[_0xec35('0x68')](_0x32c41c[_0x59ddf1]['id']);}}else{var _0x512dae=new Action(_0x32c41c[_0x59ddf1],_0x935ada);_0x512dae['starttime']=moment()['format'](_0xec35('0x69'));_0x935ada[_0xec35('0x6a')]+=0x1;ut[_0xec35('0x6b')](_0x512dae,0x17,_0xec35('0x6c'));if(_0x935ada[_0xec35('0x6d')]){rpcDb[_0xec35('0x6e')](ut[_0xec35('0x6f')](_0x32c41c[_0x59ddf1]));rpcDb[_0xec35('0x70')](_0x512dae,_0xec35('0x71'));}else{ut['logCustomer'](_0x512dae,0x16,_0xec35('0x72'));rpcDb[_0xec35('0x70')](_0x512dae,_0xec35('0x73'));rpcDb[_0xec35('0x74')](_0x512dae,_0xec35('0x73'));}}}}})[_0xec35('0x56')](ut[_0xec35('0x66')](_0xec35('0x75')));};Preview['prototype'][_0xec35('0x46')]=function(_0x38f550){_0x38f550[_0xec35('0x2f')]=!![];if(ut['IsNotLoggedIn'](_0x38f550[_0xec35('0x76')])){_0x38f550[_0xec35('0x34')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0xec35('0x77')](_0x38f550[_0xec35('0x45')])){_0x38f550['message']=utils[_0xec35('0x35')][_0xec35('0x36')];}else if(!this['isTrunkReachable'](_0x38f550[_0xec35('0x78')])){if(!this[_0xec35('0x79')](_0x38f550[_0xec35('0x7a')])){_0x38f550[_0xec35('0x34')]=utils[_0xec35('0x35')]['UNREACHABLE_TRUNK'];}else{_0x38f550[_0xec35('0x34')]=utils[_0xec35('0x35')]['ACTIVE'];}}else{_0x38f550[_0xec35('0x34')]=utils[_0xec35('0x35')]['ACTIVE'];}};Preview[_0xec35('0x3b')][_0xec35('0x7b')]=function(_0x5f2026,_0x240369,_0x15876b){var _0x17a81f=this;var _0x3a739a=this[_0xec35('0x17')][_0x240369];var _0x5decba=this[_0xec35('0x15')][_0x3a739a[_0xec35('0x4d')]];var _0x252fc8;var _0x1b7c31=![];var _0xfd3f41=0x2;var _0x6605ea=0x3;if(_0x5decba){switch(_0x15876b){case'1':_0x5decba['outboundNoSuchCallsDay']+=0x1;_0x3a739a[_0xec35('0x7c')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x0,_0xec35('0x7f'));ami[_0xec35('0x28')]('custom:agentnosuchnumber',ut[_0xec35('0x80')](_0x3a739a,'nosuchnumber'));rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0x81'));_0x17a81f['verifyAdditionalPhones'](_0x3a739a,'0',_0x5decba)[_0xec35('0x60')](function(_0x53658b){_0x1b7c31=_0x53658b[_0xec35('0x82')]==0x1;_0xfd3f41=_0x5decba[_0xec35('0x83')];_0x6605ea=_0x5decba[_0xec35('0x84')];if(!_0x1b7c31){if(ut['totalGlobal'](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0x88'));}else{if(_0x3a739a['countnosuchnumberretry']>=_0x5decba['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x3a739a,_0xec35('0x88'));}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0x7c'),_0x5decba[_0xec35('0x83')]),_0x3a739a['unlockAgent'],_0x3a739a[_0xec35('0x8b')]);}}delete this[_0xec35('0x17')][_0x5f2026[_0xec35('0x8c')]];}else{_0x3a739a[_0xec35('0x7c')]++;logger['info'](_0xec35('0x8d'),_0x3a739a[_0xec35('0x7c')]);logger[_0xec35('0x29')]('id',_0x3a739a[_0xec35('0x8e')]);_0x17a81f['incrementPreviewCounters']({'id':_0x3a739a['idContact'],'field':{'countnosuchnumberretry':_0x3a739a['countnosuchnumberretry']}})[_0xec35('0x60')](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)['then'](function(){});});}});break;case _0xec35('0x90'):var _0x42e4ea=moment()['format'](_0xec35('0x69'));_0x3a739a['responsetime']=_0x42e4ea;_0x3a739a['answertime']=_0x42e4ea;_0x3a739a[_0xec35('0x50')]=!![];_0x5decba[_0xec35('0x31')]+=0x1;logger['info'](_0xec35('0x91'),_0x3a739a[_0xec35('0x92')],'\x20Queue',_0x5decba[_0xec35('0x2e')],_0xec35('0x4f'),_0x5decba[_0xec35('0x31')]);ami[_0xec35('0x28')]('custom:agentconnect',ut['buildObj'](_0x3a739a,_0xec35('0x93'),this[_0xec35('0x15')][_0x3a739a[_0xec35('0x4d')]]));if(_0x5decba[_0xec35('0x94')]||_0x5decba['mandatoryDisposition']){ami[_0xec35('0x28')](_0xec35('0x95'),{'queue':_0x3a739a['queue'],'interface':_0x3a739a[_0xec35('0x96')],'uniqueid':_0x3a739a[_0xec35('0x92')]});}break;case'16':ami[_0xec35('0x28')](_0xec35('0x97'),ut[_0xec35('0x80')](_0x3a739a,_0xec35('0x98'),this[_0xec35('0x15')][_0x3a739a[_0xec35('0x4d')]]));emitVoiceQueueChannelRemove(ut[_0xec35('0x80')](_0x3a739a,_0xec35('0x98')));_0x5decba[_0xec35('0x99')]+=0x1;_0x5decba['total']+=0x1;_0x5decba[_0xec35('0x9a')]+=0x1;ut[_0xec35('0x58')](_0x5decba,_0xec35('0x9b'));_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x4,_0xec35('0x9c'));rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0x9d'));rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0x9e'));rpcDb[_0xec35('0x9f')](_0x3a739a);_0x5decba['sumDuration']+=_0x3a739a[_0xec35('0xa0')];_0x5decba[_0xec35('0xa1')]+=_0x3a739a[_0xec35('0xa0')];logger[_0xec35('0x29')](_0xec35('0xa2'),_0x3a739a[_0xec35('0x92')],_0xec35('0xa3'),_0x5decba[_0xec35('0x2e')],'pTalking:\x20',_0x5decba[_0xec35('0x31')]);delete this[_0xec35('0x17')][_0x5f2026[_0xec35('0x8c')]];break;case'BUSY':_0x5decba[_0xec35('0xa4')]+=0x1;_0x3a739a[_0xec35('0xa5')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x5,_0xec35('0xa6'));_0xfd3f41=_0x5decba[_0xec35('0xa7')];_0x6605ea=_0x5decba['callAdditionalPhoneAfterMin'];ami[_0xec35('0x28')]('custom:agentbusy',ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xa8')));rpcDb['createCustomerHistory'](_0x3a739a,'[callProgressDetectingCustomer][logBusy]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'5',_0x5decba)[_0xec35('0x60')](function(_0x33e883){_0x1b7c31=_0x33e883[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xaa'));}else{if(_0x3a739a[_0xec35('0xa5')]>=_0x5decba[_0xec35('0xab')]){rpcDb[_0xec35('0x74')](_0x3a739a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0xa5'),_0x5decba[_0xec35('0xa7')]),_0x3a739a[_0xec35('0xac')],_0x3a739a[_0xec35('0x8b')]);}}}else{_0x3a739a[_0xec35('0xa5')]++;_0x17a81f['incrementPreviewCounters']({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countbusyretry':_0x3a739a[_0xec35('0xa5')]}})['then'](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case _0xec35('0xad'):_0x5decba[_0xec35('0xae')]+=0x1;_0x3a739a[_0xec35('0xaf')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut['totalGlobal'](_0x3a739a);ut['logCustomer'](_0x3a739a,0x3,_0xec35('0xb0'));_0xfd3f41=_0x5decba['dialNoAnswerRetryFrequency'];_0x6605ea=_0x5decba[_0xec35('0x84')];var _0xae9f24=ut[_0xec35('0xb1')](_0x3a739a,_0x5decba);ami['emit']('custom:agentnoanswer',_0xae9f24);rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0xb2'));_0x17a81f[_0xec35('0xa9')](_0x3a739a,'3',_0x5decba)[_0xec35('0x60')](function(_0x3a4c8d){_0x1b7c31=_0x3a4c8d[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,'Global');rpcDb['createCustomerFinal'](_0x252fc8,_0xec35('0xb3'));}else{if(_0x3a739a[_0xec35('0xaf')]>=_0x5decba[_0xec35('0xb4')]){rpcDb['createCustomerFinal'](_0x3a739a,_0xec35('0xb2'));}else{rpcDb['rescheduleContact'](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0xaf'),_0x5decba['dialNoAnswerRetryFrequency']),_0x3a739a[_0xec35('0xac')],_0x3a739a['activeContact']);}}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countnoanswerretry':_0x3a739a['countnoanswerretry']}})[_0xec35('0x60')](function(){_0x17a81f['swapAdditionalPhones'](_0x3a739a,_0xfd3f41,_0x6605ea)['then'](function(){});});}});break;case _0xec35('0xb6'):_0x5decba[_0xec35('0xb7')]+=0x1;_0x3a739a[_0xec35('0xb8')]+=0x1;_0x3a739a['countglobal']=ut[_0xec35('0x7e')](_0x3a739a);ut['logCustomer'](_0x3a739a,0x8,_0xec35('0xb9'));_0xfd3f41=_0x5decba[_0xec35('0xba')];_0x6605ea=_0x5decba['callAdditionalPhoneAfterMin'];ami[_0xec35('0x28')]('custom:agentcongestion',ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xbb')));rpcDb[_0xec35('0x70')](_0x3a739a,'[callProgressDetectingCustomer][logCongestion]');_0x17a81f['verifyAdditionalPhones'](_0x3a739a,'8',_0x5decba)['then'](function(_0x393551){_0x1b7c31=_0x393551[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut['cloneAction'](_0x3a739a,0xf,'Global');rpcDb['createCustomerFinal'](_0x252fc8,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x3a739a['countcongestionretry']>=_0x5decba[_0xec35('0xbc')]){rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xbd'));}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,_0xec35('0xb8'),_0x5decba[_0xec35('0xa7')]),_0x3a739a['unlockAgent'],_0x3a739a[_0xec35('0x8b')]);}}}else{_0x3a739a[_0xec35('0xb8')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countcongestionretry':_0x3a739a[_0xec35('0xb8')]}})['then'](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case'CANCEL':_0x5decba[_0xec35('0xbe')]+=0x1;_0x3a739a[_0xec35('0xbf')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x14,'AgentReject');_0xfd3f41=_0x5decba['dialAgentRejectRetryFrequency'];_0x6605ea=_0x5decba['callAdditionalPhoneAfterMin'];ami[_0xec35('0x28')]('custom:agentreject',ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xc0')));rpcDb[_0xec35('0x70')](_0x3a739a,'[syncHangupRequest][logAgentReject]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'20',_0x5decba)['then'](function(_0x181966){_0x1b7c31=_0x181966[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0x14,_0xec35('0xc1'));rpcDb['createCustomerFinal'](_0x252fc8,_0xec35('0xc2'));}else{if(_0x3a739a[_0xec35('0xbf')]>=_0x5decba[_0xec35('0xc3')]){rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xc2'));}else{rpcDb[_0xec35('0x89')](ut[_0xec35('0x8a')](_0x3a739a,'countagentrejectretry',_0x5decba[_0xec35('0xc4')]),_0x3a739a[_0xec35('0xac')],_0x3a739a['activeContact']);}}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countnoanswerretry':_0x3a739a[_0xec35('0xaf')]}})[_0xec35('0x60')](function(){_0x17a81f['swapAdditionalPhones'](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case _0xec35('0xc5'):_0x5decba['outboundAbandonedCallsDay']+=0x1;_0x3a739a[_0xec35('0xc6')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut['logCustomer'](_0x3a739a,0xb,_0xec35('0xc7'));rpcDb[_0xec35('0x70')](_0x3a739a,_0xec35('0xc8'));_0x17a81f[_0xec35('0xa9')](_0x3a739a,'11',_0x5decba)[_0xec35('0x60')](function(_0xb3c8d){_0x1b7c31=_0xb3c8d[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba['dialGlobalMaxRetry']){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xc8'));}else{if(_0x3a739a['countabandonedetry']>=_0x5decba[_0xec35('0xc9')]){rpcDb['createCustomerFinal'](_0x3a739a,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3a739a,'countabandonedretry',_0x5decba[_0xec35('0xca')]),_0x3a739a[_0xec35('0xac')],_0x3a739a[_0xec35('0x8b')]);}}}else{_0x3a739a['countnoanswerretry']++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a['idContact'],'field':{'countnoanswerretry':_0x3a739a[_0xec35('0xaf')]}})[_0xec35('0x60')](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});break;case'18':_0x5decba['outboundUnknownCallsDay']+=0x1;_0x3a739a[_0xec35('0xcb')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut['logCustomer'](_0x3a739a,0x12,_0x5f2026[_0xec35('0xcc')]||_0x5f2026[_0xec35('0xcd')]);ami[_0xec35('0x28')](_0xec35('0xce'),ut['buildObj'](_0x3a739a,'amd'));rpcDb[_0xec35('0x70')](_0x3a739a,'[callProgressDetectingCustomer][hangupInAMD]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'18',_0x5decba)[_0xec35('0x60')](function(_0x4e7cda){_0x1b7c31=_0x4e7cda['additional']==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut['cloneAction'](_0x3a739a,0x12,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xcf'));}else{rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xcf'));}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a[_0xec35('0x8e')],'field':{'countnoanswerretry':_0x3a739a['countnoanswerretry']}})[_0xec35('0x60')](function(){_0x17a81f['swapAdditionalPhones'](_0x3a739a,_0xfd3f41,_0x6605ea)['then'](function(){});});}});delete this['actions'][_0x5f2026[_0xec35('0x8c')]];break;case'19':_0x5decba[_0xec35('0xd0')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0x13,_0x5f2026[_0xec35('0xcc')]||_0x5f2026[_0xec35('0xcd')]);ami[_0xec35('0x28')](_0xec35('0xce'),ut[_0xec35('0x80')](_0x3a739a,_0xec35('0xd1')));rpcDb['createCustomerHistory'](_0x3a739a,_0xec35('0xd2'));_0x17a81f[_0xec35('0xa9')](_0x3a739a,'18',_0x5decba)[_0xec35('0x60')](function(_0x277b62){_0x1b7c31=_0x277b62[_0xec35('0x82')]==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba[_0xec35('0x85')]){_0x252fc8=ut['cloneAction'](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xd2'));}else{rpcDb[_0xec35('0x74')](_0x3a739a,'[callProgressDetectingCustomer][machine]');}}else{_0x3a739a[_0xec35('0xaf')]++;_0x17a81f[_0xec35('0xb5')]({'id':_0x3a739a['idContact'],'field':{'countnoanswerretry':_0x3a739a[_0xec35('0xaf')]}})['then'](function(){_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});});}});delete this[_0xec35('0x17')][_0x5f2026['linkedid']];break;default:if(_0x3a739a[_0xec35('0x50')]){ut[_0xec35('0x58')](_0x5decba,_0xec35('0xd3'));ut['loggerError'](_0xec35('0xd4')+_0x5decba[_0xec35('0x2e')],_0x5f2026);}_0x5decba[_0xec35('0xd0')]+=0x1;_0x3a739a[_0xec35('0x7d')]=ut[_0xec35('0x7e')](_0x3a739a);ut[_0xec35('0x6b')](_0x3a739a,0xc,_0x5f2026['cause-txt']||_0x5f2026['dialstatus']);_0xfd3f41=_0x5decba[_0xec35('0xc4')];_0x6605ea=_0x5decba[_0xec35('0x84')];rpcDb[_0xec35('0x70')](_0x3a739a,'[callProgressDetectingCustomer][logUnknown]');_0x17a81f[_0xec35('0xa9')](_0x3a739a,'20',_0x5decba)['then'](function(_0x52dc36){_0x1b7c31=_0x52dc36['additional']==0x1;if(!_0x1b7c31){if(ut[_0xec35('0x7e')](_0x3a739a)>=_0x5decba['dialGlobalMaxRetry']){_0x252fc8=ut[_0xec35('0x86')](_0x3a739a,0xf,_0xec35('0x87'));rpcDb[_0xec35('0x74')](_0x252fc8,_0xec35('0xd5'));}else{rpcDb[_0xec35('0x74')](_0x3a739a,_0xec35('0xd5'));}delete this[_0xec35('0x17')][_0x5f2026['linkedid']];}else{_0x17a81f[_0xec35('0x8f')](_0x3a739a,_0xfd3f41,_0x6605ea)[_0xec35('0x60')](function(){});}});}if(!(_0x3a739a[_0xec35('0x50')]&&_0x15876b==='16')){utils[_0xec35('0xd6')](_0x5decba,_0xec35('0xd7'));logger[_0xec35('0x29')]('[originated][decrement][callProgressDetectingCustomer]',_0x3a739a[_0xec35('0x92')],_0xec35('0xa3'),_0x5decba[_0xec35('0x2e')],_0xec35('0x4e'),_0x5decba[_0xec35('0x30')]);}if(_0x15876b!==_0xec35('0x90')){delete this[_0xec35('0x17')][_0x5f2026[_0xec35('0x8c')]];delete this[_0xec35('0x17')][_0x5f2026['destlinkedid']];}_0x5decba['queueSummaryCountersUpdated']=!![];}};Preview[_0xec35('0x3b')]['callProgressDetectingAgent']=function(_0x27ac84,_0x11c684,_0x3d1dff){if(_[_0xec35('0xd8')](_0x11c684)&&_0xec35('0xd9')!==typeof _0x11c684){return;}if(_[_0xec35('0xd8')](_0x3d1dff)&&_0xec35('0xd9')!==typeof _0x3d1dff){return;}switch(_0x3d1dff[_0xec35('0xda')]){case'0':ut[_0xec35('0xdb')](_0x27ac84,0x0,_0xec35('0x7f'));rpcDb[_0xec35('0xdc')](_0x27ac84,_0xec35('0xdd'));break;case'3':ut[_0xec35('0xdb')](_0x27ac84,0x3,'NoAnswer');rpcDb[_0xec35('0xdc')](_0x27ac84,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xec35('0xdb')](_0x27ac84,0x5,_0xec35('0xa6'));rpcDb['createAgentHistory'](_0x27ac84,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xec35('0xdb')](_0x27ac84,0x8,_0xec35('0xb9'));rpcDb[_0xec35('0xdc')](_0x27ac84,_0xec35('0xde'));break;case'22':ut['logAgent'](_0x27ac84,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x27ac84,_0xec35('0xdf'));break;default:ut[_0xec35('0xdb')](_0x27ac84,0xc,_0x3d1dff[_0xec35('0xda')]);rpcDb[_0xec35('0xdc')](_0x27ac84,_0xec35('0xde'));}utils[_0xec35('0xd6')](_0x11c684,_0xec35('0xe0'));logger[_0xec35('0x29')](_0xec35('0xe1'),_0x27ac84['uniqueid'],'\x20Queue',_0x11c684[_0xec35('0x2e')],'originated:\x20',_0x11c684['originated']);delete this[_0xec35('0x17')][_0x27ac84[_0xec35('0x92')]];};Preview['prototype'][_0xec35('0xa9')]=function(_0x100c17,_0x29645a,_0x2e51d9){return cmHopperAdditionalPhone[_0xec35('0xa9')](_0x100c17,_0x29645a,_0x2e51d9)[_0xec35('0x56')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xec35('0x3b')][_0xec35('0x8f')]=function(_0x260e96,_0x1d7013,_0x3b1356){return cmHopperAdditionalPhone[_0xec35('0x8f')](_0x260e96,_0x1d7013,_0x3b1356)[_0xec35('0x56')](logger[_0xec35('0x29')](_0xec35('0xe2')));};Preview[_0xec35('0x3b')][_0xec35('0xb5')]=function(_0x421517){return Promise['resolve']()[_0xec35('0x60')](cmHopperAdditionalPhone[_0xec35('0xb5')](_0x421517))[_0xec35('0x56')](logger[_0xec35('0x29')](_0xec35('0xe3')));};Preview[_0xec35('0x3b')][_0xec35('0xe4')]=function(_0x518bd3,_0x3c9996,_0x397646,_0x539d80,_0x6e3697){var _0xad725f=this;return new Promise(function(_0x58f0b4,_0x28bf7d){if(_[_0xec35('0x4a')](_0x3c9996)||_['isNil'](_0x3c9996[_0xec35('0xe5')])||_[_0xec35('0x4a')](_0x3c9996[_0xec35('0xe6')])||_[_0xec35('0x4a')](_0x3c9996[_0xec35('0x53')])){_0x28bf7d(ut[_0xec35('0x34')]('Contact\x20is\x20undefined',_0x539d80,_0x6e3697));return;}var _0x1d4b98=uuid['v4']();var _0x5a4d73=_0xad725f[_0xec35('0x15')][_0x3c9996[_0xec35('0x4c')][_0xec35('0x2e')]];var _0x2d10ab=_0x397646?_0xad725f[_0xec35('0x18')][_0x397646]['id']:undefined;_0xad725f['actions'][_0x1d4b98]=new Action(_0x3c9996,_0x5a4d73,_0x1d4b98,_0x397646,_0x2d10ab);var _0x1e3940=_0xad725f[_0xec35('0x17')][_0x1d4b98];_0x1e3940[_0xec35('0xac')]=_0x539d80;_0x1e3940[_0xec35('0x8b')]=_0x6e3697;_0x1e3940[_0xec35('0xe7')]=_0x397646;if(_[_0xec35('0xe8')](_0x518bd3)){_0xad725f[_0xec35('0xe9')](_0x1e3940,_0x5a4d73,_0x3c9996,_0x397646)['then'](function(_0x45eac4){logger[_0xec35('0x29')](_0xec35('0xea'),_0xec35('0xeb')+_0x1e3940[_0xec35('0x4d')]+_0xec35('0xec')+_0x1e3940[_0xec35('0x8e')],JSON[_0xec35('0x2b')](_0x45eac4));ami[_0xec35('0x28')](_0xec35('0xed'),ut[_0xec35('0x80')](_0x1e3940,_0xec35('0xee'),_0xad725f[_0xec35('0x15')][_0x1e3940['queue']]));_0x58f0b4(ut['message'](_0xec35('0xef')));})['catch'](function(_0x415e0b){ut[_0xec35('0x37')](_0xec35('0xf0'),_0x415e0b);_0x28bf7d(ut[_0xec35('0x34')](_0xec35('0xf1'),_0x539d80,_0x6e3697));});}else{_0x5a4d73[_0xec35('0xf2')]+=0x1;ut['logBlacklist'](_0x1e3940);rpcDb[_0xec35('0xf3')](_0x1e3940,_0xec35('0xf4'));delete _0xad725f[_0xec35('0x17')][_0x1d4b98];_0x28bf7d(ut[_0xec35('0x34')]('Contact\x20in\x20black\x20List',_0x539d80,_0x6e3697));}});};Preview['prototype'][_0xec35('0x79')]=function(_0x4496a4){return!_[_0xec35('0x4a')](_0x4496a4)&&!_[_0xec35('0x4a')](_0x4496a4['name'])&&!_[_0xec35('0x4a')](_0x4496a4[_0xec35('0xf5')])&&_0x4496a4[_0xec35('0xf5')]&&!_[_0xec35('0x4a')](this[_0xec35('0x16')][util['format'](_0xec35('0xf6'),_0x4496a4['name'])])&&!_[_0xec35('0x4a')](this[_0xec35('0x16')][util[_0xec35('0x2c')](_0xec35('0xf6'),_0x4496a4[_0xec35('0x2e')])]['status'])&&(this[_0xec35('0x16')][util[_0xec35('0x2c')](_0xec35('0xf6'),_0x4496a4[_0xec35('0x2e')])][_0xec35('0x54')]===_0xec35('0xf7')||this['trunks'][util['format'](_0xec35('0xf6'),_0x4496a4['name'])][_0xec35('0x54')]===_0xec35('0xf8'));};Preview[_0xec35('0x3b')][_0xec35('0xf9')]=function(_0x54585d,_0x39fe47){return this[_0xec35('0xfa')](_0x54585d,_0x39fe47)['then'](function(_0x41616e){return _[_0xec35('0x51')](_0x41616e,[_0xec35('0x34')]);})[_0xec35('0x56')](function(_0x3524ec){if(_0x3524ec['unlock']){rpcDb['unlockContact'](_0x54585d);}if(_0x3524ec[_0xec35('0xf5')]){rpcDb['disableContact'](_0x54585d);}throw _['pick'](_0x3524ec,[_0xec35('0x34')]);});};Preview['prototype'][_0xec35('0xfa')]=function(_0x2cbffa,_0x39a1c7){var _0x1c11b7=this;var _0x3978e8,_0x377d9c;return rpcDb[_0xec35('0xfb')](_0x2cbffa)[_0xec35('0x60')](function(_0x1ae16d){if(!_[_0xec35('0x4a')](_0x1ae16d[0x0])){_0x377d9c=_0x1ae16d[0x0][_0xec35('0xfc')]?![]:!![];_0x3978e8=_0x1ae16d[0x0][_0xec35('0xfc')]?!![]:![];_0x3978e8=_0x39a1c7?!![]:_0x3978e8;}var _0x46a597=_0x1c11b7['validateContact'](_0x1ae16d);if(_0x46a597[_0xec35('0xfd')]){rpcDb[_0xec35('0xfe')](_[_0xec35('0x51')](_0x1ae16d[0x0],[_0xec35('0x53'),_0xec35('0xe6')]))[_0xec35('0x60')](function(_0x1022be){_0x1c11b7['checkInBlack'](_0x1022be,_0x1ae16d[0x0],_0x39a1c7,_0x377d9c,_0x3978e8)[_0xec35('0x60')](function(_0x30838a){return _0x30838a;})[_0xec35('0x56')](function(_0x20ef14){throw _0x20ef14;});})[_0xec35('0x56')](function(_0x2a7ead){ut['logger'](_0xec35('0xff'),_0x2a7ead);throw ut[_0xec35('0x34')](_0xec35('0x100'),_0x377d9c,_0x3978e8);});}else{throw ut['message'](_0x46a597[_0xec35('0x34')],_0x377d9c,_0x3978e8);}})[_0xec35('0x56')](function(_0x41da60){ut[_0xec35('0x37')](_0xec35('0x101'),_0x41da60);throw ut[_0xec35('0x34')](_0xec35('0x100'),![],!![]);});};Preview[_0xec35('0x3b')][_0xec35('0x102')]=function(_0x414aaf){if(_[_0xec35('0x4a')](_0x414aaf)||_[_0xec35('0xe8')](_0x414aaf)||!_['isNil'](_0x414aaf[0x0][_0xec35('0x65')])&&_[_0xec35('0x4a')](_0x414aaf[0x0][_0xec35('0x65')]['name'])){ut[_0xec35('0x37')](_0xec35('0x103'),_0x414aaf);return{'isValid':![],'message':_0xec35('0x104')};}var _0x5a278f=this['campaignsPreview'][_0x414aaf[0x0]['Queue'][_0xec35('0x2e')]];_0x5a278f[_0xec35('0x34')]=utils[_0xec35('0x35')][_0xec35('0x105')];if(_['isNil'](_0x5a278f)){ut['logger'](_0xec35('0x106'),_0x5a278f);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xec35('0x79')](_0x5a278f[_0xec35('0x78')])){ut[_0xec35('0x37')](_0xec35('0x107'),_0xec35('0x108')+_0x5a278f[_0xec35('0x2e')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x5a278f[_0xec35('0x7a')])){ut['logger'](_0xec35('0x107'),_0x5a278f[_0xec35('0x2e')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xec35('0x109')};}}if(!ut[_0xec35('0x77')](_0x5a278f[_0xec35('0x45')])){ut[_0xec35('0x37')]('[Preview][validateContact][Campaign\x20Active]',_0x5a278f[_0xec35('0x2e')]+_0xec35('0x10a'));return{'isValid':![],'message':_0xec35('0x108')+_0x5a278f['name']+_0xec35('0x10a')};}return{'isValid':!![],'message':_0xec35('0x10b')};};Preview[_0xec35('0x3b')][_0xec35('0xe9')]=function(_0x2a8c5c,_0x1eb89a,_0x336a4,_0x289d33){var _0x2a4af6=this;return new Promise(function(_0x3e52e7,_0x4cdf8e){var _0xcb5f33=_0x2a8c5c[_0xec35('0x92')];var _0x205ff4=_0x2a4af6[_0xec35('0x79')](_0x1eb89a['Trunk'])?util['format'](_0xec35('0x10c'),_0x1eb89a[_0xec35('0x78')][_0xec35('0x2e')],_[_0xec35('0x4a')](_0x1eb89a['dialPrefix'])?'':_0x1eb89a['dialPrefix'][_0xec35('0x10d')]()||'',_0x1eb89a['dialCutDigit']>0x0?_0x336a4[_0xec35('0xe6')]['substring'](_0x1eb89a[_0xec35('0x10e')]):_0x336a4[_0xec35('0xe6')]):util['format'](_0xec35('0x10c'),_[_0xec35('0x4a')](_0x1eb89a['TrunkBackup'])?_0x1eb89a[_0xec35('0x78')][_0xec35('0x2e')]:_0x1eb89a[_0xec35('0x7a')][_0xec35('0x2e')],_[_0xec35('0x4a')](_0x1eb89a[_0xec35('0x10f')])?'':_0x1eb89a['dialPrefix']['trim']()||'',_0x1eb89a[_0xec35('0x10e')]>0x0?_0x336a4['phone'][_0xec35('0x110')](_0x1eb89a[_0xec35('0x10e')]):_0x336a4[_0xec35('0xe6')]);var _0x38632c=_0x2a4af6[_0xec35('0x79')](_0x1eb89a[_0xec35('0x78')])?ut[_0xec35('0x111')](_0x1eb89a[_0xec35('0x78')][_0xec35('0x112')],_0x1eb89a['dialOriginateCallerIdName'],_0x1eb89a[_0xec35('0x113')]>0x0?ut[_0xec35('0x114')](_0x1eb89a[_0xec35('0x115')],_0x1eb89a[_0xec35('0x113')]):_0x1eb89a[_0xec35('0x115')]):ut[_0xec35('0x111')](_[_0xec35('0x4a')](_0x1eb89a[_0xec35('0x7a')])?_0x1eb89a[_0xec35('0x78')][_0xec35('0x112')]:_0x1eb89a['TrunkBackup'][_0xec35('0x112')],_0x1eb89a[_0xec35('0x116')],_0x1eb89a['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x1eb89a[_0xec35('0x115')],_0x1eb89a[_0xec35('0x113')]):_0x1eb89a[_0xec35('0x115')]);if(_0x38632c){_0x2a8c5c[_0xec35('0x117')]=ut[_0xec35('0x118')](_0x38632c);_0x2a8c5c['originatecalleridnum']=ut[_0xec35('0x119')](_0x38632c);}var _0x48de6c=ut[_0xec35('0x11a')](_0x1eb89a,_0x336a4,_0x205ff4,_0x38632c,_0xcb5f33,_0x2a8c5c);var _0x397a3b=utils[_0xec35('0x11b')](_0x336a4[_0xec35('0xe5')]);Object[_0xec35('0x11c')](_0x48de6c,_0x397a3b);_['merge'](_0x2a8c5c,ut[_0xec35('0x11d')](_0x48de6c));_0x2a8c5c[_0xec35('0x11e')]=moment()[_0xec35('0x2c')](_0xec35('0x69'));_0x1eb89a['variables']=_0x48de6c;var _0x11ce32=ut[_0xec35('0x11f')](_0x2a8c5c,_0x1eb89a,_0x48de6c,_0x2a8c5c[_0xec35('0x8b')],_0x289d33);return ami[_0xec35('0x120')](_0x11ce32)[_0xec35('0x60')](function(_0x52a8ad){_0x1eb89a[_0xec35('0x30')]+=0x1;logger[_0xec35('0x29')](_0xec35('0x121'),_0xcb5f33,_0xec35('0xa3'),_0x1eb89a['name'],_0xec35('0x4e'),_0x1eb89a['originated']);_0x3e52e7(_0x52a8ad);})[_0xec35('0x56')](function(_0x4722c8){ut['logAgent'](_0x2a8c5c,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x2a8c5c,_0xec35('0x122'));_0x4cdf8e(_0x4722c8);});});};Preview['prototype'][_0xec35('0x21')]=function(_0x48e77a){if(this['actions'][_0x48e77a[_0xec35('0x8c')]]){this[_0xec35('0x17')][_0x48e77a[_0xec35('0x8c')]][_0xec35('0x55')]=_0x48e77a[_0xec35('0x55')];}};Preview[_0xec35('0x3b')][_0xec35('0x19')]=function(_0x894377){var _0x19db6d=this;var _0x44e809=this['actions'][_0x894377[_0xec35('0x123')]];if(_0x44e809){if(_0x44e809[_0xec35('0xe7')]&&this[_0xec35('0x18')][_0x44e809[_0xec35('0xe7')]]){ut['logLookAgent'](_0x44e809,this[_0xec35('0x18')][_0x44e809[_0xec35('0xe7')]][_0xec35('0x2e')],this[_0xec35('0x18')][_0x44e809[_0xec35('0xe7')]]['id']);}var _0x41570e=_[_0xec35('0x124')](_0x44e809);_0x41570e['responsetime']=moment()[_0xec35('0x2c')](_0xec35('0x69'));var _0x4a6cfb=_0x19db6d[_0xec35('0x15')][_0x44e809['queue']];if(ut[_0xec35('0x125')](_0x894377[_0xec35('0x126')])){if(_0x44e809['unlockAgent']){rpcDb['unlockContact'](_0x44e809[_0xec35('0x8e')]);}if(_0x44e809['activeContact']){rpcDb[_0xec35('0x68')](_0x44e809[_0xec35('0x8e')]);}ami['emit'](_0xec35('0x127'),ut[_0xec35('0x80')](_0x44e809,_0xec35('0x128'),this[_0xec35('0x15')][_0x44e809[_0xec35('0x4d')]]));this['callProgressDetectingAgent'](_0x41570e,_0x4a6cfb,_0x894377);}else{_0x44e809[_0xec35('0x11e')]=moment()[_0xec35('0x2c')](_0xec35('0x69'));ut['logAgent'](_0x41570e,0x4,'Answer');rpcDb[_0xec35('0xdc')](_0x41570e,_0xec35('0x129'));}}};Preview[_0xec35('0x3b')][_0xec35('0x1b')]=function(_0x90e5c7){var _0x1fa86a=this['actions'][_0x90e5c7[_0xec35('0x8c')]];var _0x576538;if(_0x1fa86a){_0x576538=this[_0xec35('0x15')][_0x1fa86a[_0xec35('0x4d')]];logger[_0xec35('0x29')](_0xec35('0x12a'),_0x90e5c7['linkedid'],_0xec35('0xa3'),_0x576538[_0xec35('0x2e')],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);}if(this['actions'][_0x90e5c7['linkedid']]&&_0x90e5c7[_0xec35('0x8c')]!==_0x90e5c7[_0xec35('0x92')]){if(_0x90e5c7['cause']==='16'&&this[_0xec35('0x17')][_0x90e5c7['linkedid']][_0xec35('0x50')]){this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7['linkedid'],_0x90e5c7['cause']);}else if(this[_0xec35('0x17')][_0x90e5c7[_0xec35('0x8c')]][_0xec35('0x50')]){logger[_0xec35('0x29')]('[syncHangup][talking][cause]',_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')],'\x20Queue',_0x576538['name'],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')]);}}else if(_0x1fa86a&&_[_0xec35('0x4a')](_0x1fa86a['statedesc'])&&_0x576538[_0xec35('0x12c')]&&_0x90e5c7['linkedid']===_0x90e5c7[_0xec35('0x92')]&&_[_0xec35('0x4a')](_0x90e5c7[_0xec35('0xda')])&&_0x90e5c7[_0xec35('0x12b')]==='16'&&_0x90e5c7[_0xec35('0x12d')]==='6'&&_[_0xec35('0xd8')](_0x1fa86a[_0xec35('0x12e')])){if(_0x1fa86a['unlockAgent']){rpcDb[_0xec35('0x12f')](_0x1fa86a[_0xec35('0x8e')]);}if(_0x1fa86a['activeContact']){rpcDb['disableContact'](_0x1fa86a[_0xec35('0x8e')]);}_0x90e5c7[_0xec35('0xda')]='22';this[_0xec35('0x130')](_0x1fa86a,_0x576538,_0x90e5c7);}else if(_0x1fa86a&&_0x1fa86a[_0xec35('0x12e')]){if(_0x90e5c7[_0xec35('0x12b')]==='16'&&this[_0xec35('0x17')][_0x90e5c7[_0xec35('0x8c')]][_0xec35('0x50')]){logger[_0xec35('0x29')](_0xec35('0x131'),_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')],_0xec35('0xa3'),_0x576538[_0xec35('0x2e')],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')]);}else if(this[_0xec35('0x17')][_0x90e5c7[_0xec35('0x8c')]][_0xec35('0x50')]){logger[_0xec35('0x29')](_0xec35('0x132'),_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')],_0xec35('0xa3'),_0x576538[_0xec35('0x2e')],_0xec35('0x4f'),_0x576538[_0xec35('0x31')]);this[_0xec35('0x7b')](_0x90e5c7,_0x90e5c7[_0xec35('0x8c')],_0x90e5c7[_0xec35('0x12b')]);}}};Preview['prototype']['syncDialEnd']=function(_0x43a5d1){if(this[_0xec35('0x17')][_0x43a5d1[_0xec35('0x133')]]&&_0x43a5d1['destlinkedid']!==_0x43a5d1[_0xec35('0x134')]){this[_0xec35('0x7b')](_0x43a5d1,_0x43a5d1[_0xec35('0x133')],_0x43a5d1[_0xec35('0xcd')]);}};Preview[_0xec35('0x3b')][_0xec35('0x1d')]=function(_0x42dc68){if(this[_0xec35('0x17')][_0x42dc68[_0xec35('0x8c')]]&&_0x42dc68[_0xec35('0x8c')]!==_0x42dc68[_0xec35('0x92')]&&!this['actions'][_0x42dc68[_0xec35('0x8c')]]['dialAnswer']){if(_0x42dc68['cause']==='1'){this[_0xec35('0x7b')](_0x42dc68,_0x42dc68[_0xec35('0x8c')],_0x42dc68[_0xec35('0x12b')]);}}};Preview[_0xec35('0x3b')][_0xec35('0x135')]=function(_0x23f6aa,_0x3c9a70,_0x46e897){if(this[_0xec35('0x17')][_0x23f6aa]){if(_[_0xec35('0x4a')](this[_0xec35('0x17')][_0x23f6aa][_0xec35('0x136')])){this[_0xec35('0x17')][_0x23f6aa]['variables']={};}this['actions'][_0x23f6aa][_0xec35('0x136')][_0x3c9a70]=_0x46e897;}};Preview[_0xec35('0x3b')][_0xec35('0x23')]=function(_0x113621){try{if(!_[_0xec35('0x4a')](_0x113621)){if(ut['filterKey'](_[_0xec35('0x137')](_0x113621[_0xec35('0x138')])[0x0])){this[_0xec35('0x135')](_0x113621['uniqueid'],_[_0xec35('0x137')](_0x113621[_0xec35('0x138')])[0x0],_0x113621[_0xec35('0x139')]);}}}catch(_0x2fb55b){logger[_0xec35('0x13a')](_0xec35('0x13b'),util[_0xec35('0x13c')](_0x2fb55b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xec35('0x25')]=function(_0x3652fb){if(_0x3652fb){if(this[_0xec35('0x17')][_0x3652fb['transfertargetlinkedid']]){this[_0xec35('0x17')][_0x3652fb[_0xec35('0x13d')]][_0xec35('0x12e')]=!![];}}};Preview[_0xec35('0x3b')][_0xec35('0x27')]=function(_0x1d89e5){if(_0x1d89e5){if(this[_0xec35('0x17')][_0x1d89e5[_0xec35('0x13e')]]){this[_0xec35('0x17')][_0x1d89e5[_0xec35('0x13e')]][_0xec35('0x12e')]=!![];}}};module['exports']=Preview;
\ No newline at end of file