Built motion from commit 44b1f254.|2.6.26
[motion2.git] / server / components / extensions / rewrite.js
index 331df5d..d2728b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd063=[',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','catch','error','rewrite','lodash','util','Interval','findAll','models','VoiceExtension','then','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','VoiceExtensionId','inbound','Set','context','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','intervals','IntervalId','tag','CDR(tag)=','outbound','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)','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime'];(function(_0x21ebba,_0x36fafb){var _0xfabede=function(_0x70a662){while(--_0x70a662){_0x21ebba['push'](_0x21ebba['shift']());}};_0xfabede(++_0x36fafb);}(_0xd063,0x1c5));var _0x3d06=function(_0x497182,_0x40b150){_0x497182=_0x497182-0x0;var _0x33fcfc=_0xd063[_0x497182];return _0x33fcfc;};'use strict';var _=require(_0x3d06('0x0'));var util=require(_0x3d06('0x1'));function rewrite(_0x2d4692,_0x5f2028){var _0x579f8c=this;return _0x2d4692['models'][_0x3d06('0x2')][_0x3d06('0x3')]({'raw':!![]})['then'](function(_0xd4bf99){_0x579f8c['intervals']=_0xd4bf99;return _0x2d4692[_0x3d06('0x4')][_0x3d06('0x5')][_0x3d06('0x3')]({'where':{'IntervalId':_0x5f2028['IntervalId']},'raw':!![]});})[_0x3d06('0x6')](function(_0x5e3ff7){return _0x2d4692[_0x3d06('0x4')]['VoiceExtension'][_0x3d06('0x3')]({'where':{'exten':{'$in':_[_0x3d06('0x7')](_[_0x3d06('0x8')](_0x5e3ff7,'exten'))}},'order':[{'raw':_0x3d06('0x9')}],'raw':!![]});})['then'](function(_0x56eb75){var _0x3ce6da=_[_0x3d06('0xa')](_0x56eb75,{'priority':'1'});var _0x2687cf=_[_0x3d06('0xa')](_0x56eb75,{'isApp':0x1});var _0x4f12fa=_[_0x3d06('0xb')](_0x2687cf,_0x3d06('0xc'));var _0x526037=[_0x3d06('0xd'),_0x3d06('0xe')];var _0x293e27=[];var _0x3dccf7=[];for(var _0x231c40 in _0x4f12fa){if(_0x4f12fa[_0x3d06('0xf')](_0x231c40)){_0x579f8c[_0x3d06('0x10')]=0x2;_0x579f8c[_0x3d06('0x11')]=[];_0x579f8c[_0x3d06('0x12')]=_[_0x3d06('0x13')](_0x3ce6da,{'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')]});_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':'Set','appdata':util[_0x3d06('0x16')](_0x3d06('0x17'),_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')]),'context':_0x4f12fa[_0x231c40][0x0]['context'],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});if(_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')]===_0x3d06('0x19')){_0x579f8c['extensions'][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':'CDR(routeid)='+_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')],'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c['priority']++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}else if(_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')]==='outbound'){if(_0x579f8c['extension']){_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':'Set','appdata':_0x3d06('0x1c')+(_0x579f8c[_0x3d06('0x12')]['cutdigits']?_0x3d06('0x1d')+_0x579f8c['extension']['cutdigits']+'}':_0x3d06('0x1e')),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x1f')+_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId'],'context':_0x4f12fa[_0x231c40][0x0]['context'],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});var _0x363f75=_0x579f8c['priority']++;_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x20'),'appdata':_0x3d06('0x21')+(_0x363f75+0x2)+_0x3d06('0x22')+(_0x363f75+0x1)+')','context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x363f75,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});if(_0x579f8c[_0x3d06('0x12')]){_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':_0x579f8c[_0x3d06('0x12')]['cutdigits']?_0x3d06('0x23')+_0x579f8c['extension'][_0x3d06('0x24')]+'}':_0x3d06('0x25'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c['priority']++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x26')+_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')],'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});if(_0x579f8c['extension']&&_0x579f8c['extension'][_0x3d06('0xf')](_0x3d06('0x27'))&&_0x579f8c[_0x3d06('0x12')]['recordingFormat']!==_0x3d06('0x28')){_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4f12fa[_0x231c40][0x0]['context'],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c['priority']++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});_0x579f8c['extensions'][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':_0x3d06('0x1a'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x579f8c[_0x3d06('0x12')][_0x3d06('0x27')]||_0x3d06('0x29'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId']});}}_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0]['type'],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x2a'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':'Set','appdata':_0x3d06('0x2b'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId']});_0x579f8c[_0x3d06('0x11')][_0x3d06('0x14')]({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':'Set','appdata':_0x3d06('0x2c'),'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'exten':_0x4f12fa[_0x231c40][0x0]['exten'],'priority':_0x579f8c[_0x3d06('0x10')]++,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0]['VoiceExtensionId']});for(var _0x32cefb=0x0,_0xf06915=0x0;_0x32cefb<_0x4f12fa[_0x231c40][_0x3d06('0x2d')];_0x32cefb+=0x1,_0xf06915=0x0){var _0x28ebf4=_0x4f12fa[_0x231c40][_0x32cefb];if(_0x28ebf4[_0x3d06('0x15')]){_0x28ebf4['type']=_0x28ebf4[_0x3d06('0x15')][_0x3d06('0x2e')]();}var _0x328e2d=[];var _0x134a4d=[];delete _0x28ebf4['id'];delete _0x28ebf4[_0x3d06('0x2f')];delete _0x28ebf4['updatedAt'];var _0x1cbef4=_0x28ebf4[_0x3d06('0x30')]!==_0x3d06('0x31')?[_0x28ebf4[_0x3d06('0x30')]]:_0x28ebf4['IntervalId']?_[_0x3d06('0x8')](_[_0x3d06('0xa')](_0x579f8c[_0x3d06('0x32')],{'IntervalId':_0x28ebf4[_0x3d06('0x33')]}),'interval'):[];if(_0x28ebf4[_0x3d06('0xf')](_0x3d06('0x34'))){if(_0x28ebf4['tag']&&_0x28ebf4[_0x3d06('0x34')]!=='--'){_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':_0x3d06('0x35')+_0x28ebf4['tag'],'context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4['length']+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4[_0x3d06('0x18')]});}}if(_0x28ebf4[_0x3d06('0x15')]===_0x3d06('0x36')&&_0x28ebf4[_0x3d06('0xf')](_0x3d06('0x37'))){if(_0x28ebf4['callerID']){_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x20'),'appdata':_0x3d06('0x38')+_0x28ebf4[_0x3d06('0x37')]+')','context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});}else{_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':'ExecIf','appdata':_0x3d06('0x39'),'context':_0x28ebf4['context'],'exten':_0x28ebf4['exten'],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});}}if(_0x28ebf4['hasOwnProperty']('answer')){if(_0x526037[_0x3d06('0x3a')](_0x28ebf4[_0x3d06('0x3b')][_0x3d06('0x2e')]())>=0x0&&_0x28ebf4[_0x3d06('0x3c')]!==_0x3d06('0x3d')){if(_0x28ebf4['answer']){_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x20'),'appdata':_0x3d06('0x3e'),'context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c['priority']+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x28ebf4['context'],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c['priority']+_0xf06915++,'VoiceExtensionId':_0x28ebf4[_0x3d06('0x18')]});}else{_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4['type'],'app':'ExecIf','appdata':_0x3d06('0x3f'),'context':_0x28ebf4[_0x3d06('0x1b')],'exten':_0x28ebf4['exten'],'priority':_0x1cbef4['length']+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4['VoiceExtensionId']});_0x328e2d[_0x3d06('0x14')]({'type':_0x28ebf4[_0x3d06('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x28ebf4[_0x3d06('0x1b')],'exten':_0x28ebf4[_0x3d06('0xc')],'priority':_0x1cbef4[_0x3d06('0x2d')]+_0x579f8c[_0x3d06('0x10')]+_0xf06915++,'VoiceExtensionId':_0x28ebf4[_0x3d06('0x18')]});}}}for(var _0x311f45=0x0;_0x311f45<_0x1cbef4[_0x3d06('0x2d')];_0x311f45+=0x1){var _0x4b01f6=_0x579f8c['priority']+_0x1cbef4[_0x3d06('0x2d')];var _0x3f2855=_0x311f45===_0x1cbef4[_0x3d06('0x2d')]-0x1?_0x579f8c[_0x3d06('0x10')]+_0x328e2d[_0x3d06('0x2d')]+_0x134a4d[_0x3d06('0x2d')]+0x2:_0x579f8c['priority']+_0x311f45+0x1;_0x328e2d['splice'](_0x311f45,0x0,{'type':_0x28ebf4[_0x3d06('0x15')],'app':_0x3d06('0x40'),'appdata':_0x1cbef4[_0x311f45]+'?'+_0x28ebf4[_0x3d06('0x1b')]+_0x3d06('0x41')+_0x4b01f6+':'+_0x28ebf4[_0x3d06('0x1b')]+_0x3d06('0x41')+_0x3f2855,'exten':_0x28ebf4[_0x3d06('0xc')],'context':_0x28ebf4[_0x3d06('0x1b')],'priority':_0x579f8c[_0x3d06('0x10')]+_0x311f45,'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});}_0x28ebf4[_0x3d06('0x10')]=_0x328e2d[_0x3d06('0x2d')]?_[_0x3d06('0x42')](_0x328e2d)[_0x3d06('0x10')]+0x1:_0x579f8c[_0x3d06('0x10')];_0x579f8c['priority']=(_0x134a4d[_0x3d06('0x2d')]?_['last'](_0x134a4d)[_0x3d06('0x10')]:_0x28ebf4[_0x3d06('0x10')])+0x1;_0x579f8c['extensions']=_[_0x3d06('0x43')](_0x579f8c['extensions'],_0x328e2d,[_0x28ebf4],_0x134a4d);}_0x579f8c[_0x3d06('0x11')]['push']({'type':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x15')],'app':_0x3d06('0x44'),'exten':_0x4f12fa[_0x231c40][0x0][_0x3d06('0xc')],'context':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x1b')],'priority':_0x579f8c[_0x3d06('0x10')],'VoiceExtensionId':_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]});_0x293e27[_0x3d06('0x14')](_0x4f12fa[_0x231c40][0x0][_0x3d06('0x18')]);_0x3dccf7=_[_0x3d06('0x43')](_0x3dccf7,_0x579f8c[_0x3d06('0x11')]);}}return _0x2d4692[_0x3d06('0x45')](function(_0x22dac9){return _0x2d4692['models'][_0x3d06('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x293e27}},'transaction':_0x22dac9})['then'](function(_0x4961c9){return _0x2d4692[_0x3d06('0x4')]['VoiceExtension'][_0x3d06('0x46')](_['sortBy'](_0x3dccf7,_0x3d06('0x10')),{'transaction':_0x22dac9});});});})[_0x3d06('0x47')](function(_0x7b20cd){console[_0x3d06('0x48')](_0x7b20cd);});}exports[_0x3d06('0x49')]=rewrite;
\ No newline at end of file
+var _0x7387=['${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','hasOwnProperty','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)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','map','exten','filter','groupBy','queue','playback','priority','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extensions','CDR(destination)=','extension','cutdigits','${EXTEN:'];(function(_0x3f1e31,_0x5f26bd){var _0x5174d2=function(_0x82a48d){while(--_0x82a48d){_0x3f1e31['push'](_0x3f1e31['shift']());}};_0x5174d2(++_0x5f26bd);}(_0x7387,0x149));var _0x7738=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7387[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7738('0x0'));var util=require(_0x7738('0x1'));function rewrite(_0x185d80,_0x5bd8b3){var _0x52a861=this;return _0x185d80[_0x7738('0x2')][_0x7738('0x3')][_0x7738('0x4')]({'raw':!![]})[_0x7738('0x5')](function(_0xa0fe41){_0x52a861[_0x7738('0x6')]=_0xa0fe41;return _0x185d80[_0x7738('0x2')]['VoiceExtension'][_0x7738('0x4')]({'where':{'IntervalId':_0x5bd8b3[_0x7738('0x7')]},'raw':!![]});})[_0x7738('0x5')](function(_0x4be98c){return _0x185d80[_0x7738('0x2')][_0x7738('0x8')][_0x7738('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x7738('0x9')](_0x4be98c,_0x7738('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x7738('0x5')](function(_0x1caf90){var _0x3719fe=_[_0x7738('0xb')](_0x1caf90,{'priority':'1'});var _0xaa8ab3=_[_0x7738('0xb')](_0x1caf90,{'isApp':0x1});var _0x206e1d=_[_0x7738('0xc')](_0xaa8ab3,_0x7738('0xa'));var _0x1be52e=[_0x7738('0xd'),_0x7738('0xe')];var _0x22dbf1=[];var _0x4776a1=[];for(var _0x2b5f26 in _0x206e1d){if(_0x206e1d['hasOwnProperty'](_0x2b5f26)){_0x52a861[_0x7738('0xf')]=0x2;_0x52a861['extensions']=[];_0x52a861['extension']=_[_0x7738('0x10')](_0x3719fe,{'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')]});_0x52a861['extensions'][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':util['format'](_0x7738('0x14'),_0x206e1d[_0x2b5f26][0x0]['type']),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});if(_0x206e1d[_0x2b5f26][0x0]['type']===_0x7738('0x17')){_0x52a861['extensions'][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x18')+_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});}else if(_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')]===_0x7738('0x19')){if(_0x52a861['extension']){_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x1b')+(_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]?_0x7738('0x1e')+_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]+'}':_0x7738('0x1f')),'context':_0x206e1d[_0x2b5f26][0x0]['context'],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861['priority']++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});}_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':'Set','appdata':_0x7738('0x18')+_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});var _0x4dc739=_0x52a861[_0x7738('0xf')]++;_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x21')+(_0x4dc739+0x2)+_0x7738('0x22')+(_0x4dc739+0x1)+')','context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x4dc739,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});if(_0x52a861[_0x7738('0x1c')]){_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':'Set','appdata':_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]?_0x7738('0x23')+_0x52a861[_0x7738('0x1c')][_0x7738('0x1d')]+'}':_0x7738('0x24'),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861['priority']++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});}_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0]['type'],'app':_0x7738('0x13'),'appdata':_0x7738('0x25')+_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});if(_0x52a861[_0x7738('0x1c')]&&_0x52a861[_0x7738('0x1c')]['hasOwnProperty'](_0x7738('0x26'))&&_0x52a861[_0x7738('0x1c')][_0x7738('0x26')]!==_0x7738('0x27')){_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x28'),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861['priority']++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});_0x52a861[_0x7738('0x1a')]['push']({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x52a861[_0x7738('0x1c')]['recordingFormat']||'wav','context':_0x206e1d[_0x2b5f26][0x0]['context'],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});}}_0x52a861['extensions'][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x29'),'context':_0x206e1d[_0x2b5f26][0x0]['context'],'exten':_0x206e1d[_0x2b5f26][0x0]['exten'],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x2a'),'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'priority':_0x52a861[_0x7738('0xf')]++,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});for(var _0x5a7588=0x0,_0x5c8292=0x0;_0x5a7588<_0x206e1d[_0x2b5f26][_0x7738('0x2b')];_0x5a7588+=0x1,_0x5c8292=0x0){var _0x3759ea=_0x206e1d[_0x2b5f26][_0x5a7588];if(_0x3759ea[_0x7738('0x12')]){_0x3759ea[_0x7738('0x12')]=_0x3759ea[_0x7738('0x12')][_0x7738('0x2c')]();}var _0x44e1ab=[];var _0x559fc6=[];delete _0x3759ea['id'];delete _0x3759ea[_0x7738('0x2d')];delete _0x3759ea[_0x7738('0x2e')];var _0x3674a8=_0x3759ea[_0x7738('0x2f')]!==_0x7738('0x30')?[_0x3759ea[_0x7738('0x2f')]]:_0x3759ea[_0x7738('0x7')]?_[_0x7738('0x9')](_[_0x7738('0xb')](_0x52a861[_0x7738('0x6')],{'IntervalId':_0x3759ea[_0x7738('0x7')]}),'interval'):[];if(_0x3759ea[_0x7738('0x31')]('tag')){if(_0x3759ea[_0x7738('0x32')]&&_0x3759ea[_0x7738('0x32')]!=='--'){_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x33')+_0x3759ea[_0x7738('0x32')],'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861['priority']+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}}if(_0x3759ea[_0x7738('0x12')]===_0x7738('0x19')&&_0x3759ea['hasOwnProperty'](_0x7738('0x34'))){if(_0x3759ea[_0x7738('0x34')]){_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x35')+_0x3759ea['callerID']+')','context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea['exten'],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}else{_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x36'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}}if(_0x3759ea[_0x7738('0x31')]('answer')){if(_0x1be52e[_0x7738('0x37')](_0x3759ea[_0x7738('0x38')]['toLowerCase']())>=0x0&&_0x3759ea[_0x7738('0x39')]!=='custom'){if(_0x3759ea[_0x7738('0x3a')]){_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea['type'],'app':'ExecIf','appdata':_0x7738('0x3b'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861['priority']+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});_0x44e1ab['push']({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x3c'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea['exten'],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861['priority']+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}else{_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x20'),'appdata':_0x7738('0x3d'),'context':_0x3759ea[_0x7738('0x15')],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});_0x44e1ab[_0x7738('0x11')]({'type':_0x3759ea[_0x7738('0x12')],'app':_0x7738('0x13'),'appdata':_0x7738('0x3e'),'context':_0x3759ea['context'],'exten':_0x3759ea[_0x7738('0xa')],'priority':_0x3674a8[_0x7738('0x2b')]+_0x52a861[_0x7738('0xf')]+_0x5c8292++,'VoiceExtensionId':_0x3759ea[_0x7738('0x16')]});}}}for(var _0x155bc2=0x0;_0x155bc2<_0x3674a8[_0x7738('0x2b')];_0x155bc2+=0x1){var _0x386b3e=_0x52a861['priority']+_0x3674a8[_0x7738('0x2b')];var _0x5a58ba=_0x155bc2===_0x3674a8['length']-0x1?_0x52a861['priority']+_0x44e1ab[_0x7738('0x2b')]+_0x559fc6[_0x7738('0x2b')]+0x2:_0x52a861[_0x7738('0xf')]+_0x155bc2+0x1;_0x44e1ab[_0x7738('0x3f')](_0x155bc2,0x0,{'type':_0x3759ea[_0x7738('0x12')],'app':'GotoIfTime','appdata':_0x3674a8[_0x155bc2]+'?'+_0x3759ea[_0x7738('0x15')]+_0x7738('0x40')+_0x386b3e+':'+_0x3759ea['context']+_0x7738('0x40')+_0x5a58ba,'exten':_0x3759ea['exten'],'context':_0x3759ea[_0x7738('0x15')],'priority':_0x52a861[_0x7738('0xf')]+_0x155bc2,'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0]['VoiceExtensionId']});}_0x3759ea['priority']=_0x44e1ab['length']?_[_0x7738('0x41')](_0x44e1ab)[_0x7738('0xf')]+0x1:_0x52a861[_0x7738('0xf')];_0x52a861['priority']=(_0x559fc6[_0x7738('0x2b')]?_['last'](_0x559fc6)[_0x7738('0xf')]:_0x3759ea[_0x7738('0xf')])+0x1;_0x52a861[_0x7738('0x1a')]=_[_0x7738('0x42')](_0x52a861[_0x7738('0x1a')],_0x44e1ab,[_0x3759ea],_0x559fc6);}_0x52a861[_0x7738('0x1a')][_0x7738('0x11')]({'type':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x12')],'app':'Hangup','exten':_0x206e1d[_0x2b5f26][0x0][_0x7738('0xa')],'context':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x15')],'priority':_0x52a861[_0x7738('0xf')],'VoiceExtensionId':_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]});_0x22dbf1[_0x7738('0x11')](_0x206e1d[_0x2b5f26][0x0][_0x7738('0x16')]);_0x4776a1=_[_0x7738('0x42')](_0x4776a1,_0x52a861[_0x7738('0x1a')]);}}return _0x185d80[_0x7738('0x43')](function(_0x46cca9){return _0x185d80['models'][_0x7738('0x8')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x22dbf1}},'transaction':_0x46cca9})[_0x7738('0x5')](function(_0x595753){return _0x185d80[_0x7738('0x2')][_0x7738('0x8')][_0x7738('0x44')](_[_0x7738('0x45')](_0x4776a1,_0x7738('0xf')),{'transaction':_0x46cca9});});});})[_0x7738('0x46')](function(_0x5958f){console['error'](_0x5958f);});}exports[_0x7738('0x47')]=rewrite;
\ No newline at end of file