Built motion from commit 9d0783e6.|2.6.13
[motion2.git] / server / services / ami / preview / util / util.js
index b1fce4f..9f06498 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf075=['util','lodash','moment','../../../../config/logger','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','error','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','membername','UserId','talktime','answertime','isFailure','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','active','scheduledat','countbusyretry','countglobal','callbackuniqueid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','pow','replace','random','extractCalleridName','extractCalleridNumber','match'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0xf075,0x8a));var _0x5f07=function(_0xd2d0cf,_0x2ea0fb){_0xd2d0cf=_0xd2d0cf-0x0;var _0x21771c=_0xf075[_0xd2d0cf];return _0x21771c;};'use strict';var util=require(_0x5f07('0x0'));var _=require(_0x5f07('0x1'));var moment=require(_0x5f07('0x2'));var logger=require(_0x5f07('0x3'))('preview');var ipAgi=process[_0x5f07('0x4')]['XCALLY_IP_AGI']||_0x5f07('0x5');function getSeconds(_0x4d6146,_0x4eb82a){var _0x4c5ed8=moment(_0x4d6146)['milliseconds'](0x0);var _0xdc184b=moment(_0x4eb82a)[_0x5f07('0x6')](0x0);return _0x4c5ed8[_0x5f07('0x7')](_0xdc184b,_0x5f07('0x8'));}exports[_0x5f07('0x9')]=function(_0x1c55cb){return function(_0x3dffcc){logger['error'](_0x1c55cb,util[_0x5f07('0xa')](_0x3dffcc,{'showHidden':![],'depth':null}));};};exports[_0x5f07('0xb')]=function(_0x7f5370,_0x5ee1fd){logger[_0x5f07('0xc')](_0x7f5370,util[_0x5f07('0xa')](_0x5ee1fd,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2c9de4,_0x393e74){logger[_0x5f07('0xd')](_0x2c9de4,util[_0x5f07('0xa')](_0x393e74,{'showHidden':![],'depth':null}));};exports[_0x5f07('0xe')]=function(_0x2696dc){return function(_0x1c0c16){logger[_0x5f07('0xc')](_0x2696dc,util[_0x5f07('0xa')](_0x1c0c16,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1fd539,_0x3822dc,_0x113237){return{'message':_0x1fd539,'unlock':_0x3822dc,'active':_0x113237};};exports[_0x5f07('0xf')]=function(_0x508274,_0x41d0bf,_0x2d14a3){if(!_[_0x5f07('0x10')](_0x2d14a3)&&_0x5f07('0x11')===typeof _0x2d14a3&&!_[_0x5f07('0x12')](_0x2d14a3)){if(!_[_0x5f07('0x10')](_0x41d0bf)&&_0x5f07('0x11')===typeof _0x41d0bf&&!_[_0x5f07('0x12')](_0x41d0bf)){return util[_0x5f07('0x13')](_0x5f07('0x14'),_0x41d0bf,_0x2d14a3);}return util[_0x5f07('0x13')](_0x5f07('0x14'),_0x2d14a3,_0x2d14a3);}if(!_[_0x5f07('0x10')](_0x508274)&&_0x5f07('0x11')===typeof _0x508274&&!_['isEmpty'](_0x508274)){return _0x508274;}return _0x5f07('0x15');};exports[_0x5f07('0x16')]=function(_0x34b5b4){if(_[_0x5f07('0x17')](_0x34b5b4)){return![];}return _0x34b5b4;};exports[_0x5f07('0x18')]=function(_0x3be121,_0x468acc,_0x4fe301,_0x5978a2,_0x174ce8,_0x151a16){var _0x2ec65b={'XMD-QUEUE':_0x468acc[_0x5f07('0x19')]?_0x468acc[_0x5f07('0x19')]['name']:'','XMD-CALLERID':_0x5978a2,'XMD-CALLERID-PREVIEW':_0x151a16?util[_0x5f07('0x13')](_0x5f07('0x14'),_0x151a16[_0x5f07('0x1a')],_0x151a16['calleridnum']):_0x5978a2,'XMD-DIALID':_0x174ce8,'XMD-CONTACTID':_0x468acc['ContactId'],'XMD-CDRTYPE':_0x5f07('0x1b'),'CALLERID(all)':_0x5978a2,'XMD-VOICEQUEUEID':_0x468acc['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4fe301,'XMD-DIALTIMEOUT':_0x3be121[_0x5f07('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x5f07('0x1d'),_0x3be121['dialQueueProject2']?'g':'',_[_0x5f07('0x12')](_0x3be121[_0x5f07('0x1e')])?'':_0x5f07('0x1f')),'XMD-DIALURL':_0x3be121[_0x5f07('0x20')]||'','XMD-AGI':_0x3be121['dialQueueProject']?util[_0x5f07('0x13')](_0x5f07('0x21'),ipAgi,_0x3be121[_0x5f07('0x22')]):_0x5f07('0x23'),'XMD-AGIAFTER':_0x3be121[_0x5f07('0x24')]?util[_0x5f07('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3be121['dialQueueProject2']):_0x5f07('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x151a16?_0x151a16[_0x5f07('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x151a16?_0x151a16['originatecalleridname']:'','XMD-DESTINATION':_0x5f07('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x3be121[_0x5f07('0x1e')])){_0x2ec65b[util[_0x5f07('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3be121[_0x5f07('0x1e')];_0x2ec65b[util[_0x5f07('0x13')]('%s',_0x5f07('0x27'))]=_0x174ce8;}if(_0x468acc&&_0x468acc[_0x5f07('0x28')]){for(var _0x33188f in _0x468acc[_0x5f07('0x28')]){if(_0x468acc[_0x5f07('0x28')]['hasOwnProperty'](_0x33188f)){if(!_[_0x5f07('0x17')](_0x468acc['Contact'][_0x33188f])&&_0x33188f!=='id'&&_0x33188f!==_0x5f07('0x29')&&_0x33188f!==_0x5f07('0x2a')&&_0x33188f!==_0x5f07('0x2b')){_0x2ec65b[util[_0x5f07('0x13')](_0x5f07('0x2c'),'XMD-',_[_0x5f07('0x2d')](_0x33188f))]=_0x468acc['Contact'][_0x33188f];}}}}return _0x2ec65b;};exports[_0x5f07('0x2e')]=function(_0x4b0eb6){var _0x56c88d={};for(var _0x1fde64 in _0x4b0eb6){if(_0x4b0eb6[_0x5f07('0x2f')](_0x1fde64)){_0x56c88d[util[_0x5f07('0x13')]('%s',_[_0x5f07('0x30')](_0x1fde64))]=_0x4b0eb6[_0x1fde64];}}return{'variables':_0x56c88d};};exports[_0x5f07('0x31')]=function(_0x8d4f6b,_0x2e9c8b){if(!_[_0x5f07('0x17')](_0x8d4f6b)){if(_0x8d4f6b[_0x5f07('0x2f')](_0x5f07('0x32'))){if(_0x8d4f6b[_0x5f07('0x32')]>0x0){_0x8d4f6b['originated']-=0x1;}else{logger[_0x5f07('0xd')](_0x5f07('0x33'),_0x2e9c8b);}}}else{logger['error'](_0x5f07('0x34'),_0x2e9c8b);}};exports['logBlacklist']=function(_0x1b5942){var _0x5db1ad=moment()[_0x5f07('0x13')](_0x5f07('0x35'));_0x1b5942[_0x5f07('0x36')]=0xd;_0x1b5942[_0x5f07('0x37')]='Blacklist';_0x1b5942[_0x5f07('0x38')]=_0x5db1ad;_0x1b5942[_0x5f07('0x39')]=_0x5db1ad;_0x1b5942[_0x5f07('0x3a')]=_0x5db1ad;};exports[_0x5f07('0x3b')]=function(_0x3ae703,_0x131980,_0xebb6dc){var _0x481d6c=moment()[_0x5f07('0x13')](_0x5f07('0x35'));_0x3ae703[_0x5f07('0x36')]=_0x131980;_0x3ae703[_0x5f07('0x37')]=_0xebb6dc;_0x3ae703[_0x5f07('0x39')]=_0x481d6c;_0x3ae703['ringtime']=getSeconds(_0x3ae703[_0x5f07('0x39')],_0x3ae703[_0x5f07('0x38')]);};exports['logLookAgent']=function(_0x22b9d2,_0x3769c9,_0xf7df8f){_0x22b9d2[_0x5f07('0x3c')]=_0x3769c9;_0x22b9d2[_0x5f07('0x3d')]=_0xf7df8f;};exports['logCustomer']=function(_0x32b84a,_0x368a82,_0xf2711c){var _0x114930=moment()[_0x5f07('0x13')](_0x5f07('0x35'));_0x32b84a[_0x5f07('0x36')]=_0x368a82;_0x32b84a[_0x5f07('0x37')]=_0xf2711c;_0x32b84a['responsetime']=_0x32b84a[_0x5f07('0x39')]?_0x32b84a[_0x5f07('0x39')]:_0x114930;_0x32b84a[_0x5f07('0x3a')]=_0x32b84a[_0x5f07('0x3a')]?_0x32b84a[_0x5f07('0x3a')]:_0x114930;_0x32b84a['ringtime']=getSeconds(_0x32b84a[_0x5f07('0x39')]||0x0,_0x32b84a[_0x5f07('0x38')]||0x0);_0x32b84a[_0x5f07('0x3e')]=_0x32b84a['answertime']?getSeconds(_0x32b84a[_0x5f07('0x3a')],_0x32b84a[_0x5f07('0x3f')]):0x0;};exports[_0x5f07('0x40')]=function(_0x22b83e){return _0x22b83e==='Failure';};exports[_0x5f07('0x41')]=function(_0x1484de,_0x54a25d,_0x3eaaf2,_0x3007a8,_0x38c226){var _0x26ae68=_0x3007a8?_0x5f07('0x42'):_0x1484de[_0x5f07('0x1a')];_0x26ae68=_0x38c226?'BOOKED':_0x26ae68;return{'actionid':_0x1484de[_0x5f07('0x43')],'action':'originate','channel':_0x1484de[_0x5f07('0x44')],'callerid':util[_0x5f07('0x13')]('\x22%s\x22\x20<%s>',_0x26ae68,_0x1484de['calleridnum']),'Exten':_0x5f07('0x26'),'Context':_0x5f07('0x45'),'Priority':'1','variable':_0x3eaaf2,'timeout':(_0x54a25d[_0x5f07('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1484de[_0x5f07('0x43')]};};exports['totalGlobal']=function(_0xa4d928){return _0xa4d928['countbusyretry']+_0xa4d928[_0x5f07('0x47')]+_0xa4d928[_0x5f07('0x48')]+_0xa4d928['countagentrejectretry']+_0xa4d928[_0x5f07('0x49')];};exports[_0x5f07('0x4a')]=function(_0x3e1a36){var _0xe30436=_[_0x5f07('0x4b')](_0x3e1a36);_0xe30436['state']=0xf;_0xe30436[_0x5f07('0x37')]=_0x5f07('0x4c');return _0xe30436;};exports[_0x5f07('0x4d')]=function(_0x5f34f2,_0x3fe362,_0x2d2631){var _0x2c04fc={};_0x2c04fc[_0x3fe362]=_0x5f34f2[_0x3fe362];_0x2c04fc['active']=![];_0x2c04fc['scheduledat']=moment()['add'](_0x2d2631,'minutes')[_0x5f07('0x13')](_0x5f07('0x35'));_0x2c04fc[_0x5f07('0x4e')]=_0x5f34f2[_0x5f07('0x4e')];_0x2c04fc[_0x5f07('0x4f')]=_0x5f34f2[_0x5f07('0x4f')];_0x2c04fc[_0x5f07('0x50')]=_0x5f34f2['VoiceQueueId']||undefined;return _0x2c04fc;};exports[_0x5f07('0x51')]=function(_0x13973a,_0xc9484e){if(!_[_0x5f07('0x17')](_0x13973a)){if(_0x13973a[_0x5f07('0x52')]>0x0){_0x13973a['pTalking']-=0x1;}else{logger[_0x5f07('0xd')](_0xc9484e,_0x5f07('0x53'));}}else{logger['error'](_0xc9484e,_0x5f07('0x54'));}};exports[_0x5f07('0x55')]=function(_0x4db858){if(_0x4db858<=0x0){return!![];}return![];};exports[_0x5f07('0x56')]=function(_0x5b5151,_0x181678,_0x4415f3){_0x5b5151[_0x5f07('0x57')]=_0x181678;_0x5b5151[_0x5f07('0x58')]=_0x5b5151[_0x5f07('0x59')];_0x5b5151[_0x5f07('0x5a')]=_0x5b5151[_0x5f07('0x44')];_0x5b5151[_0x5f07('0x5b')]=_0x5f07('0x5c');if(_0x4415f3){_0x5b5151[_0x5f07('0x5d')]=_0x4415f3['mandatoryDisposition'];}return _0x5b5151;};exports[_0x5f07('0x5e')]=function(_0x3a2c26){var _0x1d017e={};_0x1d017e['queue']=_0x3a2c26['queue'];_0x1d017e[_0x5f07('0x5a')]=_0x3a2c26[_0x5f07('0x44')];_0x1d017e['uniqueid']=_0x3a2c26[_0x5f07('0x43')];return _0x1d017e;};exports[_0x5f07('0x5f')]=function(_0x4a61c2){var _0x3b6fd9=[];for(var _0x503fa4 in _0x4a61c2){if(_0x4a61c2['hasOwnProperty'](_0x503fa4)){if(!_[_0x5f07('0x17')](_0x4a61c2[_0x503fa4])&&_0x4a61c2[_0x503fa4]['state']===_0x5f07('0x60')&&_0x4a61c2[_0x503fa4][_0x5f07('0x61')]===_0x5f07('0x62')){_0x3b6fd9[_0x5f07('0x63')](_0x4a61c2[_0x503fa4]['id']);}}}return _0x3b6fd9;};exports[_0x5f07('0x64')]=function(_0x50dae3){var _0x3aa956=moment()[_0x5f07('0x6')](0x0);var _0x28f0b6=moment(_0x50dae3)[_0x5f07('0x6')](0x0);return _0x3aa956[_0x5f07('0x7')](_0x28f0b6,'seconds');};exports[_0x5f07('0x65')]=function(_0x44d5be){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x44d5be['ContactId'],'ListId':_0x44d5be[_0x5f07('0x4f')],'VoiceQueueId':_0x44d5be['VoiceQueueId']||undefined,'CampaignId':_0x44d5be[_0x5f07('0x66')]||undefined};};exports[_0x5f07('0x67')]=function(_0x57ff42){if(_0x57ff42===_0x5f07('0x43')||_0x57ff42===_0x5f07('0x68')||_0x57ff42===_0x5f07('0x59')||_0x57ff42===_0x5f07('0x69')||_0x57ff42==='campaigntype'||_0x57ff42===_0x5f07('0x6a')||_0x57ff42==='membername'||_0x57ff42==='channelAgent'||_0x57ff42===_0x5f07('0x1a')||_0x57ff42===_0x5f07('0x6b')||_0x57ff42==='calleridnum'||_0x57ff42===_0x5f07('0x6c')||_0x57ff42===_0x5f07('0x6d')||_0x57ff42===_0x5f07('0x47')||_0x57ff42===_0x5f07('0x48')||_0x57ff42===_0x5f07('0x6e')||_0x57ff42==='callback'||_0x57ff42===_0x5f07('0x6f')||_0x57ff42==='callbackat'||_0x57ff42==='recallme'||_0x57ff42===_0x5f07('0x4e')||_0x57ff42===_0x5f07('0x4f')||_0x57ff42===_0x5f07('0x3d')||_0x57ff42===_0x5f07('0x50')||_0x57ff42==='sipcallid'||_0x57ff42===_0x5f07('0x70')||_0x57ff42===_0x5f07('0x71')||_0x57ff42===_0x5f07('0x72')||_0x57ff42===_0x5f07('0x73')||_0x57ff42==='xmd-dialurl'||_0x57ff42===_0x5f07('0x74')||_0x57ff42===_0x5f07('0x75')||_0x57ff42==='xmd-dialid'||_0x57ff42===_0x5f07('0x76')||_0x57ff42===_0x5f07('0x77')||_0x57ff42===_0x5f07('0x78')||_0x57ff42===_0x5f07('0x79')||_0x57ff42===_0x5f07('0x7a')||_0x57ff42==='xmd-agi'||_0x57ff42===_0x5f07('0x7b')||_0x57ff42===_0x5f07('0x7c')||_0x57ff42===_0x5f07('0x7d')||_0x57ff42===_0x5f07('0x7e')||_0x57ff42===_0x5f07('0x7f')||_0x57ff42===_0x5f07('0x80')||_0x57ff42===_0x5f07('0x81')||_0x57ff42===_0x5f07('0x82')||_0x57ff42==='rtpaudioqos'||_0x57ff42==='rtpaudioqosbridged'||_0x57ff42===_0x5f07('0x7d')||_0x57ff42===_0x5f07('0x7e')||_0x57ff42===_0x5f07('0x7f')||_0x57ff42===_0x5f07('0x80')||_0x57ff42===_0x5f07('0x81')||_0x57ff42===_0x5f07('0x82')||_0x57ff42===_0x5f07('0x83')||_0x57ff42==='bridgepvtcallid'||_0x57ff42==='state'||_0x57ff42===_0x5f07('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x346377,_0x2b6d7c){var _0x860e44,_0x24eb9a,_0x2788b1;if(_0x2b6d7c<=0x0){_0x2b6d7c=0x1;}_0x860e44=new RegExp('\x5cw{0,'+_0x2b6d7c+'}$');_0x24eb9a=Math['pow'](0xa,_0x2b6d7c-0x1);_0x2788b1=Math[_0x5f07('0x84')](0xa,_0x2b6d7c)-0x1;return util[_0x5f07('0x13')]('%s',_[_0x5f07('0x85')](_0x346377,_0x860e44,_[_0x5f07('0x86')](_0x24eb9a,_0x2788b1)));};exports[_0x5f07('0x87')]=function(_0x29bdc4){var _0x166ecc=_0x29bdc4['match'](/"(.*?)"/);return _0x166ecc?_0x166ecc[0x1]:_0x29bdc4;};exports[_0x5f07('0x88')]=function(_0xf5aaab){var _0x72355e=_0xf5aaab[_0x5f07('0x89')](/<(.*?)>/);return _0x72355e?_0x72355e[0x1]:_0xf5aaab;};
\ No newline at end of file
+var _0x8a42=['[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','push','milliseconds','diff','seconds','filterKey','campaigntype','active','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','loggerError','logger2','info','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','logAgent','responsetime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','Failure','variablesAction','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking'];(function(_0x3f2d35,_0x36db80){var _0x572caa=function(_0x47ff73){while(--_0x47ff73){_0x3f2d35['push'](_0x3f2d35['shift']());}};_0x572caa(++_0x36db80);}(_0x8a42,0x161));var _0x28a4=function(_0x5a8318,_0x3d95d5){_0x5a8318=_0x5a8318-0x0;var _0x40ee51=_0x8a42[_0x5a8318];return _0x40ee51;};'use strict';var util=require(_0x28a4('0x0'));var _=require(_0x28a4('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x28a4('0x2'));var ipAgi=process[_0x28a4('0x3')][_0x28a4('0x4')]||_0x28a4('0x5');var utils=require(_0x28a4('0x6'));exports[_0x28a4('0x7')]=function(_0x5ac0d3){return function(_0x4e444c){logger[_0x28a4('0x8')](_0x5ac0d3,util[_0x28a4('0x9')](_0x4e444c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1ab9b6,_0x27363e){logger['info'](_0x1ab9b6,util[_0x28a4('0x9')](_0x27363e,{'showHidden':![],'depth':null}));};exports[_0x28a4('0xa')]=function(_0x2a6477,_0x5dc7dc){logger[_0x28a4('0x8')](_0x2a6477,util['inspect'](_0x5dc7dc,{'showHidden':![],'depth':null}));};exports[_0x28a4('0xb')]=function(_0x3fbe5f){return function(_0x3301c3){logger[_0x28a4('0xc')](_0x3fbe5f,util['inspect'](_0x3301c3,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5e8605,_0x2e5758,_0x4aa59b){return{'message':_0x5e8605,'unlock':_0x2e5758,'active':_0x4aa59b};};exports[_0x28a4('0xd')]=function(_0x96041b,_0x10fdc2,_0x50ff84){if(!_[_0x28a4('0xe')](_0x50ff84)&&_0x28a4('0xf')===typeof _0x50ff84&&!_[_0x28a4('0x10')](_0x50ff84)){if(!_[_0x28a4('0xe')](_0x10fdc2)&&_0x28a4('0xf')===typeof _0x10fdc2&&!_[_0x28a4('0x10')](_0x10fdc2)){return util['format']('\x22%s\x22\x20<%s>',_0x10fdc2,_0x50ff84);}return util[_0x28a4('0x11')](_0x28a4('0x12'),_0x50ff84,_0x50ff84);}if(!_[_0x28a4('0xe')](_0x96041b)&&'string'===typeof _0x96041b&&!_['isEmpty'](_0x96041b)){return _0x96041b;}return _0x28a4('0x13');};exports['isActive']=function(_0x32df16){if(_[_0x28a4('0x14')](_0x32df16)){return![];}return _0x32df16;};exports[_0x28a4('0x15')]=function(_0x37e0cb,_0x5ef299,_0x52d0cf,_0x2d3b5b,_0x1fb004,_0x30ccf4){var _0x2b649f={'XMD-QUEUE':_0x5ef299['Queue']?_0x5ef299[_0x28a4('0x16')][_0x28a4('0x17')]:'','XMD-CALLERID':_0x2d3b5b,'XMD-CALLERID-PREVIEW':_0x30ccf4?util[_0x28a4('0x11')](_0x28a4('0x12'),_0x30ccf4[_0x28a4('0x18')],_0x30ccf4[_0x28a4('0x19')]):_0x2d3b5b,'XMD-DIALID':_0x1fb004,'XMD-CONTACTID':_0x5ef299[_0x28a4('0x1a')],'XMD-CDRTYPE':_0x28a4('0x1b'),'CALLERID(all)':_0x2d3b5b,'XMD-VOICEQUEUEID':_0x5ef299[_0x28a4('0x1c')],'XMD-DIALCHANNEL':_0x52d0cf,'XMD-DIALTIMEOUT':_0x37e0cb['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x28a4('0x11')](_0x28a4('0x1d'),_0x37e0cb['dialQueueProject2']?'g':'',_[_0x28a4('0x10')](_0x37e0cb[_0x28a4('0x1e')])?'':_0x28a4('0x1f')),'XMD-DIALURL':_0x37e0cb[_0x28a4('0x20')]||'','XMD-AGI':_0x37e0cb[_0x28a4('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x37e0cb['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x37e0cb['dialQueueProject2']?util[_0x28a4('0x11')](_0x28a4('0x22'),ipAgi,_0x37e0cb[_0x28a4('0x23')]):_0x28a4('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x30ccf4?_0x30ccf4['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x30ccf4?_0x30ccf4[_0x28a4('0x25')]:'','XMD-DESTINATION':_0x28a4('0x26'),'SIPADDHEADER':_0x28a4('0x27')};if(!_[_0x28a4('0x10')](_0x37e0cb[_0x28a4('0x1e')])){_0x2b649f[util[_0x28a4('0x11')]('%s',_0x28a4('0x28'))]=_0x37e0cb[_0x28a4('0x1e')];_0x2b649f[util[_0x28a4('0x11')]('%s',_0x28a4('0x29'))]=_0x1fb004;}if(_0x5ef299&&_0x5ef299['Contact']){for(var _0x2d8f5c in _0x5ef299['Contact']){if(_0x5ef299[_0x28a4('0x2a')][_0x28a4('0x2b')](_0x2d8f5c)){if(!_[_0x28a4('0x14')](_0x5ef299['Contact'][_0x2d8f5c])&&_0x2d8f5c!=='id'&&_0x2d8f5c!==_0x28a4('0x2c')&&_0x2d8f5c!=='createdAt'&&_0x2d8f5c!==_0x28a4('0x2d')){_0x2b649f[util[_0x28a4('0x11')](_0x28a4('0x2e'),_0x28a4('0x2f'),_[_0x28a4('0x30')](_0x2d8f5c))]=_0x5ef299[_0x28a4('0x2a')][_0x2d8f5c];}}}}return _0x2b649f;};exports[_0x28a4('0x31')]=function(_0x2f6b4f){var _0x6bf8fa={};for(var _0x3795a0 in _0x2f6b4f){if(_0x2f6b4f['hasOwnProperty'](_0x3795a0)){_0x6bf8fa[util[_0x28a4('0x11')]('%s',_[_0x28a4('0x32')](_0x3795a0))]=_0x2f6b4f[_0x3795a0];}}return{'variables':_0x6bf8fa};};exports[_0x28a4('0x33')]=function(_0x15835c,_0x1327de){if(!_['isNil'](_0x15835c)){if(_0x15835c[_0x28a4('0x2b')](_0x28a4('0x34'))){if(_0x15835c['originated']>0x0){_0x15835c[_0x28a4('0x34')]-=0x1;}else{logger[_0x28a4('0x8')](_0x28a4('0x35'),_0x1327de);}}}else{logger[_0x28a4('0x8')](_0x28a4('0x36'),_0x1327de);}};exports[_0x28a4('0x37')]=function(_0x362f0d){var _0x3a36af=moment()[_0x28a4('0x11')](_0x28a4('0x38'));_0x362f0d[_0x28a4('0x39')]=0xd;_0x362f0d[_0x28a4('0x3a')]='Blacklist';_0x362f0d['starttime']=_0x3a36af;_0x362f0d['responsetime']=_0x3a36af;_0x362f0d[_0x28a4('0x3b')]=_0x3a36af;};exports[_0x28a4('0x3c')]=function(_0x3a9ccd,_0x3648b6,_0x4db654){var _0x53716d=moment()[_0x28a4('0x11')](_0x28a4('0x38'));_0x3a9ccd[_0x28a4('0x39')]=_0x3648b6;_0x3a9ccd[_0x28a4('0x3a')]=_0x4db654;_0x3a9ccd[_0x28a4('0x3d')]=_0x53716d;_0x3a9ccd['ringtime']=utils[_0x28a4('0x3e')](_0x3a9ccd[_0x28a4('0x3d')],_0x3a9ccd[_0x28a4('0x3f')]);};exports[_0x28a4('0x40')]=function(_0x50c043,_0x537462,_0x5d2e74){_0x50c043[_0x28a4('0x41')]=_0x537462;_0x50c043[_0x28a4('0x42')]=_0x5d2e74;};exports[_0x28a4('0x43')]=function(_0x4fc107,_0x3772cc,_0x835367){var _0x5c6201=moment()[_0x28a4('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4fc107[_0x28a4('0x39')]=_0x3772cc;_0x4fc107[_0x28a4('0x3a')]=_0x835367;_0x4fc107[_0x28a4('0x3d')]=_0x4fc107[_0x28a4('0x3d')]?_0x4fc107[_0x28a4('0x3d')]:_0x5c6201;_0x4fc107[_0x28a4('0x3b')]=_0x4fc107[_0x28a4('0x3b')]?_0x4fc107[_0x28a4('0x3b')]:_0x5c6201;_0x4fc107[_0x28a4('0x44')]=utils['getSeconds'](_0x4fc107['responsetime']||0x0,_0x4fc107[_0x28a4('0x3f')]||0x0);_0x4fc107[_0x28a4('0x45')]=_0x4fc107[_0x28a4('0x46')]?utils[_0x28a4('0x3e')](_0x4fc107[_0x28a4('0x3b')],_0x4fc107[_0x28a4('0x46')]):0x0;};exports['isFailure']=function(_0x4303be){return _0x4303be===_0x28a4('0x47');};exports[_0x28a4('0x48')]=function(_0xca6bb3,_0x4b6319,_0x22841f,_0x22cf9b,_0x179477){var _0x525d32=_0x22cf9b?'RECALL':_0xca6bb3[_0x28a4('0x18')];_0x525d32=_0x179477?'BOOKED':_0x525d32;return{'actionid':_0xca6bb3[_0x28a4('0x49')],'action':_0x28a4('0x4a'),'channel':_0xca6bb3[_0x28a4('0x4b')],'callerid':util['format'](_0x28a4('0x12'),_0x525d32,_0xca6bb3[_0x28a4('0x19')]),'Exten':_0x28a4('0x26'),'Context':'from-sip','Priority':'1','variable':_0x22841f,'timeout':(_0x4b6319[_0x28a4('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0xca6bb3['uniqueid']};};exports[_0x28a4('0x4d')]=function(_0x1e3725){return _0x1e3725[_0x28a4('0x4e')]+_0x1e3725[_0x28a4('0x4f')]+_0x1e3725['countnoanswerretry']+_0x1e3725[_0x28a4('0x50')]+_0x1e3725[_0x28a4('0x51')];};exports[_0x28a4('0x52')]=function(_0x42ceb2){var _0x5a0a89=_['clone'](_0x42ceb2);_0x5a0a89[_0x28a4('0x39')]=0xf;_0x5a0a89[_0x28a4('0x3a')]=_0x28a4('0x53');return _0x5a0a89;};exports[_0x28a4('0x54')]=function(_0x26ec69,_0xa97d64,_0x1c68de){var _0x543260={};_0x543260[_0xa97d64]=_0x26ec69[_0xa97d64];_0x543260['active']=![];_0x543260[_0x28a4('0x55')]=moment()[_0x28a4('0x56')](_0x1c68de,_0x28a4('0x57'))[_0x28a4('0x11')](_0x28a4('0x38'));_0x543260['ContactId']=_0x26ec69['ContactId'];_0x543260[_0x28a4('0x58')]=_0x26ec69['ListId'];_0x543260[_0x28a4('0x1c')]=_0x26ec69[_0x28a4('0x1c')]||undefined;return _0x543260;};exports[_0x28a4('0x59')]=function(_0x5ebff3,_0x2a328d){if(!_[_0x28a4('0x14')](_0x5ebff3)){if(_0x5ebff3['pTalking']>0x0){_0x5ebff3[_0x28a4('0x5a')]-=0x1;}else{logger[_0x28a4('0x8')](_0x2a328d,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x28a4('0x8')](_0x2a328d,_0x28a4('0x5b'));}};exports[_0x28a4('0x5c')]=function(_0x442f5f){if(_0x442f5f<=0x0){return!![];}return![];};function buildObj(_0x584d37,_0x54f7d0,_0x22e848){_0x584d37[_0x28a4('0x5d')]=_0x54f7d0;_0x584d37['name']=_0x584d37['queue'];_0x584d37[_0x28a4('0x5e')]=_0x584d37[_0x28a4('0x4b')];_0x584d37[_0x28a4('0x5f')]='voice';if(_0x22e848){_0x584d37[_0x28a4('0x60')]=_0x22e848[_0x28a4('0x60')];}return _0x584d37;}exports[_0x28a4('0x61')]=buildObj;exports[_0x28a4('0x62')]=function(_0x2b6170){var _0x5ba23d={};_0x5ba23d[_0x28a4('0x63')]=_0x2b6170['queue'];_0x5ba23d[_0x28a4('0x5e')]=_0x2b6170[_0x28a4('0x4b')];_0x5ba23d[_0x28a4('0x49')]=_0x2b6170[_0x28a4('0x49')];return _0x5ba23d;};exports[_0x28a4('0x64')]=function(_0x440719){var _0x2b258d=[];for(var _0x2eccc7 in _0x440719){if(_0x440719['hasOwnProperty'](_0x2eccc7)){if(!_[_0x28a4('0x14')](_0x440719[_0x2eccc7])&&_0x440719[_0x2eccc7]['state']===_0x28a4('0x65')&&_0x440719[_0x2eccc7]['status']==='reachable'){_0x2b258d[_0x28a4('0x66')](_0x440719[_0x2eccc7]['id']);}}}return _0x2b258d;};exports['getDiff']=function(_0x177c16){var _0x5485a1=moment()[_0x28a4('0x67')](0x0);var _0x16b0c0=moment(_0x177c16)[_0x28a4('0x67')](0x0);return _0x5485a1[_0x28a4('0x68')](_0x16b0c0,_0x28a4('0x69'));};exports['createBody']=function(_0x40a2ca){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x40a2ca['ContactId'],'ListId':_0x40a2ca[_0x28a4('0x58')],'VoiceQueueId':_0x40a2ca['VoiceQueueId']||undefined,'CampaignId':_0x40a2ca['CampaignId']||undefined};};exports[_0x28a4('0x6a')]=function(_0x26609b){if(_0x26609b==='uniqueid'||_0x26609b==='idContact'||_0x26609b===_0x28a4('0x63')||_0x26609b==='type'||_0x26609b===_0x28a4('0x6b')||_0x26609b==='dialAnswer'||_0x26609b===_0x28a4('0x41')||_0x26609b===_0x28a4('0x4b')||_0x26609b===_0x28a4('0x18')||_0x26609b===_0x28a4('0x6c')||_0x26609b==='calleridnum'||_0x26609b===_0x28a4('0x55')||_0x26609b===_0x28a4('0x4e')||_0x26609b===_0x28a4('0x4f')||_0x26609b===_0x28a4('0x6d')||_0x26609b===_0x28a4('0x6e')||_0x26609b===_0x28a4('0x6f')||_0x26609b===_0x28a4('0x70')||_0x26609b===_0x28a4('0x71')||_0x26609b===_0x28a4('0x72')||_0x26609b===_0x28a4('0x1a')||_0x26609b===_0x28a4('0x58')||_0x26609b===_0x28a4('0x42')||_0x26609b===_0x28a4('0x1c')||_0x26609b==='sipcallid'||_0x26609b===_0x28a4('0x73')||_0x26609b===_0x28a4('0x74')||_0x26609b===_0x28a4('0x75')||_0x26609b===_0x28a4('0x76')||_0x26609b===_0x28a4('0x77')||_0x26609b===_0x28a4('0x78')||_0x26609b===_0x28a4('0x79')||_0x26609b===_0x28a4('0x7a')||_0x26609b===_0x28a4('0x7b')||_0x26609b===_0x28a4('0x7c')||_0x26609b==='xmd-cdrtype'||_0x26609b==='xmd-callerid'||_0x26609b===_0x28a4('0x7d')||_0x26609b==='xmd-agi'||_0x26609b===_0x28a4('0x7e')||_0x26609b===_0x28a4('0x7f')||_0x26609b===_0x28a4('0x80')||_0x26609b===_0x28a4('0x81')||_0x26609b===_0x28a4('0x82')||_0x26609b===_0x28a4('0x83')||_0x26609b===_0x28a4('0x84')||_0x26609b===_0x28a4('0x85')||_0x26609b==='rtpaudioqos'||_0x26609b===_0x28a4('0x7f')||_0x26609b==='rtpaudioqosjitter'||_0x26609b===_0x28a4('0x81')||_0x26609b==='rtpaudioqosloss'||_0x26609b===_0x28a4('0x83')||_0x26609b===_0x28a4('0x84')||_0x26609b===_0x28a4('0x85')||_0x26609b==='bridgepeer'||_0x26609b===_0x28a4('0x86')||_0x26609b===_0x28a4('0x39')||_0x26609b===_0x28a4('0x3a')){return![];}return!![];};exports[_0x28a4('0x87')]=function(_0x449f6a,_0x47957f){var _0x4cb9b0,_0x367dba,_0x4dbd24;if(_0x47957f<=0x0){_0x47957f=0x1;}_0x4cb9b0=new RegExp('\x5cw{0,'+_0x47957f+'}$');_0x367dba=Math[_0x28a4('0x88')](0xa,_0x47957f-0x1);_0x4dbd24=Math[_0x28a4('0x88')](0xa,_0x47957f)-0x1;return util[_0x28a4('0x11')]('%s',_[_0x28a4('0x89')](_0x449f6a,_0x4cb9b0,_[_0x28a4('0x8a')](_0x367dba,_0x4dbd24)));};exports[_0x28a4('0x8b')]=function(_0x2d43df){var _0x880dc1=_0x2d43df['match'](/"(.*?)"/);return _0x880dc1?_0x880dc1[0x1]:_0x2d43df;};exports[_0x28a4('0x8c')]=function(_0x42b4d8){var _0xef1f86=_0x42b4d8[_0x28a4('0x8d')](/<(.*?)>/);return _0xef1f86?_0xef1f86[0x1]:_0x42b4d8;};function buildNoAnswerEventPayload(_0x46ec2f,_0x16471f){var _0x275347=buildObj(_0x46ec2f,_0x28a4('0x8e'));if(!_[_0x28a4('0x10')](_0x16471f[_0x28a4('0x8f')])){Object[_0x28a4('0x90')](_0x16471f[_0x28a4('0x8f')])[_0x28a4('0x91')](function(_0x18a3c6){_0x275347[_0x18a3c6[_0x28a4('0x92')]()]=_0x16471f['variables'][_0x18a3c6];});}return _0x275347;}exports[_0x28a4('0x93')]=buildNoAnswerEventPayload;
\ No newline at end of file