Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / voiceContext / voiceContext.controller.js
index 1c5f54b..8bfbb2b 100644 (file)
@@ -1 +1 @@
-const a718_0x3862=['show','lodash','body','../../config/logger','model','stack','send','http','autoAssociation','includeAll','api','render','query','request\x20sent','utf8','status','keys','end','then','destroy','nolimit','sendStatus','sort','length','chan_sip.so','fieldName','Contexts','undefined','userProfileId','readFileSync','UserProfileResource','root','jayson/promise','ejs','order','../../mysqldb','filter','offset','files/templates/context.ejs','sequelize','writeFileSync','findOne','../../components/parsers/qs','update','client','limit','params','fields','debug','options','map','Content-Range','UserProfileSection','VoiceContext,\x20%s,\x20%s,\x20%s','Reload','where','info','VoiceContext','include','VoiceContext,\x20%s,\x20%s','attributes','request','merge','/etc/asterisk/extensions_xcally_contexts.conf','json','path','intersection','findAll','set','count','name','rows','../../config/environment','create','role','error','filters','join','catch','message','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','code','rawAttributes','user','result','type'];(function(_0x4b4f53,_0x386286){const _0x4201ff=function(_0x3041f8){while(--_0x3041f8){_0x4b4f53['push'](_0x4b4f53['shift']());}};_0x4201ff(++_0x386286);}(a718_0x3862,0x137));const a718_0x4201=function(_0x4b4f53,_0x386286){_0x4b4f53=_0x4b4f53-0x0;let _0x4201ff=a718_0x3862[_0x4b4f53];return _0x4201ff;};const _0x540c93=a718_0x4201;'use strict';const path=require(_0x540c93('0xf')),ejs=require(_0x540c93('0x46')),fs=require('fs'),_=require(_0x540c93('0x26')),qs=require(_0x540c93('0x4f')),logger=require(_0x540c93('0x28'))(_0x540c93('0x2f')),config=require(_0x540c93('0x16')),db=require(_0x540c93('0x48'))['db'],{Op}=require(_0x540c93('0x4c')),jayson=require(_0x540c93('0x45')),client=jayson[_0x540c93('0x51')][_0x540c93('0x2c')]({'port':0x232a});function respondWithRpcPromise(_0x3041f8,_0x279b67,_0x41c279,_0x522c2d){return new Promise(function(_0x2db1f3,_0x40c7b8){const _0x4d76e6=a718_0x4201,_0xe28da2=_0x522c2d||client;return _0xe28da2[_0x4d76e6('0xb')](_0x3041f8,_0x41c279)[_0x4d76e6('0x37')](function(_0x28fd0d){const _0x3ff38f=_0x4d76e6;logger[_0x3ff38f('0x6')]('VoiceContext,\x20%s,\x20%s',_0x279b67,_0x3ff38f('0x32')),logger[_0x3ff38f('0x55')](_0x3ff38f('0x3'),_0x279b67,'request\x20sent',JSON['stringify'](_0x28fd0d));if(_0x28fd0d[_0x3ff38f('0x19')]){if(_0x28fd0d[_0x3ff38f('0x19')][_0x3ff38f('0x20')]===0x1f4)return logger[_0x3ff38f('0x19')](_0x3ff38f('0x9'),_0x279b67,_0x28fd0d[_0x3ff38f('0x19')][_0x3ff38f('0x1d')]),_0x40c7b8(_0x28fd0d[_0x3ff38f('0x19')][_0x3ff38f('0x1d')]);return logger[_0x3ff38f('0x19')]('VoiceContext,\x20%s,\x20%s',_0x279b67,_0x28fd0d[_0x3ff38f('0x19')][_0x3ff38f('0x1d')]),_0x2db1f3(_0x28fd0d[_0x3ff38f('0x19')][_0x3ff38f('0x1d')]);}else logger[_0x3ff38f('0x6')](_0x3ff38f('0x9'),_0x279b67,_0x3ff38f('0x32')),_0x2db1f3(_0x28fd0d[_0x3ff38f('0x23')][_0x3ff38f('0x1d')]);})['catch'](function(_0x33850f){const _0x53673c=_0x4d76e6;logger[_0x53673c('0x19')](_0x53673c('0x9'),_0x279b67,_0x33850f),_0x40c7b8(_0x33850f);});});}function respondWithResult(_0x5e3e1f,_0x501a51){return _0x501a51=_0x501a51||0xc8,function(_0x51a546){const _0x892bae=a718_0x4201;if(_0x51a546)return _0x5e3e1f[_0x892bae('0x34')](_0x501a51)[_0x892bae('0xe')](_0x51a546);};}function respondWithFilteredResult(_0x52cde5,_0x233a60){return function(_0x1b67f6){const _0xcc079=a718_0x4201;if(_0x1b67f6){const _0x34d7c9=_0x1b67f6[_0xcc079('0x13')],_0x23cd45=_0x233a60[_0xcc079('0x4a')];let _0x1a5d1=_0x233a60[_0xcc079('0x4a')]+_0x233a60[_0xcc079('0x52')],_0x223533;return _0x1a5d1>=_0x34d7c9?(_0x1a5d1=_0x34d7c9,_0x223533=0xc8):_0x223533=0xce,_0x52cde5[_0xcc079('0x34')](_0x223533),_0x52cde5[_0xcc079('0x12')](_0xcc079('0x1'),_0x23cd45+'-'+_0x1a5d1+'/'+_0x34d7c9)['json'](_0x1b67f6);}return null;};}function saveUpdates(_0x401dee){return function(_0x411db0){const _0x13b160=a718_0x4201;if(_0x411db0)return _0x411db0[_0x13b160('0x50')](_0x401dee)[_0x13b160('0x37')](function(_0x4f49f6){return _0x4f49f6;});return null;};}function removeEntity(_0x28a426){return function(_0x2a3dd2){const _0x2ac451=a718_0x4201;if(_0x2a3dd2)return _0x2a3dd2[_0x2ac451('0x38')]()[_0x2ac451('0x37')](function(){const _0x53e5f0=_0x2ac451,_0x258be7=_0x2a3dd2['get']({'plain':!![]}),_0xcb665a=_0x53e5f0('0x3f');return db[_0x53e5f0('0x43')]['destroy']({'where':{'type':_0xcb665a,'resourceId':_0x258be7['id']}})['then'](function(){return _0x2a3dd2;});})[_0x2ac451('0x37')](function(){const _0x176bbc=_0x2ac451;_0x28a426[_0x176bbc('0x34')](0xcc)[_0x176bbc('0x36')]();});};}function handleEntityNotFound(_0x6f6880){return function(_0x5e8f51){const _0x321560=a718_0x4201;return!_0x5e8f51&&_0x6f6880[_0x321560('0x3a')](0x194),_0x5e8f51;};}function handleError(_0x2fc4ec,_0x84a788){return _0x84a788=_0x84a788||0x1f4,function(_0x218e89){const _0x300beb=a718_0x4201;logger[_0x300beb('0x19')](_0x218e89[_0x300beb('0x2a')]),_0x218e89[_0x300beb('0x14')]&&delete _0x218e89[_0x300beb('0x14')],_0x2fc4ec[_0x300beb('0x34')](_0x84a788)[_0x300beb('0x2b')](_0x218e89);};}exports['index']=function(_0x4d8e3c,_0x29d6ac){const _0x177517=_0x540c93;let _0x18c7b1={};const _0x3e71b6={},_0x35bf18={'count':0x0,'rows':[]},_0x6c54f0=_[_0x177517('0x0')](db[_0x177517('0x7')]['rawAttributes'],function(_0x486ee8){const _0x5de6f7=_0x177517;return{'name':_0x486ee8[_0x5de6f7('0x3e')],'type':_0x486ee8[_0x5de6f7('0x24')]['key']};});_0x3e71b6[_0x177517('0x29')]=_[_0x177517('0x0')](_0x6c54f0,'name'),_0x3e71b6['query']=_[_0x177517('0x35')](_0x4d8e3c[_0x177517('0x31')]),_0x3e71b6[_0x177517('0x1a')]=_[_0x177517('0x10')](_0x3e71b6[_0x177517('0x29')],_0x3e71b6[_0x177517('0x31')]),_0x18c7b1[_0x177517('0xa')]=_['intersection'](_0x3e71b6[_0x177517('0x29')],qs[_0x177517('0x54')](_0x4d8e3c['query'][_0x177517('0x54')])),_0x18c7b1[_0x177517('0xa')]=_0x18c7b1[_0x177517('0xa')][_0x177517('0x3c')]?_0x18c7b1['attributes']:_0x3e71b6[_0x177517('0x29')];typeof _0x4d8e3c[_0x177517('0x31')][_0x177517('0x39')]===_0x177517('0x40')&&(_0x18c7b1['limit']=qs['limit'](_0x4d8e3c[_0x177517('0x31')][_0x177517('0x52')]),_0x18c7b1[_0x177517('0x4a')]=qs[_0x177517('0x4a')](_0x4d8e3c[_0x177517('0x31')]['offset']));_0x18c7b1[_0x177517('0x47')]=qs['sort'](_0x4d8e3c[_0x177517('0x31')][_0x177517('0x3b')]),_0x18c7b1['where']=qs[_0x177517('0x1a')](_['pick'](_0x4d8e3c['query'],_0x3e71b6[_0x177517('0x1a')]),_0x6c54f0);_0x4d8e3c[_0x177517('0x31')]['filter']&&(_0x18c7b1[_0x177517('0x5')]=_[_0x177517('0xc')](_0x18c7b1[_0x177517('0x5')],{[Op['or']]:_[_0x177517('0x0')](_0x6c54f0,function(_0x51cb2b){const _0x374ea6=_0x177517;if(_0x51cb2b['type']!=='VIRTUAL'){const _0x848eed={};return _0x848eed[_0x51cb2b[_0x374ea6('0x14')]]={[Op['like']]:'%'+_0x4d8e3c[_0x374ea6('0x31')][_0x374ea6('0x49')]+'%'},_0x848eed;}})}));_0x18c7b1=_[_0x177517('0xc')]({},_0x18c7b1,_0x4d8e3c[_0x177517('0x56')]);const _0x3f011a={'where':_0x18c7b1[_0x177517('0x5')]};return db[_0x177517('0x7')][_0x177517('0x13')](_0x3f011a)[_0x177517('0x37')](function(_0x941d66){const _0x262f28=_0x177517;return _0x35bf18[_0x262f28('0x13')]=_0x941d66,_0x4d8e3c[_0x262f28('0x31')][_0x262f28('0x2e')]&&(_0x18c7b1[_0x262f28('0x8')]=[{'all':!![]}]),db[_0x262f28('0x7')][_0x262f28('0x11')](_0x18c7b1);})[_0x177517('0x37')](function(_0x3f5893){const _0x58e31a=_0x177517;return _0x35bf18[_0x58e31a('0x15')]=_0x3f5893,_0x35bf18;})[_0x177517('0x37')](respondWithFilteredResult(_0x29d6ac,_0x18c7b1))[_0x177517('0x1c')](handleError(_0x29d6ac,null));},exports[_0x540c93('0x25')]=function(_0x71b6bc,_0x7da954){const _0x23dc41=_0x540c93;let _0x3b6b1d={'raw':![],'where':{'id':_0x71b6bc[_0x23dc41('0x53')]['id']}};const _0x97020d={};return _0x97020d[_0x23dc41('0x29')]=_[_0x23dc41('0x35')](db['VoiceContext'][_0x23dc41('0x21')]),_0x97020d['query']=_[_0x23dc41('0x35')](_0x71b6bc['query']),_0x97020d['filters']=_[_0x23dc41('0x10')](_0x97020d['model'],_0x97020d[_0x23dc41('0x31')]),_0x3b6b1d['attributes']=_[_0x23dc41('0x10')](_0x97020d[_0x23dc41('0x29')],qs[_0x23dc41('0x54')](_0x71b6bc['query'][_0x23dc41('0x54')])),_0x3b6b1d[_0x23dc41('0xa')]=_0x3b6b1d['attributes'][_0x23dc41('0x3c')]?_0x3b6b1d[_0x23dc41('0xa')]:_0x97020d[_0x23dc41('0x29')],_0x71b6bc[_0x23dc41('0x31')][_0x23dc41('0x2e')]&&(_0x3b6b1d['include']=[{'all':!![]}]),_0x3b6b1d=_[_0x23dc41('0xc')]({},_0x3b6b1d,_0x71b6bc[_0x23dc41('0x56')]),db[_0x23dc41('0x7')][_0x23dc41('0x4e')](_0x3b6b1d)[_0x23dc41('0x37')](handleEntityNotFound(_0x7da954,null))[_0x23dc41('0x37')](respondWithResult(_0x7da954,null))['catch'](handleError(_0x7da954,null));},exports[_0x540c93('0x17')]=function(_0x2a81b6,_0x473854){const _0x17fd5e=_0x540c93;let _0x354304;return db[_0x17fd5e('0x7')][_0x17fd5e('0x17')](_0x2a81b6[_0x17fd5e('0x27')],{'raw':!![]})['then'](function(_0x4c4843){const _0x4f71ac=_0x17fd5e;return _0x354304=_0x4c4843,db[_0x4f71ac('0x7')][_0x4f71ac('0x11')]({'raw':!![]});})['then'](function(_0x2f37b0){const _0x4d975a=_0x17fd5e,_0x3a580b=fs[_0x4d975a('0x42')](path[_0x4d975a('0x1b')](config[_0x4d975a('0x44')],_0x4d975a('0x4b')),_0x4d975a('0x33')),_0x240882=ejs['render'](_0x3a580b,{'contexts':_0x2f37b0||[]});fs[_0x4d975a('0x4d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x240882);})[_0x17fd5e('0x37')](function(){const _0x30620d=_0x17fd5e;return respondWithRpcPromise('Reload',_0x30620d('0x17'),{'module':'chan_sip.so'});})['then'](function(){const _0x5bf18c=_0x17fd5e,_0x48e817=_0x2a81b6[_0x5bf18c('0x22')][_0x5bf18c('0x1e')]({'plain':!![]});if(!_0x48e817)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48e817[_0x5bf18c('0x18')]==='user'){const _0x30c9b2=_0x354304[_0x5bf18c('0x1e')]({'plain':!![]});return db[_0x5bf18c('0x2')]['findOne']({'where':{'name':_0x5bf18c('0x3f'),'userProfileId':_0x48e817[_0x5bf18c('0x41')]},'raw':!![]})['then'](function(_0x5035b4){const _0x1e978a=_0x5bf18c;return _0x5035b4&&_0x5035b4[_0x1e978a('0x2d')]===0x0?db['UserProfileResource'][_0x1e978a('0x17')]({'name':_0x30c9b2[_0x1e978a('0x14')],'resourceId':_0x30c9b2['id'],'type':_0x5035b4[_0x1e978a('0x14')],'sectionId':_0x5035b4['id']},{})['then'](function(){return _0x354304;}):_0x354304;})['catch'](function(_0x2af27a){const _0x35bc8b=_0x5bf18c;logger['error'](_0x35bc8b('0x1f'),_0x2af27a);throw _0x2af27a;});}return _0x354304;})[_0x17fd5e('0x37')](respondWithResult(_0x473854,0xc9))[_0x17fd5e('0x1c')](handleError(_0x473854,null));},exports[_0x540c93('0x50')]=function(_0x12273f,_0x3aeea2){const _0x312d3c=_0x540c93;let _0x2141c0;return db[_0x312d3c('0x7')][_0x312d3c('0x4e')]({'where':{'id':_0x12273f[_0x312d3c('0x53')]['id']}})['then'](handleEntityNotFound(_0x3aeea2,null))['then'](saveUpdates(_0x12273f[_0x312d3c('0x27')],null))[_0x312d3c('0x37')](function(_0x439ca0){const _0x1d3cff=_0x312d3c;if(_0x439ca0)return _0x2141c0=_0x439ca0,db[_0x1d3cff('0x7')]['findAll']({'raw':!![]});})[_0x312d3c('0x37')](function(_0x37b110){const _0x119e7f=_0x312d3c,_0x11ca97=fs[_0x119e7f('0x42')](path[_0x119e7f('0x1b')](config[_0x119e7f('0x44')],_0x119e7f('0x4b')),_0x119e7f('0x33')),_0x1cd621=ejs[_0x119e7f('0x30')](_0x11ca97,{'contexts':_0x37b110||[]});fs[_0x119e7f('0x4d')](_0x119e7f('0xd'),_0x1cd621);})[_0x312d3c('0x37')](function(){const _0x3fe8df=_0x312d3c;return respondWithRpcPromise(_0x3fe8df('0x4'),_0x3fe8df('0x50'),{'module':_0x3fe8df('0x3d')});})[_0x312d3c('0x37')](function(){return _0x2141c0;})[_0x312d3c('0x37')](respondWithResult(_0x3aeea2,null))[_0x312d3c('0x1c')](handleError(_0x3aeea2,null));},exports['destroy']=function(_0x168204,_0x51e642){const _0x26b29e=_0x540c93;return db['VoiceContext'][_0x26b29e('0x4e')]({'where':{'id':_0x168204[_0x26b29e('0x53')]['id']}})['then'](handleEntityNotFound(_0x51e642,null))['then'](removeEntity(_0x51e642,null))[_0x26b29e('0x37')](function(){const _0x188170=_0x26b29e;return db[_0x188170('0x7')][_0x188170('0x11')]({'raw':!![]});})['then'](function(_0x50affa){const _0xfff5dd=_0x26b29e,_0x56e71a=fs['readFileSync'](path['join'](config[_0xfff5dd('0x44')],_0xfff5dd('0x4b')),'utf8'),_0x53db3b=ejs[_0xfff5dd('0x30')](_0x56e71a,{'contexts':_0x50affa});return fs[_0xfff5dd('0x4d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x53db3b),respondWithRpcPromise('Reload',_0xfff5dd('0x38'),{'module':'chan_sip.so'});})[_0x26b29e('0x1c')](handleError(_0x51e642,null));};
\ No newline at end of file
+const a718_0x3b98=['params','intersection','model','Content-Range','writeFileSync','get','merge','../../components/parsers/qs','create','info','user','client','stack','status','options','includeAll','destroy','json','VoiceContext,\x20%s,\x20%s,\x20%s','render','name','../../config/logger','count','where','request\x20sent','update','sendStatus','lodash','offset','body','filter','utf8','readFileSync','attributes','role','VoiceContext,\x20%s,\x20%s','map','filters','message','nolimit','path','show','stringify','http','findOne','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','length','VIRTUAL','end','result','then','undefined','query','rows','order','findAll','root','include','keys','VoiceContext','rawAttributes','sort','Unable\x20to\x20retrieve\x20the\x20current\x20user','set','Contexts','like','index','join','UserProfileResource','limit','/etc/asterisk/extensions_xcally_contexts.conf','pick','autoAssociation','error','code','files/templates/context.ejs','fields','../../config/environment','key','type','catch'];(function(_0x7798c7,_0x3b98bc){const _0x529852=function(_0x3e6c63){while(--_0x3e6c63){_0x7798c7['push'](_0x7798c7['shift']());}};_0x529852(++_0x3b98bc);}(a718_0x3b98,0x18d));const a718_0x5298=function(_0x7798c7,_0x3b98bc){_0x7798c7=_0x7798c7-0x0;let _0x529852=a718_0x3b98[_0x7798c7];return _0x529852;};const _0x13f613=a718_0x5298;'use strict';const path=require(_0x13f613('0x35')),ejs=require('ejs'),fs=require('fs'),_=require(_0x13f613('0x28')),qs=require(_0x13f613('0x14')),logger=require(_0x13f613('0x22'))('api'),config=require(_0x13f613('0x9')),db=require('../../mysqldb')['db'],{Op}=require('sequelize'),jayson=require('jayson/promise'),client=jayson[_0x13f613('0x18')][_0x13f613('0x38')]({'port':0x232a});function respondWithRpcPromise(_0x3e6c63,_0x113847,_0x20fa4a,_0x40dad9){return new Promise(function(_0x26f778,_0x2eb736){const _0x25e6c7=a718_0x5298,_0x4e9dc9=_0x40dad9||client;return _0x4e9dc9['request'](_0x3e6c63,_0x20fa4a)[_0x25e6c7('0x40')](function(_0x1f4605){const _0x4bedc2=_0x25e6c7;logger[_0x4bedc2('0x16')](_0x4bedc2('0x30'),_0x113847,'request\x20sent'),logger['debug'](_0x4bedc2('0x1f'),_0x113847,'request\x20sent',JSON[_0x4bedc2('0x37')](_0x1f4605));if(_0x1f4605['error']){if(_0x1f4605[_0x4bedc2('0x5')][_0x4bedc2('0x6')]===0x1f4)return logger[_0x4bedc2('0x5')]('VoiceContext,\x20%s,\x20%s',_0x113847,_0x1f4605[_0x4bedc2('0x5')][_0x4bedc2('0x33')]),_0x2eb736(_0x1f4605[_0x4bedc2('0x5')][_0x4bedc2('0x33')]);return logger[_0x4bedc2('0x5')]('VoiceContext,\x20%s,\x20%s',_0x113847,_0x1f4605['error'][_0x4bedc2('0x33')]),_0x26f778(_0x1f4605['error'][_0x4bedc2('0x33')]);}else logger[_0x4bedc2('0x16')]('VoiceContext,\x20%s,\x20%s',_0x113847,_0x4bedc2('0x25')),_0x26f778(_0x1f4605[_0x4bedc2('0x3f')][_0x4bedc2('0x33')]);})['catch'](function(_0x158d34){const _0xdc606a=_0x25e6c7;logger[_0xdc606a('0x5')]('VoiceContext,\x20%s,\x20%s',_0x113847,_0x158d34),_0x2eb736(_0x158d34);});});}function respondWithResult(_0x2ead05,_0x13969f){return _0x13969f=_0x13969f||0xc8,function(_0x6f53d0){const _0x32ad6c=a718_0x5298;if(_0x6f53d0)return _0x2ead05[_0x32ad6c('0x1a')](_0x13969f)[_0x32ad6c('0x1e')](_0x6f53d0);};}function respondWithFilteredResult(_0x409abb,_0x35c3e1){return function(_0x1ddd4){const _0x8979f8=a718_0x5298;if(_0x1ddd4){const _0x558b29=_0x1ddd4[_0x8979f8('0x23')],_0x36b403=_0x35c3e1[_0x8979f8('0x29')];let _0xc7533d=_0x35c3e1[_0x8979f8('0x29')]+_0x35c3e1['limit'],_0x4ee8ac;return _0xc7533d>=_0x558b29?(_0xc7533d=_0x558b29,_0x4ee8ac=0xc8):_0x4ee8ac=0xce,_0x409abb[_0x8979f8('0x1a')](_0x4ee8ac),_0x409abb[_0x8979f8('0x4d')](_0x8979f8('0x10'),_0x36b403+'-'+_0xc7533d+'/'+_0x558b29)[_0x8979f8('0x1e')](_0x1ddd4);}return null;};}function saveUpdates(_0x54e13b){return function(_0x34705d){const _0x28e4e0=a718_0x5298;if(_0x34705d)return _0x34705d[_0x28e4e0('0x26')](_0x54e13b)['then'](function(_0x41006b){return _0x41006b;});return null;};}function removeEntity(_0x573939){return function(_0x5ce86f){const _0x52ead0=a718_0x5298;if(_0x5ce86f)return _0x5ce86f[_0x52ead0('0x1d')]()[_0x52ead0('0x40')](function(){const _0x2f9470=_0x52ead0,_0x68acae=_0x5ce86f[_0x2f9470('0x12')]({'plain':!![]}),_0x569263='Contexts';return db[_0x2f9470('0x0')]['destroy']({'where':{'type':_0x569263,'resourceId':_0x68acae['id']}})[_0x2f9470('0x40')](function(){return _0x5ce86f;});})['then'](function(){const _0x263ab5=_0x52ead0;_0x573939[_0x263ab5('0x1a')](0xcc)[_0x263ab5('0x3e')]();});};}function handleEntityNotFound(_0x5dda21){return function(_0x1058d4){const _0x2b5a6f=a718_0x5298;return!_0x1058d4&&_0x5dda21[_0x2b5a6f('0x27')](0x194),_0x1058d4;};}function handleError(_0x3c7cbf,_0x44f895){return _0x44f895=_0x44f895||0x1f4,function(_0x12b211){const _0x2bf2a7=a718_0x5298;logger[_0x2bf2a7('0x5')](_0x12b211[_0x2bf2a7('0x19')]),_0x12b211[_0x2bf2a7('0x21')]&&delete _0x12b211['name'],_0x3c7cbf['status'](_0x44f895)['send'](_0x12b211);};}exports[_0x13f613('0x50')]=function(_0x2a9dd7,_0x242427){const _0x3e180c=_0x13f613;let _0x45387f={};const _0x253b08={},_0xfcb46={'count':0x0,'rows':[]},_0x5a5b66=_[_0x3e180c('0x31')](db['VoiceContext'][_0x3e180c('0x4a')],function(_0x9ea0a){const _0x407a20=_0x3e180c;return{'name':_0x9ea0a['fieldName'],'type':_0x9ea0a[_0x407a20('0xb')][_0x407a20('0xa')]};});_0x253b08[_0x3e180c('0xf')]=_['map'](_0x5a5b66,_0x3e180c('0x21')),_0x253b08[_0x3e180c('0x42')]=_[_0x3e180c('0x48')](_0x2a9dd7['query']),_0x253b08[_0x3e180c('0x32')]=_[_0x3e180c('0xe')](_0x253b08['model'],_0x253b08[_0x3e180c('0x42')]),_0x45387f[_0x3e180c('0x2e')]=_[_0x3e180c('0xe')](_0x253b08['model'],qs[_0x3e180c('0x8')](_0x2a9dd7['query'][_0x3e180c('0x8')])),_0x45387f[_0x3e180c('0x2e')]=_0x45387f[_0x3e180c('0x2e')][_0x3e180c('0x3c')]?_0x45387f[_0x3e180c('0x2e')]:_0x253b08[_0x3e180c('0xf')];typeof _0x2a9dd7['query'][_0x3e180c('0x34')]===_0x3e180c('0x41')&&(_0x45387f[_0x3e180c('0x1')]=qs[_0x3e180c('0x1')](_0x2a9dd7['query'][_0x3e180c('0x1')]),_0x45387f[_0x3e180c('0x29')]=qs[_0x3e180c('0x29')](_0x2a9dd7[_0x3e180c('0x42')][_0x3e180c('0x29')]));_0x45387f[_0x3e180c('0x44')]=qs[_0x3e180c('0x4b')](_0x2a9dd7['query']['sort']),_0x45387f[_0x3e180c('0x24')]=qs[_0x3e180c('0x32')](_[_0x3e180c('0x3')](_0x2a9dd7[_0x3e180c('0x42')],_0x253b08[_0x3e180c('0x32')]),_0x5a5b66);_0x2a9dd7[_0x3e180c('0x42')]['filter']&&(_0x45387f[_0x3e180c('0x24')]=_['merge'](_0x45387f['where'],{[Op['or']]:_[_0x3e180c('0x31')](_0x5a5b66,function(_0x1eee9e){const _0x31a7ba=_0x3e180c;if(_0x1eee9e[_0x31a7ba('0xb')]!==_0x31a7ba('0x3d')){const _0xfc5bce={};return _0xfc5bce[_0x1eee9e[_0x31a7ba('0x21')]]={[Op[_0x31a7ba('0x4f')]]:'%'+_0x2a9dd7[_0x31a7ba('0x42')][_0x31a7ba('0x2b')]+'%'},_0xfc5bce;}})}));_0x45387f=_['merge']({},_0x45387f,_0x2a9dd7[_0x3e180c('0x1b')]);const _0x15bd52={'where':_0x45387f[_0x3e180c('0x24')]};return db[_0x3e180c('0x49')][_0x3e180c('0x23')](_0x15bd52)[_0x3e180c('0x40')](function(_0x301da8){const _0x1eb26e=_0x3e180c;return _0xfcb46[_0x1eb26e('0x23')]=_0x301da8,_0x2a9dd7[_0x1eb26e('0x42')][_0x1eb26e('0x1c')]&&(_0x45387f[_0x1eb26e('0x47')]=[{'all':!![]}]),db[_0x1eb26e('0x49')][_0x1eb26e('0x45')](_0x45387f);})['then'](function(_0x4c17d4){const _0x4ab65d=_0x3e180c;return _0xfcb46[_0x4ab65d('0x43')]=_0x4c17d4,_0xfcb46;})[_0x3e180c('0x40')](respondWithFilteredResult(_0x242427,_0x45387f))['catch'](handleError(_0x242427,null));},exports[_0x13f613('0x36')]=function(_0x536722,_0x47d1b5){const _0x283102=_0x13f613;let _0x5938b6={'raw':![],'where':{'id':_0x536722[_0x283102('0xd')]['id']}};const _0xd9b3cd={};return _0xd9b3cd[_0x283102('0xf')]=_[_0x283102('0x48')](db[_0x283102('0x49')]['rawAttributes']),_0xd9b3cd['query']=_[_0x283102('0x48')](_0x536722['query']),_0xd9b3cd[_0x283102('0x32')]=_[_0x283102('0xe')](_0xd9b3cd[_0x283102('0xf')],_0xd9b3cd['query']),_0x5938b6['attributes']=_[_0x283102('0xe')](_0xd9b3cd[_0x283102('0xf')],qs[_0x283102('0x8')](_0x536722[_0x283102('0x42')]['fields'])),_0x5938b6[_0x283102('0x2e')]=_0x5938b6[_0x283102('0x2e')][_0x283102('0x3c')]?_0x5938b6[_0x283102('0x2e')]:_0xd9b3cd[_0x283102('0xf')],_0x536722['query'][_0x283102('0x1c')]&&(_0x5938b6[_0x283102('0x47')]=[{'all':!![]}]),_0x5938b6=_[_0x283102('0x13')]({},_0x5938b6,_0x536722[_0x283102('0x1b')]),db[_0x283102('0x49')][_0x283102('0x39')](_0x5938b6)[_0x283102('0x40')](handleEntityNotFound(_0x47d1b5,null))[_0x283102('0x40')](respondWithResult(_0x47d1b5,null))[_0x283102('0xc')](handleError(_0x47d1b5,null));},exports['create']=function(_0x97e713,_0x168937){const _0x8f0722=_0x13f613;let _0x3402b1;return db[_0x8f0722('0x49')][_0x8f0722('0x15')](_0x97e713[_0x8f0722('0x2a')],{'raw':!![]})['then'](function(_0x19ad69){const _0x194320=_0x8f0722;return _0x3402b1=_0x19ad69,db[_0x194320('0x49')][_0x194320('0x45')]({'raw':!![]});})[_0x8f0722('0x40')](function(_0x87bbe8){const _0xadb2d=_0x8f0722,_0x2a34ce=fs[_0xadb2d('0x2d')](path[_0xadb2d('0x51')](config[_0xadb2d('0x46')],_0xadb2d('0x7')),_0xadb2d('0x2c')),_0x392d6c=ejs[_0xadb2d('0x20')](_0x2a34ce,{'contexts':_0x87bbe8||[]});fs[_0xadb2d('0x11')](_0xadb2d('0x2'),_0x392d6c);})[_0x8f0722('0x40')](function(){const _0x5aba2a=_0x8f0722;return respondWithRpcPromise('Reload',_0x5aba2a('0x15'),{'module':'chan_sip.so'});})['then'](function(){const _0x4bdd4c=_0x8f0722,_0x40bd56=_0x97e713[_0x4bdd4c('0x17')][_0x4bdd4c('0x12')]({'plain':!![]});if(!_0x40bd56)throw new Error(_0x4bdd4c('0x4c'));if(_0x40bd56[_0x4bdd4c('0x2f')]===_0x4bdd4c('0x17')){const _0x117fe9=_0x3402b1[_0x4bdd4c('0x12')]({'plain':!![]});return db['UserProfileSection'][_0x4bdd4c('0x39')]({'where':{'name':_0x4bdd4c('0x4e'),'userProfileId':_0x40bd56['userProfileId']},'raw':!![]})[_0x4bdd4c('0x40')](function(_0x5c46ef){const _0x8e3a23=_0x4bdd4c;return _0x5c46ef&&_0x5c46ef[_0x8e3a23('0x4')]===0x0?db[_0x8e3a23('0x0')][_0x8e3a23('0x15')]({'name':_0x117fe9['name'],'resourceId':_0x117fe9['id'],'type':_0x5c46ef[_0x8e3a23('0x21')],'sectionId':_0x5c46ef['id']},{})[_0x8e3a23('0x40')](function(){return _0x3402b1;}):_0x3402b1;})[_0x4bdd4c('0xc')](function(_0x1c91cc){const _0x49fc75=_0x4bdd4c;logger[_0x49fc75('0x5')](_0x49fc75('0x3a'),_0x1c91cc);throw _0x1c91cc;});}return _0x3402b1;})[_0x8f0722('0x40')](respondWithResult(_0x168937,0xc9))[_0x8f0722('0xc')](handleError(_0x168937,null));},exports[_0x13f613('0x26')]=function(_0x193b6e,_0x7bcf16){const _0x50bf31=_0x13f613;let _0x8e33d0;return db[_0x50bf31('0x49')][_0x50bf31('0x39')]({'where':{'id':_0x193b6e['params']['id']}})[_0x50bf31('0x40')](handleEntityNotFound(_0x7bcf16,null))[_0x50bf31('0x40')](saveUpdates(_0x193b6e[_0x50bf31('0x2a')],null))[_0x50bf31('0x40')](function(_0x3e8ac1){const _0x2e8eb7=_0x50bf31;if(_0x3e8ac1)return _0x8e33d0=_0x3e8ac1,db[_0x2e8eb7('0x49')]['findAll']({'raw':!![]});})[_0x50bf31('0x40')](function(_0x14b5a2){const _0x19a412=_0x50bf31,_0x40a8d4=fs['readFileSync'](path[_0x19a412('0x51')](config[_0x19a412('0x46')],'files/templates/context.ejs'),_0x19a412('0x2c')),_0x2e7015=ejs[_0x19a412('0x20')](_0x40a8d4,{'contexts':_0x14b5a2||[]});fs['writeFileSync'](_0x19a412('0x2'),_0x2e7015);})[_0x50bf31('0x40')](function(){const _0x5ab7f2=_0x50bf31;return respondWithRpcPromise(_0x5ab7f2('0x3b'),_0x5ab7f2('0x26'),{'module':'chan_sip.so'});})[_0x50bf31('0x40')](function(){return _0x8e33d0;})[_0x50bf31('0x40')](respondWithResult(_0x7bcf16,null))['catch'](handleError(_0x7bcf16,null));},exports[_0x13f613('0x1d')]=function(_0x2985ed,_0x59a97e){const _0x2ab1df=_0x13f613;return db['VoiceContext'][_0x2ab1df('0x39')]({'where':{'id':_0x2985ed['params']['id']}})[_0x2ab1df('0x40')](handleEntityNotFound(_0x59a97e,null))['then'](removeEntity(_0x59a97e,null))['then'](function(){const _0x4907a8=_0x2ab1df;return db[_0x4907a8('0x49')][_0x4907a8('0x45')]({'raw':!![]});})[_0x2ab1df('0x40')](function(_0x1be04b){const _0x527ccd=_0x2ab1df,_0x1110c4=fs[_0x527ccd('0x2d')](path[_0x527ccd('0x51')](config[_0x527ccd('0x46')],_0x527ccd('0x7')),_0x527ccd('0x2c')),_0x26bd2a=ejs['render'](_0x1110c4,{'contexts':_0x1be04b});return fs['writeFileSync'](_0x527ccd('0x2'),_0x26bd2a),respondWithRpcPromise('Reload',_0x527ccd('0x1d'),{'module':'chan_sip.so'});})[_0x2ab1df('0xc')](handleError(_0x59a97e,null));};
\ No newline at end of file