Built motion from commit 64a6f4bc.|2.6.26
[motion2.git] / server / components / extensions / rewrite.js
index 2e91bb7..588283a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a69=['ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','queue','playback','hasOwnProperty','priority','extension','extensions','push','type','inbound','Set','CDR(routeid)=','VoiceExtensionId','context','outbound','CDR(destination)=','cutdigits'];(function(_0x503ead,_0x4ac126){var _0x4830cb=function(_0xe4a720){while(--_0xe4a720){_0x503ead['push'](_0x503ead['shift']());}};_0x4830cb(++_0x4ac126);}(_0x2a69,0x12d));var _0x92a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2a69[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x92a6('0x0'));var util=require(_0x92a6('0x1'));function rewrite(_0x301b47,_0x3c6fdf){var _0x4aa5e2=this;return _0x301b47[_0x92a6('0x2')][_0x92a6('0x3')][_0x92a6('0x4')]({'raw':!![]})[_0x92a6('0x5')](function(_0x22228a){_0x4aa5e2[_0x92a6('0x6')]=_0x22228a;return _0x301b47[_0x92a6('0x2')][_0x92a6('0x7')][_0x92a6('0x4')]({'where':{'IntervalId':_0x3c6fdf[_0x92a6('0x8')]},'raw':!![]});})[_0x92a6('0x5')](function(_0x480937){return _0x301b47[_0x92a6('0x2')]['VoiceExtension'][_0x92a6('0x4')]({'where':{'exten':{'$in':_[_0x92a6('0x9')](_[_0x92a6('0xa')](_0x480937,_0x92a6('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0xfb4bd4){var _0xfb7ffd=_[_0x92a6('0xc')](_0xfb4bd4,{'priority':'1'});var _0x89c235=_[_0x92a6('0xc')](_0xfb4bd4,{'isApp':0x1});var _0x285cf4=_['groupBy'](_0x89c235,_0x92a6('0xb'));var _0x1f2088=[_0x92a6('0xd'),_0x92a6('0xe')];var _0x509f78=[];var _0x58fee6=[];for(var _0x5df9d1 in _0x285cf4){if(_0x285cf4[_0x92a6('0xf')](_0x5df9d1)){_0x4aa5e2[_0x92a6('0x10')]=0x2;_0x4aa5e2['extensions']=[];_0x4aa5e2[_0x92a6('0x11')]=_['find'](_0xfb7ffd,{'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x285cf4[_0x5df9d1][0x0]['type']),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});if(_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')]===_0x92a6('0x15')){_0x4aa5e2['extensions'][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x17')+_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});}else if(_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')]===_0x92a6('0x1a')){if(_0x4aa5e2[_0x92a6('0x11')]){_0x4aa5e2['extensions'][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':'Set','appdata':_0x92a6('0x1b')+(_0x4aa5e2[_0x92a6('0x11')]['cutdigits']?'${EXTEN:'+_0x4aa5e2[_0x92a6('0x11')][_0x92a6('0x1c')]+'}':'${EXTEN}'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});}_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x17')+_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});var _0x1e9dff=_0x4aa5e2[_0x92a6('0x10')]++;_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1e9dff+0x2)+_0x92a6('0x1e')+(_0x1e9dff+0x1)+')','context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x1e9dff,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});if(_0x4aa5e2[_0x92a6('0x11')]){_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x4aa5e2['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x4aa5e2[_0x92a6('0x11')][_0x92a6('0x1c')]+'}':_0x92a6('0x1f'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});}_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':'Set','appdata':_0x92a6('0x20')+_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});if(_0x4aa5e2['extension']&&_0x4aa5e2[_0x92a6('0x11')][_0x92a6('0xf')](_0x92a6('0x21'))&&_0x4aa5e2['extension'][_0x92a6('0x21')]!==_0x92a6('0x22')){_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x23'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x24')+_0x4aa5e2['extension'][_0x92a6('0x21')]||_0x92a6('0x25'),'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});}}_0x4aa5e2['extensions'][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x26'),'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x27'),'context':_0x285cf4[_0x5df9d1][0x0]['context'],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2[_0x92a6('0x10')]++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x28'),'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'exten':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0xb')],'priority':_0x4aa5e2['priority']++,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});for(var _0x15429e=0x0,_0x559bf8=0x0;_0x15429e<_0x285cf4[_0x5df9d1][_0x92a6('0x29')];_0x15429e+=0x1,_0x559bf8=0x0){var _0x32ced0=_0x285cf4[_0x5df9d1][_0x15429e];if(_0x32ced0[_0x92a6('0x14')]){_0x32ced0[_0x92a6('0x14')]=_0x32ced0[_0x92a6('0x14')]['toLowerCase']();}var _0x45fd0e=[];var _0x4fea42=[];delete _0x32ced0['id'];delete _0x32ced0[_0x92a6('0x2a')];delete _0x32ced0[_0x92a6('0x2b')];var _0x5a3c3a=_0x32ced0[_0x92a6('0x2c')]!==_0x92a6('0x2d')?[_0x32ced0[_0x92a6('0x2c')]]:_0x32ced0[_0x92a6('0x8')]?_[_0x92a6('0xa')](_[_0x92a6('0xc')](_0x4aa5e2[_0x92a6('0x6')],{'IntervalId':_0x32ced0[_0x92a6('0x8')]}),_0x92a6('0x2c')):[];if(_0x32ced0[_0x92a6('0xf')](_0x92a6('0x2e'))){if(_0x32ced0[_0x92a6('0x2e')]&&_0x32ced0[_0x92a6('0x2e')]!=='--'){_0x45fd0e['push']({'type':_0x32ced0[_0x92a6('0x14')],'app':'Set','appdata':'CDR(tag)='+_0x32ced0['tag'],'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a['length']+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});}}if(_0x32ced0[_0x92a6('0x14')]===_0x92a6('0x1a')&&_0x32ced0['hasOwnProperty']('callerID')){if(_0x32ced0['callerID']){_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0[_0x92a6('0x14')],'app':'ExecIf','appdata':_0x92a6('0x2f')+_0x32ced0['callerID']+')','context':_0x32ced0['context'],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a['length']+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});}else{_0x45fd0e['push']({'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x1d'),'appdata':_0x92a6('0x30'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});}}if(_0x32ced0[_0x92a6('0xf')](_0x92a6('0x31'))){if(_0x1f2088['indexOf'](_0x32ced0[_0x92a6('0x32')][_0x92a6('0x33')]())>=0x0&&_0x32ced0['appType']!==_0x92a6('0x34')){if(_0x32ced0[_0x92a6('0x31')]){_0x45fd0e['push']({'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x1d'),'appdata':_0x92a6('0x35'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0['exten'],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0['VoiceExtensionId']});_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x16'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0[_0x92a6('0x18')]});}else{_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0['type'],'app':_0x92a6('0x1d'),'appdata':_0x92a6('0x36'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0['exten'],'priority':_0x5a3c3a[_0x92a6('0x29')]+_0x4aa5e2['priority']+_0x559bf8++,'VoiceExtensionId':_0x32ced0[_0x92a6('0x18')]});_0x45fd0e[_0x92a6('0x13')]({'type':_0x32ced0['type'],'app':_0x92a6('0x16'),'appdata':_0x92a6('0x37'),'context':_0x32ced0[_0x92a6('0x19')],'exten':_0x32ced0[_0x92a6('0xb')],'priority':_0x5a3c3a['length']+_0x4aa5e2[_0x92a6('0x10')]+_0x559bf8++,'VoiceExtensionId':_0x32ced0[_0x92a6('0x18')]});}}}for(var _0x10316c=0x0;_0x10316c<_0x5a3c3a[_0x92a6('0x29')];_0x10316c+=0x1){var _0x5b4d49=_0x4aa5e2[_0x92a6('0x10')]+_0x5a3c3a[_0x92a6('0x29')];var _0x1e6cef=_0x10316c===_0x5a3c3a[_0x92a6('0x29')]-0x1?_0x4aa5e2[_0x92a6('0x10')]+_0x45fd0e[_0x92a6('0x29')]+_0x4fea42[_0x92a6('0x29')]+0x2:_0x4aa5e2[_0x92a6('0x10')]+_0x10316c+0x1;_0x45fd0e[_0x92a6('0x38')](_0x10316c,0x0,{'type':_0x32ced0[_0x92a6('0x14')],'app':_0x92a6('0x39'),'appdata':_0x5a3c3a[_0x10316c]+'?'+_0x32ced0['context']+_0x92a6('0x3a')+_0x5b4d49+':'+_0x32ced0['context']+',${EXTEN},'+_0x1e6cef,'exten':_0x32ced0[_0x92a6('0xb')],'context':_0x32ced0[_0x92a6('0x19')],'priority':_0x4aa5e2[_0x92a6('0x10')]+_0x10316c,'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x18')]});}_0x32ced0[_0x92a6('0x10')]=_0x45fd0e[_0x92a6('0x29')]?_[_0x92a6('0x3b')](_0x45fd0e)[_0x92a6('0x10')]+0x1:_0x4aa5e2[_0x92a6('0x10')];_0x4aa5e2[_0x92a6('0x10')]=(_0x4fea42[_0x92a6('0x29')]?_[_0x92a6('0x3b')](_0x4fea42)[_0x92a6('0x10')]:_0x32ced0[_0x92a6('0x10')])+0x1;_0x4aa5e2['extensions']=_[_0x92a6('0x3c')](_0x4aa5e2['extensions'],_0x45fd0e,[_0x32ced0],_0x4fea42);}_0x4aa5e2[_0x92a6('0x12')][_0x92a6('0x13')]({'type':_0x285cf4[_0x5df9d1][0x0]['type'],'app':_0x92a6('0x3d'),'exten':_0x285cf4[_0x5df9d1][0x0]['exten'],'context':_0x285cf4[_0x5df9d1][0x0][_0x92a6('0x19')],'priority':_0x4aa5e2[_0x92a6('0x10')],'VoiceExtensionId':_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']});_0x509f78[_0x92a6('0x13')](_0x285cf4[_0x5df9d1][0x0]['VoiceExtensionId']);_0x58fee6=_[_0x92a6('0x3c')](_0x58fee6,_0x4aa5e2[_0x92a6('0x12')]);}}return _0x301b47[_0x92a6('0x3e')](function(_0x499447){return _0x301b47[_0x92a6('0x2')][_0x92a6('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x509f78}},'transaction':_0x499447})[_0x92a6('0x5')](function(_0x1c669a){return _0x301b47[_0x92a6('0x2')][_0x92a6('0x7')]['bulkCreate'](_[_0x92a6('0x3f')](_0x58fee6,_0x92a6('0x10')),{'transaction':_0x499447});});});})['catch'](function(_0x3187fa){console[_0x92a6('0x40')](_0x3187fa);});}exports[_0x92a6('0x41')]=rewrite;
\ No newline at end of file
+var _0x2911=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','rewrite','lodash','util','Interval','findAll','then','models','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=noprefix','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2911,0x1b6));var _0x1291=function(_0x570c12,_0x411619){_0x570c12=_0x570c12-0x0;var _0x469b64=_0x2911[_0x570c12];return _0x469b64;};'use strict';var _=require(_0x1291('0x0'));var util=require(_0x1291('0x1'));function rewrite(_0x363281,_0x4d8e72){var _0x1329cf=this;return _0x363281['models'][_0x1291('0x2')][_0x1291('0x3')]({'raw':!![]})[_0x1291('0x4')](function(_0x4c8fc7){_0x1329cf['intervals']=_0x4c8fc7;return _0x363281[_0x1291('0x5')]['VoiceExtension'][_0x1291('0x3')]({'where':{'IntervalId':_0x4d8e72['IntervalId']},'raw':!![]});})[_0x1291('0x4')](function(_0x12d17f){return _0x363281[_0x1291('0x5')][_0x1291('0x6')][_0x1291('0x3')]({'where':{'exten':{'$in':_[_0x1291('0x7')](_['map'](_0x12d17f,_0x1291('0x8')))}},'order':[{'raw':_0x1291('0x9')}],'raw':!![]});})[_0x1291('0x4')](function(_0x209a4b){var _0x2a006d=_[_0x1291('0xa')](_0x209a4b,{'priority':'1'});var _0x18e9f4=_[_0x1291('0xa')](_0x209a4b,{'isApp':0x1});var _0x4cf4a0=_[_0x1291('0xb')](_0x18e9f4,_0x1291('0x8'));var _0x214b00=[_0x1291('0xc'),'playback'];var _0x5c90fa=[];var _0x5c3054=[];for(var _0x5297a1 in _0x4cf4a0){if(_0x4cf4a0[_0x1291('0xd')](_0x5297a1)){_0x1329cf[_0x1291('0xe')]=0x2;_0x1329cf[_0x1291('0xf')]=[];_0x1329cf[_0x1291('0x10')]=_[_0x1291('0x11')](_0x2a006d,{'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')]});_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':util[_0x1291('0x15')](_0x1291('0x16'),_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')]),'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0]['exten'],'priority':_0x1329cf[_0x1291('0xe')]++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});if(_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')]===_0x1291('0x19')){_0x1329cf['extensions']['push']({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':'Set','appdata':'CDR(routeid)='+_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')],'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0]['exten'],'priority':_0x1329cf[_0x1291('0xe')]++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});}else if(_0x4cf4a0[_0x5297a1][0x0]['type']===_0x1291('0x1a')){if(_0x1329cf[_0x1291('0x10')]){_0x1329cf[_0x1291('0xf')]['push']({'type':_0x4cf4a0[_0x5297a1][0x0]['type'],'app':_0x1291('0x14'),'appdata':_0x1291('0x1b')+(_0x1329cf[_0x1291('0x10')][_0x1291('0x1c')]?'${EXTEN:'+_0x1329cf[_0x1291('0x10')][_0x1291('0x1c')]+'}':_0x1291('0x1d')),'context':_0x4cf4a0[_0x5297a1][0x0]['context'],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x1329cf['priority']++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});}_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':_0x1291('0x1e')+_0x4cf4a0[_0x5297a1][0x0]['VoiceExtensionId'],'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x1329cf[_0x1291('0xe')]++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0]['VoiceExtensionId']});var _0x59bb6d=_0x1329cf['priority']++;_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0]['type'],'app':_0x1291('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x59bb6d+0x2)+_0x1291('0x20')+(_0x59bb6d+0x1)+')','context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x59bb6d,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});if(_0x1329cf[_0x1291('0x10')]){_0x1329cf['extensions'][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0]['type'],'app':_0x1291('0x14'),'appdata':_0x1329cf[_0x1291('0x10')][_0x1291('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x1329cf[_0x1291('0x10')][_0x1291('0x1c')]+'}':_0x1291('0x21'),'context':_0x4cf4a0[_0x5297a1][0x0]['context'],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x1329cf[_0x1291('0xe')]++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});}_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':'outboundrouteid='+_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')],'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x1329cf[_0x1291('0xe')]++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});if(_0x1329cf[_0x1291('0x10')]&&_0x1329cf[_0x1291('0x10')]['hasOwnProperty'](_0x1291('0x22'))&&_0x1329cf[_0x1291('0x10')][_0x1291('0x22')]!==_0x1291('0x23')){_0x1329cf['extensions'][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x1329cf['priority']++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0]['type'],'app':_0x1291('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1329cf[_0x1291('0x10')][_0x1291('0x22')]||_0x1291('0x24'),'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0]['exten'],'priority':_0x1329cf[_0x1291('0xe')]++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});}}_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':'Set','appdata':_0x1291('0x25'),'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0]['exten'],'priority':_0x1329cf[_0x1291('0xe')]++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':_0x1291('0x26'),'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x1329cf['priority']++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0]['VoiceExtensionId']});_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':_0x1291('0x27'),'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'priority':_0x1329cf['priority']++,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0]['VoiceExtensionId']});for(var _0x20e6b9=0x0,_0x4f0882=0x0;_0x20e6b9<_0x4cf4a0[_0x5297a1][_0x1291('0x28')];_0x20e6b9+=0x1,_0x4f0882=0x0){var _0x941cd0=_0x4cf4a0[_0x5297a1][_0x20e6b9];if(_0x941cd0[_0x1291('0x13')]){_0x941cd0[_0x1291('0x13')]=_0x941cd0[_0x1291('0x13')][_0x1291('0x29')]();}var _0x1f858a=[];var _0x5ecc22=[];delete _0x941cd0['id'];delete _0x941cd0[_0x1291('0x2a')];delete _0x941cd0[_0x1291('0x2b')];var _0x4226c5=_0x941cd0[_0x1291('0x2c')]!==_0x1291('0x2d')?[_0x941cd0['interval']]:_0x941cd0[_0x1291('0x2e')]?_['map'](_[_0x1291('0xa')](_0x1329cf[_0x1291('0x2f')],{'IntervalId':_0x941cd0[_0x1291('0x2e')]}),_0x1291('0x2c')):[];if(_0x941cd0['hasOwnProperty'](_0x1291('0x30'))){if(_0x941cd0[_0x1291('0x30')]&&_0x941cd0[_0x1291('0x30')]!=='--'){_0x1f858a[_0x1291('0x12')]({'type':_0x941cd0[_0x1291('0x13')],'app':'Set','appdata':_0x1291('0x31')+_0x941cd0[_0x1291('0x30')],'context':_0x941cd0['context'],'exten':_0x941cd0[_0x1291('0x8')],'priority':_0x4226c5[_0x1291('0x28')]+_0x1329cf['priority']+_0x4f0882++,'VoiceExtensionId':_0x941cd0[_0x1291('0x18')]});}}if(_0x941cd0[_0x1291('0x13')]===_0x1291('0x1a')&&_0x941cd0['hasOwnProperty'](_0x1291('0x32'))){if(_0x941cd0[_0x1291('0x32')]){_0x1f858a['push']({'type':_0x941cd0['type'],'app':_0x1291('0x1f'),'appdata':_0x1291('0x33')+_0x941cd0[_0x1291('0x32')]+')','context':_0x941cd0[_0x1291('0x17')],'exten':_0x941cd0[_0x1291('0x8')],'priority':_0x4226c5[_0x1291('0x28')]+_0x1329cf[_0x1291('0xe')]+_0x4f0882++,'VoiceExtensionId':_0x941cd0[_0x1291('0x18')]});}else{_0x1f858a['push']({'type':_0x941cd0[_0x1291('0x13')],'app':_0x1291('0x1f'),'appdata':_0x1291('0x34'),'context':_0x941cd0[_0x1291('0x17')],'exten':_0x941cd0[_0x1291('0x8')],'priority':_0x4226c5['length']+_0x1329cf[_0x1291('0xe')]+_0x4f0882++,'VoiceExtensionId':_0x941cd0['VoiceExtensionId']});}}if(_0x941cd0[_0x1291('0xd')](_0x1291('0x35'))){if(_0x214b00[_0x1291('0x36')](_0x941cd0['app'][_0x1291('0x29')]())>=0x0&&_0x941cd0[_0x1291('0x37')]!==_0x1291('0x38')){if(_0x941cd0[_0x1291('0x35')]){_0x1f858a[_0x1291('0x12')]({'type':_0x941cd0[_0x1291('0x13')],'app':_0x1291('0x1f'),'appdata':_0x1291('0x39'),'context':_0x941cd0[_0x1291('0x17')],'exten':_0x941cd0[_0x1291('0x8')],'priority':_0x4226c5[_0x1291('0x28')]+_0x1329cf[_0x1291('0xe')]+_0x4f0882++,'VoiceExtensionId':_0x941cd0['VoiceExtensionId']});_0x1f858a[_0x1291('0x12')]({'type':_0x941cd0[_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':_0x1291('0x3a'),'context':_0x941cd0[_0x1291('0x17')],'exten':_0x941cd0[_0x1291('0x8')],'priority':_0x4226c5[_0x1291('0x28')]+_0x1329cf[_0x1291('0xe')]+_0x4f0882++,'VoiceExtensionId':_0x941cd0[_0x1291('0x18')]});}else{_0x1f858a[_0x1291('0x12')]({'type':_0x941cd0['type'],'app':'ExecIf','appdata':_0x1291('0x3b'),'context':_0x941cd0[_0x1291('0x17')],'exten':_0x941cd0['exten'],'priority':_0x4226c5[_0x1291('0x28')]+_0x1329cf[_0x1291('0xe')]+_0x4f0882++,'VoiceExtensionId':_0x941cd0['VoiceExtensionId']});_0x1f858a[_0x1291('0x12')]({'type':_0x941cd0[_0x1291('0x13')],'app':_0x1291('0x14'),'appdata':_0x1291('0x3c'),'context':_0x941cd0['context'],'exten':_0x941cd0[_0x1291('0x8')],'priority':_0x4226c5[_0x1291('0x28')]+_0x1329cf[_0x1291('0xe')]+_0x4f0882++,'VoiceExtensionId':_0x941cd0[_0x1291('0x18')]});}}}for(var _0x80f953=0x0;_0x80f953<_0x4226c5[_0x1291('0x28')];_0x80f953+=0x1){var _0x4ddc67=_0x1329cf[_0x1291('0xe')]+_0x4226c5['length'];var _0x54002d=_0x80f953===_0x4226c5[_0x1291('0x28')]-0x1?_0x1329cf[_0x1291('0xe')]+_0x1f858a[_0x1291('0x28')]+_0x5ecc22[_0x1291('0x28')]+0x2:_0x1329cf[_0x1291('0xe')]+_0x80f953+0x1;_0x1f858a[_0x1291('0x3d')](_0x80f953,0x0,{'type':_0x941cd0[_0x1291('0x13')],'app':_0x1291('0x3e'),'appdata':_0x4226c5[_0x80f953]+'?'+_0x941cd0[_0x1291('0x17')]+_0x1291('0x3f')+_0x4ddc67+':'+_0x941cd0[_0x1291('0x17')]+_0x1291('0x3f')+_0x54002d,'exten':_0x941cd0['exten'],'context':_0x941cd0['context'],'priority':_0x1329cf['priority']+_0x80f953,'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});}_0x941cd0[_0x1291('0xe')]=_0x1f858a[_0x1291('0x28')]?_[_0x1291('0x40')](_0x1f858a)[_0x1291('0xe')]+0x1:_0x1329cf['priority'];_0x1329cf[_0x1291('0xe')]=(_0x5ecc22['length']?_[_0x1291('0x40')](_0x5ecc22)[_0x1291('0xe')]:_0x941cd0[_0x1291('0xe')])+0x1;_0x1329cf['extensions']=_[_0x1291('0x41')](_0x1329cf[_0x1291('0xf')],_0x1f858a,[_0x941cd0],_0x5ecc22);}_0x1329cf[_0x1291('0xf')][_0x1291('0x12')]({'type':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x13')],'app':_0x1291('0x42'),'exten':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x8')],'context':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x17')],'priority':_0x1329cf[_0x1291('0xe')],'VoiceExtensionId':_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]});_0x5c90fa[_0x1291('0x12')](_0x4cf4a0[_0x5297a1][0x0][_0x1291('0x18')]);_0x5c3054=_[_0x1291('0x41')](_0x5c3054,_0x1329cf[_0x1291('0xf')]);}}return _0x363281[_0x1291('0x43')](function(_0x2b6787){return _0x363281[_0x1291('0x5')]['VoiceExtension'][_0x1291('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x5c90fa}},'transaction':_0x2b6787})[_0x1291('0x4')](function(_0x5f7d6f){return _0x363281['models']['VoiceExtension']['bulkCreate'](_[_0x1291('0x45')](_0x5c3054,_0x1291('0xe')),{'transaction':_0x2b6787});});});})['catch'](function(_0x1d8a81){console['error'](_0x1d8a81);});}exports[_0x1291('0x46')]=rewrite;
\ No newline at end of file