Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / services / ami / preview / util / util.js
index 15b84df..8ac34a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfa1=['logger','info','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','starttime','responsetime','state','statedesc','ringtime','logLookAgent','membername','UserId','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','calleridnum','xcally-motion-preview','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','motionChannel','mandatoryDisposition','not_inuse','reachable','push','getDiff','createBody','CampaignId','filterKey','type','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect'];(function(_0x3cd1d2,_0x1efd2d){var _0x3f9526=function(_0x542dfa){while(--_0x542dfa){_0x3cd1d2['push'](_0x3cd1d2['shift']());}};_0x3f9526(++_0x1efd2d);}(_0xbfa1,0x85));var _0x1bfa=function(_0x2c94c0,_0x5cd382){_0x2c94c0=_0x2c94c0-0x0;var _0x54ab57=_0xbfa1[_0x2c94c0];return _0x54ab57;};'use strict';var util=require(_0x1bfa('0x0'));var _=require(_0x1bfa('0x1'));var moment=require(_0x1bfa('0x2'));var logger=require(_0x1bfa('0x3'))('preview');var ipAgi=process[_0x1bfa('0x4')][_0x1bfa('0x5')]||_0x1bfa('0x6');function getSeconds(_0x439149,_0x344f90){var _0x3e5dbb=moment(_0x439149)[_0x1bfa('0x7')](0x0);var _0x18b3b8=moment(_0x344f90)['milliseconds'](0x0);return _0x3e5dbb[_0x1bfa('0x8')](_0x18b3b8,_0x1bfa('0x9'));}exports[_0x1bfa('0xa')]=function(_0x4ec4f4){return function(_0x200827){logger[_0x1bfa('0xb')](_0x4ec4f4,util[_0x1bfa('0xc')](_0x200827,{'showHidden':![],'depth':null}));};};exports[_0x1bfa('0xd')]=function(_0x2cd3f0,_0x2235e8){logger[_0x1bfa('0xe')](_0x2cd3f0,util['inspect'](_0x2235e8,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xa3009a,_0x40aa66){logger[_0x1bfa('0xb')](_0xa3009a,util['inspect'](_0x40aa66,{'showHidden':![],'depth':null}));};exports[_0x1bfa('0xf')]=function(_0x3613c){return function(_0x4fbd88){logger[_0x1bfa('0xe')](_0x3613c,util['inspect'](_0x4fbd88,{'showHidden':![],'depth':null}));};};exports[_0x1bfa('0x10')]=function(_0x25564e,_0x1802b1,_0x468c8b){return{'message':_0x25564e,'unlock':_0x1802b1,'active':_0x468c8b};};exports[_0x1bfa('0x11')]=function(_0x40c4fd,_0x403a80,_0x158f7){if(!_['isUndefined'](_0x158f7)&&_0x1bfa('0x12')===typeof _0x158f7&&!_[_0x1bfa('0x13')](_0x158f7)){if(!_[_0x1bfa('0x14')](_0x403a80)&&'string'===typeof _0x403a80&&!_['isEmpty'](_0x403a80)){return util[_0x1bfa('0x15')]('\x22%s\x22\x20<%s>',_0x403a80,_0x158f7);}return util[_0x1bfa('0x15')](_0x1bfa('0x16'),_0x158f7,_0x158f7);}if(!_[_0x1bfa('0x14')](_0x40c4fd)&&_0x1bfa('0x12')===typeof _0x40c4fd&&!_[_0x1bfa('0x13')](_0x40c4fd)){return _0x40c4fd;}return _0x1bfa('0x17');};exports[_0x1bfa('0x18')]=function(_0x191ff1){if(_[_0x1bfa('0x19')](_0x191ff1)){return![];}return _0x191ff1;};exports[_0x1bfa('0x1a')]=function(_0x3f0958,_0x349041,_0x2e2075,_0x4fbf61,_0x3857a4,_0x59aac3){var _0x4b6e5e={'XMD-QUEUE':_0x349041[_0x1bfa('0x1b')]?_0x349041[_0x1bfa('0x1b')][_0x1bfa('0x1c')]:'','XMD-CALLERID':_0x4fbf61,'XMD-CALLERID-PREVIEW':_0x59aac3?util[_0x1bfa('0x15')]('\x22%s\x22\x20<%s>',_0x59aac3[_0x1bfa('0x1d')],_0x59aac3['calleridnum']):_0x4fbf61,'XMD-DIALID':_0x3857a4,'XMD-CONTACTID':_0x349041[_0x1bfa('0x1e')],'XMD-CDRTYPE':_0x1bfa('0x1f'),'CALLERID(all)':_0x4fbf61,'XMD-VOICEQUEUEID':_0x349041[_0x1bfa('0x20')],'XMD-DIALCHANNEL':_0x2e2075,'XMD-DIALTIMEOUT':_0x3f0958[_0x1bfa('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0x1bfa('0x15')](_0x1bfa('0x22'),_0x3f0958[_0x1bfa('0x23')]?'g':'',_[_0x1bfa('0x13')](_0x3f0958[_0x1bfa('0x24')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3f0958[_0x1bfa('0x25')]||'','XMD-AGI':_0x3f0958['dialQueueProject']?util[_0x1bfa('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3f0958[_0x1bfa('0x26')]):_0x1bfa('0x27'),'XMD-AGIAFTER':_0x3f0958[_0x1bfa('0x23')]?util[_0x1bfa('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3f0958[_0x1bfa('0x23')]):_0x1bfa('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x59aac3?_0x59aac3[_0x1bfa('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x59aac3?_0x59aac3[_0x1bfa('0x29')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x1bfa('0x2a')};if(!_[_0x1bfa('0x13')](_0x3f0958['monitor_format'])){_0x4b6e5e[util[_0x1bfa('0x15')]('%s',_0x1bfa('0x2b'))]=_0x3f0958[_0x1bfa('0x24')];_0x4b6e5e[util[_0x1bfa('0x15')]('%s',_0x1bfa('0x2c'))]=_0x3857a4;}if(_0x349041&&_0x349041[_0x1bfa('0x2d')]){for(var _0x41d1e2 in _0x349041[_0x1bfa('0x2d')]){if(_0x349041[_0x1bfa('0x2d')][_0x1bfa('0x2e')](_0x41d1e2)){if(!_['isNil'](_0x349041['Contact'][_0x41d1e2])&&_0x41d1e2!=='id'&&_0x41d1e2!==_0x1bfa('0x2f')&&_0x41d1e2!==_0x1bfa('0x30')&&_0x41d1e2!=='updatedAt'){_0x4b6e5e[util[_0x1bfa('0x15')](_0x1bfa('0x31'),_0x1bfa('0x32'),_[_0x1bfa('0x33')](_0x41d1e2))]=_0x349041[_0x1bfa('0x2d')][_0x41d1e2];}}}}return _0x4b6e5e;};exports[_0x1bfa('0x34')]=function(_0x320db3){var _0x3cd525={};for(var _0x504245 in _0x320db3){if(_0x320db3['hasOwnProperty'](_0x504245)){_0x3cd525[util['format']('%s',_[_0x1bfa('0x35')](_0x504245))]=_0x320db3[_0x504245];}}return{'variables':_0x3cd525};};exports['updateOriginated']=function(_0x599c8e,_0xebd808){if(!_[_0x1bfa('0x19')](_0x599c8e)){if(_0x599c8e['hasOwnProperty'](_0x1bfa('0x36'))){if(_0x599c8e[_0x1bfa('0x36')]>0x0){_0x599c8e[_0x1bfa('0x36')]-=0x1;}else{logger[_0x1bfa('0xb')](_0x1bfa('0x37'),_0xebd808);}}}else{logger[_0x1bfa('0xb')](_0x1bfa('0x38'),_0xebd808);}};exports[_0x1bfa('0x39')]=function(_0x36368c){var _0x43395a=moment()[_0x1bfa('0x15')](_0x1bfa('0x3a'));_0x36368c['state']=0xd;_0x36368c['statedesc']=_0x1bfa('0x3b');_0x36368c[_0x1bfa('0x3c')]=_0x43395a;_0x36368c[_0x1bfa('0x3d')]=_0x43395a;_0x36368c['endtime']=_0x43395a;};exports['logAgent']=function(_0x55bbb2,_0x1c71b8,_0x1095d0){var _0x16c464=moment()[_0x1bfa('0x15')](_0x1bfa('0x3a'));_0x55bbb2[_0x1bfa('0x3e')]=_0x1c71b8;_0x55bbb2[_0x1bfa('0x3f')]=_0x1095d0;_0x55bbb2[_0x1bfa('0x3d')]=_0x16c464;_0x55bbb2[_0x1bfa('0x40')]=getSeconds(_0x55bbb2[_0x1bfa('0x3d')],_0x55bbb2['starttime']);};exports[_0x1bfa('0x41')]=function(_0x2cdff8,_0x9d11cf,_0x173d52){_0x2cdff8[_0x1bfa('0x42')]=_0x9d11cf;_0x2cdff8[_0x1bfa('0x43')]=_0x173d52;};exports['logCustomer']=function(_0x4d51b5,_0x9b06f2,_0xf303d4){var _0x388d6c=moment()[_0x1bfa('0x15')](_0x1bfa('0x3a'));_0x4d51b5['state']=_0x9b06f2;_0x4d51b5[_0x1bfa('0x3f')]=_0xf303d4;_0x4d51b5[_0x1bfa('0x3d')]=_0x4d51b5[_0x1bfa('0x3d')]?_0x4d51b5[_0x1bfa('0x3d')]:_0x388d6c;_0x4d51b5[_0x1bfa('0x44')]=_0x4d51b5[_0x1bfa('0x44')]?_0x4d51b5['endtime']:_0x388d6c;_0x4d51b5['ringtime']=getSeconds(_0x4d51b5[_0x1bfa('0x3d')]||0x0,_0x4d51b5[_0x1bfa('0x3c')]||0x0);_0x4d51b5[_0x1bfa('0x45')]=_0x4d51b5[_0x1bfa('0x46')]?getSeconds(_0x4d51b5['endtime'],_0x4d51b5['answertime']):0x0;};exports[_0x1bfa('0x47')]=function(_0x325e33){return _0x325e33===_0x1bfa('0x48');};exports[_0x1bfa('0x49')]=function(_0x3ff62a,_0xf459aa,_0x1d7a53,_0x536ae8,_0x23ab37){var _0x370a5e=_0x536ae8?_0x1bfa('0x4a'):_0x3ff62a[_0x1bfa('0x1d')];_0x370a5e=_0x23ab37?_0x1bfa('0x4b'):_0x370a5e;return{'actionid':_0x3ff62a[_0x1bfa('0x4c')],'action':'originate','channel':_0x3ff62a[_0x1bfa('0x4d')],'callerid':util[_0x1bfa('0x15')](_0x1bfa('0x16'),_0x370a5e,_0x3ff62a[_0x1bfa('0x4e')]),'Exten':_0x1bfa('0x4f'),'Context':'from-sip','Priority':'1','variable':_0x1d7a53,'timeout':(_0xf459aa['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3ff62a[_0x1bfa('0x4c')]};};exports[_0x1bfa('0x50')]=function(_0x14b504){return _0x14b504[_0x1bfa('0x51')]+_0x14b504[_0x1bfa('0x52')]+_0x14b504[_0x1bfa('0x53')]+_0x14b504[_0x1bfa('0x54')]+_0x14b504[_0x1bfa('0x55')];};exports['cloneAction']=function(_0x59b3c7){var _0x256c63=_[_0x1bfa('0x56')](_0x59b3c7);_0x256c63[_0x1bfa('0x3e')]=0xf;_0x256c63['statedesc']='Global';return _0x256c63;};exports['scheduledAt']=function(_0x472c3a,_0x24a3b5,_0x167231){var _0x2a8559={};_0x2a8559[_0x24a3b5]=_0x472c3a[_0x24a3b5];_0x2a8559['active']=![];_0x2a8559[_0x1bfa('0x57')]=moment()[_0x1bfa('0x58')](_0x167231,_0x1bfa('0x59'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2a8559[_0x1bfa('0x1e')]=_0x472c3a[_0x1bfa('0x1e')];_0x2a8559[_0x1bfa('0x5a')]=_0x472c3a[_0x1bfa('0x5a')];_0x2a8559['VoiceQueueId']=_0x472c3a['VoiceQueueId']||undefined;return _0x2a8559;};exports[_0x1bfa('0x5b')]=function(_0x43bcd9,_0x409441){if(!_[_0x1bfa('0x19')](_0x43bcd9)){if(_0x43bcd9[_0x1bfa('0x5c')]>0x0){_0x43bcd9['pTalking']-=0x1;}else{logger[_0x1bfa('0xb')](_0x409441,_0x1bfa('0x5d'));}}else{logger['error'](_0x409441,_0x1bfa('0x5e'));}};exports[_0x1bfa('0x5f')]=function(_0x105d23){if(_0x105d23<=0x0){return!![];}return![];};exports[_0x1bfa('0x60')]=function(_0x5a7f46,_0x485899,_0x20e6cd){_0x5a7f46['lastevent']=_0x485899;_0x5a7f46[_0x1bfa('0x1c')]=_0x5a7f46[_0x1bfa('0x61')];_0x5a7f46[_0x1bfa('0x62')]=_0x5a7f46[_0x1bfa('0x4d')];_0x5a7f46[_0x1bfa('0x63')]='voice';if(_0x20e6cd){_0x5a7f46[_0x1bfa('0x64')]=_0x20e6cd['mandatoryDisposition'];}return _0x5a7f46;};exports['buildAcw']=function(_0x1fd04c){var _0x1a77e3={};_0x1a77e3['queue']=_0x1fd04c['queue'];_0x1a77e3[_0x1bfa('0x62')]=_0x1fd04c[_0x1bfa('0x4d')];_0x1a77e3[_0x1bfa('0x4c')]=_0x1fd04c[_0x1bfa('0x4c')];return _0x1a77e3;};exports['agentReadyId']=function(_0x111826){var _0x5735aa=[];for(var _0x31048d in _0x111826){if(_0x111826[_0x1bfa('0x2e')](_0x31048d)){if(!_['isNil'](_0x111826[_0x31048d])&&_0x111826[_0x31048d][_0x1bfa('0x3e')]===_0x1bfa('0x65')&&_0x111826[_0x31048d]['status']===_0x1bfa('0x66')){_0x5735aa[_0x1bfa('0x67')](_0x111826[_0x31048d]['id']);}}}return _0x5735aa;};exports[_0x1bfa('0x68')]=function(_0x5ef2d4){var _0x63a437=moment()[_0x1bfa('0x7')](0x0);var _0x234991=moment(_0x5ef2d4)[_0x1bfa('0x7')](0x0);return _0x63a437[_0x1bfa('0x8')](_0x234991,_0x1bfa('0x9'));};exports[_0x1bfa('0x69')]=function(_0x555228){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x555228['ContactId'],'ListId':_0x555228[_0x1bfa('0x5a')],'VoiceQueueId':_0x555228[_0x1bfa('0x20')]||undefined,'CampaignId':_0x555228[_0x1bfa('0x6a')]||undefined};};exports[_0x1bfa('0x6b')]=function(_0x5412a5){if(_0x5412a5===_0x1bfa('0x4c')||_0x5412a5==='idContact'||_0x5412a5==='queue'||_0x5412a5===_0x1bfa('0x6c')||_0x5412a5==='campaigntype'||_0x5412a5===_0x1bfa('0x6d')||_0x5412a5===_0x1bfa('0x42')||_0x5412a5==='channelAgent'||_0x5412a5===_0x1bfa('0x1d')||_0x5412a5===_0x1bfa('0x6e')||_0x5412a5==='calleridnum'||_0x5412a5===_0x1bfa('0x57')||_0x5412a5===_0x1bfa('0x51')||_0x5412a5==='countcongestionretry'||_0x5412a5===_0x1bfa('0x53')||_0x5412a5===_0x1bfa('0x6f')||_0x5412a5===_0x1bfa('0x70')||_0x5412a5===_0x1bfa('0x71')||_0x5412a5===_0x1bfa('0x72')||_0x5412a5===_0x1bfa('0x73')||_0x5412a5===_0x1bfa('0x1e')||_0x5412a5==='ListId'||_0x5412a5==='UserId'||_0x5412a5==='VoiceQueueId'||_0x5412a5===_0x1bfa('0x74')||_0x5412a5===_0x1bfa('0x75')||_0x5412a5===_0x1bfa('0x76')||_0x5412a5==='xmd-phone'||_0x5412a5===_0x1bfa('0x77')||_0x5412a5===_0x1bfa('0x78')||_0x5412a5===_0x1bfa('0x79')||_0x5412a5===_0x1bfa('0x7a')||_0x5412a5===_0x1bfa('0x7b')||_0x5412a5===_0x1bfa('0x7c')||_0x5412a5===_0x1bfa('0x7d')||_0x5412a5===_0x1bfa('0x7e')||_0x5412a5==='xmd-callerid'||_0x5412a5===_0x1bfa('0x7f')||_0x5412a5===_0x1bfa('0x80')||_0x5412a5==='rtpaudioqos'||_0x5412a5===_0x1bfa('0x81')||_0x5412a5==='rtpaudioqosjitter'||_0x5412a5==='rtpaudioqosjitterbridged'||_0x5412a5==='rtpaudioqosloss'||_0x5412a5===_0x1bfa('0x82')||_0x5412a5===_0x1bfa('0x83')||_0x5412a5===_0x1bfa('0x84')||_0x5412a5===_0x1bfa('0x85')||_0x5412a5==='rtpaudioqosbridged'||_0x5412a5===_0x1bfa('0x86')||_0x5412a5===_0x1bfa('0x87')||_0x5412a5===_0x1bfa('0x88')||_0x5412a5==='rtpaudioqoslossbridged'||_0x5412a5===_0x1bfa('0x83')||_0x5412a5===_0x1bfa('0x84')||_0x5412a5===_0x1bfa('0x89')||_0x5412a5==='bridgepvtcallid'||_0x5412a5==='state'||_0x5412a5===_0x1bfa('0x3f')){return![];}return!![];};exports[_0x1bfa('0x8a')]=function(_0x4ffd82,_0x5daf49){var _0x52b9dc,_0x182b98,_0xda0946;if(_0x5daf49<=0x0){_0x5daf49=0x1;}_0x52b9dc=new RegExp(_0x1bfa('0x8b')+_0x5daf49+'}$');_0x182b98=Math[_0x1bfa('0x8c')](0xa,_0x5daf49-0x1);_0xda0946=Math['pow'](0xa,_0x5daf49)-0x1;return util[_0x1bfa('0x15')]('%s',_[_0x1bfa('0x8d')](_0x4ffd82,_0x52b9dc,_[_0x1bfa('0x8e')](_0x182b98,_0xda0946)));};exports[_0x1bfa('0x8f')]=function(_0x28d975){var _0x3efe23=_0x28d975['match'](/"(.*?)"/);return _0x3efe23?_0x3efe23[0x1]:_0x28d975;};exports[_0x1bfa('0x90')]=function(_0x12e782){var _0x585376=_0x12e782[_0x1bfa('0x91')](/<(.*?)>/);return _0x585376?_0x585376[0x1]:_0x12e782;};
\ No newline at end of file
+var _0x9bb5=['uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','queue','motionChannel','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','push','milliseconds','CampaignId','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','env','XCALLY_IP_AGI','../../dialer/utils','error','logger','info','loggerError','inspect','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','responsetime','getSeconds','starttime','logLookAgent','membername','UserId','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','timeout'];(function(_0x29c86a,_0x52ee0e){var _0x6727e=function(_0x10110a){while(--_0x10110a){_0x29c86a['push'](_0x29c86a['shift']());}};_0x6727e(++_0x52ee0e);}(_0x9bb5,0x1ba));var _0x59bb=function(_0x4c14a7,_0x550e7d){_0x4c14a7=_0x4c14a7-0x0;var _0x563a39=_0x9bb5[_0x4c14a7];return _0x563a39;};'use strict';var util=require(_0x59bb('0x0'));var _=require(_0x59bb('0x1'));var moment=require(_0x59bb('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x59bb('0x3')][_0x59bb('0x4')]||'127.0.0.1';var utils=require(_0x59bb('0x5'));exports['loggerCatch']=function(_0x1ce7c0){return function(_0x26ffb5){logger[_0x59bb('0x6')](_0x1ce7c0,util['inspect'](_0x26ffb5,{'showHidden':![],'depth':null}));};};exports[_0x59bb('0x7')]=function(_0x3ff896,_0x4808f1){logger[_0x59bb('0x8')](_0x3ff896,util['inspect'](_0x4808f1,{'showHidden':![],'depth':null}));};exports[_0x59bb('0x9')]=function(_0x4e854f,_0x3d25a7){logger[_0x59bb('0x6')](_0x4e854f,util[_0x59bb('0xa')](_0x3d25a7,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x102ce7){return function(_0x3ed9ba){logger[_0x59bb('0x8')](_0x102ce7,util[_0x59bb('0xa')](_0x3ed9ba,{'showHidden':![],'depth':null}));};};exports[_0x59bb('0xb')]=function(_0x1fe341,_0x62eff6,_0x2b79ec){return{'message':_0x1fe341,'unlock':_0x62eff6,'active':_0x2b79ec};};exports[_0x59bb('0xc')]=function(_0x3e4535,_0x55806c,_0x11aa8b){if(!_[_0x59bb('0xd')](_0x11aa8b)&&_0x59bb('0xe')===typeof _0x11aa8b&&!_[_0x59bb('0xf')](_0x11aa8b)){if(!_['isUndefined'](_0x55806c)&&'string'===typeof _0x55806c&&!_[_0x59bb('0xf')](_0x55806c)){return util['format']('\x22%s\x22\x20<%s>',_0x55806c,_0x11aa8b);}return util[_0x59bb('0x10')](_0x59bb('0x11'),_0x11aa8b,_0x11aa8b);}if(!_[_0x59bb('0xd')](_0x3e4535)&&_0x59bb('0xe')===typeof _0x3e4535&&!_[_0x59bb('0xf')](_0x3e4535)){return _0x3e4535;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x130e00){if(_[_0x59bb('0x12')](_0x130e00)){return![];}return _0x130e00;};exports[_0x59bb('0x13')]=function(_0x1054f8,_0x3f3c46,_0x55e769,_0xff489f,_0x5f0165,_0x2c7913){var _0x1cb16f={'XMD-QUEUE':_0x3f3c46['Queue']?_0x3f3c46[_0x59bb('0x14')][_0x59bb('0x15')]:'','XMD-CALLERID':_0xff489f,'XMD-CALLERID-PREVIEW':_0x2c7913?util[_0x59bb('0x10')]('\x22%s\x22\x20<%s>',_0x2c7913[_0x59bb('0x16')],_0x2c7913[_0x59bb('0x17')]):_0xff489f,'XMD-DIALID':_0x5f0165,'XMD-CONTACTID':_0x3f3c46['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xff489f,'XMD-VOICEQUEUEID':_0x3f3c46[_0x59bb('0x18')],'XMD-DIALCHANNEL':_0x55e769,'XMD-DIALTIMEOUT':_0x1054f8[_0x59bb('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x59bb('0x1a'),_0x1054f8[_0x59bb('0x1b')]?'g':'',_[_0x59bb('0xf')](_0x1054f8[_0x59bb('0x1c')])?'':_0x59bb('0x1d')),'XMD-DIALURL':_0x1054f8[_0x59bb('0x1e')]||'','XMD-AGI':_0x1054f8[_0x59bb('0x1f')]?util[_0x59bb('0x10')](_0x59bb('0x20'),ipAgi,_0x1054f8[_0x59bb('0x1f')]):_0x59bb('0x21'),'XMD-AGIAFTER':_0x1054f8[_0x59bb('0x1b')]?util[_0x59bb('0x10')](_0x59bb('0x20'),ipAgi,_0x1054f8[_0x59bb('0x1b')]):_0x59bb('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2c7913?_0x2c7913[_0x59bb('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2c7913?_0x2c7913[_0x59bb('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x59bb('0x24')};if(!_['isEmpty'](_0x1054f8['monitor_format'])){_0x1cb16f[util[_0x59bb('0x10')]('%s',_0x59bb('0x25'))]=_0x1054f8['monitor_format'];_0x1cb16f[util[_0x59bb('0x10')]('%s',_0x59bb('0x26'))]=_0x5f0165;}return _0x1cb16f;};exports[_0x59bb('0x27')]=function(_0x574b68){var _0x301fce={};for(var _0x12edb5 in _0x574b68){if(_0x574b68['hasOwnProperty'](_0x12edb5)){_0x301fce[util[_0x59bb('0x10')]('%s',_[_0x59bb('0x28')](_0x12edb5))]=_0x574b68[_0x12edb5];}}return{'variables':_0x301fce};};exports['logBlacklist']=function(_0x44dc82){var _0x34d5ec=moment()['format'](_0x59bb('0x29'));_0x44dc82[_0x59bb('0x2a')]=0xd;_0x44dc82[_0x59bb('0x2b')]='Blacklist';_0x44dc82['starttime']=_0x34d5ec;_0x44dc82['responsetime']=_0x34d5ec;_0x44dc82[_0x59bb('0x2c')]=_0x34d5ec;};exports['logAgent']=function(_0x376de1,_0x40bb9d,_0x2e64d4){var _0x5c9a0b=moment()[_0x59bb('0x10')](_0x59bb('0x29'));_0x376de1['state']=_0x40bb9d;_0x376de1[_0x59bb('0x2b')]=_0x2e64d4;_0x376de1[_0x59bb('0x2d')]=_0x5c9a0b;_0x376de1['ringtime']=utils[_0x59bb('0x2e')](_0x376de1[_0x59bb('0x2d')],_0x376de1[_0x59bb('0x2f')]);};exports[_0x59bb('0x30')]=function(_0x2e6c07,_0x6ccb45,_0x284c13){_0x2e6c07[_0x59bb('0x31')]=_0x6ccb45;_0x2e6c07[_0x59bb('0x32')]=_0x284c13;};exports['logCustomer']=function(_0x103764,_0x4c26a2,_0x41187e){var _0x265c0b=moment()[_0x59bb('0x10')](_0x59bb('0x29'));_0x103764['state']=_0x4c26a2;_0x103764[_0x59bb('0x2b')]=_0x41187e;_0x103764[_0x59bb('0x2d')]=_0x103764[_0x59bb('0x2d')]?_0x103764['responsetime']:_0x265c0b;_0x103764[_0x59bb('0x2c')]=_0x103764[_0x59bb('0x2c')]?_0x103764[_0x59bb('0x2c')]:_0x265c0b;_0x103764['ringtime']=utils[_0x59bb('0x2e')](_0x103764['responsetime']||0x0,_0x103764['starttime']||0x0);_0x103764[_0x59bb('0x33')]=_0x103764[_0x59bb('0x34')]?utils[_0x59bb('0x2e')](_0x103764['endtime'],_0x103764[_0x59bb('0x34')]):0x0;};exports['isFailure']=function(_0x1dbff0){return _0x1dbff0===_0x59bb('0x35');};exports[_0x59bb('0x36')]=function(_0x50bddc,_0x40564e,_0xb79827,_0x3ae977,_0x266821){var _0x3bf272=_0x3ae977?_0x59bb('0x37'):_0x50bddc['calleridname'];_0x3bf272=_0x266821?_0x59bb('0x38'):_0x3bf272;return{'actionid':_0x50bddc['uniqueid'],'action':_0x59bb('0x39'),'channel':_0x50bddc[_0x59bb('0x3a')],'callerid':util[_0x59bb('0x10')](_0x59bb('0x11'),_0x3bf272,_0x50bddc[_0x59bb('0x17')]),'Exten':_0x59bb('0x3b'),'Context':_0x59bb('0x3c'),'Priority':'1','variable':_0xb79827,'timeout':(_0x40564e[_0x59bb('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x50bddc[_0x59bb('0x3e')]};};exports[_0x59bb('0x3f')]=function(_0x6ba3c2){return _0x6ba3c2[_0x59bb('0x40')]+_0x6ba3c2[_0x59bb('0x41')]+_0x6ba3c2[_0x59bb('0x42')]+_0x6ba3c2[_0x59bb('0x43')]+_0x6ba3c2['countnosuchnumberretry'];};exports['cloneAction']=function(_0x254a85){var _0x1d20db=_['clone'](_0x254a85);_0x1d20db[_0x59bb('0x2a')]=0xf;_0x1d20db['statedesc']=_0x59bb('0x44');return _0x1d20db;};exports[_0x59bb('0x45')]=function(_0x50a2cd,_0x325d97,_0x574bf1){var _0x1bfd21={};_0x1bfd21[_0x325d97]=_0x50a2cd[_0x325d97];_0x1bfd21[_0x59bb('0x46')]=![];_0x1bfd21[_0x59bb('0x47')]=moment()['add'](_0x574bf1,_0x59bb('0x48'))[_0x59bb('0x10')](_0x59bb('0x29'));_0x1bfd21[_0x59bb('0x49')]=_0x50a2cd[_0x59bb('0x49')];_0x1bfd21[_0x59bb('0x4a')]=_0x50a2cd[_0x59bb('0x4a')];_0x1bfd21[_0x59bb('0x18')]=_0x50a2cd[_0x59bb('0x18')]||undefined;return _0x1bfd21;};exports[_0x59bb('0x4b')]=function(_0xd9f579,_0xd7fc61){if(!_['isNil'](_0xd9f579)){if(_0xd9f579[_0x59bb('0x4c')]>0x0){_0xd9f579[_0x59bb('0x4c')]-=0x1;}else{logger[_0x59bb('0x8')](_0xd7fc61,_0x59bb('0x4d'));}}else{logger[_0x59bb('0x6')](_0xd7fc61,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5348c6){if(_0x5348c6<=0x0){return!![];}return![];};function buildObj(_0x35e904,_0x104123,_0x2c6efd){_0x35e904['lastevent']=_0x104123;_0x35e904['name']=_0x35e904[_0x59bb('0x4e')];_0x35e904['interface']=_0x35e904[_0x59bb('0x3a')];_0x35e904[_0x59bb('0x4f')]='voice';if(_0x2c6efd){_0x35e904[_0x59bb('0x50')]=_0x2c6efd['mandatoryDisposition'];}return _0x35e904;}exports[_0x59bb('0x51')]=buildObj;exports[_0x59bb('0x52')]=function(_0x23c46d){var _0x5c6797=[];for(var _0x5b1886 in _0x23c46d){if(_0x23c46d[_0x59bb('0x53')](_0x5b1886)){if(!_[_0x59bb('0x12')](_0x23c46d[_0x5b1886])&&_0x23c46d[_0x5b1886]['state']===_0x59bb('0x54')&&_0x23c46d[_0x5b1886]['status']==='reachable'){_0x5c6797[_0x59bb('0x55')](_0x23c46d[_0x5b1886]['id']);}}}return _0x5c6797;};exports['getDiff']=function(_0x4850a4){var _0x495ac7=moment()[_0x59bb('0x56')](0x0);var _0x35c7d6=moment(_0x4850a4)[_0x59bb('0x56')](0x0);return _0x495ac7['diff'](_0x35c7d6,'seconds');};exports['createBody']=function(_0x446259){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x446259[_0x59bb('0x49')],'ListId':_0x446259[_0x59bb('0x4a')],'VoiceQueueId':_0x446259['VoiceQueueId']||undefined,'CampaignId':_0x446259[_0x59bb('0x57')]||undefined};};exports['filterKey']=function(_0x4bcf54){if(_0x4bcf54===_0x59bb('0x3e')||_0x4bcf54==='idContact'||_0x4bcf54===_0x59bb('0x4e')||_0x4bcf54===_0x59bb('0x58')||_0x4bcf54===_0x59bb('0x59')||_0x4bcf54===_0x59bb('0x5a')||_0x4bcf54===_0x59bb('0x31')||_0x4bcf54===_0x59bb('0x3a')||_0x4bcf54==='calleridname'||_0x4bcf54===_0x59bb('0x46')||_0x4bcf54==='calleridnum'||_0x4bcf54===_0x59bb('0x47')||_0x4bcf54===_0x59bb('0x40')||_0x4bcf54===_0x59bb('0x41')||_0x4bcf54===_0x59bb('0x42')||_0x4bcf54===_0x59bb('0x5b')||_0x4bcf54===_0x59bb('0x5c')||_0x4bcf54===_0x59bb('0x5d')||_0x4bcf54===_0x59bb('0x5e')||_0x4bcf54===_0x59bb('0x5f')||_0x4bcf54===_0x59bb('0x49')||_0x4bcf54===_0x59bb('0x4a')||_0x4bcf54===_0x59bb('0x32')||_0x4bcf54===_0x59bb('0x18')||_0x4bcf54===_0x59bb('0x60')||_0x4bcf54===_0x59bb('0x61')||_0x4bcf54===_0x59bb('0x62')||_0x4bcf54===_0x59bb('0x63')||_0x4bcf54==='xmd-listid'||_0x4bcf54===_0x59bb('0x64')||_0x4bcf54==='xmd-dialtimeout'||_0x4bcf54==='xmd-dialoptions'||_0x4bcf54==='xmd-dialid'||_0x4bcf54==='xmd-dialchannel'||_0x4bcf54===_0x59bb('0x65')||_0x4bcf54===_0x59bb('0x66')||_0x4bcf54==='xmd-callerid'||_0x4bcf54===_0x59bb('0x67')||_0x4bcf54==='xmd-agi'||_0x4bcf54===_0x59bb('0x68')||_0x4bcf54===_0x59bb('0x69')||_0x4bcf54===_0x59bb('0x6a')||_0x4bcf54===_0x59bb('0x6b')||_0x4bcf54===_0x59bb('0x6c')||_0x4bcf54===_0x59bb('0x6d')||_0x4bcf54===_0x59bb('0x6e')||_0x4bcf54===_0x59bb('0x6f')||_0x4bcf54===_0x59bb('0x68')||_0x4bcf54==='rtpaudioqosbridged'||_0x4bcf54===_0x59bb('0x6a')||_0x4bcf54===_0x59bb('0x6b')||_0x4bcf54==='rtpaudioqosloss'||_0x4bcf54===_0x59bb('0x6d')||_0x4bcf54===_0x59bb('0x6e')||_0x4bcf54===_0x59bb('0x6f')||_0x4bcf54===_0x59bb('0x70')||_0x4bcf54==='bridgepvtcallid'||_0x4bcf54===_0x59bb('0x2a')||_0x4bcf54==='statedesc'){return![];}return!![];};exports[_0x59bb('0x71')]=function(_0x483d34,_0x1a0268){var _0x4a4b3a,_0x4bb05c,_0x1b9214;if(_0x1a0268<=0x0){_0x1a0268=0x1;}_0x4a4b3a=new RegExp('\x5cw{0,'+_0x1a0268+'}$');_0x4bb05c=Math[_0x59bb('0x72')](0xa,_0x1a0268-0x1);_0x1b9214=Math[_0x59bb('0x72')](0xa,_0x1a0268)-0x1;return util[_0x59bb('0x10')]('%s',_[_0x59bb('0x73')](_0x483d34,_0x4a4b3a,_[_0x59bb('0x74')](_0x4bb05c,_0x1b9214)));};exports[_0x59bb('0x75')]=function(_0x37443f){var _0x4d1487=_0x37443f[_0x59bb('0x76')](/"(.*?)"/);return _0x4d1487?_0x4d1487[0x1]:_0x37443f;};exports[_0x59bb('0x77')]=function(_0x561c53){var _0x15d740=_0x561c53[_0x59bb('0x76')](/<(.*?)>/);return _0x15d740?_0x15d740[0x1]:_0x561c53;};function buildNoAnswerEventPayload(_0x2de748,_0x448b4a){var _0x385f1a=buildObj(_0x2de748,_0x59bb('0x78'));if(!_['isEmpty'](_0x448b4a[_0x59bb('0x79')])){Object[_0x59bb('0x7a')](_0x448b4a[_0x59bb('0x79')])[_0x59bb('0x7b')](function(_0x300854){_0x385f1a[_0x300854[_0x59bb('0x7c')]()]=_0x448b4a[_0x59bb('0x79')][_0x300854];});}return _0x385f1a;}exports[_0x59bb('0x7d')]=buildNoAnswerEventPayload;
\ No newline at end of file