Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / services / ami / preview / util / util.js
index 6d128b5..219a312 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc9b4=['xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','diff','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countcongestionretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','getDiff','seconds','createBody','CampaignId','idContact','type','campaigntype','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype'];(function(_0x18b405,_0x1ee57b){var _0x2df375=function(_0x5a4034){while(--_0x5a4034){_0x18b405['push'](_0x18b405['shift']());}};_0x2df375(++_0x1ee57b);}(_0xc9b4,0x122));var _0x4c9b=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xc9b4[_0x1b2422];return _0x376573;};'use strict';var util=require('util');var _=require(_0x4c9b('0x0'));var moment=require(_0x4c9b('0x1'));var logger=require(_0x4c9b('0x2'))('preview');var ipAgi=process[_0x4c9b('0x3')][_0x4c9b('0x4')]||'127.0.0.1';function getSeconds(_0x5ac644,_0x3e83c2){var _0x4b7b37=moment(_0x5ac644)[_0x4c9b('0x5')](0x0);var _0x51ba6f=moment(_0x3e83c2)[_0x4c9b('0x5')](0x0);return _0x4b7b37[_0x4c9b('0x6')](_0x51ba6f,'seconds');}exports[_0x4c9b('0x7')]=function(_0x8e2c4){return function(_0xd909af){logger[_0x4c9b('0x8')](_0x8e2c4,util[_0x4c9b('0x9')](_0xd909af,{'showHidden':![],'depth':null}));};};exports[_0x4c9b('0xa')]=function(_0x4e7dc3,_0x54b252){logger['info'](_0x4e7dc3,util['inspect'](_0x54b252,{'showHidden':![],'depth':null}));};exports[_0x4c9b('0xb')]=function(_0x3173b9,_0x536400){logger[_0x4c9b('0x8')](_0x3173b9,util[_0x4c9b('0x9')](_0x536400,{'showHidden':![],'depth':null}));};exports[_0x4c9b('0xc')]=function(_0x3ae365){return function(_0x57108a){logger[_0x4c9b('0xd')](_0x3ae365,util[_0x4c9b('0x9')](_0x57108a,{'showHidden':![],'depth':null}));};};exports[_0x4c9b('0xe')]=function(_0x3e1805,_0x13c63f,_0x37f69c){return{'message':_0x3e1805,'unlock':_0x13c63f,'active':_0x37f69c};};exports['getCallerId']=function(_0x3464c1,_0x2aa634,_0x4aaf39){if(!_[_0x4c9b('0xf')](_0x4aaf39)&&'string'===typeof _0x4aaf39&&!_['isEmpty'](_0x4aaf39)){if(!_[_0x4c9b('0xf')](_0x2aa634)&&_0x4c9b('0x10')===typeof _0x2aa634&&!_['isEmpty'](_0x2aa634)){return util[_0x4c9b('0x11')](_0x4c9b('0x12'),_0x2aa634,_0x4aaf39);}return util[_0x4c9b('0x11')](_0x4c9b('0x12'),_0x4aaf39,_0x4aaf39);}if(!_['isUndefined'](_0x3464c1)&&_0x4c9b('0x10')===typeof _0x3464c1&&!_[_0x4c9b('0x13')](_0x3464c1)){return _0x3464c1;}return _0x4c9b('0x14');};exports[_0x4c9b('0x15')]=function(_0x3cdaf3){if(_[_0x4c9b('0x16')](_0x3cdaf3)){return![];}return _0x3cdaf3;};exports[_0x4c9b('0x17')]=function(_0x12cf52,_0x1d4046,_0xf72eb1,_0x3d16c6,_0x27f63c,_0x1e99e7){var _0x3e0cd9={'XMD-QUEUE':_0x1d4046['Queue']?_0x1d4046['Queue'][_0x4c9b('0x18')]:'','XMD-CALLERID':_0x3d16c6,'XMD-CALLERID-PREVIEW':_0x1e99e7?util['format']('\x22%s\x22\x20<%s>',_0x1e99e7['calleridname'],_0x1e99e7[_0x4c9b('0x19')]):_0x3d16c6,'XMD-DIALID':_0x27f63c,'XMD-CONTACTID':_0x1d4046[_0x4c9b('0x1a')],'XMD-CDRTYPE':_0x4c9b('0x1b'),'CALLERID(all)':_0x3d16c6,'XMD-VOICEQUEUEID':_0x1d4046[_0x4c9b('0x1c')],'XMD-DIALCHANNEL':_0xf72eb1,'XMD-DIALTIMEOUT':_0x12cf52[_0x4c9b('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x4c9b('0x11')](_0x4c9b('0x1e'),_0x12cf52[_0x4c9b('0x1f')]?'g':'',_['isEmpty'](_0x12cf52['monitor_format'])?'':_0x4c9b('0x20')),'XMD-DIALURL':_0x12cf52[_0x4c9b('0x21')]||'','XMD-AGI':_0x12cf52[_0x4c9b('0x22')]?util[_0x4c9b('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x12cf52[_0x4c9b('0x22')]):_0x4c9b('0x23'),'XMD-AGIAFTER':_0x12cf52[_0x4c9b('0x1f')]?util[_0x4c9b('0x11')](_0x4c9b('0x24'),ipAgi,_0x12cf52['dialQueueProject2']):_0x4c9b('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1e99e7?_0x1e99e7[_0x4c9b('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x1e99e7?_0x1e99e7[_0x4c9b('0x26')]:'','XMD-DESTINATION':_0x4c9b('0x27')};if(!_[_0x4c9b('0x13')](_0x12cf52[_0x4c9b('0x28')])){_0x3e0cd9[util[_0x4c9b('0x11')]('%s',_0x4c9b('0x29'))]=_0x12cf52[_0x4c9b('0x28')];_0x3e0cd9[util[_0x4c9b('0x11')]('%s',_0x4c9b('0x2a'))]=_0x27f63c;}if(_0x1d4046&&_0x1d4046[_0x4c9b('0x2b')]){for(var _0x4dc148 in _0x1d4046[_0x4c9b('0x2b')]){if(_0x1d4046['Contact'][_0x4c9b('0x2c')](_0x4dc148)){if(!_[_0x4c9b('0x16')](_0x1d4046['Contact'][_0x4dc148])&&_0x4dc148!=='id'&&_0x4dc148!==_0x4c9b('0x2d')&&_0x4dc148!==_0x4c9b('0x2e')&&_0x4dc148!=='updatedAt'){_0x3e0cd9[util[_0x4c9b('0x11')](_0x4c9b('0x2f'),_0x4c9b('0x30'),_[_0x4c9b('0x31')](_0x4dc148))]=_0x1d4046[_0x4c9b('0x2b')][_0x4dc148];}}}}return _0x3e0cd9;};exports[_0x4c9b('0x32')]=function(_0x1f3764){var _0x3188ed={};for(var _0x128e4e in _0x1f3764){if(_0x1f3764[_0x4c9b('0x2c')](_0x128e4e)){_0x3188ed[util[_0x4c9b('0x11')]('%s',_['toLower'](_0x128e4e))]=_0x1f3764[_0x128e4e];}}return{'variables':_0x3188ed};};exports['updateOriginated']=function(_0x1ef9de,_0x5902b5){if(!_[_0x4c9b('0x16')](_0x1ef9de)){if(_0x1ef9de[_0x4c9b('0x2c')](_0x4c9b('0x33'))){if(_0x1ef9de[_0x4c9b('0x33')]>0x0){_0x1ef9de[_0x4c9b('0x33')]-=0x1;}else{logger[_0x4c9b('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5902b5);}}}else{logger[_0x4c9b('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5902b5);}};exports[_0x4c9b('0x34')]=function(_0x3348d2){var _0x3bebb6=moment()['format'](_0x4c9b('0x35'));_0x3348d2[_0x4c9b('0x36')]=0xd;_0x3348d2['statedesc']=_0x4c9b('0x37');_0x3348d2[_0x4c9b('0x38')]=_0x3bebb6;_0x3348d2[_0x4c9b('0x39')]=_0x3bebb6;_0x3348d2[_0x4c9b('0x3a')]=_0x3bebb6;};exports[_0x4c9b('0x3b')]=function(_0x58e352,_0xf5efc6,_0x1c941b){var _0x3d1b0a=moment()['format'](_0x4c9b('0x35'));_0x58e352[_0x4c9b('0x36')]=_0xf5efc6;_0x58e352[_0x4c9b('0x3c')]=_0x1c941b;_0x58e352['responsetime']=_0x3d1b0a;_0x58e352[_0x4c9b('0x3d')]=getSeconds(_0x58e352[_0x4c9b('0x39')],_0x58e352[_0x4c9b('0x38')]);};exports[_0x4c9b('0x3e')]=function(_0x328e11,_0xa82815,_0x148654){_0x328e11[_0x4c9b('0x3f')]=_0xa82815;_0x328e11[_0x4c9b('0x40')]=_0x148654;};exports[_0x4c9b('0x41')]=function(_0x3b7f3b,_0xcda11,_0x1c0b67){var _0x3a9e69=moment()[_0x4c9b('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b7f3b[_0x4c9b('0x36')]=_0xcda11;_0x3b7f3b['statedesc']=_0x1c0b67;_0x3b7f3b[_0x4c9b('0x39')]=_0x3b7f3b[_0x4c9b('0x39')]?_0x3b7f3b['responsetime']:_0x3a9e69;_0x3b7f3b[_0x4c9b('0x3a')]=_0x3b7f3b['endtime']?_0x3b7f3b[_0x4c9b('0x3a')]:_0x3a9e69;_0x3b7f3b[_0x4c9b('0x3d')]=getSeconds(_0x3b7f3b[_0x4c9b('0x39')]||0x0,_0x3b7f3b[_0x4c9b('0x38')]||0x0);_0x3b7f3b[_0x4c9b('0x42')]=_0x3b7f3b[_0x4c9b('0x43')]?getSeconds(_0x3b7f3b['endtime'],_0x3b7f3b[_0x4c9b('0x43')]):0x0;};exports['isFailure']=function(_0x371b4a){return _0x371b4a===_0x4c9b('0x44');};exports[_0x4c9b('0x45')]=function(_0x393513,_0x291580,_0x2bde16,_0x31afa4,_0x3f499a){var _0x5aad74=_0x31afa4?'RECALL':_0x393513[_0x4c9b('0x46')];_0x5aad74=_0x3f499a?_0x4c9b('0x47'):_0x5aad74;return{'actionid':_0x393513[_0x4c9b('0x48')],'action':_0x4c9b('0x49'),'channel':_0x393513['channelAgent'],'callerid':util[_0x4c9b('0x11')](_0x4c9b('0x12'),_0x5aad74,_0x393513[_0x4c9b('0x19')]),'Exten':'xcally-motion-preview','Context':_0x4c9b('0x4a'),'Priority':'1','variable':_0x2bde16,'timeout':(_0x291580[_0x4c9b('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x393513[_0x4c9b('0x48')]};};exports[_0x4c9b('0x4c')]=function(_0x48ee86){return _0x48ee86['countbusyretry']+_0x48ee86[_0x4c9b('0x4d')]+_0x48ee86['countnoanswerretry']+_0x48ee86['countagentrejectretry']+_0x48ee86['countnosuchnumberretry'];};exports[_0x4c9b('0x4e')]=function(_0xdbb27b){var _0xcee4ba=_[_0x4c9b('0x4f')](_0xdbb27b);_0xcee4ba['state']=0xf;_0xcee4ba[_0x4c9b('0x3c')]=_0x4c9b('0x50');return _0xcee4ba;};exports[_0x4c9b('0x51')]=function(_0x372f85,_0x36ab95,_0x2ddc49){var _0x5bdc9a={};_0x5bdc9a[_0x36ab95]=_0x372f85[_0x36ab95];_0x5bdc9a[_0x4c9b('0x52')]=![];_0x5bdc9a[_0x4c9b('0x53')]=moment()['add'](_0x2ddc49,_0x4c9b('0x54'))[_0x4c9b('0x11')](_0x4c9b('0x35'));_0x5bdc9a[_0x4c9b('0x1a')]=_0x372f85[_0x4c9b('0x1a')];_0x5bdc9a[_0x4c9b('0x55')]=_0x372f85[_0x4c9b('0x55')];_0x5bdc9a[_0x4c9b('0x1c')]=_0x372f85[_0x4c9b('0x1c')]||undefined;return _0x5bdc9a;};exports[_0x4c9b('0x56')]=function(_0x5bcd69,_0x45674b){if(!_['isNil'](_0x5bcd69)){if(_0x5bcd69[_0x4c9b('0x57')]>0x0){_0x5bcd69[_0x4c9b('0x57')]-=0x1;}else{logger[_0x4c9b('0x8')](_0x45674b,_0x4c9b('0x58'));}}else{logger[_0x4c9b('0x8')](_0x45674b,_0x4c9b('0x59'));}};exports[_0x4c9b('0x5a')]=function(_0x228762){if(_0x228762<=0x0){return!![];}return![];};exports[_0x4c9b('0x5b')]=function(_0x224814,_0x449b7a,_0x25c751){_0x224814[_0x4c9b('0x5c')]=_0x449b7a;_0x224814[_0x4c9b('0x18')]=_0x224814[_0x4c9b('0x5d')];_0x224814[_0x4c9b('0x5e')]=_0x224814[_0x4c9b('0x5f')];if(_0x25c751){_0x224814['mandatoryDisposition']=_0x25c751[_0x4c9b('0x60')];}return _0x224814;};exports[_0x4c9b('0x61')]=function(_0x2d2daa){var _0x179858={};_0x179858[_0x4c9b('0x5d')]=_0x2d2daa[_0x4c9b('0x5d')];_0x179858[_0x4c9b('0x5e')]=_0x2d2daa[_0x4c9b('0x5f')];_0x179858[_0x4c9b('0x48')]=_0x2d2daa[_0x4c9b('0x48')];return _0x179858;};exports[_0x4c9b('0x62')]=function(_0x54e25c){var _0x30685c=[];for(var _0x38f694 in _0x54e25c){if(_0x54e25c[_0x4c9b('0x2c')](_0x38f694)){if(!_['isNil'](_0x54e25c[_0x38f694])&&_0x54e25c[_0x38f694][_0x4c9b('0x36')]===_0x4c9b('0x63')&&_0x54e25c[_0x38f694][_0x4c9b('0x64')]===_0x4c9b('0x65')){_0x30685c['push'](_0x54e25c[_0x38f694]['id']);}}}return _0x30685c;};exports[_0x4c9b('0x66')]=function(_0x2b5c1f){var _0xea257f=moment()[_0x4c9b('0x5')](0x0);var _0x1d3de1=moment(_0x2b5c1f)[_0x4c9b('0x5')](0x0);return _0xea257f[_0x4c9b('0x6')](_0x1d3de1,_0x4c9b('0x67'));};exports[_0x4c9b('0x68')]=function(_0xfcf07c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xfcf07c[_0x4c9b('0x1a')],'ListId':_0xfcf07c[_0x4c9b('0x55')],'VoiceQueueId':_0xfcf07c['VoiceQueueId']||undefined,'CampaignId':_0xfcf07c[_0x4c9b('0x69')]||undefined};};exports['filterKey']=function(_0x146212){if(_0x146212==='uniqueid'||_0x146212===_0x4c9b('0x6a')||_0x146212===_0x4c9b('0x5d')||_0x146212===_0x4c9b('0x6b')||_0x146212===_0x4c9b('0x6c')||_0x146212==='dialAnswer'||_0x146212===_0x4c9b('0x3f')||_0x146212===_0x4c9b('0x5f')||_0x146212===_0x4c9b('0x46')||_0x146212==='active'||_0x146212===_0x4c9b('0x19')||_0x146212==='scheduledat'||_0x146212==='countbusyretry'||_0x146212===_0x4c9b('0x4d')||_0x146212===_0x4c9b('0x6d')||_0x146212===_0x4c9b('0x6e')||_0x146212===_0x4c9b('0x6f')||_0x146212===_0x4c9b('0x70')||_0x146212==='callbackat'||_0x146212===_0x4c9b('0x71')||_0x146212===_0x4c9b('0x1a')||_0x146212==='ListId'||_0x146212===_0x4c9b('0x40')||_0x146212===_0x4c9b('0x1c')||_0x146212==='sipcallid'||_0x146212===_0x4c9b('0x72')||_0x146212===_0x4c9b('0x73')||_0x146212===_0x4c9b('0x74')||_0x146212===_0x4c9b('0x75')||_0x146212==='xmd-dialurl'||_0x146212==='xmd-dialtimeout'||_0x146212===_0x4c9b('0x76')||_0x146212==='xmd-dialid'||_0x146212===_0x4c9b('0x77')||_0x146212==='xmd-contactid'||_0x146212===_0x4c9b('0x78')||_0x146212===_0x4c9b('0x79')||_0x146212==='xmd-agiafter'||_0x146212==='xmd-agi'||_0x146212==='rtpaudioqos'||_0x146212===_0x4c9b('0x7a')||_0x146212==='rtpaudioqosjitter'||_0x146212===_0x4c9b('0x7b')||_0x146212===_0x4c9b('0x7c')||_0x146212===_0x4c9b('0x7d')||_0x146212===_0x4c9b('0x7e')||_0x146212==='rtpaudioqosrttbridged'||_0x146212===_0x4c9b('0x7f')||_0x146212===_0x4c9b('0x7a')||_0x146212===_0x4c9b('0x80')||_0x146212===_0x4c9b('0x7b')||_0x146212===_0x4c9b('0x7c')||_0x146212===_0x4c9b('0x7d')||_0x146212===_0x4c9b('0x7e')||_0x146212===_0x4c9b('0x81')||_0x146212===_0x4c9b('0x82')||_0x146212===_0x4c9b('0x83')||_0x146212===_0x4c9b('0x36')||_0x146212===_0x4c9b('0x3c')){return![];}return!![];};exports[_0x4c9b('0x84')]=function(_0x44a835,_0x35bb0f){var _0x390cdd,_0x4b1817,_0xe4b0cd;if(_0x35bb0f<=0x0){_0x35bb0f=0x1;}_0x390cdd=new RegExp('\x5cw{0,'+_0x35bb0f+'}$');_0x4b1817=Math[_0x4c9b('0x85')](0xa,_0x35bb0f-0x1);_0xe4b0cd=Math['pow'](0xa,_0x35bb0f)-0x1;return util[_0x4c9b('0x11')]('%s',_[_0x4c9b('0x86')](_0x44a835,_0x390cdd,_[_0x4c9b('0x87')](_0x4b1817,_0xe4b0cd)));};exports['extractCalleridName']=function(_0x281454){var _0x32402c=_0x281454['match'](/"(.*?)"/);return _0x32402c?_0x32402c[0x1]:_0x281454;};exports['extractCalleridNumber']=function(_0x1ffcbe){var _0x61c5cb=_0x1ffcbe[_0x4c9b('0x88')](/<(.*?)>/);return _0x61c5cb?_0x61c5cb[0x1]:_0x1ffcbe;};
\ No newline at end of file
+var _0x26c8=['rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','toLowerCase','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','loggerCatch','inspect','logger','logger2','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','logLookAgent','membername','talktime','answertime','isFailure','Failure','RECALL','BOOKED','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','VoiceQueueId','pTalking','error','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildObj','queue','hasOwnProperty','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','ListId','CampaignId','filterKey','type','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0xf8e7fe,_0x5325bb){var _0x4975d5=function(_0x3d7660){while(--_0x3d7660){_0xf8e7fe['push'](_0xf8e7fe['shift']());}};_0x4975d5(++_0x5325bb);}(_0x26c8,0x128));var _0x826c=function(_0x284da7,_0x5a8125){_0x284da7=_0x284da7-0x0;var _0x84a9d1=_0x26c8[_0x284da7];return _0x84a9d1;};'use strict';var util=require(_0x826c('0x0'));var _=require(_0x826c('0x1'));var moment=require(_0x826c('0x2'));var logger=require(_0x826c('0x3'))('preview');var ipAgi=process[_0x826c('0x4')][_0x826c('0x5')]||'127.0.0.1';var utils=require('../../dialer/utils');exports[_0x826c('0x6')]=function(_0x22d415){return function(_0x53a9bf){logger['error'](_0x22d415,util[_0x826c('0x7')](_0x53a9bf,{'showHidden':![],'depth':null}));};};exports[_0x826c('0x8')]=function(_0x13c0fb,_0x1d14ab){logger['info'](_0x13c0fb,util[_0x826c('0x7')](_0x1d14ab,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x55426d,_0x30aa94){logger['error'](_0x55426d,util[_0x826c('0x7')](_0x30aa94,{'showHidden':![],'depth':null}));};exports[_0x826c('0x9')]=function(_0x5d6c6e){return function(_0x20faa5){logger[_0x826c('0xa')](_0x5d6c6e,util[_0x826c('0x7')](_0x20faa5,{'showHidden':![],'depth':null}));};};exports[_0x826c('0xb')]=function(_0x24889a,_0x32ee84,_0x191c83){return{'message':_0x24889a,'unlock':_0x32ee84,'active':_0x191c83};};exports[_0x826c('0xc')]=function(_0x50c0b7,_0x361a1c,_0x3b71f7){if(!_[_0x826c('0xd')](_0x3b71f7)&&_0x826c('0xe')===typeof _0x3b71f7&&!_[_0x826c('0xf')](_0x3b71f7)){if(!_[_0x826c('0xd')](_0x361a1c)&&_0x826c('0xe')===typeof _0x361a1c&&!_[_0x826c('0xf')](_0x361a1c)){return util['format'](_0x826c('0x10'),_0x361a1c,_0x3b71f7);}return util[_0x826c('0x11')](_0x826c('0x10'),_0x3b71f7,_0x3b71f7);}if(!_[_0x826c('0xd')](_0x50c0b7)&&_0x826c('0xe')===typeof _0x50c0b7&&!_[_0x826c('0xf')](_0x50c0b7)){return _0x50c0b7;}return'\x22\x22\x20<>';};exports[_0x826c('0x12')]=function(_0x1220ef){if(_[_0x826c('0x13')](_0x1220ef)){return![];}return _0x1220ef;};exports[_0x826c('0x14')]=function(_0x5c4e5e,_0x1699b4,_0x6dfbb4,_0xdbad27,_0x4f9de9,_0x96bc52){var _0x325668={'XMD-QUEUE':_0x1699b4[_0x826c('0x15')]?_0x1699b4[_0x826c('0x15')][_0x826c('0x16')]:'','XMD-CALLERID':_0xdbad27,'XMD-CALLERID-PREVIEW':_0x96bc52?util[_0x826c('0x11')](_0x826c('0x10'),_0x96bc52[_0x826c('0x17')],_0x96bc52['calleridnum']):_0xdbad27,'XMD-DIALID':_0x4f9de9,'XMD-CONTACTID':_0x1699b4[_0x826c('0x18')],'XMD-CDRTYPE':_0x826c('0x19'),'CALLERID(all)':_0xdbad27,'XMD-VOICEQUEUEID':_0x1699b4['VoiceQueueId'],'XMD-DIALCHANNEL':_0x6dfbb4,'XMD-DIALTIMEOUT':_0x5c4e5e[_0x826c('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x826c('0x1b'),_0x5c4e5e[_0x826c('0x1c')]?'g':'',_[_0x826c('0xf')](_0x5c4e5e[_0x826c('0x1d')])?'':_0x826c('0x1e')),'XMD-DIALURL':_0x5c4e5e[_0x826c('0x1f')]||'','XMD-AGI':_0x5c4e5e[_0x826c('0x20')]?util['format'](_0x826c('0x21'),ipAgi,_0x5c4e5e[_0x826c('0x20')]):'NONE','XMD-AGIAFTER':_0x5c4e5e[_0x826c('0x1c')]?util[_0x826c('0x11')](_0x826c('0x21'),ipAgi,_0x5c4e5e[_0x826c('0x1c')]):_0x826c('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x96bc52?_0x96bc52[_0x826c('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x96bc52?_0x96bc52[_0x826c('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x826c('0xf')](_0x5c4e5e['monitor_format'])){_0x325668[util[_0x826c('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5c4e5e[_0x826c('0x1d')];_0x325668[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4f9de9;}return _0x325668;};exports[_0x826c('0x25')]=function(_0x1c1b1d){var _0xa93257={};for(var _0x1ccb90 in _0x1c1b1d){if(_0x1c1b1d['hasOwnProperty'](_0x1ccb90)){_0xa93257[util[_0x826c('0x11')]('%s',_[_0x826c('0x26')](_0x1ccb90))]=_0x1c1b1d[_0x1ccb90];}}return{'variables':_0xa93257};};exports[_0x826c('0x27')]=function(_0xfa21f4,_0x3e640f){if(!_['isNil'](_0xfa21f4)){if(_0xfa21f4['hasOwnProperty'](_0x826c('0x28'))){if(_0xfa21f4[_0x826c('0x28')]>0x0){_0xfa21f4['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3e640f);}}}else{logger['error'](_0x826c('0x29'),_0x3e640f);}};exports[_0x826c('0x2a')]=function(_0x5c902d){var _0x2a88d4=moment()[_0x826c('0x11')](_0x826c('0x2b'));_0x5c902d[_0x826c('0x2c')]=0xd;_0x5c902d['statedesc']=_0x826c('0x2d');_0x5c902d[_0x826c('0x2e')]=_0x2a88d4;_0x5c902d[_0x826c('0x2f')]=_0x2a88d4;_0x5c902d[_0x826c('0x30')]=_0x2a88d4;};exports[_0x826c('0x31')]=function(_0x2e90f0,_0x4f6e11,_0x2864ac){var _0x30bd50=moment()[_0x826c('0x11')](_0x826c('0x2b'));_0x2e90f0['state']=_0x4f6e11;_0x2e90f0[_0x826c('0x32')]=_0x2864ac;_0x2e90f0[_0x826c('0x2f')]=_0x30bd50;_0x2e90f0[_0x826c('0x33')]=utils[_0x826c('0x34')](_0x2e90f0[_0x826c('0x2f')],_0x2e90f0[_0x826c('0x2e')]);};exports[_0x826c('0x35')]=function(_0x441a53,_0x24f61a,_0x4c06fa){_0x441a53[_0x826c('0x36')]=_0x24f61a;_0x441a53['UserId']=_0x4c06fa;};exports['logCustomer']=function(_0x32f3df,_0x6a5524,_0x3bd4b6){var _0x1ff61b=moment()['format'](_0x826c('0x2b'));_0x32f3df[_0x826c('0x2c')]=_0x6a5524;_0x32f3df[_0x826c('0x32')]=_0x3bd4b6;_0x32f3df['responsetime']=_0x32f3df[_0x826c('0x2f')]?_0x32f3df[_0x826c('0x2f')]:_0x1ff61b;_0x32f3df[_0x826c('0x30')]=_0x32f3df[_0x826c('0x30')]?_0x32f3df[_0x826c('0x30')]:_0x1ff61b;_0x32f3df[_0x826c('0x33')]=utils[_0x826c('0x34')](_0x32f3df['responsetime']||0x0,_0x32f3df[_0x826c('0x2e')]||0x0);_0x32f3df[_0x826c('0x37')]=_0x32f3df[_0x826c('0x38')]?utils[_0x826c('0x34')](_0x32f3df[_0x826c('0x30')],_0x32f3df[_0x826c('0x38')]):0x0;};exports[_0x826c('0x39')]=function(_0x32524c){return _0x32524c===_0x826c('0x3a');};exports['variablesAction']=function(_0x30f620,_0x36a1a5,_0x23f213,_0x1aaf6b,_0x3179c7){var _0x3aa466=_0x1aaf6b?_0x826c('0x3b'):_0x30f620[_0x826c('0x17')];_0x3aa466=_0x3179c7?_0x826c('0x3c'):_0x3aa466;return{'actionid':_0x30f620['uniqueid'],'action':_0x826c('0x3d'),'channel':_0x30f620[_0x826c('0x3e')],'callerid':util[_0x826c('0x11')](_0x826c('0x10'),_0x3aa466,_0x30f620[_0x826c('0x3f')]),'Exten':_0x826c('0x40'),'Context':_0x826c('0x41'),'Priority':'1','variable':_0x23f213,'timeout':(_0x36a1a5[_0x826c('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x30f620[_0x826c('0x43')]};};exports['totalGlobal']=function(_0x2485ca){return _0x2485ca[_0x826c('0x44')]+_0x2485ca[_0x826c('0x45')]+_0x2485ca['countnoanswerretry']+_0x2485ca[_0x826c('0x46')]+_0x2485ca['countnosuchnumberretry'];};exports[_0x826c('0x47')]=function(_0x315028){var _0x56875d=_[_0x826c('0x48')](_0x315028);_0x56875d[_0x826c('0x2c')]=0xf;_0x56875d[_0x826c('0x32')]=_0x826c('0x49');return _0x56875d;};exports[_0x826c('0x4a')]=function(_0x2dbdca,_0x588e2d,_0x54be1){var _0x51ccbe={};_0x51ccbe[_0x588e2d]=_0x2dbdca[_0x588e2d];_0x51ccbe['active']=![];_0x51ccbe[_0x826c('0x4b')]=moment()[_0x826c('0x4c')](_0x54be1,'minutes')[_0x826c('0x11')](_0x826c('0x2b'));_0x51ccbe[_0x826c('0x18')]=_0x2dbdca[_0x826c('0x18')];_0x51ccbe['ListId']=_0x2dbdca['ListId'];_0x51ccbe[_0x826c('0x4d')]=_0x2dbdca['VoiceQueueId']||undefined;return _0x51ccbe;};exports['decrementTalkink']=function(_0x4a63be,_0x3dc538){if(!_[_0x826c('0x13')](_0x4a63be)){if(_0x4a63be[_0x826c('0x4e')]>0x0){_0x4a63be[_0x826c('0x4e')]-=0x1;}else{logger[_0x826c('0x4f')](_0x3dc538,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x826c('0x4f')](_0x3dc538,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x826c('0x50')]=function(_0x5da3fa){if(_0x5da3fa<=0x0){return!![];}return![];};function buildObj(_0x49e9ca,_0x1bdc4f,_0xea4cd6){_0x49e9ca[_0x826c('0x51')]=_0x1bdc4f;_0x49e9ca[_0x826c('0x16')]=_0x49e9ca['queue'];_0x49e9ca[_0x826c('0x52')]=_0x49e9ca[_0x826c('0x3e')];_0x49e9ca[_0x826c('0x53')]=_0x826c('0x54');if(_0xea4cd6){_0x49e9ca[_0x826c('0x55')]=_0xea4cd6[_0x826c('0x55')];}return _0x49e9ca;}exports[_0x826c('0x56')]=buildObj;exports['buildAcw']=function(_0x550ae4){var _0x5b513e={};_0x5b513e[_0x826c('0x57')]=_0x550ae4['queue'];_0x5b513e[_0x826c('0x52')]=_0x550ae4[_0x826c('0x3e')];_0x5b513e[_0x826c('0x43')]=_0x550ae4[_0x826c('0x43')];return _0x5b513e;};exports['agentReadyId']=function(_0x4195ea){var _0x57bb0f=[];for(var _0x4d58c9 in _0x4195ea){if(_0x4195ea[_0x826c('0x58')](_0x4d58c9)){if(!_[_0x826c('0x13')](_0x4195ea[_0x4d58c9])&&_0x4195ea[_0x4d58c9][_0x826c('0x2c')]===_0x826c('0x59')&&_0x4195ea[_0x4d58c9][_0x826c('0x5a')]===_0x826c('0x5b')){_0x57bb0f['push'](_0x4195ea[_0x4d58c9]['id']);}}}return _0x57bb0f;};exports[_0x826c('0x5c')]=function(_0x2720b4){var _0x538bf0=moment()[_0x826c('0x5d')](0x0);var _0x4a416d=moment(_0x2720b4)[_0x826c('0x5d')](0x0);return _0x538bf0[_0x826c('0x5e')](_0x4a416d,_0x826c('0x5f'));};exports[_0x826c('0x60')]=function(_0x245a5d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x245a5d[_0x826c('0x18')],'ListId':_0x245a5d[_0x826c('0x61')],'VoiceQueueId':_0x245a5d[_0x826c('0x4d')]||undefined,'CampaignId':_0x245a5d[_0x826c('0x62')]||undefined};};exports[_0x826c('0x63')]=function(_0x22a8aa){if(_0x22a8aa==='uniqueid'||_0x22a8aa==='idContact'||_0x22a8aa===_0x826c('0x57')||_0x22a8aa===_0x826c('0x64')||_0x22a8aa==='campaigntype'||_0x22a8aa===_0x826c('0x65')||_0x22a8aa==='membername'||_0x22a8aa===_0x826c('0x3e')||_0x22a8aa===_0x826c('0x17')||_0x22a8aa==='active'||_0x22a8aa===_0x826c('0x3f')||_0x22a8aa==='scheduledat'||_0x22a8aa==='countbusyretry'||_0x22a8aa===_0x826c('0x45')||_0x22a8aa===_0x826c('0x66')||_0x22a8aa===_0x826c('0x67')||_0x22a8aa===_0x826c('0x68')||_0x22a8aa===_0x826c('0x69')||_0x22a8aa===_0x826c('0x6a')||_0x22a8aa===_0x826c('0x6b')||_0x22a8aa==='ContactId'||_0x22a8aa===_0x826c('0x61')||_0x22a8aa===_0x826c('0x6c')||_0x22a8aa===_0x826c('0x4d')||_0x22a8aa===_0x826c('0x6d')||_0x22a8aa===_0x826c('0x6e')||_0x22a8aa===_0x826c('0x6f')||_0x22a8aa==='xmd-phone'||_0x22a8aa===_0x826c('0x70')||_0x22a8aa===_0x826c('0x71')||_0x22a8aa===_0x826c('0x72')||_0x22a8aa===_0x826c('0x73')||_0x22a8aa===_0x826c('0x74')||_0x22a8aa===_0x826c('0x75')||_0x22a8aa===_0x826c('0x76')||_0x22a8aa==='xmd-cdrtype'||_0x22a8aa==='xmd-callerid'||_0x22a8aa===_0x826c('0x77')||_0x22a8aa==='xmd-agi'||_0x22a8aa===_0x826c('0x78')||_0x22a8aa===_0x826c('0x79')||_0x22a8aa==='rtpaudioqosjitter'||_0x22a8aa==='rtpaudioqosjitterbridged'||_0x22a8aa==='rtpaudioqosloss'||_0x22a8aa===_0x826c('0x7a')||_0x22a8aa===_0x826c('0x7b')||_0x22a8aa==='rtpaudioqosrttbridged'||_0x22a8aa===_0x826c('0x78')||_0x22a8aa===_0x826c('0x79')||_0x22a8aa===_0x826c('0x7c')||_0x22a8aa==='rtpaudioqosjitterbridged'||_0x22a8aa===_0x826c('0x7d')||_0x22a8aa==='rtpaudioqoslossbridged'||_0x22a8aa===_0x826c('0x7b')||_0x22a8aa===_0x826c('0x7e')||_0x22a8aa===_0x826c('0x7f')||_0x22a8aa==='bridgepvtcallid'||_0x22a8aa===_0x826c('0x2c')||_0x22a8aa===_0x826c('0x32')){return![];}return!![];};exports[_0x826c('0x80')]=function(_0x59aa10,_0x50a741){var _0x57a090,_0xcbbd1f,_0xd458d4;if(_0x50a741<=0x0){_0x50a741=0x1;}_0x57a090=new RegExp(_0x826c('0x81')+_0x50a741+'}$');_0xcbbd1f=Math[_0x826c('0x82')](0xa,_0x50a741-0x1);_0xd458d4=Math[_0x826c('0x82')](0xa,_0x50a741)-0x1;return util[_0x826c('0x11')]('%s',_[_0x826c('0x83')](_0x59aa10,_0x57a090,_[_0x826c('0x84')](_0xcbbd1f,_0xd458d4)));};exports[_0x826c('0x85')]=function(_0x20010a){var _0x31aee3=_0x20010a[_0x826c('0x86')](/"(.*?)"/);return _0x31aee3?_0x31aee3[0x1]:_0x20010a;};exports[_0x826c('0x87')]=function(_0x59f786){var _0x55ef98=_0x59f786[_0x826c('0x86')](/<(.*?)>/);return _0x55ef98?_0x55ef98[0x1]:_0x59f786;};function buildNoAnswerEventPayload(_0x33e17f,_0x2c4712){var _0x575d7b=buildObj(_0x33e17f,_0x826c('0x88'));if(!_[_0x826c('0xf')](_0x2c4712[_0x826c('0x89')])){Object[_0x826c('0x8a')](_0x2c4712[_0x826c('0x89')])['forEach'](function(_0x11aa62){_0x575d7b[_0x11aa62[_0x826c('0x8b')]()]=_0x2c4712[_0x826c('0x89')][_0x11aa62];});}return _0x575d7b;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload;
\ No newline at end of file