Built motion from commit (unavailable).|2.5.29
[motion2.git] / server / services / ami / preview / util / util.js
index 89f97a1..16b5b09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb62=['rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','error','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','reachable','push','getDiff','createBody','CampaignId','filterKey','type','dialAnswer','active','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x8503e0,_0x38132a){var _0x433237=function(_0x2072db){while(--_0x2072db){_0x8503e0['push'](_0x8503e0['shift']());}};_0x433237(++_0x38132a);}(_0xfb62,0x1c1));var _0x2fb6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xfb62[_0x199572];return _0x13cfa3;};'use strict';var util=require('util');var _=require(_0x2fb6('0x0'));var moment=require(_0x2fb6('0x1'));var logger=require('../../../../config/logger')(_0x2fb6('0x2'));var ipAgi=process[_0x2fb6('0x3')][_0x2fb6('0x4')]||'127.0.0.1';function getSeconds(_0x2b8dd9,_0x2da30e){var _0x36305f=moment(_0x2b8dd9)[_0x2fb6('0x5')](0x0);var _0x252999=moment(_0x2da30e)[_0x2fb6('0x5')](0x0);return _0x36305f[_0x2fb6('0x6')](_0x252999,_0x2fb6('0x7'));}exports[_0x2fb6('0x8')]=function(_0x47a6ca){return function(_0x478f70){logger['error'](_0x47a6ca,util[_0x2fb6('0x9')](_0x478f70,{'showHidden':![],'depth':null}));};};exports[_0x2fb6('0xa')]=function(_0x598b1b,_0x205ce5){logger[_0x2fb6('0xb')](_0x598b1b,util[_0x2fb6('0x9')](_0x205ce5,{'showHidden':![],'depth':null}));};exports[_0x2fb6('0xc')]=function(_0x39c4b9,_0x3e491a){logger['error'](_0x39c4b9,util['inspect'](_0x3e491a,{'showHidden':![],'depth':null}));};exports[_0x2fb6('0xd')]=function(_0x26b360){return function(_0x58fd4c){logger[_0x2fb6('0xb')](_0x26b360,util[_0x2fb6('0x9')](_0x58fd4c,{'showHidden':![],'depth':null}));};};exports[_0x2fb6('0xe')]=function(_0x14a747,_0xba0d0e,_0x238628){return{'message':_0x14a747,'unlock':_0xba0d0e,'active':_0x238628};};exports[_0x2fb6('0xf')]=function(_0x315166,_0x561b38,_0x420c22){if(!_[_0x2fb6('0x10')](_0x420c22)&&_0x2fb6('0x11')===typeof _0x420c22&&!_['isEmpty'](_0x420c22)){if(!_['isUndefined'](_0x561b38)&&_0x2fb6('0x11')===typeof _0x561b38&&!_[_0x2fb6('0x12')](_0x561b38)){return util[_0x2fb6('0x13')](_0x2fb6('0x14'),_0x561b38,_0x420c22);}return util[_0x2fb6('0x13')](_0x2fb6('0x14'),_0x420c22,_0x420c22);}if(!_[_0x2fb6('0x10')](_0x315166)&&_0x2fb6('0x11')===typeof _0x315166&&!_[_0x2fb6('0x12')](_0x315166)){return _0x315166;}return _0x2fb6('0x15');};exports[_0x2fb6('0x16')]=function(_0x1036e7){if(_['isNil'](_0x1036e7)){return![];}return _0x1036e7;};exports[_0x2fb6('0x17')]=function(_0x28dd91,_0x4a656f,_0x4b6dca,_0x32d5bb,_0x7ff4c0,_0x42520e){var _0x1d5814={'XMD-QUEUE':_0x4a656f[_0x2fb6('0x18')]?_0x4a656f[_0x2fb6('0x18')]['name']:'','XMD-CALLERID':_0x32d5bb,'XMD-CALLERID-PREVIEW':_0x42520e?util[_0x2fb6('0x13')](_0x2fb6('0x14'),_0x42520e[_0x2fb6('0x19')],_0x42520e[_0x2fb6('0x1a')]):_0x32d5bb,'XMD-DIALID':_0x7ff4c0,'XMD-CONTACTID':_0x4a656f[_0x2fb6('0x1b')],'XMD-CDRTYPE':_0x2fb6('0x1c'),'CALLERID(all)':_0x32d5bb,'XMD-VOICEQUEUEID':_0x4a656f[_0x2fb6('0x1d')],'XMD-DIALCHANNEL':_0x4b6dca,'XMD-DIALTIMEOUT':_0x28dd91['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x2fb6('0x13')](_0x2fb6('0x1e'),_0x28dd91['dialQueueProject2']?'g':'',_[_0x2fb6('0x12')](_0x28dd91['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x28dd91[_0x2fb6('0x1f')]||'','XMD-AGI':_0x28dd91['dialQueueProject']?util[_0x2fb6('0x13')](_0x2fb6('0x20'),ipAgi,_0x28dd91[_0x2fb6('0x21')]):_0x2fb6('0x22'),'XMD-AGIAFTER':_0x28dd91[_0x2fb6('0x23')]?util[_0x2fb6('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x28dd91[_0x2fb6('0x23')]):_0x2fb6('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x42520e?_0x42520e[_0x2fb6('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x42520e?_0x42520e[_0x2fb6('0x25')]:'','XMD-DESTINATION':_0x2fb6('0x26')};if(!_[_0x2fb6('0x12')](_0x28dd91[_0x2fb6('0x27')])){_0x1d5814[util[_0x2fb6('0x13')]('%s',_0x2fb6('0x28'))]=_0x28dd91[_0x2fb6('0x27')];_0x1d5814[util[_0x2fb6('0x13')]('%s',_0x2fb6('0x29'))]=_0x7ff4c0;}if(_0x4a656f&&_0x4a656f[_0x2fb6('0x2a')]){for(var _0x464e6f in _0x4a656f['Contact']){if(_0x4a656f[_0x2fb6('0x2a')][_0x2fb6('0x2b')](_0x464e6f)){if(!_['isNil'](_0x4a656f[_0x2fb6('0x2a')][_0x464e6f])&&_0x464e6f!=='id'&&_0x464e6f!=='tags'&&_0x464e6f!==_0x2fb6('0x2c')&&_0x464e6f!==_0x2fb6('0x2d')){_0x1d5814[util['format'](_0x2fb6('0x2e'),'XMD-',_[_0x2fb6('0x2f')](_0x464e6f))]=_0x4a656f[_0x2fb6('0x2a')][_0x464e6f];}}}}return _0x1d5814;};exports[_0x2fb6('0x30')]=function(_0x2c1a6d){var _0x58278f={};for(var _0xde367b in _0x2c1a6d){if(_0x2c1a6d['hasOwnProperty'](_0xde367b)){_0x58278f[util['format']('%s',_['toLower'](_0xde367b))]=_0x2c1a6d[_0xde367b];}}return{'variables':_0x58278f};};exports[_0x2fb6('0x31')]=function(_0x4c3657,_0x24aec8){if(!_[_0x2fb6('0x32')](_0x4c3657)){if(_0x4c3657[_0x2fb6('0x2b')](_0x2fb6('0x33'))){if(_0x4c3657[_0x2fb6('0x33')]>0x0){_0x4c3657[_0x2fb6('0x33')]-=0x1;}else{logger['error'](_0x2fb6('0x34'),_0x24aec8);}}}else{logger[_0x2fb6('0x35')](_0x2fb6('0x36'),_0x24aec8);}};exports[_0x2fb6('0x37')]=function(_0x38448a){var _0x406dde=moment()['format'](_0x2fb6('0x38'));_0x38448a[_0x2fb6('0x39')]=0xd;_0x38448a[_0x2fb6('0x3a')]=_0x2fb6('0x3b');_0x38448a[_0x2fb6('0x3c')]=_0x406dde;_0x38448a[_0x2fb6('0x3d')]=_0x406dde;_0x38448a[_0x2fb6('0x3e')]=_0x406dde;};exports[_0x2fb6('0x3f')]=function(_0x476c75,_0x3f70b0,_0x18a290){var _0xa6a4b4=moment()['format'](_0x2fb6('0x38'));_0x476c75[_0x2fb6('0x39')]=_0x3f70b0;_0x476c75[_0x2fb6('0x3a')]=_0x18a290;_0x476c75['responsetime']=_0xa6a4b4;_0x476c75[_0x2fb6('0x40')]=getSeconds(_0x476c75[_0x2fb6('0x3d')],_0x476c75['starttime']);};exports[_0x2fb6('0x41')]=function(_0x3a9be8,_0x4b676f,_0x5bd5ba){_0x3a9be8[_0x2fb6('0x42')]=_0x4b676f;_0x3a9be8[_0x2fb6('0x43')]=_0x5bd5ba;};exports[_0x2fb6('0x44')]=function(_0x5a366e,_0x647d9b,_0x178e4b){var _0x31f94c=moment()['format'](_0x2fb6('0x38'));_0x5a366e[_0x2fb6('0x39')]=_0x647d9b;_0x5a366e[_0x2fb6('0x3a')]=_0x178e4b;_0x5a366e[_0x2fb6('0x3d')]=_0x5a366e[_0x2fb6('0x3d')]?_0x5a366e['responsetime']:_0x31f94c;_0x5a366e['endtime']=_0x5a366e[_0x2fb6('0x3e')]?_0x5a366e[_0x2fb6('0x3e')]:_0x31f94c;_0x5a366e[_0x2fb6('0x40')]=getSeconds(_0x5a366e[_0x2fb6('0x3d')]||0x0,_0x5a366e['starttime']||0x0);_0x5a366e[_0x2fb6('0x45')]=_0x5a366e[_0x2fb6('0x46')]?getSeconds(_0x5a366e[_0x2fb6('0x3e')],_0x5a366e[_0x2fb6('0x46')]):0x0;};exports[_0x2fb6('0x47')]=function(_0xb0d0d){return _0xb0d0d===_0x2fb6('0x48');};exports[_0x2fb6('0x49')]=function(_0x1f1e58,_0x17e704,_0x4919e9,_0x373601,_0x3aeb18){var _0x4957eb=_0x373601?_0x2fb6('0x4a'):_0x1f1e58[_0x2fb6('0x19')];_0x4957eb=_0x3aeb18?'BOOKED':_0x4957eb;return{'actionid':_0x1f1e58[_0x2fb6('0x4b')],'action':'originate','channel':_0x1f1e58[_0x2fb6('0x4c')],'callerid':util[_0x2fb6('0x13')](_0x2fb6('0x14'),_0x4957eb,_0x1f1e58[_0x2fb6('0x1a')]),'Exten':_0x2fb6('0x26'),'Context':_0x2fb6('0x4d'),'Priority':'1','variable':_0x4919e9,'timeout':(_0x17e704[_0x2fb6('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1f1e58['uniqueid']};};exports['totalGlobal']=function(_0x3e59ae){return _0x3e59ae[_0x2fb6('0x4f')]+_0x3e59ae[_0x2fb6('0x50')]+_0x3e59ae[_0x2fb6('0x51')]+_0x3e59ae[_0x2fb6('0x52')]+_0x3e59ae[_0x2fb6('0x53')];};exports[_0x2fb6('0x54')]=function(_0x109257){var _0xce92cf=_[_0x2fb6('0x55')](_0x109257);_0xce92cf[_0x2fb6('0x39')]=0xf;_0xce92cf[_0x2fb6('0x3a')]=_0x2fb6('0x56');return _0xce92cf;};exports[_0x2fb6('0x57')]=function(_0x161e4b,_0x474f85,_0x4e7fe9){var _0xe2c2fc={};_0xe2c2fc[_0x474f85]=_0x161e4b[_0x474f85];_0xe2c2fc['active']=![];_0xe2c2fc[_0x2fb6('0x58')]=moment()[_0x2fb6('0x59')](_0x4e7fe9,_0x2fb6('0x5a'))[_0x2fb6('0x13')](_0x2fb6('0x38'));_0xe2c2fc[_0x2fb6('0x1b')]=_0x161e4b[_0x2fb6('0x1b')];_0xe2c2fc[_0x2fb6('0x5b')]=_0x161e4b[_0x2fb6('0x5b')];_0xe2c2fc[_0x2fb6('0x1d')]=_0x161e4b[_0x2fb6('0x1d')]||undefined;return _0xe2c2fc;};exports[_0x2fb6('0x5c')]=function(_0x229629,_0x1e8772){if(!_[_0x2fb6('0x32')](_0x229629)){if(_0x229629['pTalking']>0x0){_0x229629[_0x2fb6('0x5d')]-=0x1;}else{logger[_0x2fb6('0x35')](_0x1e8772,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2fb6('0x35')](_0x1e8772,_0x2fb6('0x5e'));}};exports[_0x2fb6('0x5f')]=function(_0x35a932){if(_0x35a932<=0x0){return!![];}return![];};exports[_0x2fb6('0x60')]=function(_0x484f4b,_0xdccc56,_0x4334cc){_0x484f4b[_0x2fb6('0x61')]=_0xdccc56;_0x484f4b[_0x2fb6('0x62')]=_0x484f4b[_0x2fb6('0x63')];_0x484f4b[_0x2fb6('0x64')]=_0x484f4b['channelAgent'];if(_0x4334cc){_0x484f4b[_0x2fb6('0x65')]=_0x4334cc[_0x2fb6('0x65')];}return _0x484f4b;};exports['buildAcw']=function(_0x23c2c2){var _0x50ec20={};_0x50ec20[_0x2fb6('0x63')]=_0x23c2c2['queue'];_0x50ec20['interface']=_0x23c2c2[_0x2fb6('0x4c')];_0x50ec20['uniqueid']=_0x23c2c2[_0x2fb6('0x4b')];return _0x50ec20;};exports[_0x2fb6('0x66')]=function(_0x53801c){var _0x5073d8=[];for(var _0x45fa69 in _0x53801c){if(_0x53801c[_0x2fb6('0x2b')](_0x45fa69)){if(!_[_0x2fb6('0x32')](_0x53801c[_0x45fa69])&&_0x53801c[_0x45fa69][_0x2fb6('0x39')]===_0x2fb6('0x67')&&_0x53801c[_0x45fa69]['status']===_0x2fb6('0x68')){_0x5073d8[_0x2fb6('0x69')](_0x53801c[_0x45fa69]['id']);}}}return _0x5073d8;};exports[_0x2fb6('0x6a')]=function(_0x33dcce){var _0xee697d=moment()[_0x2fb6('0x5')](0x0);var _0x383bb1=moment(_0x33dcce)[_0x2fb6('0x5')](0x0);return _0xee697d[_0x2fb6('0x6')](_0x383bb1,_0x2fb6('0x7'));};exports[_0x2fb6('0x6b')]=function(_0x5166c7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5166c7[_0x2fb6('0x1b')],'ListId':_0x5166c7[_0x2fb6('0x5b')],'VoiceQueueId':_0x5166c7[_0x2fb6('0x1d')]||undefined,'CampaignId':_0x5166c7[_0x2fb6('0x6c')]||undefined};};exports[_0x2fb6('0x6d')]=function(_0x37bf43){if(_0x37bf43===_0x2fb6('0x4b')||_0x37bf43==='idContact'||_0x37bf43===_0x2fb6('0x63')||_0x37bf43===_0x2fb6('0x6e')||_0x37bf43==='campaigntype'||_0x37bf43===_0x2fb6('0x6f')||_0x37bf43==='membername'||_0x37bf43==='channelAgent'||_0x37bf43===_0x2fb6('0x19')||_0x37bf43===_0x2fb6('0x70')||_0x37bf43===_0x2fb6('0x1a')||_0x37bf43==='scheduledat'||_0x37bf43==='countbusyretry'||_0x37bf43===_0x2fb6('0x50')||_0x37bf43===_0x2fb6('0x51')||_0x37bf43===_0x2fb6('0x71')||_0x37bf43===_0x2fb6('0x72')||_0x37bf43==='callbackuniqueid'||_0x37bf43===_0x2fb6('0x73')||_0x37bf43===_0x2fb6('0x74')||_0x37bf43===_0x2fb6('0x1b')||_0x37bf43===_0x2fb6('0x5b')||_0x37bf43==='UserId'||_0x37bf43===_0x2fb6('0x1d')||_0x37bf43===_0x2fb6('0x75')||_0x37bf43==='xmd-voicequeueid'||_0x37bf43===_0x2fb6('0x76')||_0x37bf43===_0x2fb6('0x77')||_0x37bf43===_0x2fb6('0x78')||_0x37bf43===_0x2fb6('0x79')||_0x37bf43==='xmd-dialtimeout'||_0x37bf43===_0x2fb6('0x7a')||_0x37bf43===_0x2fb6('0x7b')||_0x37bf43==='xmd-dialchannel'||_0x37bf43===_0x2fb6('0x7c')||_0x37bf43===_0x2fb6('0x7d')||_0x37bf43===_0x2fb6('0x7e')||_0x37bf43==='xmd-agiafter'||_0x37bf43===_0x2fb6('0x7f')||_0x37bf43===_0x2fb6('0x80')||_0x37bf43===_0x2fb6('0x81')||_0x37bf43===_0x2fb6('0x82')||_0x37bf43===_0x2fb6('0x83')||_0x37bf43===_0x2fb6('0x84')||_0x37bf43==='rtpaudioqoslossbridged'||_0x37bf43==='rtpaudioqosrtt'||_0x37bf43===_0x2fb6('0x85')||_0x37bf43===_0x2fb6('0x80')||_0x37bf43===_0x2fb6('0x81')||_0x37bf43===_0x2fb6('0x82')||_0x37bf43==='rtpaudioqosjitterbridged'||_0x37bf43===_0x2fb6('0x84')||_0x37bf43===_0x2fb6('0x86')||_0x37bf43===_0x2fb6('0x87')||_0x37bf43==='rtpaudioqosrttbridged'||_0x37bf43==='bridgepeer'||_0x37bf43===_0x2fb6('0x88')||_0x37bf43===_0x2fb6('0x39')||_0x37bf43===_0x2fb6('0x3a')){return![];}return!![];};exports[_0x2fb6('0x89')]=function(_0x372ec2,_0x36e8df){var _0x7fffd5,_0x462fbe,_0x3d0b6c;if(_0x36e8df<=0x0){_0x36e8df=0x1;}_0x7fffd5=new RegExp(_0x2fb6('0x8a')+_0x36e8df+'}$');_0x462fbe=Math[_0x2fb6('0x8b')](0xa,_0x36e8df-0x1);_0x3d0b6c=Math[_0x2fb6('0x8b')](0xa,_0x36e8df)-0x1;return util['format']('%s',_[_0x2fb6('0x8c')](_0x372ec2,_0x7fffd5,_[_0x2fb6('0x8d')](_0x462fbe,_0x3d0b6c)));};exports[_0x2fb6('0x8e')]=function(_0x20c4a2){var _0x4ec86f=_0x20c4a2[_0x2fb6('0x8f')](/"(.*?)"/);return _0x4ec86f?_0x4ec86f[0x1]:_0x20c4a2;};exports[_0x2fb6('0x90')]=function(_0x4b75c5){var _0x3046ed=_0x4b75c5['match'](/<(.*?)>/);return _0x3046ed?_0x3046ed[0x1]:_0x4b75c5;};
\ No newline at end of file
+var _0xffb6=['\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','endtime','logAgent','ringtime','responsetime','logLookAgent','UserId','logCustomer','state','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledat','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','buildObj','mandatoryDisposition','queue','interface','not_inuse','status','reachable','createBody','CampaignId','filterKey','idContact','dialAnswer','membername','calleridname','active','countglobal','callback','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-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepvtcallid','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','error','message','getCallerId','string','isUndefined','isEmpty','format'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xffb6,0x78));var _0x6ffb=function(_0x33e38f,_0xceae9d){_0x33e38f=_0x33e38f-0x0;var _0x4b4b0b=_0xffb6[_0x33e38f];return _0x4b4b0b;};'use strict';var util=require(_0x6ffb('0x0'));var _=require(_0x6ffb('0x1'));var moment=require(_0x6ffb('0x2'));var logger=require('../../../../config/logger')(_0x6ffb('0x3'));var ipAgi=process[_0x6ffb('0x4')][_0x6ffb('0x5')]||_0x6ffb('0x6');function getSeconds(_0x1ba22b,_0x52f665){var _0x4eb953=moment(_0x1ba22b)[_0x6ffb('0x7')](0x0);var _0xe4e2b5=moment(_0x52f665)[_0x6ffb('0x7')](0x0);return _0x4eb953[_0x6ffb('0x8')](_0xe4e2b5,_0x6ffb('0x9'));}exports[_0x6ffb('0xa')]=function(_0x5d77e2){return function(_0x15fc11){logger['error'](_0x5d77e2,util[_0x6ffb('0xb')](_0x15fc11,{'showHidden':![],'depth':null}));};};exports[_0x6ffb('0xc')]=function(_0x55da79,_0xd4b149){logger[_0x6ffb('0xd')](_0x55da79,util[_0x6ffb('0xb')](_0xd4b149,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3bd091,_0x295a4){logger[_0x6ffb('0xe')](_0x3bd091,util['inspect'](_0x295a4,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4a6609){return function(_0x58577b){logger[_0x6ffb('0xd')](_0x4a6609,util['inspect'](_0x58577b,{'showHidden':![],'depth':null}));};};exports[_0x6ffb('0xf')]=function(_0x16d3fc,_0x376fdb,_0x4af8fb){return{'message':_0x16d3fc,'unlock':_0x376fdb,'active':_0x4af8fb};};exports[_0x6ffb('0x10')]=function(_0x3e2c40,_0x21ca07,_0x2484b1){if(!_['isUndefined'](_0x2484b1)&&_0x6ffb('0x11')===typeof _0x2484b1&&!_['isEmpty'](_0x2484b1)){if(!_[_0x6ffb('0x12')](_0x21ca07)&&_0x6ffb('0x11')===typeof _0x21ca07&&!_[_0x6ffb('0x13')](_0x21ca07)){return util[_0x6ffb('0x14')](_0x6ffb('0x15'),_0x21ca07,_0x2484b1);}return util['format'](_0x6ffb('0x15'),_0x2484b1,_0x2484b1);}if(!_[_0x6ffb('0x12')](_0x3e2c40)&&_0x6ffb('0x11')===typeof _0x3e2c40&&!_[_0x6ffb('0x13')](_0x3e2c40)){return _0x3e2c40;}return _0x6ffb('0x16');};exports[_0x6ffb('0x17')]=function(_0x14481a){if(_[_0x6ffb('0x18')](_0x14481a)){return![];}return _0x14481a;};exports[_0x6ffb('0x19')]=function(_0x3cd4dc,_0xb0cd40,_0x4a12bc,_0x5910ea,_0x1341e6,_0x2938a7){var _0x2769ff={'XMD-QUEUE':_0xb0cd40[_0x6ffb('0x1a')]?_0xb0cd40[_0x6ffb('0x1a')][_0x6ffb('0x1b')]:'','XMD-CALLERID':_0x5910ea,'XMD-CALLERID-PREVIEW':_0x2938a7?util['format'](_0x6ffb('0x15'),_0x2938a7['calleridname'],_0x2938a7[_0x6ffb('0x1c')]):_0x5910ea,'XMD-DIALID':_0x1341e6,'XMD-CONTACTID':_0xb0cd40[_0x6ffb('0x1d')],'XMD-CDRTYPE':_0x6ffb('0x1e'),'CALLERID(all)':_0x5910ea,'XMD-VOICEQUEUEID':_0xb0cd40[_0x6ffb('0x1f')],'XMD-DIALCHANNEL':_0x4a12bc,'XMD-DIALTIMEOUT':_0x3cd4dc[_0x6ffb('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x6ffb('0x14')](_0x6ffb('0x21'),_0x3cd4dc[_0x6ffb('0x22')]?'g':'',_[_0x6ffb('0x13')](_0x3cd4dc[_0x6ffb('0x23')])?'':_0x6ffb('0x24')),'XMD-DIALURL':_0x3cd4dc[_0x6ffb('0x25')]||'','XMD-AGI':_0x3cd4dc[_0x6ffb('0x26')]?util[_0x6ffb('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3cd4dc[_0x6ffb('0x26')]):'NONE','XMD-AGIAFTER':_0x3cd4dc[_0x6ffb('0x22')]?util[_0x6ffb('0x14')](_0x6ffb('0x27'),ipAgi,_0x3cd4dc[_0x6ffb('0x22')]):_0x6ffb('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x2938a7?_0x2938a7['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2938a7?_0x2938a7['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x6ffb('0x13')](_0x3cd4dc[_0x6ffb('0x23')])){_0x2769ff[util[_0x6ffb('0x14')]('%s',_0x6ffb('0x29'))]=_0x3cd4dc['monitor_format'];_0x2769ff[util[_0x6ffb('0x14')]('%s',_0x6ffb('0x2a'))]=_0x1341e6;}if(_0xb0cd40&&_0xb0cd40[_0x6ffb('0x2b')]){for(var _0x4addee in _0xb0cd40[_0x6ffb('0x2b')]){if(_0xb0cd40['Contact'][_0x6ffb('0x2c')](_0x4addee)){if(!_[_0x6ffb('0x18')](_0xb0cd40[_0x6ffb('0x2b')][_0x4addee])&&_0x4addee!=='id'&&_0x4addee!==_0x6ffb('0x2d')&&_0x4addee!=='createdAt'&&_0x4addee!==_0x6ffb('0x2e')){_0x2769ff[util['format'](_0x6ffb('0x2f'),_0x6ffb('0x30'),_['toUpper'](_0x4addee))]=_0xb0cd40[_0x6ffb('0x2b')][_0x4addee];}}}}return _0x2769ff;};exports[_0x6ffb('0x31')]=function(_0x3aa0cc){var _0x4f68c5={};for(var _0x34fc58 in _0x3aa0cc){if(_0x3aa0cc['hasOwnProperty'](_0x34fc58)){_0x4f68c5[util[_0x6ffb('0x14')]('%s',_['toLower'](_0x34fc58))]=_0x3aa0cc[_0x34fc58];}}return{'variables':_0x4f68c5};};exports[_0x6ffb('0x32')]=function(_0xe956d0,_0x5ef4ad){if(!_[_0x6ffb('0x18')](_0xe956d0)){if(_0xe956d0[_0x6ffb('0x2c')](_0x6ffb('0x33'))){if(_0xe956d0['originated']>0x0){_0xe956d0[_0x6ffb('0x33')]-=0x1;}else{logger[_0x6ffb('0xe')](_0x6ffb('0x34'),_0x5ef4ad);}}}else{logger[_0x6ffb('0xe')](_0x6ffb('0x35'),_0x5ef4ad);}};exports[_0x6ffb('0x36')]=function(_0x38215d){var _0x52dbd4=moment()[_0x6ffb('0x14')](_0x6ffb('0x37'));_0x38215d['state']=0xd;_0x38215d[_0x6ffb('0x38')]='Blacklist';_0x38215d[_0x6ffb('0x39')]=_0x52dbd4;_0x38215d['responsetime']=_0x52dbd4;_0x38215d[_0x6ffb('0x3a')]=_0x52dbd4;};exports[_0x6ffb('0x3b')]=function(_0x2ba12e,_0x4f0ffc,_0x247d9c){var _0x18fdf8=moment()['format'](_0x6ffb('0x37'));_0x2ba12e['state']=_0x4f0ffc;_0x2ba12e[_0x6ffb('0x38')]=_0x247d9c;_0x2ba12e['responsetime']=_0x18fdf8;_0x2ba12e[_0x6ffb('0x3c')]=getSeconds(_0x2ba12e[_0x6ffb('0x3d')],_0x2ba12e['starttime']);};exports[_0x6ffb('0x3e')]=function(_0x33bc26,_0x1b4849,_0x15a971){_0x33bc26['membername']=_0x1b4849;_0x33bc26[_0x6ffb('0x3f')]=_0x15a971;};exports[_0x6ffb('0x40')]=function(_0x2eb4ac,_0x1c4df8,_0x1d05d3){var _0x533269=moment()['format'](_0x6ffb('0x37'));_0x2eb4ac[_0x6ffb('0x41')]=_0x1c4df8;_0x2eb4ac[_0x6ffb('0x38')]=_0x1d05d3;_0x2eb4ac[_0x6ffb('0x3d')]=_0x2eb4ac['responsetime']?_0x2eb4ac[_0x6ffb('0x3d')]:_0x533269;_0x2eb4ac[_0x6ffb('0x3a')]=_0x2eb4ac['endtime']?_0x2eb4ac[_0x6ffb('0x3a')]:_0x533269;_0x2eb4ac[_0x6ffb('0x3c')]=getSeconds(_0x2eb4ac[_0x6ffb('0x3d')]||0x0,_0x2eb4ac[_0x6ffb('0x39')]||0x0);_0x2eb4ac[_0x6ffb('0x42')]=_0x2eb4ac[_0x6ffb('0x43')]?getSeconds(_0x2eb4ac[_0x6ffb('0x3a')],_0x2eb4ac[_0x6ffb('0x43')]):0x0;};exports[_0x6ffb('0x44')]=function(_0x1e77ba){return _0x1e77ba===_0x6ffb('0x45');};exports['variablesAction']=function(_0x5c5624,_0x46cde3,_0x4be2eb,_0x465aa2,_0x388543){var _0x364514=_0x465aa2?_0x6ffb('0x46'):_0x5c5624['calleridname'];_0x364514=_0x388543?_0x6ffb('0x47'):_0x364514;return{'actionid':_0x5c5624[_0x6ffb('0x48')],'action':_0x6ffb('0x49'),'channel':_0x5c5624[_0x6ffb('0x4a')],'callerid':util[_0x6ffb('0x14')](_0x6ffb('0x15'),_0x364514,_0x5c5624[_0x6ffb('0x1c')]),'Exten':_0x6ffb('0x4b'),'Context':_0x6ffb('0x4c'),'Priority':'1','variable':_0x4be2eb,'timeout':(_0x46cde3[_0x6ffb('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5c5624[_0x6ffb('0x48')]};};exports[_0x6ffb('0x4e')]=function(_0x1a6616){return _0x1a6616[_0x6ffb('0x4f')]+_0x1a6616[_0x6ffb('0x50')]+_0x1a6616[_0x6ffb('0x51')]+_0x1a6616[_0x6ffb('0x52')]+_0x1a6616[_0x6ffb('0x53')];};exports['cloneAction']=function(_0x51eee0){var _0x383847=_[_0x6ffb('0x54')](_0x51eee0);_0x383847[_0x6ffb('0x41')]=0xf;_0x383847[_0x6ffb('0x38')]=_0x6ffb('0x55');return _0x383847;};exports['scheduledAt']=function(_0x692f44,_0x49afa7,_0x521f5f){var _0x232eb9={};_0x232eb9[_0x49afa7]=_0x692f44[_0x49afa7];_0x232eb9['active']=![];_0x232eb9[_0x6ffb('0x56')]=moment()['add'](_0x521f5f,_0x6ffb('0x57'))[_0x6ffb('0x14')](_0x6ffb('0x37'));_0x232eb9[_0x6ffb('0x1d')]=_0x692f44['ContactId'];_0x232eb9['ListId']=_0x692f44[_0x6ffb('0x58')];_0x232eb9['VoiceQueueId']=_0x692f44[_0x6ffb('0x1f')]||undefined;return _0x232eb9;};exports[_0x6ffb('0x59')]=function(_0x36548f,_0x22c53b){if(!_[_0x6ffb('0x18')](_0x36548f)){if(_0x36548f[_0x6ffb('0x5a')]>0x0){_0x36548f[_0x6ffb('0x5a')]-=0x1;}else{logger['error'](_0x22c53b,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x6ffb('0xe')](_0x22c53b,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x6ffb('0x5b')]=function(_0x40c5f1){if(_0x40c5f1<=0x0){return!![];}return![];};exports[_0x6ffb('0x5c')]=function(_0x5872a1,_0x4669bd,_0xc4c2fd){_0x5872a1['lastevent']=_0x4669bd;_0x5872a1['name']=_0x5872a1['queue'];_0x5872a1['interface']=_0x5872a1[_0x6ffb('0x4a')];if(_0xc4c2fd){_0x5872a1[_0x6ffb('0x5d')]=_0xc4c2fd['mandatoryDisposition'];}return _0x5872a1;};exports['buildAcw']=function(_0x482f64){var _0xd211a={};_0xd211a[_0x6ffb('0x5e')]=_0x482f64[_0x6ffb('0x5e')];_0xd211a[_0x6ffb('0x5f')]=_0x482f64[_0x6ffb('0x4a')];_0xd211a['uniqueid']=_0x482f64[_0x6ffb('0x48')];return _0xd211a;};exports['agentReadyId']=function(_0x160821){var _0x27cfce=[];for(var _0x368095 in _0x160821){if(_0x160821['hasOwnProperty'](_0x368095)){if(!_[_0x6ffb('0x18')](_0x160821[_0x368095])&&_0x160821[_0x368095]['state']===_0x6ffb('0x60')&&_0x160821[_0x368095][_0x6ffb('0x61')]===_0x6ffb('0x62')){_0x27cfce['push'](_0x160821[_0x368095]['id']);}}}return _0x27cfce;};exports['getDiff']=function(_0x465f09){var _0x2ff3dc=moment()[_0x6ffb('0x7')](0x0);var _0x5deff9=moment(_0x465f09)[_0x6ffb('0x7')](0x0);return _0x2ff3dc['diff'](_0x5deff9,_0x6ffb('0x9'));};exports[_0x6ffb('0x63')]=function(_0x7857fa){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x7857fa[_0x6ffb('0x1d')],'ListId':_0x7857fa[_0x6ffb('0x58')],'VoiceQueueId':_0x7857fa[_0x6ffb('0x1f')]||undefined,'CampaignId':_0x7857fa[_0x6ffb('0x64')]||undefined};};exports[_0x6ffb('0x65')]=function(_0x28176c){if(_0x28176c===_0x6ffb('0x48')||_0x28176c===_0x6ffb('0x66')||_0x28176c===_0x6ffb('0x5e')||_0x28176c==='type'||_0x28176c==='campaigntype'||_0x28176c===_0x6ffb('0x67')||_0x28176c===_0x6ffb('0x68')||_0x28176c==='channelAgent'||_0x28176c===_0x6ffb('0x69')||_0x28176c===_0x6ffb('0x6a')||_0x28176c==='calleridnum'||_0x28176c===_0x6ffb('0x56')||_0x28176c===_0x6ffb('0x4f')||_0x28176c===_0x6ffb('0x50')||_0x28176c===_0x6ffb('0x51')||_0x28176c===_0x6ffb('0x6b')||_0x28176c===_0x6ffb('0x6c')||_0x28176c===_0x6ffb('0x6d')||_0x28176c===_0x6ffb('0x6e')||_0x28176c===_0x6ffb('0x6f')||_0x28176c===_0x6ffb('0x1d')||_0x28176c===_0x6ffb('0x58')||_0x28176c===_0x6ffb('0x3f')||_0x28176c===_0x6ffb('0x1f')||_0x28176c===_0x6ffb('0x70')||_0x28176c===_0x6ffb('0x71')||_0x28176c===_0x6ffb('0x72')||_0x28176c===_0x6ffb('0x73')||_0x28176c===_0x6ffb('0x74')||_0x28176c===_0x6ffb('0x75')||_0x28176c===_0x6ffb('0x76')||_0x28176c===_0x6ffb('0x77')||_0x28176c===_0x6ffb('0x78')||_0x28176c===_0x6ffb('0x79')||_0x28176c===_0x6ffb('0x7a')||_0x28176c===_0x6ffb('0x7b')||_0x28176c===_0x6ffb('0x7c')||_0x28176c===_0x6ffb('0x7d')||_0x28176c===_0x6ffb('0x7e')||_0x28176c===_0x6ffb('0x7f')||_0x28176c==='rtpaudioqosbridged'||_0x28176c==='rtpaudioqosjitter'||_0x28176c===_0x6ffb('0x80')||_0x28176c===_0x6ffb('0x81')||_0x28176c===_0x6ffb('0x82')||_0x28176c===_0x6ffb('0x83')||_0x28176c===_0x6ffb('0x84')||_0x28176c===_0x6ffb('0x7f')||_0x28176c==='rtpaudioqosbridged'||_0x28176c===_0x6ffb('0x85')||_0x28176c==='rtpaudioqosjitterbridged'||_0x28176c===_0x6ffb('0x81')||_0x28176c===_0x6ffb('0x82')||_0x28176c==='rtpaudioqosrtt'||_0x28176c===_0x6ffb('0x84')||_0x28176c==='bridgepeer'||_0x28176c===_0x6ffb('0x86')||_0x28176c===_0x6ffb('0x41')||_0x28176c===_0x6ffb('0x38')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x246bbc,_0xf2fa0e){var _0x5aa4a2,_0x2ce36f,_0x5a4ea9;if(_0xf2fa0e<=0x0){_0xf2fa0e=0x1;}_0x5aa4a2=new RegExp(_0x6ffb('0x87')+_0xf2fa0e+'}$');_0x2ce36f=Math[_0x6ffb('0x88')](0xa,_0xf2fa0e-0x1);_0x5a4ea9=Math[_0x6ffb('0x88')](0xa,_0xf2fa0e)-0x1;return util[_0x6ffb('0x14')]('%s',_[_0x6ffb('0x89')](_0x246bbc,_0x5aa4a2,_[_0x6ffb('0x8a')](_0x2ce36f,_0x5a4ea9)));};exports['extractCalleridName']=function(_0x37e8ed){var _0xf805f9=_0x37e8ed[_0x6ffb('0x8b')](/"(.*?)"/);return _0xf805f9?_0xf805f9[0x1]:_0x37e8ed;};exports[_0x6ffb('0x8c')]=function(_0x2b76a6){var _0xaf4e02=_0x2b76a6['match'](/<(.*?)>/);return _0xaf4e02?_0xaf4e02[0x1]:_0x2b76a6;};
\ No newline at end of file