Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / services / ami / preview / util / util.js
index 22f2575..2f5ffc2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb8a0=['CampaignId','filterKey','idContact','type','campaigntype','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','moment','../../../../config/logger','env','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','format','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','buildAcw','queue','agentReadyId','not_inuse','push','getDiff'];(function(_0x204203,_0x56a1e6){var _0x595216=function(_0x57f483){while(--_0x57f483){_0x204203['push'](_0x204203['shift']());}};_0x595216(++_0x56a1e6);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x331cd2,_0x1dd937){_0x331cd2=_0x331cd2-0x0;var _0x5cc3ce=_0xb8a0[_0x331cd2];return _0x5cc3ce;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x0b8a('0x0'));var logger=require(_0x0b8a('0x1'))('preview');var ipAgi=process[_0x0b8a('0x2')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x4e1fbc,_0x512cef){var _0x1b594f=moment(_0x4e1fbc)[_0x0b8a('0x3')](0x0);var _0x381b17=moment(_0x512cef)[_0x0b8a('0x3')](0x0);return _0x1b594f[_0x0b8a('0x4')](_0x381b17,_0x0b8a('0x5'));}exports[_0x0b8a('0x6')]=function(_0x463015){return function(_0x29ebdc){logger[_0x0b8a('0x7')](_0x463015,util[_0x0b8a('0x8')](_0x29ebdc,{'showHidden':![],'depth':null}));};};exports[_0x0b8a('0x9')]=function(_0x35bf76,_0x14d7fd){logger[_0x0b8a('0xa')](_0x35bf76,util[_0x0b8a('0x8')](_0x14d7fd,{'showHidden':![],'depth':null}));};exports[_0x0b8a('0xb')]=function(_0x1c4fcd,_0x808fb9){logger[_0x0b8a('0x7')](_0x1c4fcd,util[_0x0b8a('0x8')](_0x808fb9,{'showHidden':![],'depth':null}));};exports[_0x0b8a('0xc')]=function(_0x4d0812){return function(_0x43aaa3){logger[_0x0b8a('0xa')](_0x4d0812,util[_0x0b8a('0x8')](_0x43aaa3,{'showHidden':![],'depth':null}));};};exports[_0x0b8a('0xd')]=function(_0x136704,_0x207322,_0x12838b){return{'message':_0x136704,'unlock':_0x207322,'active':_0x12838b};};exports[_0x0b8a('0xe')]=function(_0x1313d1,_0x5c32aa,_0x178439){if(!_[_0x0b8a('0xf')](_0x178439)&&_0x0b8a('0x10')===typeof _0x178439&&!_['isEmpty'](_0x178439)){if(!_[_0x0b8a('0xf')](_0x5c32aa)&&_0x0b8a('0x10')===typeof _0x5c32aa&&!_[_0x0b8a('0x11')](_0x5c32aa)){return util['format']('\x22%s\x22\x20<%s>',_0x5c32aa,_0x178439);}return util['format'](_0x0b8a('0x12'),_0x178439,_0x178439);}if(!_['isUndefined'](_0x1313d1)&&_0x0b8a('0x10')===typeof _0x1313d1&&!_[_0x0b8a('0x11')](_0x1313d1)){return _0x1313d1;}return _0x0b8a('0x13');};exports[_0x0b8a('0x14')]=function(_0x3862bc){if(_[_0x0b8a('0x15')](_0x3862bc)){return![];}return _0x3862bc;};exports[_0x0b8a('0x16')]=function(_0x13182e,_0x442bb9,_0x1b6c31,_0x313612,_0x568e89,_0x57285b){var _0x2d3b49={'XMD-QUEUE':_0x442bb9['Queue']?_0x442bb9[_0x0b8a('0x17')][_0x0b8a('0x18')]:'','XMD-CALLERID':_0x313612,'XMD-CALLERID-PREVIEW':_0x57285b?util[_0x0b8a('0x19')](_0x0b8a('0x12'),_0x57285b['calleridname'],_0x57285b[_0x0b8a('0x1a')]):_0x313612,'XMD-DIALID':_0x568e89,'XMD-CONTACTID':_0x442bb9['ContactId'],'XMD-CDRTYPE':_0x0b8a('0x1b'),'CALLERID(all)':_0x313612,'XMD-VOICEQUEUEID':_0x442bb9[_0x0b8a('0x1c')],'XMD-DIALCHANNEL':_0x1b6c31,'XMD-DIALTIMEOUT':_0x13182e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x0b8a('0x19')](_0x0b8a('0x1d'),_0x13182e[_0x0b8a('0x1e')]?'g':'',_['isEmpty'](_0x13182e[_0x0b8a('0x1f')])?'':_0x0b8a('0x20')),'XMD-DIALURL':_0x13182e[_0x0b8a('0x21')]||'','XMD-AGI':_0x13182e['dialQueueProject']?util[_0x0b8a('0x19')]('\x22agi://%s/square,%s\x22',ipAgi,_0x13182e[_0x0b8a('0x22')]):_0x0b8a('0x23'),'XMD-AGIAFTER':_0x13182e[_0x0b8a('0x1e')]?util[_0x0b8a('0x19')](_0x0b8a('0x24'),ipAgi,_0x13182e[_0x0b8a('0x1e')]):_0x0b8a('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x57285b?_0x57285b[_0x0b8a('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x57285b?_0x57285b[_0x0b8a('0x26')]:'','XMD-DESTINATION':_0x0b8a('0x27')};if(!_[_0x0b8a('0x11')](_0x13182e[_0x0b8a('0x1f')])){_0x2d3b49[util['format']('%s',_0x0b8a('0x28'))]=_0x13182e[_0x0b8a('0x1f')];_0x2d3b49[util[_0x0b8a('0x19')]('%s',_0x0b8a('0x29'))]=_0x568e89;}if(_0x442bb9&&_0x442bb9[_0x0b8a('0x2a')]){for(var _0x59f54d in _0x442bb9[_0x0b8a('0x2a')]){if(_0x442bb9[_0x0b8a('0x2a')]['hasOwnProperty'](_0x59f54d)){if(!_[_0x0b8a('0x15')](_0x442bb9[_0x0b8a('0x2a')][_0x59f54d])&&_0x59f54d!=='id'&&_0x59f54d!==_0x0b8a('0x2b')&&_0x59f54d!==_0x0b8a('0x2c')&&_0x59f54d!==_0x0b8a('0x2d')){_0x2d3b49[util['format'](_0x0b8a('0x2e'),_0x0b8a('0x2f'),_[_0x0b8a('0x30')](_0x59f54d))]=_0x442bb9[_0x0b8a('0x2a')][_0x59f54d];}}}}return _0x2d3b49;};exports[_0x0b8a('0x31')]=function(_0x5a2fd7){var _0x1bb340={};for(var _0x21cecc in _0x5a2fd7){if(_0x5a2fd7['hasOwnProperty'](_0x21cecc)){_0x1bb340[util[_0x0b8a('0x19')]('%s',_[_0x0b8a('0x32')](_0x21cecc))]=_0x5a2fd7[_0x21cecc];}}return{'variables':_0x1bb340};};exports[_0x0b8a('0x33')]=function(_0x2e0582,_0x4ccb0c){if(!_[_0x0b8a('0x15')](_0x2e0582)){if(_0x2e0582[_0x0b8a('0x34')]('originated')){if(_0x2e0582['originated']>0x0){_0x2e0582[_0x0b8a('0x35')]-=0x1;}else{logger[_0x0b8a('0x7')](_0x0b8a('0x36'),_0x4ccb0c);}}}else{logger[_0x0b8a('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4ccb0c);}};exports[_0x0b8a('0x37')]=function(_0xe94bcc){var _0x208a5f=moment()['format'](_0x0b8a('0x38'));_0xe94bcc[_0x0b8a('0x39')]=0xd;_0xe94bcc[_0x0b8a('0x3a')]=_0x0b8a('0x3b');_0xe94bcc[_0x0b8a('0x3c')]=_0x208a5f;_0xe94bcc[_0x0b8a('0x3d')]=_0x208a5f;_0xe94bcc[_0x0b8a('0x3e')]=_0x208a5f;};exports[_0x0b8a('0x3f')]=function(_0x1a189a,_0x406a1a,_0x53586f){var _0x37635b=moment()[_0x0b8a('0x19')](_0x0b8a('0x38'));_0x1a189a[_0x0b8a('0x39')]=_0x406a1a;_0x1a189a[_0x0b8a('0x3a')]=_0x53586f;_0x1a189a[_0x0b8a('0x3d')]=_0x37635b;_0x1a189a[_0x0b8a('0x40')]=getSeconds(_0x1a189a[_0x0b8a('0x3d')],_0x1a189a['starttime']);};exports[_0x0b8a('0x41')]=function(_0x4a1eeb,_0x26ad24,_0x4cb33f){_0x4a1eeb[_0x0b8a('0x42')]=_0x26ad24;_0x4a1eeb[_0x0b8a('0x43')]=_0x4cb33f;};exports['logCustomer']=function(_0x4c51b4,_0x336f31,_0x49a8e0){var _0x423e1a=moment()[_0x0b8a('0x19')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c51b4[_0x0b8a('0x39')]=_0x336f31;_0x4c51b4[_0x0b8a('0x3a')]=_0x49a8e0;_0x4c51b4[_0x0b8a('0x3d')]=_0x4c51b4['responsetime']?_0x4c51b4[_0x0b8a('0x3d')]:_0x423e1a;_0x4c51b4[_0x0b8a('0x3e')]=_0x4c51b4['endtime']?_0x4c51b4[_0x0b8a('0x3e')]:_0x423e1a;_0x4c51b4['ringtime']=getSeconds(_0x4c51b4[_0x0b8a('0x3d')]||0x0,_0x4c51b4['starttime']||0x0);_0x4c51b4[_0x0b8a('0x44')]=_0x4c51b4[_0x0b8a('0x45')]?getSeconds(_0x4c51b4[_0x0b8a('0x3e')],_0x4c51b4[_0x0b8a('0x45')]):0x0;};exports[_0x0b8a('0x46')]=function(_0x3589ee){return _0x3589ee===_0x0b8a('0x47');};exports[_0x0b8a('0x48')]=function(_0x25cbe2,_0x5d53e1,_0xfa0a21,_0x4909eb,_0x5f0bab){var _0x4dc6bd=_0x4909eb?'RECALL':_0x25cbe2[_0x0b8a('0x49')];_0x4dc6bd=_0x5f0bab?_0x0b8a('0x4a'):_0x4dc6bd;return{'actionid':_0x25cbe2[_0x0b8a('0x4b')],'action':_0x0b8a('0x4c'),'channel':_0x25cbe2[_0x0b8a('0x4d')],'callerid':util[_0x0b8a('0x19')]('\x22%s\x22\x20<%s>',_0x4dc6bd,_0x25cbe2[_0x0b8a('0x1a')]),'Exten':'xcally-motion-preview','Context':_0x0b8a('0x4e'),'Priority':'1','variable':_0xfa0a21,'timeout':(_0x5d53e1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x25cbe2[_0x0b8a('0x4b')]};};exports[_0x0b8a('0x4f')]=function(_0x32f21f){return _0x32f21f[_0x0b8a('0x50')]+_0x32f21f[_0x0b8a('0x51')]+_0x32f21f[_0x0b8a('0x52')]+_0x32f21f['countagentrejectretry']+_0x32f21f[_0x0b8a('0x53')];};exports[_0x0b8a('0x54')]=function(_0x2cda2e){var _0x17d12c=_[_0x0b8a('0x55')](_0x2cda2e);_0x17d12c[_0x0b8a('0x39')]=0xf;_0x17d12c[_0x0b8a('0x3a')]=_0x0b8a('0x56');return _0x17d12c;};exports[_0x0b8a('0x57')]=function(_0x3f9efa,_0x965d93,_0x463526){var _0x53793e={};_0x53793e[_0x965d93]=_0x3f9efa[_0x965d93];_0x53793e[_0x0b8a('0x58')]=![];_0x53793e[_0x0b8a('0x59')]=moment()[_0x0b8a('0x5a')](_0x463526,'minutes')[_0x0b8a('0x19')](_0x0b8a('0x38'));_0x53793e[_0x0b8a('0x5b')]=_0x3f9efa['ContactId'];_0x53793e['ListId']=_0x3f9efa[_0x0b8a('0x5c')];_0x53793e['VoiceQueueId']=_0x3f9efa[_0x0b8a('0x1c')]||undefined;return _0x53793e;};exports[_0x0b8a('0x5d')]=function(_0x29e853,_0x2e9472){if(!_[_0x0b8a('0x15')](_0x29e853)){if(_0x29e853[_0x0b8a('0x5e')]>0x0){_0x29e853['pTalking']-=0x1;}else{logger['error'](_0x2e9472,_0x0b8a('0x5f'));}}else{logger[_0x0b8a('0x7')](_0x2e9472,_0x0b8a('0x60'));}};exports[_0x0b8a('0x61')]=function(_0x5a1452){if(_0x5a1452<=0x0){return!![];}return![];};exports[_0x0b8a('0x62')]=function(_0x45d29f,_0x1e0ae4){_0x45d29f[_0x0b8a('0x63')]=_0x1e0ae4;_0x45d29f[_0x0b8a('0x18')]=_0x45d29f['queue'];_0x45d29f[_0x0b8a('0x64')]=_0x45d29f[_0x0b8a('0x4d')];return _0x45d29f;};exports[_0x0b8a('0x65')]=function(_0x2a06c7){var _0x1844a1={};_0x1844a1[_0x0b8a('0x66')]=_0x2a06c7[_0x0b8a('0x66')];_0x1844a1[_0x0b8a('0x64')]=_0x2a06c7[_0x0b8a('0x4d')];_0x1844a1[_0x0b8a('0x4b')]=_0x2a06c7[_0x0b8a('0x4b')];return _0x1844a1;};exports[_0x0b8a('0x67')]=function(_0x5108b1){var _0x24200b=[];for(var _0x13dd96 in _0x5108b1){if(_0x5108b1['hasOwnProperty'](_0x13dd96)){if(!_[_0x0b8a('0x15')](_0x5108b1[_0x13dd96])&&_0x5108b1[_0x13dd96][_0x0b8a('0x39')]===_0x0b8a('0x68')&&_0x5108b1[_0x13dd96]['status']==='reachable'){_0x24200b[_0x0b8a('0x69')](_0x5108b1[_0x13dd96]['id']);}}}return _0x24200b;};exports[_0x0b8a('0x6a')]=function(_0x206dfb){var _0xc275dd=moment()[_0x0b8a('0x3')](0x0);var _0x3e7293=moment(_0x206dfb)[_0x0b8a('0x3')](0x0);return _0xc275dd[_0x0b8a('0x4')](_0x3e7293,_0x0b8a('0x5'));};exports['createBody']=function(_0x4aee9e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4aee9e[_0x0b8a('0x5b')],'ListId':_0x4aee9e[_0x0b8a('0x5c')],'VoiceQueueId':_0x4aee9e['VoiceQueueId']||undefined,'CampaignId':_0x4aee9e[_0x0b8a('0x6b')]||undefined};};exports[_0x0b8a('0x6c')]=function(_0x153edc){if(_0x153edc===_0x0b8a('0x4b')||_0x153edc===_0x0b8a('0x6d')||_0x153edc==='queue'||_0x153edc===_0x0b8a('0x6e')||_0x153edc===_0x0b8a('0x6f')||_0x153edc==='dialAnswer'||_0x153edc===_0x0b8a('0x42')||_0x153edc===_0x0b8a('0x4d')||_0x153edc===_0x0b8a('0x49')||_0x153edc===_0x0b8a('0x58')||_0x153edc==='calleridnum'||_0x153edc===_0x0b8a('0x59')||_0x153edc==='countbusyretry'||_0x153edc==='countcongestionretry'||_0x153edc===_0x0b8a('0x52')||_0x153edc===_0x0b8a('0x70')||_0x153edc===_0x0b8a('0x71')||_0x153edc===_0x0b8a('0x72')||_0x153edc==='callbackat'||_0x153edc===_0x0b8a('0x73')||_0x153edc===_0x0b8a('0x5b')||_0x153edc===_0x0b8a('0x5c')||_0x153edc==='UserId'||_0x153edc==='VoiceQueueId'||_0x153edc===_0x0b8a('0x74')||_0x153edc===_0x0b8a('0x75')||_0x153edc===_0x0b8a('0x76')||_0x153edc==='xmd-phone'||_0x153edc===_0x0b8a('0x77')||_0x153edc===_0x0b8a('0x78')||_0x153edc===_0x0b8a('0x79')||_0x153edc==='xmd-dialoptions'||_0x153edc===_0x0b8a('0x7a')||_0x153edc===_0x0b8a('0x7b')||_0x153edc===_0x0b8a('0x7c')||_0x153edc===_0x0b8a('0x7d')||_0x153edc==='xmd-callerid'||_0x153edc===_0x0b8a('0x7e')||_0x153edc==='xmd-agi'||_0x153edc===_0x0b8a('0x7f')||_0x153edc===_0x0b8a('0x80')||_0x153edc==='rtpaudioqosjitter'||_0x153edc===_0x0b8a('0x81')||_0x153edc===_0x0b8a('0x82')||_0x153edc===_0x0b8a('0x83')||_0x153edc===_0x0b8a('0x84')||_0x153edc===_0x0b8a('0x85')||_0x153edc===_0x0b8a('0x7f')||_0x153edc===_0x0b8a('0x80')||_0x153edc===_0x0b8a('0x86')||_0x153edc===_0x0b8a('0x81')||_0x153edc===_0x0b8a('0x82')||_0x153edc===_0x0b8a('0x83')||_0x153edc==='rtpaudioqosrtt'||_0x153edc===_0x0b8a('0x85')||_0x153edc===_0x0b8a('0x87')||_0x153edc===_0x0b8a('0x88')||_0x153edc===_0x0b8a('0x39')||_0x153edc==='statedesc'){return![];}return!![];};exports[_0x0b8a('0x89')]=function(_0x115ff9,_0x1a3c85){var _0x348f8a,_0x4b3f6d,_0x1e5bd2;if(_0x1a3c85<=0x0){_0x1a3c85=0x1;}_0x348f8a=new RegExp(_0x0b8a('0x8a')+_0x1a3c85+'}$');_0x4b3f6d=Math[_0x0b8a('0x8b')](0xa,_0x1a3c85-0x1);_0x1e5bd2=Math['pow'](0xa,_0x1a3c85)-0x1;return util[_0x0b8a('0x19')]('%s',_['replace'](_0x115ff9,_0x348f8a,_[_0x0b8a('0x8c')](_0x4b3f6d,_0x1e5bd2)));};exports[_0x0b8a('0x8d')]=function(_0x1e4f19){var _0x4bb6c3=_0x1e4f19[_0x0b8a('0x8e')](/"(.*?)"/);return _0x4bb6c3?_0x4bb6c3[0x1]:_0x1e4f19;};exports[_0x0b8a('0x8f')]=function(_0x5af193){var _0x2332ec=_0x5af193[_0x0b8a('0x8e')](/<(.*?)>/);return _0x2332ec?_0x2332ec[0x1]:_0x5af193;};
\ No newline at end of file
+var _0x6ec6=['%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','not_inuse','reachable','push','ListId','CampaignId','idContact','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','logger','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt'];(function(_0x263aa2,_0x7795b2){var _0x4ed9a1=function(_0x55b340){while(--_0x55b340){_0x263aa2['push'](_0x263aa2['shift']());}};_0x4ed9a1(++_0x7795b2);}(_0x6ec6,0xd5));var _0x66ec=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x6ec6[_0x556bb1];return _0x45455f;};'use strict';var util=require(_0x66ec('0x0'));var _=require(_0x66ec('0x1'));var moment=require('moment');var logger=require(_0x66ec('0x2'))(_0x66ec('0x3'));var ipAgi=process['env'][_0x66ec('0x4')]||_0x66ec('0x5');function getSeconds(_0x9dac14,_0xc4addd){var _0x4d5c68=moment(_0x9dac14)[_0x66ec('0x6')](0x0);var _0x283d7a=moment(_0xc4addd)[_0x66ec('0x6')](0x0);return _0x4d5c68[_0x66ec('0x7')](_0x283d7a,_0x66ec('0x8'));}exports['loggerCatch']=function(_0x438802){return function(_0x15805d){logger[_0x66ec('0x9')](_0x438802,util['inspect'](_0x15805d,{'showHidden':![],'depth':null}));};};exports[_0x66ec('0xa')]=function(_0x35c982,_0x268a4c){logger['info'](_0x35c982,util[_0x66ec('0xb')](_0x268a4c,{'showHidden':![],'depth':null}));};exports[_0x66ec('0xc')]=function(_0x28f1de,_0x2fd5e0){logger[_0x66ec('0x9')](_0x28f1de,util[_0x66ec('0xb')](_0x2fd5e0,{'showHidden':![],'depth':null}));};exports[_0x66ec('0xd')]=function(_0x490d93){return function(_0x3fb48f){logger['info'](_0x490d93,util[_0x66ec('0xb')](_0x3fb48f,{'showHidden':![],'depth':null}));};};exports[_0x66ec('0xe')]=function(_0x26da34,_0x36cf85,_0x56e827){return{'message':_0x26da34,'unlock':_0x36cf85,'active':_0x56e827};};exports[_0x66ec('0xf')]=function(_0x1c8c82,_0x3c91ac,_0x22ac8c){if(!_[_0x66ec('0x10')](_0x22ac8c)&&_0x66ec('0x11')===typeof _0x22ac8c&&!_[_0x66ec('0x12')](_0x22ac8c)){if(!_[_0x66ec('0x10')](_0x3c91ac)&&_0x66ec('0x11')===typeof _0x3c91ac&&!_['isEmpty'](_0x3c91ac)){return util['format'](_0x66ec('0x13'),_0x3c91ac,_0x22ac8c);}return util[_0x66ec('0x14')](_0x66ec('0x13'),_0x22ac8c,_0x22ac8c);}if(!_[_0x66ec('0x10')](_0x1c8c82)&&_0x66ec('0x11')===typeof _0x1c8c82&&!_[_0x66ec('0x12')](_0x1c8c82)){return _0x1c8c82;}return _0x66ec('0x15');};exports[_0x66ec('0x16')]=function(_0x347eac){if(_[_0x66ec('0x17')](_0x347eac)){return![];}return _0x347eac;};exports['addVariables']=function(_0x1f7fbf,_0x134b01,_0xf14ca7,_0x17c3ed,_0x3e57da,_0x2930b2){var _0x1b1bc6={'XMD-QUEUE':_0x134b01['Queue']?_0x134b01['Queue'][_0x66ec('0x18')]:'','XMD-CALLERID':_0x17c3ed,'XMD-CALLERID-PREVIEW':_0x2930b2?util[_0x66ec('0x14')](_0x66ec('0x13'),_0x2930b2[_0x66ec('0x19')],_0x2930b2[_0x66ec('0x1a')]):_0x17c3ed,'XMD-DIALID':_0x3e57da,'XMD-CONTACTID':_0x134b01[_0x66ec('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x17c3ed,'XMD-VOICEQUEUEID':_0x134b01[_0x66ec('0x1c')],'XMD-DIALCHANNEL':_0xf14ca7,'XMD-DIALTIMEOUT':_0x1f7fbf[_0x66ec('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x66ec('0x1e'),_0x1f7fbf[_0x66ec('0x1f')]?'g':'',_['isEmpty'](_0x1f7fbf[_0x66ec('0x20')])?'':_0x66ec('0x21')),'XMD-DIALURL':_0x1f7fbf[_0x66ec('0x22')]||'','XMD-AGI':_0x1f7fbf[_0x66ec('0x23')]?util[_0x66ec('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1f7fbf['dialQueueProject']):_0x66ec('0x24'),'XMD-AGIAFTER':_0x1f7fbf[_0x66ec('0x1f')]?util[_0x66ec('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1f7fbf[_0x66ec('0x1f')]):_0x66ec('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x2930b2?_0x2930b2['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2930b2?_0x2930b2[_0x66ec('0x25')]:'','XMD-DESTINATION':_0x66ec('0x26')};if(!_[_0x66ec('0x12')](_0x1f7fbf['monitor_format'])){_0x1b1bc6[util[_0x66ec('0x14')]('%s',_0x66ec('0x27'))]=_0x1f7fbf[_0x66ec('0x20')];_0x1b1bc6[util[_0x66ec('0x14')]('%s',_0x66ec('0x28'))]=_0x3e57da;}if(_0x134b01&&_0x134b01[_0x66ec('0x29')]){for(var _0x311b1e in _0x134b01[_0x66ec('0x29')]){if(_0x134b01['Contact'][_0x66ec('0x2a')](_0x311b1e)){if(!_[_0x66ec('0x17')](_0x134b01[_0x66ec('0x29')][_0x311b1e])&&_0x311b1e!=='id'&&_0x311b1e!==_0x66ec('0x2b')&&_0x311b1e!==_0x66ec('0x2c')&&_0x311b1e!=='updatedAt'){_0x1b1bc6[util[_0x66ec('0x14')](_0x66ec('0x2d'),_0x66ec('0x2e'),_['toUpper'](_0x311b1e))]=_0x134b01['Contact'][_0x311b1e];}}}}return _0x1b1bc6;};exports[_0x66ec('0x2f')]=function(_0x12c11d){var _0x4cd46e={};for(var _0x3f2640 in _0x12c11d){if(_0x12c11d[_0x66ec('0x2a')](_0x3f2640)){_0x4cd46e[util[_0x66ec('0x14')]('%s',_[_0x66ec('0x30')](_0x3f2640))]=_0x12c11d[_0x3f2640];}}return{'variables':_0x4cd46e};};exports[_0x66ec('0x31')]=function(_0x57f1eb,_0x5044fe){if(!_[_0x66ec('0x17')](_0x57f1eb)){if(_0x57f1eb[_0x66ec('0x2a')](_0x66ec('0x32'))){if(_0x57f1eb[_0x66ec('0x32')]>0x0){_0x57f1eb[_0x66ec('0x32')]-=0x1;}else{logger[_0x66ec('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5044fe);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5044fe);}};exports['logBlacklist']=function(_0x505a85){var _0x4b4bf1=moment()[_0x66ec('0x14')](_0x66ec('0x33'));_0x505a85[_0x66ec('0x34')]=0xd;_0x505a85['statedesc']=_0x66ec('0x35');_0x505a85[_0x66ec('0x36')]=_0x4b4bf1;_0x505a85[_0x66ec('0x37')]=_0x4b4bf1;_0x505a85[_0x66ec('0x38')]=_0x4b4bf1;};exports['logAgent']=function(_0x54ee1e,_0x12c372,_0x39c96c){var _0x4fc1bb=moment()[_0x66ec('0x14')](_0x66ec('0x33'));_0x54ee1e[_0x66ec('0x34')]=_0x12c372;_0x54ee1e[_0x66ec('0x39')]=_0x39c96c;_0x54ee1e[_0x66ec('0x37')]=_0x4fc1bb;_0x54ee1e[_0x66ec('0x3a')]=getSeconds(_0x54ee1e[_0x66ec('0x37')],_0x54ee1e[_0x66ec('0x36')]);};exports[_0x66ec('0x3b')]=function(_0x3274b0,_0x1aee92,_0x58e069){_0x3274b0[_0x66ec('0x3c')]=_0x1aee92;_0x3274b0[_0x66ec('0x3d')]=_0x58e069;};exports[_0x66ec('0x3e')]=function(_0x1ef975,_0x173803,_0x5567db){var _0x388417=moment()[_0x66ec('0x14')](_0x66ec('0x33'));_0x1ef975[_0x66ec('0x34')]=_0x173803;_0x1ef975[_0x66ec('0x39')]=_0x5567db;_0x1ef975[_0x66ec('0x37')]=_0x1ef975[_0x66ec('0x37')]?_0x1ef975[_0x66ec('0x37')]:_0x388417;_0x1ef975['endtime']=_0x1ef975[_0x66ec('0x38')]?_0x1ef975[_0x66ec('0x38')]:_0x388417;_0x1ef975[_0x66ec('0x3a')]=getSeconds(_0x1ef975[_0x66ec('0x37')]||0x0,_0x1ef975[_0x66ec('0x36')]||0x0);_0x1ef975[_0x66ec('0x3f')]=_0x1ef975[_0x66ec('0x40')]?getSeconds(_0x1ef975[_0x66ec('0x38')],_0x1ef975['answertime']):0x0;};exports[_0x66ec('0x41')]=function(_0x396288){return _0x396288===_0x66ec('0x42');};exports[_0x66ec('0x43')]=function(_0x1bc0ea,_0x2b4a0d,_0x39a366,_0x23f1d3,_0x36d3c6){var _0xff4cfd=_0x23f1d3?_0x66ec('0x44'):_0x1bc0ea[_0x66ec('0x19')];_0xff4cfd=_0x36d3c6?_0x66ec('0x45'):_0xff4cfd;return{'actionid':_0x1bc0ea[_0x66ec('0x46')],'action':_0x66ec('0x47'),'channel':_0x1bc0ea['channelAgent'],'callerid':util[_0x66ec('0x14')](_0x66ec('0x13'),_0xff4cfd,_0x1bc0ea[_0x66ec('0x1a')]),'Exten':_0x66ec('0x26'),'Context':_0x66ec('0x48'),'Priority':'1','variable':_0x39a366,'timeout':(_0x2b4a0d[_0x66ec('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1bc0ea['uniqueid']};};exports[_0x66ec('0x4a')]=function(_0x4c0016){return _0x4c0016[_0x66ec('0x4b')]+_0x4c0016[_0x66ec('0x4c')]+_0x4c0016[_0x66ec('0x4d')]+_0x4c0016[_0x66ec('0x4e')]+_0x4c0016[_0x66ec('0x4f')];};exports[_0x66ec('0x50')]=function(_0x375bb8){var _0x356b7e=_['clone'](_0x375bb8);_0x356b7e[_0x66ec('0x34')]=0xf;_0x356b7e[_0x66ec('0x39')]=_0x66ec('0x51');return _0x356b7e;};exports[_0x66ec('0x52')]=function(_0xabed9b,_0x4b05d5,_0x179f59){var _0xf8f982={};_0xf8f982[_0x4b05d5]=_0xabed9b[_0x4b05d5];_0xf8f982[_0x66ec('0x53')]=![];_0xf8f982[_0x66ec('0x54')]=moment()[_0x66ec('0x55')](_0x179f59,_0x66ec('0x56'))[_0x66ec('0x14')](_0x66ec('0x33'));_0xf8f982[_0x66ec('0x1b')]=_0xabed9b[_0x66ec('0x1b')];_0xf8f982['ListId']=_0xabed9b['ListId'];_0xf8f982['VoiceQueueId']=_0xabed9b['VoiceQueueId']||undefined;return _0xf8f982;};exports['decrementTalkink']=function(_0x13ff36,_0x41f0dc){if(!_[_0x66ec('0x17')](_0x13ff36)){if(_0x13ff36[_0x66ec('0x57')]>0x0){_0x13ff36['pTalking']-=0x1;}else{logger['error'](_0x41f0dc,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x66ec('0x9')](_0x41f0dc,_0x66ec('0x58'));}};exports['IsNotLoggedIn']=function(_0x48528b){if(_0x48528b<=0x0){return!![];}return![];};exports[_0x66ec('0x59')]=function(_0x20e380,_0x5cd24a,_0x4f768a){_0x20e380[_0x66ec('0x5a')]=_0x5cd24a;_0x20e380[_0x66ec('0x18')]=_0x20e380[_0x66ec('0x5b')];_0x20e380[_0x66ec('0x5c')]=_0x20e380[_0x66ec('0x5d')];if(_0x4f768a){_0x20e380['mandatoryDisposition']=_0x4f768a[_0x66ec('0x5e')];}return _0x20e380;};exports['buildAcw']=function(_0x23c772){var _0x5878a7={};_0x5878a7[_0x66ec('0x5b')]=_0x23c772[_0x66ec('0x5b')];_0x5878a7[_0x66ec('0x5c')]=_0x23c772[_0x66ec('0x5d')];_0x5878a7['uniqueid']=_0x23c772[_0x66ec('0x46')];return _0x5878a7;};exports['agentReadyId']=function(_0x17fba5){var _0x3b76d7=[];for(var _0x354d89 in _0x17fba5){if(_0x17fba5[_0x66ec('0x2a')](_0x354d89)){if(!_[_0x66ec('0x17')](_0x17fba5[_0x354d89])&&_0x17fba5[_0x354d89][_0x66ec('0x34')]===_0x66ec('0x5f')&&_0x17fba5[_0x354d89]['status']===_0x66ec('0x60')){_0x3b76d7[_0x66ec('0x61')](_0x17fba5[_0x354d89]['id']);}}}return _0x3b76d7;};exports['getDiff']=function(_0x5d7b82){var _0x49e10f=moment()[_0x66ec('0x6')](0x0);var _0x1fd68e=moment(_0x5d7b82)[_0x66ec('0x6')](0x0);return _0x49e10f[_0x66ec('0x7')](_0x1fd68e,_0x66ec('0x8'));};exports['createBody']=function(_0x3054b5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3054b5[_0x66ec('0x1b')],'ListId':_0x3054b5[_0x66ec('0x62')],'VoiceQueueId':_0x3054b5[_0x66ec('0x1c')]||undefined,'CampaignId':_0x3054b5[_0x66ec('0x63')]||undefined};};exports['filterKey']=function(_0xf8c356){if(_0xf8c356===_0x66ec('0x46')||_0xf8c356===_0x66ec('0x64')||_0xf8c356===_0x66ec('0x5b')||_0xf8c356==='type'||_0xf8c356==='campaigntype'||_0xf8c356==='dialAnswer'||_0xf8c356===_0x66ec('0x3c')||_0xf8c356===_0x66ec('0x5d')||_0xf8c356==='calleridname'||_0xf8c356===_0x66ec('0x53')||_0xf8c356===_0x66ec('0x1a')||_0xf8c356==='scheduledat'||_0xf8c356===_0x66ec('0x4b')||_0xf8c356===_0x66ec('0x4c')||_0xf8c356===_0x66ec('0x4d')||_0xf8c356===_0x66ec('0x65')||_0xf8c356===_0x66ec('0x66')||_0xf8c356===_0x66ec('0x67')||_0xf8c356===_0x66ec('0x68')||_0xf8c356==='recallme'||_0xf8c356===_0x66ec('0x1b')||_0xf8c356===_0x66ec('0x62')||_0xf8c356===_0x66ec('0x3d')||_0xf8c356===_0x66ec('0x1c')||_0xf8c356===_0x66ec('0x69')||_0xf8c356==='xmd-voicequeueid'||_0xf8c356===_0x66ec('0x6a')||_0xf8c356==='xmd-phone'||_0xf8c356==='xmd-listid'||_0xf8c356==='xmd-dialurl'||_0xf8c356==='xmd-dialtimeout'||_0xf8c356===_0x66ec('0x6b')||_0xf8c356===_0x66ec('0x6c')||_0xf8c356===_0x66ec('0x6d')||_0xf8c356===_0x66ec('0x6e')||_0xf8c356===_0x66ec('0x6f')||_0xf8c356===_0x66ec('0x70')||_0xf8c356===_0x66ec('0x71')||_0xf8c356===_0x66ec('0x72')||_0xf8c356===_0x66ec('0x73')||_0xf8c356==='rtpaudioqosbridged'||_0xf8c356===_0x66ec('0x74')||_0xf8c356===_0x66ec('0x75')||_0xf8c356==='rtpaudioqosloss'||_0xf8c356===_0x66ec('0x76')||_0xf8c356===_0x66ec('0x77')||_0xf8c356==='rtpaudioqosrttbridged'||_0xf8c356===_0x66ec('0x73')||_0xf8c356===_0x66ec('0x78')||_0xf8c356==='rtpaudioqosjitter'||_0xf8c356==='rtpaudioqosjitterbridged'||_0xf8c356==='rtpaudioqosloss'||_0xf8c356===_0x66ec('0x76')||_0xf8c356===_0x66ec('0x77')||_0xf8c356===_0x66ec('0x79')||_0xf8c356===_0x66ec('0x7a')||_0xf8c356===_0x66ec('0x7b')||_0xf8c356===_0x66ec('0x34')||_0xf8c356==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x107e23,_0x29d525){var _0x3a02f,_0x25e307,_0x5afb36;if(_0x29d525<=0x0){_0x29d525=0x1;}_0x3a02f=new RegExp(_0x66ec('0x7c')+_0x29d525+'}$');_0x25e307=Math['pow'](0xa,_0x29d525-0x1);_0x5afb36=Math[_0x66ec('0x7d')](0xa,_0x29d525)-0x1;return util[_0x66ec('0x14')]('%s',_[_0x66ec('0x7e')](_0x107e23,_0x3a02f,_['random'](_0x25e307,_0x5afb36)));};exports['extractCalleridName']=function(_0x4d1dc2){var _0x477d09=_0x4d1dc2[_0x66ec('0x7f')](/"(.*?)"/);return _0x477d09?_0x477d09[0x1]:_0x4d1dc2;};exports[_0x66ec('0x80')]=function(_0x1b13d4){var _0x26f931=_0x1b13d4[_0x66ec('0x7f')](/<(.*?)>/);return _0x26f931?_0x26f931[0x1]:_0x1b13d4;};
\ No newline at end of file