Built motion from commit b9b02fed.|2.6.5
[motion2.git] / server / api / voiceExtension / voiceExtension.model.js
index 1dc9fe9..0cee599 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x573a=['U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','custom','ExecIf','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','then','concat','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','exten','type','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','length','name','param','phone','prefix','${EXTEN}','SIP','trunk','join','options','indexOf'];(function(_0x44b97b,_0x3ba703){var _0x32e7e0=function(_0x3c178b){while(--_0x3c178b){_0x44b97b['push'](_0x44b97b['shift']());}};_0x32e7e0(++_0x3ba703);}(_0x573a,0x124));var _0xa573=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x573a[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0xa573('0x0'));var attributes=require(_0xa573('0x1'));module['exports']=function(_0x3b613d){var _0x259495=_0x3b613d[_0xa573('0x2')];function _0x155268(_0x19bca6){var _0x59a1d5=0x2;var _0x41fbd3=[{'type':_0x19bca6['type'],'app':_0xa573('0x3'),'appdata':_0xa573('0x4')+_0x19bca6['type'],'context':_0x19bca6['context'],'exten':_0x19bca6[_0xa573('0x5')],'priority':_0x59a1d5++,'VoiceExtensionId':_0x19bca6['id']},{'type':_0x19bca6[_0xa573('0x6')],'app':_0x19bca6[_0xa573('0x7')]?_0xa573('0x3'):_0xa573('0x8'),'appdata':_0x19bca6[_0xa573('0x7')]?_0xa573('0x9')+_0x19bca6[_0xa573('0x7')]:_0xa573('0xa'),'context':_0x19bca6[_0xa573('0xb')],'exten':_0x19bca6[_0xa573('0x5')],'priority':_0x59a1d5++,'VoiceExtensionId':_0x19bca6['id']}];if(_0x19bca6[_0xa573('0x6')]===_0xa573('0xc')){_0x41fbd3['push']({'type':_0xa573('0xc'),'app':_0xa573('0x3'),'appdata':_0xa573('0xd')+_0x19bca6['id'],'context':_0x19bca6[_0xa573('0xb')],'exten':_0x19bca6[_0xa573('0x5')],'priority':_0x59a1d5++,'VoiceExtensionId':_0x19bca6['id']});}_0x41fbd3[_0xa573('0xe')]({'type':_0x19bca6[_0xa573('0x6')],'app':_0xa573('0x3'),'appdata':_0xa573('0xf'),'context':_0x19bca6[_0xa573('0xb')],'exten':_0x19bca6['exten'],'priority':_0x59a1d5++,'VoiceExtensionId':_0x19bca6['id']},{'type':_0x19bca6[_0xa573('0x6')],'app':_0xa573('0x3'),'appdata':_0xa573('0x10'),'context':_0x19bca6[_0xa573('0xb')],'exten':_0x19bca6[_0xa573('0x5')],'priority':_0x59a1d5++,'VoiceExtensionId':_0x19bca6['id']},{'type':_0x19bca6[_0xa573('0x6')],'app':_0xa573('0x3'),'appdata':_0xa573('0x11'),'context':_0x19bca6[_0xa573('0xb')],'exten':_0x19bca6[_0xa573('0x5')],'priority':_0x59a1d5++,'VoiceExtensionId':_0x19bca6['id']});return _0x41fbd3;}function _0x3dc8cb(_0x21f4ef){var _0xe40bdd=0x2;var _0x345d5a=[{'type':_0xa573('0x12'),'app':_0xa573('0x3'),'appdata':_0xa573('0x13'),'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':_0xa573('0x12'),'app':_0x21f4ef[_0xa573('0x7')]?_0xa573('0x3'):_0xa573('0x8'),'appdata':_0x21f4ef[_0xa573('0x7')]?_0xa573('0x9')+_0x21f4ef[_0xa573('0x7')]:'No\x20alias\x20set','context':_0x21f4ef['context'],'exten':_0x21f4ef['exten'],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':_0xa573('0x12'),'app':_0xa573('0x3'),'appdata':_0xa573('0x14')+(_0x21f4ef[_0xa573('0x15')]?_0xa573('0x16')+_0x21f4ef[_0xa573('0x15')]+'}':'${EXTEN}'),'context':_0x21f4ef['context'],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':'outbound','app':_0xa573('0x3'),'appdata':_0xa573('0xd')+_0x21f4ef['id'],'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':_0xa573('0x12'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xe40bdd+0x2)+'):Goto('+(_0xe40bdd+0x1)+')','context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef['exten'],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':'outbound','app':_0xa573('0x3'),'appdata':_0x21f4ef[_0xa573('0x15')]?_0xa573('0x17')+_0x21f4ef[_0xa573('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x21f4ef['context'],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':'outbound','app':_0xa573('0x3'),'appdata':_0xa573('0xf'),'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':_0xa573('0x12'),'app':_0xa573('0x3'),'appdata':_0xa573('0x10'),'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':_0xa573('0x12'),'app':_0xa573('0x3'),'appdata':_0xa573('0x11'),'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':'outbound','app':_0xa573('0x3'),'appdata':'outboundrouteid='+_0x21f4ef['id'],'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']}];if(_0x21f4ef[_0xa573('0x18')](_0xa573('0x19'))&&_0x21f4ef['recordingFormat']!==_0xa573('0x1a')){_0x345d5a['push']({'type':_0xa573('0x12'),'app':'Set','appdata':_0xa573('0x1b'),'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']},{'type':_0xa573('0x12'),'app':_0xa573('0x3'),'appdata':_0xa573('0x1c')+_0x21f4ef[_0xa573('0x19')]||_0xa573('0x1d'),'context':_0x21f4ef[_0xa573('0xb')],'exten':_0x21f4ef[_0xa573('0x5')],'priority':_0xe40bdd++,'VoiceExtensionId':_0x21f4ef['id']});}return _0x345d5a;}function _0x573048(_0xbd7792,_0x325f18){var _0x1df2cb=[{'name':'trunk','param':0x0},{'name':_0xa573('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0xa573('0x1f'),'param':0x3}];var _0x4bc99d={};var _0x590d7f=_0x325f18[_0xa573('0x20')](',');var _0x2fc42c=[];for(var _0x332976=0x0;_0x332976<_0x1df2cb[_0xa573('0x21')];_0x332976++){switch(_0x1df2cb[_0x332976][_0xa573('0x22')]){case'trunk':_0x4bc99d['trunk']=_0x590d7f[_0x1df2cb[_0x332976][_0xa573('0x23')]][_0xa573('0x20')]('/')[0x1];_0x4bc99d[_0xa573('0x24')]=_0x590d7f[_0x1df2cb[_0x332976][_0xa573('0x23')]]['split']('/')[0x2];_0x4bc99d[_0xa573('0x25')]=_0x4bc99d['phone']?_0x4bc99d['phone']['split']('$')[0x0]:undefined;_0x4bc99d[_0xa573('0x24')]=_0xbd7792['cutdigits']?(_0x4bc99d[_0xa573('0x25')]||'')+_0xa573('0x16')+_0xbd7792[_0xa573('0x15')]+'}':(_0x4bc99d[_0xa573('0x25')]||'')+_0xa573('0x26');_0x2fc42c[_0x1df2cb[_0x332976][_0xa573('0x23')]]=[_0xa573('0x27'),_0x4bc99d[_0xa573('0x28')],_0x4bc99d[_0xa573('0x24')]][_0xa573('0x29')]('/');break;case _0xa573('0x2a'):_0x4bc99d[_0xa573('0x2a')]=_0x590d7f[_0x1df2cb[_0x332976]['param']];if(_0xbd7792[_0xa573('0x19')]!==_0xa573('0x1a')){if(_0x4bc99d[_0xa573('0x2a')][_0xa573('0x2b')](_0xa573('0x2c'))<0x0){_0x4bc99d[_0xa573('0x2a')]+=_0xa573('0x2c');}}else{_0x4bc99d[_0xa573('0x2a')]=_0x4bc99d[_0xa573('0x2a')][_0xa573('0x2d')](_0xa573('0x2c'),'');}_0x2fc42c[_0x1df2cb[_0x332976][_0xa573('0x23')]]=_0x4bc99d[_0xa573('0x2a')];break;default:_0x2fc42c[_0x1df2cb[_0x332976][_0xa573('0x23')]]=_0x590d7f[_0x1df2cb[_0x332976][_0xa573('0x23')]];}}return _0x2fc42c['join'](',');}function _0x2708e1(_0x52f95c,_0x581005,_0x2172ac){return new Promise(function(_0x4f6972,_0x121d6e){var _0x40dd63=[];if(_[_0xa573('0x2e')](_0x581005))return _0x4f6972(_0x40dd63);_0x259495[_0xa573('0x2f')][_0xa573('0x30')]({'attributes':['id',_0xa573('0x31'),_0xa573('0x32')],'raw':!![]})['then'](function(_0x24240c){for(var _0x3d9fea=0x0,_0x519d0a=0x0;_0x3d9fea<_0x581005[_0xa573('0x21')];_0x3d9fea++,_0x519d0a=0x0){var _0x17468e=_0x581005[_0x3d9fea];var _0x1411fa=[];var _0x18a5eb=[];delete _0x17468e['id'];if(_0x17468e[_0xa573('0x31')]!==_0xa573('0x33')){_0x17468e['intervals']=[_0x17468e[_0xa573('0x31')]];}else{_0x17468e[_0xa573('0x34')]=_0x17468e[_0xa573('0x32')]?_[_0xa573('0x35')](_['filter'](_0x24240c,{'IntervalId':_0x17468e[_0xa573('0x32')]}),_0xa573('0x31')):[];}_0x17468e[_0xa573('0xb')]=_0x52f95c[_0xa573('0xb')];_0x17468e[_0xa573('0x5')]=_0x52f95c[_0xa573('0x5')];if(_0x17468e['type'])_0x17468e['type']=_0x17468e[_0xa573('0x6')][_0xa573('0x36')]();if(_0x52f95c[_0xa573('0x6')]===_0xa573('0x12')){if(_0x17468e[_0xa573('0x18')]('tag')&&_0x17468e[_0xa573('0x37')]&&_0x17468e[_0xa573('0x37')]!=='--'){_0x1411fa['push']({'type':_0x17468e[_0xa573('0x6')][_0xa573('0x36')](),'app':_0xa573('0x3'),'appdata':_0xa573('0x38')+_0x17468e[_0xa573('0x37')],'context':_0x52f95c[_0xa573('0xb')],'exten':_0x52f95c[_0xa573('0x5')],'priority':_0x17468e[_0xa573('0x34')][_0xa573('0x21')]+_0x2172ac+_0x519d0a++,'VoiceExtensionId':_0x52f95c['id']});}_0x1411fa['push']({'type':_0x17468e[_0xa573('0x6')][_0xa573('0x36')](),'app':'ExecIf','appdata':_0xa573('0x39')+(_0x17468e[_0xa573('0x3a')]?_0xa573('0x3b')+_0x17468e[_0xa573('0x3a')]+')':_0xa573('0x3c')),'context':_0x52f95c[_0xa573('0xb')],'exten':_0x52f95c[_0xa573('0x5')],'priority':_0x17468e[_0xa573('0x34')][_0xa573('0x21')]+_0x2172ac+_0x519d0a++,'VoiceExtensionId':_0x52f95c['id']});}else{if(_0x17468e[_0xa573('0x18')](_0xa573('0x3d'))){if([_0xa573('0x3e'),_0xa573('0x3f')][_0xa573('0x40')](_0x17468e['app'][_0xa573('0x36')]())&&_0x17468e[_0xa573('0x41')]!==_0xa573('0x42')){if(_0x17468e['answer']){_0x1411fa[_0xa573('0xe')]({'type':_0x17468e[_0xa573('0x6')]['toLowerCase'](),'app':_0xa573('0x43'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x52f95c[_0xa573('0xb')],'exten':_0x52f95c[_0xa573('0x5')],'priority':_0x17468e['intervals'][_0xa573('0x21')]+_0x2172ac+_0x519d0a++,'VoiceExtensionId':_0x52f95c['id']});_0x1411fa[_0xa573('0xe')]({'type':_0x17468e['type'][_0xa573('0x36')](),'app':_0xa573('0x3'),'appdata':_0xa573('0x44'),'context':_0x52f95c[_0xa573('0xb')],'exten':_0x52f95c[_0xa573('0x5')],'priority':_0x17468e[_0xa573('0x34')][_0xa573('0x21')]+_0x2172ac+_0x519d0a++,'VoiceExtensionId':_0x52f95c['id']});}else{_0x1411fa[_0xa573('0xe')]({'type':_0x17468e[_0xa573('0x6')][_0xa573('0x36')](),'app':'ExecIf','appdata':_0xa573('0x45'),'context':_0x52f95c[_0xa573('0xb')],'exten':_0x52f95c[_0xa573('0x5')],'priority':_0x17468e['intervals'][_0xa573('0x21')]+_0x2172ac+_0x519d0a++,'VoiceExtensionId':_0x52f95c['id']});_0x1411fa[_0xa573('0xe')]({'type':_0x17468e[_0xa573('0x6')][_0xa573('0x36')](),'app':'Set','appdata':_0xa573('0x46'),'context':_0x52f95c['context'],'exten':_0x52f95c[_0xa573('0x5')],'priority':_0x17468e[_0xa573('0x34')][_0xa573('0x21')]+_0x2172ac+_0x519d0a++,'VoiceExtensionId':_0x52f95c['id']});}}}}for(var _0x3c217c=0x0;_0x3c217c<_0x17468e[_0xa573('0x34')][_0xa573('0x21')];_0x3c217c++){var _0x10861e=_0x2172ac+_0x17468e[_0xa573('0x34')][_0xa573('0x21')];var _0x2f3828=_0x3c217c===_0x17468e[_0xa573('0x34')][_0xa573('0x21')]-0x1?_0x2172ac+_0x1411fa[_0xa573('0x21')]+_0x18a5eb['length']+0x2:_0x2172ac+_0x3c217c+0x1;_0x1411fa['splice'](_0x3c217c,0x0,{'type':_0x52f95c['type'],'app':_0xa573('0x47'),'appdata':_0x17468e[_0xa573('0x34')][_0x3c217c]+'?'+_0x52f95c['context']+_0xa573('0x48')+_0x10861e+':'+_0x52f95c[_0xa573('0xb')]+_0xa573('0x48')+_0x2f3828,'exten':_0x52f95c['exten'],'context':_0x52f95c['context'],'priority':_0x2172ac+_0x3c217c,'VoiceExtensionId':_0x52f95c['id']});}if(_0x17468e[_0xa573('0x41')]===_0xa573('0x49'))_0x17468e['appdata']=_0x573048(_0x52f95c,_0x17468e[_0xa573('0x4a')]);_0x17468e[_0xa573('0x4b')]=_0x1411fa[_0xa573('0x21')]?_['last'](_0x1411fa)[_0xa573('0x4b')]+0x1:_0x2172ac;_0x40dd63=_['concat'](_0x40dd63,_0x1411fa,[_0x17468e],_0x18a5eb);_0x2172ac=_[_0xa573('0x4c')](_0x40dd63)[_0xa573('0x4b')]+0x1;}return _0x4f6972(_0x40dd63);})[_0xa573('0x4d')](function(_0x3e91bf){_0x121d6e(_0x3e91bf);});});}return _0x3b613d[_0xa573('0x4e')](_0xa573('0x4f'),attributes,{'tableName':_0xa573('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xa8ca58){var _0x41b475=this[_0xa573('0x51')]({'plain':!![]});var _0x54b199=_0x41b475[_0xa573('0x6')]===_0xa573('0x12')?_0x3dc8cb(_0x41b475):_0x155268(_0x41b475);return _0x2708e1(_0x41b475,_0xa8ca58,_[_0xa573('0x4c')](_0x54b199)[_0xa573('0x4b')]+0x1)[_0xa573('0x52')](function(_0x25a4c6){var _0x4e9c2f=_[_0xa573('0x53')](_0x54b199,_0x25a4c6);_0x4e9c2f[_0xa573('0xe')]({'type':_0x41b475[_0xa573('0x6')],'app':'Hangup','exten':_0x41b475[_0xa573('0x5')],'context':_0x41b475[_0xa573('0xb')],'priority':_[_0xa573('0x4c')](_0x4e9c2f)[_0xa573('0x4b')]+0x1,'VoiceExtensionId':_0x41b475['id']});return _0x4e9c2f;});}}});};
\ No newline at end of file
+var _0x0738=['*,*,*,*','map','tag','toLowerCase','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0x0738,0x6e));var _0x8073=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x0738[_0x5b13c3];return _0x3d6780;};'use strict';var _=require(_0x8073('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x8073('0x1')]=function(_0x3b3772){var _0x46b716=_0x3b3772[_0x8073('0x2')];function _0x8e2e35(_0xac9f0){var _0x176f52=0x2;var _0x38b47d=[{'type':_0xac9f0[_0x8073('0x3')],'app':_0x8073('0x4'),'appdata':_0x8073('0x5')+_0xac9f0['type'],'context':_0xac9f0[_0x8073('0x6')],'exten':_0xac9f0[_0x8073('0x7')],'priority':_0x176f52++,'VoiceExtensionId':_0xac9f0['id']},{'type':_0xac9f0[_0x8073('0x3')],'app':_0xac9f0[_0x8073('0x8')]?_0x8073('0x4'):_0x8073('0x9'),'appdata':_0xac9f0[_0x8073('0x8')]?_0x8073('0xa')+_0xac9f0[_0x8073('0x8')]:'No\x20alias\x20set','context':_0xac9f0['context'],'exten':_0xac9f0[_0x8073('0x7')],'priority':_0x176f52++,'VoiceExtensionId':_0xac9f0['id']}];if(_0xac9f0[_0x8073('0x3')]===_0x8073('0xb')){_0x38b47d[_0x8073('0xc')]({'type':'inbound','app':_0x8073('0x4'),'appdata':_0x8073('0xd')+_0xac9f0['id'],'context':_0xac9f0['context'],'exten':_0xac9f0[_0x8073('0x7')],'priority':_0x176f52++,'VoiceExtensionId':_0xac9f0['id']});}_0x38b47d['push']({'type':_0xac9f0[_0x8073('0x3')],'app':_0x8073('0x4'),'appdata':_0x8073('0xe'),'context':_0xac9f0[_0x8073('0x6')],'exten':_0xac9f0['exten'],'priority':_0x176f52++,'VoiceExtensionId':_0xac9f0['id']},{'type':_0xac9f0[_0x8073('0x3')],'app':_0x8073('0x4'),'appdata':_0x8073('0xf'),'context':_0xac9f0[_0x8073('0x6')],'exten':_0xac9f0[_0x8073('0x7')],'priority':_0x176f52++,'VoiceExtensionId':_0xac9f0['id']},{'type':_0xac9f0[_0x8073('0x3')],'app':_0x8073('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0xac9f0[_0x8073('0x6')],'exten':_0xac9f0['exten'],'priority':_0x176f52++,'VoiceExtensionId':_0xac9f0['id']});return _0x38b47d;}function _0xe9c222(_0x21b7c9){var _0x1d1541=0x2;var _0x2fd1ba=[{'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':_0x8073('0x11'),'context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x21b7c9['alias']?'Set':_0x8073('0x9'),'appdata':_0x21b7c9[_0x8073('0x8')]?'CDR(routeAlias)='+_0x21b7c9[_0x8073('0x8')]:_0x8073('0x12'),'context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':_0x8073('0x13')+(_0x21b7c9['cutdigits']?_0x8073('0x14')+_0x21b7c9['cutdigits']+'}':_0x8073('0x15')),'context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':_0x8073('0xd')+_0x21b7c9['id'],'context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9['exten'],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x8073('0x16'),'appdata':_0x8073('0x17')+(_0x1d1541+0x2)+_0x8073('0x18')+(_0x1d1541+0x1)+')','context':_0x21b7c9['context'],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':_0x21b7c9[_0x8073('0x19')]?_0x8073('0x1a')+_0x21b7c9[_0x8073('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9['exten'],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':'outbound','app':'Set','appdata':_0x8073('0xf'),'context':_0x21b7c9['context'],'exten':_0x21b7c9['exten'],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':'outbound','app':_0x8073('0x4'),'appdata':_0x8073('0x1b'),'context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9['exten'],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':'outboundrouteid='+_0x21b7c9['id'],'context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']}];if(_0x21b7c9['hasOwnProperty'](_0x8073('0x1c'))&&_0x21b7c9[_0x8073('0x1c')]!==_0x8073('0x1d')){_0x2fd1ba['push']({'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x21b7c9[_0x8073('0x6')],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']},{'type':_0x8073('0x10'),'app':_0x8073('0x4'),'appdata':_0x8073('0x1e')+_0x21b7c9[_0x8073('0x1c')]||'wav','context':_0x21b7c9['context'],'exten':_0x21b7c9[_0x8073('0x7')],'priority':_0x1d1541++,'VoiceExtensionId':_0x21b7c9['id']});}return _0x2fd1ba;}function _0x5f279a(_0x6dddc1,_0x5f1199){var _0x51e924=[{'name':_0x8073('0x1f'),'param':0x0},{'name':_0x8073('0x20'),'param':0x1},{'name':_0x8073('0x21'),'param':0x2},{'name':_0x8073('0x22'),'param':0x3}];var _0x46615a={};var _0x3643d3=_0x5f1199[_0x8073('0x23')](',');var _0x368765=[];for(var _0x1726d4=0x0;_0x1726d4<_0x51e924[_0x8073('0x24')];_0x1726d4++){switch(_0x51e924[_0x1726d4]['name']){case _0x8073('0x1f'):_0x46615a['trunk']=_0x3643d3[_0x51e924[_0x1726d4][_0x8073('0x25')]][_0x8073('0x23')]('/')[0x1];_0x46615a[_0x8073('0x26')]=_0x3643d3[_0x51e924[_0x1726d4]['param']]['split']('/')[0x2];_0x46615a[_0x8073('0x27')]=_0x46615a[_0x8073('0x26')]?_0x46615a['phone']['split']('$')[0x0]:undefined;_0x46615a[_0x8073('0x26')]=_0x6dddc1[_0x8073('0x19')]?(_0x46615a[_0x8073('0x27')]||'')+_0x8073('0x14')+_0x6dddc1[_0x8073('0x19')]+'}':(_0x46615a[_0x8073('0x27')]||'')+_0x8073('0x15');_0x368765[_0x51e924[_0x1726d4]['param']]=['SIP',_0x46615a[_0x8073('0x1f')],_0x46615a[_0x8073('0x26')]][_0x8073('0x28')]('/');break;case'options':_0x46615a['options']=_0x3643d3[_0x51e924[_0x1726d4]['param']];if(_0x6dddc1[_0x8073('0x1c')]!==_0x8073('0x1d')){if(_0x46615a[_0x8073('0x21')][_0x8073('0x29')](_0x8073('0x2a'))<0x0){_0x46615a[_0x8073('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x46615a[_0x8073('0x21')]=_0x46615a[_0x8073('0x21')]['replace']('U(xcally-mixmonitor-context)','');}_0x368765[_0x51e924[_0x1726d4]['param']]=_0x46615a[_0x8073('0x21')];break;default:_0x368765[_0x51e924[_0x1726d4]['param']]=_0x3643d3[_0x51e924[_0x1726d4][_0x8073('0x25')]];}}return _0x368765[_0x8073('0x28')](',');}function _0x296071(_0x468c6f,_0x573b66,_0x336159){return new Promise(function(_0x3f6fa0,_0x44909c){var _0x49812d=[];if(_['isEmpty'](_0x573b66))return _0x3f6fa0(_0x49812d);_0x46b716[_0x8073('0x2b')][_0x8073('0x2c')]({'attributes':['id',_0x8073('0x2d'),_0x8073('0x2e')],'raw':!![]})[_0x8073('0x2f')](function(_0x444f85){for(var _0x2ef28b=0x0,_0x53e489=0x0;_0x2ef28b<_0x573b66[_0x8073('0x24')];_0x2ef28b++,_0x53e489=0x0){var _0x469764=_0x573b66[_0x2ef28b];var _0x4f7fd2=[];var _0x4382e4=[];delete _0x469764['id'];if(_0x469764['interval']!==_0x8073('0x30')){_0x469764['intervals']=[_0x469764[_0x8073('0x2d')]];}else{_0x469764['intervals']=_0x469764[_0x8073('0x2e')]?_[_0x8073('0x31')](_['filter'](_0x444f85,{'IntervalId':_0x469764[_0x8073('0x2e')]}),_0x8073('0x2d')):[];}_0x469764[_0x8073('0x6')]=_0x468c6f[_0x8073('0x6')];_0x469764[_0x8073('0x7')]=_0x468c6f[_0x8073('0x7')];if(_0x469764[_0x8073('0x3')])_0x469764['type']=_0x469764['type']['toLowerCase']();if(_0x468c6f[_0x8073('0x3')]===_0x8073('0x10')){if(_0x469764['hasOwnProperty'](_0x8073('0x32'))&&_0x469764[_0x8073('0x32')]&&_0x469764[_0x8073('0x32')]!=='--'){_0x4f7fd2['push']({'type':_0x469764['type'][_0x8073('0x33')](),'app':'Set','appdata':'CDR(tag)='+_0x469764[_0x8073('0x32')],'context':_0x468c6f['context'],'exten':_0x468c6f[_0x8073('0x7')],'priority':_0x469764[_0x8073('0x34')][_0x8073('0x24')]+_0x336159+_0x53e489++,'VoiceExtensionId':_0x468c6f['id']});}_0x4f7fd2['push']({'type':_0x469764[_0x8073('0x3')][_0x8073('0x33')](),'app':_0x8073('0x16'),'appdata':_0x8073('0x35')+(_0x469764[_0x8073('0x36')]?_0x8073('0x37')+_0x469764[_0x8073('0x36')]+')':_0x8073('0x38')),'context':_0x468c6f[_0x8073('0x6')],'exten':_0x468c6f['exten'],'priority':_0x469764[_0x8073('0x34')][_0x8073('0x24')]+_0x336159+_0x53e489++,'VoiceExtensionId':_0x468c6f['id']});}else{if(_0x469764['hasOwnProperty'](_0x8073('0x39'))){if([_0x8073('0x3a'),_0x8073('0x3b')]['includes'](_0x469764[_0x8073('0x3c')][_0x8073('0x33')]())&&_0x469764[_0x8073('0x3d')]!==_0x8073('0x3e')){if(_0x469764[_0x8073('0x39')]){_0x4f7fd2['push']({'type':_0x469764[_0x8073('0x3')][_0x8073('0x33')](),'app':_0x8073('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x468c6f[_0x8073('0x6')],'exten':_0x468c6f[_0x8073('0x7')],'priority':_0x469764[_0x8073('0x34')]['length']+_0x336159+_0x53e489++,'VoiceExtensionId':_0x468c6f['id']});_0x4f7fd2['push']({'type':_0x469764[_0x8073('0x3')]['toLowerCase'](),'app':_0x8073('0x4'),'appdata':_0x8073('0x3f'),'context':_0x468c6f[_0x8073('0x6')],'exten':_0x468c6f[_0x8073('0x7')],'priority':_0x469764[_0x8073('0x34')]['length']+_0x336159+_0x53e489++,'VoiceExtensionId':_0x468c6f['id']});}else{_0x4f7fd2[_0x8073('0xc')]({'type':_0x469764['type']['toLowerCase'](),'app':_0x8073('0x16'),'appdata':_0x8073('0x40'),'context':_0x468c6f[_0x8073('0x6')],'exten':_0x468c6f[_0x8073('0x7')],'priority':_0x469764[_0x8073('0x34')][_0x8073('0x24')]+_0x336159+_0x53e489++,'VoiceExtensionId':_0x468c6f['id']});_0x4f7fd2[_0x8073('0xc')]({'type':_0x469764[_0x8073('0x3')][_0x8073('0x33')](),'app':_0x8073('0x4'),'appdata':_0x8073('0x41'),'context':_0x468c6f[_0x8073('0x6')],'exten':_0x468c6f[_0x8073('0x7')],'priority':_0x469764[_0x8073('0x34')][_0x8073('0x24')]+_0x336159+_0x53e489++,'VoiceExtensionId':_0x468c6f['id']});}}}}for(var _0x5bfeb4=0x0;_0x5bfeb4<_0x469764['intervals'][_0x8073('0x24')];_0x5bfeb4++){var _0x4729ae=_0x336159+_0x469764[_0x8073('0x34')]['length'];var _0x4a5b3f=_0x5bfeb4===_0x469764[_0x8073('0x34')]['length']-0x1?_0x336159+_0x4f7fd2[_0x8073('0x24')]+_0x4382e4[_0x8073('0x24')]+0x2:_0x336159+_0x5bfeb4+0x1;_0x4f7fd2[_0x8073('0x42')](_0x5bfeb4,0x0,{'type':_0x468c6f[_0x8073('0x3')],'app':_0x8073('0x43'),'appdata':_0x469764[_0x8073('0x34')][_0x5bfeb4]+'?'+_0x468c6f[_0x8073('0x6')]+_0x8073('0x44')+_0x4729ae+':'+_0x468c6f[_0x8073('0x6')]+_0x8073('0x44')+_0x4a5b3f,'exten':_0x468c6f['exten'],'context':_0x468c6f[_0x8073('0x6')],'priority':_0x336159+_0x5bfeb4,'VoiceExtensionId':_0x468c6f['id']});}if(_0x469764[_0x8073('0x3d')]==='outboundDial')_0x469764[_0x8073('0x45')]=_0x5f279a(_0x468c6f,_0x469764[_0x8073('0x45')]);_0x469764[_0x8073('0x46')]=_0x4f7fd2[_0x8073('0x24')]?_[_0x8073('0x47')](_0x4f7fd2)[_0x8073('0x46')]+0x1:_0x336159;_0x49812d=_[_0x8073('0x48')](_0x49812d,_0x4f7fd2,[_0x469764],_0x4382e4);_0x336159=_['last'](_0x49812d)[_0x8073('0x46')]+0x1;}return _0x3f6fa0(_0x49812d);})[_0x8073('0x49')](function(_0x453516){_0x44909c(_0x453516);});});}return _0x3b3772[_0x8073('0x4a')](_0x8073('0x4b'),attributes,{'tableName':_0x8073('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x34239f){var _0x26352b=this[_0x8073('0x4d')]({'plain':!![]});var _0x466bd3=_0x26352b[_0x8073('0x3')]==='outbound'?_0xe9c222(_0x26352b):_0x8e2e35(_0x26352b);return _0x296071(_0x26352b,_0x34239f,_['last'](_0x466bd3)['priority']+0x1)[_0x8073('0x2f')](function(_0x274879){var _0x3007f6=_[_0x8073('0x48')](_0x466bd3,_0x274879);_0x3007f6[_0x8073('0xc')]({'type':_0x26352b['type'],'app':_0x8073('0x4e'),'exten':_0x26352b[_0x8073('0x7')],'context':_0x26352b[_0x8073('0x6')],'priority':_[_0x8073('0x47')](_0x3007f6)[_0x8073('0x46')]+0x1,'VoiceExtensionId':_0x26352b['id']});return _0x3007f6;});}}});};
\ No newline at end of file