Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / services / ami / preview / index.js
index b9c04fa..faee4fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c91=['uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','decrementTalkink','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','[callProgressDetectingCustomer][logBusy]','Global','rescheduleContact','scheduledAt','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','unlockAgent','activeContact','CONGESTION','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','AgentReject','[syncHangupRequest][logAgentReject]','idContact','disableContact','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','info','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','response','custom:agentringnoanswer','callProgressDetectingAgent','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destuniqueid','variables','keys','variable','addVariable','value','error','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','uuid','md5','../../../config/logger','preview','actionPreview','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','dialAnswer','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','[RecallMe]','logger2','starttime','outboundReCallsDay','logCustomer','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countglobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime'];(function(_0x1ad68,_0x17bb38){var _0x34e760=function(_0x165b33){while(--_0x165b33){_0x1ad68['push'](_0x1ad68['shift']());}};_0x34e760(++_0x17bb38);}(_0x3c91,0x8c));var _0x13c9=function(_0x40c547,_0x4638bc){_0x40c547=_0x40c547-0x0;var _0x4c67bf=_0x3c91[_0x40c547];return _0x4c67bf;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x13c9('0x0'));var moment=require('moment');var md5=require(_0x13c9('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x13c9('0x2'))(_0x13c9('0x3'));var loggerAction=require(_0x13c9('0x2'))(_0x13c9('0x4'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0x13c9('0x5'));var ut=require('./util/util');config[_0x13c9('0x6')]=_[_0x13c9('0x7')](config[_0x13c9('0x6')],{'host':_0x13c9('0x8'),'port':0x18eb});var io=require(_0x13c9('0x9'))(new Redis(config[_0x13c9('0x6')]));var Sequence=function(){};Sequence[_0x13c9('0xa')][_0x13c9('0xb')]=function(_0x56c60f){this[_0x13c9('0xc')]=this['tail']?this[_0x13c9('0xc')][_0x13c9('0xd')](_0x56c60f):_0x56c60f();};function Preview(_0x186974){this['sequence']=new Sequence();this[_0x13c9('0xe')]=_0x186974[_0x13c9('0xf')];this[_0x13c9('0x10')]=_0x186974['trunks'];this[_0x13c9('0x11')]={};this[_0x13c9('0x12')]=_0x186974[_0x13c9('0x12')];this[_0x13c9('0x13')]=0x0;ami['on'](_0x13c9('0x14'),this['syncOriginateResponse'][_0x13c9('0x15')](this));ami['on'](_0x13c9('0x16'),this[_0x13c9('0x17')]['bind'](this));ami['on']('hanguprequest',this[_0x13c9('0x18')][_0x13c9('0x15')](this));ami['on'](_0x13c9('0x19'),this[_0x13c9('0x1a')]['bind'](this));ami['on']('newexten',this[_0x13c9('0x1b')][_0x13c9('0x15')](this));ami['on'](_0x13c9('0x1c'),this[_0x13c9('0x1d')]['bind'](this));ami['on'](_0x13c9('0x1e'),this[_0x13c9('0x1f')][_0x13c9('0x15')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x13c9('0x15')](this));this[_0x13c9('0x20')](this[_0x13c9('0xe')]);}function emit(_0x57835c,_0xc7a003,_0x5815b5){io['to'](_0x57835c)[_0x13c9('0x21')](_0xc7a003,_0x5815b5);}function emitCampaignPreview(_0x46960a){if(_0x46960a[_0x13c9('0x22')]===_0x13c9('0x23')){var _0x2865c9={'id':_0x46960a['id'],'name':_0x46960a[_0x13c9('0x24')],'strategy':_0x46960a[_0x13c9('0x25')],'answered':_0x46960a[_0x13c9('0x26')],'available':_0x46960a[_0x13c9('0x27')],'loggedIn':_0x46960a[_0x13c9('0x28')],'pTalking':_0x46960a[_0x13c9('0x29')],'sumBillable':_0x46960a[_0x13c9('0x2a')],'sumDuration':_0x46960a[_0x13c9('0x2b')],'sumHoldTime':_0x46960a[_0x13c9('0x2c')]||0x0,'talking':_0x46960a[_0x13c9('0x2d')],'total':_0x46960a[_0x13c9('0x2e')],'type':_0x46960a[_0x13c9('0x22')],'unmanaged':_0x46960a[_0x13c9('0x2f')],'abandoned':_0x46960a['abandoned'],'waiting':_0x46960a[_0x13c9('0x30')],'loggedInDb':_0x46960a[_0x13c9('0x31')],'dialActive':_0x46960a[_0x13c9('0x32')],'dialMethod':_0x46960a[_0x13c9('0x33')],'dialOriginateCallerIdName':_0x46960a[_0x13c9('0x34')],'dialOriginateCallerIdNumber':_0x46960a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x46960a[_0x13c9('0x35')],'dialPrefix':_0x46960a[_0x13c9('0x36')],'outboundAnswerAgiCallsDay':_0x46960a[_0x13c9('0x37')],'outboundAnswerCallsDay':_0x46960a['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x46960a[_0x13c9('0x38')],'outboundBusyCallsDay':_0x46960a[_0x13c9('0x39')],'outboundCongestionCallsDay':_0x46960a[_0x13c9('0x3a')],'outboundDropCallsDayACS':_0x46960a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x46960a['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x46960a[_0x13c9('0x3b')],'outboundNoAnswerCallsDay':_0x46960a[_0x13c9('0x3c')],'outboundNoSuchCallsDay':_0x46960a[_0x13c9('0x3d')],'outboundOriginateFailureCallsDay':_0x46960a[_0x13c9('0x3e')],'outboundReCallsDay':_0x46960a['outboundReCallsDay'],'outboundRejectCallsDay':_0x46960a[_0x13c9('0x3f')],'outboundUnknownCallsDay':_0x46960a['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x46960a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46960a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46960a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46960a[_0x13c9('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x46960a[_0x13c9('0x41')],'predictiveIntervalErlangCalls':_0x46960a[_0x13c9('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x46960a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x46960a[_0x13c9('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46960a[_0x13c9('0x44')],'predictiveIntervalPauses':_0x46960a['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x46960a[_0x13c9('0x45')],'predictiveIntervalTotalCalls':_0x46960a[_0x13c9('0x46')],'message':_0x46960a[_0x13c9('0x47')],'originated':_0x46960a[_0x13c9('0x48')],'erlangCalls':_0x46960a[_0x13c9('0x49')],'erlangCallToSecond':_0x46960a[_0x13c9('0x4a')],'erlangAbandonmentRate':_0x46960a[_0x13c9('0x4b')],'erlangBusyFactor':_0x46960a['erlangBusyFactor'],'startPredictive':_0x46960a[_0x13c9('0x4c')],'startProgressive':_0x46960a[_0x13c9('0x4d')]};if(_0x46960a[_0x13c9('0x4e')]){_0x2865c9['Trunk']={'id':_0x46960a[_0x13c9('0x4e')]['id'],'name':_0x46960a['Trunk']['name'],'active':_0x46960a['Trunk'][_0x13c9('0x4f')],'callerid':_0x46960a[_0x13c9('0x4e')]['callerid']};}if(_0x46960a[_0x13c9('0x50')]){_0x2865c9[_0x13c9('0x50')]={'id':_0x46960a['Interval']['id'],'name':_0x46960a[_0x13c9('0x50')][_0x13c9('0x24')]};}var _0x14323f=md5(JSON['stringify'](_0x2865c9));if(_0x46960a[_0x13c9('0x1')]!==_0x14323f){_0x46960a[_0x13c9('0x1')]=_0x14323f;emit(util[_0x13c9('0x51')](_0x13c9('0x52'),_0x2865c9[_0x13c9('0x24')]),'voice_queue:save',_0x2865c9);}}}function emitVoiceQueueChannelRemove(_0x4469af){emit(util[_0x13c9('0x51')](_0x13c9('0x52'),_0x4469af[_0x13c9('0x24')]),_0x13c9('0x53'),_0x4469af);}function notSendMessagesQueue(_0x2b6b68){if(_0x2b6b68[_0x13c9('0x54')]){if(_0x2b6b68[_0x13c9('0x48')]===0x0&&_0x2b6b68[_0x13c9('0x29')]===0x0){_0x2b6b68[_0x13c9('0x54')]=![];_0x2b6b68['available']=0x0;_0x2b6b68[_0x13c9('0x55')]=0x0;_0x2b6b68['message']='NOT_ACTIVE';ut['logger'](_0x13c9('0x56'),_0x2b6b68[_0x13c9('0x24')]+_0x13c9('0x57'));}else{_0x2b6b68[_0x13c9('0x47')]=_0x13c9('0x58');ut[_0x13c9('0x59')](_0x13c9('0x56'),_0x2b6b68[_0x13c9('0x24')]+_0x13c9('0x5a'));}emitCampaignPreview(_0x2b6b68);}}Preview[_0x13c9('0xa')][_0x13c9('0x20')]=function(){var _0x1d94dd=this;setInterval(function(){_0x1d94dd[_0x13c9('0x5b')]();},0x7cf);};Preview[_0x13c9('0xa')][_0x13c9('0x5b')]=function(){var _0x1c670b=this[_0x13c9('0xe')];this[_0x13c9('0x13')]+=0x1;for(var _0x243dd2 in _0x1c670b){if(_0x1c670b[_0x13c9('0x5c')](_0x243dd2)&&(_0x1c670b[_0x243dd2][_0x13c9('0x33')]===_0x13c9('0x3')||_0x1c670b[_0x243dd2][_0x13c9('0x33')]===_0x13c9('0x5d'))&&_0x1c670b[_0x243dd2][_0x13c9('0x22')]===_0x13c9('0x23')){if(this[_0x13c9('0x13')]>0x7){this[_0x13c9('0x13')]=0x0;this[_0x13c9('0x5e')]();}}if(_0x1c670b[_0x13c9('0x5c')](_0x243dd2)&&_0x1c670b[_0x243dd2][_0x13c9('0x33')]===_0x13c9('0x3')&&_0x1c670b[_0x243dd2]['type']==='outbound'){if(_0x1c670b[_0x243dd2]['dialActive']){this[_0x13c9('0x5f')](_0x1c670b[_0x243dd2]);this[_0x13c9('0x60')](_0x1c670b[_0x243dd2]);}else{notSendMessagesQueue(_0x1c670b[_0x243dd2]);}}}};Preview[_0x13c9('0xa')]['clearZombieChannel']=function(_0x41aac4){var _0x461d88=this;this[_0x13c9('0x61')][_0x13c9('0xb')](function(){if(!_[_0x13c9('0x62')](_0x461d88[_0x13c9('0x11')][_0x41aac4])){loggerAction['info'](_0x13c9('0x63'),_0x41aac4,_0x13c9('0x64'),_0x461d88['actions'][_0x41aac4][_0x13c9('0x65')],_0x13c9('0x66'),JSON[_0x13c9('0x67')](_0x461d88['campaignsPreview'][_0x461d88[_0x13c9('0x11')][_0x41aac4][_0x13c9('0x65')]][_0x13c9('0x48')]),_0x13c9('0x68'),JSON['stringify'](_0x461d88['campaignsPreview'][_0x461d88[_0x13c9('0x11')][_0x41aac4]['queue']]['pTalking']),JSON['stringify'](_0x461d88[_0x13c9('0x11')][_0x41aac4]['dialAnswer']),JSON[_0x13c9('0x67')](_[_0x13c9('0x69')](_0x461d88[_0x13c9('0x11')][_0x41aac4],[_0x13c9('0x6a'),'UserId',_0x13c9('0x6b'),_0x13c9('0x6c')])));return ami[_0x13c9('0x6d')]({'action':_0x13c9('0x6e'),'channel':_0x461d88[_0x13c9('0x11')][_0x41aac4][_0x13c9('0x6f')]})[_0x13c9('0x70')](function(_0x3fb4e7){if(_0x3fb4e7[_0x13c9('0x47')]===_0x13c9('0x71')){setTimeout(function(){if(_0x461d88[_0x13c9('0x11')][_0x41aac4]){ut[_0x13c9('0x72')](_0x461d88['campaignsPreview'][_0x461d88[_0x13c9('0x11')][_0x41aac4][_0x13c9('0x65')]],'[clearZombieChannel]');if(_0x461d88[_0x13c9('0x11')][_0x41aac4][_0x13c9('0x73')]===!![]){ut['decrementTalkink'](_0x461d88[_0x13c9('0xe')][_0x461d88[_0x13c9('0x11')][_0x41aac4][_0x13c9('0x65')]],_0x13c9('0x74'));ut[_0x13c9('0x75')](_0x13c9('0x76')+_0x41aac4,_0x461d88[_0x13c9('0x11')][_0x41aac4][_0x13c9('0x65')]);}ut[_0x13c9('0x75')](_0x13c9('0x77')+_0x41aac4,_0x461d88[_0x13c9('0x11')][_0x41aac4]['queue']);delete _0x461d88[_0x13c9('0x11')][_0x41aac4];}},0x2328);}});}});};Preview[_0x13c9('0xa')][_0x13c9('0x5e')]=function(){var _0x3b1ea3=this;loggerAction['info'](_0x13c9('0x78'),_[_0x13c9('0x79')](this['actions']));for(var _0x4d589f in this[_0x13c9('0x11')]){if(_0x3b1ea3[_0x13c9('0x11')][_0x13c9('0x5c')](_0x4d589f)){_0x3b1ea3[_0x13c9('0x7a')](_0x4d589f);}}};Preview[_0x13c9('0xa')][_0x13c9('0x60')]=function(_0x4be6b7){var _0xf26085=this;rpcDb[_0x13c9('0x7b')](_0x4be6b7['id'],ut[_0x13c9('0x7c')](this[_0x13c9('0x12')]))[_0x13c9('0x7d')](function(_0x2019c4){if(!_[_0x13c9('0x62')](_0x2019c4)){for(var _0x28e1db=0x0;_0x28e1db<_0x2019c4[_0x13c9('0x7e')];_0x28e1db+=0x1){if(ut[_0x13c9('0x7f')](_0x2019c4[_0x28e1db][_0x13c9('0x80')])<_0x4be6b7[_0x13c9('0x81')]*0x3c){_0xf26085['run'](_0x2019c4[_0x28e1db]['id'])[_0x13c9('0x7d')](ut['logger2'](_0x13c9('0x82')))[_0x13c9('0x70')](ut[_0x13c9('0x83')](_0x13c9('0x82')));}else{var _0x4a8253=new Action(_0x2019c4[_0x28e1db],_0x4be6b7);_0x4a8253[_0x13c9('0x84')]=moment()[_0x13c9('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x4be6b7[_0x13c9('0x85')]+=0x1;ut[_0x13c9('0x86')](_0x4a8253,0x17,'RecallInQueue');if(_0x4be6b7['dialRecallInQueue']){rpcDb[_0x13c9('0x87')](ut[_0x13c9('0x88')](_0x2019c4[_0x28e1db]));rpcDb['createCustomerHistory'](_0x4a8253,_0x13c9('0x89'));}else{ut[_0x13c9('0x86')](_0x4a8253,0x16,_0x13c9('0x8a'));rpcDb[_0x13c9('0x8b')](_0x4a8253,_0x13c9('0x8c'));rpcDb[_0x13c9('0x8d')](_0x4a8253,'[HistoryRecallClose]');}}}}})[_0x13c9('0x70')](ut[_0x13c9('0x83')]('[getContactRecallMe]'));};Preview['prototype'][_0x13c9('0x5f')]=function(_0x2c8c29){_0x2c8c29['sendMessageOneNotActive']=!![];if(ut[_0x13c9('0x8e')](_0x2c8c29[_0x13c9('0x28')])){_0x2c8c29[_0x13c9('0x47')]=_0x13c9('0x8f');}else if(!ut[_0x13c9('0x90')](_0x2c8c29[_0x13c9('0x32')])){_0x2c8c29[_0x13c9('0x47')]=_0x13c9('0x91');}else if(!this[_0x13c9('0x92')](_0x2c8c29[_0x13c9('0x4e')])){if(!this[_0x13c9('0x92')](_0x2c8c29[_0x13c9('0x93')])){_0x2c8c29['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x2c8c29[_0x13c9('0x47')]=_0x13c9('0x94');}}else{_0x2c8c29[_0x13c9('0x47')]='ACTIVE';}emitCampaignPreview(_0x2c8c29);};Preview[_0x13c9('0xa')][_0x13c9('0x95')]=function(_0x48b92e,_0x33a748,_0x5ca153){var _0x48fb9a=this;var _0x431c5b=this[_0x13c9('0x11')][_0x33a748];var _0xbb8567=this[_0x13c9('0xe')][_0x431c5b[_0x13c9('0x65')]];var _0x39572f;if(_0xbb8567){switch(_0x5ca153){case'1':_0xbb8567[_0x13c9('0x3d')]+=0x1;_0x431c5b[_0x13c9('0x96')]=ut['totalGlobal'](_0x431c5b);ut['logCustomer'](_0x431c5b,0x0,_0x13c9('0x97'));rpcDb[_0x13c9('0x8b')](_0x431c5b,_0x13c9('0x98'));if(ut[_0x13c9('0x99')](_0x431c5b)>=_0xbb8567[_0x13c9('0x9a')]){_0x39572f=ut[_0x13c9('0x9b')](_0x431c5b,0xf,'Global');rpcDb[_0x13c9('0x8d')](_0x39572f,_0x13c9('0x9c'));}else{rpcDb[_0x13c9('0x8d')](_0x431c5b,_0x13c9('0x9c'));}delete this['actions'][_0x48b92e[_0x13c9('0x9d')]];break;case _0x13c9('0x9e'):var _0x303e3d=moment()['format'](_0x13c9('0x9f'));_0x431c5b[_0x13c9('0xa0')]=_0x303e3d;_0x431c5b[_0x13c9('0xa1')]=_0x303e3d;_0x431c5b[_0x13c9('0x73')]=!![];_0xbb8567['pTalking']+=0x1;logger['info']('[syncHangup][talking][increment]',_0x431c5b[_0x13c9('0xa2')],_0x13c9('0xa3'),_0xbb8567[_0x13c9('0x24')],'pTalking:\x20',_0xbb8567[_0x13c9('0x29')]);ami[_0x13c9('0x21')]('custom:agentconnect',ut['buildObj'](_0x431c5b,_0x13c9('0xa4')));if(_0xbb8567['acw']){ami[_0x13c9('0x21')](_0x13c9('0xa5'),ut[_0x13c9('0xa6')](_0x431c5b));}break;case'16':ami['emit'](_0x13c9('0xa7'),ut[_0x13c9('0xa8')](_0x431c5b,_0x13c9('0xa9')));emitVoiceQueueChannelRemove(ut[_0x13c9('0xa8')](_0x431c5b,_0x13c9('0xa9')));_0xbb8567['outboundAnswerCallsDay']+=0x1;_0xbb8567[_0x13c9('0x2e')]+=0x1;_0xbb8567[_0x13c9('0x26')]+=0x1;ut[_0x13c9('0xaa')](_0xbb8567,'[16]');_0x431c5b[_0x13c9('0x96')]=ut[_0x13c9('0x99')](_0x431c5b);ut[_0x13c9('0x86')](_0x431c5b,0x4,_0x13c9('0xab'));rpcDb[_0x13c9('0x8b')](_0x431c5b,_0x13c9('0xac'));rpcDb[_0x13c9('0x8d')](_0x431c5b,_0x13c9('0xad'));rpcDb['crateCustomerReportQueue'](_0x431c5b);_0xbb8567[_0x13c9('0x2b')]+=_0x431c5b[_0x13c9('0xae')];_0xbb8567[_0x13c9('0x2a')]+=_0x431c5b[_0x13c9('0xae')];logger['info'](_0x13c9('0xaf'),_0x431c5b[_0x13c9('0xa2')],_0x13c9('0xa3'),_0xbb8567[_0x13c9('0x24')],_0x13c9('0x68'),_0xbb8567[_0x13c9('0x29')]);delete this[_0x13c9('0x11')][_0x48b92e[_0x13c9('0x9d')]];break;case _0x13c9('0xb0'):_0xbb8567[_0x13c9('0x39')]+=0x1;_0x431c5b[_0x13c9('0xb1')]+=0x1;_0x431c5b[_0x13c9('0x96')]=ut[_0x13c9('0x99')](_0x431c5b);ut[_0x13c9('0x86')](_0x431c5b,0x5,'Busy');rpcDb['createCustomerHistory'](_0x431c5b,_0x13c9('0xb2'));if(ut[_0x13c9('0x99')](_0x431c5b)>=_0xbb8567[_0x13c9('0x9a')]){_0x39572f=ut['cloneAction'](_0x431c5b,0xf,_0x13c9('0xb3'));rpcDb[_0x13c9('0x8d')](_0x39572f,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x431c5b[_0x13c9('0xb1')]>=_0xbb8567['dialBusyMaxRetry']){rpcDb[_0x13c9('0x8d')](_0x431c5b,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x13c9('0xb4')](ut[_0x13c9('0xb5')](_0x431c5b,_0x13c9('0xb1'),_0xbb8567['dialBusyRetryFrequency']),_0x431c5b['unlockAgent'],_0x431c5b['activeContact']);}}break;case _0x13c9('0xb6'):_0xbb8567['outboundNoAnswerCallsDay']+=0x1;_0x431c5b[_0x13c9('0xb7')]+=0x1;_0x431c5b['countglobal']=ut[_0x13c9('0x99')](_0x431c5b);ut[_0x13c9('0x86')](_0x431c5b,0x3,_0x13c9('0xb8'));rpcDb[_0x13c9('0x8b')](_0x431c5b,_0x13c9('0xb9'));if(ut['totalGlobal'](_0x431c5b)>=_0xbb8567[_0x13c9('0x9a')]){_0x39572f=ut['cloneAction'](_0x431c5b,0xf,'Global');rpcDb['createCustomerFinal'](_0x39572f,_0x13c9('0xba'));}else{if(_0x431c5b[_0x13c9('0xb7')]>=_0xbb8567['dialNoAnswerMaxRetry']){rpcDb[_0x13c9('0x8d')](_0x431c5b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0x13c9('0xb5')](_0x431c5b,_0x13c9('0xb7'),_0xbb8567['dialNoAnswerRetryFrequency']),_0x431c5b[_0x13c9('0xbb')],_0x431c5b[_0x13c9('0xbc')]);}}break;case _0x13c9('0xbd'):_0xbb8567[_0x13c9('0x3a')]+=0x1;_0x431c5b['countcongestionretry']+=0x1;_0x431c5b[_0x13c9('0x96')]=ut['totalGlobal'](_0x431c5b);ut[_0x13c9('0x86')](_0x431c5b,0x8,'Congestion');rpcDb[_0x13c9('0x8b')](_0x431c5b,_0x13c9('0xbe'));if(ut[_0x13c9('0x99')](_0x431c5b)>=_0xbb8567['dialGlobalMaxRetry']){_0x39572f=ut['cloneAction'](_0x431c5b,0xf,_0x13c9('0xb3'));rpcDb[_0x13c9('0x8d')](_0x39572f,_0x13c9('0xbf'));}else{if(_0x431c5b[_0x13c9('0xc0')]>=_0xbb8567['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x431c5b,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x13c9('0xb4')](ut[_0x13c9('0xb5')](_0x431c5b,_0x13c9('0xc0'),_0xbb8567['dialBusyRetryFrequency']),_0x431c5b['unlockAgent'],_0x431c5b[_0x13c9('0xbc')]);}}break;case'CANCEL':_0xbb8567[_0x13c9('0x3f')]+=0x1;_0x431c5b['countglobal']=ut[_0x13c9('0x99')](_0x431c5b);ut[_0x13c9('0x86')](_0x431c5b,0x14,_0x13c9('0xc1'));rpcDb[_0x13c9('0x8b')](_0x431c5b,_0x13c9('0xc2'));if(_0x431c5b[_0x13c9('0xbb')]){rpcDb['unlockContact'](_0x431c5b[_0x13c9('0xc3')]);}if(_0x431c5b[_0x13c9('0xbc')]){rpcDb[_0x13c9('0xc4')](_0x431c5b[_0x13c9('0xc3')]);}break;default:if(_0x431c5b[_0x13c9('0x73')]){ut[_0x13c9('0xaa')](_0xbb8567,_0x13c9('0xc5'));ut[_0x13c9('0x75')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0xbb8567[_0x13c9('0x24')],_0x48b92e);}_0xbb8567['outboundUnknownCallsDay']+=0x1;_0x431c5b[_0x13c9('0x96')]=ut['totalGlobal'](_0x431c5b);ut[_0x13c9('0x86')](_0x431c5b,0xc,_0x48b92e[_0x13c9('0xc6')]||_0x48b92e[_0x13c9('0xc7')]);rpcDb['createCustomerHistory'](_0x431c5b,_0x13c9('0xc8'));if(ut[_0x13c9('0x99')](_0x431c5b)>=_0xbb8567[_0x13c9('0x9a')]){_0x39572f=ut[_0x13c9('0x9b')](_0x431c5b,0xf,_0x13c9('0xb3'));rpcDb[_0x13c9('0x8d')](_0x39572f,_0x13c9('0xc9'));}else{rpcDb[_0x13c9('0x8d')](_0x431c5b,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x13c9('0x11')][_0x48b92e['linkedid']];}if(!(_0x431c5b['dialAnswer']&&_0x5ca153==='16')){ut['updateOriginated'](_0xbb8567,_0x13c9('0xca'));logger[_0x13c9('0xcb')](_0x13c9('0xcc'),_0x431c5b[_0x13c9('0xa2')],_0x13c9('0xa3'),_0xbb8567[_0x13c9('0x24')],'originated:\x20',_0xbb8567[_0x13c9('0x48')]);}if(_0x5ca153!==_0x13c9('0x9e')){delete this[_0x13c9('0x11')][_0x48b92e[_0x13c9('0x9d')]];delete this[_0x13c9('0x11')][_0x48b92e[_0x13c9('0xcd')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x102f15,_0x926d60,_0x2783af){if(_[_0x13c9('0xce')](_0x926d60)&&_0x13c9('0xcf')!==typeof _0x926d60){return;}if(_[_0x13c9('0xce')](_0x2783af)&&'object'!==typeof _0x2783af){return;}switch(_0x2783af['reason']){case'0':ut[_0x13c9('0xd0')](_0x102f15,0x0,'NoSuchNumber');rpcDb[_0x13c9('0xd1')](_0x102f15,_0x13c9('0xd2'));break;case'3':ut[_0x13c9('0xd0')](_0x102f15,0x3,_0x13c9('0xb8'));rpcDb[_0x13c9('0xd1')](_0x102f15,_0x13c9('0xd3'));break;case'5':ut['logAgent'](_0x102f15,0x5,_0x13c9('0xd4'));rpcDb[_0x13c9('0xd1')](_0x102f15,_0x13c9('0xd5'));break;case'8':ut[_0x13c9('0xd0')](_0x102f15,0x8,_0x13c9('0xd6'));rpcDb[_0x13c9('0xd1')](_0x102f15,_0x13c9('0xd7'));break;case'22':ut[_0x13c9('0xd0')](_0x102f15,0x16,_0x13c9('0xd8'));rpcDb[_0x13c9('0xd1')](_0x102f15,_0x13c9('0xd9'));break;default:ut[_0x13c9('0xd0')](_0x102f15,0xc,_0x2783af[_0x13c9('0xda')]);rpcDb[_0x13c9('0xd1')](_0x102f15,_0x13c9('0xd7'));}ut[_0x13c9('0x72')](_0x926d60,'[callProgressDetectingAgent]');logger[_0x13c9('0xcb')](_0x13c9('0xdb'),_0x102f15['uniqueid'],_0x13c9('0xa3'),_0x926d60[_0x13c9('0x24')],_0x13c9('0x66'),_0x926d60[_0x13c9('0x48')]);delete this[_0x13c9('0x11')][_0x102f15['uniqueid']];};Preview[_0x13c9('0xa')][_0x13c9('0xdc')]=function(_0x15d137,_0x490fff,_0x1f60a0,_0x164f2a,_0x316e12){var _0x2986c9=this;return new BPromise(function(_0x367adb,_0x31b344){if(_['isNil'](_0x490fff)||_[_0x13c9('0x62')](_0x490fff[_0x13c9('0xdd')])||_[_0x13c9('0x62')](_0x490fff['Contact'][_0x13c9('0xde')])||_[_0x13c9('0x62')](_0x490fff[_0x13c9('0x6b')])){_0x31b344(ut[_0x13c9('0x47')](_0x13c9('0xdf'),_0x164f2a,_0x316e12));return;}var _0x528c45=uuid['v4']();var _0x40f953=_0x2986c9[_0x13c9('0xe')][_0x490fff[_0x13c9('0x64')][_0x13c9('0x24')]];var _0x2eecc2=_0x1f60a0?_0x2986c9[_0x13c9('0x12')][_0x1f60a0]['id']:undefined;_0x2986c9[_0x13c9('0x11')][_0x528c45]=new Action(_0x490fff,_0x40f953,_0x528c45,_0x1f60a0,_0x2eecc2);var _0x59e289=_0x2986c9[_0x13c9('0x11')][_0x528c45];_0x59e289[_0x13c9('0xbb')]=_0x164f2a;_0x59e289['activeContact']=_0x316e12;_0x59e289[_0x13c9('0xe0')]=_0x1f60a0;if(_[_0x13c9('0xe1')](_0x15d137)){_0x2986c9[_0x13c9('0xe2')](_0x59e289,_0x40f953,_0x490fff,_0x1f60a0)[_0x13c9('0x7d')](function(_0x285864){logger['info'](_0x13c9('0xe3'),_0x13c9('0xe4')+_0x59e289[_0x13c9('0x65')]+'\x20IdHopper:\x20'+_0x59e289['idContact'],JSON['stringify'](_0x285864));ami[_0x13c9('0x21')](_0x13c9('0xe5'),ut['buildObj'](_0x59e289,_0x13c9('0xe6')));_0x367adb(ut[_0x13c9('0x47')](_0x13c9('0xe7')));})['catch'](function(_0x46167d){ut['logger'](_0x13c9('0xe8'),_0x46167d);_0x31b344(ut['message'](_0x13c9('0xe9'),_0x164f2a,_0x316e12));});}else{_0x40f953[_0x13c9('0x38')]+=0x1;ut[_0x13c9('0xea')](_0x59e289);rpcDb[_0x13c9('0xeb')](_0x59e289,'[Blacklist][error]');delete _0x2986c9[_0x13c9('0x11')][_0x528c45];_0x31b344(ut[_0x13c9('0x47')](_0x13c9('0xec'),_0x164f2a,_0x316e12));}});};Preview[_0x13c9('0xa')][_0x13c9('0x92')]=function(_0x446110){return!_[_0x13c9('0x62')](_0x446110)&&!_[_0x13c9('0x62')](_0x446110[_0x13c9('0x24')])&&!_[_0x13c9('0x62')](_0x446110[_0x13c9('0x4f')])&&_0x446110[_0x13c9('0x4f')]&&!_[_0x13c9('0x62')](this[_0x13c9('0x10')][util[_0x13c9('0x51')](_0x13c9('0xed'),_0x446110[_0x13c9('0x24')])])&&!_[_0x13c9('0x62')](this[_0x13c9('0x10')][util[_0x13c9('0x51')](_0x13c9('0xed'),_0x446110[_0x13c9('0x24')])][_0x13c9('0x6e')])&&(this[_0x13c9('0x10')][util['format'](_0x13c9('0xed'),_0x446110['name'])][_0x13c9('0x6e')]===_0x13c9('0xee')||this[_0x13c9('0x10')][util[_0x13c9('0x51')](_0x13c9('0xed'),_0x446110[_0x13c9('0x24')])][_0x13c9('0x6e')]===_0x13c9('0xef'));};Preview[_0x13c9('0xa')][_0x13c9('0xf0')]=function(_0x23485c,_0x2c3d97){var _0x9388ee=this;return new BPromise(function(_0x43737f,_0x2eb962){_0x9388ee['execRun'](_0x23485c,_0x2c3d97)[_0x13c9('0x7d')](function(_0xc749be){_0x43737f(_['pick'](_0xc749be,[_0x13c9('0x47')]));})[_0x13c9('0x70')](function(_0x5c88ec){if(_0x5c88ec[_0x13c9('0xf1')]){rpcDb[_0x13c9('0xf2')](_0x23485c);}if(_0x5c88ec[_0x13c9('0x4f')]){rpcDb['disableContact'](_0x23485c);}_0x2eb962(_[_0x13c9('0x69')](_0x5c88ec,[_0x13c9('0x47')]));});});};Preview[_0x13c9('0xa')][_0x13c9('0xf3')]=function(_0x7a3452,_0x2b8748){var _0x5a119e=this;return new BPromise(function(_0x128799,_0x5a7564){var _0x249a2d,_0x40abd5;rpcDb[_0x13c9('0xf4')](_0x7a3452)[_0x13c9('0x7d')](function(_0x5093af){if(!_[_0x13c9('0x62')](_0x5093af[0x0])){_0x40abd5=_0x5093af[0x0][_0x13c9('0xf5')]?![]:!![];_0x249a2d=_0x5093af[0x0][_0x13c9('0xf5')]?!![]:![];_0x249a2d=_0x2b8748?!![]:_0x249a2d;}var _0x16f477=_0x5a119e[_0x13c9('0xf6')](_0x5093af);if(_0x16f477[_0x13c9('0xf7')]){rpcDb[_0x13c9('0xf8')](_[_0x13c9('0x69')](_0x5093af[0x0],[_0x13c9('0x6b'),'Contact.phone']))[_0x13c9('0x7d')](function(_0x2fc62b){_0x5a119e['checkInBlack'](_0x2fc62b,_0x5093af[0x0],_0x2b8748,_0x40abd5,_0x249a2d)[_0x13c9('0x7d')](function(_0x43ed14){_0x128799(_0x43ed14);})['catch'](function(_0x29fb8c){_0x5a7564(_0x29fb8c);});})[_0x13c9('0x70')](function(_0x517366){ut[_0x13c9('0x59')](_0x13c9('0xf9'),_0x517366);_0x5a7564(ut[_0x13c9('0x47')](_0x13c9('0xfa'),_0x40abd5,_0x249a2d));});}else{_0x5a7564(ut[_0x13c9('0x47')](_0x16f477['message'],_0x40abd5,_0x249a2d));}})[_0x13c9('0x70')](function(_0x1cff87){ut['logger']('[Preview][getContactPreview]',_0x1cff87);_0x5a7564(ut[_0x13c9('0x47')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x13c9('0xa')][_0x13c9('0xf6')]=function(_0x2ee199){if(_[_0x13c9('0x62')](_0x2ee199)||_['isEmpty'](_0x2ee199)||!_['isNil'](_0x2ee199[0x0]['Agent'])&&_[_0x13c9('0x62')](_0x2ee199[0x0][_0x13c9('0xfb')][_0x13c9('0x24')])){ut[_0x13c9('0x59')]('[Preview][validateContact][Empty\x20Contact]',_0x2ee199);return{'isValid':![],'message':_0x13c9('0xfc')};}var _0x421fa1=this['campaignsPreview'][_0x2ee199[0x0][_0x13c9('0x64')][_0x13c9('0x24')]];_0x421fa1[_0x13c9('0x47')]=_0x13c9('0x94');if(_[_0x13c9('0x62')](_0x421fa1)){ut[_0x13c9('0x59')](_0x13c9('0xfd'),_0x421fa1);return{'isValid':![],'message':_0x13c9('0xfe')};}if(!this[_0x13c9('0x92')](_0x421fa1[_0x13c9('0x4e')])){ut['logger'](_0x13c9('0xff'),_0x13c9('0x100')+_0x421fa1[_0x13c9('0x24')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x13c9('0x92')](_0x421fa1[_0x13c9('0x93')])){ut[_0x13c9('0x59')](_0x13c9('0xff'),_0x421fa1['name']+_0x13c9('0x101'));return{'isValid':![],'message':_0x13c9('0x102')};}}if(!ut[_0x13c9('0x90')](_0x421fa1[_0x13c9('0x32')])){ut[_0x13c9('0x59')]('[Preview][validateContact][Campaign\x20Active]',_0x421fa1[_0x13c9('0x24')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x421fa1[_0x13c9('0x24')]+_0x13c9('0x103')};}return{'isValid':!![],'message':_0x13c9('0x104')};};Preview[_0x13c9('0xa')][_0x13c9('0xe2')]=function(_0x337afd,_0x2660e9,_0x1421ee,_0x4e1a1e){var _0x7ed0a5=this;return new BPromise(function(_0xc200c4,_0x20676b){var _0x18af54=_0x337afd[_0x13c9('0xa2')];var _0x307a48=_0x7ed0a5[_0x13c9('0x92')](_0x2660e9['Trunk'])?util[_0x13c9('0x51')](_0x13c9('0x105'),_0x2660e9[_0x13c9('0x4e')]['name'],_['isNil'](_0x2660e9['dialPrefix'])?'':_0x2660e9['dialPrefix'][_0x13c9('0x106')]()||'',_0x2660e9[_0x13c9('0x107')]>0x0?_0x1421ee[_0x13c9('0xdd')][_0x13c9('0xde')][_0x13c9('0x108')](_0x2660e9[_0x13c9('0x107')]):_0x1421ee[_0x13c9('0xdd')][_0x13c9('0xde')]):util[_0x13c9('0x51')](_0x13c9('0x105'),_['isNil'](_0x2660e9[_0x13c9('0x93')])?_0x2660e9[_0x13c9('0x4e')][_0x13c9('0x24')]:_0x2660e9['TrunkBackup']['name'],_[_0x13c9('0x62')](_0x2660e9['dialPrefix'])?'':_0x2660e9[_0x13c9('0x36')]['trim']()||'',_0x2660e9[_0x13c9('0x107')]>0x0?_0x1421ee[_0x13c9('0xdd')][_0x13c9('0xde')][_0x13c9('0x108')](_0x2660e9[_0x13c9('0x107')]):_0x1421ee['Contact']['phone']);var _0x531dc7=_0x7ed0a5[_0x13c9('0x92')](_0x2660e9['Trunk'])?ut['getCallerId'](_0x2660e9[_0x13c9('0x4e')][_0x13c9('0x109')],_0x2660e9['dialOriginateCallerIdName'],_0x2660e9[_0x13c9('0x10a')]>0x0?ut['getCallerIdRandom'](_0x2660e9[_0x13c9('0x10b')],_0x2660e9[_0x13c9('0x10a')]):_0x2660e9[_0x13c9('0x10b')]):ut[_0x13c9('0x10c')](_[_0x13c9('0x62')](_0x2660e9[_0x13c9('0x93')])?_0x2660e9[_0x13c9('0x4e')]['callerid']:_0x2660e9[_0x13c9('0x93')][_0x13c9('0x109')],_0x2660e9[_0x13c9('0x34')],_0x2660e9['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x13c9('0x10d')](_0x2660e9[_0x13c9('0x10b')],_0x2660e9[_0x13c9('0x10a')]):_0x2660e9[_0x13c9('0x10b')]);if(_0x531dc7){_0x337afd[_0x13c9('0x10e')]=ut['extractCalleridName'](_0x531dc7);_0x337afd[_0x13c9('0x10f')]=ut[_0x13c9('0x110')](_0x531dc7);}var _0x3ad166=ut['addVariables'](_0x2660e9,_0x1421ee,_0x307a48,_0x531dc7,_0x18af54,_0x337afd);_['merge'](_0x337afd,ut[_0x13c9('0x111')](_0x3ad166));_0x337afd[_0x13c9('0x84')]=moment()[_0x13c9('0x51')](_0x13c9('0x9f'));ami['Action'](ut['variablesAction'](_0x337afd,_0x2660e9,_0x3ad166,_0x337afd[_0x13c9('0xbc')],_0x4e1a1e))[_0x13c9('0x7d')](function(_0x3f9d9f){_0x2660e9['originated']+=0x1;logger[_0x13c9('0xcb')](_0x13c9('0x112'),_0x18af54,'\x20Queue',_0x2660e9[_0x13c9('0x24')],_0x13c9('0x66'),_0x2660e9[_0x13c9('0x48')]);_0xc200c4(_0x3f9d9f);})['catch'](function(_0x35d9f2){ut[_0x13c9('0xd0')](_0x337afd,0xe,_0x13c9('0x113'));rpcDb[_0x13c9('0xd1')](_0x337afd,_0x13c9('0x114'));_0x20676b(_0x35d9f2);});});};Preview[_0x13c9('0xa')][_0x13c9('0x1b')]=function(_0x212850){if(this[_0x13c9('0x11')][_0x212850[_0x13c9('0x9d')]]){this[_0x13c9('0x11')][_0x212850[_0x13c9('0x9d')]][_0x13c9('0x6f')]=_0x212850[_0x13c9('0x6f')];}};Preview['prototype'][_0x13c9('0x115')]=function(_0x276b6a){var _0x4c346e=this;var _0x2093ec=this['actions'][_0x276b6a[_0x13c9('0x116')]];if(_0x2093ec){if(_0x2093ec[_0x13c9('0xe0')]&&this['agents'][_0x2093ec['lookAgent']]){ut[_0x13c9('0x117')](_0x2093ec,this['agents'][_0x2093ec[_0x13c9('0xe0')]][_0x13c9('0x24')],this[_0x13c9('0x12')][_0x2093ec[_0x13c9('0xe0')]]['id']);}var _0xc1e80a=_[_0x13c9('0x118')](_0x2093ec);_0xc1e80a[_0x13c9('0xa0')]=moment()['format'](_0x13c9('0x9f'));var _0xa21d86=_0x4c346e[_0x13c9('0xe')][_0x2093ec['queue']];if(ut['isFailure'](_0x276b6a[_0x13c9('0x119')])){if(_0x2093ec[_0x13c9('0xbb')]){rpcDb[_0x13c9('0xf2')](_0x2093ec['idContact']);}if(_0x2093ec[_0x13c9('0xbc')]){rpcDb[_0x13c9('0xc4')](_0x2093ec[_0x13c9('0xc3')]);}ami[_0x13c9('0x21')](_0x13c9('0x11a'),ut[_0x13c9('0xa8')](_0x2093ec,'rejected'));this[_0x13c9('0x11b')](_0xc1e80a,_0xa21d86,_0x276b6a);}else{_0x2093ec[_0x13c9('0x84')]=moment()['format'](_0x13c9('0x9f'));ut[_0x13c9('0xd0')](_0xc1e80a,0x4,_0x13c9('0xab'));rpcDb[_0x13c9('0xd1')](_0xc1e80a,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x247219){var _0x5b2d15=this;var _0x10f5be=this['actions'][_0x247219[_0x13c9('0x9d')]];var _0x1822cb;if(_0x10f5be){_0x1822cb=this['campaignsPreview'][_0x10f5be[_0x13c9('0x65')]];logger[_0x13c9('0xcb')](_0x13c9('0x11c'),_0x247219[_0x13c9('0x9d')],_0x13c9('0xa3'),_0x1822cb[_0x13c9('0x24')],_0x13c9('0x68'),_0x1822cb[_0x13c9('0x29')]);}if(this[_0x13c9('0x11')][_0x247219['linkedid']]&&_0x247219[_0x13c9('0x9d')]!==_0x247219['uniqueid']){if(_0x247219[_0x13c9('0x11d')]==='16'&&this[_0x13c9('0x11')][_0x247219['linkedid']][_0x13c9('0x73')]){this[_0x13c9('0x95')](_0x247219,_0x247219[_0x13c9('0x9d')],_0x247219[_0x13c9('0x11d')]);}else if(this[_0x13c9('0x11')][_0x247219[_0x13c9('0x9d')]][_0x13c9('0x73')]){logger['info'](_0x13c9('0x11e'),_0x247219['linkedid'],_0x247219[_0x13c9('0x11d')],'\x20Queue',_0x1822cb['name'],_0x13c9('0x68'),_0x1822cb[_0x13c9('0x29')]);this[_0x13c9('0x95')](_0x247219,_0x247219['linkedid'],_0x247219[_0x13c9('0x11d')]);}}else if(_0x10f5be&&_['isNil'](_0x10f5be['statedesc'])&&_0x1822cb[_0x13c9('0x11f')]&&_0x247219['linkedid']===_0x247219[_0x13c9('0xa2')]&&_[_0x13c9('0x62')](_0x247219[_0x13c9('0xda')])&&_0x247219[_0x13c9('0x11d')]==='16'&&_0x247219[_0x13c9('0x120')]==='6'&&_[_0x13c9('0xce')](_0x10f5be['transfer'])){if(_0x10f5be[_0x13c9('0xbb')]){rpcDb['unlockContact'](_0x10f5be[_0x13c9('0xc3')]);}if(_0x10f5be[_0x13c9('0xbc')]){rpcDb['disableContact'](_0x10f5be['idContact']);}_0x247219[_0x13c9('0xda')]='22';this[_0x13c9('0x11b')](_0x10f5be,_0x1822cb,_0x247219);}else if(_0x10f5be&&_0x10f5be['transfer']){if(_0x247219[_0x13c9('0x11d')]==='16'&&this['actions'][_0x247219[_0x13c9('0x9d')]][_0x13c9('0x73')]){logger[_0x13c9('0xcb')](_0x13c9('0x121'),_0x247219[_0x13c9('0x9d')],_0x247219[_0x13c9('0x11d')],_0x13c9('0xa3'),_0x1822cb['name'],_0x13c9('0x68'),_0x1822cb[_0x13c9('0x29')]);this['callProgressDetectingCustomer'](_0x247219,_0x247219[_0x13c9('0x9d')],_0x247219['cause']);}else if(this[_0x13c9('0x11')][_0x247219[_0x13c9('0x9d')]]['dialAnswer']){logger['info'](_0x13c9('0x11e'),_0x247219[_0x13c9('0x9d')],_0x247219[_0x13c9('0x11d')],_0x13c9('0xa3'),_0x1822cb[_0x13c9('0x24')],_0x13c9('0x68'),_0x1822cb[_0x13c9('0x29')]);this[_0x13c9('0x95')](_0x247219,_0x247219[_0x13c9('0x9d')],_0x247219['cause']);}}};Preview[_0x13c9('0xa')][_0x13c9('0x1a')]=function(_0x4b4e29){if(this[_0x13c9('0x11')][_0x4b4e29[_0x13c9('0xcd')]]&&_0x4b4e29[_0x13c9('0xcd')]!==_0x4b4e29[_0x13c9('0x122')]){this[_0x13c9('0x95')](_0x4b4e29,_0x4b4e29[_0x13c9('0xcd')],_0x4b4e29[_0x13c9('0xc7')]);}};Preview['prototype'][_0x13c9('0x18')]=function(_0x52ce0f){if(this[_0x13c9('0x11')][_0x52ce0f['linkedid']]&&_0x52ce0f['linkedid']!==_0x52ce0f[_0x13c9('0xa2')]&&!this[_0x13c9('0x11')][_0x52ce0f['linkedid']][_0x13c9('0x73')]){if(_0x52ce0f['cause']==='1'){this[_0x13c9('0x95')](_0x52ce0f,_0x52ce0f[_0x13c9('0x9d')],_0x52ce0f[_0x13c9('0x11d')]);}}};Preview['prototype']['addVariable']=function(_0x4a3f22,_0xe62323,_0x25fc3f){if(this[_0x13c9('0x11')][_0x4a3f22]){if(_['isNil'](this[_0x13c9('0x11')][_0x4a3f22][_0x13c9('0x123')])){this['actions'][_0x4a3f22][_0x13c9('0x123')]={};}this[_0x13c9('0x11')][_0x4a3f22][_0x13c9('0x123')][_0xe62323]=_0x25fc3f;}};Preview[_0x13c9('0xa')][_0x13c9('0x1d')]=function(_0x3f5984){try{if(!_[_0x13c9('0x62')](_0x3f5984)){if(ut['filterKey'](_[_0x13c9('0x124')](_0x3f5984[_0x13c9('0x125')])[0x0])){this[_0x13c9('0x126')](_0x3f5984[_0x13c9('0xa2')],_['keys'](_0x3f5984[_0x13c9('0x125')])[0x0],_0x3f5984[_0x13c9('0x127')]);}}}catch(_0x42cae3){logger[_0x13c9('0x128')]('[syncVarSet][Preview]',util['inspect'](_0x42cae3,{'showHidden':![],'depth':null}));}};Preview[_0x13c9('0xa')]['syncAttendedTransfer']=function(_0x12609e){if(_0x12609e){if(this[_0x13c9('0x11')][_0x12609e[_0x13c9('0x129')]]){this['actions'][_0x12609e[_0x13c9('0x129')]][_0x13c9('0x12a')]=!![];}}};Preview[_0x13c9('0xa')][_0x13c9('0x12b')]=function(_0x1e4f9b){if(_0x1e4f9b){if(this[_0x13c9('0x11')][_0x1e4f9b[_0x13c9('0x12c')]]){this[_0x13c9('0x11')][_0x1e4f9b['transfererlinkedid']][_0x13c9('0x12a')]=!![];}}};module[_0x13c9('0x12d')]=Preview;
\ No newline at end of file
+var _0xf739=['dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','dialActive','setMessage','recallMe','clearZombieChannel','isNil','info','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','then','length','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','format','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','linkedid','countbusyretry','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','uniqueid','ANSWER','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','isEmpty','execCall','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','execRun','unlock','disableContact','getContactPreview','recallme','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','Agent','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','lookAgent','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','transfertargetlinkedid','transfererlinkedid','util','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x17d27e,_0x35f4b1){var _0x3b0fa6=function(_0x4d267d){while(--_0x4d267d){_0x17d27e['push'](_0x17d27e['shift']());}};_0x3b0fa6(++_0x35f4b1);}(_0xf739,0xf7));var _0x9f73=function(_0x5ccb02,_0x3588fb){_0x5ccb02=_0x5ccb02-0x0;var _0x52a833=_0xf739[_0x5ccb02];return _0x52a833;};'use strict';var util=require(_0x9f73('0x0'));var _=require(_0x9f73('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x9f73('0x2'));var md5=require(_0x9f73('0x3'));var Redis=require(_0x9f73('0x4'));var config=require(_0x9f73('0x5'));var logger=require(_0x9f73('0x6'))(_0x9f73('0x7'));var loggerAction=require(_0x9f73('0x6'))(_0x9f73('0x8'));var ami=require(_0x9f73('0x9'));var rpcDb=require(_0x9f73('0xa'));var Action=require('./action');var ut=require(_0x9f73('0xb'));config[_0x9f73('0xc')]=_[_0x9f73('0xd')](config['redis'],{'host':_0x9f73('0xe'),'port':0x18eb});var io=require(_0x9f73('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x9f73('0x10')][_0x9f73('0x11')]=function(_0x2fb325){this[_0x9f73('0x12')]=this[_0x9f73('0x12')]?this['tail'][_0x9f73('0x13')](_0x2fb325):_0x2fb325();};function Preview(_0xaead31){this[_0x9f73('0x14')]=new Sequence();this[_0x9f73('0x15')]=_0xaead31[_0x9f73('0x16')];this[_0x9f73('0x17')]=_0xaead31[_0x9f73('0x17')];this[_0x9f73('0x18')]={};this[_0x9f73('0x19')]=_0xaead31[_0x9f73('0x19')];this[_0x9f73('0x1a')]=0x0;ami['on'](_0x9f73('0x1b'),this[_0x9f73('0x1c')][_0x9f73('0x1d')](this));ami['on'](_0x9f73('0x1e'),this[_0x9f73('0x1f')][_0x9f73('0x1d')](this));ami['on'](_0x9f73('0x20'),this[_0x9f73('0x21')][_0x9f73('0x1d')](this));ami['on'](_0x9f73('0x22'),this[_0x9f73('0x23')][_0x9f73('0x1d')](this));ami['on'](_0x9f73('0x24'),this[_0x9f73('0x25')][_0x9f73('0x1d')](this));ami['on'](_0x9f73('0x26'),this[_0x9f73('0x27')][_0x9f73('0x1d')](this));ami['on'](_0x9f73('0x28'),this[_0x9f73('0x29')][_0x9f73('0x1d')](this));ami['on']('blindtransfer',this[_0x9f73('0x2a')][_0x9f73('0x1d')](this));this['loopCampaigns'](this[_0x9f73('0x15')]);}function emit(_0x494ec6,_0x45a85f,_0x4fb71f){io['to'](_0x494ec6)[_0x9f73('0x2b')](_0x45a85f,_0x4fb71f);}function emitCampaignPreview(_0x3a1d3c){if(_0x3a1d3c[_0x9f73('0x2c')]===_0x9f73('0x2d')){var _0x37fd43={'id':_0x3a1d3c['id'],'name':_0x3a1d3c[_0x9f73('0x2e')],'strategy':_0x3a1d3c[_0x9f73('0x2f')],'answered':_0x3a1d3c[_0x9f73('0x30')],'available':_0x3a1d3c[_0x9f73('0x31')],'loggedIn':_0x3a1d3c[_0x9f73('0x32')],'pTalking':_0x3a1d3c[_0x9f73('0x33')],'sumBillable':_0x3a1d3c['sumBillable'],'sumDuration':_0x3a1d3c[_0x9f73('0x34')],'sumHoldTime':_0x3a1d3c[_0x9f73('0x35')]||0x0,'talking':_0x3a1d3c[_0x9f73('0x36')],'total':_0x3a1d3c[_0x9f73('0x37')],'type':_0x3a1d3c[_0x9f73('0x2c')],'unmanaged':_0x3a1d3c[_0x9f73('0x38')],'abandoned':_0x3a1d3c[_0x9f73('0x39')],'waiting':_0x3a1d3c['waiting'],'loggedInDb':_0x3a1d3c[_0x9f73('0x3a')],'dialActive':_0x3a1d3c['dialActive'],'dialMethod':_0x3a1d3c[_0x9f73('0x3b')],'dialOriginateCallerIdName':_0x3a1d3c[_0x9f73('0x3c')],'dialOriginateCallerIdNumber':_0x3a1d3c[_0x9f73('0x3d')],'dialOriginateTimeout':_0x3a1d3c[_0x9f73('0x3e')],'dialPrefix':_0x3a1d3c[_0x9f73('0x3f')],'outboundAnswerAgiCallsDay':_0x3a1d3c[_0x9f73('0x40')],'outboundAnswerCallsDay':_0x3a1d3c[_0x9f73('0x41')],'outboundBlacklistCallsDay':_0x3a1d3c[_0x9f73('0x42')],'outboundBusyCallsDay':_0x3a1d3c[_0x9f73('0x43')],'outboundCongestionCallsDay':_0x3a1d3c[_0x9f73('0x44')],'outboundDropCallsDayACS':_0x3a1d3c[_0x9f73('0x45')],'outboundDropCallsDayCallersExit':_0x3a1d3c['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3a1d3c[_0x9f73('0x46')],'outboundNoAnswerCallsDay':_0x3a1d3c[_0x9f73('0x47')],'outboundNoSuchCallsDay':_0x3a1d3c[_0x9f73('0x48')],'outboundOriginateFailureCallsDay':_0x3a1d3c[_0x9f73('0x49')],'outboundReCallsDay':_0x3a1d3c['outboundReCallsDay'],'outboundRejectCallsDay':_0x3a1d3c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3a1d3c[_0x9f73('0x4a')],'predictiveIntervalAnsweredCalls':_0x3a1d3c[_0x9f73('0x4b')],'predictiveIntervalAvgHoldtime':_0x3a1d3c[_0x9f73('0x4c')],'predictiveIntervalAvgTalktime':_0x3a1d3c['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3a1d3c[_0x9f73('0x4d')],'predictiveIntervalDroppedCallsTimeout':_0x3a1d3c[_0x9f73('0x4e')],'predictiveIntervalErlangCalls':_0x3a1d3c[_0x9f73('0x4f')],'predictiveIntervalErlangCallsDroppedCalls':_0x3a1d3c[_0x9f73('0x50')],'predictiveIntervalHitRate':_0x3a1d3c[_0x9f73('0x51')],'predictiveIntervalMultiplicativeFactor':_0x3a1d3c[_0x9f73('0x52')],'predictiveIntervalPauses':_0x3a1d3c['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3a1d3c[_0x9f73('0x53')],'predictiveIntervalTotalCalls':_0x3a1d3c[_0x9f73('0x54')],'message':_0x3a1d3c[_0x9f73('0x55')],'originated':_0x3a1d3c['originated'],'erlangCalls':_0x3a1d3c['erlangCalls'],'erlangCallToSecond':_0x3a1d3c[_0x9f73('0x56')],'erlangAbandonmentRate':_0x3a1d3c['erlangAbandonmentRate'],'erlangBusyFactor':_0x3a1d3c['erlangBusyFactor'],'startPredictive':_0x3a1d3c['startPredictive'],'startProgressive':_0x3a1d3c[_0x9f73('0x57')]};if(_0x3a1d3c[_0x9f73('0x58')]){_0x37fd43[_0x9f73('0x58')]={'id':_0x3a1d3c['Trunk']['id'],'name':_0x3a1d3c[_0x9f73('0x58')][_0x9f73('0x2e')],'active':_0x3a1d3c['Trunk'][_0x9f73('0x59')],'callerid':_0x3a1d3c[_0x9f73('0x58')][_0x9f73('0x5a')]};}if(_0x3a1d3c[_0x9f73('0x5b')]){_0x37fd43[_0x9f73('0x5b')]={'id':_0x3a1d3c[_0x9f73('0x5b')]['id'],'name':_0x3a1d3c[_0x9f73('0x5b')][_0x9f73('0x2e')]};}var _0x1ca216=md5(JSON[_0x9f73('0x5c')](_0x37fd43));if(_0x3a1d3c[_0x9f73('0x3')]!==_0x1ca216){_0x3a1d3c[_0x9f73('0x3')]=_0x1ca216;emit(util['format'](_0x9f73('0x5d'),_0x37fd43[_0x9f73('0x2e')]),'voice_queue:save',_0x37fd43);}}}function emitVoiceQueueChannelRemove(_0x43d1e7){emit(util['format'](_0x9f73('0x5d'),_0x43d1e7[_0x9f73('0x2e')]),_0x9f73('0x5e'),_0x43d1e7);}function notSendMessagesQueue(_0x21bb3e){if(_0x21bb3e[_0x9f73('0x5f')]){if(_0x21bb3e[_0x9f73('0x60')]===0x0&&_0x21bb3e[_0x9f73('0x33')]===0x0){_0x21bb3e[_0x9f73('0x5f')]=![];_0x21bb3e[_0x9f73('0x31')]=0x0;_0x21bb3e[_0x9f73('0x61')]=0x0;_0x21bb3e[_0x9f73('0x55')]=_0x9f73('0x62');ut[_0x9f73('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x21bb3e['name']+_0x9f73('0x64'));}else{_0x21bb3e[_0x9f73('0x55')]=_0x9f73('0x65');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x21bb3e[_0x9f73('0x2e')]+_0x9f73('0x66'));}emitCampaignPreview(_0x21bb3e);}}Preview[_0x9f73('0x10')][_0x9f73('0x67')]=function(){var _0x4fa020=this;setInterval(function(){_0x4fa020[_0x9f73('0x68')]();},0x7cf);};Preview[_0x9f73('0x10')][_0x9f73('0x68')]=function(){var _0x233401=this[_0x9f73('0x15')];this['clockClearZombieChannels']+=0x1;for(var _0x58ee70 in _0x233401){if(_0x233401[_0x9f73('0x69')](_0x58ee70)&&(_0x233401[_0x58ee70][_0x9f73('0x3b')]===_0x9f73('0x7')||_0x233401[_0x58ee70][_0x9f73('0x3b')]===_0x9f73('0x6a'))&&_0x233401[_0x58ee70][_0x9f73('0x2c')]==='outbound'){if(this[_0x9f73('0x1a')]>0x7){this[_0x9f73('0x1a')]=0x0;this['clearZombieChannels']();}}if(_0x233401[_0x9f73('0x69')](_0x58ee70)&&_0x233401[_0x58ee70][_0x9f73('0x3b')]==='preview'&&_0x233401[_0x58ee70][_0x9f73('0x2c')]===_0x9f73('0x2d')){if(_0x233401[_0x58ee70][_0x9f73('0x6b')]){this[_0x9f73('0x6c')](_0x233401[_0x58ee70]);this[_0x9f73('0x6d')](_0x233401[_0x58ee70]);}else{notSendMessagesQueue(_0x233401[_0x58ee70]);}}}};Preview['prototype'][_0x9f73('0x6e')]=function(_0x18e21b){var _0x2a1e6a=this;this[_0x9f73('0x14')][_0x9f73('0x11')](function(){if(!_[_0x9f73('0x6f')](_0x2a1e6a['actions'][_0x18e21b])){loggerAction[_0x9f73('0x70')]('[clearZombieChannels][talking]',_0x18e21b,_0x9f73('0x71'),_0x2a1e6a[_0x9f73('0x18')][_0x18e21b]['queue'],_0x9f73('0x72'),JSON[_0x9f73('0x5c')](_0x2a1e6a[_0x9f73('0x15')][_0x2a1e6a[_0x9f73('0x18')][_0x18e21b][_0x9f73('0x73')]]['originated']),_0x9f73('0x74'),JSON[_0x9f73('0x5c')](_0x2a1e6a[_0x9f73('0x15')][_0x2a1e6a[_0x9f73('0x18')][_0x18e21b][_0x9f73('0x73')]]['pTalking']),JSON[_0x9f73('0x5c')](_0x2a1e6a[_0x9f73('0x18')][_0x18e21b][_0x9f73('0x75')]),JSON[_0x9f73('0x5c')](_[_0x9f73('0x76')](_0x2a1e6a[_0x9f73('0x18')][_0x18e21b],[_0x9f73('0x77'),'UserId',_0x9f73('0x78'),_0x9f73('0x79')])));return ami['Action']({'action':_0x9f73('0x7a'),'channel':_0x2a1e6a[_0x9f73('0x18')][_0x18e21b]['channel']})[_0x9f73('0x7b')](function(_0x16d6f8){if(_0x16d6f8[_0x9f73('0x55')]===_0x9f73('0x7c')){setTimeout(function(){if(_0x2a1e6a[_0x9f73('0x18')][_0x18e21b]){ut[_0x9f73('0x7d')](_0x2a1e6a[_0x9f73('0x15')][_0x2a1e6a[_0x9f73('0x18')][_0x18e21b][_0x9f73('0x73')]],_0x9f73('0x7e'));if(_0x2a1e6a[_0x9f73('0x18')][_0x18e21b]['dialAnswer']===!![]){ut[_0x9f73('0x7f')](_0x2a1e6a[_0x9f73('0x15')][_0x2a1e6a[_0x9f73('0x18')][_0x18e21b][_0x9f73('0x73')]],'[clearZombieChannel]');ut['loggerError'](_0x9f73('0x80')+_0x18e21b,_0x2a1e6a['actions'][_0x18e21b][_0x9f73('0x73')]);}ut[_0x9f73('0x81')](_0x9f73('0x82')+_0x18e21b,_0x2a1e6a[_0x9f73('0x18')][_0x18e21b]['queue']);delete _0x2a1e6a[_0x9f73('0x18')][_0x18e21b];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x1074fa=this;loggerAction[_0x9f73('0x70')](_0x9f73('0x83'),_[_0x9f73('0x84')](this[_0x9f73('0x18')]));for(var _0x16caab in this['actions']){if(_0x1074fa[_0x9f73('0x18')]['hasOwnProperty'](_0x16caab)){_0x1074fa[_0x9f73('0x6e')](_0x16caab);}}};Preview[_0x9f73('0x10')]['recallMe']=function(_0x2fb158){var _0x31d803=this;rpcDb['getContactRecallMe'](_0x2fb158['id'],ut['agentReadyId'](this[_0x9f73('0x19')]))[_0x9f73('0x85')](function(_0x132db1){if(!_[_0x9f73('0x6f')](_0x132db1)){for(var _0x419f36=0x0;_0x419f36<_0x132db1[_0x9f73('0x86')];_0x419f36+=0x1){if(ut['getDiff'](_0x132db1[_0x419f36]['scheduledat'])<_0x2fb158[_0x9f73('0x87')]*0x3c){_0x31d803[_0x9f73('0x88')](_0x132db1[_0x419f36]['id'])[_0x9f73('0x85')](ut[_0x9f73('0x89')](_0x9f73('0x8a')))['catch'](ut[_0x9f73('0x89')](_0x9f73('0x8a')));}else{var _0x3d67dc=new Action(_0x132db1[_0x419f36],_0x2fb158);_0x3d67dc[_0x9f73('0x8b')]=moment()['format'](_0x9f73('0x8c'));_0x2fb158['outboundReCallsDay']+=0x1;ut[_0x9f73('0x8d')](_0x3d67dc,0x17,_0x9f73('0x8e'));if(_0x2fb158[_0x9f73('0x8f')]){rpcDb[_0x9f73('0x90')](ut[_0x9f73('0x91')](_0x132db1[_0x419f36]));rpcDb[_0x9f73('0x92')](_0x3d67dc,_0x9f73('0x93'));}else{ut[_0x9f73('0x8d')](_0x3d67dc,0x16,_0x9f73('0x94'));rpcDb[_0x9f73('0x92')](_0x3d67dc,_0x9f73('0x95'));rpcDb[_0x9f73('0x96')](_0x3d67dc,_0x9f73('0x95'));}}}}})[_0x9f73('0x7b')](ut[_0x9f73('0x89')](_0x9f73('0x97')));};Preview[_0x9f73('0x10')][_0x9f73('0x6c')]=function(_0x4326d2){_0x4326d2['sendMessageOneNotActive']=!![];if(ut[_0x9f73('0x98')](_0x4326d2[_0x9f73('0x32')])){_0x4326d2['message']=_0x9f73('0x99');}else if(!ut[_0x9f73('0x9a')](_0x4326d2[_0x9f73('0x6b')])){_0x4326d2[_0x9f73('0x55')]='NOT_ACTIVE';}else if(!this[_0x9f73('0x9b')](_0x4326d2[_0x9f73('0x58')])){if(!this['isTrunkReachable'](_0x4326d2[_0x9f73('0x9c')])){_0x4326d2[_0x9f73('0x55')]=_0x9f73('0x9d');}else{_0x4326d2['message']='ACTIVE';}}else{_0x4326d2[_0x9f73('0x55')]=_0x9f73('0x9e');}emitCampaignPreview(_0x4326d2);};Preview[_0x9f73('0x10')][_0x9f73('0x9f')]=function(_0x2684b4,_0xb042be,_0x123bbf){var _0x17b955=this;var _0x304e16=this[_0x9f73('0x18')][_0xb042be];var _0x4a8f74=this[_0x9f73('0x15')][_0x304e16['queue']];var _0x3c620b;if(_0x4a8f74){switch(_0x123bbf){case'1':_0x4a8f74[_0x9f73('0x48')]+=0x1;_0x304e16[_0x9f73('0xa0')]=ut[_0x9f73('0xa1')](_0x304e16);ut[_0x9f73('0x8d')](_0x304e16,0x0,_0x9f73('0xa2'));rpcDb['createCustomerHistory'](_0x304e16,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x9f73('0xa1')](_0x304e16)>=_0x4a8f74[_0x9f73('0xa3')]){_0x3c620b=ut['cloneAction'](_0x304e16,0xf,_0x9f73('0xa4'));rpcDb[_0x9f73('0x96')](_0x3c620b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x9f73('0x96')](_0x304e16,_0x9f73('0xa5'));}delete this[_0x9f73('0x18')][_0x2684b4['linkedid']];break;case'ANSWER':var _0xcc652f=moment()[_0x9f73('0xa6')](_0x9f73('0x8c'));_0x304e16[_0x9f73('0xa7')]=_0xcc652f;_0x304e16['answertime']=_0xcc652f;_0x304e16[_0x9f73('0x75')]=!![];_0x4a8f74['pTalking']+=0x1;logger[_0x9f73('0x70')](_0x9f73('0xa8'),_0x304e16['uniqueid'],_0x9f73('0xa9'),_0x4a8f74['name'],_0x9f73('0x74'),_0x4a8f74[_0x9f73('0x33')]);ami['emit'](_0x9f73('0xaa'),ut[_0x9f73('0xab')](_0x304e16,_0x9f73('0xac')));if(_0x4a8f74[_0x9f73('0xad')]){ami['emit']('custom:agentConnectPreview',ut[_0x9f73('0xae')](_0x304e16));}break;case'16':ami[_0x9f73('0x2b')](_0x9f73('0xaf'),ut[_0x9f73('0xab')](_0x304e16,_0x9f73('0xb0')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x304e16,'complete'));_0x4a8f74[_0x9f73('0x41')]+=0x1;_0x4a8f74[_0x9f73('0x37')]+=0x1;_0x4a8f74[_0x9f73('0x30')]+=0x1;ut[_0x9f73('0x7f')](_0x4a8f74,_0x9f73('0xb1'));_0x304e16[_0x9f73('0xa0')]=ut['totalGlobal'](_0x304e16);ut[_0x9f73('0x8d')](_0x304e16,0x4,_0x9f73('0xb2'));rpcDb[_0x9f73('0x92')](_0x304e16,_0x9f73('0xb3'));rpcDb[_0x9f73('0x96')](_0x304e16,_0x9f73('0xb4'));rpcDb[_0x9f73('0xb5')](_0x304e16);_0x4a8f74['sumDuration']+=_0x304e16[_0x9f73('0xb6')];_0x4a8f74[_0x9f73('0xb7')]+=_0x304e16[_0x9f73('0xb6')];logger[_0x9f73('0x70')]('[syncHangup][talking][decrement]',_0x304e16['uniqueid'],_0x9f73('0xa9'),_0x4a8f74[_0x9f73('0x2e')],_0x9f73('0x74'),_0x4a8f74['pTalking']);delete this[_0x9f73('0x18')][_0x2684b4[_0x9f73('0xb8')]];break;case'BUSY':_0x4a8f74[_0x9f73('0x43')]+=0x1;_0x304e16[_0x9f73('0xb9')]+=0x1;_0x304e16[_0x9f73('0xa0')]=ut[_0x9f73('0xa1')](_0x304e16);ut[_0x9f73('0x8d')](_0x304e16,0x5,'Busy');rpcDb['createCustomerHistory'](_0x304e16,_0x9f73('0xba'));if(ut['totalGlobal'](_0x304e16)>=_0x4a8f74[_0x9f73('0xa3')]){_0x3c620b=ut[_0x9f73('0xbb')](_0x304e16,0xf,_0x9f73('0xa4'));rpcDb['createCustomerFinal'](_0x3c620b,_0x9f73('0xbc'));}else{if(_0x304e16['countbusyretry']>=_0x4a8f74[_0x9f73('0xbd')]){rpcDb['createCustomerFinal'](_0x304e16,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x9f73('0xbe')](ut[_0x9f73('0xbf')](_0x304e16,_0x9f73('0xb9'),_0x4a8f74[_0x9f73('0xc0')]),_0x304e16[_0x9f73('0xc1')],_0x304e16[_0x9f73('0xc2')]);}}break;case _0x9f73('0xc3'):_0x4a8f74[_0x9f73('0x47')]+=0x1;_0x304e16['countnoanswerretry']+=0x1;_0x304e16[_0x9f73('0xa0')]=ut[_0x9f73('0xa1')](_0x304e16);ut[_0x9f73('0x8d')](_0x304e16,0x3,_0x9f73('0xc4'));rpcDb[_0x9f73('0x92')](_0x304e16,_0x9f73('0xc5'));if(ut['totalGlobal'](_0x304e16)>=_0x4a8f74[_0x9f73('0xa3')]){_0x3c620b=ut[_0x9f73('0xbb')](_0x304e16,0xf,_0x9f73('0xa4'));rpcDb['createCustomerFinal'](_0x3c620b,_0x9f73('0xc6'));}else{if(_0x304e16[_0x9f73('0xc7')]>=_0x4a8f74[_0x9f73('0xc8')]){rpcDb[_0x9f73('0x96')](_0x304e16,_0x9f73('0xc5'));}else{rpcDb['rescheduleContact'](ut[_0x9f73('0xbf')](_0x304e16,_0x9f73('0xc7'),_0x4a8f74[_0x9f73('0xc9')]),_0x304e16[_0x9f73('0xc1')],_0x304e16[_0x9f73('0xc2')]);}}break;case'CONGESTION':_0x4a8f74['outboundCongestionCallsDay']+=0x1;_0x304e16[_0x9f73('0xca')]+=0x1;_0x304e16[_0x9f73('0xa0')]=ut[_0x9f73('0xa1')](_0x304e16);ut[_0x9f73('0x8d')](_0x304e16,0x8,_0x9f73('0xcb'));rpcDb[_0x9f73('0x92')](_0x304e16,_0x9f73('0xcc'));if(ut[_0x9f73('0xa1')](_0x304e16)>=_0x4a8f74[_0x9f73('0xa3')]){_0x3c620b=ut[_0x9f73('0xbb')](_0x304e16,0xf,'Global');rpcDb[_0x9f73('0x96')](_0x3c620b,_0x9f73('0xcd'));}else{if(_0x304e16['countcongestionretry']>=_0x4a8f74['dialCongestionMaxRetry']){rpcDb[_0x9f73('0x96')](_0x304e16,_0x9f73('0xcc'));}else{rpcDb[_0x9f73('0xbe')](ut['scheduledAt'](_0x304e16,_0x9f73('0xca'),_0x4a8f74[_0x9f73('0xc0')]),_0x304e16[_0x9f73('0xc1')],_0x304e16['activeContact']);}}break;case _0x9f73('0xce'):_0x4a8f74[_0x9f73('0xcf')]+=0x1;_0x304e16[_0x9f73('0xa0')]=ut['totalGlobal'](_0x304e16);ut[_0x9f73('0x8d')](_0x304e16,0x14,_0x9f73('0xd0'));rpcDb[_0x9f73('0x92')](_0x304e16,_0x9f73('0xd1'));if(_0x304e16['unlockAgent']){rpcDb[_0x9f73('0xd2')](_0x304e16['idContact']);}if(_0x304e16[_0x9f73('0xc2')]){rpcDb['disableContact'](_0x304e16[_0x9f73('0xd3')]);}break;default:if(_0x304e16[_0x9f73('0x75')]){ut[_0x9f73('0x7f')](_0x4a8f74,_0x9f73('0xd4'));ut[_0x9f73('0x81')](_0x9f73('0xd5')+_0x4a8f74['name'],_0x2684b4);}_0x4a8f74[_0x9f73('0x4a')]+=0x1;_0x304e16[_0x9f73('0xa0')]=ut[_0x9f73('0xa1')](_0x304e16);ut[_0x9f73('0x8d')](_0x304e16,0xc,_0x2684b4['cause-txt']||_0x2684b4[_0x9f73('0xd6')]);rpcDb[_0x9f73('0x92')](_0x304e16,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x9f73('0xa1')](_0x304e16)>=_0x4a8f74[_0x9f73('0xa3')]){_0x3c620b=ut[_0x9f73('0xbb')](_0x304e16,0xf,_0x9f73('0xa4'));rpcDb[_0x9f73('0x96')](_0x3c620b,_0x9f73('0xd7'));}else{rpcDb['createCustomerFinal'](_0x304e16,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x2684b4[_0x9f73('0xb8')]];}if(!(_0x304e16[_0x9f73('0x75')]&&_0x123bbf==='16')){ut['updateOriginated'](_0x4a8f74,_0x9f73('0xd8'));logger[_0x9f73('0x70')]('[originated][decrement][callProgressDetectingCustomer]',_0x304e16[_0x9f73('0xd9')],_0x9f73('0xa9'),_0x4a8f74[_0x9f73('0x2e')],_0x9f73('0x72'),_0x4a8f74['originated']);}if(_0x123bbf!==_0x9f73('0xda')){delete this[_0x9f73('0x18')][_0x2684b4[_0x9f73('0xb8')]];delete this[_0x9f73('0x18')][_0x2684b4['destlinkedid']];}}};Preview[_0x9f73('0x10')]['callProgressDetectingAgent']=function(_0x2aeff4,_0x2fe43a,_0x5dcd97){if(_['isUndefined'](_0x2fe43a)&&_0x9f73('0xdb')!==typeof _0x2fe43a){return;}if(_[_0x9f73('0xdc')](_0x5dcd97)&&_0x9f73('0xdb')!==typeof _0x5dcd97){return;}switch(_0x5dcd97[_0x9f73('0xdd')]){case'0':ut[_0x9f73('0xde')](_0x2aeff4,0x0,_0x9f73('0xa2'));rpcDb[_0x9f73('0xdf')](_0x2aeff4,_0x9f73('0xe0'));break;case'3':ut[_0x9f73('0xde')](_0x2aeff4,0x3,_0x9f73('0xc4'));rpcDb['createAgentHistory'](_0x2aeff4,_0x9f73('0xe1'));break;case'5':ut[_0x9f73('0xde')](_0x2aeff4,0x5,_0x9f73('0xe2'));rpcDb[_0x9f73('0xdf')](_0x2aeff4,_0x9f73('0xe3'));break;case'8':ut[_0x9f73('0xde')](_0x2aeff4,0x8,_0x9f73('0xcb'));rpcDb[_0x9f73('0xdf')](_0x2aeff4,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x2aeff4,0x16,'AnswerAGI');rpcDb[_0x9f73('0xdf')](_0x2aeff4,_0x9f73('0xe4'));break;default:ut[_0x9f73('0xde')](_0x2aeff4,0xc,_0x5dcd97['reason']);rpcDb[_0x9f73('0xdf')](_0x2aeff4,_0x9f73('0xe5'));}ut[_0x9f73('0x7d')](_0x2fe43a,_0x9f73('0xe6'));logger['info'](_0x9f73('0xe7'),_0x2aeff4[_0x9f73('0xd9')],'\x20Queue',_0x2fe43a[_0x9f73('0x2e')],_0x9f73('0x72'),_0x2fe43a['originated']);delete this['actions'][_0x2aeff4[_0x9f73('0xd9')]];};Preview[_0x9f73('0x10')][_0x9f73('0xe8')]=function(_0x15a27b,_0x49b234,_0x42464f,_0xf88478,_0x57e846){var _0x114e58=this;return new BPromise(function(_0x107c77,_0x1bc0cc){if(_['isNil'](_0x49b234)||_[_0x9f73('0x6f')](_0x49b234[_0x9f73('0xe9')])||_[_0x9f73('0x6f')](_0x49b234['Contact'][_0x9f73('0xea')])||_['isNil'](_0x49b234['VoiceQueueId'])){_0x1bc0cc(ut[_0x9f73('0x55')]('Contact\x20is\x20undefined',_0xf88478,_0x57e846));return;}var _0x1cf6b6=uuid['v4']();var _0x4ab6a4=_0x114e58[_0x9f73('0x15')][_0x49b234[_0x9f73('0x71')]['name']];var _0x1dcfa4=_0x42464f?_0x114e58[_0x9f73('0x19')][_0x42464f]['id']:undefined;_0x114e58[_0x9f73('0x18')][_0x1cf6b6]=new Action(_0x49b234,_0x4ab6a4,_0x1cf6b6,_0x42464f,_0x1dcfa4);var _0x3ff5d6=_0x114e58[_0x9f73('0x18')][_0x1cf6b6];_0x3ff5d6[_0x9f73('0xc1')]=_0xf88478;_0x3ff5d6[_0x9f73('0xc2')]=_0x57e846;_0x3ff5d6['lookAgent']=_0x42464f;if(_[_0x9f73('0xeb')](_0x15a27b)){_0x114e58[_0x9f73('0xec')](_0x3ff5d6,_0x4ab6a4,_0x49b234,_0x42464f)[_0x9f73('0x85')](function(_0x41692c){logger[_0x9f73('0x70')]('[Preview][execCall][success]','Queue:\x20'+_0x3ff5d6['queue']+_0x9f73('0xed')+_0x3ff5d6['idContact'],JSON[_0x9f73('0x5c')](_0x41692c));ami[_0x9f73('0x2b')](_0x9f73('0xee'),ut[_0x9f73('0xab')](_0x3ff5d6,_0x9f73('0xef')));_0x107c77(ut[_0x9f73('0x55')](_0x9f73('0xf0')));})['catch'](function(_0x432262){ut['logger']('[Preview][execCall][failure]',_0x432262);_0x1bc0cc(ut[_0x9f73('0x55')](_0x9f73('0xf1'),_0xf88478,_0x57e846));});}else{_0x4ab6a4[_0x9f73('0x42')]+=0x1;ut[_0x9f73('0xf2')](_0x3ff5d6);rpcDb[_0x9f73('0xf3')](_0x3ff5d6,_0x9f73('0xf4'));delete _0x114e58[_0x9f73('0x18')][_0x1cf6b6];_0x1bc0cc(ut[_0x9f73('0x55')]('Contact\x20in\x20black\x20List',_0xf88478,_0x57e846));}});};Preview[_0x9f73('0x10')][_0x9f73('0x9b')]=function(_0x10293d){return!_[_0x9f73('0x6f')](_0x10293d)&&!_[_0x9f73('0x6f')](_0x10293d[_0x9f73('0x2e')])&&!_[_0x9f73('0x6f')](_0x10293d[_0x9f73('0x59')])&&_0x10293d[_0x9f73('0x59')]&&!_[_0x9f73('0x6f')](this[_0x9f73('0x17')][util['format'](_0x9f73('0xf5'),_0x10293d[_0x9f73('0x2e')])])&&!_[_0x9f73('0x6f')](this['trunks'][util[_0x9f73('0xa6')](_0x9f73('0xf5'),_0x10293d['name'])][_0x9f73('0x7a')])&&(this['trunks'][util[_0x9f73('0xa6')](_0x9f73('0xf5'),_0x10293d[_0x9f73('0x2e')])][_0x9f73('0x7a')]==='reachable'||this[_0x9f73('0x17')][util[_0x9f73('0xa6')]('SIP/%s',_0x10293d[_0x9f73('0x2e')])][_0x9f73('0x7a')]==='unmonitored');};Preview[_0x9f73('0x10')]['run']=function(_0x3bd60f,_0x46dd54){var _0x831b77=this;return new BPromise(function(_0x3e60ee,_0x552b83){_0x831b77[_0x9f73('0xf6')](_0x3bd60f,_0x46dd54)[_0x9f73('0x85')](function(_0x3e37ec){_0x3e60ee(_[_0x9f73('0x76')](_0x3e37ec,[_0x9f73('0x55')]));})[_0x9f73('0x7b')](function(_0x2d9731){if(_0x2d9731[_0x9f73('0xf7')]){rpcDb[_0x9f73('0xd2')](_0x3bd60f);}if(_0x2d9731[_0x9f73('0x59')]){rpcDb[_0x9f73('0xf8')](_0x3bd60f);}_0x552b83(_[_0x9f73('0x76')](_0x2d9731,[_0x9f73('0x55')]));});});};Preview[_0x9f73('0x10')]['execRun']=function(_0x42ba89,_0x2bd84f){var _0x268272=this;return new BPromise(function(_0x5e029b,_0x17b68c){var _0xa8a529,_0x34e221;rpcDb[_0x9f73('0xf9')](_0x42ba89)[_0x9f73('0x85')](function(_0x2226b2){if(!_[_0x9f73('0x6f')](_0x2226b2[0x0])){_0x34e221=_0x2226b2[0x0][_0x9f73('0xfa')]?![]:!![];_0xa8a529=_0x2226b2[0x0][_0x9f73('0xfa')]?!![]:![];_0xa8a529=_0x2bd84f?!![]:_0xa8a529;}var _0x4b44d9=_0x268272['validateContact'](_0x2226b2);if(_0x4b44d9['isValid']){rpcDb[_0x9f73('0xfb')](_[_0x9f73('0x76')](_0x2226b2[0x0],['VoiceQueueId',_0x9f73('0xfc')]))[_0x9f73('0x85')](function(_0x5db0af){_0x268272[_0x9f73('0xe8')](_0x5db0af,_0x2226b2[0x0],_0x2bd84f,_0x34e221,_0xa8a529)[_0x9f73('0x85')](function(_0x54d878){_0x5e029b(_0x54d878);})[_0x9f73('0x7b')](function(_0x3cf794){_0x17b68c(_0x3cf794);});})[_0x9f73('0x7b')](function(_0x11dacd){ut[_0x9f73('0x63')](_0x9f73('0xfd'),_0x11dacd);_0x17b68c(ut['message'](_0x9f73('0xfe'),_0x34e221,_0xa8a529));});}else{_0x17b68c(ut['message'](_0x4b44d9['message'],_0x34e221,_0xa8a529));}})[_0x9f73('0x7b')](function(_0x4a9731){ut['logger'](_0x9f73('0xff'),_0x4a9731);_0x17b68c(ut[_0x9f73('0x55')](_0x9f73('0xfe'),![],!![]));});});};Preview[_0x9f73('0x10')][_0x9f73('0x100')]=function(_0x4a9793){if(_[_0x9f73('0x6f')](_0x4a9793)||_[_0x9f73('0xeb')](_0x4a9793)||!_[_0x9f73('0x6f')](_0x4a9793[0x0][_0x9f73('0x101')])&&_[_0x9f73('0x6f')](_0x4a9793[0x0][_0x9f73('0x101')][_0x9f73('0x2e')])){ut[_0x9f73('0x63')](_0x9f73('0x102'),_0x4a9793);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5ac5b9=this['campaignsPreview'][_0x4a9793[0x0][_0x9f73('0x71')][_0x9f73('0x2e')]];_0x5ac5b9[_0x9f73('0x55')]=_0x9f73('0x9e');if(_[_0x9f73('0x6f')](_0x5ac5b9)){ut[_0x9f73('0x63')](_0x9f73('0x103'),_0x5ac5b9);return{'isValid':![],'message':_0x9f73('0x104')};}if(!this[_0x9f73('0x9b')](_0x5ac5b9[_0x9f73('0x58')])){ut[_0x9f73('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x9f73('0x105')+_0x5ac5b9[_0x9f73('0x2e')]+_0x9f73('0x106'));if(!this['isTrunkReachable'](_0x5ac5b9[_0x9f73('0x9c')])){ut[_0x9f73('0x63')](_0x9f73('0x107'),_0x5ac5b9[_0x9f73('0x2e')]+_0x9f73('0x108'));return{'isValid':![],'message':_0x9f73('0x109')};}}if(!ut[_0x9f73('0x9a')](_0x5ac5b9[_0x9f73('0x6b')])){ut[_0x9f73('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x5ac5b9[_0x9f73('0x2e')]+_0x9f73('0x10a'));return{'isValid':![],'message':_0x9f73('0x105')+_0x5ac5b9[_0x9f73('0x2e')]+_0x9f73('0x10a')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x9f73('0xec')]=function(_0x3d6d42,_0x39132d,_0x450fc2,_0x4d9833){var _0x5e7a67=this;return new BPromise(function(_0x196a69,_0x3eb370){var _0x375bfb=_0x3d6d42['uniqueid'];var _0x119f78=_0x5e7a67[_0x9f73('0x9b')](_0x39132d[_0x9f73('0x58')])?util[_0x9f73('0xa6')](_0x9f73('0x10b'),_0x39132d[_0x9f73('0x58')][_0x9f73('0x2e')],_['isNil'](_0x39132d[_0x9f73('0x3f')])?'':_0x39132d[_0x9f73('0x3f')][_0x9f73('0x10c')]()||'',_0x39132d[_0x9f73('0x10d')]>0x0?_0x450fc2['Contact'][_0x9f73('0xea')][_0x9f73('0x10e')](_0x39132d[_0x9f73('0x10d')]):_0x450fc2[_0x9f73('0xe9')][_0x9f73('0xea')]):util[_0x9f73('0xa6')](_0x9f73('0x10b'),_[_0x9f73('0x6f')](_0x39132d[_0x9f73('0x9c')])?_0x39132d[_0x9f73('0x58')]['name']:_0x39132d[_0x9f73('0x9c')]['name'],_[_0x9f73('0x6f')](_0x39132d[_0x9f73('0x3f')])?'':_0x39132d[_0x9f73('0x3f')][_0x9f73('0x10c')]()||'',_0x39132d[_0x9f73('0x10d')]>0x0?_0x450fc2[_0x9f73('0xe9')][_0x9f73('0xea')][_0x9f73('0x10e')](_0x39132d[_0x9f73('0x10d')]):_0x450fc2[_0x9f73('0xe9')][_0x9f73('0xea')]);var _0x34df42=_0x5e7a67['isTrunkReachable'](_0x39132d[_0x9f73('0x58')])?ut['getCallerId'](_0x39132d[_0x9f73('0x58')][_0x9f73('0x5a')],_0x39132d[_0x9f73('0x3c')],_0x39132d[_0x9f73('0x10f')]>0x0?ut['getCallerIdRandom'](_0x39132d[_0x9f73('0x3d')],_0x39132d['dialRandomLastDigitCallerIdNumber']):_0x39132d[_0x9f73('0x3d')]):ut[_0x9f73('0x110')](_[_0x9f73('0x6f')](_0x39132d[_0x9f73('0x9c')])?_0x39132d[_0x9f73('0x58')][_0x9f73('0x5a')]:_0x39132d[_0x9f73('0x9c')][_0x9f73('0x5a')],_0x39132d[_0x9f73('0x3c')],_0x39132d['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x9f73('0x111')](_0x39132d[_0x9f73('0x3d')],_0x39132d[_0x9f73('0x10f')]):_0x39132d[_0x9f73('0x3d')]);if(_0x34df42){_0x3d6d42['originatecalleridname']=ut[_0x9f73('0x112')](_0x34df42);_0x3d6d42[_0x9f73('0x113')]=ut['extractCalleridNumber'](_0x34df42);}var _0x22ad67=ut[_0x9f73('0x114')](_0x39132d,_0x450fc2,_0x119f78,_0x34df42,_0x375bfb,_0x3d6d42);_[_0x9f73('0x115')](_0x3d6d42,ut[_0x9f73('0x116')](_0x22ad67));_0x3d6d42[_0x9f73('0x8b')]=moment()[_0x9f73('0xa6')](_0x9f73('0x8c'));ami['Action'](ut[_0x9f73('0x117')](_0x3d6d42,_0x39132d,_0x22ad67,_0x3d6d42[_0x9f73('0xc2')],_0x4d9833))[_0x9f73('0x85')](function(_0x12e9e1){_0x39132d[_0x9f73('0x60')]+=0x1;logger[_0x9f73('0x70')](_0x9f73('0x118'),_0x375bfb,_0x9f73('0xa9'),_0x39132d[_0x9f73('0x2e')],_0x9f73('0x72'),_0x39132d[_0x9f73('0x60')]);_0x196a69(_0x12e9e1);})[_0x9f73('0x7b')](function(_0x552b45){ut[_0x9f73('0xde')](_0x3d6d42,0xe,_0x9f73('0x119'));rpcDb[_0x9f73('0xdf')](_0x3d6d42,_0x9f73('0x11a'));_0x3eb370(_0x552b45);});});};Preview[_0x9f73('0x10')][_0x9f73('0x25')]=function(_0x161f50){if(this[_0x9f73('0x18')][_0x161f50[_0x9f73('0xb8')]]){this[_0x9f73('0x18')][_0x161f50[_0x9f73('0xb8')]][_0x9f73('0x11b')]=_0x161f50[_0x9f73('0x11b')];}};Preview['prototype'][_0x9f73('0x1c')]=function(_0xced7be){var _0x5c88ea=this;var _0x450204=this[_0x9f73('0x18')][_0xced7be['actionid']];if(_0x450204){if(_0x450204['lookAgent']&&this[_0x9f73('0x19')][_0x450204[_0x9f73('0x11c')]]){ut['logLookAgent'](_0x450204,this[_0x9f73('0x19')][_0x450204['lookAgent']]['name'],this[_0x9f73('0x19')][_0x450204[_0x9f73('0x11c')]]['id']);}var _0x491806=_['clone'](_0x450204);_0x491806[_0x9f73('0xa7')]=moment()['format'](_0x9f73('0x8c'));var _0x435ab7=_0x5c88ea[_0x9f73('0x15')][_0x450204[_0x9f73('0x73')]];if(ut[_0x9f73('0x11d')](_0xced7be[_0x9f73('0x11e')])){if(_0x450204['unlockAgent']){rpcDb[_0x9f73('0xd2')](_0x450204[_0x9f73('0xd3')]);}if(_0x450204[_0x9f73('0xc2')]){rpcDb[_0x9f73('0xf8')](_0x450204['idContact']);}ami[_0x9f73('0x2b')](_0x9f73('0x11f'),ut[_0x9f73('0xab')](_0x450204,_0x9f73('0x120')));this[_0x9f73('0x121')](_0x491806,_0x435ab7,_0xced7be);}else{_0x450204[_0x9f73('0x8b')]=moment()[_0x9f73('0xa6')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x9f73('0xde')](_0x491806,0x4,_0x9f73('0xb2'));rpcDb[_0x9f73('0xdf')](_0x491806,_0x9f73('0x122'));}}};Preview['prototype'][_0x9f73('0x1f')]=function(_0x1f3a77){var _0x3af826=this;var _0x1a5db6=this[_0x9f73('0x18')][_0x1f3a77[_0x9f73('0xb8')]];var _0x2c552e;if(_0x1a5db6){_0x2c552e=this['campaignsPreview'][_0x1a5db6[_0x9f73('0x73')]];logger[_0x9f73('0x70')]('[syncHangup][talking]',_0x1f3a77[_0x9f73('0xb8')],_0x9f73('0xa9'),_0x2c552e['name'],_0x9f73('0x74'),_0x2c552e[_0x9f73('0x33')]);}if(this[_0x9f73('0x18')][_0x1f3a77[_0x9f73('0xb8')]]&&_0x1f3a77[_0x9f73('0xb8')]!==_0x1f3a77[_0x9f73('0xd9')]){if(_0x1f3a77[_0x9f73('0x123')]==='16'&&this[_0x9f73('0x18')][_0x1f3a77[_0x9f73('0xb8')]][_0x9f73('0x75')]){this[_0x9f73('0x9f')](_0x1f3a77,_0x1f3a77[_0x9f73('0xb8')],_0x1f3a77['cause']);}else if(this[_0x9f73('0x18')][_0x1f3a77[_0x9f73('0xb8')]][_0x9f73('0x75')]){logger[_0x9f73('0x70')](_0x9f73('0x124'),_0x1f3a77['linkedid'],_0x1f3a77['cause'],_0x9f73('0xa9'),_0x2c552e[_0x9f73('0x2e')],'pTalking:\x20',_0x2c552e[_0x9f73('0x33')]);this[_0x9f73('0x9f')](_0x1f3a77,_0x1f3a77[_0x9f73('0xb8')],_0x1f3a77['cause']);}}else if(_0x1a5db6&&_[_0x9f73('0x6f')](_0x1a5db6[_0x9f73('0x125')])&&_0x2c552e[_0x9f73('0x126')]&&_0x1f3a77['linkedid']===_0x1f3a77['uniqueid']&&_[_0x9f73('0x6f')](_0x1f3a77['reason'])&&_0x1f3a77[_0x9f73('0x123')]==='16'&&_0x1f3a77[_0x9f73('0x127')]==='6'&&_[_0x9f73('0xdc')](_0x1a5db6[_0x9f73('0x128')])){if(_0x1a5db6['unlockAgent']){rpcDb[_0x9f73('0xd2')](_0x1a5db6['idContact']);}if(_0x1a5db6[_0x9f73('0xc2')]){rpcDb[_0x9f73('0xf8')](_0x1a5db6[_0x9f73('0xd3')]);}_0x1f3a77[_0x9f73('0xdd')]='22';this[_0x9f73('0x121')](_0x1a5db6,_0x2c552e,_0x1f3a77);}else if(_0x1a5db6&&_0x1a5db6[_0x9f73('0x128')]){if(_0x1f3a77[_0x9f73('0x123')]==='16'&&this[_0x9f73('0x18')][_0x1f3a77[_0x9f73('0xb8')]][_0x9f73('0x75')]){logger['info'](_0x9f73('0x129'),_0x1f3a77[_0x9f73('0xb8')],_0x1f3a77[_0x9f73('0x123')],_0x9f73('0xa9'),_0x2c552e[_0x9f73('0x2e')],'pTalking:\x20',_0x2c552e['pTalking']);this[_0x9f73('0x9f')](_0x1f3a77,_0x1f3a77[_0x9f73('0xb8')],_0x1f3a77['cause']);}else if(this[_0x9f73('0x18')][_0x1f3a77['linkedid']][_0x9f73('0x75')]){logger['info'](_0x9f73('0x124'),_0x1f3a77[_0x9f73('0xb8')],_0x1f3a77[_0x9f73('0x123')],_0x9f73('0xa9'),_0x2c552e['name'],_0x9f73('0x74'),_0x2c552e[_0x9f73('0x33')]);this['callProgressDetectingCustomer'](_0x1f3a77,_0x1f3a77[_0x9f73('0xb8')],_0x1f3a77[_0x9f73('0x123')]);}}};Preview[_0x9f73('0x10')][_0x9f73('0x23')]=function(_0x5beeb2){if(this['actions'][_0x5beeb2[_0x9f73('0x12a')]]&&_0x5beeb2[_0x9f73('0x12a')]!==_0x5beeb2[_0x9f73('0x12b')]){this[_0x9f73('0x9f')](_0x5beeb2,_0x5beeb2[_0x9f73('0x12a')],_0x5beeb2[_0x9f73('0xd6')]);}};Preview[_0x9f73('0x10')][_0x9f73('0x21')]=function(_0x19f471){if(this[_0x9f73('0x18')][_0x19f471[_0x9f73('0xb8')]]&&_0x19f471[_0x9f73('0xb8')]!==_0x19f471[_0x9f73('0xd9')]&&!this[_0x9f73('0x18')][_0x19f471[_0x9f73('0xb8')]]['dialAnswer']){if(_0x19f471[_0x9f73('0x123')]==='1'){this[_0x9f73('0x9f')](_0x19f471,_0x19f471[_0x9f73('0xb8')],_0x19f471[_0x9f73('0x123')]);}}};Preview['prototype'][_0x9f73('0x12c')]=function(_0x53e27f,_0x4a3c7b,_0x5b80a2){if(this['actions'][_0x53e27f]){if(_[_0x9f73('0x6f')](this[_0x9f73('0x18')][_0x53e27f][_0x9f73('0x12d')])){this['actions'][_0x53e27f][_0x9f73('0x12d')]={};}this[_0x9f73('0x18')][_0x53e27f][_0x9f73('0x12d')][_0x4a3c7b]=_0x5b80a2;}};Preview[_0x9f73('0x10')][_0x9f73('0x27')]=function(_0x37e364){try{if(!_['isNil'](_0x37e364)){if(ut[_0x9f73('0x12e')](_['keys'](_0x37e364['variable'])[0x0])){this['addVariable'](_0x37e364[_0x9f73('0xd9')],_[_0x9f73('0x12f')](_0x37e364[_0x9f73('0x130')])[0x0],_0x37e364[_0x9f73('0x131')]);}}}catch(_0x3c21b8){logger[_0x9f73('0x132')]('[syncVarSet][Preview]',util['inspect'](_0x3c21b8,{'showHidden':![],'depth':null}));}};Preview[_0x9f73('0x10')]['syncAttendedTransfer']=function(_0x36d694){if(_0x36d694){if(this[_0x9f73('0x18')][_0x36d694[_0x9f73('0x133')]]){this['actions'][_0x36d694['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x9f73('0x10')][_0x9f73('0x2a')]=function(_0x51e15e){if(_0x51e15e){if(this[_0x9f73('0x18')][_0x51e15e[_0x9f73('0x134')]]){this[_0x9f73('0x18')][_0x51e15e[_0x9f73('0x134')]][_0x9f73('0x128')]=!![];}}};module['exports']=Preview;
\ No newline at end of file