Built motion from commit 37e1ed56.|2.6.29
[motion2.git] / server / components / extensions / rewrite.js
index 6e7e1bd..ab8165e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x07c4=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x07c4,0x9b));var _0x407c=function(_0x22e11d,_0x13199c){_0x22e11d=_0x22e11d-0x0;var _0xb38615=_0x07c4[_0x22e11d];return _0xb38615;};'use strict';var _=require(_0x407c('0x0'));var util=require(_0x407c('0x1'));function rewrite(_0x22c575,_0x3021ff){var _0x5ac3d0=this;return _0x22c575[_0x407c('0x2')][_0x407c('0x3')][_0x407c('0x4')]({'raw':!![]})[_0x407c('0x5')](function(_0x1bd723){_0x5ac3d0[_0x407c('0x6')]=_0x1bd723;return _0x22c575[_0x407c('0x2')][_0x407c('0x7')][_0x407c('0x4')]({'where':{'IntervalId':_0x3021ff[_0x407c('0x8')]},'raw':!![]});})['then'](function(_0x283766){return _0x22c575[_0x407c('0x2')][_0x407c('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x407c('0x9')](_[_0x407c('0xa')](_0x283766,_0x407c('0xb')))}},'order':[{'raw':_0x407c('0xc')}],'raw':!![]});})[_0x407c('0x5')](function(_0x4f62d6){var _0x3237c8=_[_0x407c('0xd')](_0x4f62d6,{'priority':'1'});var _0x1856e6=_[_0x407c('0xd')](_0x4f62d6,{'isApp':0x1});var _0x594ba6=_[_0x407c('0xe')](_0x1856e6,_0x407c('0xb'));var _0xc50d26=[_0x407c('0xf'),_0x407c('0x10')];var _0x119bc9=[];var _0x3a0875=[];for(var _0x5e089f in _0x594ba6){if(_0x594ba6[_0x407c('0x11')](_0x5e089f)){_0x5ac3d0[_0x407c('0x12')]=0x2;_0x5ac3d0['extensions']=[];_0x5ac3d0['extension']=_[_0x407c('0x13')](_0x3237c8,{'exten':_0x594ba6[_0x5e089f][0x0]['exten']});_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':util[_0x407c('0x18')](_0x407c('0x19'),_0x594ba6[_0x5e089f][0x0]['type']),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});if(_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')]==='inbound'){_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':'CDR(routeid)='+_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId'],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}else if(_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')]===_0x407c('0x1c')){if(_0x5ac3d0['extension']){_0x5ac3d0[_0x407c('0x14')]['push']({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':'Set','appdata':_0x407c('0x1d')+(_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]?_0x407c('0x20')+_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]+'}':_0x407c('0x21')),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0['priority']++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x22')+_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});var _0x21e565=_0x5ac3d0[_0x407c('0x12')]++;_0x5ac3d0['extensions'][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x21e565+0x2)+_0x407c('0x23')+(_0x21e565+0x1)+')','context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x21e565,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});if(_0x5ac3d0[_0x407c('0x1e')]){_0x5ac3d0['extensions']['push']({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x24')+_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId'],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0['priority']++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId']});if(_0x5ac3d0[_0x407c('0x1e')]&&_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x11')]('recordingFormat')&&_0x5ac3d0[_0x407c('0x1e')][_0x407c('0x25')]!==_0x407c('0x26')){_0x5ac3d0[_0x407c('0x14')]['push']({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x27'),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5ac3d0['extension']['recordingFormat']||_0x407c('0x28'),'context':_0x594ba6[_0x5e089f][0x0]['context'],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x29'),'context':_0x594ba6[_0x5e089f][0x0]['context'],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});_0x5ac3d0['extensions']['push']({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x594ba6[_0x5e089f][0x0]['context'],'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0]['type'],'app':_0x407c('0x17'),'appdata':_0x407c('0x2a'),'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'exten':_0x594ba6[_0x5e089f][0x0]['exten'],'priority':_0x5ac3d0[_0x407c('0x12')]++,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});for(var _0xbfef8d=0x0,_0x45156a=0x0;_0xbfef8d<_0x594ba6[_0x5e089f][_0x407c('0x2b')];_0xbfef8d+=0x1,_0x45156a=0x0){var _0x417385=_0x594ba6[_0x5e089f][_0xbfef8d];if(_0x417385[_0x407c('0x16')]){_0x417385[_0x407c('0x16')]=_0x417385['type'][_0x407c('0x2c')]();}var _0x3a66ac=[];var _0x58f562=[];delete _0x417385['id'];delete _0x417385['createdAt'];delete _0x417385['updatedAt'];var _0x18045e=_0x417385[_0x407c('0x2d')]!=='*,*,*,*'?[_0x417385[_0x407c('0x2d')]]:_0x417385[_0x407c('0x8')]?_[_0x407c('0xa')](_['filter'](_0x5ac3d0['intervals'],{'IntervalId':_0x417385['IntervalId']}),_0x407c('0x2d')):[];if(_0x417385[_0x407c('0x11')](_0x407c('0x2e'))){if(_0x417385[_0x407c('0x2e')]&&_0x417385[_0x407c('0x2e')]!=='--'){_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x2f')+_0x417385[_0x407c('0x2e')],'context':_0x417385['context'],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}}if(_0x417385[_0x407c('0x16')]===_0x407c('0x1c')&&_0x417385['hasOwnProperty']('callerID')){if(_0x417385['callerID']){_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x30'),'appdata':_0x407c('0x31')+_0x417385[_0x407c('0x32')]+')','context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0['priority']+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}else{_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':'ExecIf','appdata':_0x407c('0x33'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e['length']+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}}if(_0x417385[_0x407c('0x11')](_0x407c('0x34'))){if(_0xc50d26[_0x407c('0x35')](_0x417385[_0x407c('0x36')][_0x407c('0x2c')]())>=0x0&&_0x417385['appType']!==_0x407c('0x37')){if(_0x417385[_0x407c('0x34')]){_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':'ExecIf','appdata':_0x407c('0x38'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x39'),'context':_0x417385['context'],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385[_0x407c('0x1b')]});}else{_0x3a66ac[_0x407c('0x15')]({'type':_0x417385['type'],'app':_0x407c('0x30'),'appdata':_0x407c('0x3a'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385[_0x407c('0xb')],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385['VoiceExtensionId']});_0x3a66ac[_0x407c('0x15')]({'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x17'),'appdata':_0x407c('0x3b'),'context':_0x417385[_0x407c('0x1a')],'exten':_0x417385['exten'],'priority':_0x18045e[_0x407c('0x2b')]+_0x5ac3d0[_0x407c('0x12')]+_0x45156a++,'VoiceExtensionId':_0x417385['VoiceExtensionId']});}}}for(var _0x1b5aac=0x0;_0x1b5aac<_0x18045e[_0x407c('0x2b')];_0x1b5aac+=0x1){var _0x51cacf=_0x5ac3d0[_0x407c('0x12')]+_0x18045e[_0x407c('0x2b')];var _0x167f48=_0x1b5aac===_0x18045e[_0x407c('0x2b')]-0x1?_0x5ac3d0[_0x407c('0x12')]+_0x3a66ac[_0x407c('0x2b')]+_0x58f562[_0x407c('0x2b')]+0x2:_0x5ac3d0[_0x407c('0x12')]+_0x1b5aac+0x1;_0x3a66ac[_0x407c('0x3c')](_0x1b5aac,0x0,{'type':_0x417385[_0x407c('0x16')],'app':_0x407c('0x3d'),'appdata':_0x18045e[_0x1b5aac]+'?'+_0x417385['context']+_0x407c('0x3e')+_0x51cacf+':'+_0x417385[_0x407c('0x1a')]+_0x407c('0x3e')+_0x167f48,'exten':_0x417385[_0x407c('0xb')],'context':_0x417385[_0x407c('0x1a')],'priority':_0x5ac3d0[_0x407c('0x12')]+_0x1b5aac,'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1b')]});}_0x417385['priority']=_0x3a66ac[_0x407c('0x2b')]?_[_0x407c('0x3f')](_0x3a66ac)[_0x407c('0x12')]+0x1:_0x5ac3d0[_0x407c('0x12')];_0x5ac3d0[_0x407c('0x12')]=(_0x58f562[_0x407c('0x2b')]?_[_0x407c('0x3f')](_0x58f562)[_0x407c('0x12')]:_0x417385[_0x407c('0x12')])+0x1;_0x5ac3d0['extensions']=_['concat'](_0x5ac3d0[_0x407c('0x14')],_0x3a66ac,[_0x417385],_0x58f562);}_0x5ac3d0[_0x407c('0x14')][_0x407c('0x15')]({'type':_0x594ba6[_0x5e089f][0x0][_0x407c('0x16')],'app':_0x407c('0x40'),'exten':_0x594ba6[_0x5e089f][0x0][_0x407c('0xb')],'context':_0x594ba6[_0x5e089f][0x0][_0x407c('0x1a')],'priority':_0x5ac3d0[_0x407c('0x12')],'VoiceExtensionId':_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId']});_0x119bc9[_0x407c('0x15')](_0x594ba6[_0x5e089f][0x0]['VoiceExtensionId']);_0x3a0875=_[_0x407c('0x41')](_0x3a0875,_0x5ac3d0[_0x407c('0x14')]);}}return _0x22c575[_0x407c('0x42')](function(_0x50ebee){return _0x22c575['models'][_0x407c('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x119bc9}},'transaction':_0x50ebee})[_0x407c('0x5')](function(_0x325173){return _0x22c575[_0x407c('0x2')]['VoiceExtension'][_0x407c('0x43')](_[_0x407c('0x44')](_0x3a0875,_0x407c('0x12')),{'transaction':_0x50ebee});});});})[_0x407c('0x45')](function(_0x3df6c6){console['error'](_0x3df6c6);});}exports[_0x407c('0x46')]=rewrite;
\ No newline at end of file
+var _0x33f6=['MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','transaction','VoiceExtension','bulkCreate','catch','error','lodash','Interval','findAll','then','intervals','models','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0x460c0d,_0xd88fe8){var _0x267e99=function(_0x5807a3){while(--_0x5807a3){_0x460c0d['push'](_0x460c0d['shift']());}};_0x267e99(++_0xd88fe8);}(_0x33f6,0x17a));var _0x633f=function(_0x5da7e0,_0x26da3f){_0x5da7e0=_0x5da7e0-0x0;var _0x577f43=_0x33f6[_0x5da7e0];return _0x577f43;};'use strict';var _=require(_0x633f('0x0'));var util=require('util');function rewrite(_0x29f5f9,_0x436026){var _0x30ed12=this;return _0x29f5f9['models'][_0x633f('0x1')][_0x633f('0x2')]({'raw':!![]})[_0x633f('0x3')](function(_0x96366f){_0x30ed12[_0x633f('0x4')]=_0x96366f;return _0x29f5f9[_0x633f('0x5')]['VoiceExtension'][_0x633f('0x2')]({'where':{'IntervalId':_0x436026[_0x633f('0x6')]},'raw':!![]});})[_0x633f('0x3')](function(_0x51cf6b){return _0x29f5f9[_0x633f('0x5')]['VoiceExtension'][_0x633f('0x2')]({'where':{'exten':{'$in':_[_0x633f('0x7')](_[_0x633f('0x8')](_0x51cf6b,_0x633f('0x9')))}},'order':[{'raw':_0x633f('0xa')}],'raw':!![]});})[_0x633f('0x3')](function(_0x43e15c){var _0x3bd1ee=_[_0x633f('0xb')](_0x43e15c,{'priority':'1'});var _0x43b409=_[_0x633f('0xb')](_0x43e15c,{'isApp':0x1});var _0x58d0db=_[_0x633f('0xc')](_0x43b409,'exten');var _0x278046=[_0x633f('0xd'),_0x633f('0xe')];var _0x4b8564=[];var _0x4b909f=[];for(var _0x635464 in _0x58d0db){if(_0x58d0db[_0x633f('0xf')](_0x635464)){_0x30ed12[_0x633f('0x10')]=0x2;_0x30ed12[_0x633f('0x11')]=[];_0x30ed12[_0x633f('0x12')]=_['find'](_0x3bd1ee,{'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')]});_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':util[_0x633f('0x16')]('CDR(type)=%s',_0x58d0db[_0x635464][0x0][_0x633f('0x14')]),'context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12['priority']++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0]['VoiceExtensionId']});if(_0x58d0db[_0x635464][0x0]['type']===_0x633f('0x18')){_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x19')+_0x58d0db[_0x635464][0x0][_0x633f('0x1a')],'context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12['priority']++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0]['VoiceExtensionId']});}else if(_0x58d0db[_0x635464][0x0]['type']===_0x633f('0x1b')){if(_0x30ed12['extension']){_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x1c')+(_0x30ed12['extension'][_0x633f('0x1d')]?_0x633f('0x1e')+_0x30ed12[_0x633f('0x12')]['cutdigits']+'}':_0x633f('0x1f')),'context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0]['exten'],'priority':_0x30ed12['priority']++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});}_0x30ed12['extensions'][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x19')+_0x58d0db[_0x635464][0x0]['VoiceExtensionId'],'context':_0x58d0db[_0x635464][0x0]['context'],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12[_0x633f('0x10')]++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});var _0x3e7b93=_0x30ed12['priority']++;_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x20'),'appdata':_0x633f('0x21')+(_0x3e7b93+0x2)+_0x633f('0x22')+(_0x3e7b93+0x1)+')','context':_0x58d0db[_0x635464][0x0]['context'],'exten':_0x58d0db[_0x635464][0x0]['exten'],'priority':_0x3e7b93,'VoiceExtensionId':_0x58d0db[_0x635464][0x0]['VoiceExtensionId']});if(_0x30ed12[_0x633f('0x12')]){_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x30ed12[_0x633f('0x12')][_0x633f('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x30ed12[_0x633f('0x12')][_0x633f('0x1d')]+'}':_0x633f('0x23'),'context':_0x58d0db[_0x635464][0x0]['context'],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12[_0x633f('0x10')]++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0]['VoiceExtensionId']});}_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0]['type'],'app':_0x633f('0x15'),'appdata':_0x633f('0x24')+_0x58d0db[_0x635464][0x0][_0x633f('0x1a')],'context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0]['exten'],'priority':_0x30ed12[_0x633f('0x10')]++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});if(_0x30ed12[_0x633f('0x12')]&&_0x30ed12[_0x633f('0x12')][_0x633f('0xf')](_0x633f('0x25'))&&_0x30ed12[_0x633f('0x12')]['recordingFormat']!==_0x633f('0x26')){_0x30ed12['extensions']['push']({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x27'),'context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12['priority']++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});_0x30ed12[_0x633f('0x11')]['push']({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x28')+_0x30ed12[_0x633f('0x12')]['recordingFormat']||_0x633f('0x29'),'context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12[_0x633f('0x10')]++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});}}_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12['priority']++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12['priority']++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0][_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x2a'),'context':_0x58d0db[_0x635464][0x0][_0x633f('0x17')],'exten':_0x58d0db[_0x635464][0x0][_0x633f('0x9')],'priority':_0x30ed12['priority']++,'VoiceExtensionId':_0x58d0db[_0x635464][0x0][_0x633f('0x1a')]});for(var _0x332007=0x0,_0x1f04cc=0x0;_0x332007<_0x58d0db[_0x635464]['length'];_0x332007+=0x1,_0x1f04cc=0x0){var _0x38f4c9=_0x58d0db[_0x635464][_0x332007];if(_0x38f4c9[_0x633f('0x14')]){_0x38f4c9[_0x633f('0x14')]=_0x38f4c9['type'][_0x633f('0x2b')]();}var _0x48662e=[];var _0x1a4745=[];delete _0x38f4c9['id'];delete _0x38f4c9[_0x633f('0x2c')];delete _0x38f4c9[_0x633f('0x2d')];var _0x241bd1=_0x38f4c9[_0x633f('0x2e')]!==_0x633f('0x2f')?[_0x38f4c9[_0x633f('0x2e')]]:_0x38f4c9[_0x633f('0x6')]?_[_0x633f('0x8')](_['filter'](_0x30ed12['intervals'],{'IntervalId':_0x38f4c9[_0x633f('0x6')]}),_0x633f('0x2e')):[];if(_0x38f4c9['hasOwnProperty'](_0x633f('0x30'))){if(_0x38f4c9['tag']&&_0x38f4c9['tag']!=='--'){_0x48662e[_0x633f('0x13')]({'type':_0x38f4c9[_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x31')+_0x38f4c9[_0x633f('0x30')],'context':_0x38f4c9[_0x633f('0x17')],'exten':_0x38f4c9[_0x633f('0x9')],'priority':_0x241bd1[_0x633f('0x32')]+_0x30ed12[_0x633f('0x10')]+_0x1f04cc++,'VoiceExtensionId':_0x38f4c9['VoiceExtensionId']});}}if(_0x38f4c9[_0x633f('0x14')]===_0x633f('0x1b')&&_0x38f4c9[_0x633f('0xf')]('callerID')){if(_0x38f4c9[_0x633f('0x33')]){_0x48662e['push']({'type':_0x38f4c9['type'],'app':_0x633f('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x38f4c9[_0x633f('0x33')]+')','context':_0x38f4c9['context'],'exten':_0x38f4c9[_0x633f('0x9')],'priority':_0x241bd1[_0x633f('0x32')]+_0x30ed12[_0x633f('0x10')]+_0x1f04cc++,'VoiceExtensionId':_0x38f4c9[_0x633f('0x1a')]});}else{_0x48662e['push']({'type':_0x38f4c9['type'],'app':_0x633f('0x20'),'appdata':_0x633f('0x34'),'context':_0x38f4c9[_0x633f('0x17')],'exten':_0x38f4c9['exten'],'priority':_0x241bd1[_0x633f('0x32')]+_0x30ed12[_0x633f('0x10')]+_0x1f04cc++,'VoiceExtensionId':_0x38f4c9[_0x633f('0x1a')]});}}if(_0x38f4c9[_0x633f('0xf')](_0x633f('0x35'))){if(_0x278046[_0x633f('0x36')](_0x38f4c9[_0x633f('0x37')][_0x633f('0x2b')]())>=0x0&&_0x38f4c9[_0x633f('0x38')]!=='custom'){if(_0x38f4c9[_0x633f('0x35')]){_0x48662e['push']({'type':_0x38f4c9[_0x633f('0x14')],'app':_0x633f('0x20'),'appdata':_0x633f('0x39'),'context':_0x38f4c9['context'],'exten':_0x38f4c9[_0x633f('0x9')],'priority':_0x241bd1['length']+_0x30ed12[_0x633f('0x10')]+_0x1f04cc++,'VoiceExtensionId':_0x38f4c9[_0x633f('0x1a')]});_0x48662e[_0x633f('0x13')]({'type':_0x38f4c9[_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x3a'),'context':_0x38f4c9[_0x633f('0x17')],'exten':_0x38f4c9[_0x633f('0x9')],'priority':_0x241bd1['length']+_0x30ed12[_0x633f('0x10')]+_0x1f04cc++,'VoiceExtensionId':_0x38f4c9['VoiceExtensionId']});}else{_0x48662e[_0x633f('0x13')]({'type':_0x38f4c9['type'],'app':_0x633f('0x20'),'appdata':_0x633f('0x3b'),'context':_0x38f4c9['context'],'exten':_0x38f4c9[_0x633f('0x9')],'priority':_0x241bd1['length']+_0x30ed12['priority']+_0x1f04cc++,'VoiceExtensionId':_0x38f4c9[_0x633f('0x1a')]});_0x48662e[_0x633f('0x13')]({'type':_0x38f4c9[_0x633f('0x14')],'app':_0x633f('0x15'),'appdata':_0x633f('0x3c'),'context':_0x38f4c9[_0x633f('0x17')],'exten':_0x38f4c9[_0x633f('0x9')],'priority':_0x241bd1[_0x633f('0x32')]+_0x30ed12['priority']+_0x1f04cc++,'VoiceExtensionId':_0x38f4c9[_0x633f('0x1a')]});}}}for(var _0xfa2201=0x0;_0xfa2201<_0x241bd1[_0x633f('0x32')];_0xfa2201+=0x1){var _0x4a1225=_0x30ed12['priority']+_0x241bd1[_0x633f('0x32')];var _0x42fd14=_0xfa2201===_0x241bd1[_0x633f('0x32')]-0x1?_0x30ed12[_0x633f('0x10')]+_0x48662e[_0x633f('0x32')]+_0x1a4745[_0x633f('0x32')]+0x2:_0x30ed12[_0x633f('0x10')]+_0xfa2201+0x1;_0x48662e['splice'](_0xfa2201,0x0,{'type':_0x38f4c9[_0x633f('0x14')],'app':_0x633f('0x3d'),'appdata':_0x241bd1[_0xfa2201]+'?'+_0x38f4c9['context']+_0x633f('0x3e')+_0x4a1225+':'+_0x38f4c9['context']+_0x633f('0x3e')+_0x42fd14,'exten':_0x38f4c9[_0x633f('0x9')],'context':_0x38f4c9['context'],'priority':_0x30ed12[_0x633f('0x10')]+_0xfa2201,'VoiceExtensionId':_0x58d0db[_0x635464][0x0]['VoiceExtensionId']});}_0x38f4c9[_0x633f('0x10')]=_0x48662e[_0x633f('0x32')]?_[_0x633f('0x3f')](_0x48662e)[_0x633f('0x10')]+0x1:_0x30ed12[_0x633f('0x10')];_0x30ed12[_0x633f('0x10')]=(_0x1a4745['length']?_['last'](_0x1a4745)['priority']:_0x38f4c9['priority'])+0x1;_0x30ed12[_0x633f('0x11')]=_['concat'](_0x30ed12['extensions'],_0x48662e,[_0x38f4c9],_0x1a4745);}_0x30ed12[_0x633f('0x11')][_0x633f('0x13')]({'type':_0x58d0db[_0x635464][0x0]['type'],'app':_0x633f('0x40'),'exten':_0x58d0db[_0x635464][0x0]['exten'],'context':_0x58d0db[_0x635464][0x0]['context'],'priority':_0x30ed12[_0x633f('0x10')],'VoiceExtensionId':_0x58d0db[_0x635464][0x0]['VoiceExtensionId']});_0x4b8564[_0x633f('0x13')](_0x58d0db[_0x635464][0x0]['VoiceExtensionId']);_0x4b909f=_['concat'](_0x4b909f,_0x30ed12[_0x633f('0x11')]);}}return _0x29f5f9[_0x633f('0x41')](function(_0x48b29b){return _0x29f5f9[_0x633f('0x5')][_0x633f('0x42')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4b8564}},'transaction':_0x48b29b})[_0x633f('0x3')](function(_0x20cde8){return _0x29f5f9[_0x633f('0x5')][_0x633f('0x42')][_0x633f('0x43')](_['sortBy'](_0x4b909f,_0x633f('0x10')),{'transaction':_0x48b29b});});});})[_0x633f('0x44')](function(_0x32be23){console[_0x633f('0x45')](_0x32be23);});}exports['rewrite']=rewrite;
\ No newline at end of file