Built motion from commit e493b9a4954b50a8ee6d0034ba3601cd210d989d. Version 3.0.0...
[motion-next.git] / server / api / voiceExtension / voiceExtension.controller.js
index d83e5fc..c8f3c5f 100644 (file)
@@ -1 +1 @@
-const a872_0x2757=['end','value','filters','inbound','rows','mandatoryDisposition','send','count','stack','like','InboundRoutes','json','intersection','query','attributes','transaction','sequelize','limit','pick','index','VIRTUAL','description','update','options','map','params','model','rawAttributes','keys','user','includes','filter','offset','UserProfileResource','lodash','internal','../../components/parsers/qs','exten','../../mysqldb','OutboundRoutes','destroy','UserProfileSection','register','VoiceExtensionId','addApplications','context','startsWith','InternalRoutes','status','get','bulkCreate','body','sendStatus','then','catch','order','VoiceExtension','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','name','set','length','sort','includeAll','undefined','Content-Range','cast(priority\x20as\x20unsigned)','where','api','create','include','fields','merge','findOne','outbound','recordingFormat','role','findAndCountAll','error','type','find'];(function(_0x3c0abf,_0xea81ce){const _0x27572b=function(_0x40e7df){while(--_0x40e7df){_0x3c0abf['push'](_0x3c0abf['shift']());}};_0x27572b(++_0xea81ce);}(a872_0x2757,0xfc));const a872_0x40e7=function(_0x3c0abf,_0xea81ce){_0x3c0abf=_0x3c0abf-0x89;let _0x27572b=a872_0x2757[_0x3c0abf];return _0x27572b;};const a872_0x396e62=a872_0x40e7;'use strict';const _=require(a872_0x396e62(0x9f)),qs=require(a872_0x396e62(0xa1)),logger=require('../../config/logger')(a872_0x396e62(0xc0)),{getSocket}=require('../../rediscache'),socket=getSocket(),{db}=require(a872_0x396e62(0xa3)),{Op}=require('sequelize');require('./voiceExtension.socket')[a872_0x396e62(0xa7)](socket);function respondWithStatusCode(_0x3d98fc,_0x37d953){return _0x37d953=_0x37d953||0xcc,function(_0x519e33){const _0x5a3c42=a872_0x40e7;if(_0x519e33)return _0x3d98fc['sendStatus'](_0x37d953);return _0x3d98fc[_0x5a3c42(0xad)](_0x37d953)[_0x5a3c42(0xcd)]();};}function respondWithResult(_0x4a2e9f,_0x516935){return _0x516935=_0x516935||0xc8,function(_0x206c95){const _0x3ccc2d=a872_0x40e7;if(_0x206c95)return _0x4a2e9f[_0x3ccc2d(0xad)](_0x516935)[_0x3ccc2d(0xd8)](_0x206c95);};}function respondWithFilteredResult(_0x27baa2,_0x59bb41){return function(_0x103c9b){const _0x3417e8=a872_0x40e7;if(_0x103c9b){const _0x10ebe4=_0x103c9b[_0x3417e8(0xd4)],_0x27e3a3=_0x59bb41[_0x3417e8(0x9d)];let _0x5d9c41=_0x59bb41[_0x3417e8(0x9d)]+_0x59bb41[_0x3417e8(0x8e)],_0x33f89f;return _0x5d9c41>=_0x10ebe4?(_0x5d9c41=_0x10ebe4,_0x33f89f=0xc8):_0x33f89f=0xce,_0x27baa2[_0x3417e8(0xad)](_0x33f89f),_0x27baa2[_0x3417e8(0xb8)](_0x3417e8(0xbd),_0x27e3a3+'-'+_0x5d9c41+'/'+_0x10ebe4)[_0x3417e8(0xd8)](_0x103c9b);}return null;};}function removeEntity(_0x33bde1){return function(_0x54088c){const _0x1beb4c=a872_0x40e7;if(_0x54088c)return _0x54088c['destroy']()[_0x1beb4c(0xb2)](function(){const _0x2f339a=_0x1beb4c,_0x5a4e56=_0x54088c['get']({'plain':!![]}),_0x158a8e=[{'name':_0x2f339a(0xd7),'value':_0x2f339a(0xd0),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x2f339a(0xac),'value':_0x2f339a(0xa0),'ignore':![]}],_0xff17bf=_(_0x158a8e)[_0x2f339a(0x9c)]('ignore')['map'](_0x2f339a(0xce))[_0x2f339a(0xce)]();if(_[_0x2f339a(0x9b)](_0xff17bf,_0x5a4e56[_0x2f339a(0xcb)]))return;const _0x33a92a=_[_0x2f339a(0xcc)](_0x158a8e,['value',_0x5a4e56['type']])[_0x2f339a(0xb7)];return db[_0x2f339a(0x9e)][_0x2f339a(0xa5)]({'where':{'type':_0x33a92a,'resourceId':_0x5a4e56['id']}})['then'](function(){return _0x54088c;});})[_0x1beb4c(0xb2)](function(){const _0x36b1ce=_0x1beb4c;_0x33bde1[_0x36b1ce(0xad)](0xcc)[_0x36b1ce(0xcd)]();});};}function handleEntityNotFound(_0x143d61){return function(_0xec92eb){const _0x3fa728=a872_0x40e7;return!_0xec92eb&&_0x143d61[_0x3fa728(0xb1)](0x194),_0xec92eb;};}function handleError(_0x3367a3,_0x1d1e2b){return _0x1d1e2b=_0x1d1e2b||0x1f4,function(_0x7b9140){const _0x2ef3b5=a872_0x40e7;logger[_0x2ef3b5(0xca)](_0x7b9140[_0x2ef3b5(0xd5)]),_0x7b9140['name']&&delete _0x7b9140[_0x2ef3b5(0xb7)],_0x3367a3['status'](_0x1d1e2b)[_0x2ef3b5(0xd3)](_0x7b9140);};}exports[a872_0x396e62(0x90)]=function(_0x3a9696,_0x36f81a){const _0x1badbc=a872_0x396e62;let _0x13bf8e={};const _0x3b9dad={},_0x139ddc={'count':0x0,'rows':[]},_0x3e7e54=_[_0x1badbc(0x95)](db[_0x1badbc(0xb5)][_0x1badbc(0x98)],function(_0x2761ce){const _0x644e0b=_0x1badbc;return{'name':_0x2761ce['fieldName'],'type':_0x2761ce[_0x644e0b(0xcb)]['key']};});_0x3b9dad[_0x1badbc(0x97)]=_[_0x1badbc(0x95)](_0x3e7e54,'name'),_0x3b9dad['query']=_['keys'](_0x3a9696[_0x1badbc(0x8a)]),_0x3b9dad[_0x1badbc(0xcf)]=_[_0x1badbc(0x89)](_0x3b9dad[_0x1badbc(0x97)],_0x3b9dad[_0x1badbc(0x8a)]),_0x13bf8e[_0x1badbc(0x8b)]=_['intersection'](_0x3b9dad[_0x1badbc(0x97)],qs[_0x1badbc(0xc3)](_0x3a9696[_0x1badbc(0x8a)]['fields'])),_0x13bf8e[_0x1badbc(0x8b)]=_0x13bf8e[_0x1badbc(0x8b)][_0x1badbc(0xb9)]?_0x13bf8e['attributes']:_0x3b9dad[_0x1badbc(0x97)];typeof _0x3a9696[_0x1badbc(0x8a)]['nolimit']===_0x1badbc(0xbc)&&(_0x13bf8e[_0x1badbc(0x8e)]=qs[_0x1badbc(0x8e)](_0x3a9696['query'][_0x1badbc(0x8e)]),_0x13bf8e[_0x1badbc(0x9d)]=qs['offset'](_0x3a9696[_0x1badbc(0x8a)][_0x1badbc(0x9d)]));_0x13bf8e[_0x1badbc(0xb4)]=qs[_0x1badbc(0xba)](_0x3a9696['query'][_0x1badbc(0xba)]),_0x13bf8e[_0x1badbc(0xbf)]=qs[_0x1badbc(0xcf)](_[_0x1badbc(0x8f)](_0x3a9696[_0x1badbc(0x8a)],_0x3b9dad[_0x1badbc(0xcf)]),_0x3e7e54);_0x3a9696[_0x1badbc(0x8a)]['filter']&&(_0x13bf8e[_0x1badbc(0xbf)]=_['merge'](_0x13bf8e['where'],{[Op['or']]:_[_0x1badbc(0x95)](_0x3e7e54,function(_0xe6d349){const _0x464917=_0x1badbc;if(_0xe6d349[_0x464917(0xcb)]!==_0x464917(0x91)){const _0x22d5d8={};return _0x22d5d8[_0xe6d349['name']]={[Op[_0x464917(0xd6)]]:'%'+_0x3a9696[_0x464917(0x8a)]['filter']+'%'},_0x22d5d8;}})}));_0x13bf8e=_[_0x1badbc(0xc4)]({},_0x13bf8e,_0x3a9696[_0x1badbc(0x94)]);const _0x30a7ae={'where':_0x13bf8e[_0x1badbc(0xbf)]};return db['VoiceExtension'][_0x1badbc(0xd4)](_0x30a7ae)[_0x1badbc(0xb2)](function(_0x2cb05a){const _0x139c5d=_0x1badbc;return _0x139ddc['count']=_0x2cb05a,_0x3a9696[_0x139c5d(0x8a)][_0x139c5d(0xbb)]&&(_0x13bf8e[_0x139c5d(0xc2)]=[{'all':!![]}]),db[_0x139c5d(0xb5)]['findAll'](_0x13bf8e);})[_0x1badbc(0xb2)](function(_0x4ccbf2){const _0x253d7e=_0x1badbc;return _0x139ddc[_0x253d7e(0xd1)]=_0x4ccbf2,_0x139ddc;})[_0x1badbc(0xb2)](respondWithFilteredResult(_0x36f81a,_0x13bf8e))[_0x1badbc(0xb3)](handleError(_0x36f81a,null));},exports['show']=function(_0x40114e,_0x51a8d3){const _0x6bb01=a872_0x396e62;let _0xc8689e={'raw':![],'where':{'id':_0x40114e[_0x6bb01(0x96)]['id']}};const _0x2069ee={};return _0x2069ee[_0x6bb01(0x97)]=_[_0x6bb01(0x99)](db[_0x6bb01(0xb5)][_0x6bb01(0x98)]),_0x2069ee[_0x6bb01(0x8a)]=_[_0x6bb01(0x99)](_0x40114e[_0x6bb01(0x8a)]),_0x2069ee[_0x6bb01(0xcf)]=_[_0x6bb01(0x89)](_0x2069ee[_0x6bb01(0x97)],_0x2069ee[_0x6bb01(0x8a)]),_0xc8689e[_0x6bb01(0x8b)]=_['intersection'](_0x2069ee['model'],qs[_0x6bb01(0xc3)](_0x40114e['query'][_0x6bb01(0xc3)])),_0xc8689e[_0x6bb01(0x8b)]=_0xc8689e[_0x6bb01(0x8b)]['length']?_0xc8689e[_0x6bb01(0x8b)]:_0x2069ee[_0x6bb01(0x97)],_0x40114e[_0x6bb01(0x8a)][_0x6bb01(0xbb)]&&(_0xc8689e[_0x6bb01(0xc2)]=[{'all':!![]}]),_0xc8689e=_[_0x6bb01(0xc4)]({},_0xc8689e,_0x40114e[_0x6bb01(0x94)]),db['VoiceExtension'][_0x6bb01(0xc5)](_0xc8689e)[_0x6bb01(0xb2)](handleEntityNotFound(_0x51a8d3,null))[_0x6bb01(0xb2)](respondWithResult(_0x51a8d3,null))[_0x6bb01(0xb3)](handleError(_0x51a8d3,null));},exports[a872_0x396e62(0xa5)]=function(_0x4a6c36,_0x38db89){const _0x5cde0d=a872_0x396e62;return db[_0x5cde0d(0xb5)][_0x5cde0d(0xc5)]({'where':{'id':_0x4a6c36[_0x5cde0d(0x96)]['id']}})['then'](handleEntityNotFound(_0x38db89,null))[_0x5cde0d(0xb2)](removeEntity(_0x38db89,null))[_0x5cde0d(0xb3)](handleError(_0x38db89,null));},exports[a872_0x396e62(0xc1)]=function(_0x1aedc4,_0xaf2db4){const _0x23dc92=a872_0x396e62;return _0x1aedc4['body'][_0x23dc92(0xcb)]===_0x23dc92(0xc6)&&!_[_0x23dc92(0xab)](_0x1aedc4[_0x23dc92(0xb0)]['exten'],'_')&&(_0x1aedc4[_0x23dc92(0xb0)][_0x23dc92(0xa2)]='_'['concat'](_0x1aedc4[_0x23dc92(0xb0)][_0x23dc92(0xa2)])),db['VoiceExtension']['create'](_0x1aedc4[_0x23dc92(0xb0)],{'raw':![]})[_0x23dc92(0xb2)](function(_0x270dc5){const _0x4b6006=_0x23dc92,_0x576c0e=_0x1aedc4[_0x4b6006(0x9a)][_0x4b6006(0xae)]({'plain':!![]});if(!_0x576c0e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x576c0e[_0x4b6006(0xc8)]==='user'){const _0x2e551d=_0x270dc5['get']({'plain':!![]}),_0x358cf6=[{'name':_0x4b6006(0xd7),'value':_0x4b6006(0xd0)},{'name':_0x4b6006(0xa4),'value':_0x4b6006(0xc6)},{'name':_0x4b6006(0xac),'value':_0x4b6006(0xa0)}],_0x348d81=_[_0x4b6006(0xcc)](_0x358cf6,['value',_0x2e551d[_0x4b6006(0xcb)]])[_0x4b6006(0xb7)];return db[_0x4b6006(0xa6)][_0x4b6006(0xc5)]({'where':{'name':_0x348d81,'userProfileId':_0x576c0e['userProfileId']},'raw':!![]})[_0x4b6006(0xb2)](function(_0x189580){const _0x36a33d=_0x4b6006;return _0x189580&&_0x189580['autoAssociation']===0x0?db[_0x36a33d(0x9e)]['create']({'name':_0x2e551d[_0x36a33d(0xb7)],'resourceId':_0x2e551d['id'],'type':_0x189580[_0x36a33d(0xb7)],'sectionId':_0x189580['id']},{})['then'](function(){return _0x270dc5;}):_0x270dc5;})[_0x4b6006(0xb3)](function(_0x1c8d31){const _0x5d1ff5=_0x4b6006;logger[_0x5d1ff5(0xca)](_0x5d1ff5(0xb6),_0x1c8d31);throw _0x1c8d31;});}return _0x270dc5;})[_0x23dc92(0xb2)](respondWithResult(_0xaf2db4,0xc9))[_0x23dc92(0xb3)](handleError(_0xaf2db4,null));},exports[a872_0x396e62(0x93)]=function(_0x26f3ea,_0x1358fc){const _0x2e3b3c=a872_0x396e62;return _0x26f3ea[_0x2e3b3c(0xb0)]['id']&&delete _0x26f3ea[_0x2e3b3c(0xb0)]['id'],db['VoiceExtension'][_0x2e3b3c(0xc5)]({'where':{'id':_0x26f3ea[_0x2e3b3c(0x96)]['id']}})[_0x2e3b3c(0xb2)](handleEntityNotFound(_0x1358fc,null))['then'](function(_0x2d85b3){const _0x3f5244=_0x2e3b3c;if(_0x2d85b3)return db[_0x3f5244(0xb5)][_0x3f5244(0x93)](_[_0x3f5244(0x8f)](_0x26f3ea[_0x3f5244(0xb0)],[_0x3f5244(0xa2),_0x3f5244(0xaa),_0x3f5244(0x92),_0x3f5244(0xc7),'cutdigits',_0x3f5244(0xd2)]),{'where':{'context':_0x2d85b3[_0x3f5244(0xaa)],'exten':_0x2d85b3[_0x3f5244(0xa2)]},'individualHooks':!![]})[_0x3f5244(0xb2)](function(_0x22970a){return _0x22970a;});return null;})[_0x2e3b3c(0xb2)](respondWithStatusCode(_0x1358fc,null))[_0x2e3b3c(0xb3)](handleError(_0x1358fc,null));},exports[a872_0x396e62(0xa9)]=function(_0x3ba7a6,_0x225cc0){const _0x25eaa3=a872_0x396e62;return db[_0x25eaa3(0xb5)][_0x25eaa3(0xc5)]({'where':{'id':_0x3ba7a6['params']['id']}})['then'](handleEntityNotFound(_0x225cc0,null))[_0x25eaa3(0xb2)](function(_0x2760c6){const _0xecf985=_0x25eaa3;if(_0x2760c6)return db[_0xecf985(0x8d)][_0xecf985(0x8c)](function(_0x4cf83e){const _0x165e64=_0xecf985;return db['VoiceExtension'][_0x165e64(0xa5)]({'where':{'VoiceExtensionId':_0x3ba7a6[_0x165e64(0x96)]['id']},'transaction':_0x4cf83e})[_0x165e64(0xb2)](function(){const _0xd11125=_0x165e64,_0x4d2485=_[_0xd11125(0x95)](_0x3ba7a6['body'],function(_0xf45cef){const _0x56ecdd=_0xd11125;return _0xf45cef[_0x56ecdd(0xa8)]=_0x3ba7a6[_0x56ecdd(0x96)]['id'],_0xf45cef;});return db[_0xd11125(0xb5)][_0xd11125(0xaf)](_0x4d2485,{'transaction':_0x4cf83e});});})['then'](function(){const _0x4cc031=_0xecf985;return db[_0x4cc031(0xb5)][_0x4cc031(0xc9)]({'where':{'isApp':!![],'VoiceExtensionId':_0x3ba7a6[_0x4cc031(0x96)]['id']},'order':_0x4cc031(0xbe)});});})['then'](respondWithResult(_0x225cc0,null))[_0x25eaa3(0xb3)](handleError(_0x225cc0,null));};
\ No newline at end of file
+'use strict';const a872_0x3334=['sendStatus','priority','VoiceExtension','lodash','custom','find','@mysqldb','@config/logger','query','addApplications','pick','exten','register','sort','where','count','keys','type','api','appType','outbound','offset','fields','update','InternalRoutes','name','InboundRoutes','562012sXrXCb','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includes','internal','VoiceExtensionId','options','length','attributes','inbound','status','get','concat','sequelize','merge','limit','appdata','UserProfileResource','send','UserProfileSection','end','3827VuOaFl','1QkjZIo','includeAll','destroy','description','OutboundRoutes','1240054gBoCxv','778708pgAyYO','order','Unable\x20to\x20retrieve\x20the\x20current\x20user','737806AktTKQ','startsWith','set','unsigned','role','fieldName','autoAssociation','context','findAll','body',',xX,,,300,,,,,','stack','create','rows','model','transaction','ignore','@rediscache','157hwFKdq','undefined','catch','./voiceExtension.socket','filters','intersection','196195gAPijf','then','user','findAndCountAll','map','recordingFormat','json','rawAttributes','include','bulkCreate','value','mandatoryDisposition','filter','app','116878flhZuU','params','@components/parsers/qs','Hangup','key','findOne'];const a872_0x5e49=function(_0x584421,_0x1aa630){_0x584421=_0x584421-0x18a;let _0x3334a0=a872_0x3334[_0x584421];return _0x3334a0;};const a872_0x5a9511=a872_0x5e49;(function(_0x1b415f,_0x4789aa){const _0x436826=a872_0x5e49;while(!![]){try{const _0x396145=-parseInt(_0x436826(0x198))*parseInt(_0x436826(0x1b4))+-parseInt(_0x436826(0x19f))+parseInt(_0x436826(0x19e))+parseInt(_0x436826(0x1c8))*-parseInt(_0x436826(0x199))+parseInt(_0x436826(0x1e9))+-parseInt(_0x436826(0x1ba))+parseInt(_0x436826(0x1a2));if(_0x396145===_0x4789aa)break;else _0x1b415f['push'](_0x1b415f['shift']());}catch(_0x4353be){_0x1b415f['push'](_0x1b415f['shift']());}}}(a872_0x3334,0xced94));const _=require(a872_0x5a9511(0x1d1)),qs=require(a872_0x5a9511(0x1ca)),logger=require(a872_0x5a9511(0x1d5))(a872_0x5a9511(0x1e0)),{getSocket}=require(a872_0x5a9511(0x1b3)),socket=getSocket(),{db}=require(a872_0x5a9511(0x1d4)),{filterAttributes}=require('@utils/filter-attributes');require(a872_0x5a9511(0x1b7))[a872_0x5a9511(0x1da)](socket);function respondWithStatusCode(_0xeb7aac,_0x4826d1){return _0x4826d1=_0x4826d1||0xcc,function(_0x4717ad){const _0x380fdf=a872_0x5e49;if(_0x4717ad)return _0xeb7aac[_0x380fdf(0x1ce)](_0x4826d1);return _0xeb7aac[_0x380fdf(0x18d)](_0x4826d1)['end']();};}function respondWithResult(_0x166456,_0x37705c){return _0x37705c=_0x37705c||0xc8,function(_0x522604){const _0x2d9bc1=a872_0x5e49;if(_0x522604)return _0x166456[_0x2d9bc1(0x18d)](_0x37705c)[_0x2d9bc1(0x1c0)](_0x522604);};}function respondWithFilteredResult(_0x54fb38,_0x3f58cd){return function(_0x3bb3bb){const _0x1ee2c1=a872_0x5e49;if(_0x3bb3bb){const _0xa79379=_0x3bb3bb[_0x1ee2c1(0x1dd)],_0x316177=_0x3f58cd[_0x1ee2c1(0x1e3)];let _0xa232d=_0x3f58cd[_0x1ee2c1(0x1e3)]+_0x3f58cd[_0x1ee2c1(0x192)],_0x1d5dad;return _0xa232d>=_0xa79379?(_0xa232d=_0xa79379,_0x1d5dad=0xc8):_0x1d5dad=0xce,_0x54fb38['status'](_0x1d5dad),_0x54fb38[_0x1ee2c1(0x1a4)]('Content-Range',_0x316177+'-'+_0xa232d+'/'+_0xa79379)[_0x1ee2c1(0x1c0)](_0x3bb3bb);}return null;};}function removeEntity(_0x1c093e){return function(_0x52ce05){const _0x4b9d1e=a872_0x5e49;if(_0x52ce05)return _0x52ce05['destroy']()[_0x4b9d1e(0x1bb)](function(){const _0x48d865=_0x4b9d1e,_0xc51bc0=_0x52ce05[_0x48d865(0x18e)]({'plain':!![]}),_0x3f0332=[{'name':_0x48d865(0x1e8),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x48d865(0x1e2),'ignore':![]},{'name':_0x48d865(0x1e6),'value':_0x48d865(0x1ec),'ignore':![]}],_0x677610=_(_0x3f0332)['filter'](_0x48d865(0x1b2))[_0x48d865(0x1be)]('value')[_0x48d865(0x1c4)]();if(_[_0x48d865(0x1eb)](_0x677610,_0xc51bc0[_0x48d865(0x1df)]))return;const _0x4c28e2=_[_0x48d865(0x1d3)](_0x3f0332,[_0x48d865(0x1c4),_0xc51bc0[_0x48d865(0x1df)]])[_0x48d865(0x1e7)];return db[_0x48d865(0x194)]['destroy']({'where':{'type':_0x4c28e2,'resourceId':_0xc51bc0['id']}})[_0x48d865(0x1bb)](function(){return _0x52ce05;});})[_0x4b9d1e(0x1bb)](function(){const _0x29eb39=_0x4b9d1e;_0x1c093e[_0x29eb39(0x18d)](0xcc)[_0x29eb39(0x197)]();});};}function handleEntityNotFound(_0x159891){return function(_0x32ca2f){return!_0x32ca2f&&_0x159891['sendStatus'](0x194),_0x32ca2f;};}function handleError(_0x266816,_0xa7720a){return _0xa7720a=_0xa7720a||0x1f4,function(_0x1a44da){const _0x35f659=a872_0x5e49;logger['error'](_0x1a44da[_0x35f659(0x1ad)]),_0x1a44da[_0x35f659(0x1e7)]&&delete _0x1a44da[_0x35f659(0x1e7)],_0x266816['status'](_0xa7720a)[_0x35f659(0x195)](_0x1a44da);};}exports['index']=function(_0x433761,_0x35fa36){const _0x1667c7=a872_0x5a9511;let _0x1fbc8b={};const _0x1f002f={},_0x53a2bc={'count':0x0,'rows':[]},_0x270bc8=_['map'](db['VoiceExtension'][_0x1667c7(0x1c1)],function(_0x4d3ef6){const _0xf4daff=_0x1667c7;return{'name':_0x4d3ef6[_0xf4daff(0x1a7)],'type':_0x4d3ef6[_0xf4daff(0x1df)][_0xf4daff(0x1cc)]};});_0x1f002f[_0x1667c7(0x1b0)]=_[_0x1667c7(0x1be)](_0x270bc8,_0x1667c7(0x1e7)),_0x1f002f[_0x1667c7(0x1d6)]=_['keys'](_0x433761[_0x1667c7(0x1d6)]),_0x1f002f[_0x1667c7(0x1b8)]=_[_0x1667c7(0x1b9)](_0x1f002f[_0x1667c7(0x1b0)],_0x1f002f[_0x1667c7(0x1d6)]),_0x1fbc8b[_0x1667c7(0x18b)]=_[_0x1667c7(0x1b9)](_0x1f002f[_0x1667c7(0x1b0)],qs[_0x1667c7(0x1e4)](_0x433761['query'][_0x1667c7(0x1e4)])),_0x1fbc8b[_0x1667c7(0x18b)]=_0x1fbc8b[_0x1667c7(0x18b)]['length']?_0x1fbc8b[_0x1667c7(0x18b)]:_0x1f002f[_0x1667c7(0x1b0)];typeof _0x433761['query']['nolimit']===_0x1667c7(0x1b5)&&(_0x1fbc8b[_0x1667c7(0x192)]=qs[_0x1667c7(0x192)](_0x433761[_0x1667c7(0x1d6)][_0x1667c7(0x192)]),_0x1fbc8b[_0x1667c7(0x1e3)]=qs[_0x1667c7(0x1e3)](_0x433761[_0x1667c7(0x1d6)]['offset']));_0x1fbc8b[_0x1667c7(0x1a0)]=qs['sort'](_0x433761['query'][_0x1667c7(0x1db)]),_0x1fbc8b[_0x1667c7(0x1dc)]=qs[_0x1667c7(0x1b8)](_['pick'](_0x433761[_0x1667c7(0x1d6)],_0x1f002f[_0x1667c7(0x1b8)]),_0x270bc8),_0x1fbc8b=filterAttributes(_0x1fbc8b,_0x433761[_0x1667c7(0x1d6)][_0x1667c7(0x1c6)],_0x270bc8,_0x433761[_0x1667c7(0x1ee)]);const _0x4b5e39={'where':_0x1fbc8b[_0x1667c7(0x1dc)]};return db[_0x1667c7(0x1d0)][_0x1667c7(0x1dd)](_0x4b5e39)['then'](function(_0x530baa){const _0x1be5f1=_0x1667c7;return _0x53a2bc['count']=_0x530baa,_0x433761[_0x1be5f1(0x1d6)][_0x1be5f1(0x19a)]&&(_0x1fbc8b[_0x1be5f1(0x1c2)]=[{'all':!![]}]),db[_0x1be5f1(0x1d0)][_0x1be5f1(0x1aa)](_0x1fbc8b);})[_0x1667c7(0x1bb)](function(_0x220718){const _0x399629=_0x1667c7;return _0x53a2bc[_0x399629(0x1af)]=_0x220718,_0x53a2bc;})[_0x1667c7(0x1bb)](respondWithFilteredResult(_0x35fa36,_0x1fbc8b))[_0x1667c7(0x1b6)](handleError(_0x35fa36,null));},exports['show']=function(_0x3317ea,_0x10fd83){const _0x5f02b0=a872_0x5a9511;let _0x537965={'raw':![],'where':{'id':_0x3317ea[_0x5f02b0(0x1c9)]['id']}};const _0x2b4ff7={};return _0x2b4ff7[_0x5f02b0(0x1b0)]=_[_0x5f02b0(0x1de)](db[_0x5f02b0(0x1d0)]['rawAttributes']),_0x2b4ff7[_0x5f02b0(0x1d6)]=_[_0x5f02b0(0x1de)](_0x3317ea[_0x5f02b0(0x1d6)]),_0x2b4ff7[_0x5f02b0(0x1b8)]=_[_0x5f02b0(0x1b9)](_0x2b4ff7[_0x5f02b0(0x1b0)],_0x2b4ff7[_0x5f02b0(0x1d6)]),_0x537965[_0x5f02b0(0x18b)]=_['intersection'](_0x2b4ff7[_0x5f02b0(0x1b0)],qs[_0x5f02b0(0x1e4)](_0x3317ea['query'][_0x5f02b0(0x1e4)])),_0x537965[_0x5f02b0(0x18b)]=_0x537965[_0x5f02b0(0x18b)][_0x5f02b0(0x18a)]?_0x537965[_0x5f02b0(0x18b)]:_0x2b4ff7[_0x5f02b0(0x1b0)],_0x3317ea[_0x5f02b0(0x1d6)][_0x5f02b0(0x19a)]&&(_0x537965['include']=[{'all':!![]}]),_0x537965=_[_0x5f02b0(0x191)]({},_0x537965,_0x3317ea[_0x5f02b0(0x1ee)]),db[_0x5f02b0(0x1d0)][_0x5f02b0(0x1cd)](_0x537965)[_0x5f02b0(0x1bb)](handleEntityNotFound(_0x10fd83,null))[_0x5f02b0(0x1bb)](respondWithResult(_0x10fd83,null))[_0x5f02b0(0x1b6)](handleError(_0x10fd83,null));},exports[a872_0x5a9511(0x19b)]=function(_0x5c8854,_0x3fb48d){const _0x581199=a872_0x5a9511;return db[_0x581199(0x1d0)]['findOne']({'where':{'id':_0x5c8854[_0x581199(0x1c9)]['id']}})[_0x581199(0x1bb)](handleEntityNotFound(_0x3fb48d,null))['then'](removeEntity(_0x3fb48d,null))[_0x581199(0x1b6)](handleError(_0x3fb48d,null));},exports[a872_0x5a9511(0x1ae)]=function(_0x45054c,_0x5b991d){const _0x382077=a872_0x5a9511;return _0x45054c[_0x382077(0x1ab)][_0x382077(0x1df)]===_0x382077(0x1e2)&&!_[_0x382077(0x1a3)](_0x45054c['body'][_0x382077(0x1d9)],'_')&&(_0x45054c[_0x382077(0x1ab)][_0x382077(0x1d9)]='_'[_0x382077(0x18f)](_0x45054c[_0x382077(0x1ab)][_0x382077(0x1d9)])),db['VoiceExtension']['create'](_0x45054c[_0x382077(0x1ab)],{'raw':![]})['then'](function(_0x5e1577){const _0x209d36=_0x382077,_0x3bf486=_0x45054c[_0x209d36(0x1bc)][_0x209d36(0x18e)]({'plain':!![]});if(!_0x3bf486)throw new Error(_0x209d36(0x1a1));if(_0x3bf486[_0x209d36(0x1a6)]===_0x209d36(0x1bc)){const _0x431c43=_0x5e1577[_0x209d36(0x18e)]({'plain':!![]}),_0x4ca05c=[{'name':_0x209d36(0x1e8),'value':_0x209d36(0x18c)},{'name':_0x209d36(0x19d),'value':_0x209d36(0x1e2)},{'name':_0x209d36(0x1e6),'value':_0x209d36(0x1ec)}],_0x495c19=_[_0x209d36(0x1d3)](_0x4ca05c,['value',_0x431c43[_0x209d36(0x1df)]])['name'];return db[_0x209d36(0x196)][_0x209d36(0x1cd)]({'where':{'name':_0x495c19,'userProfileId':_0x3bf486['userProfileId']},'raw':!![]})[_0x209d36(0x1bb)](function(_0x4d6f7b){const _0x3c6aac=_0x209d36;return _0x4d6f7b&&_0x4d6f7b[_0x3c6aac(0x1a8)]===0x0?db[_0x3c6aac(0x194)][_0x3c6aac(0x1ae)]({'name':_0x431c43[_0x3c6aac(0x1e7)],'resourceId':_0x431c43['id'],'type':_0x4d6f7b['name'],'sectionId':_0x4d6f7b['id']},{})[_0x3c6aac(0x1bb)](function(){return _0x5e1577;}):_0x5e1577;})[_0x209d36(0x1b6)](function(_0x99efbe){const _0x5b21c8=_0x209d36;logger['error'](_0x5b21c8(0x1ea),_0x99efbe);throw _0x99efbe;});}return _0x5e1577;})[_0x382077(0x1bb)](respondWithResult(_0x5b991d,0xc9))['catch'](handleError(_0x5b991d,null));},exports['update']=function(_0x34f5c3,_0x5519bc){const _0x5f292f=a872_0x5a9511;return _0x34f5c3['body']['id']&&delete _0x34f5c3[_0x5f292f(0x1ab)]['id'],db[_0x5f292f(0x1d0)][_0x5f292f(0x1cd)]({'where':{'id':_0x34f5c3['params']['id']}})[_0x5f292f(0x1bb)](handleEntityNotFound(_0x5519bc,null))[_0x5f292f(0x1bb)](function(_0x49e965){const _0x84fc32=_0x5f292f;if(_0x49e965)return db['VoiceExtension'][_0x84fc32(0x1e5)](_[_0x84fc32(0x1d8)](_0x34f5c3[_0x84fc32(0x1ab)],['exten',_0x84fc32(0x1a9),_0x84fc32(0x19c),_0x84fc32(0x1bf),'cutdigits',_0x84fc32(0x1c5)]),{'where':{'context':_0x49e965[_0x84fc32(0x1a9)],'exten':_0x49e965[_0x84fc32(0x1d9)]},'individualHooks':!![]})[_0x84fc32(0x1bb)](function(_0x4b9f9a){return _0x4b9f9a;});return null;})[_0x5f292f(0x1bb)](respondWithStatusCode(_0x5519bc,null))['catch'](handleError(_0x5519bc,null));},exports[a872_0x5a9511(0x1d7)]=function(_0x1b547d,_0x111f8a){const _0x4ea27b=a872_0x5a9511;return db[_0x4ea27b(0x1d0)][_0x4ea27b(0x1cd)]({'where':{'id':_0x1b547d[_0x4ea27b(0x1c9)]['id']}})[_0x4ea27b(0x1bb)](handleEntityNotFound(_0x111f8a,null))['then'](function(_0x43f67f){const _0x430826=_0x4ea27b;if(_0x43f67f)return db['sequelize'][_0x430826(0x1b1)](function(_0x48e8b5){const _0xe86204=_0x430826;return db['VoiceExtension'][_0xe86204(0x19b)]({'where':{'VoiceExtensionId':_0x1b547d[_0xe86204(0x1c9)]['id']},'transaction':_0x48e8b5})[_0xe86204(0x1bb)](function(){const _0x62d2f0=_0xe86204,_0x468bda=_[_0x62d2f0(0x1be)](_0x1b547d['body'],function(_0x4c4d1b){const _0xc51451=_0x62d2f0;return _0x4c4d1b[_0xc51451(0x1ed)]=_0x1b547d['params']['id'],_0x4c4d1b;}),_0x38f3eb=_0x468bda[_0x62d2f0(0x1c6)](_0xfa9d3a=>{const _0x305de3=_0x62d2f0;switch(_0xfa9d3a[_0x305de3(0x1e1)]){case'queue':return _0xfa9d3a[_0x305de3(0x193)]!==_0x305de3(0x1ac)?!![]:![];case _0x305de3(0x1d2):return _0xfa9d3a[_0x305de3(0x1c7)]?!![]:![];default:return _0xfa9d3a[_0x305de3(0x1c7)]===_0x305de3(0x1cb)?!![]:_0xfa9d3a[_0x305de3(0x193)]?!![]:![];}});return db['VoiceExtension'][_0x62d2f0(0x1c3)](_0x38f3eb,{'transaction':_0x48e8b5});});})[_0x430826(0x1bb)](function(){const _0x51f31d=_0x430826;return db[_0x51f31d(0x1d0)][_0x51f31d(0x1bd)]({'where':{'isApp':!![],'VoiceExtensionId':_0x1b547d[_0x51f31d(0x1c9)]['id']},'order':db[_0x51f31d(0x190)]['cast'](db[_0x51f31d(0x190)]['col'](_0x51f31d(0x1cf)),_0x51f31d(0x1a5))});});})['then'](respondWithResult(_0x111f8a,null))['catch'](handleError(_0x111f8a,null));};
\ No newline at end of file