Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / api / voicePrefix / voicePrefix.controller.js
index c663af9..d05c9b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7fb8=['../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','map','keys','model','attributes','fields','query','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','count','include','rows','show','params','intersection','find','catch','describe','create','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7fb8,0x1d9));var _0x87fb=function(_0x18e9b0,_0x1c964e){_0x18e9b0=_0x18e9b0-0x0;var _0x34b70e=_0x7fb8[_0x18e9b0];return _0x34b70e;};'use strict';var pdf=require(_0x87fb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x87fb('0x1'));var zipdir=require(_0x87fb('0x2'));var jsonpatch=require(_0x87fb('0x3'));var rp=require(_0x87fb('0x4'));var moment=require(_0x87fb('0x5'));var BPromise=require(_0x87fb('0x6'));var Mustache=require('mustache');var util=require(_0x87fb('0x7'));var path=require('path');var sox=require(_0x87fb('0x8'));var csv=require('to-csv');var ejs=require(_0x87fb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x87fb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87fb('0xb'));var toCsv=require(_0x87fb('0xc'));var querystring=require(_0x87fb('0xd'));var Papa=require(_0x87fb('0xe'));var Redis=require('ioredis');var authService=require(_0x87fb('0xf'));var qs=require(_0x87fb('0x10'));var as=require(_0x87fb('0x11'));var hardwareService=require(_0x87fb('0x12'));var logger=require(_0x87fb('0x13'))(_0x87fb('0x14'));var utils=require('../../config/utils');var config=require(_0x87fb('0x15'));var db=require(_0x87fb('0x16'))['db'];config[_0x87fb('0x17')]=_[_0x87fb('0x18')](config[_0x87fb('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x87fb('0x19'))(new Redis(config['redis']));require(_0x87fb('0x1a'))['register'](socket);function respondWithStatusCode(_0x2073e0,_0x1a598e){_0x1a598e=_0x1a598e||0xcc;return function(_0x401e0d){if(_0x401e0d){return _0x2073e0[_0x87fb('0x1b')](_0x1a598e);}return _0x2073e0[_0x87fb('0x1c')](_0x1a598e)[_0x87fb('0x1d')]();};}function respondWithResult(_0x189a5d,_0x447bb3){_0x447bb3=_0x447bb3||0xc8;return function(_0x3aedfc){if(_0x3aedfc){return _0x189a5d[_0x87fb('0x1c')](_0x447bb3)[_0x87fb('0x1e')](_0x3aedfc);}};}function respondWithFilteredResult(_0x31bd36,_0x3a1016){return function(_0x3d7282){if(_0x3d7282){var _0x3203b3=_0x3d7282['count'],_0x46d009=_0x3a1016[_0x87fb('0x1f')],_0x5b6385=_0x3a1016['offset']+_0x3a1016[_0x87fb('0x20')],_0x712797;if(_0x5b6385>=_0x3203b3){_0x5b6385=_0x3203b3;_0x712797=0xc8;}else{_0x712797=0xce;}_0x31bd36['status'](_0x712797);return _0x31bd36[_0x87fb('0x21')](_0x87fb('0x22'),_0x46d009+'-'+_0x5b6385+'/'+_0x3203b3)[_0x87fb('0x1e')](_0x3d7282);}return null;};}function patchUpdates(_0x30d9dd){return function(_0x3e46b3){try{jsonpatch[_0x87fb('0x23')](_0x3e46b3,_0x30d9dd,!![]);}catch(_0x476383){return BPromise['reject'](_0x476383);}return _0x3e46b3[_0x87fb('0x24')]();};}function saveUpdates(_0x1e03e8,_0x2c00f7){return function(_0x29e542){if(_0x29e542){return _0x29e542[_0x87fb('0x25')](_0x1e03e8)[_0x87fb('0x26')](function(_0x3f8976){return _0x3f8976;});}return null;};}function removeEntity(_0x29d4a0,_0x47d494){return function(_0x4df981){if(_0x4df981){return _0x4df981[_0x87fb('0x27')]()[_0x87fb('0x26')](function(){var _0x160d08=_0x4df981[_0x87fb('0x28')]({'plain':!![]});var _0x54c1cf='VoicePrefixes';return db[_0x87fb('0x29')][_0x87fb('0x27')]({'where':{'type':_0x54c1cf,'resourceId':_0x160d08['id']}})[_0x87fb('0x26')](function(){return _0x4df981;});})['then'](function(){_0x29d4a0[_0x87fb('0x1c')](0xcc)[_0x87fb('0x1d')]();});}};}function handleEntityNotFound(_0x4891b7,_0xcf9d55){return function(_0x2d7f99){if(!_0x2d7f99){_0x4891b7[_0x87fb('0x1b')](0x194);}return _0x2d7f99;};}function handleError(_0x5dd463,_0x5774cc){_0x5774cc=_0x5774cc||0x1f4;return function(_0x204b0c){logger[_0x87fb('0x2a')](_0x204b0c[_0x87fb('0x2b')]);if(_0x204b0c[_0x87fb('0x2c')]){delete _0x204b0c[_0x87fb('0x2c')];}_0x5dd463['status'](_0x5774cc)[_0x87fb('0x2d')](_0x204b0c);};}exports[_0x87fb('0x2e')]=function(_0x278348,_0x4c52ae){var _0x151677={},_0x51cbf1={},_0x54a3fa={'count':0x0,'rows':[]};var _0x5d1b0e=_['map'](db[_0x87fb('0x2f')][_0x87fb('0x30')],function(_0x1af687){return{'name':_0x1af687[_0x87fb('0x31')],'type':_0x1af687['type']['key']};});_0x51cbf1['model']=_[_0x87fb('0x32')](_0x5d1b0e,_0x87fb('0x2c'));_0x51cbf1['query']=_[_0x87fb('0x33')](_0x278348['query']);_0x51cbf1['filters']=_['intersection'](_0x51cbf1[_0x87fb('0x34')],_0x51cbf1['query']);_0x151677[_0x87fb('0x35')]=_['intersection'](_0x51cbf1[_0x87fb('0x34')],qs[_0x87fb('0x36')](_0x278348[_0x87fb('0x37')][_0x87fb('0x36')]));_0x151677[_0x87fb('0x35')]=_0x151677[_0x87fb('0x35')][_0x87fb('0x38')]?_0x151677['attributes']:_0x51cbf1[_0x87fb('0x34')];if(!_0x278348['query']['hasOwnProperty'](_0x87fb('0x39'))){_0x151677[_0x87fb('0x20')]=qs[_0x87fb('0x20')](_0x278348['query']['limit']);_0x151677[_0x87fb('0x1f')]=qs['offset'](_0x278348['query'][_0x87fb('0x1f')]);}_0x151677[_0x87fb('0x3a')]=qs[_0x87fb('0x3b')](_0x278348['query'][_0x87fb('0x3b')]);_0x151677['where']=qs[_0x87fb('0x3c')](_[_0x87fb('0x3d')](_0x278348[_0x87fb('0x37')],_0x51cbf1[_0x87fb('0x3c')]));if(_0x278348[_0x87fb('0x37')][_0x87fb('0x3e')]){_0x151677[_0x87fb('0x3f')]=_[_0x87fb('0x40')](_0x151677['where'],{'$or':_[_0x87fb('0x32')](_0x5d1b0e,function(_0x4dbd36){if(_0x4dbd36[_0x87fb('0x41')]!==_0x87fb('0x42')){var _0x30d66d={};_0x30d66d[_0x4dbd36[_0x87fb('0x2c')]]={'$like':'%'+_0x278348[_0x87fb('0x37')][_0x87fb('0x3e')]+'%'};return _0x30d66d;}})});}_0x151677=_[_0x87fb('0x40')]({},_0x151677,_0x278348[_0x87fb('0x43')]);var _0x3fc9ef={'where':_0x151677[_0x87fb('0x3f')]};return db[_0x87fb('0x2f')][_0x87fb('0x44')](_0x3fc9ef)[_0x87fb('0x26')](function(_0x22b871){_0x54a3fa['count']=_0x22b871;if(_0x278348[_0x87fb('0x37')]['includeAll']){_0x151677[_0x87fb('0x45')]=[{'all':!![]}];}return db[_0x87fb('0x2f')]['findAll'](_0x151677);})[_0x87fb('0x26')](function(_0x2b2f5d){_0x54a3fa[_0x87fb('0x46')]=_0x2b2f5d;return _0x54a3fa;})[_0x87fb('0x26')](respondWithFilteredResult(_0x4c52ae,_0x151677))['catch'](handleError(_0x4c52ae,null));};exports[_0x87fb('0x47')]=function(_0xce872a,_0x4683de){var _0x4cba9b={'raw':![],'where':{'id':_0xce872a[_0x87fb('0x48')]['id']}},_0x241356={};_0x241356[_0x87fb('0x34')]=_['keys'](db[_0x87fb('0x2f')][_0x87fb('0x30')]);_0x241356[_0x87fb('0x37')]=_['keys'](_0xce872a['query']);_0x241356[_0x87fb('0x3c')]=_[_0x87fb('0x49')](_0x241356[_0x87fb('0x34')],_0x241356[_0x87fb('0x37')]);_0x4cba9b[_0x87fb('0x35')]=_[_0x87fb('0x49')](_0x241356['model'],qs[_0x87fb('0x36')](_0xce872a[_0x87fb('0x37')][_0x87fb('0x36')]));_0x4cba9b[_0x87fb('0x35')]=_0x4cba9b[_0x87fb('0x35')][_0x87fb('0x38')]?_0x4cba9b[_0x87fb('0x35')]:_0x241356[_0x87fb('0x34')];if(_0xce872a[_0x87fb('0x37')]['includeAll']){_0x4cba9b[_0x87fb('0x45')]=[{'all':!![]}];}_0x4cba9b=_[_0x87fb('0x40')]({},_0x4cba9b,_0xce872a['options']);return db[_0x87fb('0x2f')][_0x87fb('0x4a')](_0x4cba9b)[_0x87fb('0x26')](handleEntityNotFound(_0x4683de,null))[_0x87fb('0x26')](respondWithResult(_0x4683de,null))[_0x87fb('0x4b')](handleError(_0x4683de,null));};exports[_0x87fb('0x27')]=function(_0x2ae840,_0x5b8d38){return db['VoicePrefix'][_0x87fb('0x4a')]({'where':{'id':_0x2ae840['params']['id']}})[_0x87fb('0x26')](handleEntityNotFound(_0x5b8d38,null))['then'](removeEntity(_0x5b8d38,null))[_0x87fb('0x4b')](handleError(_0x5b8d38,null));};exports[_0x87fb('0x4c')]=function(_0xb5fd21,_0x111bda){return db[_0x87fb('0x2f')][_0x87fb('0x4c')]()[_0x87fb('0x26')](respondWithResult(_0x111bda,null))[_0x87fb('0x4b')](handleError(_0x111bda,null));};exports[_0x87fb('0x4d')]=function(_0x228f12,_0x3346a3){var _0x3d06d1;return db['sequelize'][_0x87fb('0x4e')](function(_0x155303){return db[_0x87fb('0x2f')][_0x87fb('0x4d')](_0x228f12[_0x87fb('0x4f')],{'transaction':_0x155303})[_0x87fb('0x26')](function(_0x3cce7b){_0x3d06d1=_0x3cce7b[_0x87fb('0x28')]({'plain':!![]});return db[_0x87fb('0x50')][_0x87fb('0x4a')]({'where':{'id':_0x3d06d1['VoiceExtensionId']},'raw':!![]})[_0x87fb('0x26')](function(_0x738c5c){return createVoicePrefixExtensions(_0x3d06d1,_0x738c5c,_0x155303);});});})['then'](function(){var _0x41438e=_0x228f12[_0x87fb('0x51')][_0x87fb('0x28')]({'plain':!![]});if(!_0x41438e)throw new Error(_0x87fb('0x52'));if(_0x41438e['role']===_0x87fb('0x51')){var _0x252bb9=_0x3d06d1;return db['UserProfileSection']['find']({'where':{'name':_0x87fb('0x53'),'userProfileId':_0x41438e[_0x87fb('0x54')]},'raw':!![]})[_0x87fb('0x26')](function(_0xa5f9dc){if(_0xa5f9dc&&_0xa5f9dc[_0x87fb('0x55')]===0x0){return db[_0x87fb('0x29')][_0x87fb('0x4d')]({'name':_0x252bb9['name'],'resourceId':_0x252bb9['id'],'type':_0xa5f9dc[_0x87fb('0x2c')],'sectionId':_0xa5f9dc['id']},{})['then'](function(){return _0x3d06d1;});}else{return _0x3d06d1;}})['catch'](function(_0x534471){logger['error'](_0x87fb('0x56'),_0x534471);throw _0x534471;});}return _0x3d06d1;})[_0x87fb('0x26')](respondWithResult(_0x3346a3,null))[_0x87fb('0x4b')](handleError(_0x3346a3,null));};function Extension(_0x56f6f2,_0x4c7edb,_0x4b87e3,_0x463575){this[_0x87fb('0x57')]='from-sip';this[_0x87fb('0x58')]=_0x56f6f2;this[_0x87fb('0x59')]=_0x4b87e3;this['type']=_0x87fb('0x5a');this[_0x87fb('0x5b')]=_0x87fb('0x5c');this[_0x87fb('0x5d')]=_0x4c7edb;this['appdata']=_0x463575;}function createVoicePrefixExtensions(_0x388c93,_0x3f3429,_0x29cb73){return new BPromise(function(_0x51a12b,_0x3b6cfb){var _0x5d1002=new Extension(formatPrefixName(_0x388c93[_0x87fb('0x5e')]),0x1,_0x87fb('0x5f'),_0x87fb('0x60'));_0x5d1002[_0x87fb('0x61')]=_0x388c93['id'];return db[_0x87fb('0x50')][_0x87fb('0x4d')](_0x5d1002,{'transaction':_0x29cb73})[_0x87fb('0x26')](function(_0x5bd82f){var _0x16f2c6=_0x5bd82f[_0x87fb('0x28')]({'plain':!![]});var _0x38debb=_['map'](addVoicePrefixExtensions(_0x388c93,_0x3f3429),function(_0x34a643){_0x34a643[_0x87fb('0x62')]=_0x16f2c6['id'];_0x34a643['VoicePrefixId']=_0x388c93['id'];return _0x34a643;});return db[_0x87fb('0x50')][_0x87fb('0x63')](_0x38debb,{'transaction':_0x29cb73})[_0x87fb('0x26')](function(_0x9bb021){if(!_0x9bb021){return _0x3b6cfb(_0x87fb('0x64'));}else{return _0x51a12b(_0x9bb021);}})[_0x87fb('0x4b')](function(_0xa990b8){return _0x3b6cfb(_0xa990b8);});});;});};function addVoicePrefixExtensions(_0x511313,_0x5e3488){var _0x853095=[];var _0x3ce9aa=formatPrefixName(_0x511313['prefix']);_0x853095[_0x87fb('0x65')](new Extension(_0x3ce9aa,0x2,_0x87fb('0x66'),_0x87fb('0x67')+_0x511313[_0x87fb('0x2c')]));if(_0x511313[_0x87fb('0x68')]){_0x853095[_0x87fb('0x65')](new Extension(_0x3ce9aa,0x3,_0x87fb('0x66'),_0x87fb('0x69')+_0x511313[_0x87fb('0x68')]));}else{_0x853095[_0x87fb('0x65')](new Extension(_0x3ce9aa,0x3,_0x87fb('0x5f'),_0x87fb('0x6a')));}_0x853095[_0x87fb('0x65')](new Extension(_0x3ce9aa,0x4,_0x87fb('0x6b'),_0x5e3488[_0x87fb('0x57')]+','+_0x87fb('0x6c')+(0x8+_0x511313[_0x87fb('0x2c')][_0x87fb('0x38')])+'}'+','+0x1));return _0x853095;}function formatPrefixName(_0x4cb05e){var _0x485c79='_';for(var _0x16c938=0x0;_0x16c938<_0x4cb05e[_0x87fb('0x38')];_0x16c938++){if(_0x4cb05e[_0x87fb('0x6d')](_0x16c938)=='-'){_0x485c79+=_0x4cb05e[_0x87fb('0x6d')](_0x16c938);}else{_0x485c79+='['+_0x4cb05e[_0x87fb('0x6d')](_0x16c938)+']';}}_0x485c79+='.';return _0x485c79;}exports[_0x87fb('0x25')]=function(_0x4c49b8,_0x5bca49,_0x594710){var _0x568d7a=_0x4c49b8[_0x87fb('0x4f')];_0x568d7a[_0x87fb('0x5e')]=_0x87fb('0x6e')+_0x568d7a[_0x87fb('0x2c')]+'-';return db[_0x87fb('0x6f')][_0x87fb('0x4e')](function(_0x482198){return db[_0x87fb('0x2f')][_0x87fb('0x25')](_0x568d7a,{'where':{'id':_0x568d7a['id']},'transaction':_0x482198})[_0x87fb('0x26')](function(){return db['VoiceExtension'][_0x87fb('0x27')]({'where':{'VoicePrefixId':_0x568d7a['id']},'transaction':_0x482198})[_0x87fb('0x26')](function(){return db[_0x87fb('0x50')][_0x87fb('0x4a')]({'where':{'id':_0x568d7a[_0x87fb('0x62')]},'raw':!![]})['then'](function(_0x1ca54b){return createVoicePrefixExtensions(_0x568d7a,_0x1ca54b,_0x482198);});});});})['then'](function(){return db[_0x87fb('0x2f')][_0x87fb('0x70')](_0x568d7a['id']);})[_0x87fb('0x26')](respondWithResult(_0x5bca49,null))[_0x87fb('0x4b')](handleError(_0x5bca49,null));};exports[_0x87fb('0x71')]=function(_0x18d0f5,_0x187c6c,_0x2e8811){return db[_0x87fb('0x2f')]['find']({'where':{'id':_0x18d0f5[_0x87fb('0x48')]['id']}})[_0x87fb('0x26')](handleEntityNotFound(_0x187c6c,null))['then'](function(_0x7ac032){if(_0x7ac032){return _0x7ac032['addAgents'](_0x18d0f5[_0x87fb('0x4f')][_0x87fb('0x72')],_['omit'](_0x18d0f5[_0x87fb('0x4f')],[_0x87fb('0x72'),'id'])||{})[_0x87fb('0x73')](function(_0x130437){for(var _0x36bb45=0x0;_0x36bb45<_0x18d0f5[_0x87fb('0x4f')][_0x87fb('0x72')][_0x87fb('0x38')];_0x36bb45+=0x1){socket['emit'](_0x87fb('0x74'),{'UserId':_0x18d0f5[_0x87fb('0x4f')]['ids'][_0x36bb45],'VoicePrefixId':_0x18d0f5[_0x87fb('0x48')]['id']});}return _0x130437;});}})[_0x87fb('0x26')](respondWithResult(_0x187c6c,null))['catch'](handleError(_0x187c6c,null));};exports['removeAgents']=function(_0x41b056,_0x2a474d,_0x541d5a){return db['VoicePrefix']['find']({'where':{'id':_0x41b056[_0x87fb('0x48')]['id']}})[_0x87fb('0x26')](handleEntityNotFound(_0x2a474d,null))[_0x87fb('0x26')](function(_0x411c78){if(_0x411c78){return _0x411c78[_0x87fb('0x75')](_0x41b056[_0x87fb('0x37')][_0x87fb('0x72')])[_0x87fb('0x26')](function(){if(_['isArray'](_0x41b056[_0x87fb('0x37')]['ids'])){for(var _0x3fc4d9=0x0;_0x3fc4d9<_0x41b056[_0x87fb('0x37')][_0x87fb('0x72')][_0x87fb('0x38')];_0x3fc4d9+=0x1){socket[_0x87fb('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x41b056[_0x87fb('0x37')][_0x87fb('0x72')][_0x3fc4d9]),'VoicePrefixId':Number(_0x41b056[_0x87fb('0x48')]['id'])});}}else{socket[_0x87fb('0x76')](_0x87fb('0x77'),{'UserId':Number(_0x41b056[_0x87fb('0x37')]['ids']),'VoicePrefixId':Number(_0x41b056[_0x87fb('0x48')]['id'])});}});}})[_0x87fb('0x26')](respondWithStatusCode(_0x2a474d,null))[_0x87fb('0x4b')](handleError(_0x2a474d,null));};exports[_0x87fb('0x78')]=function(_0x209390,_0x207cf2,_0x28e764){var _0x175bb5={};var _0x20e434={};var _0x539944;var _0x203a18;return db[_0x87fb('0x2f')][_0x87fb('0x79')]({'where':{'id':_0x209390['params']['id']}})[_0x87fb('0x26')](handleEntityNotFound(_0x207cf2,null))[_0x87fb('0x26')](function(_0x3ba452){if(_0x3ba452){_0x539944=_0x3ba452;_0x20e434[_0x87fb('0x34')]=_['keys'](db[_0x87fb('0x7a')][_0x87fb('0x30')]);_0x20e434[_0x87fb('0x37')]=_['keys'](_0x209390[_0x87fb('0x37')]);_0x20e434[_0x87fb('0x3c')]=_['intersection'](_0x20e434['model'],_0x20e434['query']);_0x175bb5['attributes']=_[_0x87fb('0x49')](_0x20e434[_0x87fb('0x34')],qs[_0x87fb('0x36')](_0x209390['query'][_0x87fb('0x36')]));_0x175bb5[_0x87fb('0x35')]=_0x175bb5[_0x87fb('0x35')]['length']?_0x175bb5[_0x87fb('0x35')]:_0x20e434[_0x87fb('0x34')];_0x175bb5['order']=qs[_0x87fb('0x3b')](_0x209390[_0x87fb('0x37')][_0x87fb('0x3b')]);_0x175bb5[_0x87fb('0x3f')]=qs[_0x87fb('0x3c')](_[_0x87fb('0x3d')](_0x209390[_0x87fb('0x37')],_0x20e434[_0x87fb('0x3c')]));if(_0x209390[_0x87fb('0x37')]['filter']){_0x175bb5[_0x87fb('0x3f')]=_['merge'](_0x175bb5[_0x87fb('0x3f')],{'$or':_[_0x87fb('0x32')](_0x175bb5[_0x87fb('0x35')],function(_0x57cce6){var _0x36ddfa={};_0x36ddfa[_0x57cce6]={'$like':'%'+_0x209390['query']['filter']+'%'};return _0x36ddfa;})});}_0x175bb5=_[_0x87fb('0x40')]({},_0x175bb5,_0x209390['options']);return _0x539944[_0x87fb('0x78')](_0x175bb5);}})['then'](function(_0x49ef9e){if(_0x49ef9e){_0x203a18=_0x49ef9e[_0x87fb('0x38')];if(!_0x209390[_0x87fb('0x37')]['hasOwnProperty'](_0x87fb('0x39'))){_0x175bb5['limit']=qs[_0x87fb('0x20')](_0x209390['query'][_0x87fb('0x20')]);_0x175bb5[_0x87fb('0x1f')]=qs[_0x87fb('0x1f')](_0x209390['query'][_0x87fb('0x1f')]);}return _0x539944[_0x87fb('0x78')](_0x175bb5);}})[_0x87fb('0x26')](function(_0x569bbc){if(_0x569bbc){return _0x569bbc?{'count':_0x203a18,'rows':_0x569bbc}:null;}})['then'](respondWithResult(_0x207cf2,null))['catch'](handleError(_0x207cf2,null));};
\ No newline at end of file
+var _0xf493=['removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','describe','create','transaction','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','body','system-','addAgents','ids','spread','emit'];(function(_0x529266,_0x539d07){var _0x23fec2=function(_0x2996ad){while(--_0x2996ad){_0x529266['push'](_0x529266['shift']());}};_0x23fec2(++_0x539d07);}(_0xf493,0x1ea));var _0x3f49=function(_0x3bd82a,_0x5bde5b){_0x3bd82a=_0x3bd82a-0x0;var _0x480b2d=_0xf493[_0x3bd82a];return _0x480b2d;};'use strict';var pdf=require(_0x3f49('0x0'));var emlformat=require(_0x3f49('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3f49('0x2'));var jsonpatch=require(_0x3f49('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f49('0x4'));var Mustache=require(_0x3f49('0x5'));var util=require(_0x3f49('0x6'));var path=require('path');var sox=require(_0x3f49('0x7'));var csv=require(_0x3f49('0x8'));var ejs=require(_0x3f49('0x9'));var fs=require('fs');var _=require(_0x3f49('0xa'));var squel=require('squel');var crypto=require(_0x3f49('0xb'));var jsforce=require(_0x3f49('0xc'));var deskjs=require(_0x3f49('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3f49('0xe'));var Redis=require(_0x3f49('0xf'));var authService=require(_0x3f49('0x10'));var qs=require(_0x3f49('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f49('0x12'));var logger=require(_0x3f49('0x13'))('api');var utils=require(_0x3f49('0x14'));var config=require(_0x3f49('0x15'));var db=require('../../mysqldb')['db'];config[_0x3f49('0x16')]=_[_0x3f49('0x17')](config[_0x3f49('0x16')],{'host':_0x3f49('0x18'),'port':0x18eb});var socket=require(_0x3f49('0x19'))(new Redis(config[_0x3f49('0x16')]));require(_0x3f49('0x1a'))[_0x3f49('0x1b')](socket);function respondWithStatusCode(_0x7b6810,_0x1500f9){_0x1500f9=_0x1500f9||0xcc;return function(_0x38c1c8){if(_0x38c1c8){return _0x7b6810['sendStatus'](_0x1500f9);}return _0x7b6810[_0x3f49('0x1c')](_0x1500f9)[_0x3f49('0x1d')]();};}function respondWithResult(_0x310f30,_0x1e3e93){_0x1e3e93=_0x1e3e93||0xc8;return function(_0x1190d2){if(_0x1190d2){return _0x310f30[_0x3f49('0x1c')](_0x1e3e93)[_0x3f49('0x1e')](_0x1190d2);}};}function respondWithFilteredResult(_0x303d03,_0x514035){return function(_0x294d90){if(_0x294d90){var _0x17b082=_0x294d90[_0x3f49('0x1f')],_0x5f2da4=_0x514035[_0x3f49('0x20')],_0x4f7995=_0x514035['offset']+_0x514035[_0x3f49('0x21')],_0x458233;if(_0x4f7995>=_0x17b082){_0x4f7995=_0x17b082;_0x458233=0xc8;}else{_0x458233=0xce;}_0x303d03['status'](_0x458233);return _0x303d03['set'](_0x3f49('0x22'),_0x5f2da4+'-'+_0x4f7995+'/'+_0x17b082)[_0x3f49('0x1e')](_0x294d90);}return null;};}function patchUpdates(_0x3f2f1c){return function(_0x30c8b1){try{jsonpatch['apply'](_0x30c8b1,_0x3f2f1c,!![]);}catch(_0x109055){return BPromise[_0x3f49('0x23')](_0x109055);}return _0x30c8b1[_0x3f49('0x24')]();};}function saveUpdates(_0x2ee4fe,_0x4d2108){return function(_0x5dd4e3){if(_0x5dd4e3){return _0x5dd4e3['update'](_0x2ee4fe)[_0x3f49('0x25')](function(_0x272ca2){return _0x272ca2;});}return null;};}function removeEntity(_0xa6c725,_0xffa9a6){return function(_0x196ccb){if(_0x196ccb){return _0x196ccb[_0x3f49('0x26')]()['then'](function(){var _0x1c38b1=_0x196ccb[_0x3f49('0x27')]({'plain':!![]});var _0xd8935e='VoicePrefixes';return db[_0x3f49('0x28')][_0x3f49('0x26')]({'where':{'type':_0xd8935e,'resourceId':_0x1c38b1['id']}})['then'](function(){return _0x196ccb;});})[_0x3f49('0x25')](function(){_0xa6c725[_0x3f49('0x1c')](0xcc)[_0x3f49('0x1d')]();});}};}function handleEntityNotFound(_0x103fd1,_0x2dd9ca){return function(_0x3a0bfd){if(!_0x3a0bfd){_0x103fd1[_0x3f49('0x29')](0x194);}return _0x3a0bfd;};}function handleError(_0x26c919,_0x36f4c6){_0x36f4c6=_0x36f4c6||0x1f4;return function(_0x518b16){logger['error'](_0x518b16[_0x3f49('0x2a')]);if(_0x518b16[_0x3f49('0x2b')]){delete _0x518b16[_0x3f49('0x2b')];}_0x26c919[_0x3f49('0x1c')](_0x36f4c6)[_0x3f49('0x2c')](_0x518b16);};}exports[_0x3f49('0x2d')]=function(_0x48c4e0,_0x3b804e){var _0x42084a={},_0x55fcd5={},_0x3184b0={'count':0x0,'rows':[]};var _0x146c91=_[_0x3f49('0x2e')](db[_0x3f49('0x2f')][_0x3f49('0x30')],function(_0x504afc){return{'name':_0x504afc['fieldName'],'type':_0x504afc[_0x3f49('0x31')][_0x3f49('0x32')]};});_0x55fcd5['model']=_[_0x3f49('0x2e')](_0x146c91,_0x3f49('0x2b'));_0x55fcd5['query']=_[_0x3f49('0x33')](_0x48c4e0[_0x3f49('0x34')]);_0x55fcd5[_0x3f49('0x35')]=_[_0x3f49('0x36')](_0x55fcd5[_0x3f49('0x37')],_0x55fcd5['query']);_0x42084a[_0x3f49('0x38')]=_[_0x3f49('0x36')](_0x55fcd5[_0x3f49('0x37')],qs[_0x3f49('0x39')](_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x39')]));_0x42084a[_0x3f49('0x38')]=_0x42084a[_0x3f49('0x38')]['length']?_0x42084a[_0x3f49('0x38')]:_0x55fcd5['model'];if(!_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3a')](_0x3f49('0x3b'))){_0x42084a[_0x3f49('0x21')]=qs[_0x3f49('0x21')](_0x48c4e0['query']['limit']);_0x42084a[_0x3f49('0x20')]=qs['offset'](_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x20')]);}_0x42084a[_0x3f49('0x3c')]=qs[_0x3f49('0x3d')](_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3d')]);_0x42084a['where']=qs[_0x3f49('0x35')](_['pick'](_0x48c4e0[_0x3f49('0x34')],_0x55fcd5[_0x3f49('0x35')]),_0x146c91);if(_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3e')]){_0x42084a[_0x3f49('0x3f')]=_['merge'](_0x42084a['where'],{'$or':_[_0x3f49('0x2e')](_0x146c91,function(_0x356bd7){if(_0x356bd7['type']!==_0x3f49('0x40')){var _0x2dd68f={};_0x2dd68f[_0x356bd7[_0x3f49('0x2b')]]={'$like':'%'+_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x3e')]+'%'};return _0x2dd68f;}})});}_0x42084a=_[_0x3f49('0x41')]({},_0x42084a,_0x48c4e0['options']);var _0x289d66={'where':_0x42084a['where']};return db[_0x3f49('0x2f')][_0x3f49('0x1f')](_0x289d66)[_0x3f49('0x25')](function(_0x488875){_0x3184b0[_0x3f49('0x1f')]=_0x488875;if(_0x48c4e0[_0x3f49('0x34')][_0x3f49('0x42')]){_0x42084a[_0x3f49('0x43')]=[{'all':!![]}];}return db[_0x3f49('0x2f')][_0x3f49('0x44')](_0x42084a);})[_0x3f49('0x25')](function(_0x181b80){_0x3184b0[_0x3f49('0x45')]=_0x181b80;return _0x3184b0;})[_0x3f49('0x25')](respondWithFilteredResult(_0x3b804e,_0x42084a))[_0x3f49('0x46')](handleError(_0x3b804e,null));};exports[_0x3f49('0x47')]=function(_0x4d3d93,_0x532589){var _0x7db6c0={'raw':![],'where':{'id':_0x4d3d93[_0x3f49('0x48')]['id']}},_0x535d98={};_0x535d98[_0x3f49('0x37')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x535d98['query']=_[_0x3f49('0x33')](_0x4d3d93['query']);_0x535d98[_0x3f49('0x35')]=_[_0x3f49('0x36')](_0x535d98[_0x3f49('0x37')],_0x535d98[_0x3f49('0x34')]);_0x7db6c0[_0x3f49('0x38')]=_[_0x3f49('0x36')](_0x535d98[_0x3f49('0x37')],qs[_0x3f49('0x39')](_0x4d3d93[_0x3f49('0x34')][_0x3f49('0x39')]));_0x7db6c0[_0x3f49('0x38')]=_0x7db6c0[_0x3f49('0x38')][_0x3f49('0x49')]?_0x7db6c0[_0x3f49('0x38')]:_0x535d98[_0x3f49('0x37')];if(_0x4d3d93[_0x3f49('0x34')]['includeAll']){_0x7db6c0[_0x3f49('0x43')]=[{'all':!![]}];}_0x7db6c0=_[_0x3f49('0x41')]({},_0x7db6c0,_0x4d3d93[_0x3f49('0x4a')]);return db['VoicePrefix'][_0x3f49('0x4b')](_0x7db6c0)[_0x3f49('0x25')](handleEntityNotFound(_0x532589,null))[_0x3f49('0x25')](respondWithResult(_0x532589,null))[_0x3f49('0x46')](handleError(_0x532589,null));};exports['destroy']=function(_0x22bf8d,_0x286e49){return db[_0x3f49('0x2f')][_0x3f49('0x4b')]({'where':{'id':_0x22bf8d[_0x3f49('0x48')]['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x286e49,null))[_0x3f49('0x25')](removeEntity(_0x286e49,null))[_0x3f49('0x46')](handleError(_0x286e49,null));};exports['describe']=function(_0x354d97,_0x1f5486){return db[_0x3f49('0x2f')][_0x3f49('0x4c')]()['then'](respondWithResult(_0x1f5486,null))[_0x3f49('0x46')](handleError(_0x1f5486,null));};exports[_0x3f49('0x4d')]=function(_0x3b7977,_0x35600d){var _0x1a0c32;return db['sequelize'][_0x3f49('0x4e')](function(_0x16010f){return db['VoicePrefix'][_0x3f49('0x4d')](_0x3b7977['body'],{'transaction':_0x16010f})[_0x3f49('0x25')](function(_0x5ab8b2){_0x1a0c32=_0x5ab8b2['get']({'plain':!![]});return db[_0x3f49('0x4f')][_0x3f49('0x4b')]({'where':{'id':_0x1a0c32['VoiceExtensionId']},'raw':!![]})['then'](function(_0x40d187){return createVoicePrefixExtensions(_0x1a0c32,_0x40d187,_0x16010f);});});})[_0x3f49('0x25')](function(){var _0x49e2fc=_0x3b7977[_0x3f49('0x50')]['get']({'plain':!![]});if(!_0x49e2fc)throw new Error(_0x3f49('0x51'));if(_0x49e2fc[_0x3f49('0x52')]===_0x3f49('0x50')){var _0x56b2a=_0x1a0c32;return db[_0x3f49('0x53')][_0x3f49('0x4b')]({'where':{'name':_0x3f49('0x54'),'userProfileId':_0x49e2fc['userProfileId']},'raw':!![]})[_0x3f49('0x25')](function(_0x44fddd){if(_0x44fddd&&_0x44fddd[_0x3f49('0x55')]===0x0){return db[_0x3f49('0x28')][_0x3f49('0x4d')]({'name':_0x56b2a[_0x3f49('0x2b')],'resourceId':_0x56b2a['id'],'type':_0x44fddd[_0x3f49('0x2b')],'sectionId':_0x44fddd['id']},{})[_0x3f49('0x25')](function(){return _0x1a0c32;});}else{return _0x1a0c32;}})['catch'](function(_0x2d491f){logger[_0x3f49('0x56')](_0x3f49('0x57'),_0x2d491f);throw _0x2d491f;});}return _0x1a0c32;})[_0x3f49('0x25')](respondWithResult(_0x35600d,null))[_0x3f49('0x46')](handleError(_0x35600d,null));};function Extension(_0x462f38,_0x56cf16,_0x138047,_0x461275){this[_0x3f49('0x58')]=_0x3f49('0x59');this[_0x3f49('0x5a')]=_0x462f38;this['app']=_0x138047;this[_0x3f49('0x31')]=_0x3f49('0x5b');this[_0x3f49('0x5c')]='Voice\x20Prefix\x20Extension';this[_0x3f49('0x5d')]=_0x56cf16;this[_0x3f49('0x5e')]=_0x461275;}function createVoicePrefixExtensions(_0x3222ad,_0xcd2420,_0x1ae41c){return new BPromise(function(_0x188737,_0x5be99a){var _0x772537=new Extension(formatPrefixName(_0x3222ad[_0x3f49('0x5f')]),0x1,_0x3f49('0x60'),_0x3f49('0x61'));_0x772537[_0x3f49('0x62')]=_0x3222ad['id'];return db[_0x3f49('0x4f')]['create'](_0x772537,{'transaction':_0x1ae41c})[_0x3f49('0x25')](function(_0x42dbed){var _0x38104e=_0x42dbed[_0x3f49('0x27')]({'plain':!![]});var _0x2764b4=_['map'](addVoicePrefixExtensions(_0x3222ad,_0xcd2420),function(_0x1d9057){_0x1d9057[_0x3f49('0x63')]=_0x38104e['id'];_0x1d9057[_0x3f49('0x62')]=_0x3222ad['id'];return _0x1d9057;});return db['VoiceExtension']['bulkCreate'](_0x2764b4,{'transaction':_0x1ae41c})[_0x3f49('0x25')](function(_0x3280cd){if(!_0x3280cd){return _0x5be99a(_0x3f49('0x64'));}else{return _0x188737(_0x3280cd);}})[_0x3f49('0x46')](function(_0x1404ae){return _0x5be99a(_0x1404ae);});});;});};function addVoicePrefixExtensions(_0x5b1d00,_0x27c2c4){var _0x26b6c7=[];var _0x5b24e0=formatPrefixName(_0x5b1d00[_0x3f49('0x5f')]);_0x26b6c7[_0x3f49('0x65')](new Extension(_0x5b24e0,0x2,_0x3f49('0x66'),_0x3f49('0x67')+_0x5b1d00[_0x3f49('0x2b')]));if(_0x5b1d00['callerIdAll']){_0x26b6c7[_0x3f49('0x65')](new Extension(_0x5b24e0,0x3,'Set','PREFIX-CALLERIDALL='+_0x5b1d00[_0x3f49('0x68')]));}else{_0x26b6c7['push'](new Extension(_0x5b24e0,0x3,_0x3f49('0x60'),_0x3f49('0x69')));}_0x26b6c7[_0x3f49('0x65')](new Extension(_0x5b24e0,0x4,_0x3f49('0x6a'),_0x27c2c4[_0x3f49('0x58')]+','+'${EXTEN:'+(0x8+_0x5b1d00[_0x3f49('0x2b')]['length'])+'}'+','+0x1));return _0x26b6c7;}function formatPrefixName(_0x5354e4){var _0x4c1285='_';for(var _0x1d5697=0x0;_0x1d5697<_0x5354e4['length'];_0x1d5697++){if(_0x5354e4[_0x3f49('0x6b')](_0x1d5697)=='-'){_0x4c1285+=_0x5354e4[_0x3f49('0x6b')](_0x1d5697);}else{_0x4c1285+='['+_0x5354e4[_0x3f49('0x6b')](_0x1d5697)+']';}}_0x4c1285+='.';return _0x4c1285;}exports[_0x3f49('0x6c')]=function(_0x31fde4,_0x566fe1,_0x4c5aeb){var _0x2e5490=_0x31fde4[_0x3f49('0x6d')];_0x2e5490['prefix']=_0x3f49('0x6e')+_0x2e5490['name']+'-';return db['sequelize'][_0x3f49('0x4e')](function(_0x59cc1c){return db['VoicePrefix'][_0x3f49('0x6c')](_0x2e5490,{'where':{'id':_0x2e5490['id']},'transaction':_0x59cc1c})['then'](function(){return db['VoiceExtension'][_0x3f49('0x26')]({'where':{'VoicePrefixId':_0x2e5490['id']},'transaction':_0x59cc1c})[_0x3f49('0x25')](function(){return db[_0x3f49('0x4f')][_0x3f49('0x4b')]({'where':{'id':_0x2e5490[_0x3f49('0x63')]},'raw':!![]})[_0x3f49('0x25')](function(_0x288a77){return createVoicePrefixExtensions(_0x2e5490,_0x288a77,_0x59cc1c);});});});})[_0x3f49('0x25')](function(){return db[_0x3f49('0x2f')]['findById'](_0x2e5490['id']);})[_0x3f49('0x25')](respondWithResult(_0x566fe1,null))[_0x3f49('0x46')](handleError(_0x566fe1,null));};exports[_0x3f49('0x6f')]=function(_0x3739cf,_0x24fff8,_0x596969){return db[_0x3f49('0x2f')]['find']({'where':{'id':_0x3739cf[_0x3f49('0x48')]['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x24fff8,null))[_0x3f49('0x25')](function(_0x5f15c6){if(_0x5f15c6){return _0x5f15c6['addAgents'](_0x3739cf[_0x3f49('0x6d')][_0x3f49('0x70')],_['omit'](_0x3739cf['body'],[_0x3f49('0x70'),'id'])||{})[_0x3f49('0x71')](function(_0x5f3ea5){for(var _0x528f48=0x0;_0x528f48<_0x3739cf['body'][_0x3f49('0x70')][_0x3f49('0x49')];_0x528f48+=0x1){socket[_0x3f49('0x72')]('userVoicePrefix:save',{'UserId':_0x3739cf['body']['ids'][_0x528f48],'VoicePrefixId':_0x3739cf[_0x3f49('0x48')]['id']});}return _0x5f3ea5;});}})['then'](respondWithResult(_0x24fff8,null))[_0x3f49('0x46')](handleError(_0x24fff8,null));};exports[_0x3f49('0x73')]=function(_0x167e7f,_0x5ddcdd,_0x105df1){return db[_0x3f49('0x2f')][_0x3f49('0x4b')]({'where':{'id':_0x167e7f['params']['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x5ddcdd,null))['then'](function(_0x52cce2){if(_0x52cce2){return _0x52cce2['removeAgents'](_0x167e7f['query']['ids'])[_0x3f49('0x25')](function(){if(_['isArray'](_0x167e7f['query'][_0x3f49('0x70')])){for(var _0x212005=0x0;_0x212005<_0x167e7f[_0x3f49('0x34')][_0x3f49('0x70')][_0x3f49('0x49')];_0x212005+=0x1){socket[_0x3f49('0x72')](_0x3f49('0x74'),{'UserId':Number(_0x167e7f[_0x3f49('0x34')][_0x3f49('0x70')][_0x212005]),'VoicePrefixId':Number(_0x167e7f[_0x3f49('0x48')]['id'])});}}else{socket['emit'](_0x3f49('0x74'),{'UserId':Number(_0x167e7f[_0x3f49('0x34')][_0x3f49('0x70')]),'VoicePrefixId':Number(_0x167e7f[_0x3f49('0x48')]['id'])});}});}})[_0x3f49('0x25')](respondWithStatusCode(_0x5ddcdd,null))[_0x3f49('0x46')](handleError(_0x5ddcdd,null));};exports[_0x3f49('0x75')]=function(_0x4a1b40,_0x1aad3e,_0x1fbc0f){var _0x46c440={};var _0x309310={};var _0x4c9dd9;var _0x455bfd;return db[_0x3f49('0x2f')][_0x3f49('0x76')]({'where':{'id':_0x4a1b40[_0x3f49('0x48')]['id']}})[_0x3f49('0x25')](handleEntityNotFound(_0x1aad3e,null))['then'](function(_0x59a142){if(_0x59a142){_0x4c9dd9=_0x59a142;_0x309310['model']=_[_0x3f49('0x33')](db[_0x3f49('0x77')][_0x3f49('0x30')]);_0x309310[_0x3f49('0x34')]=_[_0x3f49('0x33')](_0x4a1b40['query']);_0x309310['filters']=_[_0x3f49('0x36')](_0x309310[_0x3f49('0x37')],_0x309310[_0x3f49('0x34')]);_0x46c440[_0x3f49('0x38')]=_[_0x3f49('0x36')](_0x309310[_0x3f49('0x37')],qs[_0x3f49('0x39')](_0x4a1b40['query'][_0x3f49('0x39')]));_0x46c440[_0x3f49('0x38')]=_0x46c440[_0x3f49('0x38')][_0x3f49('0x49')]?_0x46c440[_0x3f49('0x38')]:_0x309310[_0x3f49('0x37')];_0x46c440['order']=qs[_0x3f49('0x3d')](_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x3d')]);_0x46c440[_0x3f49('0x3f')]=qs[_0x3f49('0x35')](_[_0x3f49('0x78')](_0x4a1b40[_0x3f49('0x34')],_0x309310[_0x3f49('0x35')]));if(_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x3e')]){_0x46c440[_0x3f49('0x3f')]=_[_0x3f49('0x41')](_0x46c440['where'],{'$or':_[_0x3f49('0x2e')](_0x46c440[_0x3f49('0x38')],function(_0x11feda){var _0x3a501c={};_0x3a501c[_0x11feda]={'$like':'%'+_0x4a1b40[_0x3f49('0x34')]['filter']+'%'};return _0x3a501c;})});}_0x46c440=_[_0x3f49('0x41')]({},_0x46c440,_0x4a1b40[_0x3f49('0x4a')]);return _0x4c9dd9['getAgents'](_0x46c440);}})['then'](function(_0x5494a2){if(_0x5494a2){_0x455bfd=_0x5494a2['length'];if(!_0x4a1b40['query']['hasOwnProperty'](_0x3f49('0x3b'))){_0x46c440[_0x3f49('0x21')]=qs['limit'](_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x21')]);_0x46c440[_0x3f49('0x20')]=qs[_0x3f49('0x20')](_0x4a1b40[_0x3f49('0x34')][_0x3f49('0x20')]);}return _0x4c9dd9[_0x3f49('0x75')](_0x46c440);}})[_0x3f49('0x25')](function(_0xd4299c){if(_0xd4299c){return _0xd4299c?{'count':_0x455bfd,'rows':_0xd4299c}:null;}})[_0x3f49('0x25')](respondWithResult(_0x1aad3e,null))['catch'](handleError(_0x1aad3e,null));};
\ No newline at end of file