Built motion from commit 52c8a02d.|2.6.29
[motion2.git] / server / components / extensions / rewrite.js
index fc6ec08..dd09abf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x76e6=['none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','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','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','type','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','push','Set','extension','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat'];(function(_0x1be72d,_0x8ab5df){var _0x5691f2=function(_0x5ceaa5){while(--_0x5ceaa5){_0x1be72d['push'](_0x1be72d['shift']());}};_0x5691f2(++_0x8ab5df);}(_0x76e6,0x69));var _0x676e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x76e6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x676e('0x0'));var util=require(_0x676e('0x1'));function rewrite(_0x2cda0f,_0x4feeef){var _0x4023b4=this;return _0x2cda0f[_0x676e('0x2')][_0x676e('0x3')][_0x676e('0x4')]({'raw':!![]})['then'](function(_0x4e40b3){_0x4023b4[_0x676e('0x5')]=_0x4e40b3;return _0x2cda0f[_0x676e('0x2')][_0x676e('0x6')][_0x676e('0x4')]({'where':{'IntervalId':_0x4feeef[_0x676e('0x7')]},'raw':!![]});})[_0x676e('0x8')](function(_0x217084){return _0x2cda0f[_0x676e('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x676e('0x9')](_[_0x676e('0xa')](_0x217084,_0x676e('0xb')))}},'order':[{'raw':_0x676e('0xc')}],'raw':!![]});})['then'](function(_0x50e45a){var _0x2027af=_[_0x676e('0xd')](_0x50e45a,{'priority':'1'});var _0x5002f8=_[_0x676e('0xd')](_0x50e45a,{'isApp':0x1});var _0x3384ec=_[_0x676e('0xe')](_0x5002f8,'exten');var _0x4b1c0f=['queue',_0x676e('0xf')];var _0x56ca80=[];var _0x248e55=[];for(var _0x280c7a in _0x3384ec){if(_0x3384ec[_0x676e('0x10')](_0x280c7a)){_0x4023b4[_0x676e('0x11')]=0x2;_0x4023b4[_0x676e('0x12')]=[];_0x4023b4['extension']=_['find'](_0x2027af,{'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')]});_0x4023b4[_0x676e('0x12')]['push']({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':'Set','appdata':util['format'](_0x676e('0x14'),_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')]),'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')],'priority':_0x4023b4[_0x676e('0x11')]++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});if(_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')]===_0x676e('0x17')){_0x4023b4['extensions']['push']({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':'Set','appdata':_0x676e('0x18')+_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')],'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0]['exten'],'priority':_0x4023b4['priority']++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});}else if(_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')]==='outbound'){if(_0x4023b4['extension']){_0x4023b4['extensions'][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0]['type'],'app':_0x676e('0x1a'),'appdata':'CDR(destination)='+(_0x4023b4[_0x676e('0x1b')][_0x676e('0x1c')]?_0x676e('0x1d')+_0x4023b4[_0x676e('0x1b')][_0x676e('0x1c')]+'}':_0x676e('0x1e')),'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')],'priority':_0x4023b4[_0x676e('0x11')]++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});}_0x4023b4['extensions'][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':_0x676e('0x1a'),'appdata':_0x676e('0x18')+_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')],'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0]['exten'],'priority':_0x4023b4[_0x676e('0x11')]++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});var _0x5ef4f7=_0x4023b4[_0x676e('0x11')]++;_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':'ExecIf','appdata':_0x676e('0x1f')+(_0x5ef4f7+0x2)+_0x676e('0x20')+(_0x5ef4f7+0x1)+')','context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0]['exten'],'priority':_0x5ef4f7,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});if(_0x4023b4[_0x676e('0x1b')]){_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0]['type'],'app':_0x676e('0x1a'),'appdata':_0x4023b4[_0x676e('0x1b')][_0x676e('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x4023b4[_0x676e('0x1b')][_0x676e('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0]['exten'],'priority':_0x4023b4[_0x676e('0x11')]++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});}_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0]['type'],'app':_0x676e('0x1a'),'appdata':_0x676e('0x21')+_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')],'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')],'priority':_0x4023b4[_0x676e('0x11')]++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});if(_0x4023b4[_0x676e('0x1b')]&&_0x4023b4[_0x676e('0x1b')][_0x676e('0x10')](_0x676e('0x22'))&&_0x4023b4[_0x676e('0x1b')][_0x676e('0x22')]!==_0x676e('0x23')){_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0]['type'],'app':_0x676e('0x1a'),'appdata':_0x676e('0x24'),'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0]['exten'],'priority':_0x4023b4[_0x676e('0x11')]++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':'Set','appdata':_0x676e('0x25')+_0x4023b4[_0x676e('0x1b')]['recordingFormat']||_0x676e('0x26'),'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')],'priority':_0x4023b4['priority']++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});}}_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':_0x676e('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')],'priority':_0x4023b4['priority']++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0]['VoiceExtensionId']});_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':_0x676e('0x1a'),'appdata':_0x676e('0x27'),'context':_0x3384ec[_0x280c7a][0x0][_0x676e('0x15')],'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')],'priority':_0x4023b4[_0x676e('0x11')]++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0]['VoiceExtensionId']});_0x4023b4[_0x676e('0x12')]['push']({'type':_0x3384ec[_0x280c7a][0x0][_0x676e('0x13')],'app':_0x676e('0x1a'),'appdata':_0x676e('0x28'),'context':_0x3384ec[_0x280c7a][0x0]['context'],'exten':_0x3384ec[_0x280c7a][0x0][_0x676e('0xb')],'priority':_0x4023b4['priority']++,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});for(var _0x3cae1f=0x0,_0xf1cabf=0x0;_0x3cae1f<_0x3384ec[_0x280c7a][_0x676e('0x29')];_0x3cae1f+=0x1,_0xf1cabf=0x0){var _0x1031d9=_0x3384ec[_0x280c7a][_0x3cae1f];if(_0x1031d9['type']){_0x1031d9[_0x676e('0x13')]=_0x1031d9[_0x676e('0x13')][_0x676e('0x2a')]();}var _0x56a6ef=[];var _0x509e6a=[];delete _0x1031d9['id'];delete _0x1031d9[_0x676e('0x2b')];delete _0x1031d9[_0x676e('0x2c')];var _0x5c66b1=_0x1031d9[_0x676e('0x2d')]!==_0x676e('0x2e')?[_0x1031d9[_0x676e('0x2d')]]:_0x1031d9[_0x676e('0x7')]?_[_0x676e('0xa')](_[_0x676e('0xd')](_0x4023b4[_0x676e('0x5')],{'IntervalId':_0x1031d9['IntervalId']}),_0x676e('0x2d')):[];if(_0x1031d9[_0x676e('0x10')]('tag')){if(_0x1031d9[_0x676e('0x2f')]&&_0x1031d9[_0x676e('0x2f')]!=='--'){_0x56a6ef[_0x676e('0x19')]({'type':_0x1031d9[_0x676e('0x13')],'app':_0x676e('0x1a'),'appdata':_0x676e('0x30')+_0x1031d9[_0x676e('0x2f')],'context':_0x1031d9[_0x676e('0x15')],'exten':_0x1031d9[_0x676e('0xb')],'priority':_0x5c66b1['length']+_0x4023b4[_0x676e('0x11')]+_0xf1cabf++,'VoiceExtensionId':_0x1031d9[_0x676e('0x16')]});}}if(_0x1031d9[_0x676e('0x13')]==='outbound'&&_0x1031d9[_0x676e('0x10')]('callerID')){if(_0x1031d9['callerID']){_0x56a6ef[_0x676e('0x19')]({'type':_0x1031d9[_0x676e('0x13')],'app':_0x676e('0x31'),'appdata':_0x676e('0x32')+_0x1031d9[_0x676e('0x33')]+')','context':_0x1031d9[_0x676e('0x15')],'exten':_0x1031d9['exten'],'priority':_0x5c66b1[_0x676e('0x29')]+_0x4023b4[_0x676e('0x11')]+_0xf1cabf++,'VoiceExtensionId':_0x1031d9[_0x676e('0x16')]});}else{_0x56a6ef[_0x676e('0x19')]({'type':_0x1031d9[_0x676e('0x13')],'app':'ExecIf','appdata':_0x676e('0x34'),'context':_0x1031d9['context'],'exten':_0x1031d9['exten'],'priority':_0x5c66b1['length']+_0x4023b4[_0x676e('0x11')]+_0xf1cabf++,'VoiceExtensionId':_0x1031d9[_0x676e('0x16')]});}}if(_0x1031d9[_0x676e('0x10')](_0x676e('0x35'))){if(_0x4b1c0f['indexOf'](_0x1031d9[_0x676e('0x36')][_0x676e('0x2a')]())>=0x0&&_0x1031d9[_0x676e('0x37')]!=='custom'){if(_0x1031d9[_0x676e('0x35')]){_0x56a6ef[_0x676e('0x19')]({'type':_0x1031d9[_0x676e('0x13')],'app':_0x676e('0x31'),'appdata':_0x676e('0x38'),'context':_0x1031d9[_0x676e('0x15')],'exten':_0x1031d9[_0x676e('0xb')],'priority':_0x5c66b1['length']+_0x4023b4[_0x676e('0x11')]+_0xf1cabf++,'VoiceExtensionId':_0x1031d9['VoiceExtensionId']});_0x56a6ef[_0x676e('0x19')]({'type':_0x1031d9['type'],'app':'Set','appdata':_0x676e('0x39'),'context':_0x1031d9['context'],'exten':_0x1031d9[_0x676e('0xb')],'priority':_0x5c66b1[_0x676e('0x29')]+_0x4023b4[_0x676e('0x11')]+_0xf1cabf++,'VoiceExtensionId':_0x1031d9[_0x676e('0x16')]});}else{_0x56a6ef['push']({'type':_0x1031d9[_0x676e('0x13')],'app':_0x676e('0x31'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1031d9['context'],'exten':_0x1031d9[_0x676e('0xb')],'priority':_0x5c66b1[_0x676e('0x29')]+_0x4023b4[_0x676e('0x11')]+_0xf1cabf++,'VoiceExtensionId':_0x1031d9[_0x676e('0x16')]});_0x56a6ef[_0x676e('0x19')]({'type':_0x1031d9['type'],'app':'Set','appdata':_0x676e('0x3a'),'context':_0x1031d9['context'],'exten':_0x1031d9[_0x676e('0xb')],'priority':_0x5c66b1[_0x676e('0x29')]+_0x4023b4['priority']+_0xf1cabf++,'VoiceExtensionId':_0x1031d9[_0x676e('0x16')]});}}}for(var _0x5b1dcd=0x0;_0x5b1dcd<_0x5c66b1[_0x676e('0x29')];_0x5b1dcd+=0x1){var _0x4d2bbb=_0x4023b4[_0x676e('0x11')]+_0x5c66b1[_0x676e('0x29')];var _0x54b4fa=_0x5b1dcd===_0x5c66b1[_0x676e('0x29')]-0x1?_0x4023b4[_0x676e('0x11')]+_0x56a6ef[_0x676e('0x29')]+_0x509e6a[_0x676e('0x29')]+0x2:_0x4023b4[_0x676e('0x11')]+_0x5b1dcd+0x1;_0x56a6ef['splice'](_0x5b1dcd,0x0,{'type':_0x1031d9[_0x676e('0x13')],'app':_0x676e('0x3b'),'appdata':_0x5c66b1[_0x5b1dcd]+'?'+_0x1031d9['context']+_0x676e('0x3c')+_0x4d2bbb+':'+_0x1031d9[_0x676e('0x15')]+_0x676e('0x3c')+_0x54b4fa,'exten':_0x1031d9[_0x676e('0xb')],'context':_0x1031d9[_0x676e('0x15')],'priority':_0x4023b4['priority']+_0x5b1dcd,'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});}_0x1031d9[_0x676e('0x11')]=_0x56a6ef[_0x676e('0x29')]?_[_0x676e('0x3d')](_0x56a6ef)[_0x676e('0x11')]+0x1:_0x4023b4[_0x676e('0x11')];_0x4023b4[_0x676e('0x11')]=(_0x509e6a['length']?_[_0x676e('0x3d')](_0x509e6a)['priority']:_0x1031d9['priority'])+0x1;_0x4023b4[_0x676e('0x12')]=_['concat'](_0x4023b4[_0x676e('0x12')],_0x56a6ef,[_0x1031d9],_0x509e6a);}_0x4023b4[_0x676e('0x12')][_0x676e('0x19')]({'type':_0x3384ec[_0x280c7a][0x0]['type'],'app':_0x676e('0x3e'),'exten':_0x3384ec[_0x280c7a][0x0]['exten'],'context':_0x3384ec[_0x280c7a][0x0]['context'],'priority':_0x4023b4[_0x676e('0x11')],'VoiceExtensionId':_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]});_0x56ca80[_0x676e('0x19')](_0x3384ec[_0x280c7a][0x0][_0x676e('0x16')]);_0x248e55=_[_0x676e('0x3f')](_0x248e55,_0x4023b4['extensions']);}}return _0x2cda0f[_0x676e('0x40')](function(_0x381bb9){return _0x2cda0f[_0x676e('0x2')]['VoiceExtension'][_0x676e('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x56ca80}},'transaction':_0x381bb9})[_0x676e('0x8')](function(_0x4643b4){return _0x2cda0f[_0x676e('0x2')][_0x676e('0x6')][_0x676e('0x42')](_[_0x676e('0x43')](_0x248e55,_0x676e('0x11')),{'transaction':_0x381bb9});});});})[_0x676e('0x44')](function(_0x231fd5){console[_0x676e('0x45')](_0x231fd5);});}exports['rewrite']=rewrite;
\ No newline at end of file
+var _0x9a8b=['XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer'];(function(_0x856e86,_0x3f9c40){var _0x586a43=function(_0x433704){while(--_0x433704){_0x856e86['push'](_0x856e86['shift']());}};_0x586a43(++_0x3f9c40);}(_0x9a8b,0xf1));var _0xb9a8=function(_0x671a5a,_0x18dd89){_0x671a5a=_0x671a5a-0x0;var _0x2bf009=_0x9a8b[_0x671a5a];return _0x2bf009;};'use strict';var _=require(_0xb9a8('0x0'));var util=require(_0xb9a8('0x1'));function rewrite(_0x36225a,_0x407918){var _0x1c6ea3=this;return _0x36225a[_0xb9a8('0x2')][_0xb9a8('0x3')][_0xb9a8('0x4')]({'raw':!![]})[_0xb9a8('0x5')](function(_0x599bfb){_0x1c6ea3[_0xb9a8('0x6')]=_0x599bfb;return _0x36225a[_0xb9a8('0x2')][_0xb9a8('0x7')]['findAll']({'where':{'IntervalId':_0x407918['IntervalId']},'raw':!![]});})[_0xb9a8('0x5')](function(_0x1ab937){return _0x36225a['models'][_0xb9a8('0x7')][_0xb9a8('0x4')]({'where':{'exten':{'$in':_[_0xb9a8('0x8')](_[_0xb9a8('0x9')](_0x1ab937,_0xb9a8('0xa')))}},'order':[{'raw':_0xb9a8('0xb')}],'raw':!![]});})[_0xb9a8('0x5')](function(_0x30038e){var _0xef2d34=_[_0xb9a8('0xc')](_0x30038e,{'priority':'1'});var _0x30c004=_[_0xb9a8('0xc')](_0x30038e,{'isApp':0x1});var _0x2cbe4b=_[_0xb9a8('0xd')](_0x30c004,_0xb9a8('0xa'));var _0x2ea211=[_0xb9a8('0xe'),_0xb9a8('0xf')];var _0x2a690a=[];var _0x327bd7=[];for(var _0x8867ed in _0x2cbe4b){if(_0x2cbe4b[_0xb9a8('0x10')](_0x8867ed)){_0x1c6ea3[_0xb9a8('0x11')]=0x2;_0x1c6ea3[_0xb9a8('0x12')]=[];_0x1c6ea3[_0xb9a8('0x13')]=_[_0xb9a8('0x14')](_0xef2d34,{'exten':_0x2cbe4b[_0x8867ed][0x0]['exten']});_0x1c6ea3[_0xb9a8('0x12')][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':util['format'](_0xb9a8('0x18'),_0x2cbe4b[_0x8867ed][0x0]['type']),'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0]['exten'],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});if(_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')]===_0xb9a8('0x1b')){_0x1c6ea3[_0xb9a8('0x12')][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':'CDR(routeid)='+_0x2cbe4b[_0x8867ed][0x0]['VoiceExtensionId'],'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});}else if(_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')]===_0xb9a8('0x1c')){if(_0x1c6ea3['extension']){_0x1c6ea3[_0xb9a8('0x12')][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x1d')+(_0x1c6ea3[_0xb9a8('0x13')][_0xb9a8('0x1e')]?_0xb9a8('0x1f')+_0x1c6ea3[_0xb9a8('0x13')][_0xb9a8('0x1e')]+'}':_0xb9a8('0x20')),'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0]['exten'],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});}_0x1c6ea3[_0xb9a8('0x12')][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x21')+_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')],'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3['priority']++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});var _0x487a64=_0x1c6ea3['priority']++;_0x1c6ea3['extensions']['push']({'type':_0x2cbe4b[_0x8867ed][0x0]['type'],'app':'ExecIf','appdata':_0xb9a8('0x22')+(_0x487a64+0x2)+_0xb9a8('0x23')+(_0x487a64+0x1)+')','context':_0x2cbe4b[_0x8867ed][0x0]['context'],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x487a64,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});if(_0x1c6ea3[_0xb9a8('0x13')]){_0x1c6ea3['extensions'][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0x1c6ea3[_0xb9a8('0x13')]['cutdigits']?_0xb9a8('0x24')+_0x1c6ea3[_0xb9a8('0x13')]['cutdigits']+'}':_0xb9a8('0x25'),'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0]['VoiceExtensionId']});}_0x1c6ea3[_0xb9a8('0x12')][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x26')+_0x2cbe4b[_0x8867ed][0x0]['VoiceExtensionId'],'context':_0x2cbe4b[_0x8867ed][0x0]['context'],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3['priority']++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});if(_0x1c6ea3['extension']&&_0x1c6ea3[_0xb9a8('0x13')][_0xb9a8('0x10')](_0xb9a8('0x27'))&&_0x1c6ea3[_0xb9a8('0x13')][_0xb9a8('0x27')]!=='none'){_0x1c6ea3[_0xb9a8('0x12')][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0]['type'],'app':_0xb9a8('0x17'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0]['exten'],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});_0x1c6ea3['extensions']['push']({'type':_0x2cbe4b[_0x8867ed][0x0]['type'],'app':'Set','appdata':_0xb9a8('0x28')+_0x1c6ea3['extension'][_0xb9a8('0x27')]||'wav','context':_0x2cbe4b[_0x8867ed][0x0]['context'],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});}}_0x1c6ea3[_0xb9a8('0x12')]['push']({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x29'),'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});_0x1c6ea3[_0xb9a8('0x12')]['push']({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x2a'),'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3[_0xb9a8('0x11')]++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});_0x1c6ea3['extensions'][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x2b'),'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'priority':_0x1c6ea3['priority']++,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});for(var _0x4f763e=0x0,_0x56270a=0x0;_0x4f763e<_0x2cbe4b[_0x8867ed][_0xb9a8('0x2c')];_0x4f763e+=0x1,_0x56270a=0x0){var _0x5b29cf=_0x2cbe4b[_0x8867ed][_0x4f763e];if(_0x5b29cf[_0xb9a8('0x16')]){_0x5b29cf[_0xb9a8('0x16')]=_0x5b29cf[_0xb9a8('0x16')][_0xb9a8('0x2d')]();}var _0x26f5af=[];var _0x519168=[];delete _0x5b29cf['id'];delete _0x5b29cf[_0xb9a8('0x2e')];delete _0x5b29cf['updatedAt'];var _0x567fb4=_0x5b29cf[_0xb9a8('0x2f')]!==_0xb9a8('0x30')?[_0x5b29cf[_0xb9a8('0x2f')]]:_0x5b29cf[_0xb9a8('0x31')]?_[_0xb9a8('0x9')](_['filter'](_0x1c6ea3[_0xb9a8('0x6')],{'IntervalId':_0x5b29cf[_0xb9a8('0x31')]}),_0xb9a8('0x2f')):[];if(_0x5b29cf[_0xb9a8('0x10')]('tag')){if(_0x5b29cf[_0xb9a8('0x32')]&&_0x5b29cf['tag']!=='--'){_0x26f5af[_0xb9a8('0x15')]({'type':_0x5b29cf[_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':'CDR(tag)='+_0x5b29cf[_0xb9a8('0x32')],'context':_0x5b29cf[_0xb9a8('0x19')],'exten':_0x5b29cf[_0xb9a8('0xa')],'priority':_0x567fb4[_0xb9a8('0x2c')]+_0x1c6ea3[_0xb9a8('0x11')]+_0x56270a++,'VoiceExtensionId':_0x5b29cf[_0xb9a8('0x1a')]});}}if(_0x5b29cf['type']==='outbound'&&_0x5b29cf['hasOwnProperty'](_0xb9a8('0x33'))){if(_0x5b29cf[_0xb9a8('0x33')]){_0x26f5af['push']({'type':_0x5b29cf[_0xb9a8('0x16')],'app':_0xb9a8('0x34'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5b29cf[_0xb9a8('0x33')]+')','context':_0x5b29cf[_0xb9a8('0x19')],'exten':_0x5b29cf[_0xb9a8('0xa')],'priority':_0x567fb4[_0xb9a8('0x2c')]+_0x1c6ea3[_0xb9a8('0x11')]+_0x56270a++,'VoiceExtensionId':_0x5b29cf[_0xb9a8('0x1a')]});}else{_0x26f5af['push']({'type':_0x5b29cf[_0xb9a8('0x16')],'app':'ExecIf','appdata':_0xb9a8('0x35'),'context':_0x5b29cf['context'],'exten':_0x5b29cf[_0xb9a8('0xa')],'priority':_0x567fb4[_0xb9a8('0x2c')]+_0x1c6ea3[_0xb9a8('0x11')]+_0x56270a++,'VoiceExtensionId':_0x5b29cf[_0xb9a8('0x1a')]});}}if(_0x5b29cf[_0xb9a8('0x10')](_0xb9a8('0x36'))){if(_0x2ea211[_0xb9a8('0x37')](_0x5b29cf['app']['toLowerCase']())>=0x0&&_0x5b29cf[_0xb9a8('0x38')]!==_0xb9a8('0x39')){if(_0x5b29cf[_0xb9a8('0x36')]){_0x26f5af['push']({'type':_0x5b29cf['type'],'app':_0xb9a8('0x34'),'appdata':_0xb9a8('0x3a'),'context':_0x5b29cf[_0xb9a8('0x19')],'exten':_0x5b29cf['exten'],'priority':_0x567fb4[_0xb9a8('0x2c')]+_0x1c6ea3['priority']+_0x56270a++,'VoiceExtensionId':_0x5b29cf[_0xb9a8('0x1a')]});_0x26f5af[_0xb9a8('0x15')]({'type':_0x5b29cf[_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x3b'),'context':_0x5b29cf[_0xb9a8('0x19')],'exten':_0x5b29cf[_0xb9a8('0xa')],'priority':_0x567fb4[_0xb9a8('0x2c')]+_0x1c6ea3['priority']+_0x56270a++,'VoiceExtensionId':_0x5b29cf[_0xb9a8('0x1a')]});}else{_0x26f5af['push']({'type':_0x5b29cf[_0xb9a8('0x16')],'app':'ExecIf','appdata':_0xb9a8('0x3c'),'context':_0x5b29cf['context'],'exten':_0x5b29cf[_0xb9a8('0xa')],'priority':_0x567fb4[_0xb9a8('0x2c')]+_0x1c6ea3[_0xb9a8('0x11')]+_0x56270a++,'VoiceExtensionId':_0x5b29cf[_0xb9a8('0x1a')]});_0x26f5af['push']({'type':_0x5b29cf[_0xb9a8('0x16')],'app':_0xb9a8('0x17'),'appdata':_0xb9a8('0x3d'),'context':_0x5b29cf[_0xb9a8('0x19')],'exten':_0x5b29cf[_0xb9a8('0xa')],'priority':_0x567fb4[_0xb9a8('0x2c')]+_0x1c6ea3[_0xb9a8('0x11')]+_0x56270a++,'VoiceExtensionId':_0x5b29cf['VoiceExtensionId']});}}}for(var _0x72e30a=0x0;_0x72e30a<_0x567fb4[_0xb9a8('0x2c')];_0x72e30a+=0x1){var _0x375d80=_0x1c6ea3[_0xb9a8('0x11')]+_0x567fb4['length'];var _0x3ea9bb=_0x72e30a===_0x567fb4[_0xb9a8('0x2c')]-0x1?_0x1c6ea3[_0xb9a8('0x11')]+_0x26f5af[_0xb9a8('0x2c')]+_0x519168['length']+0x2:_0x1c6ea3[_0xb9a8('0x11')]+_0x72e30a+0x1;_0x26f5af[_0xb9a8('0x3e')](_0x72e30a,0x0,{'type':_0x5b29cf[_0xb9a8('0x16')],'app':_0xb9a8('0x3f'),'appdata':_0x567fb4[_0x72e30a]+'?'+_0x5b29cf['context']+_0xb9a8('0x40')+_0x375d80+':'+_0x5b29cf[_0xb9a8('0x19')]+_0xb9a8('0x40')+_0x3ea9bb,'exten':_0x5b29cf[_0xb9a8('0xa')],'context':_0x5b29cf['context'],'priority':_0x1c6ea3['priority']+_0x72e30a,'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0]['VoiceExtensionId']});}_0x5b29cf['priority']=_0x26f5af[_0xb9a8('0x2c')]?_[_0xb9a8('0x41')](_0x26f5af)['priority']+0x1:_0x1c6ea3['priority'];_0x1c6ea3['priority']=(_0x519168[_0xb9a8('0x2c')]?_[_0xb9a8('0x41')](_0x519168)[_0xb9a8('0x11')]:_0x5b29cf[_0xb9a8('0x11')])+0x1;_0x1c6ea3['extensions']=_[_0xb9a8('0x42')](_0x1c6ea3[_0xb9a8('0x12')],_0x26f5af,[_0x5b29cf],_0x519168);}_0x1c6ea3[_0xb9a8('0x12')][_0xb9a8('0x15')]({'type':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x16')],'app':_0xb9a8('0x43'),'exten':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0xa')],'context':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x19')],'priority':_0x1c6ea3[_0xb9a8('0x11')],'VoiceExtensionId':_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]});_0x2a690a[_0xb9a8('0x15')](_0x2cbe4b[_0x8867ed][0x0][_0xb9a8('0x1a')]);_0x327bd7=_[_0xb9a8('0x42')](_0x327bd7,_0x1c6ea3['extensions']);}}return _0x36225a[_0xb9a8('0x44')](function(_0x30fd5b){return _0x36225a[_0xb9a8('0x2')][_0xb9a8('0x7')][_0xb9a8('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x2a690a}},'transaction':_0x30fd5b})[_0xb9a8('0x5')](function(_0x567451){return _0x36225a[_0xb9a8('0x2')][_0xb9a8('0x7')][_0xb9a8('0x46')](_[_0xb9a8('0x47')](_0x327bd7,_0xb9a8('0x11')),{'transaction':_0x30fd5b});});});})[_0xb9a8('0x48')](function(_0x35398c){console[_0xb9a8('0x49')](_0x35398c);});}exports[_0xb9a8('0x4a')]=rewrite;
\ No newline at end of file