Built motion from commit ecdc8e66766c75b1b08288b0ea13eb12d42606b4. Version 3.0.0...
[motion-next.git] / server / api / voiceExtension / voiceExtension.controller.js
index 2760cc2..a04ddc3 100644 (file)
@@ -1 +1 @@
-const a727_0xeb9b=['UserProfileSection','include','findAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','startsWith','length','includes','includeAll','send','json','bulkCreate','end','exten','attributes','sort','type','like','key','model','offset','ignore','filters','userProfileId','set','find','count','status','options','merge','role','fields','api','VoiceExtensionId','user','../../config/logger','keys','query','sequelize','OutboundRoutes','intersection','get','then','catch','lodash','mandatoryDisposition','sendStatus','UserProfileResource','create','stack','pick','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','name','error','limit','filter','VIRTUAL','InboundRoutes','fieldName','context','rawAttributes','VoiceExtension','InternalRoutes','concat','../../mysqldb','params','value','./voiceExtension.socket','nolimit','show','where','order','map','destroy','index','internal','rows','inbound','body','findOne','addApplications','description','cutdigits'];(function(_0xc924b0,_0xeb9beb){const _0x50deac=function(_0x501b57){while(--_0x501b57){_0xc924b0['push'](_0xc924b0['shift']());}};_0x50deac(++_0xeb9beb);}(a727_0xeb9b,0xc6));const a727_0x50de=function(_0xc924b0,_0xeb9beb){_0xc924b0=_0xc924b0-0x0;let _0x50deac=a727_0xeb9b[_0xc924b0];return _0x50deac;};const _0x440596=a727_0x50de;'use strict';const _=require(_0x440596('0xb')),qs=require('../../components/parsers/qs'),logger=require(_0x440596('0x2'))(_0x440596('0x52')),{getSocket}=require('../../rediscache'),socket=getSocket(),db=require(_0x440596('0x20'))['db'],{Op}=require(_0x440596('0x5'));require(_0x440596('0x23'))['register'](socket);function respondWithStatusCode(_0x501b57,_0xf033d2){return _0xf033d2=_0xf033d2||0xcc,function(_0x14858b){const _0x343496=a727_0x50de;if(_0x14858b)return _0x501b57[_0x343496('0xd')](_0xf033d2);return _0x501b57['status'](_0xf033d2)['end']();};}function respondWithResult(_0x59d264,_0x12fa95){return _0x12fa95=_0x12fa95||0xc8,function(_0x29a3c2){const _0x5f5222=a727_0x50de;if(_0x29a3c2)return _0x59d264[_0x5f5222('0x4d')](_0x12fa95)[_0x5f5222('0x3c')](_0x29a3c2);};}function respondWithFilteredResult(_0x4daadb,_0x2178ff){return function(_0x17782b){const _0x2db8df=a727_0x50de;if(_0x17782b){const _0x2f1af4=_0x17782b[_0x2db8df('0x4c')],_0x30c6e8=_0x2178ff['offset'];let _0x418d1c=_0x2178ff[_0x2db8df('0x46')]+_0x2178ff[_0x2db8df('0x16')],_0xf57766;return _0x418d1c>=_0x2f1af4?(_0x418d1c=_0x2f1af4,_0xf57766=0xc8):_0xf57766=0xce,_0x4daadb[_0x2db8df('0x4d')](_0xf57766),_0x4daadb[_0x2db8df('0x4a')]('Content-Range',_0x30c6e8+'-'+_0x418d1c+'/'+_0x2f1af4)['json'](_0x17782b);}return null;};}function removeEntity(_0x3d0e45){return function(_0xc0279c){const _0x115e52=a727_0x50de;if(_0xc0279c)return _0xc0279c['destroy']()[_0x115e52('0x9')](function(){const _0x2daa91=_0x115e52,_0xe3a440=_0xc0279c[_0x2daa91('0x8')]({'plain':!![]}),_0x20bb73=[{'name':'InboundRoutes','value':_0x2daa91('0x2d'),'ignore':![]},{'name':_0x2daa91('0x6'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x2daa91('0x2b'),'ignore':![]}],_0x3b8fe0=_(_0x20bb73)['filter'](_0x2daa91('0x47'))[_0x2daa91('0x28')]('value')[_0x2daa91('0x22')]();if(_[_0x2daa91('0x39')](_0x3b8fe0,_0xe3a440[_0x2daa91('0x42')]))return;const _0x200d8f=_[_0x2daa91('0x4b')](_0x20bb73,['value',_0xe3a440[_0x2daa91('0x42')]])[_0x2daa91('0x14')];return db[_0x2daa91('0xe')][_0x2daa91('0x29')]({'where':{'type':_0x200d8f,'resourceId':_0xe3a440['id']}})[_0x2daa91('0x9')](function(){return _0xc0279c;});})[_0x115e52('0x9')](function(){const _0x3bf67e=_0x115e52;_0x3d0e45['status'](0xcc)[_0x3bf67e('0x3e')]();});};}function handleEntityNotFound(_0x100483){return function(_0x1ab843){return!_0x1ab843&&_0x100483['sendStatus'](0x194),_0x1ab843;};}function handleError(_0x59f43,_0xd69e38){return _0xd69e38=_0xd69e38||0x1f4,function(_0x34107e){const _0x480fcb=a727_0x50de;logger[_0x480fcb('0x15')](_0x34107e[_0x480fcb('0x10')]),_0x34107e[_0x480fcb('0x14')]&&delete _0x34107e[_0x480fcb('0x14')],_0x59f43[_0x480fcb('0x4d')](_0xd69e38)[_0x480fcb('0x3b')](_0x34107e);};}exports[_0x440596('0x2a')]=function(_0x573582,_0x35a979){const _0x589b18=_0x440596;let _0x249249={};const _0x57e4ff={},_0x36aece={'count':0x0,'rows':[]},_0x2f89cb=_[_0x589b18('0x28')](db[_0x589b18('0x1d')][_0x589b18('0x1c')],function(_0x37d03a){const _0x141de1=_0x589b18;return{'name':_0x37d03a[_0x141de1('0x1a')],'type':_0x37d03a[_0x141de1('0x42')][_0x141de1('0x44')]};});_0x57e4ff[_0x589b18('0x45')]=_[_0x589b18('0x28')](_0x2f89cb,_0x589b18('0x14')),_0x57e4ff['query']=_[_0x589b18('0x3')](_0x573582[_0x589b18('0x4')]),_0x57e4ff[_0x589b18('0x48')]=_[_0x589b18('0x7')](_0x57e4ff['model'],_0x57e4ff[_0x589b18('0x4')]),_0x249249[_0x589b18('0x40')]=_[_0x589b18('0x7')](_0x57e4ff[_0x589b18('0x45')],qs[_0x589b18('0x51')](_0x573582[_0x589b18('0x4')][_0x589b18('0x51')])),_0x249249[_0x589b18('0x40')]=_0x249249[_0x589b18('0x40')][_0x589b18('0x38')]?_0x249249[_0x589b18('0x40')]:_0x57e4ff[_0x589b18('0x45')];typeof _0x573582[_0x589b18('0x4')][_0x589b18('0x24')]==='undefined'&&(_0x249249['limit']=qs[_0x589b18('0x16')](_0x573582[_0x589b18('0x4')][_0x589b18('0x16')]),_0x249249[_0x589b18('0x46')]=qs[_0x589b18('0x46')](_0x573582[_0x589b18('0x4')][_0x589b18('0x46')]));_0x249249[_0x589b18('0x27')]=qs[_0x589b18('0x41')](_0x573582['query'][_0x589b18('0x41')]),_0x249249['where']=qs[_0x589b18('0x48')](_[_0x589b18('0x11')](_0x573582['query'],_0x57e4ff[_0x589b18('0x48')]),_0x2f89cb);_0x573582[_0x589b18('0x4')]['filter']&&(_0x249249[_0x589b18('0x26')]=_[_0x589b18('0x4f')](_0x249249[_0x589b18('0x26')],{[Op['or']]:_['map'](_0x2f89cb,function(_0x5aac31){const _0x1a6f05=_0x589b18;if(_0x5aac31[_0x1a6f05('0x42')]!==_0x1a6f05('0x18')){const _0x15334e={};return _0x15334e[_0x5aac31[_0x1a6f05('0x14')]]={[Op[_0x1a6f05('0x43')]]:'%'+_0x573582[_0x1a6f05('0x4')][_0x1a6f05('0x17')]+'%'},_0x15334e;}})}));_0x249249=_[_0x589b18('0x4f')]({},_0x249249,_0x573582[_0x589b18('0x4e')]);const _0x50ef5b={'where':_0x249249[_0x589b18('0x26')]};return db[_0x589b18('0x1d')][_0x589b18('0x4c')](_0x50ef5b)[_0x589b18('0x9')](function(_0x2cca58){const _0x3499f4=_0x589b18;return _0x36aece[_0x3499f4('0x4c')]=_0x2cca58,_0x573582[_0x3499f4('0x4')][_0x3499f4('0x3a')]&&(_0x249249[_0x3499f4('0x34')]=[{'all':!![]}]),db[_0x3499f4('0x1d')][_0x3499f4('0x35')](_0x249249);})[_0x589b18('0x9')](function(_0x4f43be){const _0x380cc7=_0x589b18;return _0x36aece[_0x380cc7('0x2c')]=_0x4f43be,_0x36aece;})[_0x589b18('0x9')](respondWithFilteredResult(_0x35a979,_0x249249))[_0x589b18('0xa')](handleError(_0x35a979,null));},exports[_0x440596('0x25')]=function(_0x1b47b1,_0x1ff134){const _0x4b5088=_0x440596;let _0x1198a7={'raw':![],'where':{'id':_0x1b47b1['params']['id']}};const _0x175ad2={};return _0x175ad2[_0x4b5088('0x45')]=_['keys'](db[_0x4b5088('0x1d')][_0x4b5088('0x1c')]),_0x175ad2[_0x4b5088('0x4')]=_[_0x4b5088('0x3')](_0x1b47b1[_0x4b5088('0x4')]),_0x175ad2[_0x4b5088('0x48')]=_[_0x4b5088('0x7')](_0x175ad2[_0x4b5088('0x45')],_0x175ad2[_0x4b5088('0x4')]),_0x1198a7[_0x4b5088('0x40')]=_['intersection'](_0x175ad2['model'],qs[_0x4b5088('0x51')](_0x1b47b1['query']['fields'])),_0x1198a7[_0x4b5088('0x40')]=_0x1198a7[_0x4b5088('0x40')][_0x4b5088('0x38')]?_0x1198a7['attributes']:_0x175ad2[_0x4b5088('0x45')],_0x1b47b1[_0x4b5088('0x4')][_0x4b5088('0x3a')]&&(_0x1198a7[_0x4b5088('0x34')]=[{'all':!![]}]),_0x1198a7=_[_0x4b5088('0x4f')]({},_0x1198a7,_0x1b47b1[_0x4b5088('0x4e')]),db[_0x4b5088('0x1d')][_0x4b5088('0x2f')](_0x1198a7)[_0x4b5088('0x9')](handleEntityNotFound(_0x1ff134,null))[_0x4b5088('0x9')](respondWithResult(_0x1ff134,null))[_0x4b5088('0xa')](handleError(_0x1ff134,null));},exports['destroy']=function(_0x10ad56,_0x435f73){const _0x28f98e=_0x440596;return db[_0x28f98e('0x1d')][_0x28f98e('0x2f')]({'where':{'id':_0x10ad56[_0x28f98e('0x21')]['id']}})[_0x28f98e('0x9')](handleEntityNotFound(_0x435f73,null))[_0x28f98e('0x9')](removeEntity(_0x435f73,null))['catch'](handleError(_0x435f73,null));},exports[_0x440596('0xf')]=function(_0x1bf5ba,_0x3cb59b){const _0x19425e=_0x440596;return _0x1bf5ba['body'][_0x19425e('0x42')]==='outbound'&&!_[_0x19425e('0x37')](_0x1bf5ba[_0x19425e('0x2e')][_0x19425e('0x3f')],'_')&&(_0x1bf5ba[_0x19425e('0x2e')]['exten']='_'[_0x19425e('0x1f')](_0x1bf5ba[_0x19425e('0x2e')][_0x19425e('0x3f')])),db[_0x19425e('0x1d')][_0x19425e('0xf')](_0x1bf5ba[_0x19425e('0x2e')],{'raw':![]})[_0x19425e('0x9')](function(_0x2c0cfb){const _0x480853=_0x19425e,_0x3e235d=_0x1bf5ba[_0x480853('0x1')][_0x480853('0x8')]({'plain':!![]});if(!_0x3e235d)throw new Error(_0x480853('0x36'));if(_0x3e235d[_0x480853('0x50')]==='user'){const _0x3e948b=_0x2c0cfb['get']({'plain':!![]}),_0x467056=[{'name':_0x480853('0x19'),'value':'inbound'},{'name':_0x480853('0x6'),'value':'outbound'},{'name':_0x480853('0x1e'),'value':_0x480853('0x2b')}],_0xf57e53=_[_0x480853('0x4b')](_0x467056,[_0x480853('0x22'),_0x3e948b[_0x480853('0x42')]])[_0x480853('0x14')];return db[_0x480853('0x33')]['findOne']({'where':{'name':_0xf57e53,'userProfileId':_0x3e235d[_0x480853('0x49')]},'raw':!![]})['then'](function(_0xfc6373){const _0x24e6d1=_0x480853;return _0xfc6373&&_0xfc6373['autoAssociation']===0x0?db['UserProfileResource'][_0x24e6d1('0xf')]({'name':_0x3e948b[_0x24e6d1('0x14')],'resourceId':_0x3e948b['id'],'type':_0xfc6373[_0x24e6d1('0x14')],'sectionId':_0xfc6373['id']},{})[_0x24e6d1('0x9')](function(){return _0x2c0cfb;}):_0x2c0cfb;})[_0x480853('0xa')](function(_0x2df2ce){const _0x263d2f=_0x480853;logger['error'](_0x263d2f('0x12'),_0x2df2ce);throw _0x2df2ce;});}return _0x2c0cfb;})['then'](respondWithResult(_0x3cb59b,0xc9))['catch'](handleError(_0x3cb59b,null));},exports[_0x440596('0x13')]=function(_0x28427f,_0x3dc135){const _0x5e1a64=_0x440596;return _0x28427f[_0x5e1a64('0x2e')]['id']&&delete _0x28427f[_0x5e1a64('0x2e')]['id'],db[_0x5e1a64('0x1d')][_0x5e1a64('0x2f')]({'where':{'id':_0x28427f[_0x5e1a64('0x21')]['id']}})['then'](handleEntityNotFound(_0x3dc135,null))[_0x5e1a64('0x9')](function(_0x454361){const _0x2580de=_0x5e1a64;if(_0x454361)return db[_0x2580de('0x1d')][_0x2580de('0x13')](_[_0x2580de('0x11')](_0x28427f['body'],[_0x2580de('0x3f'),_0x2580de('0x1b'),_0x2580de('0x31'),'recordingFormat',_0x2580de('0x32'),_0x2580de('0xc')]),{'where':{'context':_0x454361['context'],'exten':_0x454361[_0x2580de('0x3f')]},'individualHooks':!![]})[_0x2580de('0x9')](function(_0x3bab27){return _0x3bab27;});return null;})[_0x5e1a64('0x9')](respondWithStatusCode(_0x3dc135,null))[_0x5e1a64('0xa')](handleError(_0x3dc135,null));},exports[_0x440596('0x30')]=function(_0x184959,_0x29c9c3){const _0x17635b=_0x440596;return db[_0x17635b('0x1d')][_0x17635b('0x2f')]({'where':{'id':_0x184959[_0x17635b('0x21')]['id']}})[_0x17635b('0x9')](handleEntityNotFound(_0x29c9c3,null))[_0x17635b('0x9')](function(_0x815bbf){const _0x10d0df=_0x17635b;if(_0x815bbf)return db[_0x10d0df('0x5')]['transaction'](function(_0x481a68){const _0x22ee3a=_0x10d0df;return db['VoiceExtension'][_0x22ee3a('0x29')]({'where':{'VoiceExtensionId':_0x184959['params']['id']},'transaction':_0x481a68})[_0x22ee3a('0x9')](function(){const _0x278e31=_0x22ee3a,_0x779e3f=_[_0x278e31('0x28')](_0x184959['body'],function(_0xb93031){const _0x257e2f=_0x278e31;return _0xb93031[_0x257e2f('0x0')]=_0x184959[_0x257e2f('0x21')]['id'],_0xb93031;});return db[_0x278e31('0x1d')][_0x278e31('0x3d')](_0x779e3f,{'transaction':_0x481a68});});})['then'](function(){const _0x11dc56=_0x10d0df;return db[_0x11dc56('0x1d')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x184959[_0x11dc56('0x21')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});})[_0x17635b('0x9')](respondWithResult(_0x29c9c3,null))[_0x17635b('0xa')](handleError(_0x29c9c3,null));};
\ No newline at end of file
+const a727_0x1443=['bulkCreate','length','VoiceExtensionId','keys','findAndCountAll','includeAll','error','index','model','filter','type','addApplications','body','api','sendStatus','UserProfileSection','count','get','UserProfileResource','stack','recordingFormat','./voiceExtension.socket','concat','map','show','exten','set','fieldName','fields','inbound','OutboundRoutes','offset','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','sequelize','nolimit','filters','../../mysqldb','like','find','where','params','outbound','../../config/logger','sort','then','VoiceExtension','Content-Range','create','query','value','order','name','status','transaction','findOne','destroy','pick','options','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','send','intersection','merge','undefined','update','role','includes','catch','json','cutdigits','user','InboundRoutes','rawAttributes','include','register','ignore','limit','internal','attributes','key'];(function(_0x2d5765,_0x144309){const _0x3845bc=function(_0x1eb407){while(--_0x1eb407){_0x2d5765['push'](_0x2d5765['shift']());}};_0x3845bc(++_0x144309);}(a727_0x1443,0xd7));const a727_0x3845=function(_0x2d5765,_0x144309){_0x2d5765=_0x2d5765-0x0;let _0x3845bc=a727_0x1443[_0x2d5765];return _0x3845bc;};const _0x3d0536=a727_0x3845;'use strict';const _=require('lodash'),qs=require('../../components/parsers/qs'),logger=require(_0x3d0536('0x47'))(_0x3d0536('0x29')),{getSocket}=require('../../rediscache'),socket=getSocket(),db=require(_0x3d0536('0x41'))['db'],{Op}=require(_0x3d0536('0x3e'));require(_0x3d0536('0x31'))[_0x3d0536('0x16')](socket);function respondWithStatusCode(_0x1eb407,_0x4aea76){return _0x4aea76=_0x4aea76||0xcc,function(_0x31b73e){if(_0x31b73e)return _0x1eb407['sendStatus'](_0x4aea76);return _0x1eb407['status'](_0x4aea76)['end']();};}function respondWithResult(_0x2ca7d3,_0x45aae4){return _0x45aae4=_0x45aae4||0xc8,function(_0x1712d6){const _0x2724f3=a727_0x3845;if(_0x1712d6)return _0x2ca7d3['status'](_0x45aae4)[_0x2724f3('0x10')](_0x1712d6);};}function respondWithFilteredResult(_0x21323d,_0xac0685){return function(_0x267206){const _0x44ae50=a727_0x3845;if(_0x267206){const _0xf3b256=_0x267206['count'],_0x1d6caa=_0xac0685[_0x44ae50('0x3b')];let _0x3799ee=_0xac0685[_0x44ae50('0x3b')]+_0xac0685[_0x44ae50('0x18')],_0xa84321;return _0x3799ee>=_0xf3b256?(_0x3799ee=_0xf3b256,_0xa84321=0xc8):_0xa84321=0xce,_0x21323d[_0x44ae50('0x0')](_0xa84321),_0x21323d[_0x44ae50('0x36')](_0x44ae50('0x4b'),_0x1d6caa+'-'+_0x3799ee+'/'+_0xf3b256)[_0x44ae50('0x10')](_0x267206);}return null;};}function removeEntity(_0x3f1ba4){return function(_0x345086){const _0x2c1f18=a727_0x3845;if(_0x345086)return _0x345086[_0x2c1f18('0x3')]()['then'](function(){const _0x29431e=_0x2c1f18,_0x945f28=_0x345086[_0x29431e('0x2d')]({'plain':!![]}),_0x5bebb4=[{'name':'InboundRoutes','value':_0x29431e('0x39'),'ignore':![]},{'name':_0x29431e('0x3a'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x29431e('0x19'),'ignore':![]}],_0x5700e8=_(_0x5bebb4)[_0x29431e('0x25')](_0x29431e('0x17'))['map'](_0x29431e('0x4e'))[_0x29431e('0x4e')]();if(_[_0x29431e('0xe')](_0x5700e8,_0x945f28['type']))return;const _0x481ccc=_[_0x29431e('0x43')](_0x5bebb4,[_0x29431e('0x4e'),_0x945f28['type']])['name'];return db[_0x29431e('0x2e')]['destroy']({'where':{'type':_0x481ccc,'resourceId':_0x945f28['id']}})['then'](function(){return _0x345086;});})[_0x2c1f18('0x49')](function(){const _0x351a82=_0x2c1f18;_0x3f1ba4[_0x351a82('0x0')](0xcc)['end']();});};}function handleEntityNotFound(_0x2922c8){return function(_0x47199f){const _0x217521=a727_0x3845;return!_0x47199f&&_0x2922c8[_0x217521('0x2a')](0x194),_0x47199f;};}function handleError(_0x77ea38,_0x5baaf8){return _0x5baaf8=_0x5baaf8||0x1f4,function(_0x47dcf8){const _0x54c148=a727_0x3845;logger[_0x54c148('0x22')](_0x47dcf8[_0x54c148('0x2f')]),_0x47dcf8[_0x54c148('0x50')]&&delete _0x47dcf8[_0x54c148('0x50')],_0x77ea38['status'](_0x5baaf8)[_0x54c148('0x8')](_0x47dcf8);};}exports[_0x3d0536('0x23')]=function(_0x2d4b52,_0x8e517b){const _0x6a3a0c=_0x3d0536;let _0x21f94f={};const _0x117d7a={},_0x401b07={'count':0x0,'rows':[]},_0x582cf8=_['map'](db[_0x6a3a0c('0x4a')][_0x6a3a0c('0x14')],function(_0x38a58a){const _0xb6b005=_0x6a3a0c;return{'name':_0x38a58a[_0xb6b005('0x37')],'type':_0x38a58a[_0xb6b005('0x26')][_0xb6b005('0x1b')]};});_0x117d7a['model']=_[_0x6a3a0c('0x33')](_0x582cf8,_0x6a3a0c('0x50')),_0x117d7a[_0x6a3a0c('0x4d')]=_[_0x6a3a0c('0x1f')](_0x2d4b52[_0x6a3a0c('0x4d')]),_0x117d7a[_0x6a3a0c('0x40')]=_[_0x6a3a0c('0x9')](_0x117d7a[_0x6a3a0c('0x24')],_0x117d7a[_0x6a3a0c('0x4d')]),_0x21f94f['attributes']=_[_0x6a3a0c('0x9')](_0x117d7a[_0x6a3a0c('0x24')],qs[_0x6a3a0c('0x38')](_0x2d4b52[_0x6a3a0c('0x4d')][_0x6a3a0c('0x38')])),_0x21f94f[_0x6a3a0c('0x1a')]=_0x21f94f[_0x6a3a0c('0x1a')][_0x6a3a0c('0x1d')]?_0x21f94f[_0x6a3a0c('0x1a')]:_0x117d7a[_0x6a3a0c('0x24')];typeof _0x2d4b52[_0x6a3a0c('0x4d')][_0x6a3a0c('0x3f')]===_0x6a3a0c('0xb')&&(_0x21f94f[_0x6a3a0c('0x18')]=qs[_0x6a3a0c('0x18')](_0x2d4b52[_0x6a3a0c('0x4d')][_0x6a3a0c('0x18')]),_0x21f94f['offset']=qs[_0x6a3a0c('0x3b')](_0x2d4b52['query'][_0x6a3a0c('0x3b')]));_0x21f94f[_0x6a3a0c('0x4f')]=qs[_0x6a3a0c('0x48')](_0x2d4b52[_0x6a3a0c('0x4d')][_0x6a3a0c('0x48')]),_0x21f94f[_0x6a3a0c('0x44')]=qs[_0x6a3a0c('0x40')](_[_0x6a3a0c('0x4')](_0x2d4b52[_0x6a3a0c('0x4d')],_0x117d7a[_0x6a3a0c('0x40')]),_0x582cf8);_0x2d4b52[_0x6a3a0c('0x4d')][_0x6a3a0c('0x25')]&&(_0x21f94f[_0x6a3a0c('0x44')]=_[_0x6a3a0c('0xa')](_0x21f94f[_0x6a3a0c('0x44')],{[Op['or']]:_['map'](_0x582cf8,function(_0x37aaed){const _0x121e1a=_0x6a3a0c;if(_0x37aaed[_0x121e1a('0x26')]!=='VIRTUAL'){const _0x1de926={};return _0x1de926[_0x37aaed[_0x121e1a('0x50')]]={[Op[_0x121e1a('0x42')]]:'%'+_0x2d4b52[_0x121e1a('0x4d')][_0x121e1a('0x25')]+'%'},_0x1de926;}})}));_0x21f94f=_[_0x6a3a0c('0xa')]({},_0x21f94f,_0x2d4b52[_0x6a3a0c('0x5')]);const _0x471221={'where':_0x21f94f[_0x6a3a0c('0x44')]};return db[_0x6a3a0c('0x4a')][_0x6a3a0c('0x2c')](_0x471221)['then'](function(_0x3d2675){const _0xe26083=_0x6a3a0c;return _0x401b07[_0xe26083('0x2c')]=_0x3d2675,_0x2d4b52[_0xe26083('0x4d')][_0xe26083('0x21')]&&(_0x21f94f[_0xe26083('0x15')]=[{'all':!![]}]),db[_0xe26083('0x4a')]['findAll'](_0x21f94f);})[_0x6a3a0c('0x49')](function(_0x28e159){return _0x401b07['rows']=_0x28e159,_0x401b07;})[_0x6a3a0c('0x49')](respondWithFilteredResult(_0x8e517b,_0x21f94f))[_0x6a3a0c('0xf')](handleError(_0x8e517b,null));},exports[_0x3d0536('0x34')]=function(_0x2db8e5,_0x5cd125){const _0x94e055=_0x3d0536;let _0x1296b6={'raw':![],'where':{'id':_0x2db8e5[_0x94e055('0x45')]['id']}};const _0x3e11b9={};return _0x3e11b9[_0x94e055('0x24')]=_['keys'](db[_0x94e055('0x4a')][_0x94e055('0x14')]),_0x3e11b9[_0x94e055('0x4d')]=_[_0x94e055('0x1f')](_0x2db8e5[_0x94e055('0x4d')]),_0x3e11b9['filters']=_[_0x94e055('0x9')](_0x3e11b9[_0x94e055('0x24')],_0x3e11b9['query']),_0x1296b6[_0x94e055('0x1a')]=_[_0x94e055('0x9')](_0x3e11b9[_0x94e055('0x24')],qs[_0x94e055('0x38')](_0x2db8e5[_0x94e055('0x4d')][_0x94e055('0x38')])),_0x1296b6[_0x94e055('0x1a')]=_0x1296b6[_0x94e055('0x1a')][_0x94e055('0x1d')]?_0x1296b6['attributes']:_0x3e11b9[_0x94e055('0x24')],_0x2db8e5[_0x94e055('0x4d')][_0x94e055('0x21')]&&(_0x1296b6['include']=[{'all':!![]}]),_0x1296b6=_[_0x94e055('0xa')]({},_0x1296b6,_0x2db8e5[_0x94e055('0x5')]),db[_0x94e055('0x4a')][_0x94e055('0x2')](_0x1296b6)[_0x94e055('0x49')](handleEntityNotFound(_0x5cd125,null))[_0x94e055('0x49')](respondWithResult(_0x5cd125,null))[_0x94e055('0xf')](handleError(_0x5cd125,null));},exports[_0x3d0536('0x3')]=function(_0x9c91e4,_0xc6f848){const _0x5c08e4=_0x3d0536;return db[_0x5c08e4('0x4a')][_0x5c08e4('0x2')]({'where':{'id':_0x9c91e4[_0x5c08e4('0x45')]['id']}})[_0x5c08e4('0x49')](handleEntityNotFound(_0xc6f848,null))['then'](removeEntity(_0xc6f848,null))[_0x5c08e4('0xf')](handleError(_0xc6f848,null));},exports[_0x3d0536('0x4c')]=function(_0x38ca5e,_0x50357b){const _0x12c1fd=_0x3d0536;return _0x38ca5e[_0x12c1fd('0x28')][_0x12c1fd('0x26')]===_0x12c1fd('0x46')&&!_['startsWith'](_0x38ca5e[_0x12c1fd('0x28')][_0x12c1fd('0x35')],'_')&&(_0x38ca5e[_0x12c1fd('0x28')]['exten']='_'[_0x12c1fd('0x32')](_0x38ca5e[_0x12c1fd('0x28')][_0x12c1fd('0x35')])),db[_0x12c1fd('0x4a')]['create'](_0x38ca5e[_0x12c1fd('0x28')],{'raw':![]})[_0x12c1fd('0x49')](function(_0x2f6f41){const _0x5993c0=_0x12c1fd,_0x329eea=_0x38ca5e['user'][_0x5993c0('0x2d')]({'plain':!![]});if(!_0x329eea)throw new Error(_0x5993c0('0x7'));if(_0x329eea[_0x5993c0('0xd')]===_0x5993c0('0x12')){const _0x3847ca=_0x2f6f41[_0x5993c0('0x2d')]({'plain':!![]}),_0x92c687=[{'name':_0x5993c0('0x13'),'value':'inbound'},{'name':_0x5993c0('0x3a'),'value':_0x5993c0('0x46')},{'name':'InternalRoutes','value':_0x5993c0('0x19')}],_0x10a17e=_[_0x5993c0('0x43')](_0x92c687,[_0x5993c0('0x4e'),_0x3847ca['type']])[_0x5993c0('0x50')];return db[_0x5993c0('0x2b')][_0x5993c0('0x2')]({'where':{'name':_0x10a17e,'userProfileId':_0x329eea['userProfileId']},'raw':!![]})[_0x5993c0('0x49')](function(_0x14a5f2){const _0x5ee458=_0x5993c0;return _0x14a5f2&&_0x14a5f2['autoAssociation']===0x0?db[_0x5ee458('0x2e')][_0x5ee458('0x4c')]({'name':_0x3847ca[_0x5ee458('0x50')],'resourceId':_0x3847ca['id'],'type':_0x14a5f2[_0x5ee458('0x50')],'sectionId':_0x14a5f2['id']},{})['then'](function(){return _0x2f6f41;}):_0x2f6f41;})[_0x5993c0('0xf')](function(_0x523b77){const _0x2c1d18=_0x5993c0;logger[_0x2c1d18('0x22')](_0x2c1d18('0x3c'),_0x523b77);throw _0x523b77;});}return _0x2f6f41;})[_0x12c1fd('0x49')](respondWithResult(_0x50357b,0xc9))[_0x12c1fd('0xf')](handleError(_0x50357b,null));},exports[_0x3d0536('0xc')]=function(_0x48e9aa,_0x2eeae6){const _0x24ada2=_0x3d0536;return _0x48e9aa[_0x24ada2('0x28')]['id']&&delete _0x48e9aa[_0x24ada2('0x28')]['id'],db[_0x24ada2('0x4a')][_0x24ada2('0x2')]({'where':{'id':_0x48e9aa[_0x24ada2('0x45')]['id']}})['then'](handleEntityNotFound(_0x2eeae6,null))[_0x24ada2('0x49')](function(_0x3d6520){const _0x7e2c7e=_0x24ada2;if(_0x3d6520)return db[_0x7e2c7e('0x4a')][_0x7e2c7e('0xc')](_[_0x7e2c7e('0x4')](_0x48e9aa[_0x7e2c7e('0x28')],['exten',_0x7e2c7e('0x3d'),_0x7e2c7e('0x6'),_0x7e2c7e('0x30'),_0x7e2c7e('0x11'),'mandatoryDisposition']),{'where':{'context':_0x3d6520['context'],'exten':_0x3d6520['exten']},'individualHooks':!![]})[_0x7e2c7e('0x49')](function(_0x394ca4){return _0x394ca4;});return null;})[_0x24ada2('0x49')](respondWithStatusCode(_0x2eeae6,null))[_0x24ada2('0xf')](handleError(_0x2eeae6,null));},exports[_0x3d0536('0x27')]=function(_0x4af4a2,_0x18a5c2){const _0x12ba26=_0x3d0536;return db['VoiceExtension'][_0x12ba26('0x2')]({'where':{'id':_0x4af4a2['params']['id']}})[_0x12ba26('0x49')](handleEntityNotFound(_0x18a5c2,null))['then'](function(_0x45b0aa){const _0x3495e6=_0x12ba26;if(_0x45b0aa)return db[_0x3495e6('0x3e')][_0x3495e6('0x1')](function(_0x2d8158){const _0x32ffc9=_0x3495e6;return db['VoiceExtension'][_0x32ffc9('0x3')]({'where':{'VoiceExtensionId':_0x4af4a2[_0x32ffc9('0x45')]['id']},'transaction':_0x2d8158})[_0x32ffc9('0x49')](function(){const _0x39f445=_0x32ffc9,_0x439d82=_['map'](_0x4af4a2[_0x39f445('0x28')],function(_0x37073e){const _0x576e99=_0x39f445;return _0x37073e[_0x576e99('0x1e')]=_0x4af4a2[_0x576e99('0x45')]['id'],_0x37073e;});return db[_0x39f445('0x4a')][_0x39f445('0x1c')](_0x439d82,{'transaction':_0x2d8158});});})['then'](function(){const _0x1ba780=_0x3495e6;return db['VoiceExtension'][_0x1ba780('0x20')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4af4a2[_0x1ba780('0x45')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});})[_0x12ba26('0x49')](respondWithResult(_0x18a5c2,null))['catch'](handleError(_0x18a5c2,null));};
\ No newline at end of file