Built motion from commit 5293bb2a.|2.6.30
[motion2.git] / server / components / extensions / rewrite.js
index 7641499..ac1d30c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e80=['extension','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','findAll','then','intervals','models','IntervalId','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','priority','extensions','find','push','Set','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound'];(function(_0x888931,_0x52f998){var _0x4dac8b=function(_0x6f30d9){while(--_0x6f30d9){_0x888931['push'](_0x888931['shift']());}};_0x4dac8b(++_0x52f998);}(_0x1e80,0x1b0));var _0x01e8=function(_0x26003b,_0x37abc9){_0x26003b=_0x26003b-0x0;var _0x1a8dc9=_0x1e80[_0x26003b];return _0x1a8dc9;};'use strict';var _=require(_0x01e8('0x0'));var util=require('util');function rewrite(_0x3e8267,_0x528e8c){var _0x22218c=this;return _0x3e8267['models']['Interval'][_0x01e8('0x1')]({'raw':!![]})[_0x01e8('0x2')](function(_0x414a41){_0x22218c[_0x01e8('0x3')]=_0x414a41;return _0x3e8267[_0x01e8('0x4')]['VoiceExtension'][_0x01e8('0x1')]({'where':{'IntervalId':_0x528e8c[_0x01e8('0x5')]},'raw':!![]});})[_0x01e8('0x2')](function(_0x1e9837){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x1')]({'where':{'exten':{'$in':_['uniq'](_[_0x01e8('0x7')](_0x1e9837,_0x01e8('0x8')))}},'order':[{'raw':_0x01e8('0x9')}],'raw':!![]});})[_0x01e8('0x2')](function(_0x347d0a){var _0x26febf=_[_0x01e8('0xa')](_0x347d0a,{'priority':'1'});var _0x4a64ac=_['filter'](_0x347d0a,{'isApp':0x1});var _0x1d9c15=_['groupBy'](_0x4a64ac,_0x01e8('0x8'));var _0x5df067=['queue',_0x01e8('0xb')];var _0x30ba4f=[];var _0x16ebea=[];for(var _0xd01c4f in _0x1d9c15){if(_0x1d9c15['hasOwnProperty'](_0xd01c4f)){_0x22218c[_0x01e8('0xc')]=0x2;_0x22218c[_0x01e8('0xd')]=[];_0x22218c['extension']=_[_0x01e8('0xe')](_0x26febf,{'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x10'),'appdata':util['format']('CDR(type)=%s',_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')]),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});if(_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')]===_0x01e8('0x14')){_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x15')+_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}else if(_0x1d9c15[_0xd01c4f][0x0]['type']===_0x01e8('0x16')){if(_0x22218c[_0x01e8('0x17')]){_0x22218c['extensions']['push']({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x18')+(_0x22218c[_0x01e8('0x17')][_0x01e8('0x19')]?_0x01e8('0x1a')+_0x22218c['extension'][_0x01e8('0x19')]+'}':'${EXTEN}'),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x15')+_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});var _0x1508d5=_0x22218c[_0x01e8('0xc')]++;_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x1b'),'appdata':_0x01e8('0x1c')+(_0x1508d5+0x2)+'):Goto('+(_0x1508d5+0x1)+')','context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x1508d5,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});if(_0x22218c[_0x01e8('0x17')]){_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x22218c['extension']['cutdigits']?_0x01e8('0x1d')+_0x22218c['extension'][_0x01e8('0x19')]+'}':_0x01e8('0x1e'),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});}_0x22218c['extensions']['push']({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x1f')+_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId'],'context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});if(_0x22218c['extension']&&_0x22218c['extension'][_0x01e8('0x20')](_0x01e8('0x21'))&&_0x22218c[_0x01e8('0x17')]['recordingFormat']!==_0x01e8('0x22')){_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x23'),'context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x24')+_0x22218c[_0x01e8('0x17')]['recordingFormat']||'wav','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}}_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});for(var _0x2b967a=0x0,_0x5b6bcd=0x0;_0x2b967a<_0x1d9c15[_0xd01c4f][_0x01e8('0x25')];_0x2b967a+=0x1,_0x5b6bcd=0x0){var _0x63aee6=_0x1d9c15[_0xd01c4f][_0x2b967a];if(_0x63aee6[_0x01e8('0x11')]){_0x63aee6['type']=_0x63aee6['type'][_0x01e8('0x26')]();}var _0x3d178a=[];var _0x4565fa=[];delete _0x63aee6['id'];delete _0x63aee6[_0x01e8('0x27')];delete _0x63aee6[_0x01e8('0x28')];var _0x27542d=_0x63aee6['interval']!==_0x01e8('0x29')?[_0x63aee6[_0x01e8('0x2a')]]:_0x63aee6[_0x01e8('0x5')]?_[_0x01e8('0x7')](_[_0x01e8('0xa')](_0x22218c[_0x01e8('0x3')],{'IntervalId':_0x63aee6[_0x01e8('0x5')]}),_0x01e8('0x2a')):[];if(_0x63aee6[_0x01e8('0x20')](_0x01e8('0x2b'))){if(_0x63aee6[_0x01e8('0x2b')]&&_0x63aee6[_0x01e8('0x2b')]!=='--'){_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x2c')+_0x63aee6[_0x01e8('0x2b')],'context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6['VoiceExtensionId']});}}if(_0x63aee6[_0x01e8('0x11')]===_0x01e8('0x16')&&_0x63aee6['hasOwnProperty']('callerID')){if(_0x63aee6[_0x01e8('0x2d')]){_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x63aee6[_0x01e8('0x2d')]+')','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c['priority']+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6['VoiceExtensionId']});}else{_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6['type'],'app':_0x01e8('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d['length']+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}}if(_0x63aee6[_0x01e8('0x20')](_0x01e8('0x2e'))){if(_0x5df067[_0x01e8('0x2f')](_0x63aee6[_0x01e8('0x30')][_0x01e8('0x26')]())>=0x0&&_0x63aee6[_0x01e8('0x31')]!==_0x01e8('0x32')){if(_0x63aee6[_0x01e8('0x2e')]){_0x3d178a['push']({'type':_0x63aee6[_0x01e8('0x11')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6['exten'],'priority':_0x27542d['length']+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x33'),'context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}else{_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x1b'),'appdata':_0x01e8('0x34'),'context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});_0x3d178a['push']({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}}}for(var _0x1208c7=0x0;_0x1208c7<_0x27542d[_0x01e8('0x25')];_0x1208c7+=0x1){var _0x3585b4=_0x22218c[_0x01e8('0xc')]+_0x27542d[_0x01e8('0x25')];var _0x23b6c7=_0x1208c7===_0x27542d[_0x01e8('0x25')]-0x1?_0x22218c[_0x01e8('0xc')]+_0x3d178a['length']+_0x4565fa[_0x01e8('0x25')]+0x2:_0x22218c['priority']+_0x1208c7+0x1;_0x3d178a[_0x01e8('0x35')](_0x1208c7,0x0,{'type':_0x63aee6[_0x01e8('0x11')],'app':'GotoIfTime','appdata':_0x27542d[_0x1208c7]+'?'+_0x63aee6[_0x01e8('0x12')]+_0x01e8('0x36')+_0x3585b4+':'+_0x63aee6['context']+_0x01e8('0x36')+_0x23b6c7,'exten':_0x63aee6['exten'],'context':_0x63aee6['context'],'priority':_0x22218c[_0x01e8('0xc')]+_0x1208c7,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}_0x63aee6[_0x01e8('0xc')]=_0x3d178a[_0x01e8('0x25')]?_[_0x01e8('0x37')](_0x3d178a)[_0x01e8('0xc')]+0x1:_0x22218c['priority'];_0x22218c[_0x01e8('0xc')]=(_0x4565fa[_0x01e8('0x25')]?_['last'](_0x4565fa)['priority']:_0x63aee6[_0x01e8('0xc')])+0x1;_0x22218c[_0x01e8('0xd')]=_['concat'](_0x22218c['extensions'],_0x3d178a,[_0x63aee6],_0x4565fa);}_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x38'),'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'priority':_0x22218c[_0x01e8('0xc')],'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x30ba4f['push'](_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']);_0x16ebea=_[_0x01e8('0x39')](_0x16ebea,_0x22218c[_0x01e8('0xd')]);}}return _0x3e8267[_0x01e8('0x3a')](function(_0x2b5974){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x30ba4f}},'transaction':_0x2b5974})['then'](function(_0x3dfc4c){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x3c')](_[_0x01e8('0x3d')](_0x16ebea,_0x01e8('0xc')),{'transaction':_0x2b5974});});});})[_0x01e8('0x3e')](function(_0x40713c){console[_0x01e8('0x3f')](_0x40713c);});}exports[_0x01e8('0x40')]=rewrite;
\ No newline at end of file
+var _0x7bb0=['):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','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','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','catch','error','lodash','util','models','findAll','then','intervals','VoiceExtension','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','hasOwnProperty','find','extensions','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','push','type','CDR(routeid)=','outbound','extension','cutdigits','${EXTEN}','ExecIf'];(function(_0x2fa2b9,_0x289e22){var _0x4d251a=function(_0x519beb){while(--_0x519beb){_0x2fa2b9['push'](_0x2fa2b9['shift']());}};_0x4d251a(++_0x289e22);}(_0x7bb0,0x6e));var _0x07bb=function(_0x445190,_0x49de87){_0x445190=_0x445190-0x0;var _0x23a0c1=_0x7bb0[_0x445190];return _0x23a0c1;};'use strict';var _=require(_0x07bb('0x0'));var util=require(_0x07bb('0x1'));function rewrite(_0x5a21dd,_0x55cc43){var _0x492660=this;return _0x5a21dd[_0x07bb('0x2')]['Interval'][_0x07bb('0x3')]({'raw':!![]})[_0x07bb('0x4')](function(_0x155890){_0x492660[_0x07bb('0x5')]=_0x155890;return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')][_0x07bb('0x3')]({'where':{'IntervalId':_0x55cc43['IntervalId']},'raw':!![]});})['then'](function(_0x36d26f){return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x07bb('0x7')](_['map'](_0x36d26f,'exten'))}},'order':[{'raw':_0x07bb('0x8')}],'raw':!![]});})[_0x07bb('0x4')](function(_0xad54c3){var _0x1f35eb=_[_0x07bb('0x9')](_0xad54c3,{'priority':'1'});var _0x3ed987=_['filter'](_0xad54c3,{'isApp':0x1});var _0x2d3328=_['groupBy'](_0x3ed987,_0x07bb('0xa'));var _0x3abd7e=[_0x07bb('0xb'),'playback'];var _0x6a3621=[];var _0x446513=[];for(var _0x31b7ac in _0x2d3328){if(_0x2d3328[_0x07bb('0xc')](_0x31b7ac)){_0x492660['priority']=0x2;_0x492660['extensions']=[];_0x492660['extension']=_[_0x07bb('0xd')](_0x1f35eb,{'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')]});_0x492660[_0x07bb('0xe')]['push']({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':util[_0x07bb('0x10')](_0x07bb('0x11'),_0x2d3328[_0x31b7ac][0x0]['type']),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});if(_0x2d3328[_0x31b7ac][0x0]['type']===_0x07bb('0x15')){_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':'Set','appdata':_0x07bb('0x18')+_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId'],'context':_0x2d3328[_0x31b7ac][0x0]['context'],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}else if(_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')]===_0x07bb('0x19')){if(_0x492660['extension']){_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':'CDR(destination)='+(_0x492660[_0x07bb('0x1a')][_0x07bb('0x1b')]?'${EXTEN:'+_0x492660['extension'][_0x07bb('0x1b')]+'}':_0x07bb('0x1c')),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x18')+_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')],'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0]['exten'],'priority':_0x492660['priority']++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});var _0x9e4f11=_0x492660[_0x07bb('0x13')]++;_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x9e4f11+0x2)+_0x07bb('0x1e')+(_0x9e4f11+0x1)+')','context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x9e4f11,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});if(_0x492660[_0x07bb('0x1a')]){_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':_0x492660[_0x07bb('0x1a')][_0x07bb('0x1b')]?_0x07bb('0x1f')+_0x492660[_0x07bb('0x1a')][_0x07bb('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x2d3328[_0x31b7ac][0x0]['context'],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId']});}_0x492660[_0x07bb('0xe')]['push']({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x20')+_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')],'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});if(_0x492660['extension']&&_0x492660['extension'][_0x07bb('0xc')](_0x07bb('0x21'))&&_0x492660[_0x07bb('0x1a')][_0x07bb('0x21')]!==_0x07bb('0x22')){_0x492660['extensions'][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x23'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660['priority']++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});_0x492660['extensions'][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x24')+_0x492660[_0x07bb('0x1a')]['recordingFormat']||_0x07bb('0x25'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}}_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId']});_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x26'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});_0x492660['extensions'][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x27'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0]['exten'],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});for(var _0x3d659e=0x0,_0xbb5653=0x0;_0x3d659e<_0x2d3328[_0x31b7ac][_0x07bb('0x28')];_0x3d659e+=0x1,_0xbb5653=0x0){var _0x34ea50=_0x2d3328[_0x31b7ac][_0x3d659e];if(_0x34ea50[_0x07bb('0x17')]){_0x34ea50[_0x07bb('0x17')]=_0x34ea50['type'][_0x07bb('0x29')]();}var _0x1fbfa3=[];var _0x217c06=[];delete _0x34ea50['id'];delete _0x34ea50[_0x07bb('0x2a')];delete _0x34ea50[_0x07bb('0x2b')];var _0x3ff988=_0x34ea50[_0x07bb('0x2c')]!==_0x07bb('0x2d')?[_0x34ea50[_0x07bb('0x2c')]]:_0x34ea50[_0x07bb('0x2e')]?_[_0x07bb('0x2f')](_[_0x07bb('0x9')](_0x492660[_0x07bb('0x5')],{'IntervalId':_0x34ea50[_0x07bb('0x2e')]}),_0x07bb('0x2c')):[];if(_0x34ea50[_0x07bb('0xc')](_0x07bb('0x30'))){if(_0x34ea50['tag']&&_0x34ea50[_0x07bb('0x30')]!=='--'){_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x31')+_0x34ea50[_0x07bb('0x30')],'context':_0x34ea50['context'],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}}if(_0x34ea50[_0x07bb('0x17')]===_0x07bb('0x19')&&_0x34ea50[_0x07bb('0xc')]('callerID')){if(_0x34ea50[_0x07bb('0x32')]){_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x33')+_0x34ea50['callerID']+')','context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}else{_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x34'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}}if(_0x34ea50[_0x07bb('0xc')]('answer')){if(_0x3abd7e[_0x07bb('0x35')](_0x34ea50[_0x07bb('0x36')]['toLowerCase']())>=0x0&&_0x34ea50[_0x07bb('0x37')]!==_0x07bb('0x38')){if(_0x34ea50[_0x07bb('0x39')]){_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x3a'),'context':_0x34ea50['context'],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660['priority']+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':'Set','appdata':_0x07bb('0x3b'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50['exten'],'priority':_0x3ff988['length']+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}else{_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x3c'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660['priority']+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});_0x1fbfa3['push']({'type':_0x34ea50[_0x07bb('0x17')],'app':'Set','appdata':_0x07bb('0x3d'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50['VoiceExtensionId']});}}}for(var _0x3ca7c1=0x0;_0x3ca7c1<_0x3ff988['length'];_0x3ca7c1+=0x1){var _0x29a3cc=_0x492660[_0x07bb('0x13')]+_0x3ff988[_0x07bb('0x28')];var _0x3073ef=_0x3ca7c1===_0x3ff988[_0x07bb('0x28')]-0x1?_0x492660[_0x07bb('0x13')]+_0x1fbfa3[_0x07bb('0x28')]+_0x217c06[_0x07bb('0x28')]+0x2:_0x492660[_0x07bb('0x13')]+_0x3ca7c1+0x1;_0x1fbfa3['splice'](_0x3ca7c1,0x0,{'type':_0x34ea50[_0x07bb('0x17')],'app':'GotoIfTime','appdata':_0x3ff988[_0x3ca7c1]+'?'+_0x34ea50[_0x07bb('0x12')]+_0x07bb('0x3e')+_0x29a3cc+':'+_0x34ea50['context']+_0x07bb('0x3e')+_0x3073ef,'exten':_0x34ea50[_0x07bb('0xa')],'context':_0x34ea50[_0x07bb('0x12')],'priority':_0x492660[_0x07bb('0x13')]+_0x3ca7c1,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}_0x34ea50['priority']=_0x1fbfa3[_0x07bb('0x28')]?_[_0x07bb('0x3f')](_0x1fbfa3)[_0x07bb('0x13')]+0x1:_0x492660[_0x07bb('0x13')];_0x492660[_0x07bb('0x13')]=(_0x217c06[_0x07bb('0x28')]?_['last'](_0x217c06)['priority']:_0x34ea50[_0x07bb('0x13')])+0x1;_0x492660[_0x07bb('0xe')]=_[_0x07bb('0x40')](_0x492660[_0x07bb('0xe')],_0x1fbfa3,[_0x34ea50],_0x217c06);}_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0x41'),'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'priority':_0x492660[_0x07bb('0x13')],'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});_0x6a3621[_0x07bb('0x16')](_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId']);_0x446513=_[_0x07bb('0x40')](_0x446513,_0x492660[_0x07bb('0xe')]);}}return _0x5a21dd['transaction'](function(_0x3c1da9){return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')][_0x07bb('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x6a3621}},'transaction':_0x3c1da9})[_0x07bb('0x4')](function(_0x22b3aa){return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')][_0x07bb('0x43')](_['sortBy'](_0x446513,_0x07bb('0x13')),{'transaction':_0x3c1da9});});});})[_0x07bb('0x44')](function(_0x52b029){console[_0x07bb('0x45')](_0x52b029);});}exports['rewrite']=rewrite;
\ No newline at end of file