Built motion from commit (unavailable).|2.4.9
[motion2.git] / server / services / ami / preview / index.js
index 361c73f..e615d46 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6ff7=['[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','bind','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','talking','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','sequence','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','run','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','scheduledAt','activeContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','buildObj','called','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','channelstate','transfer','disableContact','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value'];(function(_0x2fb581,_0x17f3a6){var _0x4f60c4=function(_0x5f0d25){while(--_0x5f0d25){_0x2fb581['push'](_0x2fb581['shift']());}};_0x4f60c4(++_0x17f3a6);}(_0x6ff7,0x139));var _0x76ff=function(_0x5d4fa4,_0x2e020c){_0x5d4fa4=_0x5d4fa4-0x0;var _0x525387=_0x6ff7[_0x5d4fa4];return _0x525387;};'use strict';var util=require('util');var _=require(_0x76ff('0x0'));var BPromise=require(_0x76ff('0x1'));var uuid=require(_0x76ff('0x2'));var moment=require(_0x76ff('0x3'));var md5=require(_0x76ff('0x4'));var Redis=require(_0x76ff('0x5'));var config=require(_0x76ff('0x6'));var logger=require(_0x76ff('0x7'))(_0x76ff('0x8'));var loggerAction=require('../../../config/logger')(_0x76ff('0x9'));var ami=require(_0x76ff('0xa'));var rpcDb=require(_0x76ff('0xb'));var Action=require('./action');var ut=require(_0x76ff('0xc'));config[_0x76ff('0xd')]=_[_0x76ff('0xe')](config[_0x76ff('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76ff('0xd')]));var Sequence=function(){};Sequence['prototype'][_0x76ff('0xf')]=function(_0x347ef8){this[_0x76ff('0x10')]=this[_0x76ff('0x10')]?this[_0x76ff('0x10')][_0x76ff('0x11')](_0x347ef8):_0x347ef8();};function Preview(_0x37c786){this['sequence']=new Sequence();this[_0x76ff('0x12')]=_0x37c786[_0x76ff('0x13')];this['trunks']=_0x37c786[_0x76ff('0x14')];this[_0x76ff('0x15')]={};this[_0x76ff('0x16')]=_0x37c786[_0x76ff('0x16')];this[_0x76ff('0x17')]=0x0;ami['on'](_0x76ff('0x18'),this[_0x76ff('0x19')]['bind'](this));ami['on'](_0x76ff('0x1a'),this[_0x76ff('0x1b')]['bind'](this));ami['on']('hanguprequest',this[_0x76ff('0x1c')]['bind'](this));ami['on'](_0x76ff('0x1d'),this[_0x76ff('0x1e')][_0x76ff('0x1f')](this));ami['on'](_0x76ff('0x20'),this[_0x76ff('0x21')][_0x76ff('0x1f')](this));ami['on'](_0x76ff('0x22'),this[_0x76ff('0x23')][_0x76ff('0x1f')](this));ami['on'](_0x76ff('0x24'),this[_0x76ff('0x25')]['bind'](this));ami['on']('blindtransfer',this[_0x76ff('0x26')][_0x76ff('0x1f')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x4508ee,_0x564933,_0x29f73d){io['to'](_0x4508ee)[_0x76ff('0x27')](_0x564933,_0x29f73d);}function emitCampaignPreview(_0x1eaf9b){if(_0x1eaf9b['type']===_0x76ff('0x28')){var _0x3d5782={'id':_0x1eaf9b['id'],'name':_0x1eaf9b[_0x76ff('0x29')],'strategy':_0x1eaf9b[_0x76ff('0x2a')],'answered':_0x1eaf9b[_0x76ff('0x2b')],'available':_0x1eaf9b['available'],'loggedIn':_0x1eaf9b[_0x76ff('0x2c')],'pTalking':_0x1eaf9b[_0x76ff('0x2d')],'sumBillable':_0x1eaf9b[_0x76ff('0x2e')],'sumDuration':_0x1eaf9b[_0x76ff('0x2f')],'sumHoldTime':_0x1eaf9b['sumHoldTime']||0x0,'talking':_0x1eaf9b[_0x76ff('0x30')],'total':_0x1eaf9b['total'],'type':_0x1eaf9b[_0x76ff('0x31')],'unmanaged':_0x1eaf9b[_0x76ff('0x32')],'abandoned':_0x1eaf9b['abandoned'],'waiting':_0x1eaf9b[_0x76ff('0x33')],'loggedInDb':_0x1eaf9b[_0x76ff('0x34')],'dialActive':_0x1eaf9b[_0x76ff('0x35')],'dialMethod':_0x1eaf9b[_0x76ff('0x36')],'dialOriginateCallerIdName':_0x1eaf9b[_0x76ff('0x37')],'dialOriginateCallerIdNumber':_0x1eaf9b[_0x76ff('0x38')],'dialOriginateTimeout':_0x1eaf9b['dialOriginateTimeout'],'dialPrefix':_0x1eaf9b[_0x76ff('0x39')],'outboundAnswerAgiCallsDay':_0x1eaf9b[_0x76ff('0x3a')],'outboundAnswerCallsDay':_0x1eaf9b[_0x76ff('0x3b')],'outboundBlacklistCallsDay':_0x1eaf9b[_0x76ff('0x3c')],'outboundBusyCallsDay':_0x1eaf9b[_0x76ff('0x3d')],'outboundCongestionCallsDay':_0x1eaf9b['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1eaf9b[_0x76ff('0x3e')],'outboundDropCallsDayCallersExit':_0x1eaf9b['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x1eaf9b[_0x76ff('0x3f')],'outboundNoAnswerCallsDay':_0x1eaf9b['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1eaf9b[_0x76ff('0x40')],'outboundOriginateFailureCallsDay':_0x1eaf9b[_0x76ff('0x41')],'outboundReCallsDay':_0x1eaf9b[_0x76ff('0x42')],'outboundRejectCallsDay':_0x1eaf9b['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1eaf9b[_0x76ff('0x43')],'predictiveIntervalAnsweredCalls':_0x1eaf9b[_0x76ff('0x44')],'predictiveIntervalAvgHoldtime':_0x1eaf9b['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1eaf9b['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1eaf9b[_0x76ff('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x1eaf9b[_0x76ff('0x46')],'predictiveIntervalErlangCalls':_0x1eaf9b[_0x76ff('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x1eaf9b[_0x76ff('0x48')],'predictiveIntervalHitRate':_0x1eaf9b[_0x76ff('0x49')],'predictiveIntervalMultiplicativeFactor':_0x1eaf9b[_0x76ff('0x4a')],'predictiveIntervalPauses':_0x1eaf9b[_0x76ff('0x4b')],'predictiveIntervalAvailable':_0x1eaf9b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1eaf9b['predictiveIntervalTotalCalls'],'message':_0x1eaf9b[_0x76ff('0x4c')],'originated':_0x1eaf9b[_0x76ff('0x4d')],'erlangCalls':_0x1eaf9b[_0x76ff('0x4e')],'erlangCallToSecond':_0x1eaf9b[_0x76ff('0x4f')],'erlangAbandonmentRate':_0x1eaf9b[_0x76ff('0x50')],'erlangBusyFactor':_0x1eaf9b[_0x76ff('0x51')],'startPredictive':_0x1eaf9b[_0x76ff('0x52')],'startProgressive':_0x1eaf9b[_0x76ff('0x53')]};if(_0x1eaf9b[_0x76ff('0x54')]){_0x3d5782[_0x76ff('0x54')]={'id':_0x1eaf9b[_0x76ff('0x54')]['id'],'name':_0x1eaf9b[_0x76ff('0x54')]['name'],'active':_0x1eaf9b[_0x76ff('0x54')][_0x76ff('0x55')],'callerid':_0x1eaf9b[_0x76ff('0x54')][_0x76ff('0x56')]};}if(_0x1eaf9b[_0x76ff('0x57')]){_0x3d5782[_0x76ff('0x57')]={'id':_0x1eaf9b['Interval']['id'],'name':_0x1eaf9b['Interval'][_0x76ff('0x29')]};}var _0x10e9e3=md5(JSON[_0x76ff('0x58')](_0x3d5782));if(_0x1eaf9b[_0x76ff('0x4')]!==_0x10e9e3){_0x1eaf9b[_0x76ff('0x4')]=_0x10e9e3;emit(util[_0x76ff('0x59')](_0x76ff('0x5a'),_0x3d5782[_0x76ff('0x29')]),_0x76ff('0x5b'),_0x3d5782);}}}function emitVoiceQueueChannelRemove(_0x9fc705){emit(util[_0x76ff('0x59')]('voice:queue:%s',_0x9fc705['name']),_0x76ff('0x5c'),_0x9fc705);}function notSendMessagesQueue(_0x32fc80){if(_0x32fc80['sendMessageOneNotActive']){if(_0x32fc80[_0x76ff('0x4d')]===0x0&&_0x32fc80[_0x76ff('0x2d')]===0x0){_0x32fc80[_0x76ff('0x5d')]=![];_0x32fc80['available']=0x0;_0x32fc80[_0x76ff('0x5e')]=0x0;_0x32fc80['message']='NOT_ACTIVE';ut[_0x76ff('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x32fc80[_0x76ff('0x29')]+'\x20is\x20not\x20active');}else{_0x32fc80['message']='IS_DISACTIVED';ut[_0x76ff('0x5f')](_0x76ff('0x60'),_0x32fc80[_0x76ff('0x29')]+_0x76ff('0x61'));}emitCampaignPreview(_0x32fc80);}}Preview[_0x76ff('0x62')][_0x76ff('0x63')]=function(){var _0x2e660b=this;setInterval(function(){_0x2e660b['syncCampaigns']();},0x7cf);};Preview[_0x76ff('0x62')][_0x76ff('0x64')]=function(){var _0x6beac0=this[_0x76ff('0x12')];this[_0x76ff('0x17')]+=0x1;for(var _0x46ff7a in _0x6beac0){if(_0x6beac0[_0x76ff('0x65')](_0x46ff7a)&&(_0x6beac0[_0x46ff7a][_0x76ff('0x36')]===_0x76ff('0x8')||_0x6beac0[_0x46ff7a][_0x76ff('0x36')]===_0x76ff('0x66'))&&_0x6beac0[_0x46ff7a]['type']===_0x76ff('0x28')){if(this[_0x76ff('0x17')]>0x7){this[_0x76ff('0x17')]=0x0;this[_0x76ff('0x67')]();}}if(_0x6beac0[_0x76ff('0x65')](_0x46ff7a)&&_0x6beac0[_0x46ff7a][_0x76ff('0x36')]==='preview'&&_0x6beac0[_0x46ff7a][_0x76ff('0x31')]==='outbound'){if(_0x6beac0[_0x46ff7a]['dialActive']){this[_0x76ff('0x68')](_0x6beac0[_0x46ff7a]);this['recallMe'](_0x6beac0[_0x46ff7a]);}else{notSendMessagesQueue(_0x6beac0[_0x46ff7a]);}}}};Preview[_0x76ff('0x62')]['clearZombieChannel']=function(_0x3466d7){var _0xd1d661=this;this[_0x76ff('0x69')][_0x76ff('0xf')](function(){if(!_[_0x76ff('0x6a')](_0xd1d661[_0x76ff('0x15')][_0x3466d7])){loggerAction[_0x76ff('0x6b')](_0x76ff('0x6c'),_0x3466d7,_0x76ff('0x6d'),_0xd1d661[_0x76ff('0x15')][_0x3466d7][_0x76ff('0x6e')],_0x76ff('0x6f'),JSON['stringify'](_0xd1d661[_0x76ff('0x12')][_0xd1d661[_0x76ff('0x15')][_0x3466d7]['queue']][_0x76ff('0x4d')]),_0x76ff('0x70'),JSON['stringify'](_0xd1d661['campaignsPreview'][_0xd1d661[_0x76ff('0x15')][_0x3466d7][_0x76ff('0x6e')]][_0x76ff('0x2d')]),JSON[_0x76ff('0x58')](_0xd1d661['actions'][_0x3466d7][_0x76ff('0x71')]),JSON[_0x76ff('0x58')](_[_0x76ff('0x72')](_0xd1d661[_0x76ff('0x15')][_0x3466d7],[_0x76ff('0x73'),_0x76ff('0x74'),_0x76ff('0x75'),_0x76ff('0x76')])));return ami[_0x76ff('0x77')]({'action':'status','channel':_0xd1d661[_0x76ff('0x15')][_0x3466d7][_0x76ff('0x78')]})['catch'](function(_0x5e328b){if(_0x5e328b[_0x76ff('0x4c')]===_0x76ff('0x79')){setTimeout(function(){if(_0xd1d661['actions'][_0x3466d7]){ut['updateOriginated'](_0xd1d661[_0x76ff('0x12')][_0xd1d661[_0x76ff('0x15')][_0x3466d7][_0x76ff('0x6e')]],_0x76ff('0x7a'));if(_0xd1d661[_0x76ff('0x15')][_0x3466d7]['dialAnswer']===!![]){ut[_0x76ff('0x7b')](_0xd1d661[_0x76ff('0x12')][_0xd1d661['actions'][_0x3466d7][_0x76ff('0x6e')]],_0x76ff('0x7a'));ut[_0x76ff('0x7c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x3466d7,_0xd1d661[_0x76ff('0x15')][_0x3466d7][_0x76ff('0x6e')]);}ut[_0x76ff('0x7c')](_0x76ff('0x7d')+_0x3466d7,_0xd1d661['actions'][_0x3466d7][_0x76ff('0x6e')]);delete _0xd1d661[_0x76ff('0x15')][_0x3466d7];}},0x2328);}});}});};Preview[_0x76ff('0x62')][_0x76ff('0x67')]=function(){var _0x47f8db=this;loggerAction[_0x76ff('0x6b')](_0x76ff('0x7e'),_[_0x76ff('0x7f')](this[_0x76ff('0x15')]));for(var _0x44bbbd in this['actions']){if(_0x47f8db[_0x76ff('0x15')][_0x76ff('0x65')](_0x44bbbd)){_0x47f8db[_0x76ff('0x80')](_0x44bbbd);}}};Preview[_0x76ff('0x62')][_0x76ff('0x81')]=function(_0x573d96){var _0xe340d6=this;rpcDb[_0x76ff('0x82')](_0x573d96['id'],ut[_0x76ff('0x83')](this[_0x76ff('0x16')]))[_0x76ff('0x84')](function(_0x2dd8a2){if(!_[_0x76ff('0x6a')](_0x2dd8a2)){for(var _0xa23807=0x0;_0xa23807<_0x2dd8a2['length'];_0xa23807+=0x1){if(ut[_0x76ff('0x85')](_0x2dd8a2[_0xa23807][_0x76ff('0x86')])<_0x573d96[_0x76ff('0x87')]*0x3c){_0xe340d6[_0x76ff('0x88')](_0x2dd8a2[_0xa23807]['id'])[_0x76ff('0x84')](ut[_0x76ff('0x89')](_0x76ff('0x8a')))[_0x76ff('0x8b')](ut['logger2'](_0x76ff('0x8a')));}else{var _0x147b34=new Action(_0x2dd8a2[_0xa23807],_0x573d96);_0x147b34[_0x76ff('0x8c')]=moment()['format'](_0x76ff('0x8d'));_0x573d96['outboundReCallsDay']+=0x1;ut[_0x76ff('0x8e')](_0x147b34,0x17,_0x76ff('0x8f'));if(_0x573d96[_0x76ff('0x90')]){rpcDb[_0x76ff('0x91')](ut[_0x76ff('0x92')](_0x2dd8a2[_0xa23807]));rpcDb[_0x76ff('0x93')](_0x147b34,_0x76ff('0x94'));}else{ut[_0x76ff('0x8e')](_0x147b34,0x16,_0x76ff('0x95'));rpcDb[_0x76ff('0x93')](_0x147b34,_0x76ff('0x96'));rpcDb[_0x76ff('0x97')](_0x147b34,_0x76ff('0x96'));}}}}})[_0x76ff('0x8b')](ut[_0x76ff('0x89')](_0x76ff('0x98')));};Preview[_0x76ff('0x62')][_0x76ff('0x68')]=function(_0xc8c2bc){_0xc8c2bc[_0x76ff('0x5d')]=!![];if(ut['IsNotLoggedIn'](_0xc8c2bc[_0x76ff('0x2c')])){_0xc8c2bc[_0x76ff('0x4c')]=_0x76ff('0x99');}else if(!ut[_0x76ff('0x9a')](_0xc8c2bc['dialActive'])){_0xc8c2bc[_0x76ff('0x4c')]=_0x76ff('0x9b');}else if(!this[_0x76ff('0x9c')](_0xc8c2bc[_0x76ff('0x54')])){if(!this['isTrunkReachable'](_0xc8c2bc[_0x76ff('0x9d')])){_0xc8c2bc['message']=_0x76ff('0x9e');}else{_0xc8c2bc['message']='ACTIVE';}}else{_0xc8c2bc[_0x76ff('0x4c')]=_0x76ff('0x9f');}emitCampaignPreview(_0xc8c2bc);};Preview[_0x76ff('0x62')]['callProgressDetectingCustomer']=function(_0x3969d0,_0x181afd,_0x364d1e){var _0x2ea300=this;var _0xfe1238=this['actions'][_0x181afd];var _0x260f55=this[_0x76ff('0x12')][_0xfe1238[_0x76ff('0x6e')]];var _0x82f514;if(_0x260f55){switch(_0x364d1e){case'1':_0x260f55[_0x76ff('0x40')]+=0x1;_0xfe1238['countglobal']=ut[_0x76ff('0xa0')](_0xfe1238);ut[_0x76ff('0x8e')](_0xfe1238,0x0,'NoSuchNumber');rpcDb['createCustomerHistory'](_0xfe1238,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0xfe1238)>=_0x260f55[_0x76ff('0xa1')]){_0x82f514=ut[_0x76ff('0xa2')](_0xfe1238,0xf,_0x76ff('0xa3'));rpcDb[_0x76ff('0x97')](_0x82f514,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['createCustomerFinal'](_0xfe1238,_0x76ff('0xa4'));}delete this[_0x76ff('0x15')][_0x3969d0[_0x76ff('0xa5')]];break;case'ANSWER':var _0x503ba3=moment()[_0x76ff('0x59')](_0x76ff('0x8d'));_0xfe1238[_0x76ff('0xa6')]=_0x503ba3;_0xfe1238[_0x76ff('0xa7')]=_0x503ba3;_0xfe1238['dialAnswer']=!![];_0x260f55[_0x76ff('0x2d')]+=0x1;logger[_0x76ff('0x6b')](_0x76ff('0xa8'),_0xfe1238[_0x76ff('0xa9')],_0x76ff('0xaa'),_0x260f55[_0x76ff('0x29')],'pTalking:\x20',_0x260f55[_0x76ff('0x2d')]);ami[_0x76ff('0x27')](_0x76ff('0xab'),ut['buildObj'](_0xfe1238,_0x76ff('0xac')));if(_0x260f55[_0x76ff('0xad')]){ami['emit']('custom:agentConnectPreview',ut[_0x76ff('0xae')](_0xfe1238));}break;case'16':ami[_0x76ff('0x27')](_0x76ff('0xaf'),ut['buildObj'](_0xfe1238,'complete'));emitVoiceQueueChannelRemove(ut['buildObj'](_0xfe1238,_0x76ff('0xb0')));_0x260f55[_0x76ff('0x3b')]+=0x1;_0x260f55['total']+=0x1;_0x260f55[_0x76ff('0x2b')]+=0x1;ut[_0x76ff('0x7b')](_0x260f55,_0x76ff('0xb1'));_0xfe1238[_0x76ff('0xb2')]=ut[_0x76ff('0xa0')](_0xfe1238);ut['logCustomer'](_0xfe1238,0x4,'Answer');rpcDb['createCustomerHistory'](_0xfe1238,_0x76ff('0xb3'));rpcDb['createCustomerFinal'](_0xfe1238,_0x76ff('0xb4'));rpcDb['crateCustomerReportQueue'](_0xfe1238);_0x260f55[_0x76ff('0x2f')]+=_0xfe1238['talktime'];_0x260f55['sumBillable']+=_0xfe1238[_0x76ff('0xb5')];logger[_0x76ff('0x6b')](_0x76ff('0xb6'),_0xfe1238[_0x76ff('0xa9')],'\x20Queue',_0x260f55[_0x76ff('0x29')],_0x76ff('0x70'),_0x260f55[_0x76ff('0x2d')]);delete this[_0x76ff('0x15')][_0x3969d0[_0x76ff('0xa5')]];break;case'BUSY':_0x260f55['outboundBusyCallsDay']+=0x1;_0xfe1238[_0x76ff('0xb7')]+=0x1;_0xfe1238['countglobal']=ut[_0x76ff('0xa0')](_0xfe1238);ut['logCustomer'](_0xfe1238,0x5,_0x76ff('0xb8'));rpcDb['createCustomerHistory'](_0xfe1238,_0x76ff('0xb9'));if(ut[_0x76ff('0xa0')](_0xfe1238)>=_0x260f55[_0x76ff('0xa1')]){_0x82f514=ut[_0x76ff('0xa2')](_0xfe1238,0xf,'Global');rpcDb[_0x76ff('0x97')](_0x82f514,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0xfe1238[_0x76ff('0xb7')]>=_0x260f55[_0x76ff('0xba')]){rpcDb[_0x76ff('0x97')](_0xfe1238,_0x76ff('0xb9'));}else{rpcDb[_0x76ff('0xbb')](ut['scheduledAt'](_0xfe1238,_0x76ff('0xb7'),_0x260f55[_0x76ff('0xbc')]),_0xfe1238[_0x76ff('0xbd')],_0xfe1238['activeContact']);}}break;case _0x76ff('0xbe'):_0x260f55[_0x76ff('0xbf')]+=0x1;_0xfe1238[_0x76ff('0xc0')]+=0x1;_0xfe1238[_0x76ff('0xb2')]=ut[_0x76ff('0xa0')](_0xfe1238);ut['logCustomer'](_0xfe1238,0x3,'NoAnswer');rpcDb[_0x76ff('0x93')](_0xfe1238,_0x76ff('0xc1'));if(ut[_0x76ff('0xa0')](_0xfe1238)>=_0x260f55[_0x76ff('0xa1')]){_0x82f514=ut[_0x76ff('0xa2')](_0xfe1238,0xf,'Global');rpcDb[_0x76ff('0x97')](_0x82f514,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xfe1238['countnoanswerretry']>=_0x260f55[_0x76ff('0xc2')]){rpcDb[_0x76ff('0x97')](_0xfe1238,_0x76ff('0xc1'));}else{rpcDb[_0x76ff('0xbb')](ut[_0x76ff('0xc3')](_0xfe1238,'countnoanswerretry',_0x260f55['dialNoAnswerRetryFrequency']),_0xfe1238[_0x76ff('0xbd')],_0xfe1238[_0x76ff('0xc4')]);}}break;case _0x76ff('0xc5'):_0x260f55[_0x76ff('0xc6')]+=0x1;_0xfe1238[_0x76ff('0xc7')]+=0x1;_0xfe1238[_0x76ff('0xb2')]=ut[_0x76ff('0xa0')](_0xfe1238);ut[_0x76ff('0x8e')](_0xfe1238,0x8,'Congestion');rpcDb['createCustomerHistory'](_0xfe1238,_0x76ff('0xc8'));if(ut[_0x76ff('0xa0')](_0xfe1238)>=_0x260f55['dialGlobalMaxRetry']){_0x82f514=ut['cloneAction'](_0xfe1238,0xf,_0x76ff('0xa3'));rpcDb[_0x76ff('0x97')](_0x82f514,_0x76ff('0xc9'));}else{if(_0xfe1238[_0x76ff('0xc7')]>=_0x260f55[_0x76ff('0xca')]){rpcDb[_0x76ff('0x97')](_0xfe1238,_0x76ff('0xc8'));}else{rpcDb[_0x76ff('0xbb')](ut['scheduledAt'](_0xfe1238,_0x76ff('0xc7'),_0x260f55[_0x76ff('0xbc')]),_0xfe1238[_0x76ff('0xbd')],_0xfe1238[_0x76ff('0xc4')]);}}break;case _0x76ff('0xcb'):_0x260f55[_0x76ff('0xcc')]+=0x1;_0xfe1238[_0x76ff('0xb2')]=ut[_0x76ff('0xa0')](_0xfe1238);ut[_0x76ff('0x8e')](_0xfe1238,0x14,'AgentReject');rpcDb['createCustomerHistory'](_0xfe1238,_0x76ff('0xcd'));if(_0xfe1238[_0x76ff('0xbd')]){rpcDb[_0x76ff('0xce')](_0xfe1238['idContact']);}if(_0xfe1238['activeContact']){rpcDb['disableContact'](_0xfe1238[_0x76ff('0xcf')]);}break;default:if(_0xfe1238[_0x76ff('0x71')]){ut[_0x76ff('0x7b')](_0x260f55,_0x76ff('0xd0'));ut[_0x76ff('0x7c')](_0x76ff('0xd1')+_0x260f55[_0x76ff('0x29')],_0x3969d0);}_0x260f55['outboundUnknownCallsDay']+=0x1;_0xfe1238[_0x76ff('0xb2')]=ut[_0x76ff('0xa0')](_0xfe1238);ut[_0x76ff('0x8e')](_0xfe1238,0xc,_0x3969d0['cause-txt']||_0x3969d0[_0x76ff('0xd2')]);rpcDb[_0x76ff('0x93')](_0xfe1238,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0xfe1238)>=_0x260f55[_0x76ff('0xa1')]){_0x82f514=ut['cloneAction'](_0xfe1238,0xf,_0x76ff('0xa3'));rpcDb[_0x76ff('0x97')](_0x82f514,_0x76ff('0xd3'));}else{rpcDb['createCustomerFinal'](_0xfe1238,_0x76ff('0xd3'));}delete this['actions'][_0x3969d0['linkedid']];}if(!(_0xfe1238[_0x76ff('0x71')]&&_0x364d1e==='16')){ut[_0x76ff('0xd4')](_0x260f55,_0x76ff('0xd5'));logger[_0x76ff('0x6b')](_0x76ff('0xd6'),_0xfe1238[_0x76ff('0xa9')],_0x76ff('0xaa'),_0x260f55['name'],_0x76ff('0x6f'),_0x260f55[_0x76ff('0x4d')]);}if(_0x364d1e!=='ANSWER'){delete this['actions'][_0x3969d0['linkedid']];delete this[_0x76ff('0x15')][_0x3969d0[_0x76ff('0xd7')]];}}};Preview[_0x76ff('0x62')][_0x76ff('0xd8')]=function(_0xed1236,_0x28635b,_0x176a40){if(_[_0x76ff('0xd9')](_0x28635b)&&_0x76ff('0xda')!==typeof _0x28635b){return;}if(_[_0x76ff('0xd9')](_0x176a40)&&_0x76ff('0xda')!==typeof _0x176a40){return;}switch(_0x176a40[_0x76ff('0xdb')]){case'0':ut[_0x76ff('0xdc')](_0xed1236,0x0,'NoSuchNumber');rpcDb[_0x76ff('0xdd')](_0xed1236,_0x76ff('0xde'));break;case'3':ut[_0x76ff('0xdc')](_0xed1236,0x3,_0x76ff('0xdf'));rpcDb[_0x76ff('0xdd')](_0xed1236,_0x76ff('0xe0'));break;case'5':ut[_0x76ff('0xdc')](_0xed1236,0x5,_0x76ff('0xb8'));rpcDb[_0x76ff('0xdd')](_0xed1236,_0x76ff('0xe1'));break;case'8':ut['logAgent'](_0xed1236,0x8,_0x76ff('0xe2'));rpcDb[_0x76ff('0xdd')](_0xed1236,_0x76ff('0xe3'));break;case'22':ut[_0x76ff('0xdc')](_0xed1236,0x16,_0x76ff('0xe4'));rpcDb[_0x76ff('0xdd')](_0xed1236,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xed1236,0xc,_0x176a40['reason']);rpcDb[_0x76ff('0xdd')](_0xed1236,_0x76ff('0xe3'));}ut[_0x76ff('0xd4')](_0x28635b,'[callProgressDetectingAgent]');logger[_0x76ff('0x6b')](_0x76ff('0xe5'),_0xed1236[_0x76ff('0xa9')],_0x76ff('0xaa'),_0x28635b[_0x76ff('0x29')],_0x76ff('0x6f'),_0x28635b[_0x76ff('0x4d')]);delete this[_0x76ff('0x15')][_0xed1236[_0x76ff('0xa9')]];};Preview['prototype'][_0x76ff('0xe6')]=function(_0x7071a8,_0x51d550,_0x59f0ac,_0x19a79a,_0x4d29fe){var _0x5b7861=this;return new BPromise(function(_0x18849f,_0x2dd858){if(_['isNil'](_0x51d550)||_[_0x76ff('0x6a')](_0x51d550[_0x76ff('0xe7')])||_[_0x76ff('0x6a')](_0x51d550[_0x76ff('0xe7')][_0x76ff('0xe8')])||_[_0x76ff('0x6a')](_0x51d550[_0x76ff('0x75')])){_0x2dd858(ut[_0x76ff('0x4c')]('Contact\x20is\x20undefined',_0x19a79a,_0x4d29fe));return;}var _0x2b99cd=uuid['v4']();var _0x26cfd6=_0x5b7861['campaignsPreview'][_0x51d550[_0x76ff('0x6d')][_0x76ff('0x29')]];var _0x240680=_0x59f0ac?_0x5b7861[_0x76ff('0x16')][_0x59f0ac]['id']:undefined;_0x5b7861[_0x76ff('0x15')][_0x2b99cd]=new Action(_0x51d550,_0x26cfd6,_0x2b99cd,_0x59f0ac,_0x240680);var _0x4da6c8=_0x5b7861[_0x76ff('0x15')][_0x2b99cd];_0x4da6c8['unlockAgent']=_0x19a79a;_0x4da6c8[_0x76ff('0xc4')]=_0x4d29fe;_0x4da6c8[_0x76ff('0xe9')]=_0x59f0ac;if(_['isEmpty'](_0x7071a8)){_0x5b7861[_0x76ff('0xea')](_0x4da6c8,_0x26cfd6,_0x51d550,_0x59f0ac)['then'](function(_0x346cb6){logger[_0x76ff('0x6b')](_0x76ff('0xeb'),'Queue:\x20'+_0x4da6c8['queue']+_0x76ff('0xec')+_0x4da6c8[_0x76ff('0xcf')],JSON['stringify'](_0x346cb6));ami[_0x76ff('0x27')](_0x76ff('0xed'),ut[_0x76ff('0xee')](_0x4da6c8,_0x76ff('0xef')));_0x18849f(ut['message'](_0x76ff('0xf0')));})[_0x76ff('0x8b')](function(_0xfd43a7){ut[_0x76ff('0x5f')]('[Preview][execCall][failure]',_0xfd43a7);_0x2dd858(ut[_0x76ff('0x4c')](_0x76ff('0xf1'),_0x19a79a,_0x4d29fe));});}else{_0x26cfd6[_0x76ff('0x3c')]+=0x1;ut[_0x76ff('0xf2')](_0x4da6c8);rpcDb[_0x76ff('0xf3')](_0x4da6c8,_0x76ff('0xf4'));delete _0x5b7861[_0x76ff('0x15')][_0x2b99cd];_0x2dd858(ut[_0x76ff('0x4c')](_0x76ff('0xf5'),_0x19a79a,_0x4d29fe));}});};Preview[_0x76ff('0x62')][_0x76ff('0x9c')]=function(_0x5191c9){return!_[_0x76ff('0x6a')](_0x5191c9)&&!_[_0x76ff('0x6a')](_0x5191c9[_0x76ff('0x29')])&&!_['isNil'](_0x5191c9[_0x76ff('0x55')])&&_0x5191c9[_0x76ff('0x55')]&&!_[_0x76ff('0x6a')](this[_0x76ff('0x14')][util['format']('SIP/%s',_0x5191c9[_0x76ff('0x29')])])&&!_[_0x76ff('0x6a')](this['trunks'][util[_0x76ff('0x59')](_0x76ff('0xf6'),_0x5191c9['name'])]['status'])&&(this['trunks'][util[_0x76ff('0x59')](_0x76ff('0xf6'),_0x5191c9[_0x76ff('0x29')])][_0x76ff('0xf7')]===_0x76ff('0xf8')||this[_0x76ff('0x14')][util[_0x76ff('0x59')](_0x76ff('0xf6'),_0x5191c9[_0x76ff('0x29')])]['status']===_0x76ff('0xf9'));};Preview['prototype']['run']=function(_0x27a70e,_0x327205){var _0x550706=this;return new BPromise(function(_0x226543,_0x42cd9e){_0x550706[_0x76ff('0xfa')](_0x27a70e,_0x327205)['then'](function(_0x1bafdd){_0x226543(_[_0x76ff('0x72')](_0x1bafdd,[_0x76ff('0x4c')]));})[_0x76ff('0x8b')](function(_0x4f229e){if(_0x4f229e[_0x76ff('0xfb')]){rpcDb[_0x76ff('0xce')](_0x27a70e);}if(_0x4f229e['active']){rpcDb['disableContact'](_0x27a70e);}_0x42cd9e(_[_0x76ff('0x72')](_0x4f229e,[_0x76ff('0x4c')]));});});};Preview[_0x76ff('0x62')][_0x76ff('0xfa')]=function(_0x3ad31e,_0x10e8ee){var _0x42a2f8=this;return new BPromise(function(_0x32c0b3,_0x2e85a9){var _0x16f049,_0x33554c;rpcDb[_0x76ff('0xfc')](_0x3ad31e)[_0x76ff('0x84')](function(_0x4a88f7){if(!_['isNil'](_0x4a88f7[0x0])){_0x33554c=_0x4a88f7[0x0][_0x76ff('0xfd')]?![]:!![];_0x16f049=_0x4a88f7[0x0][_0x76ff('0xfd')]?!![]:![];_0x16f049=_0x10e8ee?!![]:_0x16f049;}var _0xef99e7=_0x42a2f8['validateContact'](_0x4a88f7);if(_0xef99e7['isValid']){rpcDb[_0x76ff('0xfe')](_[_0x76ff('0x72')](_0x4a88f7[0x0],['VoiceQueueId',_0x76ff('0xff')]))[_0x76ff('0x84')](function(_0x3712f3){_0x42a2f8[_0x76ff('0xe6')](_0x3712f3,_0x4a88f7[0x0],_0x10e8ee,_0x33554c,_0x16f049)[_0x76ff('0x84')](function(_0x25c598){_0x32c0b3(_0x25c598);})[_0x76ff('0x8b')](function(_0xc19a72){_0x2e85a9(_0xc19a72);});})[_0x76ff('0x8b')](function(_0x6973bb){ut[_0x76ff('0x5f')]('[Preview][checkIsBlackList]',_0x6973bb);_0x2e85a9(ut[_0x76ff('0x4c')]('Call\x20unsuccessful',_0x33554c,_0x16f049));});}else{_0x2e85a9(ut[_0x76ff('0x4c')](_0xef99e7[_0x76ff('0x4c')],_0x33554c,_0x16f049));}})[_0x76ff('0x8b')](function(_0x499270){ut[_0x76ff('0x5f')](_0x76ff('0x100'),_0x499270);_0x2e85a9(ut[_0x76ff('0x4c')](_0x76ff('0x101'),![],!![]));});});};Preview[_0x76ff('0x62')]['validateContact']=function(_0x37a3e1){if(_[_0x76ff('0x6a')](_0x37a3e1)||_['isEmpty'](_0x37a3e1)||!_[_0x76ff('0x6a')](_0x37a3e1[0x0][_0x76ff('0x102')])&&_['isNil'](_0x37a3e1[0x0][_0x76ff('0x102')][_0x76ff('0x29')])){ut[_0x76ff('0x5f')]('[Preview][validateContact][Empty\x20Contact]',_0x37a3e1);return{'isValid':![],'message':_0x76ff('0x103')};}var _0x25a744=this[_0x76ff('0x12')][_0x37a3e1[0x0][_0x76ff('0x6d')]['name']];_0x25a744[_0x76ff('0x4c')]=_0x76ff('0x9f');if(_[_0x76ff('0x6a')](_0x25a744)){ut[_0x76ff('0x5f')](_0x76ff('0x104'),_0x25a744);return{'isValid':![],'message':_0x76ff('0x105')};}if(!this[_0x76ff('0x9c')](_0x25a744['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x25a744[_0x76ff('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x76ff('0x9c')](_0x25a744[_0x76ff('0x9d')])){ut[_0x76ff('0x5f')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x25a744['name']+_0x76ff('0x106'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x25a744[_0x76ff('0x35')])){ut['logger'](_0x76ff('0x107'),_0x25a744[_0x76ff('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x76ff('0x108')+_0x25a744['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x76ff('0x62')][_0x76ff('0xea')]=function(_0x2cd919,_0x13dfb7,_0x1a8b65,_0xdbfbca){var _0x125e35=this;return new BPromise(function(_0x2c26a8,_0x592ec9){var _0x4272c6=_0x2cd919['uniqueid'];var _0x4c19e9=_0x125e35[_0x76ff('0x9c')](_0x13dfb7[_0x76ff('0x54')])?util[_0x76ff('0x59')](_0x76ff('0x109'),_0x13dfb7[_0x76ff('0x54')][_0x76ff('0x29')],_[_0x76ff('0x6a')](_0x13dfb7[_0x76ff('0x39')])?'':_0x13dfb7[_0x76ff('0x39')][_0x76ff('0x10a')]()||'',_0x13dfb7[_0x76ff('0x10b')]>0x0?_0x1a8b65[_0x76ff('0xe7')][_0x76ff('0xe8')][_0x76ff('0x10c')](_0x13dfb7[_0x76ff('0x10b')]):_0x1a8b65[_0x76ff('0xe7')][_0x76ff('0xe8')]):util[_0x76ff('0x59')](_0x76ff('0x109'),_[_0x76ff('0x6a')](_0x13dfb7['TrunkBackup'])?_0x13dfb7[_0x76ff('0x54')][_0x76ff('0x29')]:_0x13dfb7[_0x76ff('0x9d')][_0x76ff('0x29')],_[_0x76ff('0x6a')](_0x13dfb7[_0x76ff('0x39')])?'':_0x13dfb7[_0x76ff('0x39')][_0x76ff('0x10a')]()||'',_0x13dfb7[_0x76ff('0x10b')]>0x0?_0x1a8b65[_0x76ff('0xe7')][_0x76ff('0xe8')][_0x76ff('0x10c')](_0x13dfb7[_0x76ff('0x10b')]):_0x1a8b65[_0x76ff('0xe7')]['phone']);var _0x4de423=_0x125e35['isTrunkReachable'](_0x13dfb7['Trunk'])?ut[_0x76ff('0x10d')](_0x13dfb7[_0x76ff('0x54')][_0x76ff('0x56')],_0x13dfb7[_0x76ff('0x37')],_0x13dfb7[_0x76ff('0x10e')]>0x0?ut[_0x76ff('0x10f')](_0x13dfb7[_0x76ff('0x38')],_0x13dfb7[_0x76ff('0x10e')]):_0x13dfb7['dialOriginateCallerIdNumber']):ut[_0x76ff('0x10d')](_[_0x76ff('0x6a')](_0x13dfb7['TrunkBackup'])?_0x13dfb7[_0x76ff('0x54')]['callerid']:_0x13dfb7[_0x76ff('0x9d')]['callerid'],_0x13dfb7['dialOriginateCallerIdName'],_0x13dfb7['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x13dfb7[_0x76ff('0x38')],_0x13dfb7[_0x76ff('0x10e')]):_0x13dfb7[_0x76ff('0x38')]);if(_0x4de423){_0x2cd919[_0x76ff('0x110')]=ut[_0x76ff('0x111')](_0x4de423);_0x2cd919[_0x76ff('0x112')]=ut['extractCalleridNumber'](_0x4de423);}var _0x5e0be3=ut[_0x76ff('0x113')](_0x13dfb7,_0x1a8b65,_0x4c19e9,_0x4de423,_0x4272c6,_0x2cd919);_[_0x76ff('0x114')](_0x2cd919,ut[_0x76ff('0x115')](_0x5e0be3));_0x2cd919[_0x76ff('0x8c')]=moment()[_0x76ff('0x59')](_0x76ff('0x8d'));ami[_0x76ff('0x77')](ut[_0x76ff('0x116')](_0x2cd919,_0x13dfb7,_0x5e0be3,_0x2cd919['activeContact'],_0xdbfbca))[_0x76ff('0x84')](function(_0x220097){_0x13dfb7[_0x76ff('0x4d')]+=0x1;logger[_0x76ff('0x6b')](_0x76ff('0x117'),_0x4272c6,_0x76ff('0xaa'),_0x13dfb7[_0x76ff('0x29')],_0x76ff('0x6f'),_0x13dfb7['originated']);_0x2c26a8(_0x220097);})[_0x76ff('0x8b')](function(_0xd4e67f){ut[_0x76ff('0xdc')](_0x2cd919,0xe,_0x76ff('0x118'));rpcDb[_0x76ff('0xdd')](_0x2cd919,_0x76ff('0x119'));_0x592ec9(_0xd4e67f);});});};Preview['prototype'][_0x76ff('0x21')]=function(_0x552b8e){if(this[_0x76ff('0x15')][_0x552b8e[_0x76ff('0xa5')]]){this['actions'][_0x552b8e[_0x76ff('0xa5')]][_0x76ff('0x78')]=_0x552b8e['channel'];}};Preview['prototype'][_0x76ff('0x19')]=function(_0x5e6720){var _0x550556=this;var _0x193374=this[_0x76ff('0x15')][_0x5e6720[_0x76ff('0x11a')]];if(_0x193374){if(_0x193374[_0x76ff('0xe9')]&&this[_0x76ff('0x16')][_0x193374[_0x76ff('0xe9')]]){ut[_0x76ff('0x11b')](_0x193374,this[_0x76ff('0x16')][_0x193374['lookAgent']][_0x76ff('0x29')],this['agents'][_0x193374[_0x76ff('0xe9')]]['id']);}var _0x2a6d3d=_['clone'](_0x193374);_0x2a6d3d[_0x76ff('0xa6')]=moment()[_0x76ff('0x59')](_0x76ff('0x8d'));var _0x3c4a07=_0x550556[_0x76ff('0x12')][_0x193374['queue']];if(ut[_0x76ff('0x11c')](_0x5e6720['response'])){if(_0x193374[_0x76ff('0xbd')]){rpcDb[_0x76ff('0xce')](_0x193374['idContact']);}if(_0x193374[_0x76ff('0xc4')]){rpcDb['disableContact'](_0x193374[_0x76ff('0xcf')]);}ami['emit'](_0x76ff('0x11d'),ut[_0x76ff('0xee')](_0x193374,'rejected'));this[_0x76ff('0xd8')](_0x2a6d3d,_0x3c4a07,_0x5e6720);}else{_0x193374[_0x76ff('0x8c')]=moment()[_0x76ff('0x59')](_0x76ff('0x8d'));ut[_0x76ff('0xdc')](_0x2a6d3d,0x4,'Answer');rpcDb['createAgentHistory'](_0x2a6d3d,_0x76ff('0x11e'));}}};Preview[_0x76ff('0x62')][_0x76ff('0x1b')]=function(_0x1ad830){var _0x24c480=this;var _0x165782=this[_0x76ff('0x15')][_0x1ad830['linkedid']];var _0x31016e;if(_0x165782){_0x31016e=this[_0x76ff('0x12')][_0x165782['queue']];logger[_0x76ff('0x6b')](_0x76ff('0x11f'),_0x1ad830[_0x76ff('0xa5')],_0x76ff('0xaa'),_0x31016e[_0x76ff('0x29')],_0x76ff('0x70'),_0x31016e[_0x76ff('0x2d')]);}if(this[_0x76ff('0x15')][_0x1ad830[_0x76ff('0xa5')]]&&_0x1ad830[_0x76ff('0xa5')]!==_0x1ad830[_0x76ff('0xa9')]){if(_0x1ad830[_0x76ff('0x120')]==='16'&&this[_0x76ff('0x15')][_0x1ad830[_0x76ff('0xa5')]][_0x76ff('0x71')]){this[_0x76ff('0x121')](_0x1ad830,_0x1ad830[_0x76ff('0xa5')],_0x1ad830[_0x76ff('0x120')]);}else if(this[_0x76ff('0x15')][_0x1ad830['linkedid']][_0x76ff('0x71')]){logger[_0x76ff('0x6b')](_0x76ff('0x122'),_0x1ad830[_0x76ff('0xa5')],_0x1ad830['cause'],'\x20Queue',_0x31016e['name'],_0x76ff('0x70'),_0x31016e[_0x76ff('0x2d')]);this[_0x76ff('0x121')](_0x1ad830,_0x1ad830[_0x76ff('0xa5')],_0x1ad830[_0x76ff('0x120')]);}}else if(_0x165782&&_[_0x76ff('0x6a')](_0x165782[_0x76ff('0x123')])&&_0x31016e['dialQueueProject']&&_0x1ad830[_0x76ff('0xa5')]===_0x1ad830[_0x76ff('0xa9')]&&_['isNil'](_0x1ad830[_0x76ff('0xdb')])&&_0x1ad830[_0x76ff('0x120')]==='16'&&_0x1ad830[_0x76ff('0x124')]==='6'&&_[_0x76ff('0xd9')](_0x165782[_0x76ff('0x125')])){if(_0x165782['unlockAgent']){rpcDb['unlockContact'](_0x165782['idContact']);}if(_0x165782[_0x76ff('0xc4')]){rpcDb[_0x76ff('0x126')](_0x165782[_0x76ff('0xcf')]);}_0x1ad830[_0x76ff('0xdb')]='22';this[_0x76ff('0xd8')](_0x165782,_0x31016e,_0x1ad830);}else if(_0x165782&&_0x165782[_0x76ff('0x125')]){if(_0x1ad830[_0x76ff('0x120')]==='16'&&this['actions'][_0x1ad830[_0x76ff('0xa5')]]['dialAnswer']){logger[_0x76ff('0x6b')](_0x76ff('0x127'),_0x1ad830[_0x76ff('0xa5')],_0x1ad830[_0x76ff('0x120')],_0x76ff('0xaa'),_0x31016e['name'],_0x76ff('0x70'),_0x31016e['pTalking']);this[_0x76ff('0x121')](_0x1ad830,_0x1ad830[_0x76ff('0xa5')],_0x1ad830['cause']);}else if(this[_0x76ff('0x15')][_0x1ad830[_0x76ff('0xa5')]][_0x76ff('0x71')]){logger[_0x76ff('0x6b')](_0x76ff('0x122'),_0x1ad830['linkedid'],_0x1ad830['cause'],_0x76ff('0xaa'),_0x31016e[_0x76ff('0x29')],'pTalking:\x20',_0x31016e[_0x76ff('0x2d')]);this[_0x76ff('0x121')](_0x1ad830,_0x1ad830['linkedid'],_0x1ad830[_0x76ff('0x120')]);}}};Preview[_0x76ff('0x62')][_0x76ff('0x1e')]=function(_0x5df09d){if(this[_0x76ff('0x15')][_0x5df09d[_0x76ff('0xd7')]]&&_0x5df09d[_0x76ff('0xd7')]!==_0x5df09d[_0x76ff('0x128')]){this[_0x76ff('0x121')](_0x5df09d,_0x5df09d['destlinkedid'],_0x5df09d['dialstatus']);}};Preview[_0x76ff('0x62')]['syncHangupRequest']=function(_0x50cca5){if(this['actions'][_0x50cca5[_0x76ff('0xa5')]]&&_0x50cca5[_0x76ff('0xa5')]!==_0x50cca5[_0x76ff('0xa9')]&&!this[_0x76ff('0x15')][_0x50cca5[_0x76ff('0xa5')]]['dialAnswer']){if(_0x50cca5[_0x76ff('0x120')]==='1'){this[_0x76ff('0x121')](_0x50cca5,_0x50cca5['linkedid'],_0x50cca5['cause']);}}};Preview['prototype'][_0x76ff('0x129')]=function(_0x38ae13,_0x21acda,_0x47f653){if(this[_0x76ff('0x15')][_0x38ae13]){if(_[_0x76ff('0x6a')](this[_0x76ff('0x15')][_0x38ae13][_0x76ff('0x12a')])){this['actions'][_0x38ae13]['variables']={};}this[_0x76ff('0x15')][_0x38ae13][_0x76ff('0x12a')][_0x21acda]=_0x47f653;}};Preview[_0x76ff('0x62')][_0x76ff('0x23')]=function(_0x36fad7){try{if(!_[_0x76ff('0x6a')](_0x36fad7)){if(ut[_0x76ff('0x12b')](_[_0x76ff('0x12c')](_0x36fad7[_0x76ff('0x12d')])[0x0])){this[_0x76ff('0x129')](_0x36fad7[_0x76ff('0xa9')],_['keys'](_0x36fad7[_0x76ff('0x12d')])[0x0],_0x36fad7[_0x76ff('0x12e')]);}}}catch(_0x8a1c6e){logger['error'](_0x76ff('0x12f'),util[_0x76ff('0x130')](_0x8a1c6e,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x5f35a5){if(_0x5f35a5){if(this[_0x76ff('0x15')][_0x5f35a5['transfertargetlinkedid']]){this[_0x76ff('0x15')][_0x5f35a5[_0x76ff('0x131')]][_0x76ff('0x125')]=!![];}}};Preview[_0x76ff('0x62')][_0x76ff('0x26')]=function(_0x302245){if(_0x302245){if(this[_0x76ff('0x15')][_0x302245[_0x76ff('0x132')]]){this[_0x76ff('0x15')][_0x302245['transfererlinkedid']][_0x76ff('0x125')]=!![];}}};module[_0x76ff('0x133')]=Preview;
\ No newline at end of file
+var _0x30f1=['outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','campaignsPreview','booked','clearZombieChannels','outbound','setMessage','recallMe','prototype','clearZombieChannel','enqueue','isNil','actions','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','run','logger2','[RecallMe]','catch','starttime','logCustomer','RecallInQueue','dialRecallInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','NoSuchNumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','cloneAction','Global','createCustomerFinal','linkedid','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','scheduledAt','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','idContact','disableContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlock','unlockContact','recallme','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Agent','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','clone','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./util/util','redis','defaults','localhost','socket.io-emitter','tail','voiceQueues','trunks','agents','clockClearZombieChannels','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','loggedIn','pTalking','sumBillable','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay'];(function(_0x27f672,_0x4cad4d){var _0x1be11e=function(_0x2802b1){while(--_0x2802b1){_0x27f672['push'](_0x27f672['shift']());}};_0x1be11e(++_0x4cad4d);}(_0x30f1,0x101));var _0x130f=function(_0x28178c,_0x40f3b9){_0x28178c=_0x28178c-0x0;var _0x12428e=_0x30f1[_0x28178c];return _0x12428e;};'use strict';var util=require(_0x130f('0x0'));var _=require('lodash');var BPromise=require(_0x130f('0x1'));var uuid=require(_0x130f('0x2'));var moment=require(_0x130f('0x3'));var md5=require(_0x130f('0x4'));var Redis=require(_0x130f('0x5'));var config=require('../../../config/environment');var logger=require(_0x130f('0x6'))(_0x130f('0x7'));var loggerAction=require(_0x130f('0x6'))(_0x130f('0x8'));var ami=require(_0x130f('0x9'));var rpcDb=require('./rpcDb');var Action=require('./action');var ut=require(_0x130f('0xa'));config[_0x130f('0xb')]=_[_0x130f('0xc')](config[_0x130f('0xb')],{'host':_0x130f('0xd'),'port':0x18eb});var io=require(_0x130f('0xe'))(new Redis(config[_0x130f('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xff4218){this[_0x130f('0xf')]=this['tail']?this['tail']['finally'](_0xff4218):_0xff4218();};function Preview(_0x1fac0a){this['sequence']=new Sequence();this['campaignsPreview']=_0x1fac0a[_0x130f('0x10')];this[_0x130f('0x11')]=_0x1fac0a[_0x130f('0x11')];this['actions']={};this[_0x130f('0x12')]=_0x1fac0a['agents'];this[_0x130f('0x13')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x130f('0x14')](this));ami['on'](_0x130f('0x15'),this['syncHangup'][_0x130f('0x14')](this));ami['on'](_0x130f('0x16'),this[_0x130f('0x17')][_0x130f('0x14')](this));ami['on']('dialend',this[_0x130f('0x18')][_0x130f('0x14')](this));ami['on'](_0x130f('0x19'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0x130f('0x1a')]['bind'](this));ami['on'](_0x130f('0x1b'),this[_0x130f('0x1c')]['bind'](this));ami['on'](_0x130f('0x1d'),this[_0x130f('0x1e')][_0x130f('0x14')](this));this[_0x130f('0x1f')](this['campaignsPreview']);}function emit(_0xcabd8f,_0x2ecf21,_0x23360e){io['to'](_0xcabd8f)[_0x130f('0x20')](_0x2ecf21,_0x23360e);}function emitCampaignPreview(_0x4b4a5b){if(_0x4b4a5b[_0x130f('0x21')]==='outbound'){var _0x501154={'id':_0x4b4a5b['id'],'name':_0x4b4a5b[_0x130f('0x22')],'strategy':_0x4b4a5b[_0x130f('0x23')],'answered':_0x4b4a5b[_0x130f('0x24')],'available':_0x4b4a5b['available'],'loggedIn':_0x4b4a5b[_0x130f('0x25')],'pTalking':_0x4b4a5b[_0x130f('0x26')],'sumBillable':_0x4b4a5b[_0x130f('0x27')],'sumDuration':_0x4b4a5b['sumDuration'],'sumHoldTime':_0x4b4a5b['sumHoldTime']||0x0,'talking':_0x4b4a5b[_0x130f('0x28')],'total':_0x4b4a5b[_0x130f('0x29')],'type':_0x4b4a5b['type'],'unmanaged':_0x4b4a5b[_0x130f('0x2a')],'abandoned':_0x4b4a5b['abandoned'],'waiting':_0x4b4a5b['waiting'],'loggedInDb':_0x4b4a5b[_0x130f('0x2b')],'dialActive':_0x4b4a5b[_0x130f('0x2c')],'dialMethod':_0x4b4a5b[_0x130f('0x2d')],'dialOriginateCallerIdName':_0x4b4a5b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4b4a5b[_0x130f('0x2e')],'dialOriginateTimeout':_0x4b4a5b[_0x130f('0x2f')],'dialPrefix':_0x4b4a5b[_0x130f('0x30')],'outboundAnswerAgiCallsDay':_0x4b4a5b[_0x130f('0x31')],'outboundAnswerCallsDay':_0x4b4a5b[_0x130f('0x32')],'outboundBlacklistCallsDay':_0x4b4a5b[_0x130f('0x33')],'outboundBusyCallsDay':_0x4b4a5b[_0x130f('0x34')],'outboundCongestionCallsDay':_0x4b4a5b[_0x130f('0x35')],'outboundDropCallsDayACS':_0x4b4a5b[_0x130f('0x36')],'outboundDropCallsDayCallersExit':_0x4b4a5b['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x4b4a5b[_0x130f('0x37')],'outboundNoAnswerCallsDay':_0x4b4a5b['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4b4a5b['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4b4a5b[_0x130f('0x38')],'outboundReCallsDay':_0x4b4a5b[_0x130f('0x39')],'outboundRejectCallsDay':_0x4b4a5b[_0x130f('0x3a')],'outboundUnknownCallsDay':_0x4b4a5b['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4b4a5b[_0x130f('0x3b')],'predictiveIntervalAvgHoldtime':_0x4b4a5b[_0x130f('0x3c')],'predictiveIntervalAvgTalktime':_0x4b4a5b['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4b4a5b[_0x130f('0x3d')],'predictiveIntervalDroppedCallsTimeout':_0x4b4a5b['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4b4a5b[_0x130f('0x3e')],'predictiveIntervalErlangCallsDroppedCalls':_0x4b4a5b[_0x130f('0x3f')],'predictiveIntervalHitRate':_0x4b4a5b[_0x130f('0x40')],'predictiveIntervalMultiplicativeFactor':_0x4b4a5b[_0x130f('0x41')],'predictiveIntervalPauses':_0x4b4a5b[_0x130f('0x42')],'predictiveIntervalAvailable':_0x4b4a5b[_0x130f('0x43')],'predictiveIntervalTotalCalls':_0x4b4a5b[_0x130f('0x44')],'message':_0x4b4a5b[_0x130f('0x45')],'originated':_0x4b4a5b[_0x130f('0x46')],'erlangCalls':_0x4b4a5b[_0x130f('0x47')],'erlangCallToSecond':_0x4b4a5b[_0x130f('0x48')],'erlangAbandonmentRate':_0x4b4a5b['erlangAbandonmentRate'],'erlangBusyFactor':_0x4b4a5b[_0x130f('0x49')],'startPredictive':_0x4b4a5b[_0x130f('0x4a')],'startProgressive':_0x4b4a5b[_0x130f('0x4b')]};if(_0x4b4a5b['Trunk']){_0x501154[_0x130f('0x4c')]={'id':_0x4b4a5b[_0x130f('0x4c')]['id'],'name':_0x4b4a5b[_0x130f('0x4c')][_0x130f('0x22')],'active':_0x4b4a5b[_0x130f('0x4c')][_0x130f('0x4d')],'callerid':_0x4b4a5b['Trunk']['callerid']};}if(_0x4b4a5b[_0x130f('0x4e')]){_0x501154[_0x130f('0x4e')]={'id':_0x4b4a5b['Interval']['id'],'name':_0x4b4a5b[_0x130f('0x4e')]['name']};}var _0x442e00=md5(JSON[_0x130f('0x4f')](_0x501154));if(_0x4b4a5b['md5']!==_0x442e00){_0x4b4a5b[_0x130f('0x4')]=_0x442e00;emit(util[_0x130f('0x50')](_0x130f('0x51'),_0x501154[_0x130f('0x22')]),_0x130f('0x52'),_0x501154);}}}function emitVoiceQueueChannelRemove(_0x557038){emit(util['format'](_0x130f('0x51'),_0x557038[_0x130f('0x22')]),_0x130f('0x53'),_0x557038);}function notSendMessagesQueue(_0x302e33){if(_0x302e33[_0x130f('0x54')]){if(_0x302e33['originated']===0x0&&_0x302e33['pTalking']===0x0){_0x302e33[_0x130f('0x54')]=![];_0x302e33[_0x130f('0x55')]=0x0;_0x302e33[_0x130f('0x56')]=0x0;_0x302e33['message']='NOT_ACTIVE';ut['logger'](_0x130f('0x57'),_0x302e33[_0x130f('0x22')]+_0x130f('0x58'));}else{_0x302e33[_0x130f('0x45')]=_0x130f('0x59');ut[_0x130f('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x302e33['name']+_0x130f('0x5b'));}emitCampaignPreview(_0x302e33);}}Preview['prototype'][_0x130f('0x1f')]=function(){var _0x430450=this;setInterval(function(){_0x430450[_0x130f('0x5c')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x2950e8=this[_0x130f('0x5d')];this['clockClearZombieChannels']+=0x1;for(var _0x539c99 in _0x2950e8){if(_0x2950e8['hasOwnProperty'](_0x539c99)&&(_0x2950e8[_0x539c99][_0x130f('0x2d')]===_0x130f('0x7')||_0x2950e8[_0x539c99][_0x130f('0x2d')]===_0x130f('0x5e'))&&_0x2950e8[_0x539c99][_0x130f('0x21')]==='outbound'){if(this[_0x130f('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x130f('0x5f')]();}}if(_0x2950e8['hasOwnProperty'](_0x539c99)&&_0x2950e8[_0x539c99][_0x130f('0x2d')]===_0x130f('0x7')&&_0x2950e8[_0x539c99][_0x130f('0x21')]===_0x130f('0x60')){if(_0x2950e8[_0x539c99]['dialActive']){this[_0x130f('0x61')](_0x2950e8[_0x539c99]);this[_0x130f('0x62')](_0x2950e8[_0x539c99]);}else{notSendMessagesQueue(_0x2950e8[_0x539c99]);}}}};Preview[_0x130f('0x63')][_0x130f('0x64')]=function(_0x457e4e){var _0x2b017b=this;this['sequence'][_0x130f('0x65')](function(){if(!_[_0x130f('0x66')](_0x2b017b[_0x130f('0x67')][_0x457e4e])){loggerAction[_0x130f('0x68')](_0x130f('0x69'),_0x457e4e,_0x130f('0x6a'),_0x2b017b[_0x130f('0x67')][_0x457e4e]['queue'],_0x130f('0x6b'),JSON[_0x130f('0x4f')](_0x2b017b[_0x130f('0x5d')][_0x2b017b[_0x130f('0x67')][_0x457e4e][_0x130f('0x6c')]][_0x130f('0x46')]),'pTalking:\x20',JSON['stringify'](_0x2b017b[_0x130f('0x5d')][_0x2b017b['actions'][_0x457e4e][_0x130f('0x6c')]][_0x130f('0x26')]),JSON[_0x130f('0x4f')](_0x2b017b[_0x130f('0x67')][_0x457e4e][_0x130f('0x6d')]),JSON[_0x130f('0x4f')](_[_0x130f('0x6e')](_0x2b017b[_0x130f('0x67')][_0x457e4e],[_0x130f('0x6f'),_0x130f('0x70'),_0x130f('0x71'),_0x130f('0x72')])));return ami[_0x130f('0x73')]({'action':_0x130f('0x74'),'channel':_0x2b017b[_0x130f('0x67')][_0x457e4e]['channel']})['catch'](function(_0x29dc89){if(_0x29dc89[_0x130f('0x45')]===_0x130f('0x75')){setTimeout(function(){if(_0x2b017b[_0x130f('0x67')][_0x457e4e]){ut[_0x130f('0x76')](_0x2b017b[_0x130f('0x5d')][_0x2b017b[_0x130f('0x67')][_0x457e4e][_0x130f('0x6c')]],_0x130f('0x77'));if(_0x2b017b[_0x130f('0x67')][_0x457e4e][_0x130f('0x6d')]===!![]){ut[_0x130f('0x78')](_0x2b017b[_0x130f('0x5d')][_0x2b017b[_0x130f('0x67')][_0x457e4e][_0x130f('0x6c')]],_0x130f('0x77'));ut[_0x130f('0x79')](_0x130f('0x7a')+_0x457e4e,_0x2b017b[_0x130f('0x67')][_0x457e4e][_0x130f('0x6c')]);}ut[_0x130f('0x79')](_0x130f('0x7b')+_0x457e4e,_0x2b017b[_0x130f('0x67')][_0x457e4e]['queue']);delete _0x2b017b[_0x130f('0x67')][_0x457e4e];}},0x2328);}});}});};Preview['prototype'][_0x130f('0x5f')]=function(){var _0x3ba3bd=this;loggerAction[_0x130f('0x68')](_0x130f('0x7c'),_[_0x130f('0x7d')](this['actions']));for(var _0x4be197 in this[_0x130f('0x67')]){if(_0x3ba3bd[_0x130f('0x67')][_0x130f('0x7e')](_0x4be197)){_0x3ba3bd[_0x130f('0x64')](_0x4be197);}}};Preview[_0x130f('0x63')][_0x130f('0x62')]=function(_0x34a571){var _0x51f565=this;rpcDb[_0x130f('0x7f')](_0x34a571['id'],ut[_0x130f('0x80')](this['agents']))[_0x130f('0x81')](function(_0x663a56){if(!_[_0x130f('0x66')](_0x663a56)){for(var _0x2a9953=0x0;_0x2a9953<_0x663a56[_0x130f('0x82')];_0x2a9953+=0x1){if(ut[_0x130f('0x83')](_0x663a56[_0x2a9953]['scheduledat'])<_0x34a571[_0x130f('0x84')]*0x3c){_0x51f565[_0x130f('0x85')](_0x663a56[_0x2a9953]['id'])[_0x130f('0x81')](ut[_0x130f('0x86')](_0x130f('0x87')))[_0x130f('0x88')](ut[_0x130f('0x86')]('[RecallMe]'));}else{var _0x12122c=new Action(_0x663a56[_0x2a9953],_0x34a571);_0x12122c[_0x130f('0x89')]=moment()[_0x130f('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x34a571[_0x130f('0x39')]+=0x1;ut[_0x130f('0x8a')](_0x12122c,0x17,_0x130f('0x8b'));if(_0x34a571[_0x130f('0x8c')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x663a56[_0x2a9953]));rpcDb['createCustomerHistory'](_0x12122c,_0x130f('0x8d'));}else{ut[_0x130f('0x8a')](_0x12122c,0x16,_0x130f('0x8e'));rpcDb['createCustomerHistory'](_0x12122c,_0x130f('0x8f'));rpcDb['createCustomerFinal'](_0x12122c,_0x130f('0x8f'));}}}}})[_0x130f('0x88')](ut['logger2'](_0x130f('0x90')));};Preview['prototype'][_0x130f('0x61')]=function(_0x3b4414){_0x3b4414[_0x130f('0x54')]=!![];if(ut[_0x130f('0x91')](_0x3b4414[_0x130f('0x25')])){_0x3b4414[_0x130f('0x45')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x130f('0x92')](_0x3b4414[_0x130f('0x2c')])){_0x3b4414[_0x130f('0x45')]='NOT_ACTIVE';}else if(!this[_0x130f('0x93')](_0x3b4414[_0x130f('0x4c')])){if(!this['isTrunkReachable'](_0x3b4414[_0x130f('0x94')])){_0x3b4414[_0x130f('0x45')]=_0x130f('0x95');}else{_0x3b4414[_0x130f('0x45')]='ACTIVE';}}else{_0x3b4414[_0x130f('0x45')]=_0x130f('0x96');}emitCampaignPreview(_0x3b4414);};Preview[_0x130f('0x63')][_0x130f('0x97')]=function(_0x922511,_0x1f1921,_0x4ca370){var _0x4aa517=this;var _0x136986=this[_0x130f('0x67')][_0x1f1921];var _0x3b3f24=this[_0x130f('0x5d')][_0x136986[_0x130f('0x6c')]];var _0x166802;if(_0x3b3f24){switch(_0x4ca370){case'1':_0x3b3f24[_0x130f('0x98')]+=0x1;_0x136986[_0x130f('0x99')]=ut['totalGlobal'](_0x136986);ut[_0x130f('0x8a')](_0x136986,0x0,_0x130f('0x9a'));rpcDb[_0x130f('0x9b')](_0x136986,_0x130f('0x9c'));if(ut[_0x130f('0x9d')](_0x136986)>=_0x3b3f24['dialGlobalMaxRetry']){_0x166802=ut[_0x130f('0x9e')](_0x136986,0xf,_0x130f('0x9f'));rpcDb[_0x130f('0xa0')](_0x166802,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x130f('0xa0')](_0x136986,'[callProgressDetectingCustomer][logNoSuchGlobal]');}delete this[_0x130f('0x67')][_0x922511[_0x130f('0xa1')]];break;case _0x130f('0xa2'):var _0x4b234e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x136986[_0x130f('0xa3')]=_0x4b234e;_0x136986['answertime']=_0x4b234e;_0x136986[_0x130f('0x6d')]=!![];_0x3b3f24[_0x130f('0x26')]+=0x1;logger['info'](_0x130f('0xa4'),_0x136986[_0x130f('0xa5')],_0x130f('0xa6'),_0x3b3f24[_0x130f('0x22')],_0x130f('0xa7'),_0x3b3f24[_0x130f('0x26')]);ami[_0x130f('0x20')](_0x130f('0xa8'),ut[_0x130f('0xa9')](_0x136986,_0x130f('0xaa')));if(_0x3b3f24[_0x130f('0xab')]){ami[_0x130f('0x20')](_0x130f('0xac'),ut[_0x130f('0xad')](_0x136986));}break;case'16':ami[_0x130f('0x20')](_0x130f('0xae'),ut['buildObj'](_0x136986,'complete'));emitVoiceQueueChannelRemove(ut[_0x130f('0xa9')](_0x136986,'complete'));_0x3b3f24[_0x130f('0x32')]+=0x1;_0x3b3f24['total']+=0x1;_0x3b3f24['answered']+=0x1;ut['decrementTalkink'](_0x3b3f24,_0x130f('0xaf'));_0x136986[_0x130f('0x99')]=ut[_0x130f('0x9d')](_0x136986);ut[_0x130f('0x8a')](_0x136986,0x4,_0x130f('0xb0'));rpcDb[_0x130f('0x9b')](_0x136986,_0x130f('0xb1'));rpcDb[_0x130f('0xa0')](_0x136986,_0x130f('0xb2'));rpcDb[_0x130f('0xb3')](_0x136986);_0x3b3f24[_0x130f('0xb4')]+=_0x136986['talktime'];_0x3b3f24[_0x130f('0x27')]+=_0x136986[_0x130f('0xb5')];logger[_0x130f('0x68')](_0x130f('0xb6'),_0x136986[_0x130f('0xa5')],_0x130f('0xa6'),_0x3b3f24[_0x130f('0x22')],_0x130f('0xa7'),_0x3b3f24['pTalking']);delete this[_0x130f('0x67')][_0x922511[_0x130f('0xa1')]];break;case'BUSY':_0x3b3f24[_0x130f('0x34')]+=0x1;_0x136986[_0x130f('0xb7')]+=0x1;_0x136986[_0x130f('0x99')]=ut[_0x130f('0x9d')](_0x136986);ut['logCustomer'](_0x136986,0x5,_0x130f('0xb8'));rpcDb[_0x130f('0x9b')](_0x136986,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x130f('0x9d')](_0x136986)>=_0x3b3f24[_0x130f('0xb9')]){_0x166802=ut[_0x130f('0x9e')](_0x136986,0xf,_0x130f('0x9f'));rpcDb[_0x130f('0xa0')](_0x166802,_0x130f('0xba'));}else{if(_0x136986[_0x130f('0xb7')]>=_0x3b3f24[_0x130f('0xbb')]){rpcDb[_0x130f('0xa0')](_0x136986,_0x130f('0xbc'));}else{rpcDb[_0x130f('0xbd')](ut[_0x130f('0xbe')](_0x136986,_0x130f('0xb7'),_0x3b3f24[_0x130f('0xbf')]),_0x136986[_0x130f('0xc0')],_0x136986[_0x130f('0xc1')]);}}break;case _0x130f('0xc2'):_0x3b3f24['outboundNoAnswerCallsDay']+=0x1;_0x136986['countnoanswerretry']+=0x1;_0x136986[_0x130f('0x99')]=ut['totalGlobal'](_0x136986);ut['logCustomer'](_0x136986,0x3,_0x130f('0xc3'));rpcDb[_0x130f('0x9b')](_0x136986,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x130f('0x9d')](_0x136986)>=_0x3b3f24[_0x130f('0xb9')]){_0x166802=ut['cloneAction'](_0x136986,0xf,'Global');rpcDb['createCustomerFinal'](_0x166802,_0x130f('0xc4'));}else{if(_0x136986[_0x130f('0xc5')]>=_0x3b3f24[_0x130f('0xc6')]){rpcDb['createCustomerFinal'](_0x136986,_0x130f('0xc7'));}else{rpcDb[_0x130f('0xbd')](ut[_0x130f('0xbe')](_0x136986,_0x130f('0xc5'),_0x3b3f24[_0x130f('0xc8')]),_0x136986[_0x130f('0xc0')],_0x136986[_0x130f('0xc1')]);}}break;case _0x130f('0xc9'):_0x3b3f24['outboundCongestionCallsDay']+=0x1;_0x136986[_0x130f('0xca')]+=0x1;_0x136986[_0x130f('0x99')]=ut['totalGlobal'](_0x136986);ut[_0x130f('0x8a')](_0x136986,0x8,_0x130f('0xcb'));rpcDb[_0x130f('0x9b')](_0x136986,_0x130f('0xcc'));if(ut[_0x130f('0x9d')](_0x136986)>=_0x3b3f24['dialGlobalMaxRetry']){_0x166802=ut['cloneAction'](_0x136986,0xf,_0x130f('0x9f'));rpcDb[_0x130f('0xa0')](_0x166802,_0x130f('0xcd'));}else{if(_0x136986[_0x130f('0xca')]>=_0x3b3f24['dialCongestionMaxRetry']){rpcDb[_0x130f('0xa0')](_0x136986,_0x130f('0xcc'));}else{rpcDb[_0x130f('0xbd')](ut[_0x130f('0xbe')](_0x136986,_0x130f('0xca'),_0x3b3f24[_0x130f('0xbf')]),_0x136986[_0x130f('0xc0')],_0x136986[_0x130f('0xc1')]);}}break;case _0x130f('0xce'):_0x3b3f24[_0x130f('0x3a')]+=0x1;_0x136986[_0x130f('0x99')]=ut[_0x130f('0x9d')](_0x136986);ut[_0x130f('0x8a')](_0x136986,0x14,_0x130f('0xcf'));rpcDb[_0x130f('0x9b')](_0x136986,_0x130f('0xd0'));if(_0x136986['unlockAgent']){rpcDb['unlockContact'](_0x136986[_0x130f('0xd1')]);}if(_0x136986[_0x130f('0xc1')]){rpcDb[_0x130f('0xd2')](_0x136986[_0x130f('0xd1')]);}break;default:if(_0x136986[_0x130f('0x6d')]){ut['decrementTalkink'](_0x3b3f24,_0x130f('0xd3'));ut['loggerError'](_0x130f('0xd4')+_0x3b3f24[_0x130f('0x22')],_0x922511);}_0x3b3f24[_0x130f('0xd5')]+=0x1;_0x136986[_0x130f('0x99')]=ut[_0x130f('0x9d')](_0x136986);ut[_0x130f('0x8a')](_0x136986,0xc,_0x922511[_0x130f('0xd6')]||_0x922511['dialstatus']);rpcDb['createCustomerHistory'](_0x136986,_0x130f('0xd7'));if(ut['totalGlobal'](_0x136986)>=_0x3b3f24[_0x130f('0xb9')]){_0x166802=ut[_0x130f('0x9e')](_0x136986,0xf,_0x130f('0x9f'));rpcDb[_0x130f('0xa0')](_0x166802,_0x130f('0xd8'));}else{rpcDb[_0x130f('0xa0')](_0x136986,_0x130f('0xd8'));}delete this[_0x130f('0x67')][_0x922511['linkedid']];}if(!(_0x136986['dialAnswer']&&_0x4ca370==='16')){ut[_0x130f('0x76')](_0x3b3f24,_0x130f('0xd9'));logger['info'](_0x130f('0xda'),_0x136986['uniqueid'],'\x20Queue',_0x3b3f24['name'],_0x130f('0x6b'),_0x3b3f24[_0x130f('0x46')]);}if(_0x4ca370!=='ANSWER'){delete this[_0x130f('0x67')][_0x922511['linkedid']];delete this[_0x130f('0x67')][_0x922511[_0x130f('0xdb')]];}}};Preview[_0x130f('0x63')][_0x130f('0xdc')]=function(_0x46bd5e,_0x416c22,_0x575744){if(_[_0x130f('0xdd')](_0x416c22)&&_0x130f('0xde')!==typeof _0x416c22){return;}if(_[_0x130f('0xdd')](_0x575744)&&_0x130f('0xde')!==typeof _0x575744){return;}switch(_0x575744['reason']){case'0':ut[_0x130f('0xdf')](_0x46bd5e,0x0,_0x130f('0x9a'));rpcDb[_0x130f('0xe0')](_0x46bd5e,_0x130f('0xe1'));break;case'3':ut['logAgent'](_0x46bd5e,0x3,_0x130f('0xc3'));rpcDb[_0x130f('0xe0')](_0x46bd5e,_0x130f('0xe2'));break;case'5':ut[_0x130f('0xdf')](_0x46bd5e,0x5,_0x130f('0xb8'));rpcDb[_0x130f('0xe0')](_0x46bd5e,_0x130f('0xe3'));break;case'8':ut[_0x130f('0xdf')](_0x46bd5e,0x8,_0x130f('0xcb'));rpcDb[_0x130f('0xe0')](_0x46bd5e,_0x130f('0xe4'));break;case'22':ut[_0x130f('0xdf')](_0x46bd5e,0x16,'AnswerAGI');rpcDb[_0x130f('0xe0')](_0x46bd5e,_0x130f('0xe5'));break;default:ut['logAgent'](_0x46bd5e,0xc,_0x575744[_0x130f('0xe6')]);rpcDb['createAgentHistory'](_0x46bd5e,_0x130f('0xe4'));}ut['updateOriginated'](_0x416c22,_0x130f('0xe7'));logger[_0x130f('0x68')](_0x130f('0xe8'),_0x46bd5e[_0x130f('0xa5')],'\x20Queue',_0x416c22[_0x130f('0x22')],'originated:\x20',_0x416c22[_0x130f('0x46')]);delete this[_0x130f('0x67')][_0x46bd5e['uniqueid']];};Preview['prototype'][_0x130f('0xe9')]=function(_0x221734,_0x1a46bd,_0x3ae92b,_0x63e592,_0x54c849){var _0x304068=this;return new BPromise(function(_0x3a123e,_0x5e3a04){if(_['isNil'](_0x1a46bd)||_[_0x130f('0x66')](_0x1a46bd[_0x130f('0xea')])||_['isNil'](_0x1a46bd[_0x130f('0xea')][_0x130f('0xeb')])||_[_0x130f('0x66')](_0x1a46bd[_0x130f('0x71')])){_0x5e3a04(ut[_0x130f('0x45')]('Contact\x20is\x20undefined',_0x63e592,_0x54c849));return;}var _0x2ea5d8=uuid['v4']();var _0x2c2af7=_0x304068[_0x130f('0x5d')][_0x1a46bd[_0x130f('0x6a')]['name']];var _0x548e40=_0x3ae92b?_0x304068['agents'][_0x3ae92b]['id']:undefined;_0x304068[_0x130f('0x67')][_0x2ea5d8]=new Action(_0x1a46bd,_0x2c2af7,_0x2ea5d8,_0x3ae92b,_0x548e40);var _0x2283d4=_0x304068['actions'][_0x2ea5d8];_0x2283d4[_0x130f('0xc0')]=_0x63e592;_0x2283d4[_0x130f('0xc1')]=_0x54c849;_0x2283d4['lookAgent']=_0x3ae92b;if(_['isEmpty'](_0x221734)){_0x304068['execCall'](_0x2283d4,_0x2c2af7,_0x1a46bd,_0x3ae92b)[_0x130f('0x81')](function(_0x5509fa){logger[_0x130f('0x68')]('[Preview][execCall][success]',_0x130f('0xec')+_0x2283d4[_0x130f('0x6c')]+_0x130f('0xed')+_0x2283d4['idContact'],JSON[_0x130f('0x4f')](_0x5509fa));ami[_0x130f('0x20')](_0x130f('0xee'),ut['buildObj'](_0x2283d4,_0x130f('0xef')));_0x3a123e(ut[_0x130f('0x45')](_0x130f('0xf0')));})[_0x130f('0x88')](function(_0x1ba114){ut[_0x130f('0x5a')]('[Preview][execCall][failure]',_0x1ba114);_0x5e3a04(ut[_0x130f('0x45')]('Call\x20failed',_0x63e592,_0x54c849));});}else{_0x2c2af7[_0x130f('0x33')]+=0x1;ut[_0x130f('0xf1')](_0x2283d4);rpcDb[_0x130f('0xf2')](_0x2283d4,_0x130f('0xf3'));delete _0x304068[_0x130f('0x67')][_0x2ea5d8];_0x5e3a04(ut[_0x130f('0x45')](_0x130f('0xf4'),_0x63e592,_0x54c849));}});};Preview[_0x130f('0x63')]['isTrunkReachable']=function(_0x1b2e1b){return!_[_0x130f('0x66')](_0x1b2e1b)&&!_[_0x130f('0x66')](_0x1b2e1b[_0x130f('0x22')])&&!_[_0x130f('0x66')](_0x1b2e1b[_0x130f('0x4d')])&&_0x1b2e1b[_0x130f('0x4d')]&&!_[_0x130f('0x66')](this[_0x130f('0x11')][util[_0x130f('0x50')](_0x130f('0xf5'),_0x1b2e1b['name'])])&&!_[_0x130f('0x66')](this['trunks'][util[_0x130f('0x50')]('SIP/%s',_0x1b2e1b[_0x130f('0x22')])]['status'])&&(this[_0x130f('0x11')][util[_0x130f('0x50')](_0x130f('0xf5'),_0x1b2e1b[_0x130f('0x22')])][_0x130f('0x74')]==='reachable'||this['trunks'][util[_0x130f('0x50')]('SIP/%s',_0x1b2e1b['name'])][_0x130f('0x74')]===_0x130f('0xf6'));};Preview[_0x130f('0x63')][_0x130f('0x85')]=function(_0x5a10f3,_0x4eb4e1){var _0x3beb54=this;return new BPromise(function(_0x35d1b3,_0x143d0d){_0x3beb54[_0x130f('0xf7')](_0x5a10f3,_0x4eb4e1)['then'](function(_0x261029){_0x35d1b3(_[_0x130f('0x6e')](_0x261029,[_0x130f('0x45')]));})['catch'](function(_0x35b65d){if(_0x35b65d[_0x130f('0xf8')]){rpcDb[_0x130f('0xf9')](_0x5a10f3);}if(_0x35b65d[_0x130f('0x4d')]){rpcDb['disableContact'](_0x5a10f3);}_0x143d0d(_[_0x130f('0x6e')](_0x35b65d,[_0x130f('0x45')]));});});};Preview[_0x130f('0x63')][_0x130f('0xf7')]=function(_0x5c187a,_0x4baf7b){var _0x527373=this;return new BPromise(function(_0x6a3574,_0xc66ecf){var _0x698c8b,_0x623032;rpcDb['getContactPreview'](_0x5c187a)[_0x130f('0x81')](function(_0xf7c648){if(!_[_0x130f('0x66')](_0xf7c648[0x0])){_0x623032=_0xf7c648[0x0][_0x130f('0xfa')]?![]:!![];_0x698c8b=_0xf7c648[0x0][_0x130f('0xfa')]?!![]:![];_0x698c8b=_0x4baf7b?!![]:_0x698c8b;}var _0x3c3b7f=_0x527373['validateContact'](_0xf7c648);if(_0x3c3b7f[_0x130f('0xfb')]){rpcDb['checkIsBlackList'](_[_0x130f('0x6e')](_0xf7c648[0x0],[_0x130f('0x71'),'Contact.phone']))['then'](function(_0x339117){_0x527373[_0x130f('0xe9')](_0x339117,_0xf7c648[0x0],_0x4baf7b,_0x623032,_0x698c8b)[_0x130f('0x81')](function(_0x557916){_0x6a3574(_0x557916);})[_0x130f('0x88')](function(_0x5ea459){_0xc66ecf(_0x5ea459);});})[_0x130f('0x88')](function(_0x3b9428){ut[_0x130f('0x5a')](_0x130f('0xfc'),_0x3b9428);_0xc66ecf(ut[_0x130f('0x45')](_0x130f('0xfd'),_0x623032,_0x698c8b));});}else{_0xc66ecf(ut['message'](_0x3c3b7f[_0x130f('0x45')],_0x623032,_0x698c8b));}})['catch'](function(_0x4d5362){ut[_0x130f('0x5a')]('[Preview][getContactPreview]',_0x4d5362);_0xc66ecf(ut[_0x130f('0x45')](_0x130f('0xfd'),![],!![]));});});};Preview[_0x130f('0x63')]['validateContact']=function(_0x1746a7){if(_[_0x130f('0x66')](_0x1746a7)||_[_0x130f('0xfe')](_0x1746a7)||!_[_0x130f('0x66')](_0x1746a7[0x0][_0x130f('0xff')])&&_[_0x130f('0x66')](_0x1746a7[0x0][_0x130f('0xff')]['name'])){ut[_0x130f('0x5a')](_0x130f('0x100'),_0x1746a7);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2a746=this['campaignsPreview'][_0x1746a7[0x0][_0x130f('0x6a')]['name']];_0x2a746[_0x130f('0x45')]=_0x130f('0x96');if(_[_0x130f('0x66')](_0x2a746)){ut[_0x130f('0x5a')](_0x130f('0x101'),_0x2a746);return{'isValid':![],'message':_0x130f('0x102')};}if(!this[_0x130f('0x93')](_0x2a746[_0x130f('0x4c')])){ut[_0x130f('0x5a')](_0x130f('0x103'),'campaign\x20Name:\x20'+_0x2a746[_0x130f('0x22')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x130f('0x93')](_0x2a746[_0x130f('0x94')])){ut[_0x130f('0x5a')](_0x130f('0x103'),_0x2a746['name']+_0x130f('0x104'));return{'isValid':![],'message':_0x130f('0x105')};}}if(!ut['isActive'](_0x2a746[_0x130f('0x2c')])){ut[_0x130f('0x5a')](_0x130f('0x106'),_0x2a746['name']+_0x130f('0x107'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2a746[_0x130f('0x22')]+_0x130f('0x107')};}return{'isValid':!![],'message':_0x130f('0x108')};};Preview[_0x130f('0x63')][_0x130f('0x109')]=function(_0x422f0a,_0x15ea4c,_0x47bb5b,_0x56aa26){var _0x8f2e7f=this;return new BPromise(function(_0x576179,_0x16e940){var _0x3f44f8=_0x422f0a[_0x130f('0xa5')];var _0x378ad6=_0x8f2e7f[_0x130f('0x93')](_0x15ea4c[_0x130f('0x4c')])?util['format'](_0x130f('0x10a'),_0x15ea4c['Trunk'][_0x130f('0x22')],_[_0x130f('0x66')](_0x15ea4c['dialPrefix'])?'':_0x15ea4c[_0x130f('0x30')][_0x130f('0x10b')]()||'',_0x15ea4c[_0x130f('0x10c')]>0x0?_0x47bb5b[_0x130f('0xea')][_0x130f('0xeb')][_0x130f('0x10d')](_0x15ea4c[_0x130f('0x10c')]):_0x47bb5b['Contact']['phone']):util['format'](_0x130f('0x10a'),_['isNil'](_0x15ea4c[_0x130f('0x94')])?_0x15ea4c[_0x130f('0x4c')][_0x130f('0x22')]:_0x15ea4c[_0x130f('0x94')][_0x130f('0x22')],_[_0x130f('0x66')](_0x15ea4c['dialPrefix'])?'':_0x15ea4c['dialPrefix'][_0x130f('0x10b')]()||'',_0x15ea4c[_0x130f('0x10c')]>0x0?_0x47bb5b[_0x130f('0xea')][_0x130f('0xeb')][_0x130f('0x10d')](_0x15ea4c[_0x130f('0x10c')]):_0x47bb5b[_0x130f('0xea')][_0x130f('0xeb')]);var _0x5011c6=_0x8f2e7f[_0x130f('0x93')](_0x15ea4c[_0x130f('0x4c')])?ut[_0x130f('0x10e')](_0x15ea4c['Trunk'][_0x130f('0x10f')],_0x15ea4c[_0x130f('0x110')],_0x15ea4c[_0x130f('0x111')]>0x0?ut[_0x130f('0x112')](_0x15ea4c[_0x130f('0x2e')],_0x15ea4c[_0x130f('0x111')]):_0x15ea4c[_0x130f('0x2e')]):ut[_0x130f('0x10e')](_['isNil'](_0x15ea4c[_0x130f('0x94')])?_0x15ea4c[_0x130f('0x4c')][_0x130f('0x10f')]:_0x15ea4c['TrunkBackup'][_0x130f('0x10f')],_0x15ea4c[_0x130f('0x110')],_0x15ea4c['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x130f('0x112')](_0x15ea4c[_0x130f('0x2e')],_0x15ea4c[_0x130f('0x111')]):_0x15ea4c['dialOriginateCallerIdNumber']);if(_0x5011c6){_0x422f0a[_0x130f('0x113')]=ut[_0x130f('0x114')](_0x5011c6);_0x422f0a[_0x130f('0x115')]=ut[_0x130f('0x116')](_0x5011c6);}var _0x3ab49b=ut[_0x130f('0x117')](_0x15ea4c,_0x47bb5b,_0x378ad6,_0x5011c6,_0x3f44f8,_0x422f0a);_[_0x130f('0x118')](_0x422f0a,ut[_0x130f('0x119')](_0x3ab49b));_0x422f0a[_0x130f('0x89')]=moment()['format'](_0x130f('0x11a'));ami[_0x130f('0x73')](ut[_0x130f('0x11b')](_0x422f0a,_0x15ea4c,_0x3ab49b,_0x422f0a['activeContact'],_0x56aa26))[_0x130f('0x81')](function(_0x3fe69f){_0x15ea4c['originated']+=0x1;logger['info']('[originated][increment]',_0x3f44f8,_0x130f('0xa6'),_0x15ea4c[_0x130f('0x22')],_0x130f('0x6b'),_0x15ea4c[_0x130f('0x46')]);_0x576179(_0x3fe69f);})['catch'](function(_0x19f6e2){ut[_0x130f('0xdf')](_0x422f0a,0xe,_0x130f('0x11c'));rpcDb['createAgentHistory'](_0x422f0a,_0x130f('0x11d'));_0x16e940(_0x19f6e2);});});};Preview['prototype']['syncNewExten']=function(_0x2ec790){if(this[_0x130f('0x67')][_0x2ec790[_0x130f('0xa1')]]){this[_0x130f('0x67')][_0x2ec790[_0x130f('0xa1')]][_0x130f('0x11e')]=_0x2ec790[_0x130f('0x11e')];}};Preview[_0x130f('0x63')]['syncOriginateResponse']=function(_0x4c90ae){var _0x4a1dcc=this;var _0x2ca86=this[_0x130f('0x67')][_0x4c90ae[_0x130f('0x11f')]];if(_0x2ca86){if(_0x2ca86[_0x130f('0x120')]&&this['agents'][_0x2ca86['lookAgent']]){ut[_0x130f('0x121')](_0x2ca86,this[_0x130f('0x12')][_0x2ca86[_0x130f('0x120')]][_0x130f('0x22')],this[_0x130f('0x12')][_0x2ca86['lookAgent']]['id']);}var _0x4a2adc=_[_0x130f('0x122')](_0x2ca86);_0x4a2adc['responsetime']=moment()[_0x130f('0x50')](_0x130f('0x11a'));var _0x4c6005=_0x4a1dcc[_0x130f('0x5d')][_0x2ca86[_0x130f('0x6c')]];if(ut['isFailure'](_0x4c90ae['response'])){if(_0x2ca86[_0x130f('0xc0')]){rpcDb[_0x130f('0xf9')](_0x2ca86[_0x130f('0xd1')]);}if(_0x2ca86[_0x130f('0xc1')]){rpcDb[_0x130f('0xd2')](_0x2ca86[_0x130f('0xd1')]);}ami[_0x130f('0x20')](_0x130f('0x123'),ut['buildObj'](_0x2ca86,_0x130f('0x124')));this[_0x130f('0xdc')](_0x4a2adc,_0x4c6005,_0x4c90ae);}else{_0x2ca86[_0x130f('0x89')]=moment()['format'](_0x130f('0x11a'));ut[_0x130f('0xdf')](_0x4a2adc,0x4,'Answer');rpcDb[_0x130f('0xe0')](_0x4a2adc,_0x130f('0x125'));}}};Preview[_0x130f('0x63')][_0x130f('0x126')]=function(_0x5439d5){var _0x1ccf85=this;var _0x4eb7f0=this[_0x130f('0x67')][_0x5439d5['linkedid']];var _0x482edf;if(_0x4eb7f0){_0x482edf=this['campaignsPreview'][_0x4eb7f0[_0x130f('0x6c')]];logger[_0x130f('0x68')](_0x130f('0x127'),_0x5439d5[_0x130f('0xa1')],'\x20Queue',_0x482edf[_0x130f('0x22')],'pTalking:\x20',_0x482edf[_0x130f('0x26')]);}if(this[_0x130f('0x67')][_0x5439d5['linkedid']]&&_0x5439d5[_0x130f('0xa1')]!==_0x5439d5['uniqueid']){if(_0x5439d5['cause']==='16'&&this[_0x130f('0x67')][_0x5439d5[_0x130f('0xa1')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x5439d5,_0x5439d5[_0x130f('0xa1')],_0x5439d5[_0x130f('0x128')]);}else if(this['actions'][_0x5439d5['linkedid']][_0x130f('0x6d')]){logger[_0x130f('0x68')](_0x130f('0x129'),_0x5439d5[_0x130f('0xa1')],_0x5439d5[_0x130f('0x128')],_0x130f('0xa6'),_0x482edf[_0x130f('0x22')],_0x130f('0xa7'),_0x482edf[_0x130f('0x26')]);this['callProgressDetectingCustomer'](_0x5439d5,_0x5439d5[_0x130f('0xa1')],_0x5439d5['cause']);}}else if(_0x4eb7f0&&_[_0x130f('0x66')](_0x4eb7f0[_0x130f('0x12a')])&&_0x482edf[_0x130f('0x12b')]&&_0x5439d5[_0x130f('0xa1')]===_0x5439d5['uniqueid']&&_[_0x130f('0x66')](_0x5439d5[_0x130f('0xe6')])&&_0x5439d5[_0x130f('0x128')]==='16'&&_0x5439d5[_0x130f('0x12c')]==='6'&&_['isUndefined'](_0x4eb7f0[_0x130f('0x12d')])){if(_0x4eb7f0[_0x130f('0xc0')]){rpcDb[_0x130f('0xf9')](_0x4eb7f0[_0x130f('0xd1')]);}if(_0x4eb7f0[_0x130f('0xc1')]){rpcDb[_0x130f('0xd2')](_0x4eb7f0[_0x130f('0xd1')]);}_0x5439d5[_0x130f('0xe6')]='22';this[_0x130f('0xdc')](_0x4eb7f0,_0x482edf,_0x5439d5);}else if(_0x4eb7f0&&_0x4eb7f0[_0x130f('0x12d')]){if(_0x5439d5['cause']==='16'&&this[_0x130f('0x67')][_0x5439d5[_0x130f('0xa1')]]['dialAnswer']){logger[_0x130f('0x68')](_0x130f('0x12e'),_0x5439d5['linkedid'],_0x5439d5[_0x130f('0x128')],'\x20Queue',_0x482edf['name'],_0x130f('0xa7'),_0x482edf[_0x130f('0x26')]);this['callProgressDetectingCustomer'](_0x5439d5,_0x5439d5[_0x130f('0xa1')],_0x5439d5['cause']);}else if(this['actions'][_0x5439d5[_0x130f('0xa1')]]['dialAnswer']){logger[_0x130f('0x68')](_0x130f('0x129'),_0x5439d5['linkedid'],_0x5439d5['cause'],_0x130f('0xa6'),_0x482edf['name'],_0x130f('0xa7'),_0x482edf[_0x130f('0x26')]);this[_0x130f('0x97')](_0x5439d5,_0x5439d5[_0x130f('0xa1')],_0x5439d5[_0x130f('0x128')]);}}};Preview[_0x130f('0x63')][_0x130f('0x18')]=function(_0x43db84){if(this['actions'][_0x43db84[_0x130f('0xdb')]]&&_0x43db84[_0x130f('0xdb')]!==_0x43db84[_0x130f('0x12f')]){this['callProgressDetectingCustomer'](_0x43db84,_0x43db84[_0x130f('0xdb')],_0x43db84['dialstatus']);}};Preview[_0x130f('0x63')][_0x130f('0x17')]=function(_0x52391f){if(this[_0x130f('0x67')][_0x52391f['linkedid']]&&_0x52391f['linkedid']!==_0x52391f[_0x130f('0xa5')]&&!this[_0x130f('0x67')][_0x52391f[_0x130f('0xa1')]][_0x130f('0x6d')]){if(_0x52391f[_0x130f('0x128')]==='1'){this[_0x130f('0x97')](_0x52391f,_0x52391f[_0x130f('0xa1')],_0x52391f['cause']);}}};Preview[_0x130f('0x63')][_0x130f('0x130')]=function(_0x1ac49b,_0x438aec,_0x4e4420){if(this[_0x130f('0x67')][_0x1ac49b]){if(_[_0x130f('0x66')](this[_0x130f('0x67')][_0x1ac49b][_0x130f('0x131')])){this[_0x130f('0x67')][_0x1ac49b]['variables']={};}this[_0x130f('0x67')][_0x1ac49b][_0x130f('0x131')][_0x438aec]=_0x4e4420;}};Preview[_0x130f('0x63')][_0x130f('0x1a')]=function(_0x2bf509){try{if(!_['isNil'](_0x2bf509)){if(ut[_0x130f('0x132')](_[_0x130f('0x133')](_0x2bf509[_0x130f('0x134')])[0x0])){this[_0x130f('0x130')](_0x2bf509[_0x130f('0xa5')],_[_0x130f('0x133')](_0x2bf509['variable'])[0x0],_0x2bf509[_0x130f('0x135')]);}}}catch(_0x5d1983){logger[_0x130f('0x136')]('[syncVarSet][Preview]',util[_0x130f('0x137')](_0x5d1983,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x130f('0x1c')]=function(_0x219466){if(_0x219466){if(this[_0x130f('0x67')][_0x219466[_0x130f('0x138')]]){this[_0x130f('0x67')][_0x219466[_0x130f('0x138')]][_0x130f('0x12d')]=!![];}}};Preview[_0x130f('0x63')][_0x130f('0x1e')]=function(_0x5bdf91){if(_0x5bdf91){if(this[_0x130f('0x67')][_0x5bdf91['transfererlinkedid']]){this[_0x130f('0x67')][_0x5bdf91[_0x130f('0x139')]][_0x130f('0x12d')]=!![];}}};module[_0x130f('0x13a')]=Preview;
\ No newline at end of file