Built motion from commit (unavailable).|2.0.72
[motion2.git] / server / services / ami / preview / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x326f=['[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','clearZombieChannel','getContactRecallMe','agentReadyId','length','getDiff','dialRecallMeTimeout','run','then','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','logCustomer','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','format','responsetime','answertime','uniqueid','custom:agentconnect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','buildObj','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','info','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','scheduledAt','dialNoAnswerRetryFrequency','unlockAgent','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','disableContact','idContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','callerid','addVariables','merge','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','syncDialEnd','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','md5','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','socket.io-emitter','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','answered','available','sumBillable','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','Trunk','active','Interval','name','stringify','voice:queue:%s','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','booked','clockClearZombieChannels','clearZombieChannels','outbound','dialActive','setMessage','recallMe','isNil'];(function(_0xbaf307,_0x18a4cc){var _0x834d3b=function(_0x3c88e4){while(--_0x3c88e4){_0xbaf307['push'](_0xbaf307['shift']());}};_0x834d3b(++_0x18a4cc);}(_0x326f,0xd1));var _0xf326=function(_0x4c0494,_0x3bf397){_0x4c0494=_0x4c0494-0x0;var _0x1a0aec=_0x326f[_0x4c0494];return _0x1a0aec;};'use strict';var util=require(_0xf326('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var md5=require(_0xf326('0x3'));var logger=require(_0xf326('0x4'))(_0xf326('0x5'));var loggerAction=require(_0xf326('0x4'))(_0xf326('0x6'));var ami=require(_0xf326('0x7'));var rpcDb=require(_0xf326('0x8'));var Action=require(_0xf326('0x9'));var ut=require('./util/util');var io=require(_0xf326('0xa'))({'host':_0xf326('0xb'),'port':0x18eb});var Sequence=function(){};Sequence[_0xf326('0xc')][_0xf326('0xd')]=function(_0x515bfa){this['tail']=this['tail']?this[_0xf326('0xe')][_0xf326('0xf')](_0x515bfa):_0x515bfa();};function Preview(_0x163416){this[_0xf326('0x10')]=new Sequence();this[_0xf326('0x11')]=_0x163416['voiceQueues'];this[_0xf326('0x12')]=_0x163416['trunks'];this[_0xf326('0x13')]={};this['agents']=_0x163416[_0xf326('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xf326('0x15'),this[_0xf326('0x16')]['bind'](this));ami['on'](_0xf326('0x17'),this[_0xf326('0x18')][_0xf326('0x19')](this));ami['on'](_0xf326('0x1a'),this['syncHangupRequest'][_0xf326('0x19')](this));ami['on']('dialend',this['syncDialEnd'][_0xf326('0x19')](this));ami['on'](_0xf326('0x1b'),this[_0xf326('0x1c')][_0xf326('0x19')](this));ami['on'](_0xf326('0x1d'),this[_0xf326('0x1e')][_0xf326('0x19')](this));ami['on'](_0xf326('0x1f'),this['syncAttendedTransfer'][_0xf326('0x19')](this));ami['on'](_0xf326('0x20'),this[_0xf326('0x21')][_0xf326('0x19')](this));this[_0xf326('0x22')](this[_0xf326('0x11')]);}function emit(_0x4d3d41,_0x4a5b6c,_0x56ad41){io['to'](_0x4d3d41)[_0xf326('0x23')](_0x4a5b6c,_0x56ad41);}function emitCampaignPreview(_0x289f4b){if(_0x289f4b['type']==='outbound'){var _0x128c68={'id':_0x289f4b['id'],'name':_0x289f4b['name'],'strategy':_0x289f4b['strategy'],'answered':_0x289f4b[_0xf326('0x24')],'available':_0x289f4b[_0xf326('0x25')],'loggedIn':_0x289f4b['loggedIn'],'pTalking':_0x289f4b['pTalking'],'sumBillable':_0x289f4b[_0xf326('0x26')],'sumDuration':_0x289f4b[_0xf326('0x27')],'sumHoldTime':_0x289f4b['sumHoldTime'],'talking':_0x289f4b[_0xf326('0x28')],'total':_0x289f4b[_0xf326('0x29')],'type':_0x289f4b[_0xf326('0x2a')],'unmanaged':_0x289f4b[_0xf326('0x2b')],'waiting':_0x289f4b[_0xf326('0x2c')],'loggedInDb':_0x289f4b[_0xf326('0x2d')],'dialActive':_0x289f4b['dialActive'],'dialMethod':_0x289f4b['dialMethod'],'dialOriginateCallerIdName':_0x289f4b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x289f4b[_0xf326('0x2e')],'dialOriginateTimeout':_0x289f4b[_0xf326('0x2f')],'dialPrefix':_0x289f4b[_0xf326('0x30')],'outboundAnswerAgiCallsDay':_0x289f4b[_0xf326('0x31')],'outboundAnswerCallsDay':_0x289f4b[_0xf326('0x32')],'outboundBlacklistCallsDay':_0x289f4b[_0xf326('0x33')],'outboundBusyCallsDay':_0x289f4b['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x289f4b[_0xf326('0x34')],'outboundDropCallsDayACS':_0x289f4b[_0xf326('0x35')],'outboundDropCallsDayCallersExit':_0x289f4b[_0xf326('0x36')],'outboundDropCallsDayTimeout':_0x289f4b['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x289f4b[_0xf326('0x37')],'outboundNoSuchCallsDay':_0x289f4b['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x289f4b['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x289f4b[_0xf326('0x38')],'outboundRejectCallsDay':_0x289f4b[_0xf326('0x39')],'outboundUnknownCallsDay':_0x289f4b[_0xf326('0x3a')],'predictiveIntervalAnsweredCalls':_0x289f4b['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x289f4b[_0xf326('0x3b')],'predictiveIntervalAvgTalktime':_0x289f4b[_0xf326('0x3c')],'predictiveIntervalDroppedCallsCallersExit':_0x289f4b['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x289f4b[_0xf326('0x3d')],'predictiveIntervalErlangCalls':_0x289f4b[_0xf326('0x3e')],'predictiveIntervalErlangCallsDroppedCalls':_0x289f4b[_0xf326('0x3f')],'predictiveIntervalHitRate':_0x289f4b[_0xf326('0x40')],'predictiveIntervalLowerLimit':_0x289f4b[_0xf326('0x41')],'predictiveIntervalMultiplicativeFactor':_0x289f4b[_0xf326('0x42')],'predictiveIntervalPauses':_0x289f4b[_0xf326('0x43')],'predictiveIntervalTotalCalls':_0x289f4b[_0xf326('0x44')],'message':_0x289f4b[_0xf326('0x45')],'originated':_0x289f4b[_0xf326('0x46')]};if(_0x289f4b['Trunk']){_0x128c68[_0xf326('0x47')]={'id':_0x289f4b[_0xf326('0x47')]['id'],'name':_0x289f4b[_0xf326('0x47')]['name'],'active':_0x289f4b[_0xf326('0x47')][_0xf326('0x48')],'callerid':_0x289f4b[_0xf326('0x47')]['callerid']};}if(_0x289f4b['Interval']){_0x128c68[_0xf326('0x49')]={'id':_0x289f4b[_0xf326('0x49')]['id'],'name':_0x289f4b[_0xf326('0x49')][_0xf326('0x4a')]};}var _0x30694f=md5(JSON[_0xf326('0x4b')](_0x128c68));if(_0x289f4b[_0xf326('0x3')]!==_0x30694f){_0x289f4b[_0xf326('0x3')]=_0x30694f;emit(util['format'](_0xf326('0x4c'),_0x128c68[_0xf326('0x4a')]),'voice_queue:save',_0x128c68);}}}function emitVoiceQueueChannelRemove(_0x4083a2){emit(util['format'](_0xf326('0x4c'),_0x4083a2['name']),'voice_queue_channel:remove',_0x4083a2);}function notSendMessagesQueue(_0xadb020){if(_0xadb020['sendMessageOneNotActive']){if(_0xadb020[_0xf326('0x46')]===0x0&&_0xadb020['pTalking']===0x0){_0xadb020[_0xf326('0x4d')]=![];_0xadb020[_0xf326('0x25')]=0x0;_0xadb020[_0xf326('0x4e')]=0x0;_0xadb020['message']=_0xf326('0x4f');ut[_0xf326('0x50')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xadb020[_0xf326('0x4a')]+_0xf326('0x51'));}else{_0xadb020[_0xf326('0x45')]=_0xf326('0x52');ut['logger'](_0xf326('0x53'),_0xadb020[_0xf326('0x4a')]+_0xf326('0x54'));}emitCampaignPreview(_0xadb020);}}Preview[_0xf326('0xc')][_0xf326('0x22')]=function(){var _0x5f02b5=this;setInterval(function(){_0x5f02b5[_0xf326('0x55')]();},0x7cf);};Preview[_0xf326('0xc')]['syncCampaigns']=function(){var _0x4dd361=this[_0xf326('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x55dfa8 in _0x4dd361){if(_0x4dd361[_0xf326('0x56')](_0x55dfa8)&&(_0x4dd361[_0x55dfa8]['dialMethod']===_0xf326('0x5')||_0x4dd361[_0x55dfa8][_0xf326('0x57')]===_0xf326('0x58'))&&_0x4dd361[_0x55dfa8][_0xf326('0x2a')]==='outbound'){if(this[_0xf326('0x59')]>0x7){this[_0xf326('0x59')]=0x0;this[_0xf326('0x5a')]();}}if(_0x4dd361[_0xf326('0x56')](_0x55dfa8)&&_0x4dd361[_0x55dfa8][_0xf326('0x57')]===_0xf326('0x5')&&_0x4dd361[_0x55dfa8][_0xf326('0x2a')]===_0xf326('0x5b')){if(_0x4dd361[_0x55dfa8][_0xf326('0x5c')]){this[_0xf326('0x5d')](_0x4dd361[_0x55dfa8]);this[_0xf326('0x5e')](_0x4dd361[_0x55dfa8]);}else{notSendMessagesQueue(_0x4dd361[_0x55dfa8]);}}}};Preview[_0xf326('0xc')]['clearZombieChannel']=function(_0x1b6126){var _0x1637dc=this;this[_0xf326('0x10')][_0xf326('0xd')](function(){if(!_[_0xf326('0x5f')](_0x1637dc[_0xf326('0x13')][_0x1b6126])){loggerAction['info'](_0xf326('0x60'),_0x1b6126,_0xf326('0x61'),_0x1637dc['actions'][_0x1b6126][_0xf326('0x62')],_0xf326('0x63'),JSON[_0xf326('0x4b')](_0x1637dc[_0xf326('0x11')][_0x1637dc[_0xf326('0x13')][_0x1b6126]['queue']]['originated']),_0xf326('0x64'),JSON[_0xf326('0x4b')](_0x1637dc['campaignsPreview'][_0x1637dc['actions'][_0x1b6126][_0xf326('0x62')]][_0xf326('0x65')]),JSON[_0xf326('0x4b')](_0x1637dc['actions'][_0x1b6126][_0xf326('0x66')]),JSON[_0xf326('0x4b')](_[_0xf326('0x67')](_0x1637dc[_0xf326('0x13')][_0x1b6126],[_0xf326('0x68'),_0xf326('0x69'),_0xf326('0x6a'),_0xf326('0x6b')])));return ami[_0xf326('0x6c')]({'action':_0xf326('0x6d'),'channel':_0x1637dc[_0xf326('0x13')][_0x1b6126][_0xf326('0x6e')]})[_0xf326('0x6f')](function(_0x395b1e){if(_0x395b1e[_0xf326('0x45')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1637dc[_0xf326('0x13')][_0x1b6126]){ut[_0xf326('0x70')](_0x1637dc[_0xf326('0x11')][_0x1637dc[_0xf326('0x13')][_0x1b6126]['queue']],_0xf326('0x71'));if(_0x1637dc[_0xf326('0x13')][_0x1b6126][_0xf326('0x66')]===!![]){ut[_0xf326('0x72')](_0x1637dc['campaignsPreview'][_0x1637dc[_0xf326('0x13')][_0x1b6126][_0xf326('0x62')]],_0xf326('0x71'));ut[_0xf326('0x73')](_0xf326('0x74')+_0x1b6126,_0x1637dc['actions'][_0x1b6126]['queue']);}ut[_0xf326('0x73')](_0xf326('0x75')+_0x1b6126,_0x1637dc[_0xf326('0x13')][_0x1b6126]['queue']);delete _0x1637dc[_0xf326('0x13')][_0x1b6126];}},0x2328);}});}});};Preview[_0xf326('0xc')][_0xf326('0x5a')]=function(){var _0x5e3532=this;loggerAction['info'](_0xf326('0x76'),_['size'](this[_0xf326('0x13')]));for(var _0x554277 in this[_0xf326('0x13')]){if(_0x5e3532[_0xf326('0x13')][_0xf326('0x56')](_0x554277)){_0x5e3532[_0xf326('0x77')](_0x554277);}}};Preview[_0xf326('0xc')][_0xf326('0x5e')]=function(_0x7f7ece){var _0x495a16=this;rpcDb[_0xf326('0x78')](_0x7f7ece['id'],ut[_0xf326('0x79')](this[_0xf326('0x14')]))['then'](function(_0x208ba4){if(!_[_0xf326('0x5f')](_0x208ba4)){for(var _0x3b8635=0x0;_0x3b8635<_0x208ba4[_0xf326('0x7a')];_0x3b8635+=0x1){if(ut[_0xf326('0x7b')](_0x208ba4[_0x3b8635]['scheduledat'])<_0x7f7ece[_0xf326('0x7c')]*0x3c){_0x495a16[_0xf326('0x7d')](_0x208ba4[_0x3b8635]['id'])[_0xf326('0x7e')](ut[_0xf326('0x7f')]('[RecallMe]'))[_0xf326('0x6f')](ut[_0xf326('0x7f')](_0xf326('0x80')));}else{var _0x29e52e=new Action(_0x208ba4[_0x3b8635],_0x7f7ece);_0x29e52e['starttime']=moment()['format'](_0xf326('0x81'));_0x7f7ece[_0xf326('0x38')]+=0x1;ut['logCustomer'](_0x29e52e,0x17,_0xf326('0x82'));if(_0x7f7ece[_0xf326('0x83')]){rpcDb[_0xf326('0x84')](ut[_0xf326('0x85')](_0x208ba4[_0x3b8635]));rpcDb['createCustomerHistory'](_0x29e52e,_0xf326('0x86'));}else{ut['logCustomer'](_0x29e52e,0x16,'RecallFailedTimeout');rpcDb[_0xf326('0x87')](_0x29e52e,'[HistoryRecallClose]');rpcDb[_0xf326('0x88')](_0x29e52e,_0xf326('0x89'));}}}}})[_0xf326('0x6f')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xf326('0xc')][_0xf326('0x5d')]=function(_0x33b259){_0x33b259['sendMessageOneNotActive']=!![];if(ut[_0xf326('0x8a')](_0x33b259['loggedIn'])){_0x33b259[_0xf326('0x45')]=_0xf326('0x8b');}else if(!ut[_0xf326('0x8c')](_0x33b259[_0xf326('0x5c')])){_0x33b259[_0xf326('0x45')]=_0xf326('0x4f');}else if(!this[_0xf326('0x8d')](_0x33b259[_0xf326('0x47')])){if(!this[_0xf326('0x8d')](_0x33b259[_0xf326('0x8e')])){_0x33b259[_0xf326('0x45')]=_0xf326('0x8f');}else{_0x33b259[_0xf326('0x45')]='ACTIVE';}}else{_0x33b259[_0xf326('0x45')]='ACTIVE';}emitCampaignPreview(_0x33b259);};Preview[_0xf326('0xc')][_0xf326('0x90')]=function(_0x5e858d,_0x2b770c,_0x5283da){var _0x3255b2=this;var _0xd55246=this[_0xf326('0x13')][_0x2b770c];var _0x2d45c9=this[_0xf326('0x11')][_0xd55246['queue']];var _0x4ec099;if(_0x2d45c9){switch(_0x5283da){case'1':_0x2d45c9[_0xf326('0x91')]+=0x1;_0xd55246[_0xf326('0x92')]=ut[_0xf326('0x93')](_0xd55246);ut[_0xf326('0x94')](_0xd55246,0x0,_0xf326('0x95'));rpcDb['createCustomerHistory'](_0xd55246,_0xf326('0x96'));if(ut[_0xf326('0x93')](_0xd55246)>=_0x2d45c9['dialGlobalMaxRetry']){_0x4ec099=ut['cloneAction'](_0xd55246,0xf,'Global');rpcDb[_0xf326('0x88')](_0x4ec099,_0xf326('0x97'));}else{rpcDb[_0xf326('0x88')](_0xd55246,_0xf326('0x97'));}delete this[_0xf326('0x13')][_0x5e858d[_0xf326('0x98')]];break;case _0xf326('0x99'):var _0x4b9013=moment()[_0xf326('0x9a')](_0xf326('0x81'));_0xd55246[_0xf326('0x9b')]=_0x4b9013;_0xd55246[_0xf326('0x9c')]=_0x4b9013;_0xd55246['dialAnswer']=!![];_0x2d45c9[_0xf326('0x65')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0xd55246[_0xf326('0x9d')],'\x20Queue',_0x2d45c9[_0xf326('0x4a')],_0xf326('0x64'),_0x2d45c9[_0xf326('0x65')]);ami[_0xf326('0x23')](_0xf326('0x9e'),ut['buildObj'](_0xd55246,'connect'));if(_0x2d45c9['acw']){ami[_0xf326('0x23')](_0xf326('0x9f'),ut[_0xf326('0xa0')](_0xd55246));}break;case'16':ami[_0xf326('0x23')](_0xf326('0xa1'),ut['buildObj'](_0xd55246,_0xf326('0xa2')));emitVoiceQueueChannelRemove(ut[_0xf326('0xa3')](_0xd55246,_0xf326('0xa2')));_0x2d45c9['outboundAnswerCallsDay']+=0x1;_0x2d45c9['total']+=0x1;_0x2d45c9[_0xf326('0x24')]+=0x1;ut[_0xf326('0x72')](_0x2d45c9,'[16]');_0xd55246['countglobal']=ut[_0xf326('0x93')](_0xd55246);ut['logCustomer'](_0xd55246,0x4,_0xf326('0xa4'));rpcDb['createCustomerHistory'](_0xd55246,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0xd55246,_0xf326('0xa5'));rpcDb[_0xf326('0xa6')](_0xd55246);_0x2d45c9[_0xf326('0x27')]+=_0xd55246['talktime'];_0x2d45c9[_0xf326('0x26')]+=_0xd55246[_0xf326('0xa7')];logger[_0xf326('0xa8')](_0xf326('0xa9'),_0xd55246[_0xf326('0x9d')],_0xf326('0xaa'),_0x2d45c9[_0xf326('0x4a')],_0xf326('0x64'),_0x2d45c9[_0xf326('0x65')]);delete this['actions'][_0x5e858d[_0xf326('0x98')]];break;case'BUSY':_0x2d45c9[_0xf326('0xab')]+=0x1;_0xd55246[_0xf326('0xac')]+=0x1;_0xd55246[_0xf326('0x92')]=ut['totalGlobal'](_0xd55246);ut[_0xf326('0x94')](_0xd55246,0x5,_0xf326('0xad'));rpcDb[_0xf326('0x87')](_0xd55246,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xf326('0x93')](_0xd55246)>=_0x2d45c9[_0xf326('0xae')]){_0x4ec099=ut[_0xf326('0xaf')](_0xd55246,0xf,_0xf326('0xb0'));rpcDb['createCustomerFinal'](_0x4ec099,_0xf326('0xb1'));}else{if(_0xd55246['countbusyretry']>=_0x2d45c9['dialBusyMaxRetry']){rpcDb[_0xf326('0x88')](_0xd55246,_0xf326('0xb2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xd55246,'countbusyretry',_0x2d45c9[_0xf326('0xb3')]),_0xd55246['unlockAgent'],_0xd55246[_0xf326('0xb4')]);}}break;case _0xf326('0xb5'):_0x2d45c9[_0xf326('0x37')]+=0x1;_0xd55246[_0xf326('0xb6')]+=0x1;_0xd55246[_0xf326('0x92')]=ut[_0xf326('0x93')](_0xd55246);ut['logCustomer'](_0xd55246,0x3,_0xf326('0xb7'));rpcDb[_0xf326('0x87')](_0xd55246,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0xd55246)>=_0x2d45c9[_0xf326('0xae')]){_0x4ec099=ut['cloneAction'](_0xd55246,0xf,_0xf326('0xb0'));rpcDb[_0xf326('0x88')](_0x4ec099,_0xf326('0xb8'));}else{if(_0xd55246[_0xf326('0xb6')]>=_0x2d45c9[_0xf326('0xb9')]){rpcDb[_0xf326('0x88')](_0xd55246,_0xf326('0xba'));}else{rpcDb[_0xf326('0xbb')](ut[_0xf326('0xbc')](_0xd55246,'countnoanswerretry',_0x2d45c9[_0xf326('0xbd')]),_0xd55246[_0xf326('0xbe')],_0xd55246['activeContact']);}}break;case _0xf326('0xbf'):_0x2d45c9['outboundCongestionCallsDay']+=0x1;_0xd55246[_0xf326('0xc0')]+=0x1;_0xd55246[_0xf326('0x92')]=ut[_0xf326('0x93')](_0xd55246);ut['logCustomer'](_0xd55246,0x8,_0xf326('0xc1'));rpcDb[_0xf326('0x87')](_0xd55246,_0xf326('0xc2'));if(ut[_0xf326('0x93')](_0xd55246)>=_0x2d45c9[_0xf326('0xae')]){_0x4ec099=ut[_0xf326('0xaf')](_0xd55246,0xf,_0xf326('0xb0'));rpcDb[_0xf326('0x88')](_0x4ec099,_0xf326('0xc3'));}else{if(_0xd55246[_0xf326('0xc0')]>=_0x2d45c9[_0xf326('0xc4')]){rpcDb[_0xf326('0x88')](_0xd55246,_0xf326('0xc2'));}else{rpcDb[_0xf326('0xbb')](ut[_0xf326('0xbc')](_0xd55246,'countcongestionretry',_0x2d45c9[_0xf326('0xb3')]),_0xd55246[_0xf326('0xbe')],_0xd55246['activeContact']);}}break;case _0xf326('0xc5'):_0x2d45c9[_0xf326('0x39')]+=0x1;_0xd55246['countglobal']=ut[_0xf326('0x93')](_0xd55246);ut[_0xf326('0x94')](_0xd55246,0x14,_0xf326('0xc6'));rpcDb[_0xf326('0x87')](_0xd55246,_0xf326('0xc7'));if(_0xd55246[_0xf326('0xbe')]){rpcDb[_0xf326('0xc8')](_0xd55246['idContact']);}if(_0xd55246[_0xf326('0xb4')]){rpcDb[_0xf326('0xc9')](_0xd55246[_0xf326('0xca')]);}break;default:if(_0xd55246[_0xf326('0x66')]){ut[_0xf326('0x72')](_0x2d45c9,_0xf326('0xcb'));ut[_0xf326('0x73')](_0xf326('0xcc')+_0x2d45c9['name'],_0x5e858d);}_0x2d45c9[_0xf326('0x3a')]+=0x1;_0xd55246[_0xf326('0x92')]=ut['totalGlobal'](_0xd55246);ut[_0xf326('0x94')](_0xd55246,0xc,_0x5e858d['cause-txt']||_0x5e858d[_0xf326('0xcd')]);rpcDb[_0xf326('0x87')](_0xd55246,_0xf326('0xce'));if(ut[_0xf326('0x93')](_0xd55246)>=_0x2d45c9[_0xf326('0xae')]){_0x4ec099=ut[_0xf326('0xaf')](_0xd55246,0xf,_0xf326('0xb0'));rpcDb[_0xf326('0x88')](_0x4ec099,_0xf326('0xcf'));}else{rpcDb[_0xf326('0x88')](_0xd55246,_0xf326('0xcf'));}delete this[_0xf326('0x13')][_0x5e858d[_0xf326('0x98')]];}if(!(_0xd55246[_0xf326('0x66')]&&_0x5283da==='16')){ut['updateOriginated'](_0x2d45c9,_0xf326('0xd0'));logger[_0xf326('0xa8')](_0xf326('0xd1'),_0xd55246[_0xf326('0x9d')],_0xf326('0xaa'),_0x2d45c9['name'],_0xf326('0x63'),_0x2d45c9[_0xf326('0x46')]);}if(_0x5283da!==_0xf326('0x99')){delete this[_0xf326('0x13')][_0x5e858d[_0xf326('0x98')]];delete this['actions'][_0x5e858d['destlinkedid']];}}};Preview[_0xf326('0xc')]['callProgressDetectingAgent']=function(_0xedbcf2,_0x143965,_0x29610a){if(_['isUndefined'](_0x143965)&&'object'!==typeof _0x143965){return;}if(_[_0xf326('0xd2')](_0x29610a)&&_0xf326('0xd3')!==typeof _0x29610a){return;}switch(_0x29610a[_0xf326('0xd4')]){case'0':ut[_0xf326('0xd5')](_0xedbcf2,0x0,_0xf326('0x95'));rpcDb['createAgentHistory'](_0xedbcf2,_0xf326('0xd6'));break;case'3':ut[_0xf326('0xd5')](_0xedbcf2,0x3,_0xf326('0xb7'));rpcDb['createAgentHistory'](_0xedbcf2,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0xedbcf2,0x5,_0xf326('0xad'));rpcDb[_0xf326('0xd7')](_0xedbcf2,_0xf326('0xd8'));break;case'8':ut[_0xf326('0xd5')](_0xedbcf2,0x8,_0xf326('0xc1'));rpcDb[_0xf326('0xd7')](_0xedbcf2,_0xf326('0xd9'));break;case'22':ut['logAgent'](_0xedbcf2,0x16,'AnswerAGI');rpcDb[_0xf326('0xd7')](_0xedbcf2,_0xf326('0xda'));break;default:ut[_0xf326('0xd5')](_0xedbcf2,0xc,_0x29610a['reason']);rpcDb[_0xf326('0xd7')](_0xedbcf2,_0xf326('0xd9'));}ut[_0xf326('0x70')](_0x143965,'[callProgressDetectingAgent]');logger[_0xf326('0xa8')](_0xf326('0xdb'),_0xedbcf2[_0xf326('0x9d')],_0xf326('0xaa'),_0x143965['name'],'originated:\x20',_0x143965['originated']);delete this[_0xf326('0x13')][_0xedbcf2[_0xf326('0x9d')]];};Preview[_0xf326('0xc')]['checkInBlack']=function(_0xb64659,_0x451769,_0x3fd475,_0x568015,_0x2ce36b){var _0x2c12bb=this;return new BPromise(function(_0xbec94,_0x218553){if(_['isNil'](_0x451769)||_[_0xf326('0x5f')](_0x451769['Contact'])||_[_0xf326('0x5f')](_0x451769[_0xf326('0xdc')][_0xf326('0xdd')])||_[_0xf326('0x5f')](_0x451769['VoiceQueueId'])){_0x218553(ut[_0xf326('0x45')]('Contact\x20is\x20undefined',_0x568015,_0x2ce36b));return;}var _0x499316=uuid['v4']();var _0x1ec34d=_0x2c12bb[_0xf326('0x11')][_0x451769[_0xf326('0x61')][_0xf326('0x4a')]];var _0x5d7e1c=_0x3fd475?_0x2c12bb['agents'][_0x3fd475]['id']:undefined;_0x2c12bb[_0xf326('0x13')][_0x499316]=new Action(_0x451769,_0x1ec34d,_0x499316,_0x3fd475,_0x5d7e1c);var _0x22f894=_0x2c12bb[_0xf326('0x13')][_0x499316];_0x22f894[_0xf326('0xbe')]=_0x568015;_0x22f894['activeContact']=_0x2ce36b;_0x22f894[_0xf326('0xde')]=_0x3fd475;if(_['isEmpty'](_0xb64659)){_0x2c12bb[_0xf326('0xdf')](_0x22f894,_0x1ec34d,_0x451769,_0x3fd475)[_0xf326('0x7e')](function(_0xb072ab){logger['info'](_0xf326('0xe0'),_0xf326('0xe1')+_0x22f894[_0xf326('0x62')]+_0xf326('0xe2')+_0x22f894[_0xf326('0xca')],JSON['stringify'](_0xb072ab));ami[_0xf326('0x23')](_0xf326('0xe3'),ut['buildObj'](_0x22f894,_0xf326('0xe4')));_0xbec94(ut[_0xf326('0x45')](_0xf326('0xe5')));})[_0xf326('0x6f')](function(_0x4e1758){ut['logger'](_0xf326('0xe6'),_0x4e1758);_0x218553(ut[_0xf326('0x45')]('Call\x20failed',_0x568015,_0x2ce36b));});}else{_0x1ec34d[_0xf326('0x33')]+=0x1;ut['logBlacklist'](_0x22f894);rpcDb['createHistory'](_0x22f894,_0xf326('0xe7'));delete _0x2c12bb[_0xf326('0x13')][_0x499316];_0x218553(ut[_0xf326('0x45')](_0xf326('0xe8'),_0x568015,_0x2ce36b));}});};Preview[_0xf326('0xc')][_0xf326('0x8d')]=function(_0xf5440){return!_[_0xf326('0x5f')](_0xf5440)&&!_[_0xf326('0x5f')](_0xf5440['name'])&&!_[_0xf326('0x5f')](_0xf5440[_0xf326('0x48')])&&_0xf5440[_0xf326('0x48')]&&!_[_0xf326('0x5f')](this['trunks'][util[_0xf326('0x9a')](_0xf326('0xe9'),_0xf5440[_0xf326('0x4a')])])&&!_[_0xf326('0x5f')](this[_0xf326('0x12')][util['format'](_0xf326('0xe9'),_0xf5440['name'])][_0xf326('0x6d')])&&(this[_0xf326('0x12')][util[_0xf326('0x9a')](_0xf326('0xe9'),_0xf5440['name'])][_0xf326('0x6d')]===_0xf326('0xea')||this[_0xf326('0x12')][util['format'](_0xf326('0xe9'),_0xf5440[_0xf326('0x4a')])][_0xf326('0x6d')]===_0xf326('0xeb'));};Preview['prototype'][_0xf326('0x7d')]=function(_0x1ee591,_0xbcac19){var _0x455128=this;return new BPromise(function(_0x4ecbcf,_0x310223){_0x455128[_0xf326('0xec')](_0x1ee591,_0xbcac19)[_0xf326('0x7e')](function(_0x48e7ab){_0x4ecbcf(_[_0xf326('0x67')](_0x48e7ab,[_0xf326('0x45')]));})['catch'](function(_0x171c53){if(_0x171c53[_0xf326('0xed')]){rpcDb[_0xf326('0xc8')](_0x1ee591);}if(_0x171c53[_0xf326('0x48')]){rpcDb[_0xf326('0xc9')](_0x1ee591);}_0x310223(_[_0xf326('0x67')](_0x171c53,['message']));});});};Preview['prototype'][_0xf326('0xec')]=function(_0x21ec87,_0x4307d9){var _0x2fa05b=this;return new BPromise(function(_0x2e31b1,_0x287d55){var _0x487230,_0x1cab82;rpcDb[_0xf326('0xee')](_0x21ec87)[_0xf326('0x7e')](function(_0x319483){if(!_[_0xf326('0x5f')](_0x319483[0x0])){_0x1cab82=_0x319483[0x0][_0xf326('0xef')]?![]:!![];_0x487230=_0x319483[0x0][_0xf326('0xef')]?!![]:![];_0x487230=_0x4307d9?!![]:_0x487230;}var _0x478395=_0x2fa05b[_0xf326('0xf0')](_0x319483);if(_0x478395['isValid']){rpcDb[_0xf326('0xf1')](_['pick'](_0x319483[0x0],['VoiceQueueId',_0xf326('0xf2')]))['then'](function(_0x1f37f9){_0x2fa05b[_0xf326('0xf3')](_0x1f37f9,_0x319483[0x0],_0x4307d9,_0x1cab82,_0x487230)[_0xf326('0x7e')](function(_0x7ea54d){_0x2e31b1(_0x7ea54d);})[_0xf326('0x6f')](function(_0x84f9ad){_0x287d55(_0x84f9ad);});})[_0xf326('0x6f')](function(_0x18b3cc){ut[_0xf326('0x50')](_0xf326('0xf4'),_0x18b3cc);_0x287d55(ut[_0xf326('0x45')](_0xf326('0xf5'),_0x1cab82,_0x487230));});}else{_0x287d55(ut['message'](_0x478395[_0xf326('0x45')],_0x1cab82,_0x487230));}})[_0xf326('0x6f')](function(_0x5657){ut[_0xf326('0x50')](_0xf326('0xf6'),_0x5657);_0x287d55(ut[_0xf326('0x45')](_0xf326('0xf5'),![],!![]));});});};Preview['prototype'][_0xf326('0xf0')]=function(_0x15f799){if(_[_0xf326('0x5f')](_0x15f799)||_[_0xf326('0xf7')](_0x15f799)||!_[_0xf326('0x5f')](_0x15f799[0x0][_0xf326('0xf8')])&&_[_0xf326('0x5f')](_0x15f799[0x0]['Agent'][_0xf326('0x4a')])){ut[_0xf326('0x50')](_0xf326('0xf9'),_0x15f799);return{'isValid':![],'message':_0xf326('0xfa')};}var _0x62e352=this[_0xf326('0x11')][_0x15f799[0x0][_0xf326('0x61')][_0xf326('0x4a')]];_0x62e352[_0xf326('0x45')]=_0xf326('0xfb');if(_[_0xf326('0x5f')](_0x62e352)){ut[_0xf326('0x50')]('[Preview][validateContact][Empty\x20Campaign]',_0x62e352);return{'isValid':![],'message':_0xf326('0xfc')};}if(!this[_0xf326('0x8d')](_0x62e352[_0xf326('0x47')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0xf326('0xfd')+_0x62e352[_0xf326('0x4a')]+_0xf326('0xfe'));if(!this[_0xf326('0x8d')](_0x62e352['TrunkBackup'])){ut[_0xf326('0x50')](_0xf326('0xff'),_0x62e352[_0xf326('0x4a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x62e352[_0xf326('0x5c')])){ut[_0xf326('0x50')](_0xf326('0x100'),_0x62e352['name']+_0xf326('0x101'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x62e352[_0xf326('0x4a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xf326('0x102')};};Preview[_0xf326('0xc')][_0xf326('0xdf')]=function(_0x178d0c,_0x435692,_0x3dcaf9,_0x1f05a2){var _0x4765ca=this;return new BPromise(function(_0x43971c,_0x21c576){var _0x2714d4=_0x178d0c[_0xf326('0x9d')];var _0x8aea8e=_0x4765ca[_0xf326('0x8d')](_0x435692['Trunk'])?util[_0xf326('0x9a')](_0xf326('0x103'),_0x435692[_0xf326('0x47')]['name'],_['isNil'](_0x435692['dialPrefix'])?'':_0x435692[_0xf326('0x30')][_0xf326('0x104')]()||'',_0x435692[_0xf326('0x105')]>0x0?_0x3dcaf9[_0xf326('0xdc')][_0xf326('0xdd')][_0xf326('0x106')](_0x435692['dialCutDigit']):_0x3dcaf9[_0xf326('0xdc')][_0xf326('0xdd')]):util[_0xf326('0x9a')](_0xf326('0x103'),_[_0xf326('0x5f')](_0x435692['TrunkBackup'])?_0x435692[_0xf326('0x47')][_0xf326('0x4a')]:_0x435692[_0xf326('0x8e')][_0xf326('0x4a')],_[_0xf326('0x5f')](_0x435692['dialPrefix'])?'':_0x435692['dialPrefix'][_0xf326('0x104')]()||'',_0x435692['dialCutDigit']>0x0?_0x3dcaf9['Contact'][_0xf326('0xdd')][_0xf326('0x106')](_0x435692[_0xf326('0x105')]):_0x3dcaf9[_0xf326('0xdc')][_0xf326('0xdd')]);var _0x5aa1ca=_0x4765ca[_0xf326('0x8d')](_0x435692[_0xf326('0x47')])?ut[_0xf326('0x107')](_0x435692[_0xf326('0x47')]['callerid'],_0x435692[_0xf326('0x108')],_0x435692['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x435692['dialOriginateCallerIdNumber'],_0x435692[_0xf326('0x109')]):_0x435692[_0xf326('0x2e')]):ut[_0xf326('0x107')](_[_0xf326('0x5f')](_0x435692[_0xf326('0x8e')])?_0x435692[_0xf326('0x47')][_0xf326('0x10a')]:_0x435692[_0xf326('0x8e')][_0xf326('0x10a')],_0x435692[_0xf326('0x108')],_0x435692[_0xf326('0x109')]>0x0?ut['getCallerIdRandom'](_0x435692[_0xf326('0x2e')],_0x435692[_0xf326('0x109')]):_0x435692[_0xf326('0x2e')]);var _0x6ebef5=ut[_0xf326('0x10b')](_0x435692,_0x3dcaf9,_0x8aea8e,_0x5aa1ca,_0x2714d4);_[_0xf326('0x10c')](_0x178d0c,ut[_0xf326('0x10d')](_0x6ebef5));_0x178d0c[_0xf326('0x10e')]=moment()[_0xf326('0x9a')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xf326('0x6c')](ut[_0xf326('0x10f')](_0x178d0c,_0x435692,_0x6ebef5,_0x178d0c[_0xf326('0xb4')],_0x1f05a2))['then'](function(_0x4d024a){_0x435692[_0xf326('0x46')]+=0x1;logger[_0xf326('0xa8')]('[originated][increment]',_0x2714d4,'\x20Queue',_0x435692[_0xf326('0x4a')],'originated:\x20',_0x435692[_0xf326('0x46')]);_0x43971c(_0x4d024a);})['catch'](function(_0x18b78e){ut[_0xf326('0xd5')](_0x178d0c,0xe,_0xf326('0x110'));rpcDb[_0xf326('0xd7')](_0x178d0c,_0xf326('0x111'));_0x21c576(_0x18b78e);});});};Preview['prototype'][_0xf326('0x1c')]=function(_0x5331ef){if(this[_0xf326('0x13')][_0x5331ef[_0xf326('0x98')]]){this[_0xf326('0x13')][_0x5331ef[_0xf326('0x98')]][_0xf326('0x6e')]=_0x5331ef['channel'];}};Preview['prototype'][_0xf326('0x16')]=function(_0x5c913c){var _0x53421f=this;var _0x5b97bb=this['actions'][_0x5c913c[_0xf326('0x112')]];if(_0x5b97bb){if(_0x5b97bb[_0xf326('0xde')]&&this[_0xf326('0x14')][_0x5b97bb[_0xf326('0xde')]]){ut[_0xf326('0x113')](_0x5b97bb,this[_0xf326('0x14')][_0x5b97bb[_0xf326('0xde')]][_0xf326('0x4a')],this[_0xf326('0x14')][_0x5b97bb[_0xf326('0xde')]]['id']);}var _0x72c3ed=_['clone'](_0x5b97bb);_0x72c3ed[_0xf326('0x9b')]=moment()[_0xf326('0x9a')](_0xf326('0x81'));var _0x3443e5=_0x53421f[_0xf326('0x11')][_0x5b97bb[_0xf326('0x62')]];if(ut[_0xf326('0x114')](_0x5c913c[_0xf326('0x115')])){if(_0x5b97bb[_0xf326('0xbe')]){rpcDb['unlockContact'](_0x5b97bb[_0xf326('0xca')]);}if(_0x5b97bb['activeContact']){rpcDb[_0xf326('0xc9')](_0x5b97bb['idContact']);}ami['emit'](_0xf326('0x116'),ut['buildObj'](_0x5b97bb,_0xf326('0x117')));this[_0xf326('0x118')](_0x72c3ed,_0x3443e5,_0x5c913c);}else{_0x5b97bb[_0xf326('0x10e')]=moment()[_0xf326('0x9a')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xf326('0xd5')](_0x72c3ed,0x4,_0xf326('0xa4'));rpcDb[_0xf326('0xd7')](_0x72c3ed,_0xf326('0x119'));}}};Preview['prototype']['syncHangup']=function(_0x24bef0){var _0x42ffcb=this;var _0x2de8bd=this[_0xf326('0x13')][_0x24bef0[_0xf326('0x98')]];var _0x1acd3b;if(_0x2de8bd){_0x1acd3b=this[_0xf326('0x11')][_0x2de8bd[_0xf326('0x62')]];logger[_0xf326('0xa8')](_0xf326('0x11a'),_0x24bef0[_0xf326('0x98')],'\x20Queue',_0x1acd3b[_0xf326('0x4a')],_0xf326('0x64'),_0x1acd3b[_0xf326('0x65')]);}if(this['actions'][_0x24bef0[_0xf326('0x98')]]&&_0x24bef0['linkedid']!==_0x24bef0[_0xf326('0x9d')]){if(_0x24bef0[_0xf326('0x11b')]==='16'&&this['actions'][_0x24bef0[_0xf326('0x98')]][_0xf326('0x66')]){this[_0xf326('0x90')](_0x24bef0,_0x24bef0[_0xf326('0x98')],_0x24bef0['cause']);}else if(this[_0xf326('0x13')][_0x24bef0[_0xf326('0x98')]][_0xf326('0x66')]){logger[_0xf326('0xa8')](_0xf326('0x11c'),_0x24bef0['linkedid'],_0x24bef0['cause'],_0xf326('0xaa'),_0x1acd3b[_0xf326('0x4a')],_0xf326('0x64'),_0x1acd3b[_0xf326('0x65')]);this[_0xf326('0x90')](_0x24bef0,_0x24bef0[_0xf326('0x98')],_0x24bef0[_0xf326('0x11b')]);}}else if(_0x2de8bd&&_[_0xf326('0x5f')](_0x2de8bd[_0xf326('0x11d')])&&_0x1acd3b[_0xf326('0x11e')]&&_0x24bef0['linkedid']===_0x24bef0['uniqueid']&&_[_0xf326('0x5f')](_0x24bef0[_0xf326('0xd4')])&&_0x24bef0[_0xf326('0x11b')]==='16'&&_0x24bef0[_0xf326('0x11f')]==='6'&&_['isUndefined'](_0x2de8bd[_0xf326('0x120')])){if(_0x2de8bd[_0xf326('0xbe')]){rpcDb[_0xf326('0xc8')](_0x2de8bd[_0xf326('0xca')]);}if(_0x2de8bd[_0xf326('0xb4')]){rpcDb[_0xf326('0xc9')](_0x2de8bd['idContact']);}_0x24bef0[_0xf326('0xd4')]='22';this['callProgressDetectingAgent'](_0x2de8bd,_0x1acd3b,_0x24bef0);}else if(_0x2de8bd&&_0x2de8bd['transfer']){if(_0x24bef0[_0xf326('0x11b')]==='16'&&this[_0xf326('0x13')][_0x24bef0[_0xf326('0x98')]][_0xf326('0x66')]){logger[_0xf326('0xa8')]('[syncHangup][talking][transfer]',_0x24bef0[_0xf326('0x98')],_0x24bef0[_0xf326('0x11b')],_0xf326('0xaa'),_0x1acd3b['name'],_0xf326('0x64'),_0x1acd3b[_0xf326('0x65')]);this[_0xf326('0x90')](_0x24bef0,_0x24bef0[_0xf326('0x98')],_0x24bef0['cause']);}else if(this[_0xf326('0x13')][_0x24bef0['linkedid']]['dialAnswer']){logger[_0xf326('0xa8')]('[syncHangup][talking][cause]',_0x24bef0['linkedid'],_0x24bef0[_0xf326('0x11b')],_0xf326('0xaa'),_0x1acd3b[_0xf326('0x4a')],_0xf326('0x64'),_0x1acd3b['pTalking']);this['callProgressDetectingCustomer'](_0x24bef0,_0x24bef0[_0xf326('0x98')],_0x24bef0[_0xf326('0x11b')]);}}};Preview[_0xf326('0xc')][_0xf326('0x121')]=function(_0xb4b8ba){if(this[_0xf326('0x13')][_0xb4b8ba[_0xf326('0x122')]]&&_0xb4b8ba[_0xf326('0x122')]!==_0xb4b8ba[_0xf326('0x123')]){this['callProgressDetectingCustomer'](_0xb4b8ba,_0xb4b8ba[_0xf326('0x122')],_0xb4b8ba[_0xf326('0xcd')]);}};Preview[_0xf326('0xc')]['syncHangupRequest']=function(_0x4fe207){if(this[_0xf326('0x13')][_0x4fe207[_0xf326('0x98')]]&&_0x4fe207[_0xf326('0x98')]!==_0x4fe207[_0xf326('0x9d')]&&!this['actions'][_0x4fe207['linkedid']]['dialAnswer']){if(_0x4fe207[_0xf326('0x11b')]==='1'){this[_0xf326('0x90')](_0x4fe207,_0x4fe207[_0xf326('0x98')],_0x4fe207['cause']);}}};Preview['prototype'][_0xf326('0x124')]=function(_0x15c66f,_0x3b55c9,_0x54f55a){if(this['actions'][_0x15c66f]){if(_['isNil'](this[_0xf326('0x13')][_0x15c66f][_0xf326('0x125')])){this[_0xf326('0x13')][_0x15c66f][_0xf326('0x125')]={};}this[_0xf326('0x13')][_0x15c66f][_0xf326('0x125')][_0x3b55c9]=_0x54f55a;}};Preview[_0xf326('0xc')][_0xf326('0x1e')]=function(_0x479ae6){try{if(!_['isNil'](_0x479ae6)){if(ut[_0xf326('0x126')](_['keys'](_0x479ae6['variable'])[0x0])){this[_0xf326('0x124')](_0x479ae6[_0xf326('0x9d')],_[_0xf326('0x127')](_0x479ae6[_0xf326('0x128')])[0x0],_0x479ae6[_0xf326('0x129')]);}}}catch(_0x1307a4){logger[_0xf326('0x12a')](_0xf326('0x12b'),util[_0xf326('0x12c')](_0x1307a4,{'showHidden':![],'depth':null}));}};Preview[_0xf326('0xc')][_0xf326('0x12d')]=function(_0x12fc15){if(_0x12fc15){if(this['actions'][_0x12fc15[_0xf326('0x12e')]]){this[_0xf326('0x13')][_0x12fc15[_0xf326('0x12e')]][_0xf326('0x120')]=!![];}}};Preview['prototype'][_0xf326('0x21')]=function(_0x27074a){if(_0x27074a){if(this[_0xf326('0x13')][_0x27074a[_0xf326('0x12f')]]){this[_0xf326('0x13')][_0x27074a['transfererlinkedid']][_0xf326('0x120')]=!![];}}};module[_0xf326('0x130')]=Preview;