Built motion from commit (unavailable).|2.5.23
[motion2.git] / server / components / extensions / rewrite.js
index 8ead99f..6915411 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9205=['exten','push','format','CDR(type)=%s','context','priority','VoiceExtensionId','type','outbound','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','*,*,*,*','interval','IntervalId','intervals','tag','length','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-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','findAll','then','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find'];(function(_0x4e5de5,_0x31db56){var _0x44c17f=function(_0x1d7b6e){while(--_0x1d7b6e){_0x4e5de5['push'](_0x4e5de5['shift']());}};_0x44c17f(++_0x31db56);}(_0x9205,0x14d));var _0x5920=function(_0x25c71c,_0x309309){_0x25c71c=_0x25c71c-0x0;var _0x3137bb=_0x9205[_0x25c71c];return _0x3137bb;};'use strict';var _=require(_0x5920('0x0'));var util=require(_0x5920('0x1'));function rewrite(_0x597773,_0x127d8f){var _0x3e27d0=this;return _0x597773[_0x5920('0x2')]['Interval']['findAll']({'raw':!![]})['then'](function(_0x48cd67){_0x3e27d0['intervals']=_0x48cd67;return _0x597773['models']['VoiceExtension'][_0x5920('0x3')]({'where':{'IntervalId':_0x127d8f['IntervalId']},'raw':!![]});})[_0x5920('0x4')](function(_0x24b8ab){return _0x597773[_0x5920('0x2')][_0x5920('0x5')][_0x5920('0x3')]({'where':{'exten':{'$in':_[_0x5920('0x6')](_[_0x5920('0x7')](_0x24b8ab,'exten'))}},'order':[{'raw':_0x5920('0x8')}],'raw':!![]});})[_0x5920('0x4')](function(_0x55a495){var _0x398252=_[_0x5920('0x9')](_0x55a495,{'priority':'1'});var _0x20b7dd=_['filter'](_0x55a495,{'isApp':0x1});var _0x4225b2=_[_0x5920('0xa')](_0x20b7dd,'exten');var _0x288132=[_0x5920('0xb'),_0x5920('0xc')];var _0x1e4648=[];var _0x417173=[];for(var _0x31d56a in _0x4225b2){if(_0x4225b2[_0x5920('0xd')](_0x31d56a)){_0x3e27d0['priority']=0x2;_0x3e27d0[_0x5920('0xe')]=[];_0x3e27d0[_0x5920('0xf')]=_[_0x5920('0x10')](_0x398252,{'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')]});_0x3e27d0[_0x5920('0xe')][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0]['type'],'app':'Set','appdata':util[_0x5920('0x13')](_0x5920('0x14'),_0x4225b2[_0x31d56a][0x0]['type']),'context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')],'priority':_0x3e27d0[_0x5920('0x16')]++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});if(_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')]===_0x5920('0x19')){if(_0x3e27d0[_0x5920('0xf')]){_0x3e27d0[_0x5920('0xe')]['push']({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':_0x5920('0x1a'),'appdata':_0x5920('0x1b')+(_0x3e27d0[_0x5920('0xf')][_0x5920('0x1c')]?_0x5920('0x1d')+_0x3e27d0[_0x5920('0xf')]['cutdigits']+'}':_0x5920('0x1e')),'context':_0x4225b2[_0x31d56a][0x0]['context'],'exten':_0x4225b2[_0x31d56a][0x0]['exten'],'priority':_0x3e27d0[_0x5920('0x16')]++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});}_0x3e27d0['extensions'][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':_0x5920('0x1a'),'appdata':_0x5920('0x1f')+_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')],'context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')],'priority':_0x3e27d0['priority']++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});var _0x190825=_0x3e27d0[_0x5920('0x16')]++;_0x3e27d0['extensions'][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':_0x5920('0x20'),'appdata':_0x5920('0x21')+(_0x190825+0x2)+'):Goto('+(_0x190825+0x1)+')','context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0]['exten'],'priority':_0x190825,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});if(_0x3e27d0[_0x5920('0xf')]){_0x3e27d0[_0x5920('0xe')]['push']({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':_0x5920('0x1a'),'appdata':_0x3e27d0['extension'][_0x5920('0x1c')]?_0x5920('0x22')+_0x3e27d0[_0x5920('0xf')][_0x5920('0x1c')]+'}':_0x5920('0x23'),'context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0]['exten'],'priority':_0x3e27d0['priority']++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0]['VoiceExtensionId']});}_0x3e27d0[_0x5920('0xe')][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':'Set','appdata':_0x5920('0x24')+_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')],'context':_0x4225b2[_0x31d56a][0x0]['context'],'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')],'priority':_0x3e27d0['priority']++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});if(_0x3e27d0[_0x5920('0xf')]&&_0x3e27d0[_0x5920('0xf')][_0x5920('0xd')]('recordingFormat')&&_0x3e27d0[_0x5920('0xf')][_0x5920('0x25')]!=='none'){_0x3e27d0['extensions'][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0]['exten'],'priority':_0x3e27d0['priority']++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0]['VoiceExtensionId']});_0x3e27d0[_0x5920('0xe')]['push']({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':_0x5920('0x1a'),'appdata':_0x5920('0x26')+_0x3e27d0[_0x5920('0xf')][_0x5920('0x25')]||'wav','context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')],'priority':_0x3e27d0[_0x5920('0x16')]++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});}}_0x3e27d0['extensions'][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':_0x5920('0x1a'),'appdata':_0x5920('0x27'),'context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')],'priority':_0x3e27d0[_0x5920('0x16')]++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});_0x3e27d0[_0x5920('0xe')][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0]['type'],'app':_0x5920('0x1a'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')],'priority':_0x3e27d0['priority']++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0]['VoiceExtensionId']});_0x3e27d0[_0x5920('0xe')][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0]['type'],'app':_0x5920('0x1a'),'appdata':_0x5920('0x28'),'context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'exten':_0x4225b2[_0x31d56a][0x0]['exten'],'priority':_0x3e27d0[_0x5920('0x16')]++,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0]['VoiceExtensionId']});for(var _0x355c4f=0x0,_0x1c639c=0x0;_0x355c4f<_0x4225b2[_0x31d56a]['length'];_0x355c4f+=0x1,_0x1c639c=0x0){var _0x2dd4ed=_0x4225b2[_0x31d56a][_0x355c4f];if(_0x2dd4ed[_0x5920('0x18')]){_0x2dd4ed['type']=_0x2dd4ed[_0x5920('0x18')][_0x5920('0x29')]();}var _0x104022=[];var _0x51287a=[];delete _0x2dd4ed['id'];delete _0x2dd4ed['createdAt'];delete _0x2dd4ed[_0x5920('0x2a')];var _0x495dee=_0x2dd4ed['interval']!==_0x5920('0x2b')?[_0x2dd4ed[_0x5920('0x2c')]]:_0x2dd4ed[_0x5920('0x2d')]?_['map'](_[_0x5920('0x9')](_0x3e27d0[_0x5920('0x2e')],{'IntervalId':_0x2dd4ed[_0x5920('0x2d')]}),_0x5920('0x2c')):[];if(_0x2dd4ed[_0x5920('0xd')](_0x5920('0x2f'))){if(_0x2dd4ed['tag']&&_0x2dd4ed[_0x5920('0x2f')]!=='--'){_0x104022[_0x5920('0x12')]({'type':_0x2dd4ed[_0x5920('0x18')],'app':_0x5920('0x1a'),'appdata':'CDR(tag)='+_0x2dd4ed[_0x5920('0x2f')],'context':_0x2dd4ed[_0x5920('0x15')],'exten':_0x2dd4ed[_0x5920('0x11')],'priority':_0x495dee[_0x5920('0x30')]+_0x3e27d0[_0x5920('0x16')]+_0x1c639c++,'VoiceExtensionId':_0x2dd4ed[_0x5920('0x17')]});}}if(_0x2dd4ed[_0x5920('0x18')]===_0x5920('0x19')&&_0x2dd4ed[_0x5920('0xd')]('callerID')){if(_0x2dd4ed[_0x5920('0x31')]){_0x104022[_0x5920('0x12')]({'type':_0x2dd4ed[_0x5920('0x18')],'app':'ExecIf','appdata':_0x5920('0x32')+_0x2dd4ed['callerID']+')','context':_0x2dd4ed['context'],'exten':_0x2dd4ed[_0x5920('0x11')],'priority':_0x495dee['length']+_0x3e27d0['priority']+_0x1c639c++,'VoiceExtensionId':_0x2dd4ed['VoiceExtensionId']});}else{_0x104022[_0x5920('0x12')]({'type':_0x2dd4ed['type'],'app':_0x5920('0x20'),'appdata':_0x5920('0x33'),'context':_0x2dd4ed[_0x5920('0x15')],'exten':_0x2dd4ed[_0x5920('0x11')],'priority':_0x495dee['length']+_0x3e27d0[_0x5920('0x16')]+_0x1c639c++,'VoiceExtensionId':_0x2dd4ed[_0x5920('0x17')]});}}if(_0x2dd4ed['hasOwnProperty'](_0x5920('0x34'))){if(_0x288132[_0x5920('0x35')](_0x2dd4ed[_0x5920('0x36')][_0x5920('0x29')]())>=0x0&&_0x2dd4ed[_0x5920('0x37')]!==_0x5920('0x38')){if(_0x2dd4ed['answer']){_0x104022[_0x5920('0x12')]({'type':_0x2dd4ed[_0x5920('0x18')],'app':_0x5920('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2dd4ed[_0x5920('0x15')],'exten':_0x2dd4ed['exten'],'priority':_0x495dee['length']+_0x3e27d0[_0x5920('0x16')]+_0x1c639c++,'VoiceExtensionId':_0x2dd4ed[_0x5920('0x17')]});_0x104022['push']({'type':_0x2dd4ed[_0x5920('0x18')],'app':_0x5920('0x1a'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2dd4ed['context'],'exten':_0x2dd4ed[_0x5920('0x11')],'priority':_0x495dee[_0x5920('0x30')]+_0x3e27d0[_0x5920('0x16')]+_0x1c639c++,'VoiceExtensionId':_0x2dd4ed['VoiceExtensionId']});}else{_0x104022['push']({'type':_0x2dd4ed[_0x5920('0x18')],'app':_0x5920('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2dd4ed[_0x5920('0x15')],'exten':_0x2dd4ed[_0x5920('0x11')],'priority':_0x495dee['length']+_0x3e27d0[_0x5920('0x16')]+_0x1c639c++,'VoiceExtensionId':_0x2dd4ed[_0x5920('0x17')]});_0x104022[_0x5920('0x12')]({'type':_0x2dd4ed[_0x5920('0x18')],'app':'Set','appdata':_0x5920('0x39'),'context':_0x2dd4ed[_0x5920('0x15')],'exten':_0x2dd4ed[_0x5920('0x11')],'priority':_0x495dee[_0x5920('0x30')]+_0x3e27d0[_0x5920('0x16')]+_0x1c639c++,'VoiceExtensionId':_0x2dd4ed['VoiceExtensionId']});}}}for(var _0xe184f9=0x0;_0xe184f9<_0x495dee[_0x5920('0x30')];_0xe184f9+=0x1){var _0x17d5a3=_0x3e27d0[_0x5920('0x16')]+_0x495dee[_0x5920('0x30')];var _0x2eb983=_0xe184f9===_0x495dee[_0x5920('0x30')]-0x1?_0x3e27d0[_0x5920('0x16')]+_0x104022['length']+_0x51287a[_0x5920('0x30')]+0x2:_0x3e27d0[_0x5920('0x16')]+_0xe184f9+0x1;_0x104022[_0x5920('0x3a')](_0xe184f9,0x0,{'type':_0x2dd4ed[_0x5920('0x18')],'app':_0x5920('0x3b'),'appdata':_0x495dee[_0xe184f9]+'?'+_0x2dd4ed[_0x5920('0x15')]+_0x5920('0x3c')+_0x17d5a3+':'+_0x2dd4ed[_0x5920('0x15')]+_0x5920('0x3c')+_0x2eb983,'exten':_0x2dd4ed['exten'],'context':_0x2dd4ed[_0x5920('0x15')],'priority':_0x3e27d0[_0x5920('0x16')]+_0xe184f9,'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});}_0x2dd4ed['priority']=_0x104022['length']?_[_0x5920('0x3d')](_0x104022)['priority']+0x1:_0x3e27d0['priority'];_0x3e27d0[_0x5920('0x16')]=(_0x51287a[_0x5920('0x30')]?_[_0x5920('0x3d')](_0x51287a)[_0x5920('0x16')]:_0x2dd4ed[_0x5920('0x16')])+0x1;_0x3e27d0[_0x5920('0xe')]=_[_0x5920('0x3e')](_0x3e27d0[_0x5920('0xe')],_0x104022,[_0x2dd4ed],_0x51287a);}_0x3e27d0[_0x5920('0xe')][_0x5920('0x12')]({'type':_0x4225b2[_0x31d56a][0x0][_0x5920('0x18')],'app':_0x5920('0x3f'),'exten':_0x4225b2[_0x31d56a][0x0][_0x5920('0x11')],'context':_0x4225b2[_0x31d56a][0x0][_0x5920('0x15')],'priority':_0x3e27d0['priority'],'VoiceExtensionId':_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]});_0x1e4648['push'](_0x4225b2[_0x31d56a][0x0][_0x5920('0x17')]);_0x417173=_['concat'](_0x417173,_0x3e27d0['extensions']);}}return _0x597773[_0x5920('0x40')](function(_0x338914){return _0x597773[_0x5920('0x2')]['VoiceExtension'][_0x5920('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x1e4648}},'transaction':_0x338914})['then'](function(_0x52c73c){return _0x597773[_0x5920('0x2')][_0x5920('0x5')][_0x5920('0x42')](_[_0x5920('0x43')](_0x417173,'priority'),{'transaction':_0x338914});});});})[_0x5920('0x44')](function(_0x1c4606){console[_0x5920('0x45')](_0x1c4606);});}exports['rewrite']=rewrite;
\ No newline at end of file
+var _0xb2e7=['playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','push','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue'];(function(_0x5135e1,_0x28957a){var _0x541326=function(_0x21800a){while(--_0x21800a){_0x5135e1['push'](_0x5135e1['shift']());}};_0x541326(++_0x28957a);}(_0xb2e7,0x111));var _0x7b2e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2e7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7b2e('0x0'));var util=require(_0x7b2e('0x1'));function rewrite(_0x21f326,_0x7c6c58){var _0x2cd5ed=this;return _0x21f326[_0x7b2e('0x2')]['Interval'][_0x7b2e('0x3')]({'raw':!![]})[_0x7b2e('0x4')](function(_0x256569){_0x2cd5ed[_0x7b2e('0x5')]=_0x256569;return _0x21f326['models'][_0x7b2e('0x6')][_0x7b2e('0x3')]({'where':{'IntervalId':_0x7c6c58[_0x7b2e('0x7')]},'raw':!![]});})['then'](function(_0x3e4785){return _0x21f326['models']['VoiceExtension'][_0x7b2e('0x3')]({'where':{'exten':{'$in':_[_0x7b2e('0x8')](_[_0x7b2e('0x9')](_0x3e4785,_0x7b2e('0xa')))}},'order':[{'raw':_0x7b2e('0xb')}],'raw':!![]});})[_0x7b2e('0x4')](function(_0x1c760d){var _0x34d8d3=_[_0x7b2e('0xc')](_0x1c760d,{'priority':'1'});var _0x4cd0fd=_[_0x7b2e('0xc')](_0x1c760d,{'isApp':0x1});var _0x3d475e=_[_0x7b2e('0xd')](_0x4cd0fd,_0x7b2e('0xa'));var _0x1b770a=[_0x7b2e('0xe'),_0x7b2e('0xf')];var _0x53dd0b=[];var _0x3a5554=[];for(var _0x214e57 in _0x3d475e){if(_0x3d475e[_0x7b2e('0x10')](_0x214e57)){_0x2cd5ed[_0x7b2e('0x11')]=0x2;_0x2cd5ed[_0x7b2e('0x12')]=[];_0x2cd5ed[_0x7b2e('0x13')]=_[_0x7b2e('0x14')](_0x34d8d3,{'exten':_0x3d475e[_0x214e57][0x0]['exten']});_0x2cd5ed['extensions']['push']({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':util[_0x7b2e('0x17')]('CDR(type)=%s',_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')]),'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});if(_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')]===_0x7b2e('0x1a')){if(_0x2cd5ed[_0x7b2e('0x13')]){_0x2cd5ed[_0x7b2e('0x12')]['push']({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':_0x7b2e('0x1b')+(_0x2cd5ed['extension'][_0x7b2e('0x1c')]?_0x7b2e('0x1d')+_0x2cd5ed[_0x7b2e('0x13')][_0x7b2e('0x1c')]+'}':'${EXTEN}'),'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});}_0x2cd5ed[_0x7b2e('0x12')][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':'CDR(routeid)='+_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')],'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});var _0x54017e=_0x2cd5ed['priority']++;_0x2cd5ed[_0x7b2e('0x12')][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':'ExecIf','appdata':_0x7b2e('0x1f')+(_0x54017e+0x2)+_0x7b2e('0x20')+(_0x54017e+0x1)+')','context':_0x3d475e[_0x214e57][0x0]['context'],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x54017e,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0]['VoiceExtensionId']});if(_0x2cd5ed['extension']){_0x2cd5ed['extensions']['push']({'type':_0x3d475e[_0x214e57][0x0]['type'],'app':'Set','appdata':_0x2cd5ed[_0x7b2e('0x13')]['cutdigits']?_0x7b2e('0x21')+_0x2cd5ed[_0x7b2e('0x13')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3d475e[_0x214e57][0x0]['context'],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});}_0x2cd5ed['extensions'][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0]['type'],'app':_0x7b2e('0x16'),'appdata':_0x7b2e('0x22')+_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')],'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0]['exten'],'priority':_0x2cd5ed['priority']++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});if(_0x2cd5ed[_0x7b2e('0x13')]&&_0x2cd5ed[_0x7b2e('0x13')][_0x7b2e('0x10')](_0x7b2e('0x23'))&&_0x2cd5ed[_0x7b2e('0x13')][_0x7b2e('0x23')]!=='none'){_0x2cd5ed[_0x7b2e('0x12')][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0]['type'],'app':_0x7b2e('0x16'),'appdata':_0x7b2e('0x24'),'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});_0x2cd5ed['extensions']['push']({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':_0x7b2e('0x25')+_0x2cd5ed[_0x7b2e('0x13')][_0x7b2e('0x23')]||_0x7b2e('0x26'),'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0]['VoiceExtensionId']});}}_0x2cd5ed[_0x7b2e('0x12')][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':_0x7b2e('0x27'),'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});_0x2cd5ed[_0x7b2e('0x12')][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3d475e[_0x214e57][0x0]['context'],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed[_0x7b2e('0x11')]++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});_0x2cd5ed['extensions'][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':_0x7b2e('0x28'),'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'priority':_0x2cd5ed['priority']++,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});for(var _0x328940=0x0,_0x3ead1d=0x0;_0x328940<_0x3d475e[_0x214e57][_0x7b2e('0x29')];_0x328940+=0x1,_0x3ead1d=0x0){var _0x537e53=_0x3d475e[_0x214e57][_0x328940];if(_0x537e53[_0x7b2e('0x15')]){_0x537e53['type']=_0x537e53[_0x7b2e('0x15')][_0x7b2e('0x2a')]();}var _0x59f564=[];var _0x180227=[];delete _0x537e53['id'];delete _0x537e53[_0x7b2e('0x2b')];delete _0x537e53[_0x7b2e('0x2c')];var _0x497067=_0x537e53[_0x7b2e('0x2d')]!==_0x7b2e('0x2e')?[_0x537e53[_0x7b2e('0x2d')]]:_0x537e53[_0x7b2e('0x7')]?_[_0x7b2e('0x9')](_[_0x7b2e('0xc')](_0x2cd5ed['intervals'],{'IntervalId':_0x537e53[_0x7b2e('0x7')]}),'interval'):[];if(_0x537e53['hasOwnProperty'](_0x7b2e('0x2f'))){if(_0x537e53['tag']&&_0x537e53['tag']!=='--'){_0x59f564[_0x7b2e('0x1e')]({'type':_0x537e53[_0x7b2e('0x15')],'app':'Set','appdata':_0x7b2e('0x30')+_0x537e53[_0x7b2e('0x2f')],'context':_0x537e53['context'],'exten':_0x537e53[_0x7b2e('0xa')],'priority':_0x497067[_0x7b2e('0x29')]+_0x2cd5ed[_0x7b2e('0x11')]+_0x3ead1d++,'VoiceExtensionId':_0x537e53[_0x7b2e('0x19')]});}}if(_0x537e53[_0x7b2e('0x15')]===_0x7b2e('0x1a')&&_0x537e53[_0x7b2e('0x10')](_0x7b2e('0x31'))){if(_0x537e53[_0x7b2e('0x31')]){_0x59f564[_0x7b2e('0x1e')]({'type':_0x537e53[_0x7b2e('0x15')],'app':_0x7b2e('0x32'),'appdata':_0x7b2e('0x33')+_0x537e53[_0x7b2e('0x31')]+')','context':_0x537e53[_0x7b2e('0x18')],'exten':_0x537e53['exten'],'priority':_0x497067['length']+_0x2cd5ed[_0x7b2e('0x11')]+_0x3ead1d++,'VoiceExtensionId':_0x537e53['VoiceExtensionId']});}else{_0x59f564[_0x7b2e('0x1e')]({'type':_0x537e53[_0x7b2e('0x15')],'app':_0x7b2e('0x32'),'appdata':_0x7b2e('0x34'),'context':_0x537e53[_0x7b2e('0x18')],'exten':_0x537e53[_0x7b2e('0xa')],'priority':_0x497067['length']+_0x2cd5ed[_0x7b2e('0x11')]+_0x3ead1d++,'VoiceExtensionId':_0x537e53[_0x7b2e('0x19')]});}}if(_0x537e53[_0x7b2e('0x10')](_0x7b2e('0x35'))){if(_0x1b770a[_0x7b2e('0x36')](_0x537e53['app'][_0x7b2e('0x2a')]())>=0x0&&_0x537e53[_0x7b2e('0x37')]!==_0x7b2e('0x38')){if(_0x537e53['answer']){_0x59f564[_0x7b2e('0x1e')]({'type':_0x537e53[_0x7b2e('0x15')],'app':_0x7b2e('0x32'),'appdata':_0x7b2e('0x39'),'context':_0x537e53[_0x7b2e('0x18')],'exten':_0x537e53[_0x7b2e('0xa')],'priority':_0x497067['length']+_0x2cd5ed[_0x7b2e('0x11')]+_0x3ead1d++,'VoiceExtensionId':_0x537e53['VoiceExtensionId']});_0x59f564[_0x7b2e('0x1e')]({'type':_0x537e53[_0x7b2e('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x537e53[_0x7b2e('0x18')],'exten':_0x537e53[_0x7b2e('0xa')],'priority':_0x497067[_0x7b2e('0x29')]+_0x2cd5ed[_0x7b2e('0x11')]+_0x3ead1d++,'VoiceExtensionId':_0x537e53['VoiceExtensionId']});}else{_0x59f564[_0x7b2e('0x1e')]({'type':_0x537e53['type'],'app':_0x7b2e('0x32'),'appdata':_0x7b2e('0x3a'),'context':_0x537e53[_0x7b2e('0x18')],'exten':_0x537e53[_0x7b2e('0xa')],'priority':_0x497067[_0x7b2e('0x29')]+_0x2cd5ed[_0x7b2e('0x11')]+_0x3ead1d++,'VoiceExtensionId':_0x537e53['VoiceExtensionId']});_0x59f564[_0x7b2e('0x1e')]({'type':_0x537e53[_0x7b2e('0x15')],'app':_0x7b2e('0x16'),'appdata':_0x7b2e('0x3b'),'context':_0x537e53['context'],'exten':_0x537e53[_0x7b2e('0xa')],'priority':_0x497067[_0x7b2e('0x29')]+_0x2cd5ed['priority']+_0x3ead1d++,'VoiceExtensionId':_0x537e53[_0x7b2e('0x19')]});}}}for(var _0x335bf0=0x0;_0x335bf0<_0x497067['length'];_0x335bf0+=0x1){var _0x2aa81b=_0x2cd5ed[_0x7b2e('0x11')]+_0x497067[_0x7b2e('0x29')];var _0x133c81=_0x335bf0===_0x497067[_0x7b2e('0x29')]-0x1?_0x2cd5ed[_0x7b2e('0x11')]+_0x59f564[_0x7b2e('0x29')]+_0x180227[_0x7b2e('0x29')]+0x2:_0x2cd5ed['priority']+_0x335bf0+0x1;_0x59f564[_0x7b2e('0x3c')](_0x335bf0,0x0,{'type':_0x537e53['type'],'app':_0x7b2e('0x3d'),'appdata':_0x497067[_0x335bf0]+'?'+_0x537e53[_0x7b2e('0x18')]+_0x7b2e('0x3e')+_0x2aa81b+':'+_0x537e53[_0x7b2e('0x18')]+',${EXTEN},'+_0x133c81,'exten':_0x537e53[_0x7b2e('0xa')],'context':_0x537e53[_0x7b2e('0x18')],'priority':_0x2cd5ed[_0x7b2e('0x11')]+_0x335bf0,'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});}_0x537e53[_0x7b2e('0x11')]=_0x59f564['length']?_[_0x7b2e('0x3f')](_0x59f564)[_0x7b2e('0x11')]+0x1:_0x2cd5ed[_0x7b2e('0x11')];_0x2cd5ed[_0x7b2e('0x11')]=(_0x180227[_0x7b2e('0x29')]?_[_0x7b2e('0x3f')](_0x180227)[_0x7b2e('0x11')]:_0x537e53[_0x7b2e('0x11')])+0x1;_0x2cd5ed[_0x7b2e('0x12')]=_[_0x7b2e('0x40')](_0x2cd5ed['extensions'],_0x59f564,[_0x537e53],_0x180227);}_0x2cd5ed[_0x7b2e('0x12')][_0x7b2e('0x1e')]({'type':_0x3d475e[_0x214e57][0x0]['type'],'app':_0x7b2e('0x41'),'exten':_0x3d475e[_0x214e57][0x0][_0x7b2e('0xa')],'context':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x18')],'priority':_0x2cd5ed[_0x7b2e('0x11')],'VoiceExtensionId':_0x3d475e[_0x214e57][0x0][_0x7b2e('0x19')]});_0x53dd0b[_0x7b2e('0x1e')](_0x3d475e[_0x214e57][0x0]['VoiceExtensionId']);_0x3a5554=_[_0x7b2e('0x40')](_0x3a5554,_0x2cd5ed[_0x7b2e('0x12')]);}}return _0x21f326[_0x7b2e('0x42')](function(_0x4ff807){return _0x21f326['models']['VoiceExtension'][_0x7b2e('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x53dd0b}},'transaction':_0x4ff807})[_0x7b2e('0x4')](function(_0x498b4e){return _0x21f326['models']['VoiceExtension'][_0x7b2e('0x44')](_['sortBy'](_0x3a5554,_0x7b2e('0x11')),{'transaction':_0x4ff807});});});})[_0x7b2e('0x45')](function(_0x1ec024){console[_0x7b2e('0x46')](_0x1ec024);});}exports[_0x7b2e('0x47')]=rewrite;
\ No newline at end of file