Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / services / ami / preview / util / util.js
index 6c0d078..ea73d16 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf922=['name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countnoanswerretry','countnosuchnumberretry','clone','Global','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','scheduledat','countbusyretry','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue'];(function(_0x4c03c3,_0x1c7bc1){var _0x5925e1=function(_0x7a2283){while(--_0x7a2283){_0x4c03c3['push'](_0x4c03c3['shift']());}};_0x5925e1(++_0x1c7bc1);}(_0xf922,0x18c));var _0x2f92=function(_0x3aab7f,_0x18d72c){_0x3aab7f=_0x3aab7f-0x0;var _0x3c2be6=_0xf922[_0x3aab7f];return _0x3c2be6;};'use strict';var util=require(_0x2f92('0x0'));var _=require('lodash');var moment=require(_0x2f92('0x1'));var logger=require(_0x2f92('0x2'))(_0x2f92('0x3'));var ipAgi=process[_0x2f92('0x4')][_0x2f92('0x5')]||_0x2f92('0x6');function getSeconds(_0xb6ff02,_0xe2f9a6){var _0xb76ba2=moment(_0xb6ff02)[_0x2f92('0x7')](0x0);var _0x5859dc=moment(_0xe2f9a6)[_0x2f92('0x7')](0x0);return _0xb76ba2[_0x2f92('0x8')](_0x5859dc,_0x2f92('0x9'));}exports[_0x2f92('0xa')]=function(_0x16e941){return function(_0xe35f46){logger[_0x2f92('0xb')](_0x16e941,util[_0x2f92('0xc')](_0xe35f46,{'showHidden':![],'depth':null}));};};exports[_0x2f92('0xd')]=function(_0x41fea4,_0x5075a0){logger['info'](_0x41fea4,util[_0x2f92('0xc')](_0x5075a0,{'showHidden':![],'depth':null}));};exports[_0x2f92('0xe')]=function(_0x4f8668,_0x74725e){logger[_0x2f92('0xb')](_0x4f8668,util[_0x2f92('0xc')](_0x74725e,{'showHidden':![],'depth':null}));};exports[_0x2f92('0xf')]=function(_0x1f29a7){return function(_0x166b90){logger[_0x2f92('0x10')](_0x1f29a7,util[_0x2f92('0xc')](_0x166b90,{'showHidden':![],'depth':null}));};};exports[_0x2f92('0x11')]=function(_0x41a26b,_0x3835bc,_0x14120b){return{'message':_0x41a26b,'unlock':_0x3835bc,'active':_0x14120b};};exports[_0x2f92('0x12')]=function(_0x37675a,_0x379213,_0x6cc798){if(!_['isUndefined'](_0x6cc798)&&_0x2f92('0x13')===typeof _0x6cc798&&!_[_0x2f92('0x14')](_0x6cc798)){if(!_[_0x2f92('0x15')](_0x379213)&&_0x2f92('0x13')===typeof _0x379213&&!_[_0x2f92('0x14')](_0x379213)){return util[_0x2f92('0x16')](_0x2f92('0x17'),_0x379213,_0x6cc798);}return util[_0x2f92('0x16')](_0x2f92('0x17'),_0x6cc798,_0x6cc798);}if(!_[_0x2f92('0x15')](_0x37675a)&&_0x2f92('0x13')===typeof _0x37675a&&!_[_0x2f92('0x14')](_0x37675a)){return _0x37675a;}return'\x22\x22\x20<>';};exports[_0x2f92('0x18')]=function(_0x5d927e){if(_[_0x2f92('0x19')](_0x5d927e)){return![];}return _0x5d927e;};exports['addVariables']=function(_0x5a10aa,_0x256b92,_0x175d2d,_0x13cb61,_0x340151,_0x23662c){var _0x207f1e={'XMD-QUEUE':_0x256b92[_0x2f92('0x1a')]?_0x256b92['Queue'][_0x2f92('0x1b')]:'','XMD-CALLERID':_0x13cb61,'XMD-CALLERID-PREVIEW':_0x23662c?util[_0x2f92('0x16')]('\x22%s\x22\x20<%s>',_0x23662c['calleridname'],_0x23662c[_0x2f92('0x1c')]):_0x13cb61,'XMD-DIALID':_0x340151,'XMD-CONTACTID':_0x256b92[_0x2f92('0x1d')],'XMD-CDRTYPE':_0x2f92('0x1e'),'CALLERID(all)':_0x13cb61,'XMD-VOICEQUEUEID':_0x256b92[_0x2f92('0x1f')],'XMD-DIALCHANNEL':_0x175d2d,'XMD-DIALTIMEOUT':_0x5a10aa[_0x2f92('0x20')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x2f92('0x21'),_0x5a10aa[_0x2f92('0x22')]?'g':'',_['isEmpty'](_0x5a10aa[_0x2f92('0x23')])?'':_0x2f92('0x24')),'XMD-DIALURL':_0x5a10aa['dialPreviewUrl']||'','XMD-AGI':_0x5a10aa[_0x2f92('0x25')]?util[_0x2f92('0x16')](_0x2f92('0x26'),ipAgi,_0x5a10aa[_0x2f92('0x25')]):'NONE','XMD-AGIAFTER':_0x5a10aa[_0x2f92('0x22')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5a10aa[_0x2f92('0x22')]):_0x2f92('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x23662c?_0x23662c[_0x2f92('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x23662c?_0x23662c[_0x2f92('0x29')]:'','XMD-DESTINATION':_0x2f92('0x2a'),'SIPADDHEADER':_0x2f92('0x2b')};if(!_['isEmpty'](_0x5a10aa['monitor_format'])){_0x207f1e[util[_0x2f92('0x16')]('%s',_0x2f92('0x2c'))]=_0x5a10aa['monitor_format'];_0x207f1e[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x340151;}if(_0x256b92&&_0x256b92[_0x2f92('0x2d')]){for(var _0x7aa153 in _0x256b92['Contact']){if(_0x256b92[_0x2f92('0x2d')][_0x2f92('0x2e')](_0x7aa153)){if(!_['isNil'](_0x256b92[_0x2f92('0x2d')][_0x7aa153])&&_0x7aa153!=='id'&&_0x7aa153!==_0x2f92('0x2f')&&_0x7aa153!==_0x2f92('0x30')&&_0x7aa153!==_0x2f92('0x31')){_0x207f1e[util[_0x2f92('0x16')](_0x2f92('0x32'),'XMD-',_['toUpper'](_0x7aa153))]=_0x256b92[_0x2f92('0x2d')][_0x7aa153];}}}}return _0x207f1e;};exports[_0x2f92('0x33')]=function(_0x556ff7){var _0x18ad9d={};for(var _0xa86c8 in _0x556ff7){if(_0x556ff7[_0x2f92('0x2e')](_0xa86c8)){_0x18ad9d[util['format']('%s',_[_0x2f92('0x34')](_0xa86c8))]=_0x556ff7[_0xa86c8];}}return{'variables':_0x18ad9d};};exports[_0x2f92('0x35')]=function(_0x3807ce,_0x2f3486){if(!_['isNil'](_0x3807ce)){if(_0x3807ce[_0x2f92('0x2e')](_0x2f92('0x36'))){if(_0x3807ce['originated']>0x0){_0x3807ce['originated']-=0x1;}else{logger[_0x2f92('0xb')](_0x2f92('0x37'),_0x2f3486);}}}else{logger[_0x2f92('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2f3486);}};exports['logBlacklist']=function(_0x21bf19){var _0xec03ea=moment()[_0x2f92('0x16')](_0x2f92('0x38'));_0x21bf19[_0x2f92('0x39')]=0xd;_0x21bf19[_0x2f92('0x3a')]=_0x2f92('0x3b');_0x21bf19[_0x2f92('0x3c')]=_0xec03ea;_0x21bf19[_0x2f92('0x3d')]=_0xec03ea;_0x21bf19[_0x2f92('0x3e')]=_0xec03ea;};exports[_0x2f92('0x3f')]=function(_0x27b28c,_0x50740c,_0x1caaa6){var _0x3f8154=moment()['format'](_0x2f92('0x38'));_0x27b28c['state']=_0x50740c;_0x27b28c['statedesc']=_0x1caaa6;_0x27b28c[_0x2f92('0x3d')]=_0x3f8154;_0x27b28c[_0x2f92('0x40')]=getSeconds(_0x27b28c[_0x2f92('0x3d')],_0x27b28c[_0x2f92('0x3c')]);};exports[_0x2f92('0x41')]=function(_0x24f01d,_0xa3d52a,_0x182002){_0x24f01d['membername']=_0xa3d52a;_0x24f01d[_0x2f92('0x42')]=_0x182002;};exports[_0x2f92('0x43')]=function(_0xf5ff90,_0x39dd10,_0x3ebda3){var _0x133e0c=moment()[_0x2f92('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0xf5ff90[_0x2f92('0x39')]=_0x39dd10;_0xf5ff90[_0x2f92('0x3a')]=_0x3ebda3;_0xf5ff90[_0x2f92('0x3d')]=_0xf5ff90['responsetime']?_0xf5ff90[_0x2f92('0x3d')]:_0x133e0c;_0xf5ff90[_0x2f92('0x3e')]=_0xf5ff90[_0x2f92('0x3e')]?_0xf5ff90[_0x2f92('0x3e')]:_0x133e0c;_0xf5ff90['ringtime']=getSeconds(_0xf5ff90[_0x2f92('0x3d')]||0x0,_0xf5ff90[_0x2f92('0x3c')]||0x0);_0xf5ff90[_0x2f92('0x44')]=_0xf5ff90[_0x2f92('0x45')]?getSeconds(_0xf5ff90[_0x2f92('0x3e')],_0xf5ff90[_0x2f92('0x45')]):0x0;};exports[_0x2f92('0x46')]=function(_0x40c406){return _0x40c406===_0x2f92('0x47');};exports[_0x2f92('0x48')]=function(_0x2274f5,_0x28bbdd,_0x47dc8a,_0x32ef5c,_0x9481f7){var _0x3abf04=_0x32ef5c?_0x2f92('0x49'):_0x2274f5[_0x2f92('0x4a')];_0x3abf04=_0x9481f7?_0x2f92('0x4b'):_0x3abf04;return{'actionid':_0x2274f5[_0x2f92('0x4c')],'action':_0x2f92('0x4d'),'channel':_0x2274f5[_0x2f92('0x4e')],'callerid':util[_0x2f92('0x16')]('\x22%s\x22\x20<%s>',_0x3abf04,_0x2274f5[_0x2f92('0x1c')]),'Exten':_0x2f92('0x2a'),'Context':_0x2f92('0x4f'),'Priority':'1','variable':_0x47dc8a,'timeout':(_0x28bbdd['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2274f5[_0x2f92('0x4c')]};};exports[_0x2f92('0x50')]=function(_0xa12ef0){return _0xa12ef0['countbusyretry']+_0xa12ef0['countcongestionretry']+_0xa12ef0[_0x2f92('0x51')]+_0xa12ef0['countagentrejectretry']+_0xa12ef0[_0x2f92('0x52')];};exports['cloneAction']=function(_0x33fcf7){var _0x5eb083=_[_0x2f92('0x53')](_0x33fcf7);_0x5eb083['state']=0xf;_0x5eb083[_0x2f92('0x3a')]=_0x2f92('0x54');return _0x5eb083;};exports['scheduledAt']=function(_0x3b693e,_0x281407,_0x575bbb){var _0x5d8b8f={};_0x5d8b8f[_0x281407]=_0x3b693e[_0x281407];_0x5d8b8f['active']=![];_0x5d8b8f['scheduledat']=moment()['add'](_0x575bbb,_0x2f92('0x55'))[_0x2f92('0x16')](_0x2f92('0x38'));_0x5d8b8f[_0x2f92('0x1d')]=_0x3b693e['ContactId'];_0x5d8b8f[_0x2f92('0x56')]=_0x3b693e[_0x2f92('0x56')];_0x5d8b8f[_0x2f92('0x1f')]=_0x3b693e[_0x2f92('0x1f')]||undefined;return _0x5d8b8f;};exports[_0x2f92('0x57')]=function(_0x5aaba3,_0x27f15c){if(!_[_0x2f92('0x19')](_0x5aaba3)){if(_0x5aaba3['pTalking']>0x0){_0x5aaba3[_0x2f92('0x58')]-=0x1;}else{logger[_0x2f92('0xb')](_0x27f15c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2f92('0xb')](_0x27f15c,_0x2f92('0x59'));}};exports[_0x2f92('0x5a')]=function(_0x7b52d0){if(_0x7b52d0<=0x0){return!![];}return![];};exports[_0x2f92('0x5b')]=function(_0x46f280,_0x5549aa,_0x7f0133){_0x46f280[_0x2f92('0x5c')]=_0x5549aa;_0x46f280[_0x2f92('0x1b')]=_0x46f280[_0x2f92('0x5d')];_0x46f280[_0x2f92('0x5e')]=_0x46f280[_0x2f92('0x4e')];_0x46f280['motionChannel']=_0x2f92('0x5f');if(_0x7f0133){_0x46f280[_0x2f92('0x60')]=_0x7f0133[_0x2f92('0x60')];}return _0x46f280;};exports[_0x2f92('0x61')]=function(_0x350545){var _0x5a89ed={};_0x5a89ed[_0x2f92('0x5d')]=_0x350545['queue'];_0x5a89ed['interface']=_0x350545[_0x2f92('0x4e')];_0x5a89ed[_0x2f92('0x4c')]=_0x350545[_0x2f92('0x4c')];return _0x5a89ed;};exports[_0x2f92('0x62')]=function(_0x5612e1){var _0x5591e5=[];for(var _0x32b640 in _0x5612e1){if(_0x5612e1[_0x2f92('0x2e')](_0x32b640)){if(!_[_0x2f92('0x19')](_0x5612e1[_0x32b640])&&_0x5612e1[_0x32b640][_0x2f92('0x39')]===_0x2f92('0x63')&&_0x5612e1[_0x32b640]['status']===_0x2f92('0x64')){_0x5591e5[_0x2f92('0x65')](_0x5612e1[_0x32b640]['id']);}}}return _0x5591e5;};exports[_0x2f92('0x66')]=function(_0x2dcf65){var _0x38c7a7=moment()[_0x2f92('0x7')](0x0);var _0x18cca6=moment(_0x2dcf65)[_0x2f92('0x7')](0x0);return _0x38c7a7['diff'](_0x18cca6,_0x2f92('0x9'));};exports['createBody']=function(_0x115fef){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x115fef[_0x2f92('0x1d')],'ListId':_0x115fef[_0x2f92('0x56')],'VoiceQueueId':_0x115fef[_0x2f92('0x1f')]||undefined,'CampaignId':_0x115fef[_0x2f92('0x67')]||undefined};};exports[_0x2f92('0x68')]=function(_0x4d602e){if(_0x4d602e===_0x2f92('0x4c')||_0x4d602e===_0x2f92('0x69')||_0x4d602e===_0x2f92('0x5d')||_0x4d602e==='type'||_0x4d602e===_0x2f92('0x6a')||_0x4d602e===_0x2f92('0x6b')||_0x4d602e===_0x2f92('0x6c')||_0x4d602e==='channelAgent'||_0x4d602e===_0x2f92('0x4a')||_0x4d602e==='active'||_0x4d602e==='calleridnum'||_0x4d602e===_0x2f92('0x6d')||_0x4d602e===_0x2f92('0x6e')||_0x4d602e===_0x2f92('0x6f')||_0x4d602e===_0x2f92('0x51')||_0x4d602e==='countglobal'||_0x4d602e===_0x2f92('0x70')||_0x4d602e===_0x2f92('0x71')||_0x4d602e===_0x2f92('0x72')||_0x4d602e===_0x2f92('0x73')||_0x4d602e===_0x2f92('0x1d')||_0x4d602e===_0x2f92('0x56')||_0x4d602e===_0x2f92('0x42')||_0x4d602e==='VoiceQueueId'||_0x4d602e==='sipcallid'||_0x4d602e==='xmd-voicequeueid'||_0x4d602e==='xmd-queue'||_0x4d602e===_0x2f92('0x74')||_0x4d602e===_0x2f92('0x75')||_0x4d602e===_0x2f92('0x76')||_0x4d602e===_0x2f92('0x77')||_0x4d602e===_0x2f92('0x78')||_0x4d602e===_0x2f92('0x79')||_0x4d602e==='xmd-dialchannel'||_0x4d602e===_0x2f92('0x7a')||_0x4d602e===_0x2f92('0x7b')||_0x4d602e===_0x2f92('0x7c')||_0x4d602e==='xmd-agiafter'||_0x4d602e===_0x2f92('0x7d')||_0x4d602e===_0x2f92('0x7e')||_0x4d602e===_0x2f92('0x7f')||_0x4d602e===_0x2f92('0x80')||_0x4d602e==='rtpaudioqosjitterbridged'||_0x4d602e==='rtpaudioqosloss'||_0x4d602e==='rtpaudioqoslossbridged'||_0x4d602e===_0x2f92('0x81')||_0x4d602e===_0x2f92('0x82')||_0x4d602e==='rtpaudioqos'||_0x4d602e===_0x2f92('0x7f')||_0x4d602e===_0x2f92('0x80')||_0x4d602e==='rtpaudioqosjitterbridged'||_0x4d602e===_0x2f92('0x83')||_0x4d602e===_0x2f92('0x84')||_0x4d602e==='rtpaudioqosrtt'||_0x4d602e===_0x2f92('0x82')||_0x4d602e===_0x2f92('0x85')||_0x4d602e===_0x2f92('0x86')||_0x4d602e===_0x2f92('0x39')||_0x4d602e==='statedesc'){return![];}return!![];};exports[_0x2f92('0x87')]=function(_0x59beac,_0x3e147a){var _0x159cad,_0xe8a9bf,_0x57f837;if(_0x3e147a<=0x0){_0x3e147a=0x1;}_0x159cad=new RegExp(_0x2f92('0x88')+_0x3e147a+'}$');_0xe8a9bf=Math[_0x2f92('0x89')](0xa,_0x3e147a-0x1);_0x57f837=Math[_0x2f92('0x89')](0xa,_0x3e147a)-0x1;return util[_0x2f92('0x16')]('%s',_[_0x2f92('0x8a')](_0x59beac,_0x159cad,_[_0x2f92('0x8b')](_0xe8a9bf,_0x57f837)));};exports['extractCalleridName']=function(_0x288a3f){var _0x2deab5=_0x288a3f['match'](/"(.*?)"/);return _0x2deab5?_0x2deab5[0x1]:_0x288a3f;};exports[_0x2f92('0x8c')]=function(_0x8620e9){var _0x1feb21=_0x8620e9['match'](/<(.*?)>/);return _0x1feb21?_0x1feb21[0x1]:_0x8620e9;};
\ No newline at end of file
+var _0x61ab=['NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','Contact','hasOwnProperty','tags','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','add','minutes','ListId','pTalking','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','reachable','push','getDiff','milliseconds','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','lodash','moment','preview','env','127.0.0.1','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x61ab,0x1db));var _0xb61a=function(_0xbbe973,_0x481cbb){_0xbbe973=_0xbbe973-0x0;var _0x13b770=_0x61ab[_0xbbe973];return _0x13b770;};'use strict';var util=require('util');var _=require(_0xb61a('0x0'));var moment=require(_0xb61a('0x1'));var logger=require('../../../../config/logger')(_0xb61a('0x2'));var ipAgi=process[_0xb61a('0x3')]['XCALLY_IP_AGI']||_0xb61a('0x4');function getSeconds(_0x4661f2,_0x20056e){var _0x514374=moment(_0x4661f2)['milliseconds'](0x0);var _0x334edb=moment(_0x20056e)['milliseconds'](0x0);return _0x514374[_0xb61a('0x5')](_0x334edb,_0xb61a('0x6'));}exports[_0xb61a('0x7')]=function(_0x3a78ef){return function(_0x174a1a){logger[_0xb61a('0x8')](_0x3a78ef,util[_0xb61a('0x9')](_0x174a1a,{'showHidden':![],'depth':null}));};};exports[_0xb61a('0xa')]=function(_0x8a6d41,_0x5a7733){logger[_0xb61a('0xb')](_0x8a6d41,util[_0xb61a('0x9')](_0x5a7733,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3ad300,_0x15fb06){logger[_0xb61a('0x8')](_0x3ad300,util[_0xb61a('0x9')](_0x15fb06,{'showHidden':![],'depth':null}));};exports[_0xb61a('0xc')]=function(_0x52fa5d){return function(_0x2c835e){logger[_0xb61a('0xb')](_0x52fa5d,util[_0xb61a('0x9')](_0x2c835e,{'showHidden':![],'depth':null}));};};exports[_0xb61a('0xd')]=function(_0x59c8b5,_0x5bf234,_0x24b37e){return{'message':_0x59c8b5,'unlock':_0x5bf234,'active':_0x24b37e};};exports[_0xb61a('0xe')]=function(_0x3f0b9e,_0x2bd8e9,_0x49441f){if(!_['isUndefined'](_0x49441f)&&'string'===typeof _0x49441f&&!_[_0xb61a('0xf')](_0x49441f)){if(!_[_0xb61a('0x10')](_0x2bd8e9)&&_0xb61a('0x11')===typeof _0x2bd8e9&&!_['isEmpty'](_0x2bd8e9)){return util[_0xb61a('0x12')]('\x22%s\x22\x20<%s>',_0x2bd8e9,_0x49441f);}return util[_0xb61a('0x12')](_0xb61a('0x13'),_0x49441f,_0x49441f);}if(!_[_0xb61a('0x10')](_0x3f0b9e)&&'string'===typeof _0x3f0b9e&&!_[_0xb61a('0xf')](_0x3f0b9e)){return _0x3f0b9e;}return _0xb61a('0x14');};exports['isActive']=function(_0xe260d6){if(_[_0xb61a('0x15')](_0xe260d6)){return![];}return _0xe260d6;};exports['addVariables']=function(_0xc26cbe,_0x4f33f8,_0x37efec,_0x30adc3,_0x120dd1,_0x41a7de){var _0x59fa7b={'XMD-QUEUE':_0x4f33f8[_0xb61a('0x16')]?_0x4f33f8[_0xb61a('0x16')][_0xb61a('0x17')]:'','XMD-CALLERID':_0x30adc3,'XMD-CALLERID-PREVIEW':_0x41a7de?util[_0xb61a('0x12')](_0xb61a('0x13'),_0x41a7de[_0xb61a('0x18')],_0x41a7de[_0xb61a('0x19')]):_0x30adc3,'XMD-DIALID':_0x120dd1,'XMD-CONTACTID':_0x4f33f8[_0xb61a('0x1a')],'XMD-CDRTYPE':_0xb61a('0x1b'),'CALLERID(all)':_0x30adc3,'XMD-VOICEQUEUEID':_0x4f33f8[_0xb61a('0x1c')],'XMD-DIALCHANNEL':_0x37efec,'XMD-DIALTIMEOUT':_0xc26cbe[_0xb61a('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xb61a('0x12')]('\x22rtTxX%s%s\x22',_0xc26cbe[_0xb61a('0x1e')]?'g':'',_[_0xb61a('0xf')](_0xc26cbe['monitor_format'])?'':_0xb61a('0x1f')),'XMD-DIALURL':_0xc26cbe[_0xb61a('0x20')]||'','XMD-AGI':_0xc26cbe['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0xc26cbe['dialQueueProject']):_0xb61a('0x21'),'XMD-AGIAFTER':_0xc26cbe[_0xb61a('0x1e')]?util[_0xb61a('0x12')](_0xb61a('0x22'),ipAgi,_0xc26cbe['dialQueueProject2']):_0xb61a('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x41a7de?_0x41a7de[_0xb61a('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x41a7de?_0x41a7de[_0xb61a('0x24')]:'','XMD-DESTINATION':_0xb61a('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xb61a('0xf')](_0xc26cbe[_0xb61a('0x26')])){_0x59fa7b[util[_0xb61a('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0xc26cbe[_0xb61a('0x26')];_0x59fa7b[util[_0xb61a('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x120dd1;}if(_0x4f33f8&&_0x4f33f8[_0xb61a('0x27')]){for(var _0x37f274 in _0x4f33f8['Contact']){if(_0x4f33f8['Contact'][_0xb61a('0x28')](_0x37f274)){if(!_[_0xb61a('0x15')](_0x4f33f8[_0xb61a('0x27')][_0x37f274])&&_0x37f274!=='id'&&_0x37f274!==_0xb61a('0x29')&&_0x37f274!=='createdAt'&&_0x37f274!=='updatedAt'){_0x59fa7b[util[_0xb61a('0x12')]('%s%s','XMD-',_['toUpper'](_0x37f274))]=_0x4f33f8['Contact'][_0x37f274];}}}}return _0x59fa7b;};exports[_0xb61a('0x2a')]=function(_0x22cdf2){var _0x849121={};for(var _0x1d24b4 in _0x22cdf2){if(_0x22cdf2[_0xb61a('0x28')](_0x1d24b4)){_0x849121[util[_0xb61a('0x12')]('%s',_[_0xb61a('0x2b')](_0x1d24b4))]=_0x22cdf2[_0x1d24b4];}}return{'variables':_0x849121};};exports['updateOriginated']=function(_0xdb1c35,_0x4c6281){if(!_[_0xb61a('0x15')](_0xdb1c35)){if(_0xdb1c35[_0xb61a('0x28')](_0xb61a('0x2c'))){if(_0xdb1c35['originated']>0x0){_0xdb1c35[_0xb61a('0x2c')]-=0x1;}else{logger[_0xb61a('0x8')](_0xb61a('0x2d'),_0x4c6281);}}}else{logger['error'](_0xb61a('0x2e'),_0x4c6281);}};exports['logBlacklist']=function(_0x581f92){var _0x45d662=moment()[_0xb61a('0x12')](_0xb61a('0x2f'));_0x581f92[_0xb61a('0x30')]=0xd;_0x581f92[_0xb61a('0x31')]=_0xb61a('0x32');_0x581f92[_0xb61a('0x33')]=_0x45d662;_0x581f92['responsetime']=_0x45d662;_0x581f92[_0xb61a('0x34')]=_0x45d662;};exports[_0xb61a('0x35')]=function(_0x2759b9,_0x10d4fe,_0x14e9d8){var _0x348ac1=moment()[_0xb61a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2759b9[_0xb61a('0x30')]=_0x10d4fe;_0x2759b9['statedesc']=_0x14e9d8;_0x2759b9['responsetime']=_0x348ac1;_0x2759b9['ringtime']=getSeconds(_0x2759b9[_0xb61a('0x36')],_0x2759b9[_0xb61a('0x33')]);};exports['logLookAgent']=function(_0x5280b4,_0x44f883,_0x43a4e7){_0x5280b4['membername']=_0x44f883;_0x5280b4[_0xb61a('0x37')]=_0x43a4e7;};exports[_0xb61a('0x38')]=function(_0x49d82c,_0x5eaa68,_0x546e09){var _0x303de4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x49d82c[_0xb61a('0x30')]=_0x5eaa68;_0x49d82c[_0xb61a('0x31')]=_0x546e09;_0x49d82c[_0xb61a('0x36')]=_0x49d82c[_0xb61a('0x36')]?_0x49d82c[_0xb61a('0x36')]:_0x303de4;_0x49d82c[_0xb61a('0x34')]=_0x49d82c[_0xb61a('0x34')]?_0x49d82c[_0xb61a('0x34')]:_0x303de4;_0x49d82c[_0xb61a('0x39')]=getSeconds(_0x49d82c[_0xb61a('0x36')]||0x0,_0x49d82c[_0xb61a('0x33')]||0x0);_0x49d82c[_0xb61a('0x3a')]=_0x49d82c[_0xb61a('0x3b')]?getSeconds(_0x49d82c[_0xb61a('0x34')],_0x49d82c[_0xb61a('0x3b')]):0x0;};exports[_0xb61a('0x3c')]=function(_0x5b0a81){return _0x5b0a81===_0xb61a('0x3d');};exports['variablesAction']=function(_0x328598,_0x431164,_0x365b37,_0x176eac,_0x461aa2){var _0x472f1b=_0x176eac?_0xb61a('0x3e'):_0x328598[_0xb61a('0x18')];_0x472f1b=_0x461aa2?_0xb61a('0x3f'):_0x472f1b;return{'actionid':_0x328598[_0xb61a('0x40')],'action':_0xb61a('0x41'),'channel':_0x328598[_0xb61a('0x42')],'callerid':util[_0xb61a('0x12')](_0xb61a('0x13'),_0x472f1b,_0x328598[_0xb61a('0x19')]),'Exten':_0xb61a('0x25'),'Context':_0xb61a('0x43'),'Priority':'1','variable':_0x365b37,'timeout':(_0x431164[_0xb61a('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x328598[_0xb61a('0x40')]};};exports['totalGlobal']=function(_0x1e32b4){return _0x1e32b4[_0xb61a('0x45')]+_0x1e32b4[_0xb61a('0x46')]+_0x1e32b4[_0xb61a('0x47')]+_0x1e32b4[_0xb61a('0x48')]+_0x1e32b4[_0xb61a('0x49')];};exports['cloneAction']=function(_0x1cbcee){var _0x160a09=_['clone'](_0x1cbcee);_0x160a09[_0xb61a('0x30')]=0xf;_0x160a09[_0xb61a('0x31')]=_0xb61a('0x4a');return _0x160a09;};exports[_0xb61a('0x4b')]=function(_0x54baa4,_0x7d567d,_0x354b2d){var _0x53ffb3={};_0x53ffb3[_0x7d567d]=_0x54baa4[_0x7d567d];_0x53ffb3[_0xb61a('0x4c')]=![];_0x53ffb3['scheduledat']=moment()[_0xb61a('0x4d')](_0x354b2d,_0xb61a('0x4e'))[_0xb61a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x53ffb3[_0xb61a('0x1a')]=_0x54baa4[_0xb61a('0x1a')];_0x53ffb3[_0xb61a('0x4f')]=_0x54baa4[_0xb61a('0x4f')];_0x53ffb3[_0xb61a('0x1c')]=_0x54baa4[_0xb61a('0x1c')]||undefined;return _0x53ffb3;};exports['decrementTalkink']=function(_0x341054,_0x28c937){if(!_[_0xb61a('0x15')](_0x341054)){if(_0x341054[_0xb61a('0x50')]>0x0){_0x341054[_0xb61a('0x50')]-=0x1;}else{logger['error'](_0x28c937,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb61a('0x8')](_0x28c937,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5bbcc5){if(_0x5bbcc5<=0x0){return!![];}return![];};exports[_0xb61a('0x51')]=function(_0x115565,_0x41ddad,_0xd8e473){_0x115565[_0xb61a('0x52')]=_0x41ddad;_0x115565[_0xb61a('0x17')]=_0x115565[_0xb61a('0x53')];_0x115565['interface']=_0x115565['channelAgent'];_0x115565[_0xb61a('0x54')]=_0xb61a('0x55');if(_0xd8e473){_0x115565[_0xb61a('0x56')]=_0xd8e473[_0xb61a('0x56')];}return _0x115565;};exports['buildAcw']=function(_0x202c49){var _0x209c51={};_0x209c51[_0xb61a('0x53')]=_0x202c49[_0xb61a('0x53')];_0x209c51['interface']=_0x202c49['channelAgent'];_0x209c51[_0xb61a('0x40')]=_0x202c49[_0xb61a('0x40')];return _0x209c51;};exports['agentReadyId']=function(_0x3d5a00){var _0x383fd9=[];for(var _0x12102e in _0x3d5a00){if(_0x3d5a00[_0xb61a('0x28')](_0x12102e)){if(!_['isNil'](_0x3d5a00[_0x12102e])&&_0x3d5a00[_0x12102e][_0xb61a('0x30')]==='not_inuse'&&_0x3d5a00[_0x12102e]['status']===_0xb61a('0x57')){_0x383fd9[_0xb61a('0x58')](_0x3d5a00[_0x12102e]['id']);}}}return _0x383fd9;};exports[_0xb61a('0x59')]=function(_0x2e8415){var _0x5cc433=moment()[_0xb61a('0x5a')](0x0);var _0xbe4fbb=moment(_0x2e8415)['milliseconds'](0x0);return _0x5cc433['diff'](_0xbe4fbb,_0xb61a('0x6'));};exports['createBody']=function(_0x32672f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x32672f[_0xb61a('0x1a')],'ListId':_0x32672f[_0xb61a('0x4f')],'VoiceQueueId':_0x32672f['VoiceQueueId']||undefined,'CampaignId':_0x32672f[_0xb61a('0x5b')]||undefined};};exports[_0xb61a('0x5c')]=function(_0x288969){if(_0x288969==='uniqueid'||_0x288969==='idContact'||_0x288969==='queue'||_0x288969===_0xb61a('0x5d')||_0x288969===_0xb61a('0x5e')||_0x288969===_0xb61a('0x5f')||_0x288969===_0xb61a('0x60')||_0x288969==='channelAgent'||_0x288969==='calleridname'||_0x288969===_0xb61a('0x4c')||_0x288969==='calleridnum'||_0x288969==='scheduledat'||_0x288969===_0xb61a('0x45')||_0x288969===_0xb61a('0x46')||_0x288969===_0xb61a('0x47')||_0x288969==='countglobal'||_0x288969==='callback'||_0x288969===_0xb61a('0x61')||_0x288969===_0xb61a('0x62')||_0x288969===_0xb61a('0x63')||_0x288969===_0xb61a('0x1a')||_0x288969===_0xb61a('0x4f')||_0x288969===_0xb61a('0x37')||_0x288969===_0xb61a('0x1c')||_0x288969===_0xb61a('0x64')||_0x288969===_0xb61a('0x65')||_0x288969===_0xb61a('0x66')||_0x288969===_0xb61a('0x67')||_0x288969===_0xb61a('0x68')||_0x288969===_0xb61a('0x69')||_0x288969===_0xb61a('0x6a')||_0x288969===_0xb61a('0x6b')||_0x288969===_0xb61a('0x6c')||_0x288969===_0xb61a('0x6d')||_0x288969===_0xb61a('0x6e')||_0x288969==='xmd-cdrtype'||_0x288969===_0xb61a('0x6f')||_0x288969===_0xb61a('0x70')||_0x288969==='xmd-agi'||_0x288969==='rtpaudioqos'||_0x288969===_0xb61a('0x71')||_0x288969===_0xb61a('0x72')||_0x288969===_0xb61a('0x73')||_0x288969===_0xb61a('0x74')||_0x288969===_0xb61a('0x75')||_0x288969===_0xb61a('0x76')||_0x288969==='rtpaudioqosrttbridged'||_0x288969===_0xb61a('0x77')||_0x288969===_0xb61a('0x71')||_0x288969===_0xb61a('0x72')||_0x288969==='rtpaudioqosjitterbridged'||_0x288969===_0xb61a('0x74')||_0x288969===_0xb61a('0x75')||_0x288969==='rtpaudioqosrtt'||_0x288969===_0xb61a('0x78')||_0x288969===_0xb61a('0x79')||_0x288969===_0xb61a('0x7a')||_0x288969==='state'||_0x288969===_0xb61a('0x31')){return![];}return!![];};exports[_0xb61a('0x7b')]=function(_0x427403,_0x2a7f2c){var _0x33f1bf,_0x3e4cc3,_0x2907ed;if(_0x2a7f2c<=0x0){_0x2a7f2c=0x1;}_0x33f1bf=new RegExp('\x5cw{0,'+_0x2a7f2c+'}$');_0x3e4cc3=Math[_0xb61a('0x7c')](0xa,_0x2a7f2c-0x1);_0x2907ed=Math['pow'](0xa,_0x2a7f2c)-0x1;return util[_0xb61a('0x12')]('%s',_['replace'](_0x427403,_0x33f1bf,_[_0xb61a('0x7d')](_0x3e4cc3,_0x2907ed)));};exports[_0xb61a('0x7e')]=function(_0x276512){var _0x1681fc=_0x276512['match'](/"(.*?)"/);return _0x1681fc?_0x1681fc[0x1]:_0x276512;};exports['extractCalleridNumber']=function(_0x51c0c9){var _0x2df697=_0x51c0c9['match'](/<(.*?)>/);return _0x2df697?_0x2df697[0x1]:_0x51c0c9;};
\ No newline at end of file