Built motion from commit a9fb64cc6defd8fb3a5cc199221f878e91c0e969. Version 3.0.0...
[motion-next.git] / server / api / voiceExtension / voiceExtension.controller.js
index 56a15e9..1e00740 100644 (file)
@@ -1 +1 @@
-const a727_0x2a0a=['count','internal','sequelize','userProfileId','includeAll','order','outbound','UserProfileResource','../../config/logger','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','query','VoiceExtension','./voiceExtension.socket','length','VoiceExtensionId','fields','bulkCreate','addApplications','keys','mandatoryDisposition','nolimit','findOne','UserProfileSection','options','where','merge','destroy','inbound','OutboundRoutes','context','attributes','like','role','autoAssociation','create','cutdigits','fieldName','set','update','sendStatus','find','type','status','filter','description','offset','name','stack','limit','body','end','include','cast(priority\x20as\x20unsigned)','startsWith','../../rediscache','exten','findAll','ignore','rawAttributes','error','map','sort','json','key','undefined','get','findAndCountAll','lodash','Content-Range','value','pick','../../components/parsers/qs','then','model','InboundRoutes','includes','params','filters','intersection','catch','user'];(function(_0x59ca50,_0x2a0afc){const _0x42e436=function(_0x319672){while(--_0x319672){_0x59ca50['push'](_0x59ca50['shift']());}};_0x42e436(++_0x2a0afc);}(a727_0x2a0a,0x1e0));const a727_0x42e4=function(_0x59ca50,_0x2a0afc){_0x59ca50=_0x59ca50-0x0;let _0x42e436=a727_0x2a0a[_0x59ca50];return _0x42e436;};const _0x2eb8ef=a727_0x42e4;'use strict';const _=require(_0x2eb8ef('0x49')),qs=require(_0x2eb8ef('0x4d')),logger=require(_0x2eb8ef('0xe'))('api'),{getSocket}=require(_0x2eb8ef('0x3c')),socket=getSocket(),db=require('../../mysqldb')['db'],{Op}=require(_0x2eb8ef('0x8'));require(_0x2eb8ef('0x12'))['register'](socket);function respondWithStatusCode(_0x319672,_0x3b128e){return _0x3b128e=_0x3b128e||0xcc,function(_0x3b74d5){const _0x57b37c=a727_0x42e4;if(_0x3b74d5)return _0x319672[_0x57b37c('0x2d')](_0x3b128e);return _0x319672[_0x57b37c('0x30')](_0x3b128e)['end']();};}function respondWithResult(_0x275b71,_0x5bd20d){return _0x5bd20d=_0x5bd20d||0xc8,function(_0x2fa2aa){const _0x1d2446=a727_0x42e4;if(_0x2fa2aa)return _0x275b71[_0x1d2446('0x30')](_0x5bd20d)['json'](_0x2fa2aa);};}function respondWithFilteredResult(_0x21d8e7,_0x80fec4){return function(_0x657e7c){const _0x114d4b=a727_0x42e4;if(_0x657e7c){const _0x8ec840=_0x657e7c['count'],_0x36422e=_0x80fec4[_0x114d4b('0x33')];let _0x5480a3=_0x80fec4[_0x114d4b('0x33')]+_0x80fec4[_0x114d4b('0x36')],_0x2506c0;return _0x5480a3>=_0x8ec840?(_0x5480a3=_0x8ec840,_0x2506c0=0xc8):_0x2506c0=0xce,_0x21d8e7[_0x114d4b('0x30')](_0x2506c0),_0x21d8e7[_0x114d4b('0x2b')](_0x114d4b('0x4a'),_0x36422e+'-'+_0x5480a3+'/'+_0x8ec840)[_0x114d4b('0x44')](_0x657e7c);}return null;};}function removeEntity(_0x29d8da){return function(_0x10beb2){const _0x45c306=a727_0x42e4;if(_0x10beb2)return _0x10beb2['destroy']()[_0x45c306('0x4e')](function(){const _0x3b1fdd=_0x45c306,_0x34f13a=_0x10beb2['get']({'plain':!![]}),_0x30c974=[{'name':_0x3b1fdd('0x50'),'value':'inbound','ignore':![]},{'name':_0x3b1fdd('0x22'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x3b1fdd('0x7'),'ignore':![]}],_0xdc0ec8=_(_0x30c974)[_0x3b1fdd('0x31')](_0x3b1fdd('0x3f'))[_0x3b1fdd('0x42')]('value')[_0x3b1fdd('0x4b')]();if(_[_0x3b1fdd('0x0')](_0xdc0ec8,_0x34f13a[_0x3b1fdd('0x2f')]))return;const _0x6d5dd5=_[_0x3b1fdd('0x2e')](_0x30c974,[_0x3b1fdd('0x4b'),_0x34f13a[_0x3b1fdd('0x2f')]])[_0x3b1fdd('0x34')];return db[_0x3b1fdd('0xd')][_0x3b1fdd('0x20')]({'where':{'type':_0x6d5dd5,'resourceId':_0x34f13a['id']}})[_0x3b1fdd('0x4e')](function(){return _0x10beb2;});})[_0x45c306('0x4e')](function(){const _0x1b8b1f=_0x45c306;_0x29d8da[_0x1b8b1f('0x30')](0xcc)[_0x1b8b1f('0x38')]();});};}function handleEntityNotFound(_0x13cb68){return function(_0x269ddc){return!_0x269ddc&&_0x13cb68['sendStatus'](0x194),_0x269ddc;};}function handleError(_0x502a0d,_0x474e07){return _0x474e07=_0x474e07||0x1f4,function(_0xb7de00){const _0x48e811=a727_0x42e4;logger[_0x48e811('0x41')](_0xb7de00[_0x48e811('0x35')]),_0xb7de00['name']&&delete _0xb7de00['name'],_0x502a0d[_0x48e811('0x30')](_0x474e07)['send'](_0xb7de00);};}exports['index']=function(_0x2b4914,_0x41b5a2){const _0x34f5cd=_0x2eb8ef;let _0x339f92={};const _0x53eb4d={},_0x66be5f={'count':0x0,'rows':[]},_0x3dcaae=_['map'](db[_0x34f5cd('0x11')][_0x34f5cd('0x40')],function(_0x4f97cf){const _0x3732dc=_0x34f5cd;return{'name':_0x4f97cf[_0x3732dc('0x2a')],'type':_0x4f97cf[_0x3732dc('0x2f')][_0x3732dc('0x45')]};});_0x53eb4d[_0x34f5cd('0x4f')]=_['map'](_0x3dcaae,_0x34f5cd('0x34')),_0x53eb4d['query']=_[_0x34f5cd('0x18')](_0x2b4914[_0x34f5cd('0x10')]),_0x53eb4d[_0x34f5cd('0x2')]=_['intersection'](_0x53eb4d[_0x34f5cd('0x4f')],_0x53eb4d[_0x34f5cd('0x10')]),_0x339f92['attributes']=_[_0x34f5cd('0x3')](_0x53eb4d[_0x34f5cd('0x4f')],qs[_0x34f5cd('0x15')](_0x2b4914['query']['fields'])),_0x339f92['attributes']=_0x339f92['attributes'][_0x34f5cd('0x13')]?_0x339f92['attributes']:_0x53eb4d[_0x34f5cd('0x4f')];typeof _0x2b4914[_0x34f5cd('0x10')][_0x34f5cd('0x1a')]===_0x34f5cd('0x46')&&(_0x339f92[_0x34f5cd('0x36')]=qs[_0x34f5cd('0x36')](_0x2b4914[_0x34f5cd('0x10')][_0x34f5cd('0x36')]),_0x339f92[_0x34f5cd('0x33')]=qs['offset'](_0x2b4914[_0x34f5cd('0x10')][_0x34f5cd('0x33')]));_0x339f92[_0x34f5cd('0xb')]=qs[_0x34f5cd('0x43')](_0x2b4914[_0x34f5cd('0x10')]['sort']),_0x339f92['where']=qs[_0x34f5cd('0x2')](_['pick'](_0x2b4914[_0x34f5cd('0x10')],_0x53eb4d[_0x34f5cd('0x2')]),_0x3dcaae);_0x2b4914[_0x34f5cd('0x10')][_0x34f5cd('0x31')]&&(_0x339f92[_0x34f5cd('0x1e')]=_[_0x34f5cd('0x1f')](_0x339f92[_0x34f5cd('0x1e')],{[Op['or']]:_[_0x34f5cd('0x42')](_0x3dcaae,function(_0x31a408){const _0x4542ed=_0x34f5cd;if(_0x31a408[_0x4542ed('0x2f')]!=='VIRTUAL'){const _0x2d7f13={};return _0x2d7f13[_0x31a408[_0x4542ed('0x34')]]={[Op[_0x4542ed('0x25')]]:'%'+_0x2b4914[_0x4542ed('0x10')][_0x4542ed('0x31')]+'%'},_0x2d7f13;}})}));_0x339f92=_[_0x34f5cd('0x1f')]({},_0x339f92,_0x2b4914[_0x34f5cd('0x1d')]);const _0x1417e8={'where':_0x339f92[_0x34f5cd('0x1e')]};return db[_0x34f5cd('0x11')][_0x34f5cd('0x6')](_0x1417e8)[_0x34f5cd('0x4e')](function(_0x172f73){const _0x26e167=_0x34f5cd;return _0x66be5f[_0x26e167('0x6')]=_0x172f73,_0x2b4914[_0x26e167('0x10')][_0x26e167('0xa')]&&(_0x339f92['include']=[{'all':!![]}]),db[_0x26e167('0x11')][_0x26e167('0x3e')](_0x339f92);})[_0x34f5cd('0x4e')](function(_0x4da760){return _0x66be5f['rows']=_0x4da760,_0x66be5f;})[_0x34f5cd('0x4e')](respondWithFilteredResult(_0x41b5a2,_0x339f92))['catch'](handleError(_0x41b5a2,null));},exports['show']=function(_0x5a23ae,_0x2f2b38){const _0x2a9ebd=_0x2eb8ef;let _0x148f9f={'raw':![],'where':{'id':_0x5a23ae[_0x2a9ebd('0x1')]['id']}};const _0x4f521b={};return _0x4f521b['model']=_[_0x2a9ebd('0x18')](db[_0x2a9ebd('0x11')][_0x2a9ebd('0x40')]),_0x4f521b[_0x2a9ebd('0x10')]=_[_0x2a9ebd('0x18')](_0x5a23ae['query']),_0x4f521b[_0x2a9ebd('0x2')]=_['intersection'](_0x4f521b[_0x2a9ebd('0x4f')],_0x4f521b[_0x2a9ebd('0x10')]),_0x148f9f[_0x2a9ebd('0x24')]=_['intersection'](_0x4f521b[_0x2a9ebd('0x4f')],qs[_0x2a9ebd('0x15')](_0x5a23ae['query'][_0x2a9ebd('0x15')])),_0x148f9f[_0x2a9ebd('0x24')]=_0x148f9f['attributes'][_0x2a9ebd('0x13')]?_0x148f9f[_0x2a9ebd('0x24')]:_0x4f521b[_0x2a9ebd('0x4f')],_0x5a23ae[_0x2a9ebd('0x10')]['includeAll']&&(_0x148f9f[_0x2a9ebd('0x39')]=[{'all':!![]}]),_0x148f9f=_[_0x2a9ebd('0x1f')]({},_0x148f9f,_0x5a23ae['options']),db['VoiceExtension'][_0x2a9ebd('0x1b')](_0x148f9f)[_0x2a9ebd('0x4e')](handleEntityNotFound(_0x2f2b38,null))[_0x2a9ebd('0x4e')](respondWithResult(_0x2f2b38,null))[_0x2a9ebd('0x4')](handleError(_0x2f2b38,null));},exports[_0x2eb8ef('0x20')]=function(_0x1e9953,_0x27437d){const _0x28620f=_0x2eb8ef;return db[_0x28620f('0x11')]['findOne']({'where':{'id':_0x1e9953[_0x28620f('0x1')]['id']}})['then'](handleEntityNotFound(_0x27437d,null))[_0x28620f('0x4e')](removeEntity(_0x27437d,null))[_0x28620f('0x4')](handleError(_0x27437d,null));},exports[_0x2eb8ef('0x28')]=function(_0x18270a,_0x3de56a){const _0x54196f=_0x2eb8ef;return _0x18270a[_0x54196f('0x37')][_0x54196f('0x2f')]===_0x54196f('0xc')&&!_[_0x54196f('0x3b')](_0x18270a[_0x54196f('0x37')][_0x54196f('0x3d')],'_')&&(_0x18270a[_0x54196f('0x37')][_0x54196f('0x3d')]='_'['concat'](_0x18270a[_0x54196f('0x37')][_0x54196f('0x3d')])),db[_0x54196f('0x11')][_0x54196f('0x28')](_0x18270a['body'],{'raw':![]})['then'](function(_0x3ff4a1){const _0x5e1256=_0x54196f,_0x4bbfdf=_0x18270a[_0x5e1256('0x5')][_0x5e1256('0x47')]({'plain':!![]});if(!_0x4bbfdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bbfdf[_0x5e1256('0x26')]===_0x5e1256('0x5')){const _0x19a4c2=_0x3ff4a1[_0x5e1256('0x47')]({'plain':!![]}),_0x413f40=[{'name':_0x5e1256('0x50'),'value':_0x5e1256('0x21')},{'name':_0x5e1256('0x22'),'value':_0x5e1256('0xc')},{'name':'InternalRoutes','value':_0x5e1256('0x7')}],_0x4ebe58=_[_0x5e1256('0x2e')](_0x413f40,[_0x5e1256('0x4b'),_0x19a4c2['type']])['name'];return db[_0x5e1256('0x1c')][_0x5e1256('0x1b')]({'where':{'name':_0x4ebe58,'userProfileId':_0x4bbfdf[_0x5e1256('0x9')]},'raw':!![]})[_0x5e1256('0x4e')](function(_0x3d90fc){const _0x2c5ef4=_0x5e1256;return _0x3d90fc&&_0x3d90fc[_0x2c5ef4('0x27')]===0x0?db[_0x2c5ef4('0xd')][_0x2c5ef4('0x28')]({'name':_0x19a4c2['name'],'resourceId':_0x19a4c2['id'],'type':_0x3d90fc[_0x2c5ef4('0x34')],'sectionId':_0x3d90fc['id']},{})[_0x2c5ef4('0x4e')](function(){return _0x3ff4a1;}):_0x3ff4a1;})[_0x5e1256('0x4')](function(_0x73d450){const _0x23ea89=_0x5e1256;logger[_0x23ea89('0x41')](_0x23ea89('0xf'),_0x73d450);throw _0x73d450;});}return _0x3ff4a1;})[_0x54196f('0x4e')](respondWithResult(_0x3de56a,0xc9))[_0x54196f('0x4')](handleError(_0x3de56a,null));},exports[_0x2eb8ef('0x2c')]=function(_0x276f41,_0x16cc49){const _0x5dfeee=_0x2eb8ef;return _0x276f41[_0x5dfeee('0x37')]['id']&&delete _0x276f41[_0x5dfeee('0x37')]['id'],db[_0x5dfeee('0x11')][_0x5dfeee('0x1b')]({'where':{'id':_0x276f41[_0x5dfeee('0x1')]['id']}})[_0x5dfeee('0x4e')](handleEntityNotFound(_0x16cc49,null))[_0x5dfeee('0x4e')](function(_0x17f34a){const _0x59b3d8=_0x5dfeee;if(_0x17f34a)return db[_0x59b3d8('0x11')][_0x59b3d8('0x2c')](_[_0x59b3d8('0x4c')](_0x276f41[_0x59b3d8('0x37')],[_0x59b3d8('0x3d'),_0x59b3d8('0x23'),_0x59b3d8('0x32'),'recordingFormat',_0x59b3d8('0x29'),_0x59b3d8('0x19')]),{'where':{'context':_0x17f34a[_0x59b3d8('0x23')],'exten':_0x17f34a[_0x59b3d8('0x3d')]},'individualHooks':!![]})['then'](function(_0x4c64f9){return _0x4c64f9;});return null;})[_0x5dfeee('0x4e')](respondWithStatusCode(_0x16cc49,null))[_0x5dfeee('0x4')](handleError(_0x16cc49,null));},exports[_0x2eb8ef('0x17')]=function(_0x4e22d7,_0xf276bb){const _0x109dea=_0x2eb8ef;return db[_0x109dea('0x11')][_0x109dea('0x1b')]({'where':{'id':_0x4e22d7[_0x109dea('0x1')]['id']}})[_0x109dea('0x4e')](handleEntityNotFound(_0xf276bb,null))['then'](function(_0x10ada0){const _0x4e8f7c=_0x109dea;if(_0x10ada0)return db[_0x4e8f7c('0x8')]['transaction'](function(_0x30d9c7){const _0x1bf1fb=_0x4e8f7c;return db[_0x1bf1fb('0x11')][_0x1bf1fb('0x20')]({'where':{'VoiceExtensionId':_0x4e22d7[_0x1bf1fb('0x1')]['id']},'transaction':_0x30d9c7})[_0x1bf1fb('0x4e')](function(){const _0x31fd99=_0x1bf1fb,_0x598de4=_[_0x31fd99('0x42')](_0x4e22d7[_0x31fd99('0x37')],function(_0x92dcae){const _0x102cb8=_0x31fd99;return _0x92dcae[_0x102cb8('0x14')]=_0x4e22d7[_0x102cb8('0x1')]['id'],_0x92dcae;});return db[_0x31fd99('0x11')][_0x31fd99('0x16')](_0x598de4,{'transaction':_0x30d9c7});});})[_0x4e8f7c('0x4e')](function(){const _0x47ca1c=_0x4e8f7c;return db['VoiceExtension'][_0x47ca1c('0x48')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4e22d7['params']['id']},'order':_0x47ca1c('0x3a')});});})[_0x109dea('0x4e')](respondWithResult(_0xf276bb,null))['catch'](handleError(_0xf276bb,null));};
\ No newline at end of file
+const a727_0x2559=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','UserProfileResource','lodash','offset','json','InternalRoutes','findAll','where','get','UserProfileSection','user','filter','exten','concat','params','show','attributes','fieldName','rows','fields','value','then','model','send','error','intersection','register','update','inbound','findOne','query','ignore','recordingFormat','type','transaction','name','count','sequelize','startsWith','length','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','limit','includes','merge','sort','autoAssociation','map','set','stack','context','includeAll','../../rediscache','role','keys','nolimit','cast(priority\x20as\x20unsigned)','find','status','body','index','sendStatus','create','InboundRoutes','internal','findAndCountAll','options','destroy','like','../../config/logger','pick','end','rawAttributes','catch','key','order','OutboundRoutes','VoiceExtension','outbound','cutdigits','filters','bulkCreate'];(function(_0x490a2b,_0x2559ed){const _0x5016d6=function(_0x4a7f70){while(--_0x4a7f70){_0x490a2b['push'](_0x490a2b['shift']());}};_0x5016d6(++_0x2559ed);}(a727_0x2559,0x17d));const a727_0x5016=function(_0x490a2b,_0x2559ed){_0x490a2b=_0x490a2b-0x0;let _0x5016d6=a727_0x2559[_0x490a2b];return _0x5016d6;};const _0x4b31a8=a727_0x5016;'use strict';const _=require(_0x4b31a8('0x1f')),qs=require('../../components/parsers/qs'),logger=require(_0x4b31a8('0x10'))('api'),{getSocket}=require(_0x4b31a8('0x51')),socket=getSocket(),db=require('../../mysqldb')['db'],{Op}=require('sequelize');require('./voiceExtension.socket')[_0x4b31a8('0x37')](socket);function respondWithStatusCode(_0x4a7f70,_0x1535f8){return _0x1535f8=_0x1535f8||0xcc,function(_0x208e92){const _0x46cb86=a727_0x5016;if(_0x208e92)return _0x4a7f70[_0x46cb86('0x8')](_0x1535f8);return _0x4a7f70[_0x46cb86('0x5')](_0x1535f8)[_0x46cb86('0x12')]();};}function respondWithResult(_0xdc5221,_0xa7664f){return _0xa7664f=_0xa7664f||0xc8,function(_0x535a25){const _0x1d248b=a727_0x5016;if(_0x535a25)return _0xdc5221[_0x1d248b('0x5')](_0xa7664f)['json'](_0x535a25);};}function respondWithFilteredResult(_0x384ca6,_0x24664a){return function(_0x48c629){const _0x34c666=a727_0x5016;if(_0x48c629){const _0x136f69=_0x48c629['count'],_0x59a675=_0x24664a[_0x34c666('0x20')];let _0x264f90=_0x24664a[_0x34c666('0x20')]+_0x24664a['limit'],_0x542e13;return _0x264f90>=_0x136f69?(_0x264f90=_0x136f69,_0x542e13=0xc8):_0x542e13=0xce,_0x384ca6['status'](_0x542e13),_0x384ca6[_0x34c666('0x4d')]('Content-Range',_0x59a675+'-'+_0x264f90+'/'+_0x136f69)[_0x34c666('0x21')](_0x48c629);}return null;};}function removeEntity(_0x441663){return function(_0x587298){const _0x4881c0=a727_0x5016;if(_0x587298)return _0x587298[_0x4881c0('0xe')]()[_0x4881c0('0x32')](function(){const _0xb14b59=_0x4881c0,_0x93050a=_0x587298['get']({'plain':!![]}),_0x2bba4a=[{'name':'InboundRoutes','value':_0xb14b59('0x39'),'ignore':![]},{'name':_0xb14b59('0x17'),'value':_0xb14b59('0x19'),'ignore':![]},{'name':_0xb14b59('0x22'),'value':_0xb14b59('0xb'),'ignore':![]}],_0x115bd8=_(_0x2bba4a)[_0xb14b59('0x28')](_0xb14b59('0x3c'))[_0xb14b59('0x4c')](_0xb14b59('0x31'))[_0xb14b59('0x31')]();if(_[_0xb14b59('0x48')](_0x115bd8,_0x93050a[_0xb14b59('0x3e')]))return;const _0x2d34c1=_[_0xb14b59('0x4')](_0x2bba4a,[_0xb14b59('0x31'),_0x93050a[_0xb14b59('0x3e')]])[_0xb14b59('0x40')];return db['UserProfileResource'][_0xb14b59('0xe')]({'where':{'type':_0x2d34c1,'resourceId':_0x93050a['id']}})[_0xb14b59('0x32')](function(){return _0x587298;});})['then'](function(){const _0x657447=_0x4881c0;_0x441663[_0x657447('0x5')](0xcc)['end']();});};}function handleEntityNotFound(_0x5eccc9){return function(_0xf0b5a7){const _0x65b97=a727_0x5016;return!_0xf0b5a7&&_0x5eccc9[_0x65b97('0x8')](0x194),_0xf0b5a7;};}function handleError(_0x1b5934,_0x7c101f){return _0x7c101f=_0x7c101f||0x1f4,function(_0x2694da){const _0x1c675f=a727_0x5016;logger['error'](_0x2694da[_0x1c675f('0x4e')]),_0x2694da[_0x1c675f('0x40')]&&delete _0x2694da[_0x1c675f('0x40')],_0x1b5934[_0x1c675f('0x5')](_0x7c101f)[_0x1c675f('0x34')](_0x2694da);};}exports[_0x4b31a8('0x7')]=function(_0x48f645,_0x59e9a2){const _0xf98140=_0x4b31a8;let _0xd57ea2={};const _0x1a9518={},_0x225ccc={'count':0x0,'rows':[]},_0x45503a=_[_0xf98140('0x4c')](db[_0xf98140('0x18')]['rawAttributes'],function(_0x414f9e){const _0x9990e7=_0xf98140;return{'name':_0x414f9e[_0x9990e7('0x2e')],'type':_0x414f9e['type'][_0x9990e7('0x15')]};});_0x1a9518[_0xf98140('0x33')]=_[_0xf98140('0x4c')](_0x45503a,'name'),_0x1a9518[_0xf98140('0x3b')]=_[_0xf98140('0x1')](_0x48f645['query']),_0x1a9518[_0xf98140('0x1b')]=_[_0xf98140('0x36')](_0x1a9518[_0xf98140('0x33')],_0x1a9518['query']),_0xd57ea2['attributes']=_[_0xf98140('0x36')](_0x1a9518[_0xf98140('0x33')],qs['fields'](_0x48f645[_0xf98140('0x3b')][_0xf98140('0x30')])),_0xd57ea2[_0xf98140('0x2d')]=_0xd57ea2[_0xf98140('0x2d')][_0xf98140('0x44')]?_0xd57ea2[_0xf98140('0x2d')]:_0x1a9518[_0xf98140('0x33')];typeof _0x48f645['query'][_0xf98140('0x2')]==='undefined'&&(_0xd57ea2[_0xf98140('0x47')]=qs['limit'](_0x48f645[_0xf98140('0x3b')]['limit']),_0xd57ea2[_0xf98140('0x20')]=qs[_0xf98140('0x20')](_0x48f645['query'][_0xf98140('0x20')]));_0xd57ea2[_0xf98140('0x16')]=qs[_0xf98140('0x4a')](_0x48f645['query']['sort']),_0xd57ea2['where']=qs[_0xf98140('0x1b')](_[_0xf98140('0x11')](_0x48f645['query'],_0x1a9518[_0xf98140('0x1b')]),_0x45503a);_0x48f645['query']['filter']&&(_0xd57ea2[_0xf98140('0x24')]=_[_0xf98140('0x49')](_0xd57ea2[_0xf98140('0x24')],{[Op['or']]:_[_0xf98140('0x4c')](_0x45503a,function(_0x438fcd){const _0x31a493=_0xf98140;if(_0x438fcd[_0x31a493('0x3e')]!=='VIRTUAL'){const _0x520c0d={};return _0x520c0d[_0x438fcd['name']]={[Op[_0x31a493('0xf')]]:'%'+_0x48f645[_0x31a493('0x3b')][_0x31a493('0x28')]+'%'},_0x520c0d;}})}));_0xd57ea2=_[_0xf98140('0x49')]({},_0xd57ea2,_0x48f645['options']);const _0x3166cb={'where':_0xd57ea2[_0xf98140('0x24')]};return db[_0xf98140('0x18')][_0xf98140('0x41')](_0x3166cb)[_0xf98140('0x32')](function(_0x41724e){const _0x141113=_0xf98140;return _0x225ccc[_0x141113('0x41')]=_0x41724e,_0x48f645[_0x141113('0x3b')][_0x141113('0x50')]&&(_0xd57ea2['include']=[{'all':!![]}]),db[_0x141113('0x18')][_0x141113('0x23')](_0xd57ea2);})[_0xf98140('0x32')](function(_0x53fd2a){const _0x2cd7b0=_0xf98140;return _0x225ccc[_0x2cd7b0('0x2f')]=_0x53fd2a,_0x225ccc;})[_0xf98140('0x32')](respondWithFilteredResult(_0x59e9a2,_0xd57ea2))['catch'](handleError(_0x59e9a2,null));},exports[_0x4b31a8('0x2c')]=function(_0x4d95b9,_0x2f2964){const _0x5ab731=_0x4b31a8;let _0x2d7d79={'raw':![],'where':{'id':_0x4d95b9[_0x5ab731('0x2b')]['id']}};const _0x5b5f88={};return _0x5b5f88[_0x5ab731('0x33')]=_[_0x5ab731('0x1')](db['VoiceExtension'][_0x5ab731('0x13')]),_0x5b5f88['query']=_['keys'](_0x4d95b9['query']),_0x5b5f88[_0x5ab731('0x1b')]=_[_0x5ab731('0x36')](_0x5b5f88[_0x5ab731('0x33')],_0x5b5f88['query']),_0x2d7d79['attributes']=_[_0x5ab731('0x36')](_0x5b5f88[_0x5ab731('0x33')],qs[_0x5ab731('0x30')](_0x4d95b9[_0x5ab731('0x3b')]['fields'])),_0x2d7d79[_0x5ab731('0x2d')]=_0x2d7d79[_0x5ab731('0x2d')][_0x5ab731('0x44')]?_0x2d7d79[_0x5ab731('0x2d')]:_0x5b5f88[_0x5ab731('0x33')],_0x4d95b9[_0x5ab731('0x3b')]['includeAll']&&(_0x2d7d79['include']=[{'all':!![]}]),_0x2d7d79=_[_0x5ab731('0x49')]({},_0x2d7d79,_0x4d95b9[_0x5ab731('0xd')]),db[_0x5ab731('0x18')]['findOne'](_0x2d7d79)[_0x5ab731('0x32')](handleEntityNotFound(_0x2f2964,null))['then'](respondWithResult(_0x2f2964,null))[_0x5ab731('0x14')](handleError(_0x2f2964,null));},exports[_0x4b31a8('0xe')]=function(_0x338b30,_0x578647){const _0x397181=_0x4b31a8;return db[_0x397181('0x18')][_0x397181('0x3a')]({'where':{'id':_0x338b30[_0x397181('0x2b')]['id']}})[_0x397181('0x32')](handleEntityNotFound(_0x578647,null))[_0x397181('0x32')](removeEntity(_0x578647,null))[_0x397181('0x14')](handleError(_0x578647,null));},exports[_0x4b31a8('0x9')]=function(_0x5ba3ef,_0x23b6b3){const _0x102a10=_0x4b31a8;return _0x5ba3ef[_0x102a10('0x6')][_0x102a10('0x3e')]==='outbound'&&!_[_0x102a10('0x43')](_0x5ba3ef[_0x102a10('0x6')]['exten'],'_')&&(_0x5ba3ef[_0x102a10('0x6')][_0x102a10('0x29')]='_'[_0x102a10('0x2a')](_0x5ba3ef[_0x102a10('0x6')][_0x102a10('0x29')])),db[_0x102a10('0x18')]['create'](_0x5ba3ef[_0x102a10('0x6')],{'raw':![]})['then'](function(_0x14ebe0){const _0x1526a7=_0x102a10,_0x2fb7d5=_0x5ba3ef[_0x1526a7('0x27')][_0x1526a7('0x25')]({'plain':!![]});if(!_0x2fb7d5)throw new Error(_0x1526a7('0x46'));if(_0x2fb7d5[_0x1526a7('0x0')]===_0x1526a7('0x27')){const _0x2c7e1a=_0x14ebe0[_0x1526a7('0x25')]({'plain':!![]}),_0x225fbd=[{'name':_0x1526a7('0xa'),'value':_0x1526a7('0x39')},{'name':_0x1526a7('0x17'),'value':_0x1526a7('0x19')},{'name':_0x1526a7('0x22'),'value':_0x1526a7('0xb')}],_0x5af0ed=_[_0x1526a7('0x4')](_0x225fbd,['value',_0x2c7e1a['type']])[_0x1526a7('0x40')];return db[_0x1526a7('0x26')]['findOne']({'where':{'name':_0x5af0ed,'userProfileId':_0x2fb7d5['userProfileId']},'raw':!![]})['then'](function(_0x1234ce){const _0xa19e4a=_0x1526a7;return _0x1234ce&&_0x1234ce[_0xa19e4a('0x4b')]===0x0?db[_0xa19e4a('0x1e')]['create']({'name':_0x2c7e1a[_0xa19e4a('0x40')],'resourceId':_0x2c7e1a['id'],'type':_0x1234ce[_0xa19e4a('0x40')],'sectionId':_0x1234ce['id']},{})[_0xa19e4a('0x32')](function(){return _0x14ebe0;}):_0x14ebe0;})[_0x1526a7('0x14')](function(_0x5e9bd8){const _0x246207=_0x1526a7;logger[_0x246207('0x35')](_0x246207('0x1d'),_0x5e9bd8);throw _0x5e9bd8;});}return _0x14ebe0;})['then'](respondWithResult(_0x23b6b3,0xc9))[_0x102a10('0x14')](handleError(_0x23b6b3,null));},exports[_0x4b31a8('0x38')]=function(_0x35ad1f,_0x179b18){const _0x3d0cb7=_0x4b31a8;return _0x35ad1f[_0x3d0cb7('0x6')]['id']&&delete _0x35ad1f[_0x3d0cb7('0x6')]['id'],db[_0x3d0cb7('0x18')][_0x3d0cb7('0x3a')]({'where':{'id':_0x35ad1f['params']['id']}})[_0x3d0cb7('0x32')](handleEntityNotFound(_0x179b18,null))['then'](function(_0x3031d0){const _0x1c9470=_0x3d0cb7;if(_0x3031d0)return db['VoiceExtension'][_0x1c9470('0x38')](_['pick'](_0x35ad1f[_0x1c9470('0x6')],[_0x1c9470('0x29'),'context',_0x1c9470('0x45'),_0x1c9470('0x3d'),_0x1c9470('0x1a'),'mandatoryDisposition']),{'where':{'context':_0x3031d0[_0x1c9470('0x4f')],'exten':_0x3031d0[_0x1c9470('0x29')]},'individualHooks':!![]})[_0x1c9470('0x32')](function(_0x2bfecf){return _0x2bfecf;});return null;})[_0x3d0cb7('0x32')](respondWithStatusCode(_0x179b18,null))['catch'](handleError(_0x179b18,null));},exports['addApplications']=function(_0x3eb990,_0x2a4aef){const _0x52e716=_0x4b31a8;return db[_0x52e716('0x18')]['findOne']({'where':{'id':_0x3eb990[_0x52e716('0x2b')]['id']}})[_0x52e716('0x32')](handleEntityNotFound(_0x2a4aef,null))[_0x52e716('0x32')](function(_0x1dadc1){const _0x1efba9=_0x52e716;if(_0x1dadc1)return db[_0x1efba9('0x42')][_0x1efba9('0x3f')](function(_0x1f725a){const _0x31f3f2=_0x1efba9;return db[_0x31f3f2('0x18')]['destroy']({'where':{'VoiceExtensionId':_0x3eb990[_0x31f3f2('0x2b')]['id']},'transaction':_0x1f725a})[_0x31f3f2('0x32')](function(){const _0x58d17d=_0x31f3f2,_0xfe9f52=_[_0x58d17d('0x4c')](_0x3eb990['body'],function(_0x1032e7){const _0x244945=_0x58d17d;return _0x1032e7['VoiceExtensionId']=_0x3eb990[_0x244945('0x2b')]['id'],_0x1032e7;});return db[_0x58d17d('0x18')][_0x58d17d('0x1c')](_0xfe9f52,{'transaction':_0x1f725a});});})[_0x1efba9('0x32')](function(){const _0x26cf80=_0x1efba9;return db['VoiceExtension'][_0x26cf80('0xc')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3eb990[_0x26cf80('0x2b')]['id']},'order':_0x26cf80('0x3')});});})[_0x52e716('0x32')](respondWithResult(_0x2a4aef,null))[_0x52e716('0x14')](handleError(_0x2a4aef,null));};
\ No newline at end of file