Built motion from commit e8da49ee.|2.6.33
[motion2.git] / server / components / extensions / rewrite.js
index 6775738..d44ca0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde9e=['then','intervals','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','push','Set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','VoiceExtension','destroy','sortBy','error','rewrite','lodash','util','models','Interval','findAll'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xde9e,0xe2));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xede9('0x0'));var util=require(_0xede9('0x1'));function rewrite(_0x1c819b,_0xcd01d){var _0x24ac4f=this;return _0x1c819b[_0xede9('0x2')][_0xede9('0x3')][_0xede9('0x4')]({'raw':!![]})[_0xede9('0x5')](function(_0x19ae72){_0x24ac4f[_0xede9('0x6')]=_0x19ae72;return _0x1c819b[_0xede9('0x2')]['VoiceExtension'][_0xede9('0x4')]({'where':{'IntervalId':_0xcd01d[_0xede9('0x7')]},'raw':!![]});})[_0xede9('0x5')](function(_0x3e03d7){return _0x1c819b[_0xede9('0x2')]['VoiceExtension'][_0xede9('0x4')]({'where':{'exten':{'$in':_[_0xede9('0x8')](_[_0xede9('0x9')](_0x3e03d7,_0xede9('0xa')))}},'order':[{'raw':_0xede9('0xb')}],'raw':!![]});})['then'](function(_0x41f3f8){var _0x5ada3=_[_0xede9('0xc')](_0x41f3f8,{'priority':'1'});var _0x5482f2=_[_0xede9('0xc')](_0x41f3f8,{'isApp':0x1});var _0x4fc681=_[_0xede9('0xd')](_0x5482f2,_0xede9('0xa'));var _0x27f277=[_0xede9('0xe'),_0xede9('0xf')];var _0x5688a6=[];var _0x198e4b=[];for(var _0xa231b1 in _0x4fc681){if(_0x4fc681[_0xede9('0x10')](_0xa231b1)){_0x24ac4f[_0xede9('0x11')]=0x2;_0x24ac4f[_0xede9('0x12')]=[];_0x24ac4f[_0xede9('0x13')]=_[_0xede9('0x14')](_0x5ada3,{'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')]});_0x24ac4f[_0xede9('0x12')]['push']({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':'Set','appdata':util[_0xede9('0x15')](_0xede9('0x16'),_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]===_0xede9('0x1a')){_0x24ac4f['extensions']['push']({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':'Set','appdata':_0xede9('0x1b')+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}else if(_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')]===_0xede9('0x1c')){if(_0x24ac4f[_0xede9('0x13')]){_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x1f')+(_0x24ac4f[_0xede9('0x13')]['cutdigits']?'${EXTEN:'+_0x24ac4f[_0xede9('0x13')][_0xede9('0x20')]+'}':_0xede9('0x21')),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']});}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':'CDR(routeid)='+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});var _0xab5c80=_0x24ac4f['priority']++;_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x22'),'appdata':_0xede9('0x23')+(_0xab5c80+0x2)+_0xede9('0x24')+(_0xab5c80+0x1)+')','context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0xab5c80,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x24ac4f[_0xede9('0x13')]){_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0x24ac4f[_0xede9('0x13')][_0xede9('0x20')]?_0xede9('0x25')+_0x24ac4f[_0xede9('0x13')]['cutdigits']+'}':_0xede9('0x26'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0xede9('0x27')+_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});if(_0x24ac4f[_0xede9('0x13')]&&_0x24ac4f[_0xede9('0x13')]['hasOwnProperty'](_0xede9('0x28'))&&_0x24ac4f['extension'][_0xede9('0x28')]!==_0xede9('0x29')){_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':_0xede9('0x2a'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2b')+_0x24ac4f[_0xede9('0x13')][_0xede9('0x28')]||_0xede9('0x2c'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']});}}_0x24ac4f[_0xede9('0x12')][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2d'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0]['exten'],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0]['type'],'app':_0xede9('0x1e'),'appdata':_0xede9('0x2e'),'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f['priority']++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x24ac4f[_0xede9('0x12')]['push']({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'priority':_0x24ac4f[_0xede9('0x11')]++,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});for(var _0xd4a0fb=0x0,_0x248aae=0x0;_0xd4a0fb<_0x4fc681[_0xa231b1][_0xede9('0x2f')];_0xd4a0fb+=0x1,_0x248aae=0x0){var _0x4bc4b9=_0x4fc681[_0xa231b1][_0xd4a0fb];if(_0x4bc4b9[_0xede9('0x17')]){_0x4bc4b9['type']=_0x4bc4b9['type'][_0xede9('0x30')]();}var _0x8e3a1a=[];var _0x3286f6=[];delete _0x4bc4b9['id'];delete _0x4bc4b9[_0xede9('0x31')];delete _0x4bc4b9[_0xede9('0x32')];var _0x3b370d=_0x4bc4b9[_0xede9('0x33')]!==_0xede9('0x34')?[_0x4bc4b9[_0xede9('0x33')]]:_0x4bc4b9[_0xede9('0x7')]?_[_0xede9('0x9')](_[_0xede9('0xc')](_0x24ac4f[_0xede9('0x6')],{'IntervalId':_0x4bc4b9[_0xede9('0x7')]}),_0xede9('0x33')):[];if(_0x4bc4b9['hasOwnProperty'](_0xede9('0x35'))){if(_0x4bc4b9[_0xede9('0x35')]&&_0x4bc4b9[_0xede9('0x35')]!=='--'){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x36')+_0x4bc4b9['tag'],'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}}if(_0x4bc4b9[_0xede9('0x17')]===_0xede9('0x1c')&&_0x4bc4b9[_0xede9('0x10')](_0xede9('0x37'))){if(_0x4bc4b9[_0xede9('0x37')]){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':'ExecIf','appdata':_0xede9('0x38')+_0x4bc4b9['callerID']+')','context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d['length']+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9['VoiceExtensionId']});}else{_0x8e3a1a['push']({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x22'),'appdata':_0xede9('0x39'),'context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f['priority']+_0x248aae++,'VoiceExtensionId':_0x4bc4b9['VoiceExtensionId']});}}if(_0x4bc4b9[_0xede9('0x10')](_0xede9('0x3a'))){if(_0x27f277[_0xede9('0x3b')](_0x4bc4b9[_0xede9('0x3c')][_0xede9('0x30')]())>=0x0&&_0x4bc4b9[_0xede9('0x3d')]!==_0xede9('0x3e')){if(_0x4bc4b9[_0xede9('0x3a')]){_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9['type'],'app':_0xede9('0x22'),'appdata':_0xede9('0x3f'),'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});_0x8e3a1a['push']({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x40'),'context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}else{_0x8e3a1a['push']({'type':_0x4bc4b9['type'],'app':_0xede9('0x22'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4bc4b9['context'],'exten':_0x4bc4b9[_0xede9('0xa')],'priority':_0x3b370d[_0xede9('0x2f')]+_0x24ac4f[_0xede9('0x11')]+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});_0x8e3a1a[_0xede9('0x1d')]({'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x1e'),'appdata':_0xede9('0x41'),'context':_0x4bc4b9[_0xede9('0x18')],'exten':_0x4bc4b9['exten'],'priority':_0x3b370d['length']+_0x24ac4f['priority']+_0x248aae++,'VoiceExtensionId':_0x4bc4b9[_0xede9('0x19')]});}}}for(var _0x1bbfa4=0x0;_0x1bbfa4<_0x3b370d[_0xede9('0x2f')];_0x1bbfa4+=0x1){var _0x133d39=_0x24ac4f[_0xede9('0x11')]+_0x3b370d['length'];var _0xd8eb7f=_0x1bbfa4===_0x3b370d['length']-0x1?_0x24ac4f['priority']+_0x8e3a1a[_0xede9('0x2f')]+_0x3286f6[_0xede9('0x2f')]+0x2:_0x24ac4f[_0xede9('0x11')]+_0x1bbfa4+0x1;_0x8e3a1a[_0xede9('0x42')](_0x1bbfa4,0x0,{'type':_0x4bc4b9[_0xede9('0x17')],'app':_0xede9('0x43'),'appdata':_0x3b370d[_0x1bbfa4]+'?'+_0x4bc4b9[_0xede9('0x18')]+',${EXTEN},'+_0x133d39+':'+_0x4bc4b9[_0xede9('0x18')]+_0xede9('0x44')+_0xd8eb7f,'exten':_0x4bc4b9[_0xede9('0xa')],'context':_0x4bc4b9[_0xede9('0x18')],'priority':_0x24ac4f[_0xede9('0x11')]+_0x1bbfa4,'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});}_0x4bc4b9[_0xede9('0x11')]=_0x8e3a1a[_0xede9('0x2f')]?_['last'](_0x8e3a1a)[_0xede9('0x11')]+0x1:_0x24ac4f[_0xede9('0x11')];_0x24ac4f[_0xede9('0x11')]=(_0x3286f6[_0xede9('0x2f')]?_[_0xede9('0x45')](_0x3286f6)[_0xede9('0x11')]:_0x4bc4b9[_0xede9('0x11')])+0x1;_0x24ac4f[_0xede9('0x12')]=_[_0xede9('0x46')](_0x24ac4f[_0xede9('0x12')],_0x8e3a1a,[_0x4bc4b9],_0x3286f6);}_0x24ac4f['extensions'][_0xede9('0x1d')]({'type':_0x4fc681[_0xa231b1][0x0][_0xede9('0x17')],'app':'Hangup','exten':_0x4fc681[_0xa231b1][0x0][_0xede9('0xa')],'context':_0x4fc681[_0xa231b1][0x0][_0xede9('0x18')],'priority':_0x24ac4f[_0xede9('0x11')],'VoiceExtensionId':_0x4fc681[_0xa231b1][0x0][_0xede9('0x19')]});_0x5688a6[_0xede9('0x1d')](_0x4fc681[_0xa231b1][0x0]['VoiceExtensionId']);_0x198e4b=_['concat'](_0x198e4b,_0x24ac4f[_0xede9('0x12')]);}}return _0x1c819b[_0xede9('0x47')](function(_0x49a5af){return _0x1c819b[_0xede9('0x2')][_0xede9('0x48')][_0xede9('0x49')]({'where':{'VoiceExtensionId':{'$in':_0x5688a6}},'transaction':_0x49a5af})[_0xede9('0x5')](function(_0x59ba43){return _0x1c819b[_0xede9('0x2')][_0xede9('0x48')]['bulkCreate'](_[_0xede9('0x4a')](_0x198e4b,_0xede9('0x11')),{'transaction':_0x49a5af});});});})['catch'](function(_0xb86b07){console[_0xede9('0x4b')](_0xb86b07);});}exports[_0xede9('0x4c')]=rewrite;
\ No newline at end of file
+var _0xafe9=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','find','type','Set','context','priority','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq'];(function(_0x2ccddc,_0x40c85c){var _0x3d508c=function(_0x34cf02){while(--_0x34cf02){_0x2ccddc['push'](_0x2ccddc['shift']());}};_0x3d508c(++_0x40c85c);}(_0xafe9,0x112));var _0x9afe=function(_0xbbadb8,_0x6301aa){_0xbbadb8=_0xbbadb8-0x0;var _0x47f4a2=_0xafe9[_0xbbadb8];return _0x47f4a2;};'use strict';var _=require(_0x9afe('0x0'));var util=require(_0x9afe('0x1'));function rewrite(_0x5f5ba2,_0x72d327){var _0x482d5a=this;return _0x5f5ba2[_0x9afe('0x2')][_0x9afe('0x3')][_0x9afe('0x4')]({'raw':!![]})[_0x9afe('0x5')](function(_0x547cb1){_0x482d5a[_0x9afe('0x6')]=_0x547cb1;return _0x5f5ba2[_0x9afe('0x2')][_0x9afe('0x7')][_0x9afe('0x4')]({'where':{'IntervalId':_0x72d327[_0x9afe('0x8')]},'raw':!![]});})['then'](function(_0x35e99f){return _0x5f5ba2['models'][_0x9afe('0x7')][_0x9afe('0x4')]({'where':{'exten':{'$in':_[_0x9afe('0x9')](_['map'](_0x35e99f,_0x9afe('0xa')))}},'order':[{'raw':_0x9afe('0xb')}],'raw':!![]});})[_0x9afe('0x5')](function(_0x314dba){var _0x3dc928=_[_0x9afe('0xc')](_0x314dba,{'priority':'1'});var _0x2404ac=_[_0x9afe('0xc')](_0x314dba,{'isApp':0x1});var _0x3c9832=_[_0x9afe('0xd')](_0x2404ac,_0x9afe('0xa'));var _0x1ac8ac=['queue','playback'];var _0x4792a8=[];var _0x4ff3ac=[];for(var _0x33567f in _0x3c9832){if(_0x3c9832[_0x9afe('0xe')](_0x33567f)){_0x482d5a['priority']=0x2;_0x482d5a[_0x9afe('0xf')]=[];_0x482d5a[_0x9afe('0x10')]=_[_0x9afe('0x11')](_0x3dc928,{'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')]});_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':util['format']('CDR(type)=%s',_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')]),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x3c9832[_0x33567f][0x0]['type']===_0x9afe('0x17')){_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x19')+_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a['priority']++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}else if(_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')]===_0x9afe('0x1a')){if(_0x482d5a['extension']){_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x1b')+(_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]?_0x9afe('0x1d')+_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]+'}':'${EXTEN}'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});}_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x19')+_0x3c9832[_0x33567f][0x0]['VoiceExtensionId'],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});var _0x18d7c8=_0x482d5a[_0x9afe('0x15')]++;_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'ExecIf','appdata':_0x9afe('0x1e')+(_0x18d7c8+0x2)+_0x9afe('0x1f')+(_0x18d7c8+0x1)+')','context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x18d7c8,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x482d5a[_0x9afe('0x10')]){_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]?_0x9afe('0x20')+_0x482d5a[_0x9afe('0x10')][_0x9afe('0x1c')]+'}':_0x9afe('0x21'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}_0x482d5a['extensions']['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x22')+_0x3c9832[_0x33567f][0x0]['VoiceExtensionId'],'context':_0x3c9832[_0x33567f][0x0]['context'],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});if(_0x482d5a[_0x9afe('0x10')]&&_0x482d5a[_0x9afe('0x10')]['hasOwnProperty']('recordingFormat')&&_0x482d5a[_0x9afe('0x10')]['recordingFormat']!=='none'){_0x482d5a[_0x9afe('0xf')]['push']({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x23'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0]['exten'],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x24')+_0x482d5a[_0x9afe('0x10')]['recordingFormat']||_0x9afe('0x25'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});}}_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x26'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a['extensions'][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0]['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x27'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'Set','appdata':_0x9afe('0x28'),'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'priority':_0x482d5a[_0x9afe('0x15')]++,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0]['VoiceExtensionId']});for(var _0x279861=0x0,_0x121a5=0x0;_0x279861<_0x3c9832[_0x33567f][_0x9afe('0x29')];_0x279861+=0x1,_0x121a5=0x0){var _0x50f4b6=_0x3c9832[_0x33567f][_0x279861];if(_0x50f4b6['type']){_0x50f4b6['type']=_0x50f4b6[_0x9afe('0x12')][_0x9afe('0x2a')]();}var _0x39c640=[];var _0x100504=[];delete _0x50f4b6['id'];delete _0x50f4b6[_0x9afe('0x2b')];delete _0x50f4b6[_0x9afe('0x2c')];var _0x2f2918=_0x50f4b6[_0x9afe('0x2d')]!==_0x9afe('0x2e')?[_0x50f4b6[_0x9afe('0x2d')]]:_0x50f4b6[_0x9afe('0x8')]?_['map'](_[_0x9afe('0xc')](_0x482d5a[_0x9afe('0x6')],{'IntervalId':_0x50f4b6[_0x9afe('0x8')]}),_0x9afe('0x2d')):[];if(_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x2f'))){if(_0x50f4b6[_0x9afe('0x2f')]&&_0x50f4b6[_0x9afe('0x2f')]!=='--'){_0x39c640['push']({'type':_0x50f4b6['type'],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x30')+_0x50f4b6[_0x9afe('0x2f')],'context':_0x50f4b6['context'],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}if(_0x50f4b6[_0x9afe('0x12')]===_0x9afe('0x1a')&&_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x31'))){if(_0x50f4b6[_0x9afe('0x31')]){_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6[_0x9afe('0x12')],'app':'ExecIf','appdata':_0x9afe('0x32')+_0x50f4b6['callerID']+')','context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}else{_0x39c640['push']({'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x34'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a['priority']+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}if(_0x50f4b6[_0x9afe('0xe')](_0x9afe('0x35'))){if(_0x1ac8ac[_0x9afe('0x36')](_0x50f4b6[_0x9afe('0x37')][_0x9afe('0x2a')]())>=0x0&&_0x50f4b6[_0x9afe('0x38')]!==_0x9afe('0x39')){if(_0x50f4b6['answer']){_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x3a'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6[_0x9afe('0xa')],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}else{_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6['type'],'app':_0x9afe('0x33'),'appdata':_0x9afe('0x3b'),'context':_0x50f4b6['context'],'exten':_0x50f4b6['exten'],'priority':_0x2f2918[_0x9afe('0x29')]+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6[_0x9afe('0x16')]});_0x39c640[_0x9afe('0x18')]({'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x13'),'appdata':_0x9afe('0x3c'),'context':_0x50f4b6[_0x9afe('0x14')],'exten':_0x50f4b6['exten'],'priority':_0x2f2918['length']+_0x482d5a[_0x9afe('0x15')]+_0x121a5++,'VoiceExtensionId':_0x50f4b6['VoiceExtensionId']});}}}for(var _0x540b41=0x0;_0x540b41<_0x2f2918[_0x9afe('0x29')];_0x540b41+=0x1){var _0x1a81d8=_0x482d5a[_0x9afe('0x15')]+_0x2f2918['length'];var _0x6168c=_0x540b41===_0x2f2918[_0x9afe('0x29')]-0x1?_0x482d5a[_0x9afe('0x15')]+_0x39c640[_0x9afe('0x29')]+_0x100504['length']+0x2:_0x482d5a[_0x9afe('0x15')]+_0x540b41+0x1;_0x39c640[_0x9afe('0x3d')](_0x540b41,0x0,{'type':_0x50f4b6[_0x9afe('0x12')],'app':_0x9afe('0x3e'),'appdata':_0x2f2918[_0x540b41]+'?'+_0x50f4b6['context']+_0x9afe('0x3f')+_0x1a81d8+':'+_0x50f4b6[_0x9afe('0x14')]+_0x9afe('0x3f')+_0x6168c,'exten':_0x50f4b6[_0x9afe('0xa')],'context':_0x50f4b6[_0x9afe('0x14')],'priority':_0x482d5a[_0x9afe('0x15')]+_0x540b41,'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});}_0x50f4b6['priority']=_0x39c640[_0x9afe('0x29')]?_[_0x9afe('0x40')](_0x39c640)['priority']+0x1:_0x482d5a[_0x9afe('0x15')];_0x482d5a[_0x9afe('0x15')]=(_0x100504[_0x9afe('0x29')]?_['last'](_0x100504)['priority']:_0x50f4b6[_0x9afe('0x15')])+0x1;_0x482d5a['extensions']=_['concat'](_0x482d5a[_0x9afe('0xf')],_0x39c640,[_0x50f4b6],_0x100504);}_0x482d5a[_0x9afe('0xf')][_0x9afe('0x18')]({'type':_0x3c9832[_0x33567f][0x0][_0x9afe('0x12')],'app':'Hangup','exten':_0x3c9832[_0x33567f][0x0][_0x9afe('0xa')],'context':_0x3c9832[_0x33567f][0x0][_0x9afe('0x14')],'priority':_0x482d5a[_0x9afe('0x15')],'VoiceExtensionId':_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]});_0x4792a8[_0x9afe('0x18')](_0x3c9832[_0x33567f][0x0][_0x9afe('0x16')]);_0x4ff3ac=_[_0x9afe('0x41')](_0x4ff3ac,_0x482d5a['extensions']);}}return _0x5f5ba2['transaction'](function(_0x4e0c04){return _0x5f5ba2[_0x9afe('0x2')]['VoiceExtension'][_0x9afe('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x4792a8}},'transaction':_0x4e0c04})[_0x9afe('0x5')](function(_0x54eeed){return _0x5f5ba2['models'][_0x9afe('0x7')][_0x9afe('0x43')](_[_0x9afe('0x44')](_0x4ff3ac,'priority'),{'transaction':_0x4e0c04});});});})[_0x9afe('0x45')](function(_0x29c33f){console['error'](_0x29c33f);});}exports[_0x9afe('0x46')]=rewrite;
\ No newline at end of file