Built motion from commit ff78e754.|2.6.29
[motion2.git] / server / api / voiceExtension / voiceExtension.model.js
index e1a5dd5..32e51e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8dfe=['Set','CDR(type)=','context','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','length','name','trunk','param','split','phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','queue','playback','includes','appType','custom','answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','priority','last','catch','define','VoiceExtension','voice_extensions','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type'];(function(_0x494756,_0x2deaa7){var _0x30c0e7=function(_0x285cbd){while(--_0x285cbd){_0x494756['push'](_0x494756['shift']());}};_0x30c0e7(++_0x2deaa7);}(_0x8dfe,0x9b));var _0xe8df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8dfe[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe8df('0x0'));var attributes=require(_0xe8df('0x1'));module[_0xe8df('0x2')]=function(_0x419e71){var _0x471062=_0x419e71[_0xe8df('0x3')];function _0x8a381f(_0x16db28){var _0x5f14e3=0x2;var _0x20c225=[{'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0x6')+_0x16db28[_0xe8df('0x4')],'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']}];if(_0x16db28[_0xe8df('0x4')]===_0xe8df('0x9')){_0x20c225['push']({'type':'inbound','app':'Set','appdata':_0xe8df('0xa')+_0x16db28['id'],'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']});}_0x20c225[_0xe8df('0xb')]({'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0xc'),'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28['exten'],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']},{'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0xd'),'context':_0x16db28[_0xe8df('0x7')],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']},{'type':_0x16db28[_0xe8df('0x4')],'app':_0xe8df('0x5'),'appdata':_0xe8df('0xe'),'context':_0x16db28['context'],'exten':_0x16db28[_0xe8df('0x8')],'priority':_0x5f14e3++,'VoiceExtensionId':_0x16db28['id']});return _0x20c225;}function _0x980d79(_0x563b0f){var _0xaeadbe=0x2;var _0x3c5903=[{'type':'outbound','app':_0xe8df('0x5'),'appdata':_0xe8df('0xf'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0x11')+(_0x563b0f[_0xe8df('0x12')]?'${EXTEN:'+_0x563b0f['cutdigits']+'}':_0xe8df('0x13')),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0xa')+_0x563b0f['id'],'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f['exten'],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'ExecIf','appdata':_0xe8df('0x14')+(_0xaeadbe+0x2)+_0xe8df('0x15')+(_0xaeadbe+0x1)+')','context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0x563b0f[_0xe8df('0x12')]?_0xe8df('0x16')+_0x563b0f[_0xe8df('0x12')]+'}':_0xe8df('0x17'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0xc'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':'Set','appdata':_0xe8df('0xe'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':'outboundrouteid='+_0x563b0f['id'],'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']}];if(_0x563b0f['hasOwnProperty'](_0xe8df('0x18'))&&_0x563b0f[_0xe8df('0x18')]!==_0xe8df('0x19')){_0x3c5903[_0xe8df('0xb')]({'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x1a'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f['exten'],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']},{'type':_0xe8df('0x10'),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x1b')+_0x563b0f[_0xe8df('0x18')]||_0xe8df('0x1c'),'context':_0x563b0f[_0xe8df('0x7')],'exten':_0x563b0f[_0xe8df('0x8')],'priority':_0xaeadbe++,'VoiceExtensionId':_0x563b0f['id']});}return _0x3c5903;}function _0x213249(_0x51c684,_0x23ee36){var _0x1e36de=[{'name':'trunk','param':0x0},{'name':_0xe8df('0x1d'),'param':0x1},{'name':_0xe8df('0x1e'),'param':0x2},{'name':_0xe8df('0x1f'),'param':0x3}];var _0x2b3ba8={};var _0x51aa84=_0x23ee36['split'](',');var _0x1d0527=[];for(var _0x3a4fcc=0x0;_0x3a4fcc<_0x1e36de[_0xe8df('0x20')];_0x3a4fcc++){switch(_0x1e36de[_0x3a4fcc][_0xe8df('0x21')]){case _0xe8df('0x22'):_0x2b3ba8['trunk']=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]][_0xe8df('0x24')]('/')[0x1];_0x2b3ba8[_0xe8df('0x25')]=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]['split']('/')[0x2];_0x2b3ba8[_0xe8df('0x26')]=_0x2b3ba8['phone']?_0x2b3ba8[_0xe8df('0x25')][_0xe8df('0x24')]('$')[0x0]:undefined;_0x2b3ba8['phone']=_0x51c684[_0xe8df('0x12')]?(_0x2b3ba8[_0xe8df('0x26')]||'')+_0xe8df('0x27')+_0x51c684['cutdigits']+'}':(_0x2b3ba8['prefix']||'')+_0xe8df('0x13');_0x1d0527[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]=['SIP',_0x2b3ba8[_0xe8df('0x22')],_0x2b3ba8[_0xe8df('0x25')]][_0xe8df('0x28')]('/');break;case _0xe8df('0x1e'):_0x2b3ba8[_0xe8df('0x1e')]=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]];if(_0x51c684[_0xe8df('0x18')]!==_0xe8df('0x19')){if(_0x2b3ba8[_0xe8df('0x1e')][_0xe8df('0x29')](_0xe8df('0x2a'))<0x0){_0x2b3ba8[_0xe8df('0x1e')]+=_0xe8df('0x2a');}}else{_0x2b3ba8[_0xe8df('0x1e')]=_0x2b3ba8[_0xe8df('0x1e')][_0xe8df('0x2b')](_0xe8df('0x2a'),'');}_0x1d0527[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]=_0x2b3ba8[_0xe8df('0x1e')];break;default:_0x1d0527[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]]=_0x51aa84[_0x1e36de[_0x3a4fcc][_0xe8df('0x23')]];}}return _0x1d0527[_0xe8df('0x28')](',');}function _0x4f8632(_0x417d54,_0xbeda54,_0x203106){return new Promise(function(_0xd3011a,_0x23c702){var _0x52d5b7=[];if(_[_0xe8df('0x2c')](_0xbeda54))return _0xd3011a(_0x52d5b7);_0x471062['Interval'][_0xe8df('0x2d')]({'attributes':['id',_0xe8df('0x2e'),_0xe8df('0x2f')],'raw':!![]})[_0xe8df('0x30')](function(_0x3cd3a1){for(var _0x1f7a93=0x0,_0x11f78e=0x0;_0x1f7a93<_0xbeda54['length'];_0x1f7a93++,_0x11f78e=0x0){var _0x39ae9b=_0xbeda54[_0x1f7a93];var _0x1f5202=[];var _0x37df25=[];delete _0x39ae9b['id'];if(_0x39ae9b[_0xe8df('0x2e')]!==_0xe8df('0x31')){_0x39ae9b[_0xe8df('0x32')]=[_0x39ae9b[_0xe8df('0x2e')]];}else{_0x39ae9b[_0xe8df('0x32')]=_0x39ae9b[_0xe8df('0x2f')]?_[_0xe8df('0x33')](_['filter'](_0x3cd3a1,{'IntervalId':_0x39ae9b['IntervalId']}),'interval'):[];}_0x39ae9b[_0xe8df('0x7')]=_0x417d54[_0xe8df('0x7')];_0x39ae9b[_0xe8df('0x8')]=_0x417d54[_0xe8df('0x8')];if(_0x39ae9b[_0xe8df('0x4')])_0x39ae9b['type']=_0x39ae9b['type'][_0xe8df('0x34')]();if(_0x417d54[_0xe8df('0x4')]==='outbound'){if(_0x39ae9b[_0xe8df('0x35')](_0xe8df('0x36'))&&_0x39ae9b[_0xe8df('0x36')]&&_0x39ae9b[_0xe8df('0x36')]!=='--'){_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')]['toLowerCase'](),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x37')+_0x39ae9b[_0xe8df('0x36')],'context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b['type'][_0xe8df('0x34')](),'app':_0xe8df('0x38'),'appdata':_0xe8df('0x39')+(_0x39ae9b[_0xe8df('0x3a')]?_0xe8df('0x3b')+_0x39ae9b['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')]['length']+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}else{if(_0x39ae9b[_0xe8df('0x35')]('answer')){if([_0xe8df('0x3c'),_0xe8df('0x3d')][_0xe8df('0x3e')](_0x39ae9b['app'][_0xe8df('0x34')]())&&_0x39ae9b[_0xe8df('0x3f')]!==_0xe8df('0x40')){if(_0x39ae9b[_0xe8df('0x41')]){_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b['type']['toLowerCase'](),'app':_0xe8df('0x38'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x417d54['context'],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')][_0xe8df('0x34')](),'app':_0xe8df('0x5'),'appdata':_0xe8df('0x42'),'context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54['exten'],'priority':_0x39ae9b['intervals'][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}else{_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')][_0xe8df('0x34')](),'app':_0xe8df('0x38'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')]['length']+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});_0x1f5202['push']({'type':_0x39ae9b[_0xe8df('0x4')]['toLowerCase'](),'app':_0xe8df('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54[_0xe8df('0x8')],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}}}}for(var _0x4fffc3=0x0;_0x4fffc3<_0x39ae9b[_0xe8df('0x32')]['length'];_0x4fffc3++){var _0xaa882=_0x203106+_0x39ae9b['intervals'][_0xe8df('0x20')];var _0x47d91a=_0x4fffc3===_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]-0x1?_0x203106+_0x1f5202['length']+_0x37df25['length']+0x2:_0x203106+_0x4fffc3+0x1;_0x1f5202[_0xe8df('0x43')](_0x4fffc3,0x0,{'type':_0x417d54[_0xe8df('0x4')],'app':_0xe8df('0x44'),'appdata':_0x39ae9b[_0xe8df('0x32')][_0x4fffc3]+'?'+_0x417d54[_0xe8df('0x7')]+_0xe8df('0x45')+_0xaa882+':'+_0x417d54[_0xe8df('0x7')]+_0xe8df('0x45')+_0x47d91a,'exten':_0x417d54[_0xe8df('0x8')],'context':_0x417d54[_0xe8df('0x7')],'priority':_0x203106+_0x4fffc3,'VoiceExtensionId':_0x417d54['id']});}if(_0x39ae9b[_0xe8df('0x3f')]==='outboundDial'){_0x39ae9b[_0xe8df('0x46')]=_0x213249(_0x417d54,_0x39ae9b[_0xe8df('0x46')]);}if(_0x39ae9b['appType']===_0xe8df('0x47')){_0x1f5202[_0xe8df('0xb')]({'type':_0x39ae9b[_0xe8df('0x4')][_0xe8df('0x34')](),'app':_0xe8df('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x417d54[_0xe8df('0x7')],'exten':_0x417d54['exten'],'priority':_0x39ae9b[_0xe8df('0x32')][_0xe8df('0x20')]+_0x203106+_0x11f78e++,'VoiceExtensionId':_0x417d54['id']});}_0x39ae9b[_0xe8df('0x48')]=_0x1f5202[_0xe8df('0x20')]?_['last'](_0x1f5202)[_0xe8df('0x48')]+0x1:_0x203106;_0x52d5b7=_['concat'](_0x52d5b7,_0x1f5202,[_0x39ae9b],_0x37df25);_0x203106=_[_0xe8df('0x49')](_0x52d5b7)[_0xe8df('0x48')]+0x1;}return _0xd3011a(_0x52d5b7);})[_0xe8df('0x4a')](function(_0x2dc93f){_0x23c702(_0x2dc93f);});});}return _0x419e71[_0xe8df('0x4b')](_0xe8df('0x4c'),attributes,{'tableName':_0xe8df('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x205ee8){var _0xae6217=this['get']({'plain':!![]});var _0x5199d6=_0xae6217[_0xe8df('0x4')]==='outbound'?_0x980d79(_0xae6217):_0x8a381f(_0xae6217);return _0x4f8632(_0xae6217,_0x205ee8,_['last'](_0x5199d6)['priority']+0x1)['then'](function(_0x31847d){var _0x5df32d=_[_0xe8df('0x4e')](_0x5199d6,_0x31847d);_0x5df32d[_0xe8df('0xb')]({'type':_0xae6217[_0xe8df('0x4')],'app':_0xe8df('0x4f'),'exten':_0xae6217[_0xe8df('0x8')],'context':_0xae6217[_0xe8df('0x7')],'priority':_[_0xe8df('0x49')](_0x5df32d)[_0xe8df('0x48')]+0x1,'VoiceExtensionId':_0xae6217['id']});return _0x5df32d;});}}});};
\ No newline at end of file
+var _0x1ae4=['Hangup','lodash','./voiceExtension.attributes','models','type','Set','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','split','name','trunk','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','VoiceExtension','voice_extensions','get'];(function(_0x387fd0,_0x3efc1c){var _0x331d1b=function(_0x4252f3){while(--_0x4252f3){_0x387fd0['push'](_0x387fd0['shift']());}};_0x331d1b(++_0x3efc1c);}(_0x1ae4,0x1db));var _0x41ae=function(_0x12de83,_0xa00d4e){_0x12de83=_0x12de83-0x0;var _0x5e5fdf=_0x1ae4[_0x12de83];return _0x5e5fdf;};'use strict';var _=require(_0x41ae('0x0'));var attributes=require(_0x41ae('0x1'));module['exports']=function(_0x6090e9){var _0x199a52=_0x6090e9[_0x41ae('0x2')];function _0x154f1f(_0x2c28f2){var _0x5b8ded=0x2;var _0x153fa8=[{'type':_0x2c28f2[_0x41ae('0x3')],'app':_0x41ae('0x4'),'appdata':'CDR(type)='+_0x2c28f2[_0x41ae('0x3')],'context':_0x2c28f2[_0x41ae('0x5')],'exten':_0x2c28f2[_0x41ae('0x6')],'priority':_0x5b8ded++,'VoiceExtensionId':_0x2c28f2['id']}];if(_0x2c28f2[_0x41ae('0x3')]===_0x41ae('0x7')){_0x153fa8[_0x41ae('0x8')]({'type':'inbound','app':_0x41ae('0x4'),'appdata':_0x41ae('0x9')+_0x2c28f2['id'],'context':_0x2c28f2[_0x41ae('0x5')],'exten':_0x2c28f2[_0x41ae('0x6')],'priority':_0x5b8ded++,'VoiceExtensionId':_0x2c28f2['id']});}_0x153fa8[_0x41ae('0x8')]({'type':_0x2c28f2['type'],'app':_0x41ae('0x4'),'appdata':_0x41ae('0xa'),'context':_0x2c28f2['context'],'exten':_0x2c28f2['exten'],'priority':_0x5b8ded++,'VoiceExtensionId':_0x2c28f2['id']},{'type':_0x2c28f2[_0x41ae('0x3')],'app':_0x41ae('0x4'),'appdata':_0x41ae('0xb'),'context':_0x2c28f2[_0x41ae('0x5')],'exten':_0x2c28f2['exten'],'priority':_0x5b8ded++,'VoiceExtensionId':_0x2c28f2['id']},{'type':_0x2c28f2[_0x41ae('0x3')],'app':_0x41ae('0x4'),'appdata':_0x41ae('0xc'),'context':_0x2c28f2[_0x41ae('0x5')],'exten':_0x2c28f2[_0x41ae('0x6')],'priority':_0x5b8ded++,'VoiceExtensionId':_0x2c28f2['id']});return _0x153fa8;}function _0x29b8b6(_0x56d5a9){var _0x3c7fdb=0x2;var _0x2e815d=[{'type':_0x41ae('0xd'),'app':'Set','appdata':_0x41ae('0xe'),'context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9[_0x41ae('0x6')],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':'outbound','app':_0x41ae('0x4'),'appdata':'CDR(destination)='+(_0x56d5a9[_0x41ae('0xf')]?_0x41ae('0x10')+_0x56d5a9['cutdigits']+'}':_0x41ae('0x11')),'context':_0x56d5a9['context'],'exten':_0x56d5a9[_0x41ae('0x6')],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':_0x41ae('0xd'),'app':'Set','appdata':_0x41ae('0x9')+_0x56d5a9['id'],'context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9[_0x41ae('0x6')],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':'outbound','app':_0x41ae('0x12'),'appdata':_0x41ae('0x13')+(_0x3c7fdb+0x2)+_0x41ae('0x14')+(_0x3c7fdb+0x1)+')','context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9['exten'],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':_0x41ae('0xd'),'app':_0x41ae('0x4'),'appdata':_0x56d5a9[_0x41ae('0xf')]?_0x41ae('0x15')+_0x56d5a9[_0x41ae('0xf')]+'}':_0x41ae('0x16'),'context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9['exten'],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':_0x41ae('0xd'),'app':_0x41ae('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x56d5a9['context'],'exten':_0x56d5a9[_0x41ae('0x6')],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':_0x41ae('0xd'),'app':_0x41ae('0x4'),'appdata':_0x41ae('0xb'),'context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9[_0x41ae('0x6')],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':'outbound','app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9['exten'],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':'outbound','app':_0x41ae('0x4'),'appdata':_0x41ae('0x17')+_0x56d5a9['id'],'context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9['exten'],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']}];if(_0x56d5a9[_0x41ae('0x18')](_0x41ae('0x19'))&&_0x56d5a9[_0x41ae('0x19')]!==_0x41ae('0x1a')){_0x2e815d[_0x41ae('0x8')]({'type':_0x41ae('0xd'),'app':_0x41ae('0x4'),'appdata':_0x41ae('0x1b'),'context':_0x56d5a9[_0x41ae('0x5')],'exten':_0x56d5a9[_0x41ae('0x6')],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']},{'type':_0x41ae('0xd'),'app':'Set','appdata':_0x41ae('0x1c')+_0x56d5a9[_0x41ae('0x19')]||_0x41ae('0x1d'),'context':_0x56d5a9['context'],'exten':_0x56d5a9[_0x41ae('0x6')],'priority':_0x3c7fdb++,'VoiceExtensionId':_0x56d5a9['id']});}return _0x2e815d;}function _0x1d036e(_0x29c23c,_0x45508f){var _0x3fa7af=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x41ae('0x1e'),'param':0x2},{'name':_0x41ae('0x1f'),'param':0x3}];var _0x21dead={};var _0x17e03a=_0x45508f[_0x41ae('0x20')](',');var _0x5d7993=[];for(var _0x5d1f3f=0x0;_0x5d1f3f<_0x3fa7af['length'];_0x5d1f3f++){switch(_0x3fa7af[_0x5d1f3f][_0x41ae('0x21')]){case _0x41ae('0x22'):_0x21dead['trunk']=_0x17e03a[_0x3fa7af[_0x5d1f3f][_0x41ae('0x23')]][_0x41ae('0x20')]('/')[0x1];_0x21dead[_0x41ae('0x24')]=_0x17e03a[_0x3fa7af[_0x5d1f3f][_0x41ae('0x23')]][_0x41ae('0x20')]('/')[0x2];_0x21dead['prefix']=_0x21dead[_0x41ae('0x24')]?_0x21dead['phone'][_0x41ae('0x20')]('$')[0x0]:undefined;_0x21dead[_0x41ae('0x24')]=_0x29c23c['cutdigits']?(_0x21dead['prefix']||'')+'${EXTEN:'+_0x29c23c[_0x41ae('0xf')]+'}':(_0x21dead[_0x41ae('0x25')]||'')+_0x41ae('0x11');_0x5d7993[_0x3fa7af[_0x5d1f3f][_0x41ae('0x23')]]=[_0x41ae('0x26'),_0x21dead[_0x41ae('0x22')],_0x21dead[_0x41ae('0x24')]][_0x41ae('0x27')]('/');break;case'options':_0x21dead[_0x41ae('0x1e')]=_0x17e03a[_0x3fa7af[_0x5d1f3f][_0x41ae('0x23')]];if(_0x29c23c[_0x41ae('0x19')]!==_0x41ae('0x1a')){if(_0x21dead[_0x41ae('0x1e')][_0x41ae('0x28')](_0x41ae('0x29'))<0x0){_0x21dead[_0x41ae('0x1e')]+=_0x41ae('0x29');}}else{_0x21dead[_0x41ae('0x1e')]=_0x21dead[_0x41ae('0x1e')][_0x41ae('0x2a')]('U(xcally-mixmonitor-context)','');}_0x5d7993[_0x3fa7af[_0x5d1f3f][_0x41ae('0x23')]]=_0x21dead[_0x41ae('0x1e')];break;default:_0x5d7993[_0x3fa7af[_0x5d1f3f][_0x41ae('0x23')]]=_0x17e03a[_0x3fa7af[_0x5d1f3f][_0x41ae('0x23')]];}}return _0x5d7993[_0x41ae('0x27')](',');}function _0x521d0b(_0x172671,_0x32b6a7,_0x486eee){return new Promise(function(_0x366a65,_0x1a05e2){var _0x13bc47=[];if(_[_0x41ae('0x2b')](_0x32b6a7))return _0x366a65(_0x13bc47);_0x199a52['Interval'][_0x41ae('0x2c')]({'attributes':['id',_0x41ae('0x2d'),_0x41ae('0x2e')],'raw':!![]})[_0x41ae('0x2f')](function(_0x236f1a){for(var _0xe18f0c=0x0,_0x580cbb=0x0;_0xe18f0c<_0x32b6a7['length'];_0xe18f0c++,_0x580cbb=0x0){var _0x490ce7=_0x32b6a7[_0xe18f0c];var _0x5ca442=[];var _0x4442d9=[];delete _0x490ce7['id'];if(_0x490ce7[_0x41ae('0x2d')]!==_0x41ae('0x30')){_0x490ce7[_0x41ae('0x31')]=[_0x490ce7[_0x41ae('0x2d')]];}else{_0x490ce7[_0x41ae('0x31')]=_0x490ce7[_0x41ae('0x2e')]?_[_0x41ae('0x32')](_[_0x41ae('0x33')](_0x236f1a,{'IntervalId':_0x490ce7[_0x41ae('0x2e')]}),_0x41ae('0x2d')):[];}_0x490ce7['context']=_0x172671[_0x41ae('0x5')];_0x490ce7[_0x41ae('0x6')]=_0x172671['exten'];if(_0x490ce7['type'])_0x490ce7[_0x41ae('0x3')]=_0x490ce7[_0x41ae('0x3')][_0x41ae('0x34')]();if(_0x172671[_0x41ae('0x3')]==='outbound'){if(_0x490ce7[_0x41ae('0x18')]('tag')&&_0x490ce7['tag']&&_0x490ce7[_0x41ae('0x35')]!=='--'){_0x5ca442['push']({'type':_0x490ce7[_0x41ae('0x3')]['toLowerCase'](),'app':_0x41ae('0x4'),'appdata':'CDR(tag)='+_0x490ce7['tag'],'context':_0x172671[_0x41ae('0x5')],'exten':_0x172671['exten'],'priority':_0x490ce7[_0x41ae('0x31')][_0x41ae('0x36')]+_0x486eee+_0x580cbb++,'VoiceExtensionId':_0x172671['id']});}_0x5ca442['push']({'type':_0x490ce7[_0x41ae('0x3')][_0x41ae('0x34')](),'app':_0x41ae('0x12'),'appdata':_0x41ae('0x37')+(_0x490ce7[_0x41ae('0x38')]?_0x41ae('0x39')+_0x490ce7[_0x41ae('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x172671['context'],'exten':_0x172671[_0x41ae('0x6')],'priority':_0x490ce7[_0x41ae('0x31')][_0x41ae('0x36')]+_0x486eee+_0x580cbb++,'VoiceExtensionId':_0x172671['id']});}else{if(_0x490ce7[_0x41ae('0x18')](_0x41ae('0x3a'))){if([_0x41ae('0x3b'),_0x41ae('0x3c')][_0x41ae('0x3d')](_0x490ce7[_0x41ae('0x3e')]['toLowerCase']())&&_0x490ce7[_0x41ae('0x3f')]!==_0x41ae('0x40')){if(_0x490ce7[_0x41ae('0x3a')]){_0x5ca442[_0x41ae('0x8')]({'type':_0x490ce7[_0x41ae('0x3')][_0x41ae('0x34')](),'app':_0x41ae('0x12'),'appdata':_0x41ae('0x41'),'context':_0x172671[_0x41ae('0x5')],'exten':_0x172671[_0x41ae('0x6')],'priority':_0x490ce7[_0x41ae('0x31')]['length']+_0x486eee+_0x580cbb++,'VoiceExtensionId':_0x172671['id']});_0x5ca442[_0x41ae('0x8')]({'type':_0x490ce7[_0x41ae('0x3')][_0x41ae('0x34')](),'app':_0x41ae('0x4'),'appdata':_0x41ae('0x42'),'context':_0x172671['context'],'exten':_0x172671[_0x41ae('0x6')],'priority':_0x490ce7['intervals'][_0x41ae('0x36')]+_0x486eee+_0x580cbb++,'VoiceExtensionId':_0x172671['id']});}else{_0x5ca442['push']({'type':_0x490ce7[_0x41ae('0x3')][_0x41ae('0x34')](),'app':_0x41ae('0x12'),'appdata':_0x41ae('0x43'),'context':_0x172671[_0x41ae('0x5')],'exten':_0x172671[_0x41ae('0x6')],'priority':_0x490ce7[_0x41ae('0x31')][_0x41ae('0x36')]+_0x486eee+_0x580cbb++,'VoiceExtensionId':_0x172671['id']});_0x5ca442['push']({'type':_0x490ce7[_0x41ae('0x3')][_0x41ae('0x34')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x172671[_0x41ae('0x5')],'exten':_0x172671[_0x41ae('0x6')],'priority':_0x490ce7[_0x41ae('0x31')][_0x41ae('0x36')]+_0x486eee+_0x580cbb++,'VoiceExtensionId':_0x172671['id']});}}}}for(var _0x5526a6=0x0;_0x5526a6<_0x490ce7['intervals'][_0x41ae('0x36')];_0x5526a6++){var _0x5c9f95=_0x486eee+_0x490ce7['intervals'][_0x41ae('0x36')];var _0x5233c6=_0x5526a6===_0x490ce7[_0x41ae('0x31')][_0x41ae('0x36')]-0x1?_0x486eee+_0x5ca442[_0x41ae('0x36')]+_0x4442d9[_0x41ae('0x36')]+0x2:_0x486eee+_0x5526a6+0x1;_0x5ca442['splice'](_0x5526a6,0x0,{'type':_0x172671[_0x41ae('0x3')],'app':_0x41ae('0x44'),'appdata':_0x490ce7['intervals'][_0x5526a6]+'?'+_0x172671[_0x41ae('0x5')]+_0x41ae('0x45')+_0x5c9f95+':'+_0x172671[_0x41ae('0x5')]+_0x41ae('0x45')+_0x5233c6,'exten':_0x172671[_0x41ae('0x6')],'context':_0x172671['context'],'priority':_0x486eee+_0x5526a6,'VoiceExtensionId':_0x172671['id']});}if(_0x490ce7[_0x41ae('0x3f')]===_0x41ae('0x46')){_0x490ce7[_0x41ae('0x47')]=_0x1d036e(_0x172671,_0x490ce7[_0x41ae('0x47')]);}if(_0x490ce7['appType']==='agi'){_0x5ca442['push']({'type':_0x490ce7[_0x41ae('0x3')][_0x41ae('0x34')](),'app':_0x41ae('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x172671[_0x41ae('0x5')],'exten':_0x172671[_0x41ae('0x6')],'priority':_0x490ce7['intervals']['length']+_0x486eee+_0x580cbb++,'VoiceExtensionId':_0x172671['id']});}_0x490ce7[_0x41ae('0x48')]=_0x5ca442[_0x41ae('0x36')]?_['last'](_0x5ca442)[_0x41ae('0x48')]+0x1:_0x486eee;_0x13bc47=_[_0x41ae('0x49')](_0x13bc47,_0x5ca442,[_0x490ce7],_0x4442d9);_0x486eee=_[_0x41ae('0x4a')](_0x13bc47)[_0x41ae('0x48')]+0x1;}return _0x366a65(_0x13bc47);})['catch'](function(_0x341d58){_0x1a05e2(_0x341d58);});});}return _0x6090e9['define'](_0x41ae('0x4b'),attributes,{'tableName':_0x41ae('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x24c3c7){var _0x1052db=this[_0x41ae('0x4d')]({'plain':!![]});var _0xa4e67b=_0x1052db['type']===_0x41ae('0xd')?_0x29b8b6(_0x1052db):_0x154f1f(_0x1052db);return _0x521d0b(_0x1052db,_0x24c3c7,_['last'](_0xa4e67b)[_0x41ae('0x48')]+0x1)[_0x41ae('0x2f')](function(_0x16a086){var _0x302e5d=_[_0x41ae('0x49')](_0xa4e67b,_0x16a086);_0x302e5d['push']({'type':_0x1052db[_0x41ae('0x3')],'app':_0x41ae('0x4e'),'exten':_0x1052db[_0x41ae('0x6')],'context':_0x1052db['context'],'priority':_[_0x41ae('0x4a')](_0x302e5d)[_0x41ae('0x48')]+0x1,'VoiceExtensionId':_0x1052db['id']});return _0x302e5d;});}}});};
\ No newline at end of file