Built motion from commit 5b761a7b.|2.5.36
[motion2.git] / server / services / ami / preview / util / util.js
index 7760223..24def7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd17=['pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','interface','mandatoryDisposition','queue','agentReadyId','not_inuse','status','reachable','push','createBody','idContact','type','scheduledat','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','info','inspect','loggerError','error','message','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','createdAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','state','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','variablesAction','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink'];(function(_0x28527b,_0x1e39e4){var _0x403088=function(_0x792283){while(--_0x792283){_0x28527b['push'](_0x28527b['shift']());}};_0x403088(++_0x1e39e4);}(_0xfd17,0x14b));var _0x7fd1=function(_0x15f236,_0x59a12b){_0x15f236=_0x15f236-0x0;var _0x3645c0=_0xfd17[_0x15f236];return _0x3645c0;};'use strict';var util=require(_0x7fd1('0x0'));var _=require(_0x7fd1('0x1'));var moment=require(_0x7fd1('0x2'));var logger=require(_0x7fd1('0x3'))('preview');var ipAgi=process[_0x7fd1('0x4')][_0x7fd1('0x5')]||_0x7fd1('0x6');function getSeconds(_0x21d22e,_0x41a299){var _0x5e647f=moment(_0x21d22e)[_0x7fd1('0x7')](0x0);var _0x44d01b=moment(_0x41a299)[_0x7fd1('0x7')](0x0);return _0x5e647f[_0x7fd1('0x8')](_0x44d01b,_0x7fd1('0x9'));}exports[_0x7fd1('0xa')]=function(_0x3be51e){return function(_0x18c978){logger['error'](_0x3be51e,util['inspect'](_0x18c978,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x30ed63,_0x570cb2){logger[_0x7fd1('0xb')](_0x30ed63,util[_0x7fd1('0xc')](_0x570cb2,{'showHidden':![],'depth':null}));};exports[_0x7fd1('0xd')]=function(_0x13da16,_0x177d3f){logger[_0x7fd1('0xe')](_0x13da16,util[_0x7fd1('0xc')](_0x177d3f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x471c3a){return function(_0x2ca5f8){logger['info'](_0x471c3a,util[_0x7fd1('0xc')](_0x2ca5f8,{'showHidden':![],'depth':null}));};};exports[_0x7fd1('0xf')]=function(_0x40b12e,_0x40f1d5,_0x3feba1){return{'message':_0x40b12e,'unlock':_0x40f1d5,'active':_0x3feba1};};exports['getCallerId']=function(_0x51e176,_0x45aebe,_0x195459){if(!_['isUndefined'](_0x195459)&&_0x7fd1('0x10')===typeof _0x195459&&!_[_0x7fd1('0x11')](_0x195459)){if(!_['isUndefined'](_0x45aebe)&&_0x7fd1('0x10')===typeof _0x45aebe&&!_['isEmpty'](_0x45aebe)){return util[_0x7fd1('0x12')](_0x7fd1('0x13'),_0x45aebe,_0x195459);}return util['format'](_0x7fd1('0x13'),_0x195459,_0x195459);}if(!_[_0x7fd1('0x14')](_0x51e176)&&'string'===typeof _0x51e176&&!_[_0x7fd1('0x11')](_0x51e176)){return _0x51e176;}return _0x7fd1('0x15');};exports[_0x7fd1('0x16')]=function(_0x43b59e){if(_['isNil'](_0x43b59e)){return![];}return _0x43b59e;};exports[_0x7fd1('0x17')]=function(_0x182215,_0x36af15,_0x16ca2c,_0x3bbc4e,_0xa4b859,_0xd8c7b6){var _0x1c6e00={'XMD-QUEUE':_0x36af15[_0x7fd1('0x18')]?_0x36af15[_0x7fd1('0x18')][_0x7fd1('0x19')]:'','XMD-CALLERID':_0x3bbc4e,'XMD-CALLERID-PREVIEW':_0xd8c7b6?util[_0x7fd1('0x12')](_0x7fd1('0x13'),_0xd8c7b6[_0x7fd1('0x1a')],_0xd8c7b6[_0x7fd1('0x1b')]):_0x3bbc4e,'XMD-DIALID':_0xa4b859,'XMD-CONTACTID':_0x36af15[_0x7fd1('0x1c')],'XMD-CDRTYPE':_0x7fd1('0x1d'),'CALLERID(all)':_0x3bbc4e,'XMD-VOICEQUEUEID':_0x36af15[_0x7fd1('0x1e')],'XMD-DIALCHANNEL':_0x16ca2c,'XMD-DIALTIMEOUT':_0x182215['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x7fd1('0x12')](_0x7fd1('0x1f'),_0x182215[_0x7fd1('0x20')]?'g':'',_['isEmpty'](_0x182215[_0x7fd1('0x21')])?'':_0x7fd1('0x22')),'XMD-DIALURL':_0x182215[_0x7fd1('0x23')]||'','XMD-AGI':_0x182215[_0x7fd1('0x24')]?util[_0x7fd1('0x12')](_0x7fd1('0x25'),ipAgi,_0x182215['dialQueueProject']):_0x7fd1('0x26'),'XMD-AGIAFTER':_0x182215[_0x7fd1('0x20')]?util[_0x7fd1('0x12')](_0x7fd1('0x25'),ipAgi,_0x182215['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0xd8c7b6?_0xd8c7b6[_0x7fd1('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0xd8c7b6?_0xd8c7b6['originatecalleridname']:'','XMD-DESTINATION':_0x7fd1('0x28')};if(!_[_0x7fd1('0x11')](_0x182215[_0x7fd1('0x21')])){_0x1c6e00[util['format']('%s',_0x7fd1('0x29'))]=_0x182215[_0x7fd1('0x21')];_0x1c6e00[util['format']('%s',_0x7fd1('0x2a'))]=_0xa4b859;}if(_0x36af15&&_0x36af15['Contact']){for(var _0x42cb24 in _0x36af15['Contact']){if(_0x36af15[_0x7fd1('0x2b')]['hasOwnProperty'](_0x42cb24)){if(!_[_0x7fd1('0x2c')](_0x36af15[_0x7fd1('0x2b')][_0x42cb24])&&_0x42cb24!=='id'&&_0x42cb24!=='tags'&&_0x42cb24!==_0x7fd1('0x2d')&&_0x42cb24!=='updatedAt'){_0x1c6e00[util[_0x7fd1('0x12')](_0x7fd1('0x2e'),'XMD-',_[_0x7fd1('0x2f')](_0x42cb24))]=_0x36af15[_0x7fd1('0x2b')][_0x42cb24];}}}}return _0x1c6e00;};exports[_0x7fd1('0x30')]=function(_0x30ee5f){var _0x44d0eb={};for(var _0x42f882 in _0x30ee5f){if(_0x30ee5f[_0x7fd1('0x31')](_0x42f882)){_0x44d0eb[util[_0x7fd1('0x12')]('%s',_[_0x7fd1('0x32')](_0x42f882))]=_0x30ee5f[_0x42f882];}}return{'variables':_0x44d0eb};};exports['updateOriginated']=function(_0x5bc64c,_0x15d73f){if(!_[_0x7fd1('0x2c')](_0x5bc64c)){if(_0x5bc64c[_0x7fd1('0x31')]('originated')){if(_0x5bc64c['originated']>0x0){_0x5bc64c[_0x7fd1('0x33')]-=0x1;}else{logger['error'](_0x7fd1('0x34'),_0x15d73f);}}}else{logger[_0x7fd1('0xe')](_0x7fd1('0x35'),_0x15d73f);}};exports[_0x7fd1('0x36')]=function(_0x5cab2c){var _0x51b253=moment()['format'](_0x7fd1('0x37'));_0x5cab2c['state']=0xd;_0x5cab2c['statedesc']=_0x7fd1('0x38');_0x5cab2c[_0x7fd1('0x39')]=_0x51b253;_0x5cab2c[_0x7fd1('0x3a')]=_0x51b253;_0x5cab2c['endtime']=_0x51b253;};exports['logAgent']=function(_0x1fefca,_0x2e7094,_0x2321e2){var _0x514922=moment()[_0x7fd1('0x12')](_0x7fd1('0x37'));_0x1fefca[_0x7fd1('0x3b')]=_0x2e7094;_0x1fefca[_0x7fd1('0x3c')]=_0x2321e2;_0x1fefca[_0x7fd1('0x3a')]=_0x514922;_0x1fefca[_0x7fd1('0x3d')]=getSeconds(_0x1fefca['responsetime'],_0x1fefca[_0x7fd1('0x39')]);};exports[_0x7fd1('0x3e')]=function(_0x22db27,_0xb71acc,_0x31984c){_0x22db27[_0x7fd1('0x3f')]=_0xb71acc;_0x22db27[_0x7fd1('0x40')]=_0x31984c;};exports[_0x7fd1('0x41')]=function(_0x182366,_0x5e73c6,_0x570201){var _0x5823e0=moment()[_0x7fd1('0x12')](_0x7fd1('0x37'));_0x182366['state']=_0x5e73c6;_0x182366[_0x7fd1('0x3c')]=_0x570201;_0x182366[_0x7fd1('0x3a')]=_0x182366[_0x7fd1('0x3a')]?_0x182366[_0x7fd1('0x3a')]:_0x5823e0;_0x182366[_0x7fd1('0x42')]=_0x182366['endtime']?_0x182366[_0x7fd1('0x42')]:_0x5823e0;_0x182366[_0x7fd1('0x3d')]=getSeconds(_0x182366[_0x7fd1('0x3a')]||0x0,_0x182366[_0x7fd1('0x39')]||0x0);_0x182366[_0x7fd1('0x43')]=_0x182366['answertime']?getSeconds(_0x182366[_0x7fd1('0x42')],_0x182366[_0x7fd1('0x44')]):0x0;};exports['isFailure']=function(_0x5153c0){return _0x5153c0==='Failure';};exports[_0x7fd1('0x45')]=function(_0x384dec,_0x38b87f,_0x37deb4,_0x8e5cae,_0x40341e){var _0x2c3c83=_0x8e5cae?'RECALL':_0x384dec[_0x7fd1('0x1a')];_0x2c3c83=_0x40341e?'BOOKED':_0x2c3c83;return{'actionid':_0x384dec[_0x7fd1('0x46')],'action':_0x7fd1('0x47'),'channel':_0x384dec[_0x7fd1('0x48')],'callerid':util[_0x7fd1('0x12')](_0x7fd1('0x13'),_0x2c3c83,_0x384dec[_0x7fd1('0x1b')]),'Exten':'xcally-motion-preview','Context':_0x7fd1('0x49'),'Priority':'1','variable':_0x37deb4,'timeout':(_0x38b87f[_0x7fd1('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x384dec[_0x7fd1('0x46')]};};exports[_0x7fd1('0x4b')]=function(_0x12c511){return _0x12c511[_0x7fd1('0x4c')]+_0x12c511[_0x7fd1('0x4d')]+_0x12c511[_0x7fd1('0x4e')]+_0x12c511[_0x7fd1('0x4f')]+_0x12c511[_0x7fd1('0x50')];};exports[_0x7fd1('0x51')]=function(_0xe87357){var _0x53af97=_['clone'](_0xe87357);_0x53af97[_0x7fd1('0x3b')]=0xf;_0x53af97[_0x7fd1('0x3c')]=_0x7fd1('0x52');return _0x53af97;};exports[_0x7fd1('0x53')]=function(_0x35b0fe,_0x6789ce,_0x1f01b5){var _0x2ffeb3={};_0x2ffeb3[_0x6789ce]=_0x35b0fe[_0x6789ce];_0x2ffeb3[_0x7fd1('0x54')]=![];_0x2ffeb3['scheduledat']=moment()[_0x7fd1('0x55')](_0x1f01b5,_0x7fd1('0x56'))[_0x7fd1('0x12')](_0x7fd1('0x37'));_0x2ffeb3[_0x7fd1('0x1c')]=_0x35b0fe[_0x7fd1('0x1c')];_0x2ffeb3[_0x7fd1('0x57')]=_0x35b0fe[_0x7fd1('0x57')];_0x2ffeb3[_0x7fd1('0x1e')]=_0x35b0fe[_0x7fd1('0x1e')]||undefined;return _0x2ffeb3;};exports[_0x7fd1('0x58')]=function(_0x3e7361,_0x1ddf76){if(!_['isNil'](_0x3e7361)){if(_0x3e7361[_0x7fd1('0x59')]>0x0){_0x3e7361['pTalking']-=0x1;}else{logger[_0x7fd1('0xe')](_0x1ddf76,_0x7fd1('0x5a'));}}else{logger[_0x7fd1('0xe')](_0x1ddf76,_0x7fd1('0x5b'));}};exports[_0x7fd1('0x5c')]=function(_0x88b084){if(_0x88b084<=0x0){return!![];}return![];};exports[_0x7fd1('0x5d')]=function(_0x2536a9,_0x4c053a,_0x913c42){_0x2536a9['lastevent']=_0x4c053a;_0x2536a9[_0x7fd1('0x19')]=_0x2536a9['queue'];_0x2536a9[_0x7fd1('0x5e')]=_0x2536a9['channelAgent'];if(_0x913c42){_0x2536a9[_0x7fd1('0x5f')]=_0x913c42[_0x7fd1('0x5f')];}return _0x2536a9;};exports['buildAcw']=function(_0x389d31){var _0x4c0583={};_0x4c0583[_0x7fd1('0x60')]=_0x389d31[_0x7fd1('0x60')];_0x4c0583['interface']=_0x389d31[_0x7fd1('0x48')];_0x4c0583[_0x7fd1('0x46')]=_0x389d31[_0x7fd1('0x46')];return _0x4c0583;};exports[_0x7fd1('0x61')]=function(_0x119704){var _0x317cc5=[];for(var _0x120e2b in _0x119704){if(_0x119704[_0x7fd1('0x31')](_0x120e2b)){if(!_[_0x7fd1('0x2c')](_0x119704[_0x120e2b])&&_0x119704[_0x120e2b][_0x7fd1('0x3b')]===_0x7fd1('0x62')&&_0x119704[_0x120e2b][_0x7fd1('0x63')]===_0x7fd1('0x64')){_0x317cc5[_0x7fd1('0x65')](_0x119704[_0x120e2b]['id']);}}}return _0x317cc5;};exports['getDiff']=function(_0x4bd309){var _0x4757c0=moment()['milliseconds'](0x0);var _0x288146=moment(_0x4bd309)[_0x7fd1('0x7')](0x0);return _0x4757c0[_0x7fd1('0x8')](_0x288146,_0x7fd1('0x9'));};exports[_0x7fd1('0x66')]=function(_0x1113f2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1113f2[_0x7fd1('0x1c')],'ListId':_0x1113f2[_0x7fd1('0x57')],'VoiceQueueId':_0x1113f2[_0x7fd1('0x1e')]||undefined,'CampaignId':_0x1113f2['CampaignId']||undefined};};exports['filterKey']=function(_0x1d3d80){if(_0x1d3d80===_0x7fd1('0x46')||_0x1d3d80===_0x7fd1('0x67')||_0x1d3d80===_0x7fd1('0x60')||_0x1d3d80===_0x7fd1('0x68')||_0x1d3d80==='campaigntype'||_0x1d3d80==='dialAnswer'||_0x1d3d80===_0x7fd1('0x3f')||_0x1d3d80===_0x7fd1('0x48')||_0x1d3d80===_0x7fd1('0x1a')||_0x1d3d80===_0x7fd1('0x54')||_0x1d3d80==='calleridnum'||_0x1d3d80===_0x7fd1('0x69')||_0x1d3d80==='countbusyretry'||_0x1d3d80===_0x7fd1('0x4d')||_0x1d3d80===_0x7fd1('0x4e')||_0x1d3d80===_0x7fd1('0x6a')||_0x1d3d80==='callback'||_0x1d3d80===_0x7fd1('0x6b')||_0x1d3d80===_0x7fd1('0x6c')||_0x1d3d80===_0x7fd1('0x6d')||_0x1d3d80===_0x7fd1('0x1c')||_0x1d3d80===_0x7fd1('0x57')||_0x1d3d80===_0x7fd1('0x40')||_0x1d3d80===_0x7fd1('0x1e')||_0x1d3d80===_0x7fd1('0x6e')||_0x1d3d80==='xmd-voicequeueid'||_0x1d3d80==='xmd-queue'||_0x1d3d80===_0x7fd1('0x6f')||_0x1d3d80===_0x7fd1('0x70')||_0x1d3d80===_0x7fd1('0x71')||_0x1d3d80===_0x7fd1('0x72')||_0x1d3d80===_0x7fd1('0x73')||_0x1d3d80===_0x7fd1('0x74')||_0x1d3d80===_0x7fd1('0x75')||_0x1d3d80===_0x7fd1('0x76')||_0x1d3d80===_0x7fd1('0x77')||_0x1d3d80===_0x7fd1('0x78')||_0x1d3d80===_0x7fd1('0x79')||_0x1d3d80===_0x7fd1('0x7a')||_0x1d3d80===_0x7fd1('0x7b')||_0x1d3d80===_0x7fd1('0x7c')||_0x1d3d80===_0x7fd1('0x7d')||_0x1d3d80===_0x7fd1('0x7e')||_0x1d3d80===_0x7fd1('0x7f')||_0x1d3d80===_0x7fd1('0x80')||_0x1d3d80===_0x7fd1('0x81')||_0x1d3d80===_0x7fd1('0x82')||_0x1d3d80===_0x7fd1('0x7b')||_0x1d3d80===_0x7fd1('0x7c')||_0x1d3d80===_0x7fd1('0x7d')||_0x1d3d80===_0x7fd1('0x7e')||_0x1d3d80===_0x7fd1('0x7f')||_0x1d3d80===_0x7fd1('0x80')||_0x1d3d80===_0x7fd1('0x81')||_0x1d3d80==='rtpaudioqosrttbridged'||_0x1d3d80===_0x7fd1('0x83')||_0x1d3d80===_0x7fd1('0x84')||_0x1d3d80===_0x7fd1('0x3b')||_0x1d3d80===_0x7fd1('0x3c')){return![];}return!![];};exports[_0x7fd1('0x85')]=function(_0x283142,_0x2bdd71){var _0x1f68f5,_0x474b0a,_0x31c156;if(_0x2bdd71<=0x0){_0x2bdd71=0x1;}_0x1f68f5=new RegExp(_0x7fd1('0x86')+_0x2bdd71+'}$');_0x474b0a=Math['pow'](0xa,_0x2bdd71-0x1);_0x31c156=Math[_0x7fd1('0x87')](0xa,_0x2bdd71)-0x1;return util[_0x7fd1('0x12')]('%s',_[_0x7fd1('0x88')](_0x283142,_0x1f68f5,_['random'](_0x474b0a,_0x31c156)));};exports[_0x7fd1('0x89')]=function(_0x1105cb){var _0x22ddbf=_0x1105cb[_0x7fd1('0x8a')](/"(.*?)"/);return _0x22ddbf?_0x22ddbf[0x1]:_0x1105cb;};exports[_0x7fd1('0x8b')]=function(_0x31f09c){var _0x3731e9=_0x31f09c[_0x7fd1('0x8a')](/<(.*?)>/);return _0x3731e9?_0x3731e9[0x1]:_0x31f09c;};
\ No newline at end of file
+var _0xe21c=['originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','logAgent','responsetime','ringtime','logLookAgent','membername','logCustomer','endtime','talktime','answertime','isFailure','RECALL','calleridname','BOOKED','originate','channelAgent','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','milliseconds','createBody','CampaignId','filterKey','type','campaigntype','active','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE'];(function(_0x497d22,_0xaafbb8){var _0x3272ed=function(_0x5480f2){while(--_0x5480f2){_0x497d22['push'](_0x497d22['shift']());}};_0x3272ed(++_0xaafbb8);}(_0xe21c,0x6c));var _0xce21=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe21c[_0x5ddb1c];return _0x354adc;};'use strict';var util=require(_0xce21('0x0'));var _=require(_0xce21('0x1'));var moment=require(_0xce21('0x2'));var logger=require(_0xce21('0x3'))(_0xce21('0x4'));var ipAgi=process[_0xce21('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x5b7bf9,_0x73a764){var _0x1d3f09=moment(_0x5b7bf9)['milliseconds'](0x0);var _0x84b8fe=moment(_0x73a764)['milliseconds'](0x0);return _0x1d3f09[_0xce21('0x6')](_0x84b8fe,_0xce21('0x7'));}exports[_0xce21('0x8')]=function(_0x224df7){return function(_0x292508){logger[_0xce21('0x9')](_0x224df7,util[_0xce21('0xa')](_0x292508,{'showHidden':![],'depth':null}));};};exports[_0xce21('0xb')]=function(_0x5d4150,_0x336079){logger['info'](_0x5d4150,util[_0xce21('0xa')](_0x336079,{'showHidden':![],'depth':null}));};exports[_0xce21('0xc')]=function(_0x508c2f,_0x3f9b2f){logger[_0xce21('0x9')](_0x508c2f,util['inspect'](_0x3f9b2f,{'showHidden':![],'depth':null}));};exports[_0xce21('0xd')]=function(_0x18753b){return function(_0x1223c){logger[_0xce21('0xe')](_0x18753b,util[_0xce21('0xa')](_0x1223c,{'showHidden':![],'depth':null}));};};exports[_0xce21('0xf')]=function(_0x17b3c2,_0x503472,_0x5edb26){return{'message':_0x17b3c2,'unlock':_0x503472,'active':_0x5edb26};};exports['getCallerId']=function(_0x14faa2,_0x2b398e,_0x4fd7e2){if(!_[_0xce21('0x10')](_0x4fd7e2)&&_0xce21('0x11')===typeof _0x4fd7e2&&!_['isEmpty'](_0x4fd7e2)){if(!_[_0xce21('0x10')](_0x2b398e)&&_0xce21('0x11')===typeof _0x2b398e&&!_[_0xce21('0x12')](_0x2b398e)){return util[_0xce21('0x13')](_0xce21('0x14'),_0x2b398e,_0x4fd7e2);}return util['format']('\x22%s\x22\x20<%s>',_0x4fd7e2,_0x4fd7e2);}if(!_[_0xce21('0x10')](_0x14faa2)&&_0xce21('0x11')===typeof _0x14faa2&&!_[_0xce21('0x12')](_0x14faa2)){return _0x14faa2;}return _0xce21('0x15');};exports[_0xce21('0x16')]=function(_0x24598a){if(_['isNil'](_0x24598a)){return![];}return _0x24598a;};exports[_0xce21('0x17')]=function(_0x3b335f,_0x2fd64a,_0xfe42c9,_0xdf0416,_0x2fd0ab,_0x29458a){var _0x41279a={'XMD-QUEUE':_0x2fd64a[_0xce21('0x18')]?_0x2fd64a[_0xce21('0x18')][_0xce21('0x19')]:'','XMD-CALLERID':_0xdf0416,'XMD-CALLERID-PREVIEW':_0x29458a?util[_0xce21('0x13')](_0xce21('0x14'),_0x29458a['calleridname'],_0x29458a[_0xce21('0x1a')]):_0xdf0416,'XMD-DIALID':_0x2fd0ab,'XMD-CONTACTID':_0x2fd64a[_0xce21('0x1b')],'XMD-CDRTYPE':_0xce21('0x1c'),'CALLERID(all)':_0xdf0416,'XMD-VOICEQUEUEID':_0x2fd64a[_0xce21('0x1d')],'XMD-DIALCHANNEL':_0xfe42c9,'XMD-DIALTIMEOUT':_0x3b335f['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xce21('0x13')](_0xce21('0x1e'),_0x3b335f[_0xce21('0x1f')]?'g':'',_[_0xce21('0x12')](_0x3b335f['monitor_format'])?'':_0xce21('0x20')),'XMD-DIALURL':_0x3b335f['dialPreviewUrl']||'','XMD-AGI':_0x3b335f[_0xce21('0x21')]?util[_0xce21('0x13')](_0xce21('0x22'),ipAgi,_0x3b335f[_0xce21('0x21')]):'NONE','XMD-AGIAFTER':_0x3b335f['dialQueueProject2']?util[_0xce21('0x13')](_0xce21('0x22'),ipAgi,_0x3b335f[_0xce21('0x1f')]):_0xce21('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x29458a?_0x29458a[_0xce21('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x29458a?_0x29458a['originatecalleridname']:'','XMD-DESTINATION':_0xce21('0x25'),'SIPADDHEADER':_0xce21('0x26')};if(!_[_0xce21('0x12')](_0x3b335f[_0xce21('0x27')])){_0x41279a[util[_0xce21('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3b335f[_0xce21('0x27')];_0x41279a[util[_0xce21('0x13')]('%s',_0xce21('0x28'))]=_0x2fd0ab;}if(_0x2fd64a&&_0x2fd64a[_0xce21('0x29')]){for(var _0xf3187d in _0x2fd64a[_0xce21('0x29')]){if(_0x2fd64a[_0xce21('0x29')][_0xce21('0x2a')](_0xf3187d)){if(!_['isNil'](_0x2fd64a[_0xce21('0x29')][_0xf3187d])&&_0xf3187d!=='id'&&_0xf3187d!==_0xce21('0x2b')&&_0xf3187d!==_0xce21('0x2c')&&_0xf3187d!==_0xce21('0x2d')){_0x41279a[util['format'](_0xce21('0x2e'),'XMD-',_['toUpper'](_0xf3187d))]=_0x2fd64a[_0xce21('0x29')][_0xf3187d];}}}}return _0x41279a;};exports[_0xce21('0x2f')]=function(_0x429061){var _0xb62dcf={};for(var _0x5228e2 in _0x429061){if(_0x429061[_0xce21('0x2a')](_0x5228e2)){_0xb62dcf[util[_0xce21('0x13')]('%s',_[_0xce21('0x30')](_0x5228e2))]=_0x429061[_0x5228e2];}}return{'variables':_0xb62dcf};};exports[_0xce21('0x31')]=function(_0x3a60c4,_0x2aa8d5){if(!_['isNil'](_0x3a60c4)){if(_0x3a60c4['hasOwnProperty'](_0xce21('0x32'))){if(_0x3a60c4['originated']>0x0){_0x3a60c4[_0xce21('0x32')]-=0x1;}else{logger['error'](_0xce21('0x33'),_0x2aa8d5);}}}else{logger[_0xce21('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2aa8d5);}};exports[_0xce21('0x34')]=function(_0x98a0b8){var _0xcfb3f8=moment()[_0xce21('0x13')](_0xce21('0x35'));_0x98a0b8[_0xce21('0x36')]=0xd;_0x98a0b8[_0xce21('0x37')]='Blacklist';_0x98a0b8[_0xce21('0x38')]=_0xcfb3f8;_0x98a0b8['responsetime']=_0xcfb3f8;_0x98a0b8['endtime']=_0xcfb3f8;};exports[_0xce21('0x39')]=function(_0x403ca3,_0x43666a,_0x1ebf6d){var _0x2491f5=moment()[_0xce21('0x13')](_0xce21('0x35'));_0x403ca3[_0xce21('0x36')]=_0x43666a;_0x403ca3[_0xce21('0x37')]=_0x1ebf6d;_0x403ca3[_0xce21('0x3a')]=_0x2491f5;_0x403ca3[_0xce21('0x3b')]=getSeconds(_0x403ca3[_0xce21('0x3a')],_0x403ca3['starttime']);};exports[_0xce21('0x3c')]=function(_0x480625,_0x14cb89,_0x888c89){_0x480625[_0xce21('0x3d')]=_0x14cb89;_0x480625['UserId']=_0x888c89;};exports[_0xce21('0x3e')]=function(_0x275949,_0x31272c,_0x497e13){var _0x50f382=moment()[_0xce21('0x13')](_0xce21('0x35'));_0x275949[_0xce21('0x36')]=_0x31272c;_0x275949[_0xce21('0x37')]=_0x497e13;_0x275949[_0xce21('0x3a')]=_0x275949[_0xce21('0x3a')]?_0x275949['responsetime']:_0x50f382;_0x275949[_0xce21('0x3f')]=_0x275949[_0xce21('0x3f')]?_0x275949[_0xce21('0x3f')]:_0x50f382;_0x275949[_0xce21('0x3b')]=getSeconds(_0x275949[_0xce21('0x3a')]||0x0,_0x275949[_0xce21('0x38')]||0x0);_0x275949[_0xce21('0x40')]=_0x275949['answertime']?getSeconds(_0x275949[_0xce21('0x3f')],_0x275949[_0xce21('0x41')]):0x0;};exports[_0xce21('0x42')]=function(_0x13520f){return _0x13520f==='Failure';};exports['variablesAction']=function(_0x27a27a,_0x4c7869,_0x41506f,_0x5621fd,_0x35aa72){var _0x1b3336=_0x5621fd?_0xce21('0x43'):_0x27a27a[_0xce21('0x44')];_0x1b3336=_0x35aa72?_0xce21('0x45'):_0x1b3336;return{'actionid':_0x27a27a['uniqueid'],'action':_0xce21('0x46'),'channel':_0x27a27a[_0xce21('0x47')],'callerid':util[_0xce21('0x13')](_0xce21('0x14'),_0x1b3336,_0x27a27a[_0xce21('0x1a')]),'Exten':_0xce21('0x25'),'Context':'from-sip','Priority':'1','variable':_0x41506f,'timeout':(_0x4c7869[_0xce21('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x27a27a[_0xce21('0x49')]};};exports[_0xce21('0x4a')]=function(_0x3de1ec){return _0x3de1ec[_0xce21('0x4b')]+_0x3de1ec[_0xce21('0x4c')]+_0x3de1ec['countnoanswerretry']+_0x3de1ec['countagentrejectretry']+_0x3de1ec[_0xce21('0x4d')];};exports[_0xce21('0x4e')]=function(_0x54fe60){var _0xa2afb9=_[_0xce21('0x4f')](_0x54fe60);_0xa2afb9['state']=0xf;_0xa2afb9[_0xce21('0x37')]=_0xce21('0x50');return _0xa2afb9;};exports[_0xce21('0x51')]=function(_0x29653c,_0x95e32d,_0x3940fc){var _0x4144a6={};_0x4144a6[_0x95e32d]=_0x29653c[_0x95e32d];_0x4144a6['active']=![];_0x4144a6[_0xce21('0x52')]=moment()[_0xce21('0x53')](_0x3940fc,_0xce21('0x54'))['format'](_0xce21('0x35'));_0x4144a6['ContactId']=_0x29653c[_0xce21('0x1b')];_0x4144a6['ListId']=_0x29653c[_0xce21('0x55')];_0x4144a6[_0xce21('0x1d')]=_0x29653c[_0xce21('0x1d')]||undefined;return _0x4144a6;};exports[_0xce21('0x56')]=function(_0x2d14ca,_0xf7cd70){if(!_[_0xce21('0x57')](_0x2d14ca)){if(_0x2d14ca[_0xce21('0x58')]>0x0){_0x2d14ca[_0xce21('0x58')]-=0x1;}else{logger[_0xce21('0x9')](_0xf7cd70,_0xce21('0x59'));}}else{logger['error'](_0xf7cd70,_0xce21('0x5a'));}};exports[_0xce21('0x5b')]=function(_0x5ce48e){if(_0x5ce48e<=0x0){return!![];}return![];};exports[_0xce21('0x5c')]=function(_0x41182b,_0x59723d,_0x114d99){_0x41182b[_0xce21('0x5d')]=_0x59723d;_0x41182b[_0xce21('0x19')]=_0x41182b[_0xce21('0x5e')];_0x41182b['interface']=_0x41182b['channelAgent'];_0x41182b[_0xce21('0x5f')]=_0xce21('0x60');if(_0x114d99){_0x41182b['mandatoryDisposition']=_0x114d99[_0xce21('0x61')];}return _0x41182b;};exports[_0xce21('0x62')]=function(_0x47df24){var _0x4a321c={};_0x4a321c['queue']=_0x47df24[_0xce21('0x5e')];_0x4a321c[_0xce21('0x63')]=_0x47df24[_0xce21('0x47')];_0x4a321c[_0xce21('0x49')]=_0x47df24[_0xce21('0x49')];return _0x4a321c;};exports[_0xce21('0x64')]=function(_0x335b18){var _0x58a069=[];for(var _0x5d4e1f in _0x335b18){if(_0x335b18[_0xce21('0x2a')](_0x5d4e1f)){if(!_[_0xce21('0x57')](_0x335b18[_0x5d4e1f])&&_0x335b18[_0x5d4e1f]['state']===_0xce21('0x65')&&_0x335b18[_0x5d4e1f][_0xce21('0x66')]===_0xce21('0x67')){_0x58a069['push'](_0x335b18[_0x5d4e1f]['id']);}}}return _0x58a069;};exports['getDiff']=function(_0x11dba4){var _0x4db001=moment()['milliseconds'](0x0);var _0x2f2e63=moment(_0x11dba4)[_0xce21('0x68')](0x0);return _0x4db001['diff'](_0x2f2e63,_0xce21('0x7'));};exports[_0xce21('0x69')]=function(_0x465208){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x465208[_0xce21('0x1b')],'ListId':_0x465208[_0xce21('0x55')],'VoiceQueueId':_0x465208['VoiceQueueId']||undefined,'CampaignId':_0x465208[_0xce21('0x6a')]||undefined};};exports[_0xce21('0x6b')]=function(_0x130fcf){if(_0x130fcf===_0xce21('0x49')||_0x130fcf==='idContact'||_0x130fcf===_0xce21('0x5e')||_0x130fcf===_0xce21('0x6c')||_0x130fcf===_0xce21('0x6d')||_0x130fcf==='dialAnswer'||_0x130fcf===_0xce21('0x3d')||_0x130fcf===_0xce21('0x47')||_0x130fcf===_0xce21('0x44')||_0x130fcf===_0xce21('0x6e')||_0x130fcf===_0xce21('0x1a')||_0x130fcf===_0xce21('0x52')||_0x130fcf===_0xce21('0x4b')||_0x130fcf==='countcongestionretry'||_0x130fcf===_0xce21('0x6f')||_0x130fcf===_0xce21('0x70')||_0x130fcf===_0xce21('0x71')||_0x130fcf===_0xce21('0x72')||_0x130fcf===_0xce21('0x73')||_0x130fcf===_0xce21('0x74')||_0x130fcf==='ContactId'||_0x130fcf===_0xce21('0x55')||_0x130fcf==='UserId'||_0x130fcf===_0xce21('0x1d')||_0x130fcf==='sipcallid'||_0x130fcf===_0xce21('0x75')||_0x130fcf===_0xce21('0x76')||_0x130fcf==='xmd-phone'||_0x130fcf===_0xce21('0x77')||_0x130fcf===_0xce21('0x78')||_0x130fcf===_0xce21('0x79')||_0x130fcf===_0xce21('0x7a')||_0x130fcf===_0xce21('0x7b')||_0x130fcf===_0xce21('0x7c')||_0x130fcf===_0xce21('0x7d')||_0x130fcf==='xmd-cdrtype'||_0x130fcf===_0xce21('0x7e')||_0x130fcf===_0xce21('0x7f')||_0x130fcf===_0xce21('0x80')||_0x130fcf==='rtpaudioqos'||_0x130fcf===_0xce21('0x81')||_0x130fcf===_0xce21('0x82')||_0x130fcf===_0xce21('0x83')||_0x130fcf===_0xce21('0x84')||_0x130fcf==='rtpaudioqoslossbridged'||_0x130fcf==='rtpaudioqosrtt'||_0x130fcf===_0xce21('0x85')||_0x130fcf==='rtpaudioqos'||_0x130fcf===_0xce21('0x81')||_0x130fcf===_0xce21('0x82')||_0x130fcf==='rtpaudioqosjitterbridged'||_0x130fcf===_0xce21('0x84')||_0x130fcf===_0xce21('0x86')||_0x130fcf===_0xce21('0x87')||_0x130fcf===_0xce21('0x85')||_0x130fcf===_0xce21('0x88')||_0x130fcf==='bridgepvtcallid'||_0x130fcf===_0xce21('0x36')||_0x130fcf===_0xce21('0x37')){return![];}return!![];};exports[_0xce21('0x89')]=function(_0x33bcdb,_0x4c613c){var _0x5a032d,_0x2220f5,_0x420a83;if(_0x4c613c<=0x0){_0x4c613c=0x1;}_0x5a032d=new RegExp(_0xce21('0x8a')+_0x4c613c+'}$');_0x2220f5=Math[_0xce21('0x8b')](0xa,_0x4c613c-0x1);_0x420a83=Math[_0xce21('0x8b')](0xa,_0x4c613c)-0x1;return util['format']('%s',_[_0xce21('0x8c')](_0x33bcdb,_0x5a032d,_['random'](_0x2220f5,_0x420a83)));};exports[_0xce21('0x8d')]=function(_0x2779f9){var _0x44f800=_0x2779f9['match'](/"(.*?)"/);return _0x44f800?_0x44f800[0x1]:_0x2779f9;};exports[_0xce21('0x8e')]=function(_0x4f8d7c){var _0x2d0894=_0x4f8d7c[_0xce21('0x8f')](/<(.*?)>/);return _0x2d0894?_0x2d0894[0x1]:_0x4f8d7c;};
\ No newline at end of file