Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / components / extensions / rewrite.js
index 9c9fcfb..6e67113 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe622=['playback','hasOwnProperty','priority','extension','exten','extensions','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','push','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','error','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe622,0x1e4));var _0x2e62=function(_0x165f36,_0x5917ed){_0x165f36=_0x165f36-0x0;var _0x5eb673=_0xe622[_0x165f36];return _0x5eb673;};'use strict';var _=require('lodash');var util=require(_0x2e62('0x0'));function rewrite(_0x346745,_0x201730){var _0x38f61f=this;return _0x346745[_0x2e62('0x1')]['Interval'][_0x2e62('0x2')]({'raw':!![]})[_0x2e62('0x3')](function(_0x3632dc){_0x38f61f[_0x2e62('0x4')]=_0x3632dc;return _0x346745['models'][_0x2e62('0x5')][_0x2e62('0x2')]({'where':{'IntervalId':_0x201730[_0x2e62('0x6')]},'raw':!![]});})[_0x2e62('0x3')](function(_0x1d81a1){return _0x346745[_0x2e62('0x1')][_0x2e62('0x5')][_0x2e62('0x2')]({'where':{'exten':{'$in':_[_0x2e62('0x7')](_[_0x2e62('0x8')](_0x1d81a1,'exten'))}},'order':[{'raw':_0x2e62('0x9')}],'raw':!![]});})[_0x2e62('0x3')](function(_0x2f042b){var _0x3d271d=_[_0x2e62('0xa')](_0x2f042b,{'priority':'1'});var _0x23f60f=_[_0x2e62('0xa')](_0x2f042b,{'isApp':0x1});var _0x5b4f5f=_[_0x2e62('0xb')](_0x23f60f,'exten');var _0x2b27f1=[_0x2e62('0xc'),_0x2e62('0xd')];var _0x329607=[];var _0x2b0354=[];for(var _0x43483e in _0x5b4f5f){if(_0x5b4f5f[_0x2e62('0xe')](_0x43483e)){_0x38f61f[_0x2e62('0xf')]=0x2;_0x38f61f['extensions']=[];_0x38f61f[_0x2e62('0x10')]=_['find'](_0x3d271d,{'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')]});_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':util[_0x2e62('0x15')](_0x2e62('0x16'),_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')]),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f['priority']++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});if(_0x5b4f5f[_0x43483e][0x0]['type']===_0x2e62('0x19')){_0x38f61f['extensions']['push']({'type':_0x5b4f5f[_0x43483e][0x0]['type'],'app':'Set','appdata':_0x2e62('0x1a')+_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')],'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}else if(_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')]===_0x2e62('0x1b')){if(_0x38f61f['extension']){_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x1d')+(_0x38f61f[_0x2e62('0x10')]['cutdigits']?_0x2e62('0x1e')+_0x38f61f['extension'][_0x2e62('0x1f')]+'}':_0x2e62('0x20')),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x1a')+_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId'],'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});var _0x3d4b2c=_0x38f61f[_0x2e62('0xf')]++;_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x21'),'appdata':_0x2e62('0x22')+(_0x3d4b2c+0x2)+_0x2e62('0x23')+(_0x3d4b2c+0x1)+')','context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0]['exten'],'priority':_0x3d4b2c,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});if(_0x38f61f[_0x2e62('0x10')]){_0x38f61f['extensions']['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x38f61f[_0x2e62('0x10')][_0x2e62('0x1f')]?_0x2e62('0x24')+_0x38f61f[_0x2e62('0x10')][_0x2e62('0x1f')]+'}':_0x2e62('0x25'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x26')+_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')],'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f['priority']++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});if(_0x38f61f['extension']&&_0x38f61f[_0x2e62('0x10')][_0x2e62('0xe')]('recordingFormat')&&_0x38f61f[_0x2e62('0x10')][_0x2e62('0x27')]!=='none'){_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x28'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x38f61f[_0x2e62('0x10')][_0x2e62('0x27')]||_0x2e62('0x29'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});}}_0x38f61f[_0x2e62('0x12')][_0x2e62('0x1c')]({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x2a'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0]['exten'],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':'Set','appdata':_0x2e62('0x2b'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x2c'),'context':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x17')],'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'priority':_0x38f61f[_0x2e62('0xf')]++,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});for(var _0x1e7f2e=0x0,_0x2d1fe7=0x0;_0x1e7f2e<_0x5b4f5f[_0x43483e][_0x2e62('0x2d')];_0x1e7f2e+=0x1,_0x2d1fe7=0x0){var _0x29bd3b=_0x5b4f5f[_0x43483e][_0x1e7f2e];if(_0x29bd3b[_0x2e62('0x13')]){_0x29bd3b[_0x2e62('0x13')]=_0x29bd3b['type'][_0x2e62('0x2e')]();}var _0x43ff11=[];var _0x1127f5=[];delete _0x29bd3b['id'];delete _0x29bd3b[_0x2e62('0x2f')];delete _0x29bd3b[_0x2e62('0x30')];var _0x3c5d46=_0x29bd3b[_0x2e62('0x31')]!=='*,*,*,*'?[_0x29bd3b['interval']]:_0x29bd3b[_0x2e62('0x6')]?_[_0x2e62('0x8')](_[_0x2e62('0xa')](_0x38f61f[_0x2e62('0x4')],{'IntervalId':_0x29bd3b['IntervalId']}),_0x2e62('0x31')):[];if(_0x29bd3b[_0x2e62('0xe')](_0x2e62('0x32'))){if(_0x29bd3b[_0x2e62('0x32')]&&_0x29bd3b[_0x2e62('0x32')]!=='--'){_0x43ff11['push']({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x33')+_0x29bd3b['tag'],'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b['VoiceExtensionId']});}}if(_0x29bd3b[_0x2e62('0x13')]===_0x2e62('0x1b')&&_0x29bd3b[_0x2e62('0xe')]('callerID')){if(_0x29bd3b['callerID']){_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b['type'],'app':_0x2e62('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x29bd3b['callerID']+')','context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});}else{_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x21'),'appdata':_0x2e62('0x34'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b['VoiceExtensionId']});}}if(_0x29bd3b['hasOwnProperty']('answer')){if(_0x2b27f1[_0x2e62('0x35')](_0x29bd3b[_0x2e62('0x36')]['toLowerCase']())>=0x0&&_0x29bd3b[_0x2e62('0x37')]!==_0x2e62('0x38')){if(_0x29bd3b[_0x2e62('0x39')]){_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b['type'],'app':_0x2e62('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46['length']+_0x38f61f['priority']+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x3a'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f['priority']+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});}else{_0x43ff11['push']({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x21'),'appdata':_0x2e62('0x3b'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f[_0x2e62('0xf')]+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});_0x43ff11[_0x2e62('0x1c')]({'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x14'),'appdata':_0x2e62('0x3c'),'context':_0x29bd3b[_0x2e62('0x17')],'exten':_0x29bd3b[_0x2e62('0x11')],'priority':_0x3c5d46[_0x2e62('0x2d')]+_0x38f61f['priority']+_0x2d1fe7++,'VoiceExtensionId':_0x29bd3b[_0x2e62('0x18')]});}}}for(var _0x33f75c=0x0;_0x33f75c<_0x3c5d46[_0x2e62('0x2d')];_0x33f75c+=0x1){var _0x4bff2f=_0x38f61f['priority']+_0x3c5d46[_0x2e62('0x2d')];var _0xcc273d=_0x33f75c===_0x3c5d46[_0x2e62('0x2d')]-0x1?_0x38f61f[_0x2e62('0xf')]+_0x43ff11[_0x2e62('0x2d')]+_0x1127f5['length']+0x2:_0x38f61f[_0x2e62('0xf')]+_0x33f75c+0x1;_0x43ff11[_0x2e62('0x3d')](_0x33f75c,0x0,{'type':_0x29bd3b[_0x2e62('0x13')],'app':_0x2e62('0x3e'),'appdata':_0x3c5d46[_0x33f75c]+'?'+_0x29bd3b[_0x2e62('0x17')]+_0x2e62('0x3f')+_0x4bff2f+':'+_0x29bd3b[_0x2e62('0x17')]+_0x2e62('0x3f')+_0xcc273d,'exten':_0x29bd3b['exten'],'context':_0x29bd3b[_0x2e62('0x17')],'priority':_0x38f61f[_0x2e62('0xf')]+_0x33f75c,'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']});}_0x29bd3b[_0x2e62('0xf')]=_0x43ff11[_0x2e62('0x2d')]?_['last'](_0x43ff11)[_0x2e62('0xf')]+0x1:_0x38f61f['priority'];_0x38f61f['priority']=(_0x1127f5[_0x2e62('0x2d')]?_[_0x2e62('0x40')](_0x1127f5)['priority']:_0x29bd3b['priority'])+0x1;_0x38f61f[_0x2e62('0x12')]=_[_0x2e62('0x41')](_0x38f61f['extensions'],_0x43ff11,[_0x29bd3b],_0x1127f5);}_0x38f61f[_0x2e62('0x12')]['push']({'type':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x13')],'app':_0x2e62('0x42'),'exten':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x11')],'context':_0x5b4f5f[_0x43483e][0x0]['context'],'priority':_0x38f61f[_0x2e62('0xf')],'VoiceExtensionId':_0x5b4f5f[_0x43483e][0x0][_0x2e62('0x18')]});_0x329607[_0x2e62('0x1c')](_0x5b4f5f[_0x43483e][0x0]['VoiceExtensionId']);_0x2b0354=_[_0x2e62('0x41')](_0x2b0354,_0x38f61f[_0x2e62('0x12')]);}}return _0x346745[_0x2e62('0x43')](function(_0x328790){return _0x346745[_0x2e62('0x1')][_0x2e62('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x329607}},'transaction':_0x328790})[_0x2e62('0x3')](function(_0x48d7a2){return _0x346745[_0x2e62('0x1')][_0x2e62('0x5')][_0x2e62('0x44')](_[_0x2e62('0x45')](_0x2b0354,_0x2e62('0xf')),{'transaction':_0x328790});});});})['catch'](function(_0x105d1c){console[_0x2e62('0x46')](_0x105d1c);});}exports['rewrite']=rewrite;
\ No newline at end of file
+var _0x869e=['models','VoiceExtension','uniq','map','exten','filter','groupBy','queue','playback','find','extensions','Set','format','CDR(type)=%s','context','priority','type','push','CDR(routeid)=','VoiceExtensionId','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','outbound','callerID','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','concat','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals'];(function(_0x5e2371,_0x1d264e){var _0x1e065b=function(_0x4bcd6a){while(--_0x4bcd6a){_0x5e2371['push'](_0x5e2371['shift']());}};_0x1e065b(++_0x1d264e);}(_0x869e,0x88));var _0xe869=function(_0x2d2e9d,_0x272e3f){_0x2d2e9d=_0x2d2e9d-0x0;var _0x59c748=_0x869e[_0x2d2e9d];return _0x59c748;};'use strict';var _=require(_0xe869('0x0'));var util=require(_0xe869('0x1'));function rewrite(_0x25b267,_0x3066d0){var _0x10540f=this;return _0x25b267['models'][_0xe869('0x2')][_0xe869('0x3')]({'raw':!![]})[_0xe869('0x4')](function(_0x59f7fb){_0x10540f[_0xe869('0x5')]=_0x59f7fb;return _0x25b267[_0xe869('0x6')][_0xe869('0x7')]['findAll']({'where':{'IntervalId':_0x3066d0['IntervalId']},'raw':!![]});})[_0xe869('0x4')](function(_0x2cf24d){return _0x25b267[_0xe869('0x6')][_0xe869('0x7')][_0xe869('0x3')]({'where':{'exten':{'$in':_[_0xe869('0x8')](_[_0xe869('0x9')](_0x2cf24d,_0xe869('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x36bf9c){var _0x180e34=_[_0xe869('0xb')](_0x36bf9c,{'priority':'1'});var _0x229724=_['filter'](_0x36bf9c,{'isApp':0x1});var _0xc3b70d=_[_0xe869('0xc')](_0x229724,_0xe869('0xa'));var _0x3708d1=[_0xe869('0xd'),_0xe869('0xe')];var _0x55e7b2=[];var _0x5e1884=[];for(var _0xe01acf in _0xc3b70d){if(_0xc3b70d['hasOwnProperty'](_0xe01acf)){_0x10540f['priority']=0x2;_0x10540f['extensions']=[];_0x10540f['extension']=_[_0xe869('0xf')](_0x180e34,{'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')]});_0x10540f[_0xe869('0x10')]['push']({'type':_0xc3b70d[_0xe01acf][0x0]['type'],'app':_0xe869('0x11'),'appdata':util[_0xe869('0x12')](_0xe869('0x13'),_0xc3b70d[_0xe01acf][0x0]['type']),'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0]['VoiceExtensionId']});if(_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')]==='inbound'){_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0]['type'],'app':_0xe869('0x11'),'appdata':_0xe869('0x18')+_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')],'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});}else if(_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')]==='outbound'){if(_0x10540f[_0xe869('0x1a')]){_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':'Set','appdata':_0xe869('0x1b')+(_0x10540f[_0xe869('0x1a')][_0xe869('0x1c')]?_0xe869('0x1d')+_0x10540f['extension'][_0xe869('0x1c')]+'}':_0xe869('0x1e')),'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});}_0x10540f['extensions']['push']({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':_0xe869('0x11'),'appdata':'CDR(routeid)='+_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')],'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f['priority']++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});var _0x56c232=_0x10540f[_0xe869('0x15')]++;_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':_0xe869('0x1f'),'appdata':_0xe869('0x20')+(_0x56c232+0x2)+_0xe869('0x21')+(_0x56c232+0x1)+')','context':_0xc3b70d[_0xe01acf][0x0]['context'],'exten':_0xc3b70d[_0xe01acf][0x0]['exten'],'priority':_0x56c232,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0]['VoiceExtensionId']});if(_0x10540f['extension']){_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':_0xe869('0x11'),'appdata':_0x10540f[_0xe869('0x1a')][_0xe869('0x1c')]?_0xe869('0x22')+_0x10540f[_0xe869('0x1a')][_0xe869('0x1c')]+'}':_0xe869('0x23'),'context':_0xc3b70d[_0xe01acf][0x0]['context'],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0]['VoiceExtensionId']});}_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':_0xe869('0x11'),'appdata':_0xe869('0x24')+_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')],'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0]['VoiceExtensionId']});if(_0x10540f[_0xe869('0x1a')]&&_0x10540f['extension'][_0xe869('0x25')]('recordingFormat')&&_0x10540f[_0xe869('0x1a')]['recordingFormat']!=='none'){_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0]['type'],'app':_0xe869('0x11'),'appdata':_0xe869('0x26'),'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0]['exten'],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':_0xe869('0x11'),'appdata':_0xe869('0x27')+_0x10540f[_0xe869('0x1a')][_0xe869('0x28')]||_0xe869('0x29'),'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0]['exten'],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});}}_0x10540f[_0xe869('0x10')]['push']({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':_0xe869('0x11'),'appdata':_0xe869('0x2a'),'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});_0x10540f['extensions']['push']({'type':_0xc3b70d[_0xe01acf][0x0]['type'],'app':'Set','appdata':_0xe869('0x2b'),'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f[_0xe869('0x15')]++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':'Set','appdata':_0xe869('0x2c'),'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'priority':_0x10540f['priority']++,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0]['VoiceExtensionId']});for(var _0x5497c8=0x0,_0x59fb81=0x0;_0x5497c8<_0xc3b70d[_0xe01acf][_0xe869('0x2d')];_0x5497c8+=0x1,_0x59fb81=0x0){var _0x363457=_0xc3b70d[_0xe01acf][_0x5497c8];if(_0x363457['type']){_0x363457[_0xe869('0x16')]=_0x363457[_0xe869('0x16')][_0xe869('0x2e')]();}var _0x5c63b9=[];var _0x2f1acb=[];delete _0x363457['id'];delete _0x363457[_0xe869('0x2f')];delete _0x363457[_0xe869('0x30')];var _0x50f728=_0x363457[_0xe869('0x31')]!==_0xe869('0x32')?[_0x363457['interval']]:_0x363457[_0xe869('0x33')]?_['map'](_[_0xe869('0xb')](_0x10540f[_0xe869('0x5')],{'IntervalId':_0x363457['IntervalId']}),_0xe869('0x31')):[];if(_0x363457['hasOwnProperty'](_0xe869('0x34'))){if(_0x363457[_0xe869('0x34')]&&_0x363457[_0xe869('0x34')]!=='--'){_0x5c63b9[_0xe869('0x17')]({'type':_0x363457[_0xe869('0x16')],'app':_0xe869('0x11'),'appdata':_0xe869('0x35')+_0x363457[_0xe869('0x34')],'context':_0x363457['context'],'exten':_0x363457['exten'],'priority':_0x50f728[_0xe869('0x2d')]+_0x10540f['priority']+_0x59fb81++,'VoiceExtensionId':_0x363457[_0xe869('0x19')]});}}if(_0x363457['type']===_0xe869('0x36')&&_0x363457['hasOwnProperty'](_0xe869('0x37'))){if(_0x363457[_0xe869('0x37')]){_0x5c63b9[_0xe869('0x17')]({'type':_0x363457[_0xe869('0x16')],'app':_0xe869('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x363457[_0xe869('0x37')]+')','context':_0x363457['context'],'exten':_0x363457[_0xe869('0xa')],'priority':_0x50f728[_0xe869('0x2d')]+_0x10540f[_0xe869('0x15')]+_0x59fb81++,'VoiceExtensionId':_0x363457[_0xe869('0x19')]});}else{_0x5c63b9[_0xe869('0x17')]({'type':_0x363457[_0xe869('0x16')],'app':_0xe869('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x363457[_0xe869('0x14')],'exten':_0x363457[_0xe869('0xa')],'priority':_0x50f728[_0xe869('0x2d')]+_0x10540f['priority']+_0x59fb81++,'VoiceExtensionId':_0x363457['VoiceExtensionId']});}}if(_0x363457['hasOwnProperty'](_0xe869('0x38'))){if(_0x3708d1[_0xe869('0x39')](_0x363457[_0xe869('0x3a')]['toLowerCase']())>=0x0&&_0x363457[_0xe869('0x3b')]!=='custom'){if(_0x363457['answer']){_0x5c63b9['push']({'type':_0x363457['type'],'app':_0xe869('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x363457['context'],'exten':_0x363457['exten'],'priority':_0x50f728[_0xe869('0x2d')]+_0x10540f['priority']+_0x59fb81++,'VoiceExtensionId':_0x363457[_0xe869('0x19')]});_0x5c63b9[_0xe869('0x17')]({'type':_0x363457[_0xe869('0x16')],'app':_0xe869('0x11'),'appdata':_0xe869('0x3c'),'context':_0x363457[_0xe869('0x14')],'exten':_0x363457[_0xe869('0xa')],'priority':_0x50f728['length']+_0x10540f[_0xe869('0x15')]+_0x59fb81++,'VoiceExtensionId':_0x363457[_0xe869('0x19')]});}else{_0x5c63b9[_0xe869('0x17')]({'type':_0x363457[_0xe869('0x16')],'app':_0xe869('0x1f'),'appdata':_0xe869('0x3d'),'context':_0x363457['context'],'exten':_0x363457[_0xe869('0xa')],'priority':_0x50f728[_0xe869('0x2d')]+_0x10540f['priority']+_0x59fb81++,'VoiceExtensionId':_0x363457['VoiceExtensionId']});_0x5c63b9[_0xe869('0x17')]({'type':_0x363457['type'],'app':_0xe869('0x11'),'appdata':_0xe869('0x3e'),'context':_0x363457[_0xe869('0x14')],'exten':_0x363457[_0xe869('0xa')],'priority':_0x50f728['length']+_0x10540f[_0xe869('0x15')]+_0x59fb81++,'VoiceExtensionId':_0x363457[_0xe869('0x19')]});}}}for(var _0x6fefda=0x0;_0x6fefda<_0x50f728[_0xe869('0x2d')];_0x6fefda+=0x1){var _0x341ca2=_0x10540f[_0xe869('0x15')]+_0x50f728[_0xe869('0x2d')];var _0x1b958b=_0x6fefda===_0x50f728[_0xe869('0x2d')]-0x1?_0x10540f[_0xe869('0x15')]+_0x5c63b9[_0xe869('0x2d')]+_0x2f1acb['length']+0x2:_0x10540f['priority']+_0x6fefda+0x1;_0x5c63b9[_0xe869('0x3f')](_0x6fefda,0x0,{'type':_0x363457[_0xe869('0x16')],'app':'GotoIfTime','appdata':_0x50f728[_0x6fefda]+'?'+_0x363457[_0xe869('0x14')]+_0xe869('0x40')+_0x341ca2+':'+_0x363457[_0xe869('0x14')]+_0xe869('0x40')+_0x1b958b,'exten':_0x363457[_0xe869('0xa')],'context':_0x363457['context'],'priority':_0x10540f[_0xe869('0x15')]+_0x6fefda,'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});}_0x363457[_0xe869('0x15')]=_0x5c63b9[_0xe869('0x2d')]?_['last'](_0x5c63b9)[_0xe869('0x15')]+0x1:_0x10540f['priority'];_0x10540f['priority']=(_0x2f1acb['length']?_['last'](_0x2f1acb)[_0xe869('0x15')]:_0x363457[_0xe869('0x15')])+0x1;_0x10540f[_0xe869('0x10')]=_[_0xe869('0x41')](_0x10540f[_0xe869('0x10')],_0x5c63b9,[_0x363457],_0x2f1acb);}_0x10540f[_0xe869('0x10')][_0xe869('0x17')]({'type':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x16')],'app':'Hangup','exten':_0xc3b70d[_0xe01acf][0x0][_0xe869('0xa')],'context':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x14')],'priority':_0x10540f[_0xe869('0x15')],'VoiceExtensionId':_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]});_0x55e7b2[_0xe869('0x17')](_0xc3b70d[_0xe01acf][0x0][_0xe869('0x19')]);_0x5e1884=_['concat'](_0x5e1884,_0x10540f[_0xe869('0x10')]);}}return _0x25b267['transaction'](function(_0x4ad27a){return _0x25b267[_0xe869('0x6')][_0xe869('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x55e7b2}},'transaction':_0x4ad27a})[_0xe869('0x4')](function(_0x1e9c6e){return _0x25b267[_0xe869('0x6')][_0xe869('0x7')][_0xe869('0x42')](_[_0xe869('0x43')](_0x5e1884,_0xe869('0x15')),{'transaction':_0x4ad27a});});});})[_0xe869('0x44')](function(_0x6852b4){console[_0xe869('0x45')](_0x6852b4);});}exports[_0xe869('0x46')]=rewrite;
\ No newline at end of file