Built motion from commit (unavailable).|2.5.11
[motion2.git] / server / api / voicePrefix / voicePrefix.controller.js
index a7cd5ad..8b9e88d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb091=['prefix','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','charAt','update','system-','addAgents','ids','removeAgents','isArray','userVoicePrefix:remove','emit','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','index','VoicePrefix','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','sequelize','transaction','create','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','appdata','NoOp','VoicePrefixId','Extensions\x20creation\x20failed'];(function(_0x437c10,_0x464d93){var _0x345deb=function(_0x34cd07){while(--_0x34cd07){_0x437c10['push'](_0x437c10['shift']());}};_0x345deb(++_0x464d93);}(_0xb091,0x16e));var _0x1b09=function(_0x158e09,_0x3a6427){_0x158e09=_0x158e09-0x0;var _0x48585b=_0xb091[_0x158e09];return _0x48585b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b09('0x0'));var rimraf=require(_0x1b09('0x1'));var zipdir=require(_0x1b09('0x2'));var jsonpatch=require(_0x1b09('0x3'));var rp=require('request-promise');var moment=require(_0x1b09('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b09('0x5'));var path=require(_0x1b09('0x6'));var sox=require('sox');var csv=require(_0x1b09('0x7'));var ejs=require(_0x1b09('0x8'));var fs=require('fs');var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0x7'));var querystring=require(_0x1b09('0xd'));var Papa=require(_0x1b09('0xe'));var Redis=require(_0x1b09('0xf'));var authService=require(_0x1b09('0x10'));var qs=require(_0x1b09('0x11'));var as=require(_0x1b09('0x12'));var hardwareService=require(_0x1b09('0x13'));var logger=require('../../config/logger')(_0x1b09('0x14'));var utils=require(_0x1b09('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x16'))['db'];config[_0x1b09('0x17')]=_[_0x1b09('0x18')](config[_0x1b09('0x17')],{'host':_0x1b09('0x19'),'port':0x18eb});var socket=require(_0x1b09('0x1a'))(new Redis(config[_0x1b09('0x17')]));require('./voicePrefix.socket')[_0x1b09('0x1b')](socket);function respondWithStatusCode(_0x515ade,_0x455a8e){_0x455a8e=_0x455a8e||0xcc;return function(_0x27a731){if(_0x27a731){return _0x515ade[_0x1b09('0x1c')](_0x455a8e);}return _0x515ade[_0x1b09('0x1d')](_0x455a8e)[_0x1b09('0x1e')]();};}function respondWithResult(_0x1dc96b,_0x64689a){_0x64689a=_0x64689a||0xc8;return function(_0x33129b){if(_0x33129b){return _0x1dc96b[_0x1b09('0x1d')](_0x64689a)[_0x1b09('0x1f')](_0x33129b);}};}function respondWithFilteredResult(_0x311158,_0x231ef6){return function(_0x646575){if(_0x646575){var _0x4c64e1=_0x646575['count'],_0x214c6b=_0x231ef6[_0x1b09('0x20')],_0x1c1ef9=_0x231ef6['offset']+_0x231ef6[_0x1b09('0x21')],_0x5483ef;if(_0x1c1ef9>=_0x4c64e1){_0x1c1ef9=_0x4c64e1;_0x5483ef=0xc8;}else{_0x5483ef=0xce;}_0x311158['status'](_0x5483ef);return _0x311158[_0x1b09('0x22')](_0x1b09('0x23'),_0x214c6b+'-'+_0x1c1ef9+'/'+_0x4c64e1)[_0x1b09('0x1f')](_0x646575);}return null;};}function patchUpdates(_0x1e8f97){return function(_0x29dd70){try{jsonpatch[_0x1b09('0x24')](_0x29dd70,_0x1e8f97,!![]);}catch(_0x363e78){return BPromise[_0x1b09('0x25')](_0x363e78);}return _0x29dd70['save']();};}function saveUpdates(_0x5e2806,_0x27f4f5){return function(_0x41c786){if(_0x41c786){return _0x41c786['update'](_0x5e2806)[_0x1b09('0x26')](function(_0x11d0d5){return _0x11d0d5;});}return null;};}function removeEntity(_0x6e132c,_0xb22064){return function(_0x5a9677){if(_0x5a9677){return _0x5a9677[_0x1b09('0x27')]()[_0x1b09('0x26')](function(){var _0x4936d0=_0x5a9677[_0x1b09('0x28')]({'plain':!![]});var _0x472d30='VoicePrefixes';return db[_0x1b09('0x29')][_0x1b09('0x27')]({'where':{'type':_0x472d30,'resourceId':_0x4936d0['id']}})[_0x1b09('0x26')](function(){return _0x5a9677;});})[_0x1b09('0x26')](function(){_0x6e132c['status'](0xcc)[_0x1b09('0x1e')]();});}};}function handleEntityNotFound(_0x3cdbc5,_0x532589){return function(_0x2d1ec0){if(!_0x2d1ec0){_0x3cdbc5[_0x1b09('0x1c')](0x194);}return _0x2d1ec0;};}function handleError(_0x26befb,_0x1cbbd5){_0x1cbbd5=_0x1cbbd5||0x1f4;return function(_0x11098e){logger[_0x1b09('0x2a')](_0x11098e[_0x1b09('0x2b')]);if(_0x11098e['name']){delete _0x11098e[_0x1b09('0x2c')];}_0x26befb[_0x1b09('0x1d')](_0x1cbbd5)['send'](_0x11098e);};}exports[_0x1b09('0x2d')]=function(_0x1a6130,_0x1b98da){var _0x122b1c={},_0x62a96b={},_0x4b3aec={'count':0x0,'rows':[]};var _0x4540de=_['map'](db[_0x1b09('0x2e')]['rawAttributes'],function(_0x1ee079){return{'name':_0x1ee079[_0x1b09('0x2f')],'type':_0x1ee079[_0x1b09('0x30')][_0x1b09('0x31')]};});_0x62a96b[_0x1b09('0x32')]=_[_0x1b09('0x33')](_0x4540de,_0x1b09('0x2c'));_0x62a96b[_0x1b09('0x34')]=_[_0x1b09('0x35')](_0x1a6130[_0x1b09('0x34')]);_0x62a96b['filters']=_[_0x1b09('0x36')](_0x62a96b[_0x1b09('0x32')],_0x62a96b[_0x1b09('0x34')]);_0x122b1c['attributes']=_[_0x1b09('0x36')](_0x62a96b[_0x1b09('0x32')],qs[_0x1b09('0x37')](_0x1a6130[_0x1b09('0x34')][_0x1b09('0x37')]));_0x122b1c[_0x1b09('0x38')]=_0x122b1c[_0x1b09('0x38')][_0x1b09('0x39')]?_0x122b1c['attributes']:_0x62a96b[_0x1b09('0x32')];if(!_0x1a6130['query'][_0x1b09('0x3a')]('nolimit')){_0x122b1c[_0x1b09('0x21')]=qs[_0x1b09('0x21')](_0x1a6130[_0x1b09('0x34')][_0x1b09('0x21')]);_0x122b1c[_0x1b09('0x20')]=qs[_0x1b09('0x20')](_0x1a6130[_0x1b09('0x34')][_0x1b09('0x20')]);}_0x122b1c[_0x1b09('0x3b')]=qs[_0x1b09('0x3c')](_0x1a6130[_0x1b09('0x34')][_0x1b09('0x3c')]);_0x122b1c[_0x1b09('0x3d')]=qs['filters'](_['pick'](_0x1a6130[_0x1b09('0x34')],_0x62a96b[_0x1b09('0x3e')]),_0x4540de);if(_0x1a6130[_0x1b09('0x34')][_0x1b09('0x3f')]){_0x122b1c[_0x1b09('0x3d')]=_[_0x1b09('0x40')](_0x122b1c[_0x1b09('0x3d')],{'$or':_[_0x1b09('0x33')](_0x4540de,function(_0x4dd7e2){if(_0x4dd7e2['type']!==_0x1b09('0x41')){var _0x51d5eb={};_0x51d5eb[_0x4dd7e2[_0x1b09('0x2c')]]={'$like':'%'+_0x1a6130[_0x1b09('0x34')][_0x1b09('0x3f')]+'%'};return _0x51d5eb;}})});}_0x122b1c=_['merge']({},_0x122b1c,_0x1a6130[_0x1b09('0x42')]);var _0x23bdde={'where':_0x122b1c[_0x1b09('0x3d')]};return db['VoicePrefix'][_0x1b09('0x43')](_0x23bdde)[_0x1b09('0x26')](function(_0x237b99){_0x4b3aec[_0x1b09('0x43')]=_0x237b99;if(_0x1a6130['query'][_0x1b09('0x44')]){_0x122b1c[_0x1b09('0x45')]=[{'all':!![]}];}return db['VoicePrefix'][_0x1b09('0x46')](_0x122b1c);})[_0x1b09('0x26')](function(_0x4d8597){_0x4b3aec['rows']=_0x4d8597;return _0x4b3aec;})['then'](respondWithFilteredResult(_0x1b98da,_0x122b1c))['catch'](handleError(_0x1b98da,null));};exports[_0x1b09('0x47')]=function(_0xabc336,_0x1314b8){var _0x50bafc={'raw':![],'where':{'id':_0xabc336[_0x1b09('0x48')]['id']}},_0x207af5={};_0x207af5['model']=_[_0x1b09('0x35')](db[_0x1b09('0x2e')][_0x1b09('0x49')]);_0x207af5[_0x1b09('0x34')]=_[_0x1b09('0x35')](_0xabc336[_0x1b09('0x34')]);_0x207af5[_0x1b09('0x3e')]=_[_0x1b09('0x36')](_0x207af5[_0x1b09('0x32')],_0x207af5[_0x1b09('0x34')]);_0x50bafc['attributes']=_[_0x1b09('0x36')](_0x207af5[_0x1b09('0x32')],qs[_0x1b09('0x37')](_0xabc336['query'][_0x1b09('0x37')]));_0x50bafc['attributes']=_0x50bafc[_0x1b09('0x38')][_0x1b09('0x39')]?_0x50bafc['attributes']:_0x207af5[_0x1b09('0x32')];if(_0xabc336[_0x1b09('0x34')][_0x1b09('0x44')]){_0x50bafc[_0x1b09('0x45')]=[{'all':!![]}];}_0x50bafc=_[_0x1b09('0x40')]({},_0x50bafc,_0xabc336[_0x1b09('0x42')]);return db['VoicePrefix'][_0x1b09('0x4a')](_0x50bafc)['then'](handleEntityNotFound(_0x1314b8,null))[_0x1b09('0x26')](respondWithResult(_0x1314b8,null))['catch'](handleError(_0x1314b8,null));};exports['destroy']=function(_0x55376,_0x141b98){return db[_0x1b09('0x2e')][_0x1b09('0x4a')]({'where':{'id':_0x55376[_0x1b09('0x48')]['id']}})[_0x1b09('0x26')](handleEntityNotFound(_0x141b98,null))[_0x1b09('0x26')](removeEntity(_0x141b98,null))[_0x1b09('0x4b')](handleError(_0x141b98,null));};exports['describe']=function(_0x24028e,_0x3c6ea6){return db[_0x1b09('0x2e')]['describe']()['then'](respondWithResult(_0x3c6ea6,null))[_0x1b09('0x4b')](handleError(_0x3c6ea6,null));};exports['create']=function(_0x2abc94,_0x3e3dc2){var _0x49b051;return db[_0x1b09('0x4c')][_0x1b09('0x4d')](function(_0x5941df){return db[_0x1b09('0x2e')][_0x1b09('0x4e')](_0x2abc94[_0x1b09('0x4f')],{'transaction':_0x5941df})[_0x1b09('0x26')](function(_0x18adb5){_0x49b051=_0x18adb5['get']({'plain':!![]});return db[_0x1b09('0x50')][_0x1b09('0x4a')]({'where':{'id':_0x49b051[_0x1b09('0x51')]},'raw':!![]})[_0x1b09('0x26')](function(_0x34e660){return createVoicePrefixExtensions(_0x49b051,_0x34e660,_0x5941df);});});})[_0x1b09('0x26')](function(){var _0x7ee6af=_0x2abc94['user']['get']({'plain':!![]});if(!_0x7ee6af)throw new Error(_0x1b09('0x52'));if(_0x7ee6af[_0x1b09('0x53')]===_0x1b09('0x54')){var _0x533eb5=_0x49b051;return db[_0x1b09('0x55')][_0x1b09('0x4a')]({'where':{'name':_0x1b09('0x56'),'userProfileId':_0x7ee6af['userProfileId']},'raw':!![]})[_0x1b09('0x26')](function(_0x2dcdb6){if(_0x2dcdb6&&_0x2dcdb6[_0x1b09('0x57')]===0x0){return db[_0x1b09('0x29')][_0x1b09('0x4e')]({'name':_0x533eb5[_0x1b09('0x2c')],'resourceId':_0x533eb5['id'],'type':_0x2dcdb6[_0x1b09('0x2c')],'sectionId':_0x2dcdb6['id']},{})[_0x1b09('0x26')](function(){return _0x49b051;});}else{return _0x49b051;}})[_0x1b09('0x4b')](function(_0xcab572){logger[_0x1b09('0x2a')](_0x1b09('0x58'),_0xcab572);throw _0xcab572;});}return _0x49b051;})[_0x1b09('0x26')](respondWithResult(_0x3e3dc2,null))[_0x1b09('0x4b')](handleError(_0x3e3dc2,null));};function Extension(_0x7dd20a,_0x4ca41c,_0x5766cb,_0x2cc31e){this['context']=_0x1b09('0x59');this[_0x1b09('0x5a')]=_0x7dd20a;this[_0x1b09('0x5b')]=_0x5766cb;this['type']='system';this[_0x1b09('0x5c')]=_0x1b09('0x5d');this['priority']=_0x4ca41c;this[_0x1b09('0x5e')]=_0x2cc31e;}function createVoicePrefixExtensions(_0x2f2388,_0x1ba539,_0x410b16){return new BPromise(function(_0x284185,_0x1f8f1c){var _0x24a20d=new Extension(formatPrefixName(_0x2f2388['prefix']),0x1,_0x1b09('0x5f'),'Voice\x20Prefix');_0x24a20d[_0x1b09('0x60')]=_0x2f2388['id'];return db[_0x1b09('0x50')][_0x1b09('0x4e')](_0x24a20d,{'transaction':_0x410b16})[_0x1b09('0x26')](function(_0x1ed857){var _0x178ab7=_0x1ed857[_0x1b09('0x28')]({'plain':!![]});var _0x44ffc1=_[_0x1b09('0x33')](addVoicePrefixExtensions(_0x2f2388,_0x1ba539),function(_0x3e1dba){_0x3e1dba[_0x1b09('0x51')]=_0x178ab7['id'];_0x3e1dba[_0x1b09('0x60')]=_0x2f2388['id'];return _0x3e1dba;});return db['VoiceExtension']['bulkCreate'](_0x44ffc1,{'transaction':_0x410b16})[_0x1b09('0x26')](function(_0x314411){if(!_0x314411){return _0x1f8f1c(_0x1b09('0x61'));}else{return _0x284185(_0x314411);}})['catch'](function(_0x42fa10){return _0x1f8f1c(_0x42fa10);});});;});};function addVoicePrefixExtensions(_0x7b6db1,_0x2b422c){var _0x57bec1=[];var _0x28d473=formatPrefixName(_0x7b6db1[_0x1b09('0x62')]);_0x57bec1[_0x1b09('0x63')](new Extension(_0x28d473,0x2,'Set',_0x1b09('0x64')+_0x7b6db1['name']));if(_0x7b6db1['callerIdAll']){_0x57bec1[_0x1b09('0x63')](new Extension(_0x28d473,0x3,_0x1b09('0x65'),_0x1b09('0x66')+_0x7b6db1['callerIdAll']));}else{_0x57bec1[_0x1b09('0x63')](new Extension(_0x28d473,0x3,'NoOp',_0x1b09('0x67')));}_0x57bec1[_0x1b09('0x63')](new Extension(_0x28d473,0x4,'goto',_0x2b422c[_0x1b09('0x68')]+','+'${EXTEN:'+(0x8+_0x7b6db1[_0x1b09('0x2c')][_0x1b09('0x39')])+'}'+','+0x1));return _0x57bec1;}function formatPrefixName(_0x52b5cf){var _0x1acf31='_';for(var _0x597a68=0x0;_0x597a68<_0x52b5cf[_0x1b09('0x39')];_0x597a68++){if(_0x52b5cf[_0x1b09('0x69')](_0x597a68)=='-'){_0x1acf31+=_0x52b5cf[_0x1b09('0x69')](_0x597a68);}else{_0x1acf31+='['+_0x52b5cf[_0x1b09('0x69')](_0x597a68)+']';}}_0x1acf31+='.';return _0x1acf31;}exports[_0x1b09('0x6a')]=function(_0x576060,_0x2ed2a7,_0x150b7e){var _0x410138=_0x576060['body'];_0x410138[_0x1b09('0x62')]=_0x1b09('0x6b')+_0x410138[_0x1b09('0x2c')]+'-';return db[_0x1b09('0x4c')][_0x1b09('0x4d')](function(_0x5051dc){return db[_0x1b09('0x2e')]['update'](_0x410138,{'where':{'id':_0x410138['id']},'transaction':_0x5051dc})[_0x1b09('0x26')](function(){return db[_0x1b09('0x50')][_0x1b09('0x27')]({'where':{'VoicePrefixId':_0x410138['id']},'transaction':_0x5051dc})[_0x1b09('0x26')](function(){return db[_0x1b09('0x50')][_0x1b09('0x4a')]({'where':{'id':_0x410138[_0x1b09('0x51')]},'raw':!![]})[_0x1b09('0x26')](function(_0x4e74de){return createVoicePrefixExtensions(_0x410138,_0x4e74de,_0x5051dc);});});});})[_0x1b09('0x26')](function(){return db[_0x1b09('0x2e')]['findById'](_0x410138['id']);})[_0x1b09('0x26')](respondWithResult(_0x2ed2a7,null))[_0x1b09('0x4b')](handleError(_0x2ed2a7,null));};exports[_0x1b09('0x6c')]=function(_0x24871f,_0x309168,_0xe6d81b){return db[_0x1b09('0x2e')][_0x1b09('0x4a')]({'where':{'id':_0x24871f[_0x1b09('0x48')]['id']}})['then'](handleEntityNotFound(_0x309168,null))[_0x1b09('0x26')](function(_0xd83b8c){if(_0xd83b8c){return _0xd83b8c[_0x1b09('0x6c')](_0x24871f[_0x1b09('0x4f')][_0x1b09('0x6d')],_['omit'](_0x24871f[_0x1b09('0x4f')],[_0x1b09('0x6d'),'id'])||{})['spread'](function(_0x2eeb15){for(var _0x5add57=0x0;_0x5add57<_0x24871f[_0x1b09('0x4f')][_0x1b09('0x6d')][_0x1b09('0x39')];_0x5add57+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x24871f['body'][_0x1b09('0x6d')][_0x5add57],'VoicePrefixId':_0x24871f[_0x1b09('0x48')]['id']});}return _0x2eeb15;});}})[_0x1b09('0x26')](respondWithResult(_0x309168,null))[_0x1b09('0x4b')](handleError(_0x309168,null));};exports[_0x1b09('0x6e')]=function(_0x326564,_0x1b71cc,_0x408d2b){return db[_0x1b09('0x2e')][_0x1b09('0x4a')]({'where':{'id':_0x326564[_0x1b09('0x48')]['id']}})[_0x1b09('0x26')](handleEntityNotFound(_0x1b71cc,null))['then'](function(_0x47a45c){if(_0x47a45c){return _0x47a45c[_0x1b09('0x6e')](_0x326564[_0x1b09('0x34')][_0x1b09('0x6d')])[_0x1b09('0x26')](function(){if(_[_0x1b09('0x6f')](_0x326564[_0x1b09('0x34')][_0x1b09('0x6d')])){for(var _0x52f219=0x0;_0x52f219<_0x326564[_0x1b09('0x34')][_0x1b09('0x6d')][_0x1b09('0x39')];_0x52f219+=0x1){socket['emit'](_0x1b09('0x70'),{'UserId':Number(_0x326564[_0x1b09('0x34')][_0x1b09('0x6d')][_0x52f219]),'VoicePrefixId':Number(_0x326564[_0x1b09('0x48')]['id'])});}}else{socket[_0x1b09('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x326564['query'][_0x1b09('0x6d')]),'VoicePrefixId':Number(_0x326564[_0x1b09('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b71cc,null))[_0x1b09('0x4b')](handleError(_0x1b71cc,null));};exports['getAgents']=function(_0x3b66fc,_0x42bbc0,_0x18d0e9){var _0x595a32={};var _0x14f277={};var _0x4c504d;var _0x4c4b37;return db[_0x1b09('0x2e')]['findOne']({'where':{'id':_0x3b66fc['params']['id']}})['then'](handleEntityNotFound(_0x42bbc0,null))[_0x1b09('0x26')](function(_0x21bdaa){if(_0x21bdaa){_0x4c504d=_0x21bdaa;_0x14f277[_0x1b09('0x32')]=_[_0x1b09('0x35')](db['User'][_0x1b09('0x49')]);_0x14f277[_0x1b09('0x34')]=_[_0x1b09('0x35')](_0x3b66fc[_0x1b09('0x34')]);_0x14f277[_0x1b09('0x3e')]=_['intersection'](_0x14f277[_0x1b09('0x32')],_0x14f277[_0x1b09('0x34')]);_0x595a32[_0x1b09('0x38')]=_[_0x1b09('0x36')](_0x14f277['model'],qs['fields'](_0x3b66fc['query'][_0x1b09('0x37')]));_0x595a32[_0x1b09('0x38')]=_0x595a32[_0x1b09('0x38')][_0x1b09('0x39')]?_0x595a32[_0x1b09('0x38')]:_0x14f277[_0x1b09('0x32')];_0x595a32['order']=qs[_0x1b09('0x3c')](_0x3b66fc[_0x1b09('0x34')]['sort']);_0x595a32['where']=qs[_0x1b09('0x3e')](_[_0x1b09('0x72')](_0x3b66fc[_0x1b09('0x34')],_0x14f277['filters']));if(_0x3b66fc['query'][_0x1b09('0x3f')]){_0x595a32['where']=_[_0x1b09('0x40')](_0x595a32['where'],{'$or':_['map'](_0x595a32[_0x1b09('0x38')],function(_0xbd17f8){var _0x40f6bf={};_0x40f6bf[_0xbd17f8]={'$like':'%'+_0x3b66fc['query'][_0x1b09('0x3f')]+'%'};return _0x40f6bf;})});}_0x595a32=_[_0x1b09('0x40')]({},_0x595a32,_0x3b66fc[_0x1b09('0x42')]);return _0x4c504d[_0x1b09('0x73')](_0x595a32);}})[_0x1b09('0x26')](function(_0x315303){if(_0x315303){_0x4c4b37=_0x315303[_0x1b09('0x39')];if(!_0x3b66fc['query'][_0x1b09('0x3a')]('nolimit')){_0x595a32[_0x1b09('0x21')]=qs[_0x1b09('0x21')](_0x3b66fc['query'][_0x1b09('0x21')]);_0x595a32[_0x1b09('0x20')]=qs['offset'](_0x3b66fc['query'][_0x1b09('0x20')]);}return _0x4c504d[_0x1b09('0x73')](_0x595a32);}})[_0x1b09('0x26')](function(_0x266139){if(_0x266139){return _0x266139?{'count':_0x4c4b37,'rows':_0x266139}:null;}})[_0x1b09('0x26')](respondWithResult(_0x42bbc0,null))[_0x1b09('0x4b')](handleError(_0x42bbc0,null));};
\ No newline at end of file
+var _0xf1c6=['transaction','findById','addAgents','ids','omit','userVoicePrefix:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voicePrefix.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','VoicePrefix','findAll','catch','show','params','options','find','describe','create','sequelize','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','push','Set','NoOp','goto','charAt','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xfe00bd,_0x4c9578){_0xfe00bd=_0xfe00bd-0x0;var _0x50e3ee=_0xf1c6[_0xfe00bd];return _0x50e3ee;};'use strict';var pdf=require(_0x6f1c('0x0'));var emlformat=require(_0x6f1c('0x1'));var rimraf=require(_0x6f1c('0x2'));var zipdir=require(_0x6f1c('0x3'));var jsonpatch=require(_0x6f1c('0x4'));var rp=require(_0x6f1c('0x5'));var moment=require(_0x6f1c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6f1c('0x7'));var util=require(_0x6f1c('0x8'));var path=require(_0x6f1c('0x9'));var sox=require(_0x6f1c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f1c('0xb'));var squel=require(_0x6f1c('0xc'));var crypto=require(_0x6f1c('0xd'));var jsforce=require(_0x6f1c('0xe'));var deskjs=require(_0x6f1c('0xf'));var toCsv=require(_0x6f1c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f1c('0x11'));var authService=require(_0x6f1c('0x12'));var qs=require(_0x6f1c('0x13'));var as=require(_0x6f1c('0x14'));var hardwareService=require(_0x6f1c('0x15'));var logger=require(_0x6f1c('0x16'))('api');var utils=require(_0x6f1c('0x17'));var config=require(_0x6f1c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x19'))['db'];config['redis']=_['defaults'](config[_0x6f1c('0x1a')],{'host':_0x6f1c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f1c('0x1c'))['register'](socket);function respondWithStatusCode(_0x206ed5,_0xb36b41){_0xb36b41=_0xb36b41||0xcc;return function(_0x14c412){if(_0x14c412){return _0x206ed5[_0x6f1c('0x1d')](_0xb36b41);}return _0x206ed5[_0x6f1c('0x1e')](_0xb36b41)[_0x6f1c('0x1f')]();};}function respondWithResult(_0xbac2ee,_0x5e953f){_0x5e953f=_0x5e953f||0xc8;return function(_0x2ca612){if(_0x2ca612){return _0xbac2ee['status'](_0x5e953f)[_0x6f1c('0x20')](_0x2ca612);}};}function respondWithFilteredResult(_0x5a0a2d,_0x1d968f){return function(_0x66103a){if(_0x66103a){var _0x5b11ea=_0x66103a[_0x6f1c('0x21')],_0x5475d6=_0x1d968f['offset'],_0x317686=_0x1d968f[_0x6f1c('0x22')]+_0x1d968f[_0x6f1c('0x23')],_0x842773;if(_0x317686>=_0x5b11ea){_0x317686=_0x5b11ea;_0x842773=0xc8;}else{_0x842773=0xce;}_0x5a0a2d[_0x6f1c('0x1e')](_0x842773);return _0x5a0a2d['set'](_0x6f1c('0x24'),_0x5475d6+'-'+_0x317686+'/'+_0x5b11ea)[_0x6f1c('0x20')](_0x66103a);}return null;};}function patchUpdates(_0x27a351){return function(_0x539d59){try{jsonpatch[_0x6f1c('0x25')](_0x539d59,_0x27a351,!![]);}catch(_0xebf430){return BPromise['reject'](_0xebf430);}return _0x539d59[_0x6f1c('0x26')]();};}function saveUpdates(_0x1f7ac2,_0x3fe23a){return function(_0x25e460){if(_0x25e460){return _0x25e460['update'](_0x1f7ac2)[_0x6f1c('0x27')](function(_0xd19a62){return _0xd19a62;});}return null;};}function removeEntity(_0x235773,_0x241ee7){return function(_0xa9c80d){if(_0xa9c80d){return _0xa9c80d[_0x6f1c('0x28')]()['then'](function(){var _0x1ac41=_0xa9c80d[_0x6f1c('0x29')]({'plain':!![]});var _0x2d4236=_0x6f1c('0x2a');return db[_0x6f1c('0x2b')]['destroy']({'where':{'type':_0x2d4236,'resourceId':_0x1ac41['id']}})[_0x6f1c('0x27')](function(){return _0xa9c80d;});})[_0x6f1c('0x27')](function(){_0x235773[_0x6f1c('0x1e')](0xcc)[_0x6f1c('0x1f')]();});}};}function handleEntityNotFound(_0x31e829,_0x145ae9){return function(_0x4d120d){if(!_0x4d120d){_0x31e829['sendStatus'](0x194);}return _0x4d120d;};}function handleError(_0x30ba57,_0x2b3732){_0x2b3732=_0x2b3732||0x1f4;return function(_0x1b5c9a){logger['error'](_0x1b5c9a[_0x6f1c('0x2c')]);if(_0x1b5c9a[_0x6f1c('0x2d')]){delete _0x1b5c9a[_0x6f1c('0x2d')];}_0x30ba57[_0x6f1c('0x1e')](_0x2b3732)['send'](_0x1b5c9a);};}exports[_0x6f1c('0x2e')]=function(_0x11f1f6,_0x5c09ba){var _0x11ac4b={},_0x346c4a={},_0x182f99={'count':0x0,'rows':[]};var _0x5a25ec=_[_0x6f1c('0x2f')](db['VoicePrefix'][_0x6f1c('0x30')],function(_0x2ee3e7){return{'name':_0x2ee3e7[_0x6f1c('0x31')],'type':_0x2ee3e7['type']['key']};});_0x346c4a[_0x6f1c('0x32')]=_[_0x6f1c('0x2f')](_0x5a25ec,_0x6f1c('0x2d'));_0x346c4a[_0x6f1c('0x33')]=_[_0x6f1c('0x34')](_0x11f1f6[_0x6f1c('0x33')]);_0x346c4a[_0x6f1c('0x35')]=_[_0x6f1c('0x36')](_0x346c4a[_0x6f1c('0x32')],_0x346c4a[_0x6f1c('0x33')]);_0x11ac4b[_0x6f1c('0x37')]=_[_0x6f1c('0x36')](_0x346c4a[_0x6f1c('0x32')],qs[_0x6f1c('0x38')](_0x11f1f6[_0x6f1c('0x33')]['fields']));_0x11ac4b[_0x6f1c('0x37')]=_0x11ac4b[_0x6f1c('0x37')][_0x6f1c('0x39')]?_0x11ac4b[_0x6f1c('0x37')]:_0x346c4a['model'];if(!_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x3a')](_0x6f1c('0x3b'))){_0x11ac4b[_0x6f1c('0x23')]=qs[_0x6f1c('0x23')](_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x23')]);_0x11ac4b['offset']=qs[_0x6f1c('0x22')](_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x22')]);}_0x11ac4b[_0x6f1c('0x3c')]=qs[_0x6f1c('0x3d')](_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x3d')]);_0x11ac4b[_0x6f1c('0x3e')]=qs[_0x6f1c('0x35')](_[_0x6f1c('0x3f')](_0x11f1f6['query'],_0x346c4a[_0x6f1c('0x35')]),_0x5a25ec);if(_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x40')]){_0x11ac4b[_0x6f1c('0x3e')]=_[_0x6f1c('0x41')](_0x11ac4b[_0x6f1c('0x3e')],{'$or':_[_0x6f1c('0x2f')](_0x5a25ec,function(_0x248fc4){if(_0x248fc4[_0x6f1c('0x42')]!==_0x6f1c('0x43')){var _0xcd112e={};_0xcd112e[_0x248fc4['name']]={'$like':'%'+_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x40')]+'%'};return _0xcd112e;}})});}_0x11ac4b=_[_0x6f1c('0x41')]({},_0x11ac4b,_0x11f1f6['options']);var _0x4e2754={'where':_0x11ac4b[_0x6f1c('0x3e')]};return db['VoicePrefix']['count'](_0x4e2754)[_0x6f1c('0x27')](function(_0x4f58a7){_0x182f99[_0x6f1c('0x21')]=_0x4f58a7;if(_0x11f1f6['query'][_0x6f1c('0x44')]){_0x11ac4b[_0x6f1c('0x45')]=[{'all':!![]}];}return db[_0x6f1c('0x46')][_0x6f1c('0x47')](_0x11ac4b);})[_0x6f1c('0x27')](function(_0x35203e){_0x182f99['rows']=_0x35203e;return _0x182f99;})[_0x6f1c('0x27')](respondWithFilteredResult(_0x5c09ba,_0x11ac4b))[_0x6f1c('0x48')](handleError(_0x5c09ba,null));};exports[_0x6f1c('0x49')]=function(_0x234d79,_0x1a506b){var _0x307e7e={'raw':![],'where':{'id':_0x234d79[_0x6f1c('0x4a')]['id']}},_0xd61e73={};_0xd61e73[_0x6f1c('0x32')]=_[_0x6f1c('0x34')](db[_0x6f1c('0x46')][_0x6f1c('0x30')]);_0xd61e73['query']=_['keys'](_0x234d79[_0x6f1c('0x33')]);_0xd61e73['filters']=_[_0x6f1c('0x36')](_0xd61e73[_0x6f1c('0x32')],_0xd61e73['query']);_0x307e7e[_0x6f1c('0x37')]=_[_0x6f1c('0x36')](_0xd61e73[_0x6f1c('0x32')],qs['fields'](_0x234d79['query'][_0x6f1c('0x38')]));_0x307e7e[_0x6f1c('0x37')]=_0x307e7e[_0x6f1c('0x37')][_0x6f1c('0x39')]?_0x307e7e['attributes']:_0xd61e73[_0x6f1c('0x32')];if(_0x234d79[_0x6f1c('0x33')][_0x6f1c('0x44')]){_0x307e7e[_0x6f1c('0x45')]=[{'all':!![]}];}_0x307e7e=_[_0x6f1c('0x41')]({},_0x307e7e,_0x234d79[_0x6f1c('0x4b')]);return db['VoicePrefix'][_0x6f1c('0x4c')](_0x307e7e)['then'](handleEntityNotFound(_0x1a506b,null))['then'](respondWithResult(_0x1a506b,null))[_0x6f1c('0x48')](handleError(_0x1a506b,null));};exports['destroy']=function(_0x256ca1,_0x79498){return db[_0x6f1c('0x46')][_0x6f1c('0x4c')]({'where':{'id':_0x256ca1[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x79498,null))[_0x6f1c('0x27')](removeEntity(_0x79498,null))[_0x6f1c('0x48')](handleError(_0x79498,null));};exports[_0x6f1c('0x4d')]=function(_0x374bf6,_0x530b9f){return db['VoicePrefix'][_0x6f1c('0x4d')]()[_0x6f1c('0x27')](respondWithResult(_0x530b9f,null))[_0x6f1c('0x48')](handleError(_0x530b9f,null));};exports[_0x6f1c('0x4e')]=function(_0xe29b0c,_0x70c654){var _0x353b50;return db[_0x6f1c('0x4f')]['transaction'](function(_0x2878e7){return db['VoicePrefix']['create'](_0xe29b0c[_0x6f1c('0x50')],{'transaction':_0x2878e7})[_0x6f1c('0x27')](function(_0x4a7244){_0x353b50=_0x4a7244[_0x6f1c('0x29')]({'plain':!![]});return db['VoiceExtension'][_0x6f1c('0x4c')]({'where':{'id':_0x353b50['VoiceExtensionId']},'raw':!![]})[_0x6f1c('0x27')](function(_0x546f05){return createVoicePrefixExtensions(_0x353b50,_0x546f05,_0x2878e7);});});})[_0x6f1c('0x27')](function(){var _0x40c1a7=_0xe29b0c[_0x6f1c('0x51')][_0x6f1c('0x29')]({'plain':!![]});if(!_0x40c1a7)throw new Error(_0x6f1c('0x52'));if(_0x40c1a7[_0x6f1c('0x53')]===_0x6f1c('0x51')){var _0x2397c2=_0x353b50;return db[_0x6f1c('0x54')][_0x6f1c('0x4c')]({'where':{'name':_0x6f1c('0x2a'),'userProfileId':_0x40c1a7[_0x6f1c('0x55')]},'raw':!![]})[_0x6f1c('0x27')](function(_0x567d50){if(_0x567d50&&_0x567d50[_0x6f1c('0x56')]===0x0){return db[_0x6f1c('0x2b')][_0x6f1c('0x4e')]({'name':_0x2397c2[_0x6f1c('0x2d')],'resourceId':_0x2397c2['id'],'type':_0x567d50['name'],'sectionId':_0x567d50['id']},{})[_0x6f1c('0x27')](function(){return _0x353b50;});}else{return _0x353b50;}})['catch'](function(_0x199aad){logger[_0x6f1c('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x199aad);throw _0x199aad;});}return _0x353b50;})[_0x6f1c('0x27')](respondWithResult(_0x70c654,null))['catch'](handleError(_0x70c654,null));};function Extension(_0xd9e2a2,_0x43b6c1,_0x5ce94a,_0x12d3c9){this[_0x6f1c('0x58')]=_0x6f1c('0x59');this[_0x6f1c('0x5a')]=_0xd9e2a2;this[_0x6f1c('0x5b')]=_0x5ce94a;this['type']=_0x6f1c('0x5c');this['description']=_0x6f1c('0x5d');this['priority']=_0x43b6c1;this[_0x6f1c('0x5e')]=_0x12d3c9;}function createVoicePrefixExtensions(_0x8c47e0,_0x4556a6,_0x2ef7ce){return new BPromise(function(_0x471664,_0x712a6b){var _0x57ebea=new Extension(formatPrefixName(_0x8c47e0[_0x6f1c('0x5f')]),0x1,'NoOp',_0x6f1c('0x60'));_0x57ebea[_0x6f1c('0x61')]=_0x8c47e0['id'];return db[_0x6f1c('0x62')][_0x6f1c('0x4e')](_0x57ebea,{'transaction':_0x2ef7ce})[_0x6f1c('0x27')](function(_0x7baff3){var _0x4694f3=_0x7baff3[_0x6f1c('0x29')]({'plain':!![]});var _0x518bbc=_[_0x6f1c('0x2f')](addVoicePrefixExtensions(_0x8c47e0,_0x4556a6),function(_0x291a3f){_0x291a3f[_0x6f1c('0x63')]=_0x4694f3['id'];_0x291a3f[_0x6f1c('0x61')]=_0x8c47e0['id'];return _0x291a3f;});return db[_0x6f1c('0x62')][_0x6f1c('0x64')](_0x518bbc,{'transaction':_0x2ef7ce})[_0x6f1c('0x27')](function(_0x3f2cea){if(!_0x3f2cea){return _0x712a6b(_0x6f1c('0x65'));}else{return _0x471664(_0x3f2cea);}})[_0x6f1c('0x48')](function(_0x4ee324){return _0x712a6b(_0x4ee324);});});;});};function addVoicePrefixExtensions(_0x49c6ad,_0x23e0e5){var _0x3ed2f0=[];var _0xd36d97=formatPrefixName(_0x49c6ad[_0x6f1c('0x5f')]);_0x3ed2f0['push'](new Extension(_0xd36d97,0x2,'Set',_0x6f1c('0x66')+_0x49c6ad['name']));if(_0x49c6ad[_0x6f1c('0x67')]){_0x3ed2f0[_0x6f1c('0x68')](new Extension(_0xd36d97,0x3,_0x6f1c('0x69'),'PREFIX-CALLERIDALL='+_0x49c6ad[_0x6f1c('0x67')]));}else{_0x3ed2f0[_0x6f1c('0x68')](new Extension(_0xd36d97,0x3,_0x6f1c('0x6a'),'No\x20callerid\x20available'));}_0x3ed2f0['push'](new Extension(_0xd36d97,0x4,_0x6f1c('0x6b'),_0x23e0e5[_0x6f1c('0x58')]+','+'${EXTEN:'+(0x8+_0x49c6ad[_0x6f1c('0x2d')][_0x6f1c('0x39')])+'}'+','+0x1));return _0x3ed2f0;}function formatPrefixName(_0x515374){var _0x5f219a='_';for(var _0x24d863=0x0;_0x24d863<_0x515374[_0x6f1c('0x39')];_0x24d863++){if(_0x515374[_0x6f1c('0x6c')](_0x24d863)=='-'){_0x5f219a+=_0x515374[_0x6f1c('0x6c')](_0x24d863);}else{_0x5f219a+='['+_0x515374[_0x6f1c('0x6c')](_0x24d863)+']';}}_0x5f219a+='.';return _0x5f219a;}exports[_0x6f1c('0x6d')]=function(_0x27490c,_0x2c6752,_0x68c121){var _0x2e4743=_0x27490c[_0x6f1c('0x50')];_0x2e4743[_0x6f1c('0x5f')]='system-'+_0x2e4743[_0x6f1c('0x2d')]+'-';return db['sequelize'][_0x6f1c('0x6e')](function(_0x46bbc3){return db[_0x6f1c('0x46')][_0x6f1c('0x6d')](_0x2e4743,{'where':{'id':_0x2e4743['id']},'transaction':_0x46bbc3})[_0x6f1c('0x27')](function(){return db['VoiceExtension'][_0x6f1c('0x28')]({'where':{'VoicePrefixId':_0x2e4743['id']},'transaction':_0x46bbc3})[_0x6f1c('0x27')](function(){return db[_0x6f1c('0x62')][_0x6f1c('0x4c')]({'where':{'id':_0x2e4743[_0x6f1c('0x63')]},'raw':!![]})['then'](function(_0x5324e4){return createVoicePrefixExtensions(_0x2e4743,_0x5324e4,_0x46bbc3);});});});})[_0x6f1c('0x27')](function(){return db[_0x6f1c('0x46')][_0x6f1c('0x6f')](_0x2e4743['id']);})[_0x6f1c('0x27')](respondWithResult(_0x2c6752,null))[_0x6f1c('0x48')](handleError(_0x2c6752,null));};exports['addAgents']=function(_0x251baf,_0x32aa2f,_0x220d83){return db[_0x6f1c('0x46')]['find']({'where':{'id':_0x251baf[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x32aa2f,null))[_0x6f1c('0x27')](function(_0xe4ea3c){if(_0xe4ea3c){return _0xe4ea3c[_0x6f1c('0x70')](_0x251baf['body'][_0x6f1c('0x71')],_[_0x6f1c('0x72')](_0x251baf[_0x6f1c('0x50')],[_0x6f1c('0x71'),'id'])||{})['spread'](function(_0x565708){for(var _0xf82c2f=0x0;_0xf82c2f<_0x251baf['body'][_0x6f1c('0x71')][_0x6f1c('0x39')];_0xf82c2f+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x251baf[_0x6f1c('0x50')][_0x6f1c('0x71')][_0xf82c2f],'VoicePrefixId':_0x251baf[_0x6f1c('0x4a')]['id']});}return _0x565708;});}})[_0x6f1c('0x27')](respondWithResult(_0x32aa2f,null))[_0x6f1c('0x48')](handleError(_0x32aa2f,null));};exports['removeAgents']=function(_0x34927a,_0x4e666a,_0x2391d7){return db['VoicePrefix']['find']({'where':{'id':_0x34927a[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x4e666a,null))['then'](function(_0x4770f0){if(_0x4770f0){return _0x4770f0['removeAgents'](_0x34927a['query']['ids'])[_0x6f1c('0x27')](function(){if(_['isArray'](_0x34927a[_0x6f1c('0x33')][_0x6f1c('0x71')])){for(var _0x256bab=0x0;_0x256bab<_0x34927a[_0x6f1c('0x33')][_0x6f1c('0x71')][_0x6f1c('0x39')];_0x256bab+=0x1){socket['emit'](_0x6f1c('0x73'),{'UserId':Number(_0x34927a[_0x6f1c('0x33')]['ids'][_0x256bab]),'VoicePrefixId':Number(_0x34927a[_0x6f1c('0x4a')]['id'])});}}else{socket['emit'](_0x6f1c('0x73'),{'UserId':Number(_0x34927a[_0x6f1c('0x33')][_0x6f1c('0x71')]),'VoicePrefixId':Number(_0x34927a[_0x6f1c('0x4a')]['id'])});}});}})[_0x6f1c('0x27')](respondWithStatusCode(_0x4e666a,null))[_0x6f1c('0x48')](handleError(_0x4e666a,null));};exports[_0x6f1c('0x74')]=function(_0x281c4d,_0x2907cb,_0x2195ea){var _0x5d54ec={};var _0x4f4161={};var _0x12f48b;var _0x5d6858;return db['VoicePrefix']['findOne']({'where':{'id':_0x281c4d[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x2907cb,null))[_0x6f1c('0x27')](function(_0x37ccb3){if(_0x37ccb3){_0x12f48b=_0x37ccb3;_0x4f4161['model']=_[_0x6f1c('0x34')](db[_0x6f1c('0x75')]['rawAttributes']);_0x4f4161[_0x6f1c('0x33')]=_[_0x6f1c('0x34')](_0x281c4d[_0x6f1c('0x33')]);_0x4f4161[_0x6f1c('0x35')]=_[_0x6f1c('0x36')](_0x4f4161[_0x6f1c('0x32')],_0x4f4161[_0x6f1c('0x33')]);_0x5d54ec[_0x6f1c('0x37')]=_[_0x6f1c('0x36')](_0x4f4161['model'],qs[_0x6f1c('0x38')](_0x281c4d['query']['fields']));_0x5d54ec[_0x6f1c('0x37')]=_0x5d54ec[_0x6f1c('0x37')][_0x6f1c('0x39')]?_0x5d54ec[_0x6f1c('0x37')]:_0x4f4161[_0x6f1c('0x32')];_0x5d54ec[_0x6f1c('0x3c')]=qs[_0x6f1c('0x3d')](_0x281c4d['query']['sort']);_0x5d54ec[_0x6f1c('0x3e')]=qs[_0x6f1c('0x35')](_[_0x6f1c('0x3f')](_0x281c4d[_0x6f1c('0x33')],_0x4f4161['filters']));if(_0x281c4d[_0x6f1c('0x33')][_0x6f1c('0x40')]){_0x5d54ec[_0x6f1c('0x3e')]=_[_0x6f1c('0x41')](_0x5d54ec['where'],{'$or':_['map'](_0x5d54ec[_0x6f1c('0x37')],function(_0x282d6b){var _0x3695d9={};_0x3695d9[_0x282d6b]={'$like':'%'+_0x281c4d[_0x6f1c('0x33')]['filter']+'%'};return _0x3695d9;})});}_0x5d54ec=_[_0x6f1c('0x41')]({},_0x5d54ec,_0x281c4d[_0x6f1c('0x4b')]);return _0x12f48b['getAgents'](_0x5d54ec);}})['then'](function(_0x2deebb){if(_0x2deebb){_0x5d6858=_0x2deebb[_0x6f1c('0x39')];if(!_0x281c4d[_0x6f1c('0x33')][_0x6f1c('0x3a')](_0x6f1c('0x3b'))){_0x5d54ec['limit']=qs[_0x6f1c('0x23')](_0x281c4d['query']['limit']);_0x5d54ec[_0x6f1c('0x22')]=qs[_0x6f1c('0x22')](_0x281c4d[_0x6f1c('0x33')]['offset']);}return _0x12f48b[_0x6f1c('0x74')](_0x5d54ec);}})['then'](function(_0x39939b){if(_0x39939b){return _0x39939b?{'count':_0x5d6858,'rows':_0x39939b}:null;}})['then'](respondWithResult(_0x2907cb,null))[_0x6f1c('0x48')](handleError(_0x2907cb,null));};
\ No newline at end of file