Built motion from commit a61a4a20.|2.5.46
[motion2.git] / server / api / voiceExtension / voiceExtension.model.js
index e567ba1..7db25bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe8a4=['param','phone','prefix','${EXTEN:','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','intervals','map','hasOwnProperty','tag','toLowerCase','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','priority','concat','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','split','name'];(function(_0x145ccf,_0x5e670a){var _0x2967ab=function(_0x157795){while(--_0x157795){_0x145ccf['push'](_0x145ccf['shift']());}};_0x2967ab(++_0x5e670a);}(_0xe8a4,0x158));var _0x4e8a=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xe8a4[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x4e8a('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x4e8a('0x1')]=function(_0x5737b5){var _0x31cd4d=_0x5737b5[_0x4e8a('0x2')];function _0x44933f(_0x51ee1e){var _0x9d4261=0x2;var _0x2131a1=[{'type':_0x51ee1e['type'],'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x4')+_0x51ee1e[_0x4e8a('0x5')],'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']},{'type':_0x51ee1e[_0x4e8a('0x5')],'app':_0x51ee1e[_0x4e8a('0x8')]?_0x4e8a('0x3'):_0x4e8a('0x9'),'appdata':_0x51ee1e[_0x4e8a('0x8')]?'CDR(routeAlias)='+_0x51ee1e[_0x4e8a('0x8')]:_0x4e8a('0xa'),'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']}];if(_0x51ee1e['type']===_0x4e8a('0xb')){_0x2131a1[_0x4e8a('0xc')]({'type':'inbound','app':_0x4e8a('0x3'),'appdata':_0x4e8a('0xd')+_0x51ee1e['id'],'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']});}_0x2131a1['push']({'type':_0x51ee1e[_0x4e8a('0x5')],'app':'Set','appdata':_0x4e8a('0xe'),'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']},{'type':_0x51ee1e['type'],'app':_0x4e8a('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']},{'type':_0x51ee1e[_0x4e8a('0x5')],'app':'Set','appdata':_0x4e8a('0xf'),'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']});return _0x2131a1;}function _0x13eb23(_0x5460e8){var _0x2390e4=0x2;var _0x541bdb=[{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x11'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x5460e8[_0x4e8a('0x8')]?_0x4e8a('0x3'):_0x4e8a('0x9'),'appdata':_0x5460e8['alias']?'CDR(routeAlias)='+_0x5460e8['alias']:_0x4e8a('0xa'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':'CDR(destination)='+(_0x5460e8['cutdigits']?'${EXTEN:'+_0x5460e8['cutdigits']+'}':_0x4e8a('0x12')),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':_0x4e8a('0xd')+_0x5460e8['id'],'context':_0x5460e8['context'],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':'ExecIf','appdata':_0x4e8a('0x13')+(_0x2390e4+0x2)+'):Goto('+(_0x2390e4+0x1)+')','context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x5460e8['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x5460e8[_0x4e8a('0x14')]+'}':_0x4e8a('0x15'),'context':_0x5460e8['context'],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x16'),'context':_0x5460e8['context'],'exten':_0x5460e8['exten'],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':_0x4e8a('0xf'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8['exten'],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':'Set','appdata':_0x4e8a('0x17')+_0x5460e8['id'],'context':_0x5460e8['context'],'exten':_0x5460e8['exten'],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']}];if(_0x5460e8['hasOwnProperty']('recordingFormat')&&_0x5460e8[_0x4e8a('0x18')]!==_0x4e8a('0x19')){_0x541bdb[_0x4e8a('0xc')]({'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x1a'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5460e8[_0x4e8a('0x18')]||_0x4e8a('0x1b'),'context':_0x5460e8['context'],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']});}return _0x541bdb;}function _0x5168b2(_0x363c63,_0x21af7d){var _0x82a02c=[{'name':_0x4e8a('0x1c'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x17340f={};var _0x5e79ea=_0x21af7d[_0x4e8a('0x1d')](',');var _0xc4e355=[];for(var _0x37ca6e=0x0;_0x37ca6e<_0x82a02c['length'];_0x37ca6e++){switch(_0x82a02c[_0x37ca6e][_0x4e8a('0x1e')]){case _0x4e8a('0x1c'):_0x17340f[_0x4e8a('0x1c')]=_0x5e79ea[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]][_0x4e8a('0x1d')]('/')[0x1];_0x17340f[_0x4e8a('0x20')]=_0x5e79ea[_0x82a02c[_0x37ca6e]['param']]['split']('/')[0x2];_0x17340f['prefix']=_0x17340f[_0x4e8a('0x20')]?_0x17340f[_0x4e8a('0x20')][_0x4e8a('0x1d')]('$')[0x0]:undefined;_0x17340f[_0x4e8a('0x20')]=_0x363c63[_0x4e8a('0x14')]?(_0x17340f[_0x4e8a('0x21')]||'')+_0x4e8a('0x22')+_0x363c63[_0x4e8a('0x14')]+'}':(_0x17340f['prefix']||'')+'${EXTEN}';_0xc4e355[_0x82a02c[_0x37ca6e]['param']]=['SIP',_0x17340f[_0x4e8a('0x1c')],_0x17340f['phone']][_0x4e8a('0x23')]('/');break;case _0x4e8a('0x24'):_0x17340f[_0x4e8a('0x24')]=_0x5e79ea[_0x82a02c[_0x37ca6e]['param']];if(_0x363c63[_0x4e8a('0x18')]!==_0x4e8a('0x19')){if(_0x17340f['options'][_0x4e8a('0x25')](_0x4e8a('0x26'))<0x0){_0x17340f['options']+='U(xcally-mixmonitor-context)';}}else{_0x17340f[_0x4e8a('0x24')]=_0x17340f[_0x4e8a('0x24')]['replace'](_0x4e8a('0x26'),'');}_0xc4e355[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]]=_0x17340f[_0x4e8a('0x24')];break;default:_0xc4e355[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]]=_0x5e79ea[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]];}}return _0xc4e355[_0x4e8a('0x23')](',');}function _0x584188(_0x2e389f,_0x503838,_0x18aa1a){return new Promise(function(_0x21e2b9,_0x5c00d3){var _0x896114=[];if(_[_0x4e8a('0x27')](_0x503838))return _0x21e2b9(_0x896114);_0x31cd4d[_0x4e8a('0x28')][_0x4e8a('0x29')]({'attributes':['id',_0x4e8a('0x2a'),_0x4e8a('0x2b')],'raw':!![]})[_0x4e8a('0x2c')](function(_0x52b2be){for(var _0x1309bd=0x0,_0x47c1fa=0x0;_0x1309bd<_0x503838[_0x4e8a('0x2d')];_0x1309bd++,_0x47c1fa=0x0){var _0x599b80=_0x503838[_0x1309bd];var _0x32d99d=[];var _0x37f7df=[];delete _0x599b80['id'];if(_0x599b80[_0x4e8a('0x2a')]!=='*,*,*,*'){_0x599b80[_0x4e8a('0x2e')]=[_0x599b80['interval']];}else{_0x599b80['intervals']=_0x599b80[_0x4e8a('0x2b')]?_[_0x4e8a('0x2f')](_['filter'](_0x52b2be,{'IntervalId':_0x599b80['IntervalId']}),'interval'):[];}_0x599b80[_0x4e8a('0x6')]=_0x2e389f[_0x4e8a('0x6')];_0x599b80[_0x4e8a('0x7')]=_0x2e389f[_0x4e8a('0x7')];if(_0x599b80[_0x4e8a('0x5')])_0x599b80['type']=_0x599b80[_0x4e8a('0x5')]['toLowerCase']();if(_0x2e389f['type']===_0x4e8a('0x10')){if(_0x599b80[_0x4e8a('0x30')](_0x4e8a('0x31'))&&_0x599b80[_0x4e8a('0x31')]&&_0x599b80[_0x4e8a('0x31')]!=='--'){_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x33')+_0x599b80[_0x4e8a('0x31')],'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f['exten'],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}_0x32d99d['push']({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':_0x4e8a('0x34'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x599b80[_0x4e8a('0x35')]?_0x4e8a('0x36')+_0x599b80[_0x4e8a('0x35')]+')':_0x4e8a('0x37')),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f['exten'],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}else{if(_0x599b80[_0x4e8a('0x30')](_0x4e8a('0x38'))){if([_0x4e8a('0x39'),_0x4e8a('0x3a')]['includes'](_0x599b80[_0x4e8a('0x3b')][_0x4e8a('0x32')]())&&_0x599b80[_0x4e8a('0x3c')]!=='custom'){if(_0x599b80[_0x4e8a('0x38')]){_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':_0x4e8a('0x34'),'appdata':_0x4e8a('0x3d'),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f['exten'],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80['type']['toLowerCase'](),'app':'Set','appdata':_0x4e8a('0x3e'),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f[_0x4e8a('0x7')],'priority':_0x599b80['intervals']['length']+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}else{_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80['type']['toLowerCase'](),'app':_0x4e8a('0x34'),'appdata':_0x4e8a('0x3f'),'context':_0x2e389f['context'],'exten':_0x2e389f[_0x4e8a('0x7')],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':'Set','appdata':_0x4e8a('0x40'),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f[_0x4e8a('0x7')],'priority':_0x599b80['intervals']['length']+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}}}}for(var _0x3f04ce=0x0;_0x3f04ce<_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')];_0x3f04ce++){var _0xd3785a=_0x18aa1a+_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')];var _0x4b5831=_0x3f04ce===_0x599b80[_0x4e8a('0x2e')]['length']-0x1?_0x18aa1a+_0x32d99d[_0x4e8a('0x2d')]+_0x37f7df[_0x4e8a('0x2d')]+0x2:_0x18aa1a+_0x3f04ce+0x1;_0x32d99d[_0x4e8a('0x41')](_0x3f04ce,0x0,{'type':_0x2e389f['type'],'app':'GotoIfTime','appdata':_0x599b80[_0x4e8a('0x2e')][_0x3f04ce]+'?'+_0x2e389f[_0x4e8a('0x6')]+',${EXTEN},'+_0xd3785a+':'+_0x2e389f[_0x4e8a('0x6')]+_0x4e8a('0x42')+_0x4b5831,'exten':_0x2e389f[_0x4e8a('0x7')],'context':_0x2e389f['context'],'priority':_0x18aa1a+_0x3f04ce,'VoiceExtensionId':_0x2e389f['id']});}if(_0x599b80['appType']==='outboundDial')_0x599b80['appdata']=_0x5168b2(_0x2e389f,_0x599b80['appdata']);_0x599b80['priority']=_0x32d99d[_0x4e8a('0x2d')]?_[_0x4e8a('0x43')](_0x32d99d)[_0x4e8a('0x44')]+0x1:_0x18aa1a;_0x896114=_[_0x4e8a('0x45')](_0x896114,_0x32d99d,[_0x599b80],_0x37f7df);_0x18aa1a=_['last'](_0x896114)[_0x4e8a('0x44')]+0x1;}return _0x21e2b9(_0x896114);})[_0x4e8a('0x46')](function(_0x30ce5a){_0x5c00d3(_0x30ce5a);});});}return _0x5737b5[_0x4e8a('0x47')](_0x4e8a('0x48'),attributes,{'tableName':_0x4e8a('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1a807a){var _0x182c57=this['get']({'plain':!![]});var _0x20752d=_0x182c57[_0x4e8a('0x5')]===_0x4e8a('0x10')?_0x13eb23(_0x182c57):_0x44933f(_0x182c57);return _0x584188(_0x182c57,_0x1a807a,_[_0x4e8a('0x43')](_0x20752d)[_0x4e8a('0x44')]+0x1)[_0x4e8a('0x2c')](function(_0x3976de){var _0x5ad7f7=_[_0x4e8a('0x45')](_0x20752d,_0x3976de);_0x5ad7f7['push']({'type':_0x182c57['type'],'app':_0x4e8a('0x4a'),'exten':_0x182c57['exten'],'context':_0x182c57['context'],'priority':_[_0x4e8a('0x43')](_0x5ad7f7)[_0x4e8a('0x44')]+0x1,'VoiceExtensionId':_0x182c57['id']});return _0x5ad7f7;});}}});};
\ No newline at end of file
+var _0x7953=['Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','concat','last','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','CDR(routeid)=','context','push','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','IntervalId','then','intervals','interval','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x7953,0x66));var _0x3795=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x7953[_0x3b231a];return _0x18d67a;};'use strict';var _=require(_0x3795('0x0'));var attributes=require(_0x3795('0x1'));module[_0x3795('0x2')]=function(_0x3b754c){var _0x2c70d9=_0x3b754c[_0x3795('0x3')];function _0x38f527(_0x38f964){var _0x4e01df=0x2;var _0x5527ea=[{'type':_0x38f964[_0x3795('0x4')],'app':_0x3795('0x5'),'appdata':_0x3795('0x6')+_0x38f964[_0x3795('0x4')],'context':_0x38f964['context'],'exten':_0x38f964[_0x3795('0x7')],'priority':_0x4e01df++,'VoiceExtensionId':_0x38f964['id']},{'type':_0x38f964['type'],'app':_0x38f964[_0x3795('0x8')]?_0x3795('0x5'):_0x3795('0x9'),'appdata':_0x38f964[_0x3795('0x8')]?_0x3795('0xa')+_0x38f964[_0x3795('0x8')]:_0x3795('0xb'),'context':_0x38f964['context'],'exten':_0x38f964[_0x3795('0x7')],'priority':_0x4e01df++,'VoiceExtensionId':_0x38f964['id']}];if(_0x38f964[_0x3795('0x4')]==='inbound'){_0x5527ea['push']({'type':'inbound','app':'Set','appdata':_0x3795('0xc')+_0x38f964['id'],'context':_0x38f964[_0x3795('0xd')],'exten':_0x38f964[_0x3795('0x7')],'priority':_0x4e01df++,'VoiceExtensionId':_0x38f964['id']});}_0x5527ea[_0x3795('0xe')]({'type':_0x38f964[_0x3795('0x4')],'app':_0x3795('0x5'),'appdata':_0x3795('0xf'),'context':_0x38f964[_0x3795('0xd')],'exten':_0x38f964[_0x3795('0x7')],'priority':_0x4e01df++,'VoiceExtensionId':_0x38f964['id']},{'type':_0x38f964[_0x3795('0x4')],'app':_0x3795('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x38f964[_0x3795('0xd')],'exten':_0x38f964[_0x3795('0x7')],'priority':_0x4e01df++,'VoiceExtensionId':_0x38f964['id']},{'type':_0x38f964[_0x3795('0x4')],'app':_0x3795('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x38f964[_0x3795('0xd')],'exten':_0x38f964['exten'],'priority':_0x4e01df++,'VoiceExtensionId':_0x38f964['id']});return _0x5527ea;}function _0x30b03f(_0x1bf4d0){var _0x3cc5db=0x2;var _0x3eb505=[{'type':_0x3795('0x10'),'app':'Set','appdata':_0x3795('0x11'),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':_0x1bf4d0[_0x3795('0x8')]?_0x3795('0x5'):'NoOp','appdata':_0x1bf4d0[_0x3795('0x8')]?_0x3795('0xa')+_0x1bf4d0['alias']:_0x3795('0xb'),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':_0x3795('0x5'),'appdata':_0x3795('0x12')+(_0x1bf4d0[_0x3795('0x13')]?_0x3795('0x14')+_0x1bf4d0[_0x3795('0x13')]+'}':_0x3795('0x15')),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':'Set','appdata':_0x3795('0xc')+_0x1bf4d0['id'],'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0['exten'],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':_0x3795('0x16'),'appdata':_0x3795('0x17')+(_0x3cc5db+0x2)+_0x3795('0x18')+(_0x3cc5db+0x1)+')','context':_0x1bf4d0['context'],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':_0x3795('0x5'),'appdata':_0x1bf4d0['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x1bf4d0[_0x3795('0x13')]+'}':_0x3795('0x19'),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0['exten'],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':'Set','appdata':_0x3795('0xf'),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':_0x3795('0x5'),'appdata':_0x3795('0x1a'),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':'Set','appdata':_0x3795('0x1b'),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0['exten'],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':'outbound','app':'Set','appdata':_0x3795('0x1c')+_0x1bf4d0['id'],'context':_0x1bf4d0['context'],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']}];if(_0x1bf4d0[_0x3795('0x1d')](_0x3795('0x1e'))&&_0x1bf4d0[_0x3795('0x1e')]!==_0x3795('0x1f')){_0x3eb505[_0x3795('0xe')]({'type':_0x3795('0x10'),'app':_0x3795('0x5'),'appdata':_0x3795('0x20'),'context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0[_0x3795('0x7')],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']},{'type':_0x3795('0x10'),'app':_0x3795('0x5'),'appdata':_0x3795('0x21')+_0x1bf4d0[_0x3795('0x1e')]||'wav','context':_0x1bf4d0[_0x3795('0xd')],'exten':_0x1bf4d0['exten'],'priority':_0x3cc5db++,'VoiceExtensionId':_0x1bf4d0['id']});}return _0x3eb505;}function _0x32a991(_0x1338ec,_0x6759b1){var _0x342100=[{'name':_0x3795('0x22'),'param':0x0},{'name':_0x3795('0x23'),'param':0x1},{'name':_0x3795('0x24'),'param':0x2},{'name':_0x3795('0x25'),'param':0x3}];var _0x2aac2a={};var _0x1ca38a=_0x6759b1[_0x3795('0x26')](',');var _0x541d14=[];for(var _0x1ff29c=0x0;_0x1ff29c<_0x342100[_0x3795('0x27')];_0x1ff29c++){switch(_0x342100[_0x1ff29c][_0x3795('0x28')]){case _0x3795('0x22'):_0x2aac2a[_0x3795('0x22')]=_0x1ca38a[_0x342100[_0x1ff29c][_0x3795('0x29')]][_0x3795('0x26')]('/')[0x1];_0x2aac2a[_0x3795('0x2a')]=_0x1ca38a[_0x342100[_0x1ff29c][_0x3795('0x29')]][_0x3795('0x26')]('/')[0x2];_0x2aac2a[_0x3795('0x2b')]=_0x2aac2a[_0x3795('0x2a')]?_0x2aac2a[_0x3795('0x2a')][_0x3795('0x26')]('$')[0x0]:undefined;_0x2aac2a[_0x3795('0x2a')]=_0x1338ec[_0x3795('0x13')]?(_0x2aac2a[_0x3795('0x2b')]||'')+_0x3795('0x14')+_0x1338ec[_0x3795('0x13')]+'}':(_0x2aac2a[_0x3795('0x2b')]||'')+_0x3795('0x15');_0x541d14[_0x342100[_0x1ff29c][_0x3795('0x29')]]=['SIP',_0x2aac2a[_0x3795('0x22')],_0x2aac2a[_0x3795('0x2a')]]['join']('/');break;case _0x3795('0x24'):_0x2aac2a[_0x3795('0x24')]=_0x1ca38a[_0x342100[_0x1ff29c][_0x3795('0x29')]];if(_0x1338ec[_0x3795('0x1e')]!==_0x3795('0x1f')){if(_0x2aac2a[_0x3795('0x24')][_0x3795('0x2c')](_0x3795('0x2d'))<0x0){_0x2aac2a[_0x3795('0x24')]+=_0x3795('0x2d');}}else{_0x2aac2a[_0x3795('0x24')]=_0x2aac2a[_0x3795('0x24')][_0x3795('0x2e')]('U(xcally-mixmonitor-context)','');}_0x541d14[_0x342100[_0x1ff29c][_0x3795('0x29')]]=_0x2aac2a[_0x3795('0x24')];break;default:_0x541d14[_0x342100[_0x1ff29c][_0x3795('0x29')]]=_0x1ca38a[_0x342100[_0x1ff29c][_0x3795('0x29')]];}}return _0x541d14[_0x3795('0x2f')](',');}function _0x12799d(_0x4afc85,_0x13ec8b,_0x4c3150){return new Promise(function(_0x1cf914,_0x3f2b4f){var _0x10cf35=[];if(_[_0x3795('0x30')](_0x13ec8b))return _0x1cf914(_0x10cf35);_0x2c70d9[_0x3795('0x31')]['findAll']({'attributes':['id','interval',_0x3795('0x32')],'raw':!![]})[_0x3795('0x33')](function(_0x1ba6e7){for(var _0x788390=0x0,_0x218780=0x0;_0x788390<_0x13ec8b['length'];_0x788390++,_0x218780=0x0){var _0x12422a=_0x13ec8b[_0x788390];var _0x1ccf11=[];var _0x511671=[];delete _0x12422a['id'];if(_0x12422a['interval']!=='*,*,*,*'){_0x12422a[_0x3795('0x34')]=[_0x12422a[_0x3795('0x35')]];}else{_0x12422a[_0x3795('0x34')]=_0x12422a[_0x3795('0x32')]?_['map'](_[_0x3795('0x36')](_0x1ba6e7,{'IntervalId':_0x12422a[_0x3795('0x32')]}),'interval'):[];}_0x12422a[_0x3795('0xd')]=_0x4afc85['context'];_0x12422a[_0x3795('0x7')]=_0x4afc85[_0x3795('0x7')];if(_0x12422a['type'])_0x12422a['type']=_0x12422a[_0x3795('0x4')][_0x3795('0x37')]();if(_0x4afc85[_0x3795('0x4')]===_0x3795('0x10')){if(_0x12422a[_0x3795('0x1d')](_0x3795('0x38'))&&_0x12422a['tag']&&_0x12422a[_0x3795('0x38')]!=='--'){_0x1ccf11[_0x3795('0xe')]({'type':_0x12422a[_0x3795('0x4')][_0x3795('0x37')](),'app':_0x3795('0x5'),'appdata':_0x3795('0x39')+_0x12422a['tag'],'context':_0x4afc85[_0x3795('0xd')],'exten':_0x4afc85[_0x3795('0x7')],'priority':_0x12422a[_0x3795('0x34')][_0x3795('0x27')]+_0x4c3150+_0x218780++,'VoiceExtensionId':_0x4afc85['id']});}_0x1ccf11[_0x3795('0xe')]({'type':_0x12422a[_0x3795('0x4')]['toLowerCase'](),'app':_0x3795('0x16'),'appdata':_0x3795('0x3a')+(_0x12422a[_0x3795('0x3b')]?_0x3795('0x3c')+_0x12422a[_0x3795('0x3b')]+')':_0x3795('0x3d')),'context':_0x4afc85[_0x3795('0xd')],'exten':_0x4afc85[_0x3795('0x7')],'priority':_0x12422a[_0x3795('0x34')][_0x3795('0x27')]+_0x4c3150+_0x218780++,'VoiceExtensionId':_0x4afc85['id']});}else{if(_0x12422a[_0x3795('0x1d')](_0x3795('0x3e'))){if([_0x3795('0x3f'),'playback'][_0x3795('0x40')](_0x12422a[_0x3795('0x41')][_0x3795('0x37')]())&&_0x12422a[_0x3795('0x42')]!==_0x3795('0x43')){if(_0x12422a[_0x3795('0x3e')]){_0x1ccf11[_0x3795('0xe')]({'type':_0x12422a[_0x3795('0x4')][_0x3795('0x37')](),'app':_0x3795('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4afc85['context'],'exten':_0x4afc85[_0x3795('0x7')],'priority':_0x12422a[_0x3795('0x34')]['length']+_0x4c3150+_0x218780++,'VoiceExtensionId':_0x4afc85['id']});_0x1ccf11[_0x3795('0xe')]({'type':_0x12422a[_0x3795('0x4')][_0x3795('0x37')](),'app':_0x3795('0x5'),'appdata':_0x3795('0x44'),'context':_0x4afc85['context'],'exten':_0x4afc85[_0x3795('0x7')],'priority':_0x12422a['intervals'][_0x3795('0x27')]+_0x4c3150+_0x218780++,'VoiceExtensionId':_0x4afc85['id']});}else{_0x1ccf11[_0x3795('0xe')]({'type':_0x12422a['type']['toLowerCase'](),'app':_0x3795('0x16'),'appdata':_0x3795('0x45'),'context':_0x4afc85[_0x3795('0xd')],'exten':_0x4afc85[_0x3795('0x7')],'priority':_0x12422a[_0x3795('0x34')][_0x3795('0x27')]+_0x4c3150+_0x218780++,'VoiceExtensionId':_0x4afc85['id']});_0x1ccf11[_0x3795('0xe')]({'type':_0x12422a[_0x3795('0x4')][_0x3795('0x37')](),'app':'Set','appdata':_0x3795('0x46'),'context':_0x4afc85[_0x3795('0xd')],'exten':_0x4afc85[_0x3795('0x7')],'priority':_0x12422a[_0x3795('0x34')][_0x3795('0x27')]+_0x4c3150+_0x218780++,'VoiceExtensionId':_0x4afc85['id']});}}}}for(var _0x524ab7=0x0;_0x524ab7<_0x12422a[_0x3795('0x34')][_0x3795('0x27')];_0x524ab7++){var _0x37085e=_0x4c3150+_0x12422a[_0x3795('0x34')][_0x3795('0x27')];var _0x493bba=_0x524ab7===_0x12422a[_0x3795('0x34')][_0x3795('0x27')]-0x1?_0x4c3150+_0x1ccf11[_0x3795('0x27')]+_0x511671['length']+0x2:_0x4c3150+_0x524ab7+0x1;_0x1ccf11[_0x3795('0x47')](_0x524ab7,0x0,{'type':_0x4afc85[_0x3795('0x4')],'app':_0x3795('0x48'),'appdata':_0x12422a['intervals'][_0x524ab7]+'?'+_0x4afc85[_0x3795('0xd')]+',${EXTEN},'+_0x37085e+':'+_0x4afc85[_0x3795('0xd')]+_0x3795('0x49')+_0x493bba,'exten':_0x4afc85['exten'],'context':_0x4afc85[_0x3795('0xd')],'priority':_0x4c3150+_0x524ab7,'VoiceExtensionId':_0x4afc85['id']});}if(_0x12422a['appType']==='outboundDial')_0x12422a[_0x3795('0x4a')]=_0x32a991(_0x4afc85,_0x12422a[_0x3795('0x4a')]);_0x12422a[_0x3795('0x4b')]=_0x1ccf11[_0x3795('0x27')]?_['last'](_0x1ccf11)['priority']+0x1:_0x4c3150;_0x10cf35=_[_0x3795('0x4c')](_0x10cf35,_0x1ccf11,[_0x12422a],_0x511671);_0x4c3150=_[_0x3795('0x4d')](_0x10cf35)['priority']+0x1;}return _0x1cf914(_0x10cf35);})['catch'](function(_0x1b83fc){_0x3f2b4f(_0x1b83fc);});});}return _0x3b754c['define'](_0x3795('0x4e'),attributes,{'tableName':_0x3795('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x25e4cc){var _0x4b86b7=this[_0x3795('0x50')]({'plain':!![]});var _0x4e70d0=_0x4b86b7[_0x3795('0x4')]===_0x3795('0x10')?_0x30b03f(_0x4b86b7):_0x38f527(_0x4b86b7);return _0x12799d(_0x4b86b7,_0x25e4cc,_[_0x3795('0x4d')](_0x4e70d0)[_0x3795('0x4b')]+0x1)['then'](function(_0x49d205){var _0x5b22f8=_[_0x3795('0x4c')](_0x4e70d0,_0x49d205);_0x5b22f8[_0x3795('0xe')]({'type':_0x4b86b7[_0x3795('0x4')],'app':'Hangup','exten':_0x4b86b7[_0x3795('0x7')],'context':_0x4b86b7[_0x3795('0xd')],'priority':_[_0x3795('0x4d')](_0x5b22f8)[_0x3795('0x4b')]+0x1,'VoiceExtensionId':_0x4b86b7['id']});return _0x5b22f8;});}}});};
\ No newline at end of file