Built motion from commit 14588770.|2.5.38
[motion2.git] / server / services / ami / preview / util / util.js
index ad23710..e8d5d26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffb0=['xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','logAgent','responsetime','ringtime','logLookAgent','UserId','logCustomer','endtime','talktime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','createBody','type','dialAnswer','membername','active','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel'];(function(_0x25d4b1,_0x4e896d){var _0x2d51a5=function(_0x9c766){while(--_0x9c766){_0x25d4b1['push'](_0x25d4b1['shift']());}};_0x2d51a5(++_0x4e896d);}(_0xffb0,0xa7));var _0x0ffb=function(_0x18f9b2,_0x1c1db4){_0x18f9b2=_0x18f9b2-0x0;var _0x4996e4=_0xffb0[_0x18f9b2];return _0x4996e4;};'use strict';var util=require(_0x0ffb('0x0'));var _=require(_0x0ffb('0x1'));var moment=require(_0x0ffb('0x2'));var logger=require(_0x0ffb('0x3'))(_0x0ffb('0x4'));var ipAgi=process[_0x0ffb('0x5')][_0x0ffb('0x6')]||'127.0.0.1';function getSeconds(_0x1f3989,_0x22dcae){var _0x125fb0=moment(_0x1f3989)['milliseconds'](0x0);var _0x47c905=moment(_0x22dcae)[_0x0ffb('0x7')](0x0);return _0x125fb0[_0x0ffb('0x8')](_0x47c905,_0x0ffb('0x9'));}exports[_0x0ffb('0xa')]=function(_0x299c45){return function(_0x3928e0){logger[_0x0ffb('0xb')](_0x299c45,util[_0x0ffb('0xc')](_0x3928e0,{'showHidden':![],'depth':null}));};};exports[_0x0ffb('0xd')]=function(_0x4e4367,_0x527ce8){logger[_0x0ffb('0xe')](_0x4e4367,util[_0x0ffb('0xc')](_0x527ce8,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x138f52,_0x4c1a6f){logger[_0x0ffb('0xb')](_0x138f52,util['inspect'](_0x4c1a6f,{'showHidden':![],'depth':null}));};exports[_0x0ffb('0xf')]=function(_0x564858){return function(_0x38c40a){logger[_0x0ffb('0xe')](_0x564858,util[_0x0ffb('0xc')](_0x38c40a,{'showHidden':![],'depth':null}));};};exports[_0x0ffb('0x10')]=function(_0x288e8e,_0x43e5d2,_0x591af1){return{'message':_0x288e8e,'unlock':_0x43e5d2,'active':_0x591af1};};exports[_0x0ffb('0x11')]=function(_0x471cd0,_0x5930b1,_0x2c62e7){if(!_[_0x0ffb('0x12')](_0x2c62e7)&&_0x0ffb('0x13')===typeof _0x2c62e7&&!_[_0x0ffb('0x14')](_0x2c62e7)){if(!_[_0x0ffb('0x12')](_0x5930b1)&&_0x0ffb('0x13')===typeof _0x5930b1&&!_['isEmpty'](_0x5930b1)){return util['format']('\x22%s\x22\x20<%s>',_0x5930b1,_0x2c62e7);}return util[_0x0ffb('0x15')](_0x0ffb('0x16'),_0x2c62e7,_0x2c62e7);}if(!_[_0x0ffb('0x12')](_0x471cd0)&&_0x0ffb('0x13')===typeof _0x471cd0&&!_[_0x0ffb('0x14')](_0x471cd0)){return _0x471cd0;}return'\x22\x22\x20<>';};exports[_0x0ffb('0x17')]=function(_0x586444){if(_[_0x0ffb('0x18')](_0x586444)){return![];}return _0x586444;};exports[_0x0ffb('0x19')]=function(_0x2efffa,_0x4bbaea,_0x4e6fb8,_0x128949,_0x44b51a,_0x157942){var _0x59a4e5={'XMD-QUEUE':_0x4bbaea[_0x0ffb('0x1a')]?_0x4bbaea[_0x0ffb('0x1a')][_0x0ffb('0x1b')]:'','XMD-CALLERID':_0x128949,'XMD-CALLERID-PREVIEW':_0x157942?util[_0x0ffb('0x15')]('\x22%s\x22\x20<%s>',_0x157942['calleridname'],_0x157942['calleridnum']):_0x128949,'XMD-DIALID':_0x44b51a,'XMD-CONTACTID':_0x4bbaea['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x128949,'XMD-VOICEQUEUEID':_0x4bbaea[_0x0ffb('0x1c')],'XMD-DIALCHANNEL':_0x4e6fb8,'XMD-DIALTIMEOUT':_0x2efffa[_0x0ffb('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x0ffb('0x15')](_0x0ffb('0x1e'),_0x2efffa['dialQueueProject2']?'g':'',_[_0x0ffb('0x14')](_0x2efffa[_0x0ffb('0x1f')])?'':_0x0ffb('0x20')),'XMD-DIALURL':_0x2efffa[_0x0ffb('0x21')]||'','XMD-AGI':_0x2efffa[_0x0ffb('0x22')]?util['format'](_0x0ffb('0x23'),ipAgi,_0x2efffa[_0x0ffb('0x22')]):_0x0ffb('0x24'),'XMD-AGIAFTER':_0x2efffa[_0x0ffb('0x25')]?util['format'](_0x0ffb('0x23'),ipAgi,_0x2efffa[_0x0ffb('0x25')]):_0x0ffb('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x157942?_0x157942['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x157942?_0x157942[_0x0ffb('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x2efffa[_0x0ffb('0x1f')])){_0x59a4e5[util[_0x0ffb('0x15')]('%s',_0x0ffb('0x27'))]=_0x2efffa[_0x0ffb('0x1f')];_0x59a4e5[util[_0x0ffb('0x15')]('%s',_0x0ffb('0x28'))]=_0x44b51a;}if(_0x4bbaea&&_0x4bbaea[_0x0ffb('0x29')]){for(var _0x13dff3 in _0x4bbaea[_0x0ffb('0x29')]){if(_0x4bbaea[_0x0ffb('0x29')]['hasOwnProperty'](_0x13dff3)){if(!_[_0x0ffb('0x18')](_0x4bbaea[_0x0ffb('0x29')][_0x13dff3])&&_0x13dff3!=='id'&&_0x13dff3!==_0x0ffb('0x2a')&&_0x13dff3!==_0x0ffb('0x2b')&&_0x13dff3!==_0x0ffb('0x2c')){_0x59a4e5[util[_0x0ffb('0x15')](_0x0ffb('0x2d'),_0x0ffb('0x2e'),_[_0x0ffb('0x2f')](_0x13dff3))]=_0x4bbaea[_0x0ffb('0x29')][_0x13dff3];}}}}return _0x59a4e5;};exports['toLowerVariables']=function(_0x13310a){var _0x1596ac={};for(var _0x5137a5 in _0x13310a){if(_0x13310a[_0x0ffb('0x30')](_0x5137a5)){_0x1596ac[util[_0x0ffb('0x15')]('%s',_[_0x0ffb('0x31')](_0x5137a5))]=_0x13310a[_0x5137a5];}}return{'variables':_0x1596ac};};exports['updateOriginated']=function(_0x418cc1,_0x257657){if(!_['isNil'](_0x418cc1)){if(_0x418cc1[_0x0ffb('0x30')]('originated')){if(_0x418cc1[_0x0ffb('0x32')]>0x0){_0x418cc1['originated']-=0x1;}else{logger['error'](_0x0ffb('0x33'),_0x257657);}}}else{logger[_0x0ffb('0xb')](_0x0ffb('0x34'),_0x257657);}};exports['logBlacklist']=function(_0x5d3d94){var _0x2ca8c2=moment()[_0x0ffb('0x15')](_0x0ffb('0x35'));_0x5d3d94[_0x0ffb('0x36')]=0xd;_0x5d3d94[_0x0ffb('0x37')]='Blacklist';_0x5d3d94[_0x0ffb('0x38')]=_0x2ca8c2;_0x5d3d94['responsetime']=_0x2ca8c2;_0x5d3d94['endtime']=_0x2ca8c2;};exports[_0x0ffb('0x39')]=function(_0x5cd707,_0x45d4ba,_0x55dd2a){var _0x2c98f5=moment()[_0x0ffb('0x15')](_0x0ffb('0x35'));_0x5cd707[_0x0ffb('0x36')]=_0x45d4ba;_0x5cd707[_0x0ffb('0x37')]=_0x55dd2a;_0x5cd707[_0x0ffb('0x3a')]=_0x2c98f5;_0x5cd707[_0x0ffb('0x3b')]=getSeconds(_0x5cd707[_0x0ffb('0x3a')],_0x5cd707[_0x0ffb('0x38')]);};exports[_0x0ffb('0x3c')]=function(_0x1e4a44,_0x3d5362,_0x458094){_0x1e4a44['membername']=_0x3d5362;_0x1e4a44[_0x0ffb('0x3d')]=_0x458094;};exports[_0x0ffb('0x3e')]=function(_0x12d3c9,_0x4540fd,_0x21a5e3){var _0x270eeb=moment()[_0x0ffb('0x15')](_0x0ffb('0x35'));_0x12d3c9[_0x0ffb('0x36')]=_0x4540fd;_0x12d3c9[_0x0ffb('0x37')]=_0x21a5e3;_0x12d3c9['responsetime']=_0x12d3c9[_0x0ffb('0x3a')]?_0x12d3c9['responsetime']:_0x270eeb;_0x12d3c9[_0x0ffb('0x3f')]=_0x12d3c9[_0x0ffb('0x3f')]?_0x12d3c9[_0x0ffb('0x3f')]:_0x270eeb;_0x12d3c9['ringtime']=getSeconds(_0x12d3c9[_0x0ffb('0x3a')]||0x0,_0x12d3c9[_0x0ffb('0x38')]||0x0);_0x12d3c9[_0x0ffb('0x40')]=_0x12d3c9['answertime']?getSeconds(_0x12d3c9[_0x0ffb('0x3f')],_0x12d3c9['answertime']):0x0;};exports[_0x0ffb('0x41')]=function(_0xe20d75){return _0xe20d75===_0x0ffb('0x42');};exports[_0x0ffb('0x43')]=function(_0x177b71,_0x1d232b,_0x4c5067,_0x7ba41d,_0x490b19){var _0x393b04=_0x7ba41d?_0x0ffb('0x44'):_0x177b71[_0x0ffb('0x45')];_0x393b04=_0x490b19?_0x0ffb('0x46'):_0x393b04;return{'actionid':_0x177b71[_0x0ffb('0x47')],'action':_0x0ffb('0x48'),'channel':_0x177b71[_0x0ffb('0x49')],'callerid':util[_0x0ffb('0x15')](_0x0ffb('0x16'),_0x393b04,_0x177b71[_0x0ffb('0x4a')]),'Exten':'xcally-motion-preview','Context':_0x0ffb('0x4b'),'Priority':'1','variable':_0x4c5067,'timeout':(_0x1d232b[_0x0ffb('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x177b71[_0x0ffb('0x47')]};};exports[_0x0ffb('0x4d')]=function(_0xcfb136){return _0xcfb136[_0x0ffb('0x4e')]+_0xcfb136[_0x0ffb('0x4f')]+_0xcfb136[_0x0ffb('0x50')]+_0xcfb136[_0x0ffb('0x51')]+_0xcfb136[_0x0ffb('0x52')];};exports[_0x0ffb('0x53')]=function(_0x4d628f){var _0x123f4c=_[_0x0ffb('0x54')](_0x4d628f);_0x123f4c['state']=0xf;_0x123f4c['statedesc']=_0x0ffb('0x55');return _0x123f4c;};exports[_0x0ffb('0x56')]=function(_0x5c51f2,_0x1d3953,_0x5bac65){var _0x4c03f6={};_0x4c03f6[_0x1d3953]=_0x5c51f2[_0x1d3953];_0x4c03f6['active']=![];_0x4c03f6[_0x0ffb('0x57')]=moment()[_0x0ffb('0x58')](_0x5bac65,_0x0ffb('0x59'))[_0x0ffb('0x15')](_0x0ffb('0x35'));_0x4c03f6['ContactId']=_0x5c51f2[_0x0ffb('0x5a')];_0x4c03f6[_0x0ffb('0x5b')]=_0x5c51f2[_0x0ffb('0x5b')];_0x4c03f6[_0x0ffb('0x1c')]=_0x5c51f2[_0x0ffb('0x1c')]||undefined;return _0x4c03f6;};exports[_0x0ffb('0x5c')]=function(_0x419540,_0xc927d){if(!_[_0x0ffb('0x18')](_0x419540)){if(_0x419540['pTalking']>0x0){_0x419540[_0x0ffb('0x5d')]-=0x1;}else{logger['error'](_0xc927d,_0x0ffb('0x5e'));}}else{logger[_0x0ffb('0xb')](_0xc927d,_0x0ffb('0x5f'));}};exports[_0x0ffb('0x60')]=function(_0x211571){if(_0x211571<=0x0){return!![];}return![];};exports[_0x0ffb('0x61')]=function(_0x5ea7a3,_0x3625e7,_0x367c75){_0x5ea7a3['lastevent']=_0x3625e7;_0x5ea7a3[_0x0ffb('0x1b')]=_0x5ea7a3[_0x0ffb('0x62')];_0x5ea7a3['interface']=_0x5ea7a3['channelAgent'];_0x5ea7a3[_0x0ffb('0x63')]=_0x0ffb('0x64');if(_0x367c75){_0x5ea7a3[_0x0ffb('0x65')]=_0x367c75['mandatoryDisposition'];}return _0x5ea7a3;};exports[_0x0ffb('0x66')]=function(_0x4aa226){var _0xd54a6c={};_0xd54a6c[_0x0ffb('0x62')]=_0x4aa226[_0x0ffb('0x62')];_0xd54a6c[_0x0ffb('0x67')]=_0x4aa226[_0x0ffb('0x49')];_0xd54a6c[_0x0ffb('0x47')]=_0x4aa226[_0x0ffb('0x47')];return _0xd54a6c;};exports[_0x0ffb('0x68')]=function(_0x1221f9){var _0x5de0b1=[];for(var _0x9ff916 in _0x1221f9){if(_0x1221f9['hasOwnProperty'](_0x9ff916)){if(!_[_0x0ffb('0x18')](_0x1221f9[_0x9ff916])&&_0x1221f9[_0x9ff916][_0x0ffb('0x36')]===_0x0ffb('0x69')&&_0x1221f9[_0x9ff916][_0x0ffb('0x6a')]===_0x0ffb('0x6b')){_0x5de0b1['push'](_0x1221f9[_0x9ff916]['id']);}}}return _0x5de0b1;};exports['getDiff']=function(_0xa368a6){var _0x4b603b=moment()[_0x0ffb('0x7')](0x0);var _0x46c460=moment(_0xa368a6)[_0x0ffb('0x7')](0x0);return _0x4b603b[_0x0ffb('0x8')](_0x46c460,_0x0ffb('0x9'));};exports[_0x0ffb('0x6c')]=function(_0x475873){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x475873['ContactId'],'ListId':_0x475873[_0x0ffb('0x5b')],'VoiceQueueId':_0x475873['VoiceQueueId']||undefined,'CampaignId':_0x475873['CampaignId']||undefined};};exports['filterKey']=function(_0x21082b){if(_0x21082b===_0x0ffb('0x47')||_0x21082b==='idContact'||_0x21082b===_0x0ffb('0x62')||_0x21082b===_0x0ffb('0x6d')||_0x21082b==='campaigntype'||_0x21082b===_0x0ffb('0x6e')||_0x21082b===_0x0ffb('0x6f')||_0x21082b===_0x0ffb('0x49')||_0x21082b===_0x0ffb('0x45')||_0x21082b===_0x0ffb('0x70')||_0x21082b===_0x0ffb('0x4a')||_0x21082b===_0x0ffb('0x57')||_0x21082b===_0x0ffb('0x4e')||_0x21082b===_0x0ffb('0x4f')||_0x21082b===_0x0ffb('0x50')||_0x21082b==='countglobal'||_0x21082b===_0x0ffb('0x71')||_0x21082b===_0x0ffb('0x72')||_0x21082b===_0x0ffb('0x73')||_0x21082b==='recallme'||_0x21082b==='ContactId'||_0x21082b===_0x0ffb('0x5b')||_0x21082b===_0x0ffb('0x3d')||_0x21082b===_0x0ffb('0x1c')||_0x21082b===_0x0ffb('0x74')||_0x21082b===_0x0ffb('0x75')||_0x21082b===_0x0ffb('0x76')||_0x21082b===_0x0ffb('0x77')||_0x21082b===_0x0ffb('0x78')||_0x21082b===_0x0ffb('0x79')||_0x21082b===_0x0ffb('0x7a')||_0x21082b==='xmd-dialoptions'||_0x21082b===_0x0ffb('0x7b')||_0x21082b===_0x0ffb('0x7c')||_0x21082b===_0x0ffb('0x7d')||_0x21082b==='xmd-cdrtype'||_0x21082b===_0x0ffb('0x7e')||_0x21082b===_0x0ffb('0x7f')||_0x21082b===_0x0ffb('0x80')||_0x21082b===_0x0ffb('0x81')||_0x21082b===_0x0ffb('0x82')||_0x21082b===_0x0ffb('0x83')||_0x21082b===_0x0ffb('0x84')||_0x21082b==='rtpaudioqosloss'||_0x21082b===_0x0ffb('0x85')||_0x21082b===_0x0ffb('0x86')||_0x21082b==='rtpaudioqosrttbridged'||_0x21082b===_0x0ffb('0x81')||_0x21082b===_0x0ffb('0x82')||_0x21082b===_0x0ffb('0x83')||_0x21082b==='rtpaudioqosjitterbridged'||_0x21082b===_0x0ffb('0x87')||_0x21082b==='rtpaudioqoslossbridged'||_0x21082b===_0x0ffb('0x86')||_0x21082b===_0x0ffb('0x88')||_0x21082b===_0x0ffb('0x89')||_0x21082b===_0x0ffb('0x8a')||_0x21082b===_0x0ffb('0x36')||_0x21082b===_0x0ffb('0x37')){return![];}return!![];};exports[_0x0ffb('0x8b')]=function(_0x2723a2,_0x1c72ab){var _0x3dab78,_0x460b12,_0x188e39;if(_0x1c72ab<=0x0){_0x1c72ab=0x1;}_0x3dab78=new RegExp(_0x0ffb('0x8c')+_0x1c72ab+'}$');_0x460b12=Math[_0x0ffb('0x8d')](0xa,_0x1c72ab-0x1);_0x188e39=Math[_0x0ffb('0x8d')](0xa,_0x1c72ab)-0x1;return util['format']('%s',_[_0x0ffb('0x8e')](_0x2723a2,_0x3dab78,_[_0x0ffb('0x8f')](_0x460b12,_0x188e39)));};exports[_0x0ffb('0x90')]=function(_0x12ad00){var _0x1d5beb=_0x12ad00[_0x0ffb('0x91')](/"(.*?)"/);return _0x1d5beb?_0x1d5beb[0x1]:_0x12ad00;};exports['extractCalleridNumber']=function(_0x5e521a){var _0x1c1b8b=_0x5e521a[_0x0ffb('0x91')](/<(.*?)>/);return _0x1c1b8b?_0x1c1b8b[0x1]:_0x5e521a;};
\ No newline at end of file
+var _0xa76e=['seconds','inspect','logger','info','error','message','isEmpty','isUndefined','string','\x22%s\x22\x20<%s>','format','isNil','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildAcw','reachable','getDiff','createBody','filterKey','campaigntype','dialAnswer','channelAgent','calleridname','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa76e,0x7d));var _0xea76=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xa76e[_0x3cc9d9];return _0x1a425d;};'use strict';var util=require(_0xea76('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xea76('0x1'))(_0xea76('0x2'));var ipAgi=process['env'][_0xea76('0x3')]||_0xea76('0x4');function getSeconds(_0x4cab3b,_0xcb85a6){var _0x37d587=moment(_0x4cab3b)[_0xea76('0x5')](0x0);var _0x29306d=moment(_0xcb85a6)['milliseconds'](0x0);return _0x37d587['diff'](_0x29306d,_0xea76('0x6'));}exports['loggerCatch']=function(_0x198e9b){return function(_0x340230){logger['error'](_0x198e9b,util[_0xea76('0x7')](_0x340230,{'showHidden':![],'depth':null}));};};exports[_0xea76('0x8')]=function(_0x5c4fde,_0x35682c){logger[_0xea76('0x9')](_0x5c4fde,util['inspect'](_0x35682c,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x268c94,_0x7bd8bf){logger[_0xea76('0xa')](_0x268c94,util[_0xea76('0x7')](_0x7bd8bf,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x272cf0){return function(_0x27fe4d){logger[_0xea76('0x9')](_0x272cf0,util['inspect'](_0x27fe4d,{'showHidden':![],'depth':null}));};};exports[_0xea76('0xb')]=function(_0x229497,_0x3c46,_0x4ea833){return{'message':_0x229497,'unlock':_0x3c46,'active':_0x4ea833};};exports['getCallerId']=function(_0x1beb23,_0x470c4b,_0x3f8937){if(!_['isUndefined'](_0x3f8937)&&'string'===typeof _0x3f8937&&!_[_0xea76('0xc')](_0x3f8937)){if(!_[_0xea76('0xd')](_0x470c4b)&&_0xea76('0xe')===typeof _0x470c4b&&!_[_0xea76('0xc')](_0x470c4b)){return util['format'](_0xea76('0xf'),_0x470c4b,_0x3f8937);}return util[_0xea76('0x10')](_0xea76('0xf'),_0x3f8937,_0x3f8937);}if(!_['isUndefined'](_0x1beb23)&&_0xea76('0xe')===typeof _0x1beb23&&!_['isEmpty'](_0x1beb23)){return _0x1beb23;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x1db1ab){if(_[_0xea76('0x11')](_0x1db1ab)){return![];}return _0x1db1ab;};exports['addVariables']=function(_0x25a1a8,_0x46f91f,_0x33cb12,_0x476ea8,_0x2cda79,_0x332650){var _0xba5e48={'XMD-QUEUE':_0x46f91f[_0xea76('0x12')]?_0x46f91f[_0xea76('0x12')][_0xea76('0x13')]:'','XMD-CALLERID':_0x476ea8,'XMD-CALLERID-PREVIEW':_0x332650?util[_0xea76('0x10')](_0xea76('0xf'),_0x332650['calleridname'],_0x332650[_0xea76('0x14')]):_0x476ea8,'XMD-DIALID':_0x2cda79,'XMD-CONTACTID':_0x46f91f[_0xea76('0x15')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x476ea8,'XMD-VOICEQUEUEID':_0x46f91f[_0xea76('0x16')],'XMD-DIALCHANNEL':_0x33cb12,'XMD-DIALTIMEOUT':_0x25a1a8[_0xea76('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0xea76('0x10')](_0xea76('0x18'),_0x25a1a8['dialQueueProject2']?'g':'',_[_0xea76('0xc')](_0x25a1a8['monitor_format'])?'':_0xea76('0x19')),'XMD-DIALURL':_0x25a1a8[_0xea76('0x1a')]||'','XMD-AGI':_0x25a1a8[_0xea76('0x1b')]?util[_0xea76('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x25a1a8['dialQueueProject']):_0xea76('0x1c'),'XMD-AGIAFTER':_0x25a1a8[_0xea76('0x1d')]?util[_0xea76('0x10')](_0xea76('0x1e'),ipAgi,_0x25a1a8[_0xea76('0x1d')]):_0xea76('0x1c'),'XMD-ORIGINATECALLERIDNUM':_0x332650?_0x332650[_0xea76('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x332650?_0x332650[_0xea76('0x20')]:'','XMD-DESTINATION':_0xea76('0x21'),'SIPADDHEADER':_0xea76('0x22')};if(!_[_0xea76('0xc')](_0x25a1a8[_0xea76('0x23')])){_0xba5e48[util[_0xea76('0x10')]('%s',_0xea76('0x24'))]=_0x25a1a8[_0xea76('0x23')];_0xba5e48[util[_0xea76('0x10')]('%s',_0xea76('0x25'))]=_0x2cda79;}if(_0x46f91f&&_0x46f91f[_0xea76('0x26')]){for(var _0x55de97 in _0x46f91f[_0xea76('0x26')]){if(_0x46f91f[_0xea76('0x26')]['hasOwnProperty'](_0x55de97)){if(!_[_0xea76('0x11')](_0x46f91f[_0xea76('0x26')][_0x55de97])&&_0x55de97!=='id'&&_0x55de97!=='tags'&&_0x55de97!==_0xea76('0x27')&&_0x55de97!==_0xea76('0x28')){_0xba5e48[util[_0xea76('0x10')](_0xea76('0x29'),_0xea76('0x2a'),_[_0xea76('0x2b')](_0x55de97))]=_0x46f91f[_0xea76('0x26')][_0x55de97];}}}}return _0xba5e48;};exports[_0xea76('0x2c')]=function(_0x1514fe){var _0xde3893={};for(var _0x59ea58 in _0x1514fe){if(_0x1514fe[_0xea76('0x2d')](_0x59ea58)){_0xde3893[util[_0xea76('0x10')]('%s',_['toLower'](_0x59ea58))]=_0x1514fe[_0x59ea58];}}return{'variables':_0xde3893};};exports[_0xea76('0x2e')]=function(_0xa7eb20,_0x164be6){if(!_[_0xea76('0x11')](_0xa7eb20)){if(_0xa7eb20[_0xea76('0x2d')](_0xea76('0x2f'))){if(_0xa7eb20['originated']>0x0){_0xa7eb20[_0xea76('0x2f')]-=0x1;}else{logger[_0xea76('0xa')](_0xea76('0x30'),_0x164be6);}}}else{logger[_0xea76('0xa')](_0xea76('0x31'),_0x164be6);}};exports[_0xea76('0x32')]=function(_0x5b8307){var _0x17107f=moment()[_0xea76('0x10')](_0xea76('0x33'));_0x5b8307[_0xea76('0x34')]=0xd;_0x5b8307[_0xea76('0x35')]=_0xea76('0x36');_0x5b8307[_0xea76('0x37')]=_0x17107f;_0x5b8307[_0xea76('0x38')]=_0x17107f;_0x5b8307[_0xea76('0x39')]=_0x17107f;};exports['logAgent']=function(_0x3d827b,_0x2e9e6b,_0x15d744){var _0x56de60=moment()[_0xea76('0x10')](_0xea76('0x33'));_0x3d827b[_0xea76('0x34')]=_0x2e9e6b;_0x3d827b[_0xea76('0x35')]=_0x15d744;_0x3d827b[_0xea76('0x38')]=_0x56de60;_0x3d827b[_0xea76('0x3a')]=getSeconds(_0x3d827b[_0xea76('0x38')],_0x3d827b[_0xea76('0x37')]);};exports[_0xea76('0x3b')]=function(_0x1a4f4b,_0x171467,_0x726278){_0x1a4f4b[_0xea76('0x3c')]=_0x171467;_0x1a4f4b[_0xea76('0x3d')]=_0x726278;};exports[_0xea76('0x3e')]=function(_0x3cd051,_0x5e20ce,_0xf98cff){var _0x48c9bb=moment()[_0xea76('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cd051[_0xea76('0x34')]=_0x5e20ce;_0x3cd051['statedesc']=_0xf98cff;_0x3cd051['responsetime']=_0x3cd051[_0xea76('0x38')]?_0x3cd051[_0xea76('0x38')]:_0x48c9bb;_0x3cd051[_0xea76('0x39')]=_0x3cd051[_0xea76('0x39')]?_0x3cd051[_0xea76('0x39')]:_0x48c9bb;_0x3cd051[_0xea76('0x3a')]=getSeconds(_0x3cd051[_0xea76('0x38')]||0x0,_0x3cd051[_0xea76('0x37')]||0x0);_0x3cd051[_0xea76('0x3f')]=_0x3cd051[_0xea76('0x40')]?getSeconds(_0x3cd051[_0xea76('0x39')],_0x3cd051[_0xea76('0x40')]):0x0;};exports[_0xea76('0x41')]=function(_0x104b68){return _0x104b68===_0xea76('0x42');};exports[_0xea76('0x43')]=function(_0x116a90,_0x30c495,_0xa5466d,_0x3a6325,_0x31bbc6){var _0x5cff26=_0x3a6325?_0xea76('0x44'):_0x116a90['calleridname'];_0x5cff26=_0x31bbc6?_0xea76('0x45'):_0x5cff26;return{'actionid':_0x116a90[_0xea76('0x46')],'action':_0xea76('0x47'),'channel':_0x116a90['channelAgent'],'callerid':util[_0xea76('0x10')]('\x22%s\x22\x20<%s>',_0x5cff26,_0x116a90['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0xa5466d,'timeout':(_0x30c495[_0xea76('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x116a90['uniqueid']};};exports[_0xea76('0x49')]=function(_0x54f06e){return _0x54f06e[_0xea76('0x4a')]+_0x54f06e[_0xea76('0x4b')]+_0x54f06e['countnoanswerretry']+_0x54f06e[_0xea76('0x4c')]+_0x54f06e[_0xea76('0x4d')];};exports['cloneAction']=function(_0x2520d6){var _0x51a9d7=_[_0xea76('0x4e')](_0x2520d6);_0x51a9d7['state']=0xf;_0x51a9d7[_0xea76('0x35')]=_0xea76('0x4f');return _0x51a9d7;};exports['scheduledAt']=function(_0x28591a,_0x29d5b2,_0x1c7c4f){var _0xdebe71={};_0xdebe71[_0x29d5b2]=_0x28591a[_0x29d5b2];_0xdebe71[_0xea76('0x50')]=![];_0xdebe71['scheduledat']=moment()['add'](_0x1c7c4f,_0xea76('0x51'))['format'](_0xea76('0x33'));_0xdebe71[_0xea76('0x15')]=_0x28591a['ContactId'];_0xdebe71[_0xea76('0x52')]=_0x28591a['ListId'];_0xdebe71['VoiceQueueId']=_0x28591a[_0xea76('0x16')]||undefined;return _0xdebe71;};exports[_0xea76('0x53')]=function(_0x6de40c,_0x364ad2){if(!_[_0xea76('0x11')](_0x6de40c)){if(_0x6de40c[_0xea76('0x54')]>0x0){_0x6de40c[_0xea76('0x54')]-=0x1;}else{logger['error'](_0x364ad2,_0xea76('0x55'));}}else{logger['error'](_0x364ad2,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xea76('0x56')]=function(_0x384c33){if(_0x384c33<=0x0){return!![];}return![];};exports[_0xea76('0x57')]=function(_0x448364,_0x5a7ec8,_0x1a46b6){_0x448364[_0xea76('0x58')]=_0x5a7ec8;_0x448364[_0xea76('0x13')]=_0x448364[_0xea76('0x59')];_0x448364[_0xea76('0x5a')]=_0x448364['channelAgent'];_0x448364[_0xea76('0x5b')]='voice';if(_0x1a46b6){_0x448364[_0xea76('0x5c')]=_0x1a46b6['mandatoryDisposition'];}return _0x448364;};exports[_0xea76('0x5d')]=function(_0x5e1d97){var _0x4adb64={};_0x4adb64['queue']=_0x5e1d97[_0xea76('0x59')];_0x4adb64[_0xea76('0x5a')]=_0x5e1d97['channelAgent'];_0x4adb64[_0xea76('0x46')]=_0x5e1d97['uniqueid'];return _0x4adb64;};exports['agentReadyId']=function(_0x2030d0){var _0x5173f6=[];for(var _0x57be01 in _0x2030d0){if(_0x2030d0[_0xea76('0x2d')](_0x57be01)){if(!_[_0xea76('0x11')](_0x2030d0[_0x57be01])&&_0x2030d0[_0x57be01][_0xea76('0x34')]==='not_inuse'&&_0x2030d0[_0x57be01]['status']===_0xea76('0x5e')){_0x5173f6['push'](_0x2030d0[_0x57be01]['id']);}}}return _0x5173f6;};exports[_0xea76('0x5f')]=function(_0x5583a6){var _0x213087=moment()['milliseconds'](0x0);var _0x1a0ac5=moment(_0x5583a6)[_0xea76('0x5')](0x0);return _0x213087['diff'](_0x1a0ac5,'seconds');};exports[_0xea76('0x60')]=function(_0x207a4a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x207a4a[_0xea76('0x15')],'ListId':_0x207a4a[_0xea76('0x52')],'VoiceQueueId':_0x207a4a[_0xea76('0x16')]||undefined,'CampaignId':_0x207a4a['CampaignId']||undefined};};exports[_0xea76('0x61')]=function(_0x1339da){if(_0x1339da===_0xea76('0x46')||_0x1339da==='idContact'||_0x1339da===_0xea76('0x59')||_0x1339da==='type'||_0x1339da===_0xea76('0x62')||_0x1339da===_0xea76('0x63')||_0x1339da===_0xea76('0x3c')||_0x1339da===_0xea76('0x64')||_0x1339da===_0xea76('0x65')||_0x1339da===_0xea76('0x50')||_0x1339da===_0xea76('0x14')||_0x1339da===_0xea76('0x66')||_0x1339da===_0xea76('0x4a')||_0x1339da===_0xea76('0x4b')||_0x1339da==='countnoanswerretry'||_0x1339da===_0xea76('0x67')||_0x1339da===_0xea76('0x68')||_0x1339da===_0xea76('0x69')||_0x1339da===_0xea76('0x6a')||_0x1339da===_0xea76('0x6b')||_0x1339da===_0xea76('0x15')||_0x1339da==='ListId'||_0x1339da===_0xea76('0x3d')||_0x1339da===_0xea76('0x16')||_0x1339da===_0xea76('0x6c')||_0x1339da===_0xea76('0x6d')||_0x1339da===_0xea76('0x6e')||_0x1339da===_0xea76('0x6f')||_0x1339da===_0xea76('0x70')||_0x1339da==='xmd-dialurl'||_0x1339da==='xmd-dialtimeout'||_0x1339da===_0xea76('0x71')||_0x1339da===_0xea76('0x72')||_0x1339da==='xmd-dialchannel'||_0x1339da==='xmd-contactid'||_0x1339da===_0xea76('0x73')||_0x1339da==='xmd-callerid'||_0x1339da==='xmd-agiafter'||_0x1339da===_0xea76('0x74')||_0x1339da===_0xea76('0x75')||_0x1339da===_0xea76('0x76')||_0x1339da===_0xea76('0x77')||_0x1339da===_0xea76('0x78')||_0x1339da===_0xea76('0x79')||_0x1339da==='rtpaudioqoslossbridged'||_0x1339da===_0xea76('0x7a')||_0x1339da===_0xea76('0x7b')||_0x1339da===_0xea76('0x75')||_0x1339da===_0xea76('0x76')||_0x1339da===_0xea76('0x77')||_0x1339da===_0xea76('0x78')||_0x1339da===_0xea76('0x79')||_0x1339da===_0xea76('0x7c')||_0x1339da==='rtpaudioqosrtt'||_0x1339da==='rtpaudioqosrttbridged'||_0x1339da===_0xea76('0x7d')||_0x1339da===_0xea76('0x7e')||_0x1339da===_0xea76('0x34')||_0x1339da==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x10bd81,_0x979449){var _0x28a40a,_0x1aebf8,_0x369e93;if(_0x979449<=0x0){_0x979449=0x1;}_0x28a40a=new RegExp('\x5cw{0,'+_0x979449+'}$');_0x1aebf8=Math[_0xea76('0x7f')](0xa,_0x979449-0x1);_0x369e93=Math[_0xea76('0x7f')](0xa,_0x979449)-0x1;return util['format']('%s',_[_0xea76('0x80')](_0x10bd81,_0x28a40a,_[_0xea76('0x81')](_0x1aebf8,_0x369e93)));};exports['extractCalleridName']=function(_0x1b3bbe){var _0x1bb353=_0x1b3bbe[_0xea76('0x82')](/"(.*?)"/);return _0x1bb353?_0x1bb353[0x1]:_0x1b3bbe;};exports['extractCalleridNumber']=function(_0x2416eb){var _0x5f0790=_0x2416eb['match'](/<(.*?)>/);return _0x5f0790?_0x5f0790[0x1]:_0x2416eb;};
\ No newline at end of file