Built motion from commit (unavailable).|2.2.3
[motion2.git] / server / services / ami / preview / index.js
index ea50a30..b9a13c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc48f=['unlockAgent','activeContact','NOANSWER','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','AgentReject','unlockContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','originated:\x20','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','VoiceQueueId','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','active','SIP/%s','status','reachable','unmonitored','pick','unlock','disableContact','execRun','recallme','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[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','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','phone','substring','getCallerId','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','channel','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','Trunk','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','dialActive','setMessage','isNil','info','Queue','queue','pTalking:\x20','dialAnswer','contactId','ListId','Action','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','getDiff','scheduledat','dialRecallMeTimeout','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','emit','buildObj','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','decrementTalkink','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','dialBusyRetryFrequency'];(function(_0x3bddda,_0x42a67f){var _0x188997=function(_0x49b25a){while(--_0x49b25a){_0x3bddda['push'](_0x3bddda['shift']());}};_0x188997(++_0x42a67f);}(_0xc48f,0x1b8));var _0xfc48=function(_0x44eaec,_0xee3437){_0x44eaec=_0x44eaec-0x0;var _0x4730e7=_0xc48f[_0x44eaec];return _0x4730e7;};'use strict';var util=require(_0xfc48('0x0'));var _=require(_0xfc48('0x1'));var BPromise=require(_0xfc48('0x2'));var uuid=require(_0xfc48('0x3'));var moment=require(_0xfc48('0x4'));var md5=require(_0xfc48('0x5'));var Redis=require('ioredis');var config=require(_0xfc48('0x6'));var logger=require(_0xfc48('0x7'))('preview');var loggerAction=require('../../../config/logger')(_0xfc48('0x8'));var ami=require(_0xfc48('0x9'));var rpcDb=require(_0xfc48('0xa'));var Action=require('./action');var ut=require(_0xfc48('0xb'));config[_0xfc48('0xc')]=_['defaults'](config[_0xfc48('0xc')],{'host':_0xfc48('0xd'),'port':0x18eb});var io=require(_0xfc48('0xe'))(new Redis(config[_0xfc48('0xc')]));var Sequence=function(){};Sequence[_0xfc48('0xf')][_0xfc48('0x10')]=function(_0x8f5b06){this['tail']=this[_0xfc48('0x11')]?this['tail'][_0xfc48('0x12')](_0x8f5b06):_0x8f5b06();};function Preview(_0x205016){this[_0xfc48('0x13')]=new Sequence();this[_0xfc48('0x14')]=_0x205016[_0xfc48('0x15')];this[_0xfc48('0x16')]=_0x205016[_0xfc48('0x16')];this[_0xfc48('0x17')]={};this[_0xfc48('0x18')]=_0x205016[_0xfc48('0x18')];this[_0xfc48('0x19')]=0x0;ami['on']('originateresponse',this[_0xfc48('0x1a')][_0xfc48('0x1b')](this));ami['on']('hangup',this[_0xfc48('0x1c')][_0xfc48('0x1b')](this));ami['on'](_0xfc48('0x1d'),this[_0xfc48('0x1e')][_0xfc48('0x1b')](this));ami['on'](_0xfc48('0x1f'),this[_0xfc48('0x20')][_0xfc48('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0xfc48('0x1b')](this));ami['on'](_0xfc48('0x21'),this[_0xfc48('0x22')]['bind'](this));ami['on'](_0xfc48('0x23'),this[_0xfc48('0x24')][_0xfc48('0x1b')](this));ami['on'](_0xfc48('0x25'),this[_0xfc48('0x26')][_0xfc48('0x1b')](this));this[_0xfc48('0x27')](this[_0xfc48('0x14')]);}function emit(_0x2a4cf0,_0x1268b3,_0x36cf5e){io['to'](_0x2a4cf0)['emit'](_0x1268b3,_0x36cf5e);}function emitCampaignPreview(_0x44fd38){if(_0x44fd38[_0xfc48('0x28')]===_0xfc48('0x29')){var _0x304375={'id':_0x44fd38['id'],'name':_0x44fd38[_0xfc48('0x2a')],'strategy':_0x44fd38[_0xfc48('0x2b')],'answered':_0x44fd38[_0xfc48('0x2c')],'available':_0x44fd38[_0xfc48('0x2d')],'loggedIn':_0x44fd38[_0xfc48('0x2e')],'pTalking':_0x44fd38[_0xfc48('0x2f')],'sumBillable':_0x44fd38[_0xfc48('0x30')],'sumDuration':_0x44fd38['sumDuration'],'sumHoldTime':_0x44fd38[_0xfc48('0x31')]||0x0,'talking':_0x44fd38['talking'],'total':_0x44fd38[_0xfc48('0x32')],'type':_0x44fd38['type'],'unmanaged':_0x44fd38['unmanaged'],'abandoned':_0x44fd38[_0xfc48('0x33')],'waiting':_0x44fd38[_0xfc48('0x34')],'loggedInDb':_0x44fd38[_0xfc48('0x35')],'dialActive':_0x44fd38['dialActive'],'dialMethod':_0x44fd38[_0xfc48('0x36')],'dialOriginateCallerIdName':_0x44fd38[_0xfc48('0x37')],'dialOriginateCallerIdNumber':_0x44fd38['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x44fd38[_0xfc48('0x38')],'dialPrefix':_0x44fd38[_0xfc48('0x39')],'outboundAnswerAgiCallsDay':_0x44fd38[_0xfc48('0x3a')],'outboundAnswerCallsDay':_0x44fd38['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x44fd38['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x44fd38[_0xfc48('0x3b')],'outboundCongestionCallsDay':_0x44fd38[_0xfc48('0x3c')],'outboundDropCallsDayACS':_0x44fd38[_0xfc48('0x3d')],'outboundDropCallsDayCallersExit':_0x44fd38[_0xfc48('0x3e')],'outboundDropCallsDayTimeout':_0x44fd38[_0xfc48('0x3f')],'outboundNoAnswerCallsDay':_0x44fd38[_0xfc48('0x40')],'outboundNoSuchCallsDay':_0x44fd38[_0xfc48('0x41')],'outboundOriginateFailureCallsDay':_0x44fd38[_0xfc48('0x42')],'outboundReCallsDay':_0x44fd38[_0xfc48('0x43')],'outboundRejectCallsDay':_0x44fd38[_0xfc48('0x44')],'outboundUnknownCallsDay':_0x44fd38['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x44fd38[_0xfc48('0x45')],'predictiveIntervalAvgHoldtime':_0x44fd38[_0xfc48('0x46')],'predictiveIntervalAvgTalktime':_0x44fd38[_0xfc48('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x44fd38['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x44fd38[_0xfc48('0x48')],'predictiveIntervalErlangCalls':_0x44fd38[_0xfc48('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x44fd38['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x44fd38[_0xfc48('0x4a')],'predictiveIntervalLowerLimit':_0x44fd38[_0xfc48('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x44fd38[_0xfc48('0x4c')],'predictiveIntervalPauses':_0x44fd38[_0xfc48('0x4d')],'predictiveIntervalTotalCalls':_0x44fd38[_0xfc48('0x4e')],'message':_0x44fd38[_0xfc48('0x4f')],'originated':_0x44fd38[_0xfc48('0x50')]};if(_0x44fd38['Trunk']){_0x304375[_0xfc48('0x51')]={'id':_0x44fd38[_0xfc48('0x51')]['id'],'name':_0x44fd38[_0xfc48('0x51')]['name'],'active':_0x44fd38[_0xfc48('0x51')]['active'],'callerid':_0x44fd38['Trunk']['callerid']};}if(_0x44fd38[_0xfc48('0x52')]){_0x304375['Interval']={'id':_0x44fd38[_0xfc48('0x52')]['id'],'name':_0x44fd38[_0xfc48('0x52')][_0xfc48('0x2a')]};}var _0x1ca154=md5(JSON[_0xfc48('0x53')](_0x304375));if(_0x44fd38[_0xfc48('0x5')]!==_0x1ca154){_0x44fd38['md5']=_0x1ca154;emit(util[_0xfc48('0x54')](_0xfc48('0x55'),_0x304375[_0xfc48('0x2a')]),_0xfc48('0x56'),_0x304375);}}}function emitVoiceQueueChannelRemove(_0x1233d3){emit(util['format'](_0xfc48('0x55'),_0x1233d3[_0xfc48('0x2a')]),_0xfc48('0x57'),_0x1233d3);}function notSendMessagesQueue(_0x55db2a){if(_0x55db2a[_0xfc48('0x58')]){if(_0x55db2a[_0xfc48('0x50')]===0x0&&_0x55db2a[_0xfc48('0x2f')]===0x0){_0x55db2a[_0xfc48('0x58')]=![];_0x55db2a[_0xfc48('0x2d')]=0x0;_0x55db2a[_0xfc48('0x59')]=0x0;_0x55db2a[_0xfc48('0x4f')]=_0xfc48('0x5a');ut['logger'](_0xfc48('0x5b'),_0x55db2a[_0xfc48('0x2a')]+_0xfc48('0x5c'));}else{_0x55db2a[_0xfc48('0x4f')]=_0xfc48('0x5d');ut[_0xfc48('0x5e')](_0xfc48('0x5b'),_0x55db2a[_0xfc48('0x2a')]+_0xfc48('0x5f'));}emitCampaignPreview(_0x55db2a);}}Preview['prototype'][_0xfc48('0x27')]=function(){var _0x4b99fb=this;setInterval(function(){_0x4b99fb[_0xfc48('0x60')]();},0x7cf);};Preview[_0xfc48('0xf')][_0xfc48('0x60')]=function(){var _0x4cea66=this[_0xfc48('0x14')];this[_0xfc48('0x19')]+=0x1;for(var _0x32cede in _0x4cea66){if(_0x4cea66[_0xfc48('0x61')](_0x32cede)&&(_0x4cea66[_0x32cede]['dialMethod']===_0xfc48('0x62')||_0x4cea66[_0x32cede][_0xfc48('0x36')]===_0xfc48('0x63'))&&_0x4cea66[_0x32cede]['type']===_0xfc48('0x29')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xfc48('0x64')]();}}if(_0x4cea66[_0xfc48('0x61')](_0x32cede)&&_0x4cea66[_0x32cede]['dialMethod']===_0xfc48('0x62')&&_0x4cea66[_0x32cede][_0xfc48('0x28')]===_0xfc48('0x29')){if(_0x4cea66[_0x32cede][_0xfc48('0x65')]){this[_0xfc48('0x66')](_0x4cea66[_0x32cede]);this['recallMe'](_0x4cea66[_0x32cede]);}else{notSendMessagesQueue(_0x4cea66[_0x32cede]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x31ec8a){var _0x3c1db7=this;this[_0xfc48('0x13')][_0xfc48('0x10')](function(){if(!_[_0xfc48('0x67')](_0x3c1db7[_0xfc48('0x17')][_0x31ec8a])){loggerAction[_0xfc48('0x68')]('[clearZombieChannels][talking]',_0x31ec8a,_0xfc48('0x69'),_0x3c1db7[_0xfc48('0x17')][_0x31ec8a][_0xfc48('0x6a')],'originated:\x20',JSON[_0xfc48('0x53')](_0x3c1db7[_0xfc48('0x14')][_0x3c1db7[_0xfc48('0x17')][_0x31ec8a]['queue']][_0xfc48('0x50')]),_0xfc48('0x6b'),JSON[_0xfc48('0x53')](_0x3c1db7[_0xfc48('0x14')][_0x3c1db7[_0xfc48('0x17')][_0x31ec8a][_0xfc48('0x6a')]][_0xfc48('0x2f')]),JSON[_0xfc48('0x53')](_0x3c1db7[_0xfc48('0x17')][_0x31ec8a][_0xfc48('0x6c')]),JSON[_0xfc48('0x53')](_['pick'](_0x3c1db7[_0xfc48('0x17')][_0x31ec8a],[_0xfc48('0x6d'),'UserId','VoiceQueueId',_0xfc48('0x6e')])));return ami[_0xfc48('0x6f')]({'action':'status','channel':_0x3c1db7['actions'][_0x31ec8a]['channel']})[_0xfc48('0x70')](function(_0x175e99){if(_0x175e99[_0xfc48('0x4f')]===_0xfc48('0x71')){setTimeout(function(){if(_0x3c1db7['actions'][_0x31ec8a]){ut['updateOriginated'](_0x3c1db7[_0xfc48('0x14')][_0x3c1db7[_0xfc48('0x17')][_0x31ec8a][_0xfc48('0x6a')]],_0xfc48('0x72'));if(_0x3c1db7[_0xfc48('0x17')][_0x31ec8a]['dialAnswer']===!![]){ut['decrementTalkink'](_0x3c1db7[_0xfc48('0x14')][_0x3c1db7[_0xfc48('0x17')][_0x31ec8a][_0xfc48('0x6a')]],_0xfc48('0x72'));ut[_0xfc48('0x73')](_0xfc48('0x74')+_0x31ec8a,_0x3c1db7[_0xfc48('0x17')][_0x31ec8a][_0xfc48('0x6a')]);}ut[_0xfc48('0x73')](_0xfc48('0x75')+_0x31ec8a,_0x3c1db7[_0xfc48('0x17')][_0x31ec8a][_0xfc48('0x6a')]);delete _0x3c1db7[_0xfc48('0x17')][_0x31ec8a];}},0x2328);}});}});};Preview[_0xfc48('0xf')][_0xfc48('0x64')]=function(){var _0x15fcf3=this;loggerAction[_0xfc48('0x68')](_0xfc48('0x76'),_[_0xfc48('0x77')](this[_0xfc48('0x17')]));for(var _0x73a9bc in this[_0xfc48('0x17')]){if(_0x15fcf3[_0xfc48('0x17')][_0xfc48('0x61')](_0x73a9bc)){_0x15fcf3[_0xfc48('0x78')](_0x73a9bc);}}};Preview[_0xfc48('0xf')][_0xfc48('0x79')]=function(_0x329202){var _0x3739ef=this;rpcDb[_0xfc48('0x7a')](_0x329202['id'],ut[_0xfc48('0x7b')](this[_0xfc48('0x18')]))['then'](function(_0x17d3e3){if(!_[_0xfc48('0x67')](_0x17d3e3)){for(var _0x37e1df=0x0;_0x37e1df<_0x17d3e3['length'];_0x37e1df+=0x1){if(ut[_0xfc48('0x7c')](_0x17d3e3[_0x37e1df][_0xfc48('0x7d')])<_0x329202[_0xfc48('0x7e')]*0x3c){_0x3739ef[_0xfc48('0x7f')](_0x17d3e3[_0x37e1df]['id'])[_0xfc48('0x80')](ut[_0xfc48('0x81')](_0xfc48('0x82')))['catch'](ut[_0xfc48('0x81')](_0xfc48('0x82')));}else{var _0x5c7f1a=new Action(_0x17d3e3[_0x37e1df],_0x329202);_0x5c7f1a[_0xfc48('0x83')]=moment()[_0xfc48('0x54')](_0xfc48('0x84'));_0x329202[_0xfc48('0x43')]+=0x1;ut[_0xfc48('0x85')](_0x5c7f1a,0x17,_0xfc48('0x86'));if(_0x329202[_0xfc48('0x87')]){rpcDb[_0xfc48('0x88')](ut[_0xfc48('0x89')](_0x17d3e3[_0x37e1df]));rpcDb['createCustomerHistory'](_0x5c7f1a,_0xfc48('0x8a'));}else{ut[_0xfc48('0x85')](_0x5c7f1a,0x16,_0xfc48('0x8b'));rpcDb['createCustomerHistory'](_0x5c7f1a,'[HistoryRecallClose]');rpcDb[_0xfc48('0x8c')](_0x5c7f1a,_0xfc48('0x8d'));}}}}})['catch'](ut[_0xfc48('0x81')](_0xfc48('0x8e')));};Preview[_0xfc48('0xf')][_0xfc48('0x66')]=function(_0x4a1ee4){_0x4a1ee4['sendMessageOneNotActive']=!![];if(ut[_0xfc48('0x8f')](_0x4a1ee4[_0xfc48('0x2e')])){_0x4a1ee4['message']=_0xfc48('0x90');}else if(!ut[_0xfc48('0x91')](_0x4a1ee4[_0xfc48('0x65')])){_0x4a1ee4[_0xfc48('0x4f')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x4a1ee4[_0xfc48('0x51')])){if(!this[_0xfc48('0x92')](_0x4a1ee4[_0xfc48('0x93')])){_0x4a1ee4[_0xfc48('0x4f')]='TRUNK_IS_NOT_REACHABLE';}else{_0x4a1ee4[_0xfc48('0x4f')]=_0xfc48('0x94');}}else{_0x4a1ee4[_0xfc48('0x4f')]=_0xfc48('0x94');}emitCampaignPreview(_0x4a1ee4);};Preview[_0xfc48('0xf')][_0xfc48('0x95')]=function(_0x44bc5b,_0x27dd3b,_0x55b577){var _0x1a3977=this;var _0x524b32=this[_0xfc48('0x17')][_0x27dd3b];var _0x4e1a9d=this[_0xfc48('0x14')][_0x524b32[_0xfc48('0x6a')]];var _0xe473b9;if(_0x4e1a9d){switch(_0x55b577){case'1':_0x4e1a9d[_0xfc48('0x41')]+=0x1;_0x524b32[_0xfc48('0x96')]=ut[_0xfc48('0x97')](_0x524b32);ut[_0xfc48('0x85')](_0x524b32,0x0,_0xfc48('0x98'));rpcDb[_0xfc48('0x99')](_0x524b32,_0xfc48('0x9a'));if(ut[_0xfc48('0x97')](_0x524b32)>=_0x4e1a9d[_0xfc48('0x9b')]){_0xe473b9=ut['cloneAction'](_0x524b32,0xf,'Global');rpcDb[_0xfc48('0x8c')](_0xe473b9,_0xfc48('0x9c'));}else{rpcDb['createCustomerFinal'](_0x524b32,_0xfc48('0x9c'));}delete this['actions'][_0x44bc5b[_0xfc48('0x9d')]];break;case _0xfc48('0x9e'):var _0x6218d=moment()['format'](_0xfc48('0x84'));_0x524b32[_0xfc48('0x9f')]=_0x6218d;_0x524b32[_0xfc48('0xa0')]=_0x6218d;_0x524b32[_0xfc48('0x6c')]=!![];_0x4e1a9d[_0xfc48('0x2f')]+=0x1;logger[_0xfc48('0x68')](_0xfc48('0xa1'),_0x524b32['uniqueid'],_0xfc48('0xa2'),_0x4e1a9d['name'],_0xfc48('0x6b'),_0x4e1a9d['pTalking']);ami[_0xfc48('0xa3')]('custom:agentconnect',ut[_0xfc48('0xa4')](_0x524b32,'connect'));if(_0x4e1a9d[_0xfc48('0xa5')]){ami[_0xfc48('0xa3')](_0xfc48('0xa6'),ut['buildAcw'](_0x524b32));}break;case'16':ami[_0xfc48('0xa3')](_0xfc48('0xa7'),ut[_0xfc48('0xa4')](_0x524b32,_0xfc48('0xa8')));emitVoiceQueueChannelRemove(ut[_0xfc48('0xa4')](_0x524b32,_0xfc48('0xa8')));_0x4e1a9d[_0xfc48('0xa9')]+=0x1;_0x4e1a9d[_0xfc48('0x32')]+=0x1;_0x4e1a9d['answered']+=0x1;ut[_0xfc48('0xaa')](_0x4e1a9d,'[16]');_0x524b32[_0xfc48('0x96')]=ut[_0xfc48('0x97')](_0x524b32);ut[_0xfc48('0x85')](_0x524b32,0x4,'Answer');rpcDb[_0xfc48('0x99')](_0x524b32,_0xfc48('0xab'));rpcDb[_0xfc48('0x8c')](_0x524b32,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xfc48('0xac')](_0x524b32);_0x4e1a9d[_0xfc48('0xad')]+=_0x524b32[_0xfc48('0xae')];_0x4e1a9d[_0xfc48('0x30')]+=_0x524b32[_0xfc48('0xae')];logger[_0xfc48('0x68')](_0xfc48('0xaf'),_0x524b32[_0xfc48('0xb0')],'\x20Queue',_0x4e1a9d['name'],_0xfc48('0x6b'),_0x4e1a9d[_0xfc48('0x2f')]);delete this[_0xfc48('0x17')][_0x44bc5b[_0xfc48('0x9d')]];break;case'BUSY':_0x4e1a9d[_0xfc48('0x3b')]+=0x1;_0x524b32[_0xfc48('0xb1')]+=0x1;_0x524b32[_0xfc48('0x96')]=ut[_0xfc48('0x97')](_0x524b32);ut['logCustomer'](_0x524b32,0x5,_0xfc48('0xb2'));rpcDb[_0xfc48('0x99')](_0x524b32,_0xfc48('0xb3'));if(ut[_0xfc48('0x97')](_0x524b32)>=_0x4e1a9d['dialGlobalMaxRetry']){_0xe473b9=ut['cloneAction'](_0x524b32,0xf,_0xfc48('0xb4'));rpcDb[_0xfc48('0x8c')](_0xe473b9,_0xfc48('0xb5'));}else{if(_0x524b32[_0xfc48('0xb1')]>=_0x4e1a9d[_0xfc48('0xb6')]){rpcDb[_0xfc48('0x8c')](_0x524b32,_0xfc48('0xb3'));}else{rpcDb[_0xfc48('0xb7')](ut[_0xfc48('0xb8')](_0x524b32,_0xfc48('0xb1'),_0x4e1a9d[_0xfc48('0xb9')]),_0x524b32[_0xfc48('0xba')],_0x524b32[_0xfc48('0xbb')]);}}break;case _0xfc48('0xbc'):_0x4e1a9d[_0xfc48('0x40')]+=0x1;_0x524b32['countnoanswerretry']+=0x1;_0x524b32[_0xfc48('0x96')]=ut[_0xfc48('0x97')](_0x524b32);ut[_0xfc48('0x85')](_0x524b32,0x3,_0xfc48('0xbd'));rpcDb[_0xfc48('0x99')](_0x524b32,_0xfc48('0xbe'));if(ut[_0xfc48('0x97')](_0x524b32)>=_0x4e1a9d[_0xfc48('0x9b')]){_0xe473b9=ut[_0xfc48('0xbf')](_0x524b32,0xf,_0xfc48('0xb4'));rpcDb['createCustomerFinal'](_0xe473b9,_0xfc48('0xc0'));}else{if(_0x524b32[_0xfc48('0xc1')]>=_0x4e1a9d['dialNoAnswerMaxRetry']){rpcDb[_0xfc48('0x8c')](_0x524b32,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xfc48('0xb7')](ut[_0xfc48('0xb8')](_0x524b32,_0xfc48('0xc1'),_0x4e1a9d[_0xfc48('0xc2')]),_0x524b32[_0xfc48('0xba')],_0x524b32[_0xfc48('0xbb')]);}}break;case _0xfc48('0xc3'):_0x4e1a9d[_0xfc48('0x3c')]+=0x1;_0x524b32[_0xfc48('0xc4')]+=0x1;_0x524b32[_0xfc48('0x96')]=ut['totalGlobal'](_0x524b32);ut[_0xfc48('0x85')](_0x524b32,0x8,_0xfc48('0xc5'));rpcDb[_0xfc48('0x99')](_0x524b32,_0xfc48('0xc6'));if(ut['totalGlobal'](_0x524b32)>=_0x4e1a9d['dialGlobalMaxRetry']){_0xe473b9=ut[_0xfc48('0xbf')](_0x524b32,0xf,'Global');rpcDb[_0xfc48('0x8c')](_0xe473b9,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x524b32[_0xfc48('0xc4')]>=_0x4e1a9d['dialCongestionMaxRetry']){rpcDb[_0xfc48('0x8c')](_0x524b32,_0xfc48('0xc6'));}else{rpcDb[_0xfc48('0xb7')](ut[_0xfc48('0xb8')](_0x524b32,'countcongestionretry',_0x4e1a9d[_0xfc48('0xb9')]),_0x524b32[_0xfc48('0xba')],_0x524b32['activeContact']);}}break;case _0xfc48('0xc7'):_0x4e1a9d[_0xfc48('0x44')]+=0x1;_0x524b32['countglobal']=ut[_0xfc48('0x97')](_0x524b32);ut[_0xfc48('0x85')](_0x524b32,0x14,_0xfc48('0xc8'));rpcDb[_0xfc48('0x99')](_0x524b32,'[syncHangupRequest][logAgentReject]');if(_0x524b32[_0xfc48('0xba')]){rpcDb[_0xfc48('0xc9')](_0x524b32[_0xfc48('0xca')]);}if(_0x524b32[_0xfc48('0xbb')]){rpcDb['disableContact'](_0x524b32[_0xfc48('0xca')]);}break;default:if(_0x524b32[_0xfc48('0x6c')]){ut[_0xfc48('0xaa')](_0x4e1a9d,_0xfc48('0xcb'));ut[_0xfc48('0x73')](_0xfc48('0xcc')+_0x4e1a9d[_0xfc48('0x2a')],_0x44bc5b);}_0x4e1a9d[_0xfc48('0xcd')]+=0x1;_0x524b32[_0xfc48('0x96')]=ut[_0xfc48('0x97')](_0x524b32);ut[_0xfc48('0x85')](_0x524b32,0xc,_0x44bc5b[_0xfc48('0xce')]||_0x44bc5b[_0xfc48('0xcf')]);rpcDb[_0xfc48('0x99')](_0x524b32,_0xfc48('0xd0'));if(ut[_0xfc48('0x97')](_0x524b32)>=_0x4e1a9d['dialGlobalMaxRetry']){_0xe473b9=ut[_0xfc48('0xbf')](_0x524b32,0xf,_0xfc48('0xb4'));rpcDb[_0xfc48('0x8c')](_0xe473b9,_0xfc48('0xd1'));}else{rpcDb[_0xfc48('0x8c')](_0x524b32,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x44bc5b[_0xfc48('0x9d')]];}if(!(_0x524b32[_0xfc48('0x6c')]&&_0x55b577==='16')){ut[_0xfc48('0xd2')](_0x4e1a9d,'[callProgressDetectingCustomer]');logger[_0xfc48('0x68')]('[originated][decrement][callProgressDetectingCustomer]',_0x524b32[_0xfc48('0xb0')],'\x20Queue',_0x4e1a9d[_0xfc48('0x2a')],_0xfc48('0xd3'),_0x4e1a9d[_0xfc48('0x50')]);}if(_0x55b577!==_0xfc48('0x9e')){delete this[_0xfc48('0x17')][_0x44bc5b[_0xfc48('0x9d')]];delete this['actions'][_0x44bc5b['destlinkedid']];}}};Preview[_0xfc48('0xf')][_0xfc48('0xd4')]=function(_0x3f0e76,_0x3a1971,_0x2ebd28){if(_['isUndefined'](_0x3a1971)&&_0xfc48('0xd5')!==typeof _0x3a1971){return;}if(_[_0xfc48('0xd6')](_0x2ebd28)&&_0xfc48('0xd5')!==typeof _0x2ebd28){return;}switch(_0x2ebd28[_0xfc48('0xd7')]){case'0':ut[_0xfc48('0xd8')](_0x3f0e76,0x0,_0xfc48('0x98'));rpcDb[_0xfc48('0xd9')](_0x3f0e76,_0xfc48('0xda'));break;case'3':ut[_0xfc48('0xd8')](_0x3f0e76,0x3,_0xfc48('0xbd'));rpcDb[_0xfc48('0xd9')](_0x3f0e76,_0xfc48('0xdb'));break;case'5':ut[_0xfc48('0xd8')](_0x3f0e76,0x5,_0xfc48('0xb2'));rpcDb['createAgentHistory'](_0x3f0e76,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xfc48('0xd8')](_0x3f0e76,0x8,_0xfc48('0xc5'));rpcDb[_0xfc48('0xd9')](_0x3f0e76,_0xfc48('0xdc'));break;case'22':ut[_0xfc48('0xd8')](_0x3f0e76,0x16,_0xfc48('0xdd'));rpcDb[_0xfc48('0xd9')](_0x3f0e76,_0xfc48('0xde'));break;default:ut[_0xfc48('0xd8')](_0x3f0e76,0xc,_0x2ebd28[_0xfc48('0xd7')]);rpcDb[_0xfc48('0xd9')](_0x3f0e76,_0xfc48('0xdc'));}ut[_0xfc48('0xd2')](_0x3a1971,_0xfc48('0xdf'));logger['info'](_0xfc48('0xe0'),_0x3f0e76[_0xfc48('0xb0')],_0xfc48('0xa2'),_0x3a1971[_0xfc48('0x2a')],_0xfc48('0xd3'),_0x3a1971[_0xfc48('0x50')]);delete this[_0xfc48('0x17')][_0x3f0e76['uniqueid']];};Preview[_0xfc48('0xf')]['checkInBlack']=function(_0x4e7ad8,_0x2a9e91,_0x4d09bf,_0x16d02f,_0x3b1d94){var _0xdb0c4d=this;return new BPromise(function(_0x61af2e,_0x4de842){if(_[_0xfc48('0x67')](_0x2a9e91)||_['isNil'](_0x2a9e91[_0xfc48('0xe1')])||_[_0xfc48('0x67')](_0x2a9e91[_0xfc48('0xe1')]['phone'])||_[_0xfc48('0x67')](_0x2a9e91[_0xfc48('0xe2')])){_0x4de842(ut[_0xfc48('0x4f')]('Contact\x20is\x20undefined',_0x16d02f,_0x3b1d94));return;}var _0x1d2984=uuid['v4']();var _0x336471=_0xdb0c4d[_0xfc48('0x14')][_0x2a9e91[_0xfc48('0x69')]['name']];var _0xdf8872=_0x4d09bf?_0xdb0c4d[_0xfc48('0x18')][_0x4d09bf]['id']:undefined;_0xdb0c4d[_0xfc48('0x17')][_0x1d2984]=new Action(_0x2a9e91,_0x336471,_0x1d2984,_0x4d09bf,_0xdf8872);var _0x58c218=_0xdb0c4d[_0xfc48('0x17')][_0x1d2984];_0x58c218[_0xfc48('0xba')]=_0x16d02f;_0x58c218[_0xfc48('0xbb')]=_0x3b1d94;_0x58c218['lookAgent']=_0x4d09bf;if(_['isEmpty'](_0x4e7ad8)){_0xdb0c4d[_0xfc48('0xe3')](_0x58c218,_0x336471,_0x2a9e91,_0x4d09bf)[_0xfc48('0x80')](function(_0x490285){logger[_0xfc48('0x68')]('[Preview][execCall][success]',_0xfc48('0xe4')+_0x58c218[_0xfc48('0x6a')]+_0xfc48('0xe5')+_0x58c218['idContact'],JSON['stringify'](_0x490285));ami[_0xfc48('0xa3')](_0xfc48('0xe6'),ut[_0xfc48('0xa4')](_0x58c218,_0xfc48('0xe7')));_0x61af2e(ut[_0xfc48('0x4f')](_0xfc48('0xe8')));})[_0xfc48('0x70')](function(_0x5a5298){ut['logger'](_0xfc48('0xe9'),_0x5a5298);_0x4de842(ut[_0xfc48('0x4f')](_0xfc48('0xea'),_0x16d02f,_0x3b1d94));});}else{_0x336471[_0xfc48('0xeb')]+=0x1;ut[_0xfc48('0xec')](_0x58c218);rpcDb[_0xfc48('0xed')](_0x58c218,'[Blacklist][error]');delete _0xdb0c4d[_0xfc48('0x17')][_0x1d2984];_0x4de842(ut[_0xfc48('0x4f')]('Contact\x20in\x20black\x20List',_0x16d02f,_0x3b1d94));}});};Preview[_0xfc48('0xf')]['isTrunkReachable']=function(_0x1c3b3c){return!_[_0xfc48('0x67')](_0x1c3b3c)&&!_[_0xfc48('0x67')](_0x1c3b3c[_0xfc48('0x2a')])&&!_[_0xfc48('0x67')](_0x1c3b3c[_0xfc48('0xee')])&&_0x1c3b3c[_0xfc48('0xee')]&&!_[_0xfc48('0x67')](this[_0xfc48('0x16')][util[_0xfc48('0x54')](_0xfc48('0xef'),_0x1c3b3c[_0xfc48('0x2a')])])&&!_[_0xfc48('0x67')](this[_0xfc48('0x16')][util[_0xfc48('0x54')](_0xfc48('0xef'),_0x1c3b3c[_0xfc48('0x2a')])][_0xfc48('0xf0')])&&(this['trunks'][util[_0xfc48('0x54')]('SIP/%s',_0x1c3b3c['name'])][_0xfc48('0xf0')]===_0xfc48('0xf1')||this[_0xfc48('0x16')][util[_0xfc48('0x54')]('SIP/%s',_0x1c3b3c['name'])]['status']===_0xfc48('0xf2'));};Preview[_0xfc48('0xf')][_0xfc48('0x7f')]=function(_0x1d5b38,_0x451496){var _0x31c970=this;return new BPromise(function(_0x38b841,_0x49202d){_0x31c970['execRun'](_0x1d5b38,_0x451496)[_0xfc48('0x80')](function(_0x3420c4){_0x38b841(_[_0xfc48('0xf3')](_0x3420c4,[_0xfc48('0x4f')]));})['catch'](function(_0xe9e5b9){if(_0xe9e5b9[_0xfc48('0xf4')]){rpcDb[_0xfc48('0xc9')](_0x1d5b38);}if(_0xe9e5b9[_0xfc48('0xee')]){rpcDb[_0xfc48('0xf5')](_0x1d5b38);}_0x49202d(_[_0xfc48('0xf3')](_0xe9e5b9,[_0xfc48('0x4f')]));});});};Preview['prototype'][_0xfc48('0xf6')]=function(_0x57498f,_0x49db9c){var _0x5c70ea=this;return new BPromise(function(_0x41cde5,_0x2b74c0){var _0x2b592d,_0x1c6fc7;rpcDb['getContactPreview'](_0x57498f)[_0xfc48('0x80')](function(_0x498026){if(!_['isNil'](_0x498026[0x0])){_0x1c6fc7=_0x498026[0x0][_0xfc48('0xf7')]?![]:!![];_0x2b592d=_0x498026[0x0][_0xfc48('0xf7')]?!![]:![];_0x2b592d=_0x49db9c?!![]:_0x2b592d;}var _0x4d9377=_0x5c70ea['validateContact'](_0x498026);if(_0x4d9377['isValid']){rpcDb[_0xfc48('0xf8')](_[_0xfc48('0xf3')](_0x498026[0x0],[_0xfc48('0xe2'),_0xfc48('0xf9')]))[_0xfc48('0x80')](function(_0x445499){_0x5c70ea['checkInBlack'](_0x445499,_0x498026[0x0],_0x49db9c,_0x1c6fc7,_0x2b592d)[_0xfc48('0x80')](function(_0x474c01){_0x41cde5(_0x474c01);})[_0xfc48('0x70')](function(_0x1b4824){_0x2b74c0(_0x1b4824);});})[_0xfc48('0x70')](function(_0x3617b1){ut['logger']('[Preview][checkIsBlackList]',_0x3617b1);_0x2b74c0(ut[_0xfc48('0x4f')](_0xfc48('0xfa'),_0x1c6fc7,_0x2b592d));});}else{_0x2b74c0(ut[_0xfc48('0x4f')](_0x4d9377['message'],_0x1c6fc7,_0x2b592d));}})['catch'](function(_0x26b434){ut[_0xfc48('0x5e')](_0xfc48('0xfb'),_0x26b434);_0x2b74c0(ut['message'](_0xfc48('0xfa'),![],!![]));});});};Preview[_0xfc48('0xf')][_0xfc48('0xfc')]=function(_0x578299){if(_[_0xfc48('0x67')](_0x578299)||_['isEmpty'](_0x578299)||!_['isNil'](_0x578299[0x0]['Agent'])&&_[_0xfc48('0x67')](_0x578299[0x0]['Agent'][_0xfc48('0x2a')])){ut['logger'](_0xfc48('0xfd'),_0x578299);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1900ca=this['campaignsPreview'][_0x578299[0x0][_0xfc48('0x69')]['name']];_0x1900ca[_0xfc48('0x4f')]='ACTIVE';if(_[_0xfc48('0x67')](_0x1900ca)){ut[_0xfc48('0x5e')](_0xfc48('0xfe'),_0x1900ca);return{'isValid':![],'message':_0xfc48('0xff')};}if(!this[_0xfc48('0x92')](_0x1900ca[_0xfc48('0x51')])){ut[_0xfc48('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xfc48('0x100')+_0x1900ca['name']+_0xfc48('0x101'));if(!this['isTrunkReachable'](_0x1900ca[_0xfc48('0x93')])){ut[_0xfc48('0x5e')](_0xfc48('0x102'),_0x1900ca[_0xfc48('0x2a')]+_0xfc48('0x103'));return{'isValid':![],'message':_0xfc48('0x104')};}}if(!ut['isActive'](_0x1900ca['dialActive'])){ut[_0xfc48('0x5e')](_0xfc48('0x105'),_0x1900ca[_0xfc48('0x2a')]+_0xfc48('0x106'));return{'isValid':![],'message':_0xfc48('0x100')+_0x1900ca[_0xfc48('0x2a')]+_0xfc48('0x106')};}return{'isValid':!![],'message':_0xfc48('0x107')};};Preview[_0xfc48('0xf')][_0xfc48('0xe3')]=function(_0x410b21,_0x10c035,_0x57ec8d,_0x508064){var _0x4515b5=this;return new BPromise(function(_0x1ebf3f,_0x5c06fb){var _0x14ecb2=_0x410b21[_0xfc48('0xb0')];var _0x38717d=_0x4515b5['isTrunkReachable'](_0x10c035[_0xfc48('0x51')])?util[_0xfc48('0x54')]('SIP/%s/%s%s',_0x10c035[_0xfc48('0x51')][_0xfc48('0x2a')],_[_0xfc48('0x67')](_0x10c035[_0xfc48('0x39')])?'':_0x10c035[_0xfc48('0x39')][_0xfc48('0x108')]()||'',_0x10c035[_0xfc48('0x109')]>0x0?_0x57ec8d[_0xfc48('0xe1')][_0xfc48('0x10a')]['substring'](_0x10c035['dialCutDigit']):_0x57ec8d['Contact'][_0xfc48('0x10a')]):util['format']('SIP/%s/%s%s',_[_0xfc48('0x67')](_0x10c035['TrunkBackup'])?_0x10c035[_0xfc48('0x51')]['name']:_0x10c035[_0xfc48('0x93')][_0xfc48('0x2a')],_[_0xfc48('0x67')](_0x10c035[_0xfc48('0x39')])?'':_0x10c035[_0xfc48('0x39')]['trim']()||'',_0x10c035[_0xfc48('0x109')]>0x0?_0x57ec8d[_0xfc48('0xe1')][_0xfc48('0x10a')][_0xfc48('0x10b')](_0x10c035[_0xfc48('0x109')]):_0x57ec8d[_0xfc48('0xe1')][_0xfc48('0x10a')]);var _0x5a68e3=_0x4515b5[_0xfc48('0x92')](_0x10c035[_0xfc48('0x51')])?ut[_0xfc48('0x10c')](_0x10c035[_0xfc48('0x51')]['callerid'],_0x10c035['dialOriginateCallerIdName'],_0x10c035['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xfc48('0x10d')](_0x10c035[_0xfc48('0x10e')],_0x10c035[_0xfc48('0x10f')]):_0x10c035[_0xfc48('0x10e')]):ut[_0xfc48('0x10c')](_[_0xfc48('0x67')](_0x10c035[_0xfc48('0x93')])?_0x10c035[_0xfc48('0x51')][_0xfc48('0x110')]:_0x10c035[_0xfc48('0x93')][_0xfc48('0x110')],_0x10c035['dialOriginateCallerIdName'],_0x10c035[_0xfc48('0x10f')]>0x0?ut[_0xfc48('0x10d')](_0x10c035[_0xfc48('0x10e')],_0x10c035[_0xfc48('0x10f')]):_0x10c035[_0xfc48('0x10e')]);if(_0x5a68e3){_0x410b21[_0xfc48('0x111')]=ut[_0xfc48('0x112')](_0x5a68e3);_0x410b21[_0xfc48('0x113')]=ut[_0xfc48('0x114')](_0x5a68e3);}var _0x5536ed=ut['addVariables'](_0x10c035,_0x57ec8d,_0x38717d,_0x5a68e3,_0x14ecb2,_0x410b21);_[_0xfc48('0x115')](_0x410b21,ut[_0xfc48('0x116')](_0x5536ed));_0x410b21['starttime']=moment()['format'](_0xfc48('0x84'));ami[_0xfc48('0x6f')](ut[_0xfc48('0x117')](_0x410b21,_0x10c035,_0x5536ed,_0x410b21[_0xfc48('0xbb')],_0x508064))['then'](function(_0x589a5e){_0x10c035[_0xfc48('0x50')]+=0x1;logger[_0xfc48('0x68')](_0xfc48('0x118'),_0x14ecb2,_0xfc48('0xa2'),_0x10c035[_0xfc48('0x2a')],'originated:\x20',_0x10c035['originated']);_0x1ebf3f(_0x589a5e);})[_0xfc48('0x70')](function(_0x3f8c15){ut[_0xfc48('0xd8')](_0x410b21,0xe,'OriginateError');rpcDb[_0xfc48('0xd9')](_0x410b21,_0xfc48('0x119'));_0x5c06fb(_0x3f8c15);});});};Preview[_0xfc48('0xf')][_0xfc48('0x11a')]=function(_0x353e00){if(this[_0xfc48('0x17')][_0x353e00[_0xfc48('0x9d')]]){this[_0xfc48('0x17')][_0x353e00[_0xfc48('0x9d')]][_0xfc48('0x11b')]=_0x353e00[_0xfc48('0x11b')];}};Preview[_0xfc48('0xf')]['syncOriginateResponse']=function(_0x37f79e){var _0x2f33db=this;var _0xe46ecf=this['actions'][_0x37f79e['actionid']];if(_0xe46ecf){if(_0xe46ecf[_0xfc48('0x11c')]&&this['agents'][_0xe46ecf['lookAgent']]){ut[_0xfc48('0x11d')](_0xe46ecf,this[_0xfc48('0x18')][_0xe46ecf[_0xfc48('0x11c')]][_0xfc48('0x2a')],this[_0xfc48('0x18')][_0xe46ecf['lookAgent']]['id']);}var _0x3ea3f9=_[_0xfc48('0x11e')](_0xe46ecf);_0x3ea3f9[_0xfc48('0x9f')]=moment()[_0xfc48('0x54')](_0xfc48('0x84'));var _0x50c259=_0x2f33db['campaignsPreview'][_0xe46ecf['queue']];if(ut[_0xfc48('0x11f')](_0x37f79e[_0xfc48('0x120')])){if(_0xe46ecf['unlockAgent']){rpcDb[_0xfc48('0xc9')](_0xe46ecf[_0xfc48('0xca')]);}if(_0xe46ecf[_0xfc48('0xbb')]){rpcDb['disableContact'](_0xe46ecf[_0xfc48('0xca')]);}ami[_0xfc48('0xa3')](_0xfc48('0x121'),ut[_0xfc48('0xa4')](_0xe46ecf,_0xfc48('0x122')));this[_0xfc48('0xd4')](_0x3ea3f9,_0x50c259,_0x37f79e);}else{_0xe46ecf[_0xfc48('0x83')]=moment()[_0xfc48('0x54')](_0xfc48('0x84'));ut['logAgent'](_0x3ea3f9,0x4,_0xfc48('0x123'));rpcDb[_0xfc48('0xd9')](_0x3ea3f9,_0xfc48('0x124'));}}};Preview[_0xfc48('0xf')][_0xfc48('0x1c')]=function(_0x446b3d){var _0x2ab972=this;var _0x2e35ee=this[_0xfc48('0x17')][_0x446b3d[_0xfc48('0x9d')]];var _0xc4cf69;if(_0x2e35ee){_0xc4cf69=this[_0xfc48('0x14')][_0x2e35ee[_0xfc48('0x6a')]];logger[_0xfc48('0x68')](_0xfc48('0x125'),_0x446b3d[_0xfc48('0x9d')],_0xfc48('0xa2'),_0xc4cf69[_0xfc48('0x2a')],_0xfc48('0x6b'),_0xc4cf69[_0xfc48('0x2f')]);}if(this[_0xfc48('0x17')][_0x446b3d[_0xfc48('0x9d')]]&&_0x446b3d['linkedid']!==_0x446b3d[_0xfc48('0xb0')]){if(_0x446b3d[_0xfc48('0x126')]==='16'&&this[_0xfc48('0x17')][_0x446b3d['linkedid']][_0xfc48('0x6c')]){this['callProgressDetectingCustomer'](_0x446b3d,_0x446b3d[_0xfc48('0x9d')],_0x446b3d['cause']);}else if(this[_0xfc48('0x17')][_0x446b3d['linkedid']][_0xfc48('0x6c')]){logger[_0xfc48('0x68')](_0xfc48('0x127'),_0x446b3d[_0xfc48('0x9d')],_0x446b3d[_0xfc48('0x126')],'\x20Queue',_0xc4cf69[_0xfc48('0x2a')],_0xfc48('0x6b'),_0xc4cf69[_0xfc48('0x2f')]);this[_0xfc48('0x95')](_0x446b3d,_0x446b3d[_0xfc48('0x9d')],_0x446b3d[_0xfc48('0x126')]);}}else if(_0x2e35ee&&_['isNil'](_0x2e35ee['statedesc'])&&_0xc4cf69[_0xfc48('0x128')]&&_0x446b3d['linkedid']===_0x446b3d[_0xfc48('0xb0')]&&_[_0xfc48('0x67')](_0x446b3d[_0xfc48('0xd7')])&&_0x446b3d[_0xfc48('0x126')]==='16'&&_0x446b3d[_0xfc48('0x129')]==='6'&&_['isUndefined'](_0x2e35ee[_0xfc48('0x12a')])){if(_0x2e35ee[_0xfc48('0xba')]){rpcDb[_0xfc48('0xc9')](_0x2e35ee[_0xfc48('0xca')]);}if(_0x2e35ee[_0xfc48('0xbb')]){rpcDb['disableContact'](_0x2e35ee[_0xfc48('0xca')]);}_0x446b3d['reason']='22';this[_0xfc48('0xd4')](_0x2e35ee,_0xc4cf69,_0x446b3d);}else if(_0x2e35ee&&_0x2e35ee[_0xfc48('0x12a')]){if(_0x446b3d[_0xfc48('0x126')]==='16'&&this['actions'][_0x446b3d[_0xfc48('0x9d')]]['dialAnswer']){logger[_0xfc48('0x68')](_0xfc48('0x12b'),_0x446b3d[_0xfc48('0x9d')],_0x446b3d[_0xfc48('0x126')],_0xfc48('0xa2'),_0xc4cf69[_0xfc48('0x2a')],_0xfc48('0x6b'),_0xc4cf69[_0xfc48('0x2f')]);this[_0xfc48('0x95')](_0x446b3d,_0x446b3d[_0xfc48('0x9d')],_0x446b3d['cause']);}else if(this[_0xfc48('0x17')][_0x446b3d[_0xfc48('0x9d')]][_0xfc48('0x6c')]){logger[_0xfc48('0x68')](_0xfc48('0x127'),_0x446b3d[_0xfc48('0x9d')],_0x446b3d[_0xfc48('0x126')],_0xfc48('0xa2'),_0xc4cf69[_0xfc48('0x2a')],_0xfc48('0x6b'),_0xc4cf69[_0xfc48('0x2f')]);this[_0xfc48('0x95')](_0x446b3d,_0x446b3d[_0xfc48('0x9d')],_0x446b3d[_0xfc48('0x126')]);}}};Preview[_0xfc48('0xf')][_0xfc48('0x20')]=function(_0x20f62c){if(this[_0xfc48('0x17')][_0x20f62c[_0xfc48('0x12c')]]&&_0x20f62c['destlinkedid']!==_0x20f62c[_0xfc48('0x12d')]){this[_0xfc48('0x95')](_0x20f62c,_0x20f62c[_0xfc48('0x12c')],_0x20f62c[_0xfc48('0xcf')]);}};Preview['prototype'][_0xfc48('0x1e')]=function(_0x33a686){if(this[_0xfc48('0x17')][_0x33a686[_0xfc48('0x9d')]]&&_0x33a686[_0xfc48('0x9d')]!==_0x33a686[_0xfc48('0xb0')]&&!this[_0xfc48('0x17')][_0x33a686[_0xfc48('0x9d')]][_0xfc48('0x6c')]){if(_0x33a686[_0xfc48('0x126')]==='1'){this[_0xfc48('0x95')](_0x33a686,_0x33a686[_0xfc48('0x9d')],_0x33a686['cause']);}}};Preview[_0xfc48('0xf')][_0xfc48('0x12e')]=function(_0xd25704,_0x4a612d,_0x186f62){if(this['actions'][_0xd25704]){if(_[_0xfc48('0x67')](this[_0xfc48('0x17')][_0xd25704][_0xfc48('0x12f')])){this[_0xfc48('0x17')][_0xd25704][_0xfc48('0x12f')]={};}this[_0xfc48('0x17')][_0xd25704][_0xfc48('0x12f')][_0x4a612d]=_0x186f62;}};Preview[_0xfc48('0xf')][_0xfc48('0x22')]=function(_0xd857e){try{if(!_[_0xfc48('0x67')](_0xd857e)){if(ut[_0xfc48('0x130')](_[_0xfc48('0x131')](_0xd857e['variable'])[0x0])){this['addVariable'](_0xd857e[_0xfc48('0xb0')],_['keys'](_0xd857e[_0xfc48('0x132')])[0x0],_0xd857e[_0xfc48('0x133')]);}}}catch(_0x582241){logger[_0xfc48('0x134')](_0xfc48('0x135'),util[_0xfc48('0x136')](_0x582241,{'showHidden':![],'depth':null}));}};Preview[_0xfc48('0xf')][_0xfc48('0x24')]=function(_0x40796b){if(_0x40796b){if(this[_0xfc48('0x17')][_0x40796b[_0xfc48('0x137')]]){this[_0xfc48('0x17')][_0x40796b[_0xfc48('0x137')]][_0xfc48('0x12a')]=!![];}}};Preview[_0xfc48('0xf')][_0xfc48('0x26')]=function(_0x3cdf0a){if(_0x3cdf0a){if(this[_0xfc48('0x17')][_0x3cdf0a[_0xfc48('0x138')]]){this[_0xfc48('0x17')][_0x3cdf0a['transfererlinkedid']][_0xfc48('0x12a')]=!![];}}};module['exports']=Preview;
\ No newline at end of file
+var _0x51e7=['responsetime','isFailure','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','moment','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./action','redis','defaults','localhost','socket.io-emitter','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','Trunk','active','callerid','Interval','stringify','voice:queue:%s','format','originated','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','prototype','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','type','recallMe','enqueue','isNil','info','Queue','originated:\x20','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agents','then','getDiff','scheduledat','dialRecallMeTimeout','run','[RecallMe]','starttime','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','logger2','setMessage','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','linkedid','countbusyretry','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','NoAnswer','Global','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','scheduledAt','CONGESTION','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','disableContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0x51e7,0x14e));var _0x751e=function(_0x8b8060,_0x3dd837){_0x8b8060=_0x8b8060-0x0;var _0x50e6dc=_0x51e7[_0x8b8060];return _0x50e6dc;};'use strict';var util=require('util');var _=require(_0x751e('0x0'));var BPromise=require(_0x751e('0x1'));var uuid=require('uuid');var moment=require(_0x751e('0x2'));var md5=require(_0x751e('0x3'));var Redis=require('ioredis');var config=require(_0x751e('0x4'));var logger=require(_0x751e('0x5'))('preview');var loggerAction=require(_0x751e('0x5'))(_0x751e('0x6'));var ami=require(_0x751e('0x7'));var rpcDb=require('./rpcDb');var Action=require(_0x751e('0x8'));var ut=require('./util/util');config[_0x751e('0x9')]=_[_0x751e('0xa')](config[_0x751e('0x9')],{'host':_0x751e('0xb'),'port':0x18eb});var io=require(_0x751e('0xc'))(new Redis(config[_0x751e('0x9')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x52beeb){this[_0x751e('0xd')]=this['tail']?this[_0x751e('0xd')][_0x751e('0xe')](_0x52beeb):_0x52beeb();};function Preview(_0x133962){this[_0x751e('0xf')]=new Sequence();this[_0x751e('0x10')]=_0x133962[_0x751e('0x11')];this[_0x751e('0x12')]=_0x133962[_0x751e('0x12')];this[_0x751e('0x13')]={};this['agents']=_0x133962['agents'];this[_0x751e('0x14')]=0x0;ami['on'](_0x751e('0x15'),this[_0x751e('0x16')][_0x751e('0x17')](this));ami['on'](_0x751e('0x18'),this[_0x751e('0x19')][_0x751e('0x17')](this));ami['on'](_0x751e('0x1a'),this[_0x751e('0x1b')][_0x751e('0x17')](this));ami['on']('dialend',this[_0x751e('0x1c')][_0x751e('0x17')](this));ami['on'](_0x751e('0x1d'),this['syncNewExten'][_0x751e('0x17')](this));ami['on'](_0x751e('0x1e'),this[_0x751e('0x1f')][_0x751e('0x17')](this));ami['on']('attendedtransfer',this[_0x751e('0x20')][_0x751e('0x17')](this));ami['on'](_0x751e('0x21'),this[_0x751e('0x22')][_0x751e('0x17')](this));this['loopCampaigns'](this[_0x751e('0x10')]);}function emit(_0x3baefa,_0x46871f,_0x37084f){io['to'](_0x3baefa)[_0x751e('0x23')](_0x46871f,_0x37084f);}function emitCampaignPreview(_0x412f0a){if(_0x412f0a['type']===_0x751e('0x24')){var _0xe2e8cd={'id':_0x412f0a['id'],'name':_0x412f0a[_0x751e('0x25')],'strategy':_0x412f0a[_0x751e('0x26')],'answered':_0x412f0a[_0x751e('0x27')],'available':_0x412f0a[_0x751e('0x28')],'loggedIn':_0x412f0a[_0x751e('0x29')],'pTalking':_0x412f0a[_0x751e('0x2a')],'sumBillable':_0x412f0a['sumBillable'],'sumDuration':_0x412f0a[_0x751e('0x2b')],'sumHoldTime':_0x412f0a[_0x751e('0x2c')]||0x0,'talking':_0x412f0a['talking'],'total':_0x412f0a[_0x751e('0x2d')],'type':_0x412f0a['type'],'unmanaged':_0x412f0a['unmanaged'],'abandoned':_0x412f0a['abandoned'],'waiting':_0x412f0a[_0x751e('0x2e')],'loggedInDb':_0x412f0a[_0x751e('0x2f')],'dialActive':_0x412f0a[_0x751e('0x30')],'dialMethod':_0x412f0a[_0x751e('0x31')],'dialOriginateCallerIdName':_0x412f0a[_0x751e('0x32')],'dialOriginateCallerIdNumber':_0x412f0a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x412f0a[_0x751e('0x33')],'dialPrefix':_0x412f0a[_0x751e('0x34')],'outboundAnswerAgiCallsDay':_0x412f0a[_0x751e('0x35')],'outboundAnswerCallsDay':_0x412f0a[_0x751e('0x36')],'outboundBlacklistCallsDay':_0x412f0a[_0x751e('0x37')],'outboundBusyCallsDay':_0x412f0a[_0x751e('0x38')],'outboundCongestionCallsDay':_0x412f0a[_0x751e('0x39')],'outboundDropCallsDayACS':_0x412f0a[_0x751e('0x3a')],'outboundDropCallsDayCallersExit':_0x412f0a[_0x751e('0x3b')],'outboundDropCallsDayTimeout':_0x412f0a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x412f0a[_0x751e('0x3c')],'outboundNoSuchCallsDay':_0x412f0a[_0x751e('0x3d')],'outboundOriginateFailureCallsDay':_0x412f0a[_0x751e('0x3e')],'outboundReCallsDay':_0x412f0a[_0x751e('0x3f')],'outboundRejectCallsDay':_0x412f0a[_0x751e('0x40')],'outboundUnknownCallsDay':_0x412f0a[_0x751e('0x41')],'predictiveIntervalAnsweredCalls':_0x412f0a[_0x751e('0x42')],'predictiveIntervalAvgHoldtime':_0x412f0a[_0x751e('0x43')],'predictiveIntervalAvgTalktime':_0x412f0a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x412f0a[_0x751e('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x412f0a[_0x751e('0x45')],'predictiveIntervalErlangCalls':_0x412f0a[_0x751e('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x412f0a[_0x751e('0x47')],'predictiveIntervalHitRate':_0x412f0a[_0x751e('0x48')],'predictiveIntervalLowerLimit':_0x412f0a[_0x751e('0x49')],'predictiveIntervalMultiplicativeFactor':_0x412f0a[_0x751e('0x4a')],'predictiveIntervalPauses':_0x412f0a[_0x751e('0x4b')],'predictiveIntervalTotalCalls':_0x412f0a[_0x751e('0x4c')],'message':_0x412f0a[_0x751e('0x4d')],'originated':_0x412f0a['originated']};if(_0x412f0a[_0x751e('0x4e')]){_0xe2e8cd['Trunk']={'id':_0x412f0a[_0x751e('0x4e')]['id'],'name':_0x412f0a[_0x751e('0x4e')][_0x751e('0x25')],'active':_0x412f0a[_0x751e('0x4e')][_0x751e('0x4f')],'callerid':_0x412f0a[_0x751e('0x4e')][_0x751e('0x50')]};}if(_0x412f0a['Interval']){_0xe2e8cd[_0x751e('0x51')]={'id':_0x412f0a[_0x751e('0x51')]['id'],'name':_0x412f0a[_0x751e('0x51')]['name']};}var _0x32d896=md5(JSON[_0x751e('0x52')](_0xe2e8cd));if(_0x412f0a[_0x751e('0x3')]!==_0x32d896){_0x412f0a[_0x751e('0x3')]=_0x32d896;emit(util['format'](_0x751e('0x53'),_0xe2e8cd[_0x751e('0x25')]),'voice_queue:save',_0xe2e8cd);}}}function emitVoiceQueueChannelRemove(_0x190222){emit(util[_0x751e('0x54')](_0x751e('0x53'),_0x190222[_0x751e('0x25')]),'voice_queue_channel:remove',_0x190222);}function notSendMessagesQueue(_0x3c900b){if(_0x3c900b['sendMessageOneNotActive']){if(_0x3c900b[_0x751e('0x55')]===0x0&&_0x3c900b[_0x751e('0x2a')]===0x0){_0x3c900b[_0x751e('0x56')]=![];_0x3c900b[_0x751e('0x28')]=0x0;_0x3c900b[_0x751e('0x57')]=0x0;_0x3c900b[_0x751e('0x4d')]=_0x751e('0x58');ut[_0x751e('0x59')](_0x751e('0x5a'),_0x3c900b[_0x751e('0x25')]+_0x751e('0x5b'));}else{_0x3c900b[_0x751e('0x4d')]=_0x751e('0x5c');ut[_0x751e('0x59')](_0x751e('0x5a'),_0x3c900b[_0x751e('0x25')]+'\x20is\x20disactive');}emitCampaignPreview(_0x3c900b);}}Preview[_0x751e('0x5d')]['loopCampaigns']=function(){var _0x555ed0=this;setInterval(function(){_0x555ed0['syncCampaigns']();},0x7cf);};Preview[_0x751e('0x5d')][_0x751e('0x5e')]=function(){var _0x421a45=this[_0x751e('0x10')];this[_0x751e('0x14')]+=0x1;for(var _0x2ce601 in _0x421a45){if(_0x421a45[_0x751e('0x5f')](_0x2ce601)&&(_0x421a45[_0x2ce601][_0x751e('0x31')]===_0x751e('0x60')||_0x421a45[_0x2ce601][_0x751e('0x31')]===_0x751e('0x61'))&&_0x421a45[_0x2ce601]['type']===_0x751e('0x24')){if(this[_0x751e('0x14')]>0x7){this[_0x751e('0x14')]=0x0;this[_0x751e('0x62')]();}}if(_0x421a45[_0x751e('0x5f')](_0x2ce601)&&_0x421a45[_0x2ce601][_0x751e('0x31')]==='preview'&&_0x421a45[_0x2ce601][_0x751e('0x63')]===_0x751e('0x24')){if(_0x421a45[_0x2ce601][_0x751e('0x30')]){this['setMessage'](_0x421a45[_0x2ce601]);this[_0x751e('0x64')](_0x421a45[_0x2ce601]);}else{notSendMessagesQueue(_0x421a45[_0x2ce601]);}}}};Preview[_0x751e('0x5d')]['clearZombieChannel']=function(_0x1516d2){var _0x2b299b=this;this[_0x751e('0xf')][_0x751e('0x65')](function(){if(!_[_0x751e('0x66')](_0x2b299b[_0x751e('0x13')][_0x1516d2])){loggerAction[_0x751e('0x67')]('[clearZombieChannels][talking]',_0x1516d2,_0x751e('0x68'),_0x2b299b[_0x751e('0x13')][_0x1516d2]['queue'],_0x751e('0x69'),JSON[_0x751e('0x52')](_0x2b299b[_0x751e('0x10')][_0x2b299b[_0x751e('0x13')][_0x1516d2]['queue']][_0x751e('0x55')]),_0x751e('0x6a'),JSON[_0x751e('0x52')](_0x2b299b[_0x751e('0x10')][_0x2b299b[_0x751e('0x13')][_0x1516d2][_0x751e('0x6b')]][_0x751e('0x2a')]),JSON['stringify'](_0x2b299b[_0x751e('0x13')][_0x1516d2][_0x751e('0x6c')]),JSON[_0x751e('0x52')](_[_0x751e('0x6d')](_0x2b299b[_0x751e('0x13')][_0x1516d2],[_0x751e('0x6e'),_0x751e('0x6f'),_0x751e('0x70'),_0x751e('0x71')])));return ami[_0x751e('0x72')]({'action':_0x751e('0x73'),'channel':_0x2b299b[_0x751e('0x13')][_0x1516d2][_0x751e('0x74')]})[_0x751e('0x75')](function(_0x29b166){if(_0x29b166['message']===_0x751e('0x76')){setTimeout(function(){if(_0x2b299b['actions'][_0x1516d2]){ut[_0x751e('0x77')](_0x2b299b[_0x751e('0x10')][_0x2b299b[_0x751e('0x13')][_0x1516d2][_0x751e('0x6b')]],'[clearZombieChannel]');if(_0x2b299b['actions'][_0x1516d2]['dialAnswer']===!![]){ut[_0x751e('0x78')](_0x2b299b[_0x751e('0x10')][_0x2b299b[_0x751e('0x13')][_0x1516d2]['queue']],_0x751e('0x79'));ut['loggerError'](_0x751e('0x7a')+_0x1516d2,_0x2b299b[_0x751e('0x13')][_0x1516d2][_0x751e('0x6b')]);}ut[_0x751e('0x7b')](_0x751e('0x7c')+_0x1516d2,_0x2b299b[_0x751e('0x13')][_0x1516d2]['queue']);delete _0x2b299b[_0x751e('0x13')][_0x1516d2];}},0x2328);}});}});};Preview[_0x751e('0x5d')][_0x751e('0x62')]=function(){var _0x5593de=this;loggerAction['info'](_0x751e('0x7d'),_[_0x751e('0x7e')](this[_0x751e('0x13')]));for(var _0x4f7670 in this['actions']){if(_0x5593de[_0x751e('0x13')][_0x751e('0x5f')](_0x4f7670)){_0x5593de[_0x751e('0x7f')](_0x4f7670);}}};Preview[_0x751e('0x5d')][_0x751e('0x64')]=function(_0x2b46d4){var _0x4010b7=this;rpcDb[_0x751e('0x80')](_0x2b46d4['id'],ut['agentReadyId'](this[_0x751e('0x81')]))[_0x751e('0x82')](function(_0x142cfc){if(!_[_0x751e('0x66')](_0x142cfc)){for(var _0x4fccf3=0x0;_0x4fccf3<_0x142cfc['length'];_0x4fccf3+=0x1){if(ut[_0x751e('0x83')](_0x142cfc[_0x4fccf3][_0x751e('0x84')])<_0x2b46d4[_0x751e('0x85')]*0x3c){_0x4010b7[_0x751e('0x86')](_0x142cfc[_0x4fccf3]['id'])['then'](ut['logger2'](_0x751e('0x87')))[_0x751e('0x75')](ut['logger2'](_0x751e('0x87')));}else{var _0x470dad=new Action(_0x142cfc[_0x4fccf3],_0x2b46d4);_0x470dad[_0x751e('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b46d4['outboundReCallsDay']+=0x1;ut[_0x751e('0x89')](_0x470dad,0x17,'RecallInQueue');if(_0x2b46d4[_0x751e('0x8a')]){rpcDb['rescheduleContactInQueue'](ut[_0x751e('0x8b')](_0x142cfc[_0x4fccf3]));rpcDb[_0x751e('0x8c')](_0x470dad,_0x751e('0x8d'));}else{ut[_0x751e('0x89')](_0x470dad,0x16,'RecallFailedTimeout');rpcDb[_0x751e('0x8c')](_0x470dad,_0x751e('0x8e'));rpcDb[_0x751e('0x8f')](_0x470dad,'[HistoryRecallClose]');}}}}})['catch'](ut[_0x751e('0x90')]('[getContactRecallMe]'));};Preview['prototype'][_0x751e('0x91')]=function(_0x31abca){_0x31abca['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x31abca[_0x751e('0x29')])){_0x31abca[_0x751e('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x31abca[_0x751e('0x30')])){_0x31abca[_0x751e('0x4d')]='NOT_ACTIVE';}else if(!this[_0x751e('0x92')](_0x31abca[_0x751e('0x4e')])){if(!this[_0x751e('0x92')](_0x31abca['TrunkBackup'])){_0x31abca[_0x751e('0x4d')]=_0x751e('0x93');}else{_0x31abca[_0x751e('0x4d')]=_0x751e('0x94');}}else{_0x31abca[_0x751e('0x4d')]='ACTIVE';}emitCampaignPreview(_0x31abca);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x45348b,_0x4ed73e,_0x37119e){var _0x44a79c=this;var _0xe4cec0=this[_0x751e('0x13')][_0x4ed73e];var _0x3904f9=this[_0x751e('0x10')][_0xe4cec0[_0x751e('0x6b')]];var _0x3acd48;if(_0x3904f9){switch(_0x37119e){case'1':_0x3904f9[_0x751e('0x3d')]+=0x1;_0xe4cec0[_0x751e('0x95')]=ut[_0x751e('0x96')](_0xe4cec0);ut[_0x751e('0x89')](_0xe4cec0,0x0,_0x751e('0x97'));rpcDb[_0x751e('0x8c')](_0xe4cec0,_0x751e('0x98'));if(ut[_0x751e('0x96')](_0xe4cec0)>=_0x3904f9[_0x751e('0x99')]){_0x3acd48=ut[_0x751e('0x9a')](_0xe4cec0,0xf,'Global');rpcDb[_0x751e('0x8f')](_0x3acd48,_0x751e('0x9b'));}else{rpcDb[_0x751e('0x8f')](_0xe4cec0,'[callProgressDetectingCustomer][logNoSuchGlobal]');}delete this[_0x751e('0x13')][_0x45348b['linkedid']];break;case _0x751e('0x9c'):var _0x243292=moment()[_0x751e('0x54')](_0x751e('0x9d'));_0xe4cec0['responsetime']=_0x243292;_0xe4cec0[_0x751e('0x9e')]=_0x243292;_0xe4cec0['dialAnswer']=!![];_0x3904f9[_0x751e('0x2a')]+=0x1;logger[_0x751e('0x67')](_0x751e('0x9f'),_0xe4cec0[_0x751e('0xa0')],_0x751e('0xa1'),_0x3904f9['name'],_0x751e('0x6a'),_0x3904f9['pTalking']);ami['emit'](_0x751e('0xa2'),ut['buildObj'](_0xe4cec0,'connect'));if(_0x3904f9['acw']){ami[_0x751e('0x23')](_0x751e('0xa3'),ut[_0x751e('0xa4')](_0xe4cec0));}break;case'16':ami['emit'](_0x751e('0xa5'),ut[_0x751e('0xa6')](_0xe4cec0,_0x751e('0xa7')));emitVoiceQueueChannelRemove(ut[_0x751e('0xa6')](_0xe4cec0,_0x751e('0xa7')));_0x3904f9[_0x751e('0x36')]+=0x1;_0x3904f9[_0x751e('0x2d')]+=0x1;_0x3904f9[_0x751e('0x27')]+=0x1;ut[_0x751e('0x78')](_0x3904f9,_0x751e('0xa8'));_0xe4cec0[_0x751e('0x95')]=ut['totalGlobal'](_0xe4cec0);ut[_0x751e('0x89')](_0xe4cec0,0x4,_0x751e('0xa9'));rpcDb[_0x751e('0x8c')](_0xe4cec0,_0x751e('0xaa'));rpcDb[_0x751e('0x8f')](_0xe4cec0,_0x751e('0xab'));rpcDb[_0x751e('0xac')](_0xe4cec0);_0x3904f9[_0x751e('0x2b')]+=_0xe4cec0['talktime'];_0x3904f9[_0x751e('0xad')]+=_0xe4cec0[_0x751e('0xae')];logger[_0x751e('0x67')]('[syncHangup][talking][decrement]',_0xe4cec0[_0x751e('0xa0')],_0x751e('0xa1'),_0x3904f9[_0x751e('0x25')],_0x751e('0x6a'),_0x3904f9[_0x751e('0x2a')]);delete this[_0x751e('0x13')][_0x45348b[_0x751e('0xaf')]];break;case'BUSY':_0x3904f9['outboundBusyCallsDay']+=0x1;_0xe4cec0[_0x751e('0xb0')]+=0x1;_0xe4cec0[_0x751e('0x95')]=ut[_0x751e('0x96')](_0xe4cec0);ut[_0x751e('0x89')](_0xe4cec0,0x5,'Busy');rpcDb['createCustomerHistory'](_0xe4cec0,_0x751e('0xb1'));if(ut[_0x751e('0x96')](_0xe4cec0)>=_0x3904f9[_0x751e('0x99')]){_0x3acd48=ut[_0x751e('0x9a')](_0xe4cec0,0xf,'Global');rpcDb[_0x751e('0x8f')](_0x3acd48,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0xe4cec0[_0x751e('0xb0')]>=_0x3904f9[_0x751e('0xb2')]){rpcDb['createCustomerFinal'](_0xe4cec0,_0x751e('0xb1'));}else{rpcDb[_0x751e('0xb3')](ut['scheduledAt'](_0xe4cec0,'countbusyretry',_0x3904f9[_0x751e('0xb4')]),_0xe4cec0[_0x751e('0xb5')],_0xe4cec0[_0x751e('0xb6')]);}}break;case _0x751e('0xb7'):_0x3904f9[_0x751e('0x3c')]+=0x1;_0xe4cec0[_0x751e('0xb8')]+=0x1;_0xe4cec0['countglobal']=ut[_0x751e('0x96')](_0xe4cec0);ut[_0x751e('0x89')](_0xe4cec0,0x3,_0x751e('0xb9'));rpcDb[_0x751e('0x8c')](_0xe4cec0,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x751e('0x96')](_0xe4cec0)>=_0x3904f9[_0x751e('0x99')]){_0x3acd48=ut[_0x751e('0x9a')](_0xe4cec0,0xf,_0x751e('0xba'));rpcDb[_0x751e('0x8f')](_0x3acd48,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xe4cec0[_0x751e('0xb8')]>=_0x3904f9[_0x751e('0xbb')]){rpcDb['createCustomerFinal'](_0xe4cec0,_0x751e('0xbc'));}else{rpcDb[_0x751e('0xb3')](ut[_0x751e('0xbd')](_0xe4cec0,_0x751e('0xb8'),_0x3904f9['dialNoAnswerRetryFrequency']),_0xe4cec0[_0x751e('0xb5')],_0xe4cec0[_0x751e('0xb6')]);}}break;case _0x751e('0xbe'):_0x3904f9[_0x751e('0x39')]+=0x1;_0xe4cec0['countcongestionretry']+=0x1;_0xe4cec0[_0x751e('0x95')]=ut[_0x751e('0x96')](_0xe4cec0);ut[_0x751e('0x89')](_0xe4cec0,0x8,_0x751e('0xbf'));rpcDb['createCustomerHistory'](_0xe4cec0,_0x751e('0xc0'));if(ut[_0x751e('0x96')](_0xe4cec0)>=_0x3904f9['dialGlobalMaxRetry']){_0x3acd48=ut[_0x751e('0x9a')](_0xe4cec0,0xf,_0x751e('0xba'));rpcDb[_0x751e('0x8f')](_0x3acd48,_0x751e('0xc1'));}else{if(_0xe4cec0[_0x751e('0xc2')]>=_0x3904f9[_0x751e('0xc3')]){rpcDb[_0x751e('0x8f')](_0xe4cec0,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x751e('0xb3')](ut[_0x751e('0xbd')](_0xe4cec0,_0x751e('0xc2'),_0x3904f9[_0x751e('0xb4')]),_0xe4cec0[_0x751e('0xb5')],_0xe4cec0['activeContact']);}}break;case _0x751e('0xc4'):_0x3904f9[_0x751e('0x40')]+=0x1;_0xe4cec0[_0x751e('0x95')]=ut[_0x751e('0x96')](_0xe4cec0);ut[_0x751e('0x89')](_0xe4cec0,0x14,_0x751e('0xc5'));rpcDb['createCustomerHistory'](_0xe4cec0,_0x751e('0xc6'));if(_0xe4cec0[_0x751e('0xb5')]){rpcDb['unlockContact'](_0xe4cec0['idContact']);}if(_0xe4cec0[_0x751e('0xb6')]){rpcDb[_0x751e('0xc7')](_0xe4cec0[_0x751e('0xc8')]);}break;default:if(_0xe4cec0[_0x751e('0x6c')]){ut[_0x751e('0x78')](_0x3904f9,_0x751e('0xc9'));ut[_0x751e('0x7b')](_0x751e('0xca')+_0x3904f9[_0x751e('0x25')],_0x45348b);}_0x3904f9[_0x751e('0x41')]+=0x1;_0xe4cec0[_0x751e('0x95')]=ut[_0x751e('0x96')](_0xe4cec0);ut[_0x751e('0x89')](_0xe4cec0,0xc,_0x45348b[_0x751e('0xcb')]||_0x45348b[_0x751e('0xcc')]);rpcDb['createCustomerHistory'](_0xe4cec0,_0x751e('0xcd'));if(ut[_0x751e('0x96')](_0xe4cec0)>=_0x3904f9['dialGlobalMaxRetry']){_0x3acd48=ut[_0x751e('0x9a')](_0xe4cec0,0xf,_0x751e('0xba'));rpcDb[_0x751e('0x8f')](_0x3acd48,_0x751e('0xce'));}else{rpcDb[_0x751e('0x8f')](_0xe4cec0,_0x751e('0xce'));}delete this[_0x751e('0x13')][_0x45348b[_0x751e('0xaf')]];}if(!(_0xe4cec0[_0x751e('0x6c')]&&_0x37119e==='16')){ut[_0x751e('0x77')](_0x3904f9,_0x751e('0xcf'));logger[_0x751e('0x67')]('[originated][decrement][callProgressDetectingCustomer]',_0xe4cec0['uniqueid'],_0x751e('0xa1'),_0x3904f9[_0x751e('0x25')],'originated:\x20',_0x3904f9['originated']);}if(_0x37119e!=='ANSWER'){delete this['actions'][_0x45348b[_0x751e('0xaf')]];delete this['actions'][_0x45348b[_0x751e('0xd0')]];}}};Preview[_0x751e('0x5d')][_0x751e('0xd1')]=function(_0x2c98dd,_0x1e02b9,_0x3bd2d8){if(_[_0x751e('0xd2')](_0x1e02b9)&&_0x751e('0xd3')!==typeof _0x1e02b9){return;}if(_[_0x751e('0xd2')](_0x3bd2d8)&&_0x751e('0xd3')!==typeof _0x3bd2d8){return;}switch(_0x3bd2d8['reason']){case'0':ut[_0x751e('0xd4')](_0x2c98dd,0x0,_0x751e('0x97'));rpcDb[_0x751e('0xd5')](_0x2c98dd,_0x751e('0xd6'));break;case'3':ut[_0x751e('0xd4')](_0x2c98dd,0x3,_0x751e('0xb9'));rpcDb[_0x751e('0xd5')](_0x2c98dd,_0x751e('0xd7'));break;case'5':ut[_0x751e('0xd4')](_0x2c98dd,0x5,'Busy');rpcDb[_0x751e('0xd5')](_0x2c98dd,_0x751e('0xd8'));break;case'8':ut['logAgent'](_0x2c98dd,0x8,'Congestion');rpcDb['createAgentHistory'](_0x2c98dd,_0x751e('0xd9'));break;case'22':ut[_0x751e('0xd4')](_0x2c98dd,0x16,_0x751e('0xda'));rpcDb['createAgentHistory'](_0x2c98dd,_0x751e('0xdb'));break;default:ut['logAgent'](_0x2c98dd,0xc,_0x3bd2d8[_0x751e('0xdc')]);rpcDb['createAgentHistory'](_0x2c98dd,_0x751e('0xd9'));}ut[_0x751e('0x77')](_0x1e02b9,_0x751e('0xdd'));logger[_0x751e('0x67')](_0x751e('0xde'),_0x2c98dd[_0x751e('0xa0')],_0x751e('0xa1'),_0x1e02b9[_0x751e('0x25')],'originated:\x20',_0x1e02b9[_0x751e('0x55')]);delete this['actions'][_0x2c98dd[_0x751e('0xa0')]];};Preview[_0x751e('0x5d')][_0x751e('0xdf')]=function(_0x39e6a2,_0x1bc443,_0x5efc78,_0x14fa53,_0x45f0d5){var _0x1af64d=this;return new BPromise(function(_0x357d4f,_0x1f6be1){if(_['isNil'](_0x1bc443)||_[_0x751e('0x66')](_0x1bc443[_0x751e('0xe0')])||_[_0x751e('0x66')](_0x1bc443[_0x751e('0xe0')][_0x751e('0xe1')])||_[_0x751e('0x66')](_0x1bc443['VoiceQueueId'])){_0x1f6be1(ut[_0x751e('0x4d')](_0x751e('0xe2'),_0x14fa53,_0x45f0d5));return;}var _0x439436=uuid['v4']();var _0x32d4c4=_0x1af64d[_0x751e('0x10')][_0x1bc443[_0x751e('0x68')][_0x751e('0x25')]];var _0x3bdbb7=_0x5efc78?_0x1af64d[_0x751e('0x81')][_0x5efc78]['id']:undefined;_0x1af64d['actions'][_0x439436]=new Action(_0x1bc443,_0x32d4c4,_0x439436,_0x5efc78,_0x3bdbb7);var _0x54dc11=_0x1af64d[_0x751e('0x13')][_0x439436];_0x54dc11['unlockAgent']=_0x14fa53;_0x54dc11[_0x751e('0xb6')]=_0x45f0d5;_0x54dc11[_0x751e('0xe3')]=_0x5efc78;if(_['isEmpty'](_0x39e6a2)){_0x1af64d['execCall'](_0x54dc11,_0x32d4c4,_0x1bc443,_0x5efc78)[_0x751e('0x82')](function(_0x558cfa){logger[_0x751e('0x67')](_0x751e('0xe4'),_0x751e('0xe5')+_0x54dc11[_0x751e('0x6b')]+_0x751e('0xe6')+_0x54dc11[_0x751e('0xc8')],JSON[_0x751e('0x52')](_0x558cfa));ami[_0x751e('0x23')](_0x751e('0xe7'),ut[_0x751e('0xa6')](_0x54dc11,_0x751e('0xe8')));_0x357d4f(ut[_0x751e('0x4d')](_0x751e('0xe9')));})[_0x751e('0x75')](function(_0x476b03){ut['logger'](_0x751e('0xea'),_0x476b03);_0x1f6be1(ut[_0x751e('0x4d')](_0x751e('0xeb'),_0x14fa53,_0x45f0d5));});}else{_0x32d4c4[_0x751e('0x37')]+=0x1;ut['logBlacklist'](_0x54dc11);rpcDb[_0x751e('0xec')](_0x54dc11,_0x751e('0xed'));delete _0x1af64d[_0x751e('0x13')][_0x439436];_0x1f6be1(ut[_0x751e('0x4d')]('Contact\x20in\x20black\x20List',_0x14fa53,_0x45f0d5));}});};Preview[_0x751e('0x5d')][_0x751e('0x92')]=function(_0x108699){return!_[_0x751e('0x66')](_0x108699)&&!_[_0x751e('0x66')](_0x108699[_0x751e('0x25')])&&!_[_0x751e('0x66')](_0x108699[_0x751e('0x4f')])&&_0x108699['active']&&!_['isNil'](this[_0x751e('0x12')][util[_0x751e('0x54')](_0x751e('0xee'),_0x108699[_0x751e('0x25')])])&&!_[_0x751e('0x66')](this[_0x751e('0x12')][util[_0x751e('0x54')]('SIP/%s',_0x108699[_0x751e('0x25')])][_0x751e('0x73')])&&(this[_0x751e('0x12')][util[_0x751e('0x54')](_0x751e('0xee'),_0x108699[_0x751e('0x25')])][_0x751e('0x73')]===_0x751e('0xef')||this[_0x751e('0x12')][util[_0x751e('0x54')]('SIP/%s',_0x108699[_0x751e('0x25')])][_0x751e('0x73')]===_0x751e('0xf0'));};Preview['prototype']['run']=function(_0xf197ef,_0x33b224){var _0x3da30d=this;return new BPromise(function(_0x309818,_0x401355){_0x3da30d[_0x751e('0xf1')](_0xf197ef,_0x33b224)[_0x751e('0x82')](function(_0x3bb3b3){_0x309818(_[_0x751e('0x6d')](_0x3bb3b3,[_0x751e('0x4d')]));})[_0x751e('0x75')](function(_0x42160b){if(_0x42160b[_0x751e('0xf2')]){rpcDb[_0x751e('0xf3')](_0xf197ef);}if(_0x42160b[_0x751e('0x4f')]){rpcDb['disableContact'](_0xf197ef);}_0x401355(_[_0x751e('0x6d')](_0x42160b,[_0x751e('0x4d')]));});});};Preview['prototype'][_0x751e('0xf1')]=function(_0x2d0489,_0xecc3f6){var _0x10aec1=this;return new BPromise(function(_0xec0b15,_0x4b3bfa){var _0xe7ef3c,_0x12dc3b;rpcDb[_0x751e('0xf4')](_0x2d0489)[_0x751e('0x82')](function(_0xe68b50){if(!_[_0x751e('0x66')](_0xe68b50[0x0])){_0x12dc3b=_0xe68b50[0x0][_0x751e('0xf5')]?![]:!![];_0xe7ef3c=_0xe68b50[0x0]['recallme']?!![]:![];_0xe7ef3c=_0xecc3f6?!![]:_0xe7ef3c;}var _0x3ce185=_0x10aec1[_0x751e('0xf6')](_0xe68b50);if(_0x3ce185[_0x751e('0xf7')]){rpcDb['checkIsBlackList'](_['pick'](_0xe68b50[0x0],['VoiceQueueId',_0x751e('0xf8')]))['then'](function(_0x1d131a){_0x10aec1[_0x751e('0xdf')](_0x1d131a,_0xe68b50[0x0],_0xecc3f6,_0x12dc3b,_0xe7ef3c)[_0x751e('0x82')](function(_0x551e2d){_0xec0b15(_0x551e2d);})[_0x751e('0x75')](function(_0x4bb59a){_0x4b3bfa(_0x4bb59a);});})[_0x751e('0x75')](function(_0x440af2){ut[_0x751e('0x59')](_0x751e('0xf9'),_0x440af2);_0x4b3bfa(ut[_0x751e('0x4d')]('Call\x20unsuccessful',_0x12dc3b,_0xe7ef3c));});}else{_0x4b3bfa(ut[_0x751e('0x4d')](_0x3ce185['message'],_0x12dc3b,_0xe7ef3c));}})[_0x751e('0x75')](function(_0x5e0133){ut[_0x751e('0x59')](_0x751e('0xfa'),_0x5e0133);_0x4b3bfa(ut[_0x751e('0x4d')](_0x751e('0xfb'),![],!![]));});});};Preview['prototype'][_0x751e('0xf6')]=function(_0x3fd845){if(_[_0x751e('0x66')](_0x3fd845)||_[_0x751e('0xfc')](_0x3fd845)||!_['isNil'](_0x3fd845[0x0]['Agent'])&&_[_0x751e('0x66')](_0x3fd845[0x0][_0x751e('0xfd')][_0x751e('0x25')])){ut['logger'](_0x751e('0xfe'),_0x3fd845);return{'isValid':![],'message':_0x751e('0xff')};}var _0x48b6ad=this[_0x751e('0x10')][_0x3fd845[0x0]['Queue'][_0x751e('0x25')]];_0x48b6ad[_0x751e('0x4d')]=_0x751e('0x94');if(_[_0x751e('0x66')](_0x48b6ad)){ut[_0x751e('0x59')](_0x751e('0x100'),_0x48b6ad);return{'isValid':![],'message':_0x751e('0x101')};}if(!this[_0x751e('0x92')](_0x48b6ad[_0x751e('0x4e')])){ut[_0x751e('0x59')](_0x751e('0x102'),_0x751e('0x103')+_0x48b6ad[_0x751e('0x25')]+_0x751e('0x104'));if(!this['isTrunkReachable'](_0x48b6ad[_0x751e('0x105')])){ut[_0x751e('0x59')](_0x751e('0x102'),_0x48b6ad[_0x751e('0x25')]+_0x751e('0x106'));return{'isValid':![],'message':_0x751e('0x107')};}}if(!ut[_0x751e('0x108')](_0x48b6ad['dialActive'])){ut[_0x751e('0x59')]('[Preview][validateContact][Campaign\x20Active]',_0x48b6ad[_0x751e('0x25')]+_0x751e('0x109'));return{'isValid':![],'message':_0x751e('0x103')+_0x48b6ad['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x751e('0x10a')]=function(_0x71380b,_0x4719b8,_0x52f171,_0x3b98fe){var _0x12cbb7=this;return new BPromise(function(_0x25bdf8,_0x4df964){var _0x148130=_0x71380b['uniqueid'];var _0x30ea30=_0x12cbb7[_0x751e('0x92')](_0x4719b8[_0x751e('0x4e')])?util['format'](_0x751e('0x10b'),_0x4719b8[_0x751e('0x4e')][_0x751e('0x25')],_['isNil'](_0x4719b8['dialPrefix'])?'':_0x4719b8[_0x751e('0x34')][_0x751e('0x10c')]()||'',_0x4719b8[_0x751e('0x10d')]>0x0?_0x52f171['Contact'][_0x751e('0xe1')][_0x751e('0x10e')](_0x4719b8['dialCutDigit']):_0x52f171['Contact'][_0x751e('0xe1')]):util['format'](_0x751e('0x10b'),_[_0x751e('0x66')](_0x4719b8[_0x751e('0x105')])?_0x4719b8['Trunk']['name']:_0x4719b8['TrunkBackup'][_0x751e('0x25')],_[_0x751e('0x66')](_0x4719b8[_0x751e('0x34')])?'':_0x4719b8[_0x751e('0x34')]['trim']()||'',_0x4719b8[_0x751e('0x10d')]>0x0?_0x52f171[_0x751e('0xe0')][_0x751e('0xe1')]['substring'](_0x4719b8['dialCutDigit']):_0x52f171[_0x751e('0xe0')][_0x751e('0xe1')]);var _0x5561bf=_0x12cbb7['isTrunkReachable'](_0x4719b8['Trunk'])?ut[_0x751e('0x10f')](_0x4719b8['Trunk'][_0x751e('0x50')],_0x4719b8[_0x751e('0x32')],_0x4719b8[_0x751e('0x110')]>0x0?ut[_0x751e('0x111')](_0x4719b8[_0x751e('0x112')],_0x4719b8[_0x751e('0x110')]):_0x4719b8['dialOriginateCallerIdNumber']):ut[_0x751e('0x10f')](_['isNil'](_0x4719b8[_0x751e('0x105')])?_0x4719b8['Trunk']['callerid']:_0x4719b8[_0x751e('0x105')][_0x751e('0x50')],_0x4719b8['dialOriginateCallerIdName'],_0x4719b8[_0x751e('0x110')]>0x0?ut[_0x751e('0x111')](_0x4719b8[_0x751e('0x112')],_0x4719b8[_0x751e('0x110')]):_0x4719b8['dialOriginateCallerIdNumber']);if(_0x5561bf){_0x71380b[_0x751e('0x113')]=ut['extractCalleridName'](_0x5561bf);_0x71380b[_0x751e('0x114')]=ut[_0x751e('0x115')](_0x5561bf);}var _0x1b334d=ut[_0x751e('0x116')](_0x4719b8,_0x52f171,_0x30ea30,_0x5561bf,_0x148130,_0x71380b);_['merge'](_0x71380b,ut[_0x751e('0x117')](_0x1b334d));_0x71380b[_0x751e('0x88')]=moment()[_0x751e('0x54')](_0x751e('0x9d'));ami[_0x751e('0x72')](ut[_0x751e('0x118')](_0x71380b,_0x4719b8,_0x1b334d,_0x71380b['activeContact'],_0x3b98fe))[_0x751e('0x82')](function(_0x23c6dd){_0x4719b8[_0x751e('0x55')]+=0x1;logger[_0x751e('0x67')](_0x751e('0x119'),_0x148130,_0x751e('0xa1'),_0x4719b8[_0x751e('0x25')],'originated:\x20',_0x4719b8[_0x751e('0x55')]);_0x25bdf8(_0x23c6dd);})[_0x751e('0x75')](function(_0x472f25){ut[_0x751e('0xd4')](_0x71380b,0xe,_0x751e('0x11a'));rpcDb[_0x751e('0xd5')](_0x71380b,'[originateFailure][logOriginateFailure]');_0x4df964(_0x472f25);});});};Preview['prototype']['syncNewExten']=function(_0x3fea1f){if(this[_0x751e('0x13')][_0x3fea1f[_0x751e('0xaf')]]){this['actions'][_0x3fea1f[_0x751e('0xaf')]][_0x751e('0x74')]=_0x3fea1f[_0x751e('0x74')];}};Preview[_0x751e('0x5d')][_0x751e('0x16')]=function(_0x1441a2){var _0x21ae5e=this;var _0x56d8e6=this[_0x751e('0x13')][_0x1441a2[_0x751e('0x11b')]];if(_0x56d8e6){if(_0x56d8e6[_0x751e('0xe3')]&&this[_0x751e('0x81')][_0x56d8e6['lookAgent']]){ut[_0x751e('0x11c')](_0x56d8e6,this[_0x751e('0x81')][_0x56d8e6[_0x751e('0xe3')]][_0x751e('0x25')],this[_0x751e('0x81')][_0x56d8e6['lookAgent']]['id']);}var _0x1624ca=_[_0x751e('0x11d')](_0x56d8e6);_0x1624ca[_0x751e('0x11e')]=moment()[_0x751e('0x54')](_0x751e('0x9d'));var _0x3df83f=_0x21ae5e[_0x751e('0x10')][_0x56d8e6['queue']];if(ut[_0x751e('0x11f')](_0x1441a2['response'])){if(_0x56d8e6['unlockAgent']){rpcDb[_0x751e('0xf3')](_0x56d8e6[_0x751e('0xc8')]);}if(_0x56d8e6[_0x751e('0xb6')]){rpcDb[_0x751e('0xc7')](_0x56d8e6[_0x751e('0xc8')]);}ami[_0x751e('0x23')](_0x751e('0x120'),ut[_0x751e('0xa6')](_0x56d8e6,'rejected'));this['callProgressDetectingAgent'](_0x1624ca,_0x3df83f,_0x1441a2);}else{_0x56d8e6[_0x751e('0x88')]=moment()[_0x751e('0x54')](_0x751e('0x9d'));ut[_0x751e('0xd4')](_0x1624ca,0x4,_0x751e('0xa9'));rpcDb[_0x751e('0xd5')](_0x1624ca,_0x751e('0x121'));}}};Preview[_0x751e('0x5d')][_0x751e('0x19')]=function(_0x404673){var _0x1c2ed9=this;var _0x34ca91=this[_0x751e('0x13')][_0x404673[_0x751e('0xaf')]];var _0x4ce6b6;if(_0x34ca91){_0x4ce6b6=this['campaignsPreview'][_0x34ca91['queue']];logger[_0x751e('0x67')](_0x751e('0x122'),_0x404673[_0x751e('0xaf')],_0x751e('0xa1'),_0x4ce6b6['name'],_0x751e('0x6a'),_0x4ce6b6[_0x751e('0x2a')]);}if(this[_0x751e('0x13')][_0x404673[_0x751e('0xaf')]]&&_0x404673[_0x751e('0xaf')]!==_0x404673[_0x751e('0xa0')]){if(_0x404673[_0x751e('0x123')]==='16'&&this[_0x751e('0x13')][_0x404673['linkedid']]['dialAnswer']){this['callProgressDetectingCustomer'](_0x404673,_0x404673['linkedid'],_0x404673[_0x751e('0x123')]);}else if(this['actions'][_0x404673[_0x751e('0xaf')]][_0x751e('0x6c')]){logger[_0x751e('0x67')](_0x751e('0x124'),_0x404673[_0x751e('0xaf')],_0x404673['cause'],_0x751e('0xa1'),_0x4ce6b6[_0x751e('0x25')],_0x751e('0x6a'),_0x4ce6b6[_0x751e('0x2a')]);this[_0x751e('0x125')](_0x404673,_0x404673[_0x751e('0xaf')],_0x404673[_0x751e('0x123')]);}}else if(_0x34ca91&&_[_0x751e('0x66')](_0x34ca91['statedesc'])&&_0x4ce6b6[_0x751e('0x126')]&&_0x404673[_0x751e('0xaf')]===_0x404673[_0x751e('0xa0')]&&_[_0x751e('0x66')](_0x404673[_0x751e('0xdc')])&&_0x404673['cause']==='16'&&_0x404673[_0x751e('0x127')]==='6'&&_['isUndefined'](_0x34ca91[_0x751e('0x128')])){if(_0x34ca91['unlockAgent']){rpcDb['unlockContact'](_0x34ca91['idContact']);}if(_0x34ca91[_0x751e('0xb6')]){rpcDb[_0x751e('0xc7')](_0x34ca91['idContact']);}_0x404673[_0x751e('0xdc')]='22';this[_0x751e('0xd1')](_0x34ca91,_0x4ce6b6,_0x404673);}else if(_0x34ca91&&_0x34ca91[_0x751e('0x128')]){if(_0x404673[_0x751e('0x123')]==='16'&&this[_0x751e('0x13')][_0x404673[_0x751e('0xaf')]]['dialAnswer']){logger[_0x751e('0x67')](_0x751e('0x129'),_0x404673['linkedid'],_0x404673[_0x751e('0x123')],_0x751e('0xa1'),_0x4ce6b6[_0x751e('0x25')],_0x751e('0x6a'),_0x4ce6b6[_0x751e('0x2a')]);this[_0x751e('0x125')](_0x404673,_0x404673['linkedid'],_0x404673[_0x751e('0x123')]);}else if(this[_0x751e('0x13')][_0x404673['linkedid']][_0x751e('0x6c')]){logger[_0x751e('0x67')](_0x751e('0x124'),_0x404673[_0x751e('0xaf')],_0x404673['cause'],_0x751e('0xa1'),_0x4ce6b6[_0x751e('0x25')],_0x751e('0x6a'),_0x4ce6b6[_0x751e('0x2a')]);this[_0x751e('0x125')](_0x404673,_0x404673[_0x751e('0xaf')],_0x404673[_0x751e('0x123')]);}}};Preview[_0x751e('0x5d')][_0x751e('0x1c')]=function(_0x1d8b7c){if(this[_0x751e('0x13')][_0x1d8b7c[_0x751e('0xd0')]]&&_0x1d8b7c[_0x751e('0xd0')]!==_0x1d8b7c[_0x751e('0x12a')]){this[_0x751e('0x125')](_0x1d8b7c,_0x1d8b7c[_0x751e('0xd0')],_0x1d8b7c['dialstatus']);}};Preview[_0x751e('0x5d')][_0x751e('0x1b')]=function(_0xcc25cd){if(this[_0x751e('0x13')][_0xcc25cd[_0x751e('0xaf')]]&&_0xcc25cd['linkedid']!==_0xcc25cd['uniqueid']&&!this[_0x751e('0x13')][_0xcc25cd[_0x751e('0xaf')]]['dialAnswer']){if(_0xcc25cd[_0x751e('0x123')]==='1'){this[_0x751e('0x125')](_0xcc25cd,_0xcc25cd[_0x751e('0xaf')],_0xcc25cd[_0x751e('0x123')]);}}};Preview[_0x751e('0x5d')][_0x751e('0x12b')]=function(_0x15ef37,_0x60a529,_0x31c686){if(this[_0x751e('0x13')][_0x15ef37]){if(_[_0x751e('0x66')](this[_0x751e('0x13')][_0x15ef37][_0x751e('0x12c')])){this[_0x751e('0x13')][_0x15ef37][_0x751e('0x12c')]={};}this[_0x751e('0x13')][_0x15ef37]['variables'][_0x60a529]=_0x31c686;}};Preview['prototype'][_0x751e('0x1f')]=function(_0x3fc7f4){try{if(!_['isNil'](_0x3fc7f4)){if(ut[_0x751e('0x12d')](_[_0x751e('0x12e')](_0x3fc7f4[_0x751e('0x12f')])[0x0])){this[_0x751e('0x12b')](_0x3fc7f4[_0x751e('0xa0')],_[_0x751e('0x12e')](_0x3fc7f4['variable'])[0x0],_0x3fc7f4[_0x751e('0x130')]);}}}catch(_0x3854e6){logger['error'](_0x751e('0x131'),util[_0x751e('0x132')](_0x3854e6,{'showHidden':![],'depth':null}));}};Preview[_0x751e('0x5d')][_0x751e('0x20')]=function(_0x43b2b7){if(_0x43b2b7){if(this[_0x751e('0x13')][_0x43b2b7['transfertargetlinkedid']]){this[_0x751e('0x13')][_0x43b2b7[_0x751e('0x133')]]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x328ec9){if(_0x328ec9){if(this[_0x751e('0x13')][_0x328ec9[_0x751e('0x134')]]){this[_0x751e('0x13')][_0x328ec9[_0x751e('0x134')]]['transfer']=!![];}}};module[_0x751e('0x135')]=Preview;
\ No newline at end of file