Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / faxAccount / faxAccount.controller.js
index 4157701..a313b8b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c3e=['removeAgents','userFaxAccount:remove','getAgents','User','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./faxAccount.socket','register','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','index','Pause','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','FaxAccount','includeAll','findAll','rows','show','params','mandatoryDispositionPause','fields','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','removeDispositions','addAnswer','getAnswers','order','CannedAnswer','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','finally','sendStatus','send','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','localstationid','gateway','faxdetect','maxrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x8c3e,0x180));var _0xe8c3=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0x8c3e[_0x4a1353];return _0x3805cc;};'use strict';var emlformat=require(_0xe8c3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe8c3('0x1'));var rp=require(_0xe8c3('0x2'));var moment=require(_0xe8c3('0x3'));var BPromise=require(_0xe8c3('0x4'));var Mustache=require(_0xe8c3('0x5'));var util=require(_0xe8c3('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe8c3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8c3('0x8'));var _=require(_0xe8c3('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8c3('0x7'));var querystring=require(_0xe8c3('0xa'));var Papa=require('papaparse');var Redis=require(_0xe8c3('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe8c3('0xc'));var hardwareService=require(_0xe8c3('0xd'));var logger=require(_0xe8c3('0xe'))(_0xe8c3('0xf'));var utils=require('../../config/utils');var config=require(_0xe8c3('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8c3('0x11'))['db'];config['redis']=_[_0xe8c3('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe8c3('0x13'))(new Redis(config['redis']));require(_0xe8c3('0x14'))[_0xe8c3('0x15')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xe8c3('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x15e807,_0x2609bc,_0x509870,_0x35a74b){return new BPromise(function(_0x49c806,_0x4b6a63){var _0x27a9a0=_0x35a74b||client;return _0x27a9a0[_0xe8c3('0x17')](_0x15e807,_0x509870)[_0xe8c3('0x18')](function(_0x5dd92c){logger[_0xe8c3('0x19')](_0xe8c3('0x1a'),_0x2609bc,'request\x20sent');logger[_0xe8c3('0x1b')](_0xe8c3('0x1c'),_0x2609bc,'request\x20sent',JSON[_0xe8c3('0x1d')](_0x5dd92c));if(_0x5dd92c['error']){if(_0x5dd92c[_0xe8c3('0x1e')][_0xe8c3('0x1f')]===0x1f4){logger[_0xe8c3('0x1e')](_0xe8c3('0x1a'),_0x2609bc,_0x5dd92c['error'][_0xe8c3('0x20')]);return _0x4b6a63(_0x5dd92c[_0xe8c3('0x1e')]['message']);}logger[_0xe8c3('0x1e')](_0xe8c3('0x1a'),_0x2609bc,_0x5dd92c[_0xe8c3('0x1e')][_0xe8c3('0x20')]);return _0x49c806(_0x5dd92c[_0xe8c3('0x1e')]['message']);}else{logger[_0xe8c3('0x19')](_0xe8c3('0x1a'),_0x2609bc,_0xe8c3('0x21'));_0x49c806(_0x5dd92c[_0xe8c3('0x22')][_0xe8c3('0x20')]);}})[_0xe8c3('0x23')](function(_0x447561){logger['error'](_0xe8c3('0x1a'),_0x2609bc,_0x447561);_0x4b6a63(_0x447561);});});}function respondWithStatusCode(_0x30d185,_0x156d48){_0x156d48=_0x156d48||0xcc;return function(_0x1d9f81){if(_0x1d9f81){return _0x30d185['sendStatus'](_0x156d48);}return _0x30d185[_0xe8c3('0x24')](_0x156d48)['end']();};}function respondWithResult(_0xb2b0dd,_0x5afdfb){_0x5afdfb=_0x5afdfb||0xc8;return function(_0x420dc6){if(_0x420dc6){return _0xb2b0dd[_0xe8c3('0x24')](_0x5afdfb)[_0xe8c3('0x25')](_0x420dc6);}};}function respondWithFilteredResult(_0x862800,_0x2af293){return function(_0x4e0983){if(_0x4e0983){var _0x4ba239=typeof _0x2af293[_0xe8c3('0x26')]==='undefined'&&typeof _0x2af293['limit']===_0xe8c3('0x27');var _0x2f3a3e=_0x4e0983[_0xe8c3('0x28')];var _0x306456=_0x4ba239?0x0:_0x2af293[_0xe8c3('0x26')];var _0x334306=_0x4ba239?_0x4e0983[_0xe8c3('0x28')]:_0x2af293[_0xe8c3('0x26')]+_0x2af293[_0xe8c3('0x29')];var _0x43f277;if(_0x334306>=_0x2f3a3e){_0x334306=_0x2f3a3e;_0x43f277=0xc8;}else{_0x43f277=0xce;}_0x862800['status'](_0x43f277);return _0x862800[_0xe8c3('0x2a')]('Content-Range',_0x306456+'-'+_0x334306+'/'+_0x2f3a3e)[_0xe8c3('0x25')](_0x4e0983);}return null;};}function patchUpdates(_0xb892b8){return function(_0x512863){try{jsonpatch['apply'](_0x512863,_0xb892b8,!![]);}catch(_0x4d8541){return BPromise[_0xe8c3('0x2b')](_0x4d8541);}return _0x512863[_0xe8c3('0x2c')]();};}function saveUpdates(_0x560555,_0x569146){return function(_0x2b0b43){if(_0x2b0b43){return _0x2b0b43[_0xe8c3('0x2d')](_0x560555)[_0xe8c3('0x18')](function(_0xf4c1dc){return _0xf4c1dc;});}return null;};}function removeEntity(_0x3e3066,_0x145b8a){return function(_0x3a817a){if(_0x3a817a){return _0x3a817a[_0xe8c3('0x2e')]()[_0xe8c3('0x18')](function(){var _0x5e7878=_0x3a817a['get']({'plain':!![]});var _0x293e5c=_0xe8c3('0x2f');return db[_0xe8c3('0x30')][_0xe8c3('0x2e')]({'where':{'type':_0x293e5c,'resourceId':_0x5e7878['id']}})[_0xe8c3('0x18')](function(){return _0x3a817a;});})[_0xe8c3('0x18')](function(){_0x3e3066[_0xe8c3('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13481d,_0x1797c0){return function(_0x54807d){if(!_0x54807d){_0x13481d['sendStatus'](0x194);}return _0x54807d;};}function handleError(_0x21b377,_0x228694){_0x228694=_0x228694||0x1f4;return function(_0x4e465e){logger[_0xe8c3('0x1e')](_0x4e465e[_0xe8c3('0x31')]);if(_0x4e465e[_0xe8c3('0x32')]){delete _0x4e465e[_0xe8c3('0x32')];}_0x21b377[_0xe8c3('0x24')](_0x228694)['send'](_0x4e465e);};}exports[_0xe8c3('0x33')]=function(_0x21d820,_0x52cd9b){var _0x260800={'include':[{'model':db[_0xe8c3('0x34')],'as':'mandatoryDispositionPause'}]},_0x456cac={},_0x45b9a6={'count':0x0,'rows':[]};var _0x3eaf42=_[_0xe8c3('0x35')](db['FaxAccount'][_0xe8c3('0x36')],function(_0x5b264d){return{'name':_0x5b264d['fieldName'],'type':_0x5b264d[_0xe8c3('0x37')]['key']};});_0x456cac[_0xe8c3('0x38')]=_[_0xe8c3('0x35')](_0x3eaf42,_0xe8c3('0x32'));_0x456cac[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x21d820[_0xe8c3('0x39')]);_0x456cac[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x456cac[_0xe8c3('0x38')],_0x456cac[_0xe8c3('0x39')]);_0x260800['attributes']=_[_0xe8c3('0x3c')](_0x456cac[_0xe8c3('0x38')],qs['fields'](_0x21d820[_0xe8c3('0x39')]['fields']));_0x260800[_0xe8c3('0x3d')]=_0x260800[_0xe8c3('0x3d')]['length']?_0x260800['attributes']:_0x456cac['model'];if(!_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x260800[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x260800[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x21d820['query'][_0xe8c3('0x26')]);}_0x260800['order']=qs[_0xe8c3('0x40')](_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x260800[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x21d820[_0xe8c3('0x39')],_0x456cac[_0xe8c3('0x3b')]),_0x3eaf42);if(_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x260800[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x260800[_0xe8c3('0x41')],{'$or':_['map'](_0x3eaf42,function(_0x35f876){if(_0x35f876[_0xe8c3('0x37')]!=='VIRTUAL'){var _0x336cbd={};_0x336cbd[_0x35f876[_0xe8c3('0x32')]]={'$like':'%'+_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x336cbd;}})});}_0x260800=_[_0xe8c3('0x44')]({},_0x260800,_0x21d820[_0xe8c3('0x45')]);var _0x50b3fd={'where':_0x260800[_0xe8c3('0x41')]};return db[_0xe8c3('0x46')]['count'](_0x50b3fd)[_0xe8c3('0x18')](function(_0x9c791d){_0x45b9a6[_0xe8c3('0x28')]=_0x9c791d;if(_0x21d820[_0xe8c3('0x39')][_0xe8c3('0x47')]){_0x260800['include']=[{'all':!![]}];}return db[_0xe8c3('0x46')][_0xe8c3('0x48')](_0x260800);})[_0xe8c3('0x18')](function(_0x506e89){_0x45b9a6[_0xe8c3('0x49')]=_0x506e89;return _0x45b9a6;})[_0xe8c3('0x18')](respondWithFilteredResult(_0x52cd9b,_0x260800))[_0xe8c3('0x23')](handleError(_0x52cd9b,null));};exports[_0xe8c3('0x4a')]=function(_0x42f3d8,_0x5a0822){var _0x5ee33d={'raw':![],'where':{'id':_0x42f3d8[_0xe8c3('0x4b')]['id']},'include':[{'model':db['Pause'],'as':_0xe8c3('0x4c')}]},_0x1c1e0a={};_0x1c1e0a[_0xe8c3('0x38')]=_['keys'](db[_0xe8c3('0x46')][_0xe8c3('0x36')]);_0x1c1e0a['query']=_['keys'](_0x42f3d8[_0xe8c3('0x39')]);_0x1c1e0a['filters']=_[_0xe8c3('0x3c')](_0x1c1e0a[_0xe8c3('0x38')],_0x1c1e0a[_0xe8c3('0x39')]);_0x5ee33d[_0xe8c3('0x3d')]=_['intersection'](_0x1c1e0a['model'],qs[_0xe8c3('0x4d')](_0x42f3d8['query']['fields']));_0x5ee33d[_0xe8c3('0x3d')]=_0x5ee33d[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x5ee33d[_0xe8c3('0x3d')]:_0x1c1e0a[_0xe8c3('0x38')];if(_0x42f3d8[_0xe8c3('0x39')][_0xe8c3('0x47')]){_0x5ee33d[_0xe8c3('0x4f')]=[{'all':!![]}];}_0x5ee33d=_[_0xe8c3('0x44')]({},_0x5ee33d,_0x42f3d8[_0xe8c3('0x45')]);return db[_0xe8c3('0x46')][_0xe8c3('0x50')](_0x5ee33d)[_0xe8c3('0x18')](handleEntityNotFound(_0x5a0822,null))['then'](respondWithResult(_0x5a0822,null))[_0xe8c3('0x23')](handleError(_0x5a0822,null));};exports[_0xe8c3('0x51')]=function(_0x46e119,_0x83e652){return db[_0xe8c3('0x46')][_0xe8c3('0x51')](_0x46e119[_0xe8c3('0x52')],{})[_0xe8c3('0x18')](function(_0x41491a){var _0x2636a1=_0x46e119[_0xe8c3('0x53')][_0xe8c3('0x54')]({'plain':!![]});if(!_0x2636a1)throw new Error(_0xe8c3('0x55'));if(_0x2636a1[_0xe8c3('0x56')]===_0xe8c3('0x53')){var _0x567083=_0x41491a['get']({'plain':!![]});var _0x17fcae=_0xe8c3('0x2f');return db[_0xe8c3('0x57')][_0xe8c3('0x50')]({'where':{'name':_0x17fcae,'userProfileId':_0x2636a1['userProfileId']},'raw':!![]})[_0xe8c3('0x18')](function(_0x465486){if(_0x465486&&_0x465486[_0xe8c3('0x58')]===0x0){return db[_0xe8c3('0x30')]['create']({'name':_0x567083['name'],'resourceId':_0x567083['id'],'type':_0x465486[_0xe8c3('0x32')],'sectionId':_0x465486['id']},{})['then'](function(){return _0x41491a;});}else{return _0x41491a;}})[_0xe8c3('0x23')](function(_0xf0b596){logger[_0xe8c3('0x1e')](_0xe8c3('0x59'),_0xf0b596);throw _0xf0b596;});}return _0x41491a;})[_0xe8c3('0x18')](respondWithResult(_0x83e652,0xc9))[_0xe8c3('0x23')](handleError(_0x83e652,null));};exports[_0xe8c3('0x2d')]=function(_0x218fba,_0x3efad2){if(_0x218fba[_0xe8c3('0x52')]['id']){delete _0x218fba[_0xe8c3('0x52')]['id'];}return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x218fba['params']['id']},'include':[{'model':db[_0xe8c3('0x34')],'as':'mandatoryDispositionPause'}]})[_0xe8c3('0x18')](handleEntityNotFound(_0x3efad2,null))[_0xe8c3('0x18')](saveUpdates(_0x218fba[_0xe8c3('0x52')],null))[_0xe8c3('0x18')](respondWithResult(_0x3efad2,null))[_0xe8c3('0x23')](handleError(_0x3efad2,null));};exports[_0xe8c3('0x2e')]=function(_0x245613,_0xbd0a98){return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x245613['params']['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0xbd0a98,null))[_0xe8c3('0x18')](removeEntity(_0xbd0a98,null))['catch'](handleError(_0xbd0a98,null));};exports[_0xe8c3('0x5a')]=function(_0x5f49ea,_0x585441){return db[_0xe8c3('0x46')][_0xe8c3('0x5a')]()['then'](respondWithResult(_0x585441,null))[_0xe8c3('0x23')](handleError(_0x585441,null));};exports[_0xe8c3('0x5b')]=function(_0x47912a,_0x1b411f,_0x665300){if(_0x47912a[_0xe8c3('0x52')]['id']){delete _0x47912a[_0xe8c3('0x52')]['id'];}return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0x47912a[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x1b411f,null))[_0xe8c3('0x18')](function(_0x54ff61){if(_0x54ff61){_0x47912a['body'][_0xe8c3('0x5c')]=_0x54ff61['id'];return db[_0xe8c3('0x5d')][_0xe8c3('0x51')](_0x47912a[_0xe8c3('0x52')]);}})['then'](respondWithResult(_0x1b411f,null))[_0xe8c3('0x23')](handleError(_0x1b411f,null));};exports['getDispositions']=function(_0x5dd9ce,_0x39288d,_0x2ac4b9){var _0x34e6ce={'raw':![],'where':{}};var _0x3856dc={};var _0x3f55a5={'count':0x0,'rows':[]};return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x5dd9ce[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x39288d,null))[_0xe8c3('0x18')](function(_0xd5b45e){if(_0xd5b45e){_0x3856dc[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db['Disposition'][_0xe8c3('0x36')]);_0x3856dc[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x5dd9ce[_0xe8c3('0x39')]);_0x3856dc[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x3856dc[_0xe8c3('0x38')],_0x3856dc[_0xe8c3('0x39')]);_0x34e6ce[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0x3856dc[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x34e6ce[_0xe8c3('0x3d')]=_0x34e6ce['attributes'][_0xe8c3('0x4e')]?_0x34e6ce[_0xe8c3('0x3d')]:_0x3856dc[_0xe8c3('0x38')];if(!_0x5dd9ce['query'][_0xe8c3('0x3e')]('nolimit')){_0x34e6ce['limit']=qs[_0xe8c3('0x29')](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x34e6ce[_0xe8c3('0x26')]=qs['offset'](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x26')]);}_0x34e6ce['order']=qs[_0xe8c3('0x40')](_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x34e6ce['where']=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x5dd9ce[_0xe8c3('0x39')],_0x3856dc[_0xe8c3('0x3b')]));_0x34e6ce['where'][_0xe8c3('0x5c')]=_0xd5b45e['id'];if(_0x5dd9ce['query'][_0xe8c3('0x43')]){_0x34e6ce[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x34e6ce['where'],{'$or':_[_0xe8c3('0x35')](_0x34e6ce[_0xe8c3('0x3d')],function(_0x5b4307){var _0x35d94d={};_0x35d94d[_0x5b4307]={'$like':'%'+_0x5dd9ce[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x35d94d;})});}_0x34e6ce=_[_0xe8c3('0x44')]({},_0x34e6ce,_0x5dd9ce[_0xe8c3('0x45')]);return db[_0xe8c3('0x5d')][_0xe8c3('0x28')]({'where':_0x34e6ce['where']})[_0xe8c3('0x18')](function(_0x30f61d){_0x3f55a5[_0xe8c3('0x28')]=_0x30f61d;if(_0x5dd9ce['query'][_0xe8c3('0x47')]){_0x34e6ce[_0xe8c3('0x4f')]=[{'all':!![]}];}return db[_0xe8c3('0x5d')][_0xe8c3('0x48')](_0x34e6ce);})['then'](function(_0x4ac737){_0x3f55a5['rows']=_0x4ac737;return _0x3f55a5;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0x39288d,_0x34e6ce))[_0xe8c3('0x23')](handleError(_0x39288d,null));};exports[_0xe8c3('0x5f')]=function(_0xc254cb,_0x5e916d,_0x1873c3){return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0xc254cb['params']['id']}})['then'](handleEntityNotFound(_0x5e916d,null))[_0xe8c3('0x18')](function(_0x43522a){if(_0x43522a){return _0x43522a[_0xe8c3('0x5f')](_0xc254cb[_0xe8c3('0x39')]['ids']);}})[_0xe8c3('0x18')](respondWithStatusCode(_0x5e916d,null))[_0xe8c3('0x23')](handleError(_0x5e916d,null));};exports[_0xe8c3('0x60')]=function(_0x363efc,_0x3228f1,_0xf4c085){if(_0x363efc[_0xe8c3('0x52')]['id']){delete _0x363efc['body']['id'];}return db[_0xe8c3('0x46')]['find']({'where':{'id':_0x363efc[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x3228f1,null))[_0xe8c3('0x18')](function(_0x290e78){if(_0x290e78){_0x363efc[_0xe8c3('0x52')][_0xe8c3('0x5c')]=_0x290e78['id'];return db['CannedAnswer'][_0xe8c3('0x51')](_0x363efc[_0xe8c3('0x52')]);}})['then'](respondWithResult(_0x3228f1,null))['catch'](handleError(_0x3228f1,null));};exports[_0xe8c3('0x61')]=function(_0x78c734,_0xa9c44c,_0x7a81a0){var _0x54456e={'raw':![],'where':{}};var _0x239917={};var _0x152853={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe8c3('0x5e')]({'where':{'id':_0x78c734['params']['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0xa9c44c,null))[_0xe8c3('0x18')](function(_0x234166){if(_0x234166){_0x239917[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db['CannedAnswer'][_0xe8c3('0x36')]);_0x239917[_0xe8c3('0x39')]=_['keys'](_0x78c734[_0xe8c3('0x39')]);_0x239917[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x239917['model'],_0x239917[_0xe8c3('0x39')]);_0x54456e[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0x239917['model'],qs[_0xe8c3('0x4d')](_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x54456e[_0xe8c3('0x3d')]=_0x54456e[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x54456e[_0xe8c3('0x3d')]:_0x239917[_0xe8c3('0x38')];if(!_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x54456e[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x78c734[_0xe8c3('0x39')]['limit']);_0x54456e[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x26')]);}_0x54456e[_0xe8c3('0x62')]=qs['sort'](_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x54456e[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x78c734['query'],_0x239917[_0xe8c3('0x3b')]));_0x54456e[_0xe8c3('0x41')][_0xe8c3('0x5c')]=_0x234166['id'];if(_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x54456e[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x54456e[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x54456e['attributes'],function(_0x783e30){var _0x1239ef={};_0x1239ef[_0x783e30]={'$like':'%'+_0x78c734[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x1239ef;})});}_0x54456e=_[_0xe8c3('0x44')]({},_0x54456e,_0x78c734[_0xe8c3('0x45')]);return db[_0xe8c3('0x63')][_0xe8c3('0x28')]({'where':_0x54456e[_0xe8c3('0x41')]})[_0xe8c3('0x18')](function(_0x194b8e){_0x152853[_0xe8c3('0x28')]=_0x194b8e;if(_0x78c734['query'][_0xe8c3('0x47')]){_0x54456e[_0xe8c3('0x4f')]=[{'all':!![]}];}return db[_0xe8c3('0x63')]['findAll'](_0x54456e);})[_0xe8c3('0x18')](function(_0x5d69d9){_0x152853[_0xe8c3('0x49')]=_0x5d69d9;return _0x152853;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0xa9c44c,_0x54456e))[_0xe8c3('0x23')](handleError(_0xa9c44c,null));};exports[_0xe8c3('0x64')]=function(_0x59e858,_0x44fb92,_0x12df65){return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x59e858[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x44fb92,null))[_0xe8c3('0x18')](function(_0xdaa842){if(_0xdaa842){return _0xdaa842['removeAnswers'](_0x59e858[_0xe8c3('0x39')][_0xe8c3('0x65')]);}})[_0xe8c3('0x18')](respondWithStatusCode(_0x44fb92,null))['catch'](handleError(_0x44fb92,null));};exports[_0xe8c3('0x66')]=function(_0x22574e,_0x352c79,_0x3606e8){return db['FaxInteraction']['find']({'where':{'id':_0x22574e[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x352c79,null))['then'](function(_0x7f20fe){if(_0x7f20fe){return _0x7f20fe[_0xe8c3('0x66')](_0x22574e[_0xe8c3('0x52')][_0xe8c3('0x65')],_[_0xe8c3('0x67')](_0x22574e[_0xe8c3('0x52')],['ids','id'])||{});}})['then'](respondWithResult(_0x352c79,null))[_0xe8c3('0x23')](handleError(_0x352c79,null));};exports[_0xe8c3('0x68')]=function(_0x2d778f,_0x3f2d7a,_0x344611){var _0x3bf6e5={'raw':![],'where':{}};var _0x1d13b5={};var _0x265b61={'count':0x0,'rows':[]};return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x2d778f[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x3f2d7a,null))['then'](function(_0x145a1d){if(_0x145a1d){_0x1d13b5[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db['FaxInteraction'][_0xe8c3('0x36')]);_0x1d13b5[_0xe8c3('0x39')]=_['keys'](_0x2d778f[_0xe8c3('0x39')]);_0x1d13b5[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x1d13b5['model'],_0x1d13b5[_0xe8c3('0x39')]);_0x3bf6e5[_0xe8c3('0x3d')]=_['intersection'](_0x1d13b5[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x2d778f[_0xe8c3('0x39')]['fields']));_0x3bf6e5[_0xe8c3('0x3d')]=_0x3bf6e5['attributes']['length']?_0x3bf6e5[_0xe8c3('0x3d')]:_0x1d13b5[_0xe8c3('0x38')];if(!_0x2d778f[_0xe8c3('0x39')]['hasOwnProperty'](_0xe8c3('0x3f'))){_0x3bf6e5[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x3bf6e5[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x26')]);}_0x3bf6e5[_0xe8c3('0x62')]=qs['sort'](_0x2d778f[_0xe8c3('0x39')]['sort']);_0x3bf6e5[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x2d778f[_0xe8c3('0x39')],_0x1d13b5['filters']));_0x3bf6e5[_0xe8c3('0x41')]['FaxAccountId']=_0x145a1d['id'];if(_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x3bf6e5[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x3bf6e5[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x3bf6e5[_0xe8c3('0x3d')],function(_0x95a5e0){var _0x539d65={};_0x539d65[_0x95a5e0]={'$like':'%'+_0x2d778f['query'][_0xe8c3('0x43')]+'%'};return _0x539d65;})});}_0x3bf6e5=_[_0xe8c3('0x44')]({},_0x3bf6e5,_0x2d778f[_0xe8c3('0x45')]);return db[_0xe8c3('0x69')]['count']({'where':_0x3bf6e5[_0xe8c3('0x41')]})['then'](function(_0x210b12){_0x265b61[_0xe8c3('0x28')]=_0x210b12;if(_0x2d778f['query'][_0xe8c3('0x47')]){_0x3bf6e5[_0xe8c3('0x4f')]=[{'model':db[_0xe8c3('0x6a')],'as':_0xe8c3('0x6b'),'required':![]},{'model':db['User'],'as':_0xe8c3('0x6c'),'attributes':['name',_0xe8c3('0x6d'),_0xe8c3('0x6e')],'required':![]},{'model':db[_0xe8c3('0x6f')],'as':_0xe8c3('0x70'),'attributes':['id',_0xe8c3('0x32'),_0xe8c3('0x71')],'where':_0x2d778f[_0xe8c3('0x39')][_0xe8c3('0x72')]?{'id':_0x2d778f['query'][_0xe8c3('0x72')]}:undefined,'required':_0x2d778f[_0xe8c3('0x39')]['tag']?!![]:![]}];}return db[_0xe8c3('0x69')][_0xe8c3('0x48')](_0x3bf6e5);})[_0xe8c3('0x18')](function(_0x25031e){_0x265b61['rows']=_0x25031e;return _0x265b61;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0x3f2d7a,_0x3bf6e5))[_0xe8c3('0x23')](handleError(_0x3f2d7a,null));};exports[_0xe8c3('0x73')]=function(_0x58fe39,_0x228312){var _0x1024ec=_0x58fe39[_0xe8c3('0x4b')]['id'];var _0x1faeac=_0x58fe39[_0xe8c3('0x52')];var _0x3af574=0xc8;var _0x5b9589=null;return db[_0xe8c3('0x74')][_0xe8c3('0x75')]({'isolationLevel':db[_0xe8c3('0x74')][_0xe8c3('0x76')][_0xe8c3('0x77')][_0xe8c3('0x78')]},function(_0x2a381a){return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x1024ec},'transaction':_0x2a381a})['then'](function(_0x53e0cc){if(_0x53e0cc){return db['FaxApplication'][_0xe8c3('0x2e')]({'where':{'FaxAccountId':_0x1024ec},'transaction':_0x2a381a})[_0xe8c3('0x18')](function(){var _0x588f2f=_[_0xe8c3('0x35')](_0x1faeac,function(_0x10af0f){_0x10af0f[_0xe8c3('0x5c')]=_0x1024ec;return _0x10af0f;});return db[_0xe8c3('0x79')]['bulkCreate'](_0x588f2f,{'transaction':_0x2a381a});});}else{_0x3af574=0x194;_0x5b9589=[];}});})[_0xe8c3('0x18')](function(){if(_0x3af574!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x1024ec},'order':_0xe8c3('0x7a')})[_0xe8c3('0x18')](function(_0xa605ac){_0x5b9589=_0xa605ac;});}})[_0xe8c3('0x23')](function(_0x370112){_0x3af574=0x1f4;logger[_0xe8c3('0x1e')](_0x370112[_0xe8c3('0x31')]);if(_0x370112['name']){delete _0x370112[_0xe8c3('0x32')];}_0x5b9589=_0x370112;})[_0xe8c3('0x7b')](function(){if(_0x5b9589===null){_0x228312[_0xe8c3('0x7c')](_0x3af574);}else{if(_0x3af574===0x1f4){_0x228312[_0xe8c3('0x24')](_0x3af574)[_0xe8c3('0x7d')](_0x5b9589);}else{_0x228312['status'](_0x3af574)[_0xe8c3('0x25')](_0x5b9589);}}});};exports['getApplications']=function(_0x35a4f1,_0x7a0006,_0x47704f){var _0x177461={};var _0x36b3cc={};var _0x35bcb8;var _0x85fb69;return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x35a4f1['params']['id']}})['then'](handleEntityNotFound(_0x7a0006,null))[_0xe8c3('0x18')](function(_0x4ccaab){if(_0x4ccaab){_0x35bcb8=_0x4ccaab;_0x36b3cc['model']=_[_0xe8c3('0x3a')](db[_0xe8c3('0x79')][_0xe8c3('0x36')]);_0x36b3cc['query']=_['keys'](_0x35a4f1[_0xe8c3('0x39')]);_0x36b3cc[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0x36b3cc[_0xe8c3('0x38')],_0x36b3cc[_0xe8c3('0x39')]);_0x177461[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0x36b3cc[_0xe8c3('0x38')],qs['fields'](_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x177461['attributes']=_0x177461[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x177461['attributes']:_0x36b3cc[_0xe8c3('0x38')];_0x177461[_0xe8c3('0x62')]=qs[_0xe8c3('0x40')](_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x40')]);_0x177461[_0xe8c3('0x41')]=qs['filters'](_[_0xe8c3('0x42')](_0x35a4f1[_0xe8c3('0x39')],_0x36b3cc[_0xe8c3('0x3b')]));if(_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x177461[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x177461[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x177461[_0xe8c3('0x3d')],function(_0x183444){var _0x4a20c5={};_0x4a20c5[_0x183444]={'$like':'%'+_0x35a4f1['query'][_0xe8c3('0x43')]+'%'};return _0x4a20c5;})});}_0x177461=_['merge']({},_0x177461,_0x35a4f1[_0xe8c3('0x45')]);return _0x35bcb8[_0xe8c3('0x7e')](_0x177461);}})['then'](function(_0x29305d){if(_0x29305d){_0x85fb69=_0x29305d[_0xe8c3('0x4e')];if(!_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x177461[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x35a4f1[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x177461[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x35a4f1['query']['offset']);}return _0x35bcb8[_0xe8c3('0x7e')](_0x177461);}})[_0xe8c3('0x18')](function(_0x268efb){if(_0x268efb){return _0x268efb?{'count':_0x85fb69,'rows':_0x268efb}:null;}})[_0xe8c3('0x18')](respondWithResult(_0x7a0006,null))[_0xe8c3('0x23')](handleError(_0x7a0006,null));};function Extension(_0x539ee4,_0x545c14,_0x7cbd03,_0x2cde7a){this['context']=_0xe8c3('0x7f');this[_0xe8c3('0x80')]=_0x539ee4['localstationid'];this[_0xe8c3('0x81')]=_0x2cde7a;this[_0xe8c3('0x37')]=_0xe8c3('0x82');this[_0xe8c3('0x83')]=_0xe8c3('0x84');this[_0xe8c3('0x5c')]=_0x539ee4['id'];this['priority']=_0x545c14;this[_0xe8c3('0x85')]=_0x7cbd03;}function createExtensionsReciveFax(_0x3cf521){var _0x5e3ecf=0x1;var _0x570e57=[];_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,'',_0xe8c3('0x87')));_0x5e3ecf+=0x1;_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,'CDR(type)=inbound-fax',_0xe8c3('0x88')));_0x5e3ecf+=0x1;for(var _0x5f556a in _0x3cf521){if(_0x3cf521[_0xe8c3('0x3e')](_0x5f556a)&&(_0x5f556a===_0xe8c3('0x89')||_0x5f556a===_0xe8c3('0x8a')||_0x5f556a===_0xe8c3('0x8b')||_0x5f556a===_0xe8c3('0x8c')||_0x5f556a==='headerinfo'||_0x5f556a===_0xe8c3('0x8d')||_0x5f556a==='minrate'||_0x5f556a===_0xe8c3('0x8e')||_0x5f556a===_0xe8c3('0x8f'))){_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,_0xe8c3('0x90')+_0x5f556a+')='+_0x3cf521[_0x5f556a],_0xe8c3('0x88')));_0x5e3ecf+=0x1;}}_0x570e57['push'](new Extension(_0x3cf521,_0x5e3ecf,'6','Wait'));_0x5e3ecf+=0x1;_0x570e57[_0xe8c3('0x86')](new Extension(_0x3cf521,_0x5e3ecf,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0xe8c3('0x91')));_0x5e3ecf=0x0;return _0x570e57;}exports[_0xe8c3('0x92')]=function(_0x3d3d03,_0x1eb316,_0x1ff440){var _0x12fd6f;return db[_0xe8c3('0x74')][_0xe8c3('0x75')](function(_0x3ac958){return db[_0xe8c3('0x46')][_0xe8c3('0x51')](_0x3d3d03[_0xe8c3('0x52')],{'transaction':_0x3ac958})[_0xe8c3('0x18')](function(_0x2a85fa){_0x12fd6f=_0x2a85fa[_0xe8c3('0x54')]({'plain':!![]});return db[_0xe8c3('0x93')][_0xe8c3('0x94')](createExtensionsReciveFax(_0x12fd6f),{'transaction':_0x3ac958});});})['then'](function(){return _0x12fd6f;})[_0xe8c3('0x18')](respondWithResult(_0x1eb316,null))[_0xe8c3('0x23')](handleError(_0x1eb316,null));};exports['updateAccountApplications']=function(_0x50fe9d,_0x3059c6,_0x16e908){var _0x2b389c;return db['sequelize']['transaction'](function(_0x2f0f96){return db[_0xe8c3('0x46')][_0xe8c3('0x2d')](_0x50fe9d['body'],{'where':{'id':_0x50fe9d[_0xe8c3('0x52')]['id']},'transaction':_0x2f0f96})[_0xe8c3('0x18')](function(_0x15608b){return db[_0xe8c3('0x93')][_0xe8c3('0x2e')]({'where':{'FaxAccountId':_0x50fe9d[_0xe8c3('0x52')]['id']},'transaction':_0x2f0f96})[_0xe8c3('0x18')](function(_0x3e7d60){return db[_0xe8c3('0x93')]['bulkCreate'](createExtensionsReciveFax(_[_0xe8c3('0x67')](_0x50fe9d[_0xe8c3('0x52')],[_0xe8c3('0x95'),'key',_0xe8c3('0x96'),_0xe8c3('0x97'),'TrunkId',_0xe8c3('0x98')])),{'transaction':_0x2f0f96});});});})[_0xe8c3('0x18')](function(){return db[_0xe8c3('0x46')][_0xe8c3('0x99')](_0x50fe9d[_0xe8c3('0x52')]['id']);})[_0xe8c3('0x18')](respondWithResult(_0x3059c6,null))[_0xe8c3('0x23')](handleError(_0x3059c6,null));};exports[_0xe8c3('0x9a')]=function(_0x3d3c29,_0x4aab68,_0x380b9f){var _0x3ac0ef={'raw':!![],'where':{}};var _0xd02be9={};var _0x3c6e09={'count':0x0,'rows':[]};return db[_0xe8c3('0x46')]['findOne']({'where':{'id':_0x3d3c29[_0xe8c3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4aab68,null))[_0xe8c3('0x18')](function(_0x25c862){if(_0x25c862){_0xd02be9[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db[_0xe8c3('0x9b')][_0xe8c3('0x36')]);_0xd02be9[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x3d3c29[_0xe8c3('0x39')]);_0xd02be9[_0xe8c3('0x3b')]=_[_0xe8c3('0x3c')](_0xd02be9[_0xe8c3('0x38')],_0xd02be9[_0xe8c3('0x39')]);_0x3ac0ef[_0xe8c3('0x3d')]=_[_0xe8c3('0x3c')](_0xd02be9[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x3ac0ef['attributes']=_0x3ac0ef[_0xe8c3('0x3d')][_0xe8c3('0x4e')]?_0x3ac0ef['attributes']:_0xd02be9['model'];if(!_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x3e')](_0xe8c3('0x3f'))){_0x3ac0ef[_0xe8c3('0x29')]=qs[_0xe8c3('0x29')](_0x3d3c29['query']['limit']);_0x3ac0ef['offset']=qs[_0xe8c3('0x26')](_0x3d3c29[_0xe8c3('0x39')]['offset']);}_0x3ac0ef[_0xe8c3('0x62')]=qs[_0xe8c3('0x40')](_0x3d3c29[_0xe8c3('0x39')]['sort']);_0x3ac0ef['where']=qs['filters'](_[_0xe8c3('0x42')](_0x3d3c29[_0xe8c3('0x39')],_0xd02be9[_0xe8c3('0x3b')]));_0x3ac0ef[_0xe8c3('0x41')]['FaxAccountId']=_0x25c862['id'];if(_0x3d3c29['query'][_0xe8c3('0x43')]){_0x3ac0ef[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x3ac0ef['where'],{'$or':_['map'](_0x3ac0ef[_0xe8c3('0x3d')],function(_0x22782f){var _0x3b666e={};_0x3b666e[_0x22782f]={'$like':'%'+_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x43')]+'%'};return _0x3b666e;})});}if(_0x3d3c29[_0xe8c3('0x39')]['$gte']){var _0x5094ba=_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x9c')]['split'](',');var _0x43d2d5={};_0x43d2d5[_0x5094ba[0x0]]={'$gte':moment(_0x5094ba[0x1])[_0xe8c3('0x9d')](_0xe8c3('0x9e'))};_0x3ac0ef[_0xe8c3('0x41')]=_[_0xe8c3('0x44')](_0x3ac0ef['where'],_0x43d2d5);}_0x3ac0ef=_[_0xe8c3('0x44')]({},_0x3ac0ef,_0x3d3c29[_0xe8c3('0x45')]);return db['FaxMessage'][_0xe8c3('0x28')]({'where':_0x3ac0ef[_0xe8c3('0x41')]})[_0xe8c3('0x18')](function(_0x521b5a){_0x3c6e09[_0xe8c3('0x28')]=_0x521b5a;if(_0x3d3c29[_0xe8c3('0x39')][_0xe8c3('0x47')]){_0x3ac0ef[_0xe8c3('0x4f')]=[{'all':!![]}];}return db[_0xe8c3('0x9b')]['findAll'](_0x3ac0ef);})['then'](function(_0xe3e3da){_0x3c6e09[_0xe8c3('0x49')]=_0xe3e3da;return _0x3c6e09;});}})[_0xe8c3('0x18')](respondWithFilteredResult(_0x4aab68,_0x3ac0ef))[_0xe8c3('0x23')](handleError(_0x4aab68,null));};exports[_0xe8c3('0x7d')]=function(_0x4923d2,_0x4588e7,_0x39f688){var _0x151b1e,_0x392be0={},_0xf957c3;if(_0x4923d2[_0xe8c3('0x52')]['to']){_0xf957c3=_0x4923d2[_0xe8c3('0x52')]['to'][0x0];}return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0x4923d2[_0xe8c3('0x4b')]['id']},'include':[{'model':db[_0xe8c3('0x9f')],'as':'List','include':[{'model':db[_0xe8c3('0x6a')],'as':_0xe8c3('0xa0'),'where':{'fax':_0xf957c3},'limit':0x1,'order':[['updatedAt',_0xe8c3('0xa1')]]}]}]})[_0xe8c3('0x18')](handleEntityNotFound(_0x4588e7,null))[_0xe8c3('0x18')](function(_0x4c5b59){_0x151b1e=_0x4c5b59;if(_0x4923d2['body']['attachments']&&_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][_0xe8c3('0x4e')]){for(var _0xf8cb4f=0x0;_0xf8cb4f<_0x4923d2['body']['attachments'][_0xe8c3('0x4e')];_0xf8cb4f+=0x1){_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][_0xf8cb4f]={'filename':_0x4923d2['body']['attachments'][_0xf8cb4f][_0xe8c3('0x32')],'id':_0x4923d2['body'][_0xe8c3('0xa2')][_0xf8cb4f]['id'],'path':path[_0xe8c3('0xa3')](config[_0xe8c3('0xa4')],_0xe8c3('0xa5'),_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][_0xf8cb4f][_0xe8c3('0xa6')])};}}return respondWithRpcPromise(_0xe8c3('0xa7'),_0xe8c3('0xa7'),{'FaxAccountId':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x4b')]['id'])?undefined:_0x4923d2[_0xe8c3('0x4b')]['id'],'path':_[_0xe8c3('0xa8')](_0x4923d2['body']['attachments'][0x0][_0xe8c3('0xa9')])?undefined:_0x4923d2['body'][_0xe8c3('0xa2')][0x0][_0xe8c3('0xa9')],'fax':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')]['to'][0x0])?undefined:_0x4923d2[_0xe8c3('0x52')]['to'][0x0]},client9002);})[_0xe8c3('0x18')](function(){if(_0x151b1e){if(_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xaa')])){_0x4923d2['body'][_0xe8c3('0xaa')]=util[_0xe8c3('0x9d')](_0xe8c3('0xab'),_0x151b1e[_0xe8c3('0x32')],_0x151b1e[_0xe8c3('0xac')]);}if(_0x151b1e['List']){if(_0x151b1e[_0xe8c3('0xad')][_0xe8c3('0xa0')][_0xe8c3('0x4e')]){return _0x151b1e[_0xe8c3('0xad')]['Contacts'][0x0];}else{return db[_0xe8c3('0x6a')][_0xe8c3('0x51')](_[_0xe8c3('0x12')](_0x4923d2[_0xe8c3('0x52')],{'firstName':_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'phone':_0x4923d2['body']['to'][0x0],'fax':_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'ListId':_0x151b1e['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x521d6c){if(_0x521d6c){return db[_0xe8c3('0x69')][_0xe8c3('0x50')]({'where':{'ContactId':_0x521d6c['id'],'closed':![],'FaxAccountId':_0x151b1e['id']}})['then'](function(_0x74c48d){if(_0x74c48d){return[_0x74c48d,![]];}return db[_0xe8c3('0x69')]['create']({'UserId':_0x4923d2[_0xe8c3('0x53')]['id'],'ContactId':_0x521d6c['id'],'FaxAccountId':_0x151b1e['id'],'fax':_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'firstMsgDirection':_0xe8c3('0xae'),'Messages':[_['merge'](_0x4923d2[_0xe8c3('0x52')],{'read':![],'body':_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][0x0][_0xe8c3('0xaf')],'FaxAccountId':_0x151b1e['id'],'UserId':_0x4923d2[_0xe8c3('0x53')]['id'],'ContactId':_0x521d6c['id'],'AttachmentId':_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][0x0]['id']})]},{'include':[{'model':db[_0xe8c3('0x9b')],'as':_0xe8c3('0xb0')}]})['then'](function(_0x3c884c){return[_0x3c884c,!![]];});});}else{throw new Error(_0xe8c3('0xb1'));}})[_0xe8c3('0xb2')](function(_0x1c0afe,_0x1dbfd6){if(_0x1dbfd6){return _0x1c0afe;}return db[_0xe8c3('0x9b')][_0xe8c3('0x51')]({'direction':_0xe8c3('0xae'),'read':![],'body':_0x4923d2[_0xe8c3('0x52')][_0xe8c3('0xa2')][0x0][_0xe8c3('0xaf')],'FaxAccountId':_0x151b1e['id'],'FaxInteractionId':_0x1c0afe['id'],'UserId':_0x4923d2[_0xe8c3('0x53')]['id'],'ContactId':_0x1c0afe[_0xe8c3('0xb3')],'AttachmentId':_0x4923d2['body'][_0xe8c3('0xa2')][0x0]['id']})[_0xe8c3('0x18')](function(_0x8f1fd1){_0x1c0afe[_0xe8c3('0xb4')][_0xe8c3('0xb0')]=[];_0x1c0afe[_0xe8c3('0xb4')][_0xe8c3('0xb0')][_0xe8c3('0x86')](_0x8f1fd1[_0xe8c3('0xb4')]);return _0x1c0afe;});})['then'](function(_0x3ed270){respondWithRpcPromise(_0xe8c3('0xb5'),_0xe8c3('0xb5'),{'FaxAccountId':_[_0xe8c3('0xa8')](_0x4923d2['params']['id'])?undefined:_0x4923d2['params']['id'],'path':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')]['attachments'][0x0][_0xe8c3('0xa9')])?undefined:_0x4923d2[_0xe8c3('0x52')]['attachments'][0x0][_0xe8c3('0xa9')],'fax':_[_0xe8c3('0xa8')](_0x4923d2[_0xe8c3('0x52')]['to'][0x0])?undefined:_0x4923d2[_0xe8c3('0x52')]['to'][0x0],'AttachmentId':_0x4923d2['body'][_0xe8c3('0xa2')][0x0]['id']},client9002)['then'](function(_0x26735a){logger[_0xe8c3('0x19')](_0xe8c3('0xb6'),_0x26735a);})['catch'](function(_0x3d5c93){logger[_0xe8c3('0x19')](_0xe8c3('0xb6'),_0x3d5c93);});return _0x3ed270;})['then'](respondWithResult(_0x4588e7,null))[_0xe8c3('0x23')](handleError(_0x4588e7,null));};exports['addAgents']=function(_0x1cb157,_0x3ff8d2,_0x251a17){return db[_0xe8c3('0x46')][_0xe8c3('0x50')]({'where':{'id':_0x1cb157['params']['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x3ff8d2,null))[_0xe8c3('0x18')](function(_0x58a4d0){if(_0x58a4d0){return _0x58a4d0[_0xe8c3('0xb7')](_0x1cb157[_0xe8c3('0x52')][_0xe8c3('0x65')],_[_0xe8c3('0x67')](_0x1cb157[_0xe8c3('0x52')],[_0xe8c3('0x65'),'id'])||{})[_0xe8c3('0xb2')](function(_0x2ac668){for(var _0x7d4d5a=0x0;_0x7d4d5a<_0x1cb157[_0xe8c3('0x52')][_0xe8c3('0x65')][_0xe8c3('0x4e')];_0x7d4d5a+=0x1){socket[_0xe8c3('0xb8')](_0xe8c3('0xb9'),{'UserId':Number(_0x1cb157[_0xe8c3('0x52')][_0xe8c3('0x65')][_0x7d4d5a]),'FaxAccountId':Number(_0x1cb157[_0xe8c3('0x4b')]['id'])});}return _0x2ac668;});}})[_0xe8c3('0x18')](respondWithResult(_0x3ff8d2,null))[_0xe8c3('0x23')](handleError(_0x3ff8d2,null));};exports[_0xe8c3('0xba')]=function(_0x4b36bc,_0x31b5d8,_0x508d5){return db['FaxAccount'][_0xe8c3('0x50')]({'where':{'id':_0x4b36bc['params']['id']}})['then'](handleEntityNotFound(_0x31b5d8,null))['then'](function(_0x35f613){if(_0x35f613){return _0x35f613[_0xe8c3('0xba')](_0x4b36bc[_0xe8c3('0x39')][_0xe8c3('0x65')])[_0xe8c3('0x18')](function(){if(_['isArray'](_0x4b36bc['query']['ids'])){for(var _0x66e399=0x0;_0x66e399<_0x4b36bc[_0xe8c3('0x39')][_0xe8c3('0x65')][_0xe8c3('0x4e')];_0x66e399+=0x1){socket[_0xe8c3('0xb8')](_0xe8c3('0xbb'),{'UserId':Number(_0x4b36bc[_0xe8c3('0x39')]['ids'][_0x66e399]),'FaxAccountId':Number(_0x4b36bc['params']['id'])});}}else{socket[_0xe8c3('0xb8')](_0xe8c3('0xbb'),{'UserId':Number(_0x4b36bc['query']['ids']),'FaxAccountId':Number(_0x4b36bc['params']['id'])});}});}})[_0xe8c3('0x18')](respondWithStatusCode(_0x31b5d8,null))[_0xe8c3('0x23')](handleError(_0x31b5d8,null));};exports[_0xe8c3('0xbc')]=function(_0x24e229,_0x34eb68,_0x151006){var _0x46eb1f={};var _0x161eb2={};var _0x35fedb;var _0x916de2;return db[_0xe8c3('0x46')][_0xe8c3('0x5e')]({'where':{'id':_0x24e229[_0xe8c3('0x4b')]['id']}})[_0xe8c3('0x18')](handleEntityNotFound(_0x34eb68,null))['then'](function(_0xcbcdf8){if(_0xcbcdf8){_0x35fedb=_0xcbcdf8;_0x161eb2[_0xe8c3('0x38')]=_[_0xe8c3('0x3a')](db[_0xe8c3('0xbd')]['rawAttributes']);_0x161eb2[_0xe8c3('0x39')]=_[_0xe8c3('0x3a')](_0x24e229[_0xe8c3('0x39')]);_0x161eb2[_0xe8c3('0x3b')]=_['intersection'](_0x161eb2['model'],_0x161eb2[_0xe8c3('0x39')]);_0x46eb1f['attributes']=_[_0xe8c3('0x3c')](_0x161eb2[_0xe8c3('0x38')],qs[_0xe8c3('0x4d')](_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x4d')]));_0x46eb1f[_0xe8c3('0x3d')]=_0x46eb1f[_0xe8c3('0x3d')]['length']?_0x46eb1f[_0xe8c3('0x3d')]:_0x161eb2[_0xe8c3('0x38')];_0x46eb1f['order']=qs[_0xe8c3('0x40')](_0x24e229[_0xe8c3('0x39')]['sort']);_0x46eb1f[_0xe8c3('0x41')]=qs[_0xe8c3('0x3b')](_[_0xe8c3('0x42')](_0x24e229[_0xe8c3('0x39')],_0x161eb2[_0xe8c3('0x3b')]));if(_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x43')]){_0x46eb1f['where']=_[_0xe8c3('0x44')](_0x46eb1f[_0xe8c3('0x41')],{'$or':_[_0xe8c3('0x35')](_0x46eb1f[_0xe8c3('0x3d')],function(_0x1dc5d3){var _0x5778ca={};_0x5778ca[_0x1dc5d3]={'$like':'%'+_0x24e229[_0xe8c3('0x39')]['filter']+'%'};return _0x5778ca;})});}_0x46eb1f=_[_0xe8c3('0x44')]({},_0x46eb1f,_0x24e229[_0xe8c3('0x45')]);return _0x35fedb[_0xe8c3('0xbc')](_0x46eb1f);}})[_0xe8c3('0x18')](function(_0x19b71e){if(_0x19b71e){_0x916de2=_0x19b71e[_0xe8c3('0x4e')];if(!_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x3e')]('nolimit')){_0x46eb1f['limit']=qs[_0xe8c3('0x29')](_0x24e229[_0xe8c3('0x39')][_0xe8c3('0x29')]);_0x46eb1f[_0xe8c3('0x26')]=qs[_0xe8c3('0x26')](_0x24e229['query']['offset']);}return _0x35fedb['getAgents'](_0x46eb1f);}})[_0xe8c3('0x18')](function(_0x308490){if(_0x308490){return _0x308490?{'count':_0x916de2,'rows':_0x308490}:null;}})[_0xe8c3('0x18')](respondWithResult(_0x34eb68,null))[_0xe8c3('0x23')](handleError(_0x34eb68,null));};
\ No newline at end of file
+var _0x9b11=['updateAccountApplications','tech','key','createdAt','updatedAt','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','FaxAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','Disposition','FaxAccountId','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','system','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','modem','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x9b11,0x1af));var _0x19b1=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x9b11[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19b1('0x0'));var zipdir=require(_0x19b1('0x1'));var jsonpatch=require(_0x19b1('0x2'));var rp=require(_0x19b1('0x3'));var moment=require('moment');var BPromise=require(_0x19b1('0x4'));var Mustache=require(_0x19b1('0x5'));var util=require('util');var path=require(_0x19b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x19b1('0x7'));var fs=require('fs');var fs_extra=require(_0x19b1('0x8'));var _=require(_0x19b1('0x9'));var squel=require('squel');var crypto=require(_0x19b1('0xa'));var jsforce=require(_0x19b1('0xb'));var deskjs=require(_0x19b1('0xc'));var toCsv=require(_0x19b1('0xd'));var querystring=require(_0x19b1('0xe'));var Papa=require(_0x19b1('0xf'));var Redis=require(_0x19b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x19b1('0x11'));var as=require(_0x19b1('0x12'));var hardwareService=require(_0x19b1('0x13'));var logger=require('../../config/logger')(_0x19b1('0x14'));var utils=require('../../config/utils');var config=require(_0x19b1('0x15'));var licenseUtil=require(_0x19b1('0x16'));var db=require(_0x19b1('0x17'))['db'];config[_0x19b1('0x18')]=_['defaults'](config[_0x19b1('0x18')],{'host':_0x19b1('0x19'),'port':0x18eb});var socket=require(_0x19b1('0x1a'))(new Redis(config[_0x19b1('0x18')]));require(_0x19b1('0x1b'))[_0x19b1('0x1c')](socket);var jayson=require(_0x19b1('0x1d'));var client=jayson[_0x19b1('0x1e')][_0x19b1('0x1f')]({'port':0x232c});var client9002=jayson[_0x19b1('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e0c1f,_0x3438a2,_0xe45c43,_0x164209){return new BPromise(function(_0xdc1a16,_0x51ed4f){var _0x222642=_0x164209||client;return _0x222642[_0x19b1('0x20')](_0x3e0c1f,_0xe45c43)['then'](function(_0x20b46b){logger['info'](_0x19b1('0x21'),_0x3438a2,'request\x20sent');logger['debug'](_0x19b1('0x22'),_0x3438a2,_0x19b1('0x23'),JSON[_0x19b1('0x24')](_0x20b46b));if(_0x20b46b[_0x19b1('0x25')]){if(_0x20b46b[_0x19b1('0x25')][_0x19b1('0x26')]===0x1f4){logger['error'](_0x19b1('0x21'),_0x3438a2,_0x20b46b[_0x19b1('0x25')][_0x19b1('0x27')]);return _0x51ed4f(_0x20b46b['error'][_0x19b1('0x27')]);}logger[_0x19b1('0x25')](_0x19b1('0x21'),_0x3438a2,_0x20b46b[_0x19b1('0x25')][_0x19b1('0x27')]);return _0xdc1a16(_0x20b46b[_0x19b1('0x25')]['message']);}else{logger[_0x19b1('0x28')](_0x19b1('0x21'),_0x3438a2,'request\x20sent');_0xdc1a16(_0x20b46b[_0x19b1('0x29')][_0x19b1('0x27')]);}})[_0x19b1('0x2a')](function(_0x1ce60f){logger[_0x19b1('0x25')]('FaxAccount,\x20%s,\x20%s',_0x3438a2,_0x1ce60f);_0x51ed4f(_0x1ce60f);});});}function respondWithStatusCode(_0x48c85e,_0x5e9e11){_0x5e9e11=_0x5e9e11||0xcc;return function(_0x35ddb5){if(_0x35ddb5){return _0x48c85e[_0x19b1('0x2b')](_0x5e9e11);}return _0x48c85e[_0x19b1('0x2c')](_0x5e9e11)[_0x19b1('0x2d')]();};}function respondWithResult(_0x59b004,_0x2ea263){_0x2ea263=_0x2ea263||0xc8;return function(_0x1962bc){if(_0x1962bc){return _0x59b004[_0x19b1('0x2c')](_0x2ea263)[_0x19b1('0x2e')](_0x1962bc);}};}function respondWithFilteredResult(_0x7d4a65,_0x48b2a2){return function(_0x3f4772){if(_0x3f4772){var _0x203199=typeof _0x48b2a2[_0x19b1('0x2f')]==='undefined'&&typeof _0x48b2a2[_0x19b1('0x30')]===_0x19b1('0x31');var _0x461e52=_0x3f4772[_0x19b1('0x32')];var _0x36d590=_0x203199?0x0:_0x48b2a2[_0x19b1('0x2f')];var _0x57743c=_0x203199?_0x3f4772[_0x19b1('0x32')]:_0x48b2a2['offset']+_0x48b2a2['limit'];var _0x4b11fe;if(_0x57743c>=_0x461e52){_0x57743c=_0x461e52;_0x4b11fe=0xc8;}else{_0x4b11fe=0xce;}_0x7d4a65['status'](_0x4b11fe);return _0x7d4a65[_0x19b1('0x33')](_0x19b1('0x34'),_0x36d590+'-'+_0x57743c+'/'+_0x461e52)[_0x19b1('0x2e')](_0x3f4772);}return null;};}function patchUpdates(_0x2ba9a6){return function(_0x5241af){try{jsonpatch['apply'](_0x5241af,_0x2ba9a6,!![]);}catch(_0x13178f){return BPromise[_0x19b1('0x35')](_0x13178f);}return _0x5241af[_0x19b1('0x36')]();};}function saveUpdates(_0x1c01b9,_0x1aa9c8){return function(_0x458653){if(_0x458653){return _0x458653[_0x19b1('0x37')](_0x1c01b9)[_0x19b1('0x38')](function(_0x4cdcb5){return _0x4cdcb5;});}return null;};}function removeEntity(_0x2c41d9,_0x3567b7){return function(_0x150963){if(_0x150963){return _0x150963[_0x19b1('0x39')]()['then'](function(){var _0x94d860=_0x150963[_0x19b1('0x3a')]({'plain':!![]});var _0x4843d2=_0x19b1('0x3b');return db['UserProfileResource'][_0x19b1('0x39')]({'where':{'type':_0x4843d2,'resourceId':_0x94d860['id']}})[_0x19b1('0x38')](function(){return _0x150963;});})[_0x19b1('0x38')](function(){_0x2c41d9[_0x19b1('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ad64,_0x2da764){return function(_0x361b25){if(!_0x361b25){_0x28ad64[_0x19b1('0x2b')](0x194);}return _0x361b25;};}function handleError(_0x3c58b2,_0x1135e3){_0x1135e3=_0x1135e3||0x1f4;return function(_0x3a461c){logger['error'](_0x3a461c[_0x19b1('0x3c')]);if(_0x3a461c[_0x19b1('0x3d')]){delete _0x3a461c[_0x19b1('0x3d')];}_0x3c58b2[_0x19b1('0x2c')](_0x1135e3)[_0x19b1('0x3e')](_0x3a461c);};}exports[_0x19b1('0x3f')]=function(_0x1672cd,_0x4a1492){var _0x3980f0={'include':[{'model':db[_0x19b1('0x40')],'as':_0x19b1('0x41')}]},_0x8c5c33={},_0x1d851b={'count':0x0,'rows':[]};var _0x519381=_['map'](db[_0x19b1('0x42')][_0x19b1('0x43')],function(_0x2fdd7a){return{'name':_0x2fdd7a[_0x19b1('0x44')],'type':_0x2fdd7a['type']['key']};});_0x8c5c33['model']=_['map'](_0x519381,'name');_0x8c5c33[_0x19b1('0x45')]=_['keys'](_0x1672cd[_0x19b1('0x45')]);_0x8c5c33[_0x19b1('0x46')]=_[_0x19b1('0x47')](_0x8c5c33[_0x19b1('0x48')],_0x8c5c33[_0x19b1('0x45')]);_0x3980f0[_0x19b1('0x49')]=_['intersection'](_0x8c5c33[_0x19b1('0x48')],qs['fields'](_0x1672cd[_0x19b1('0x45')][_0x19b1('0x4a')]));_0x3980f0[_0x19b1('0x49')]=_0x3980f0[_0x19b1('0x49')][_0x19b1('0x4b')]?_0x3980f0['attributes']:_0x8c5c33['model'];if(!_0x1672cd[_0x19b1('0x45')][_0x19b1('0x4c')](_0x19b1('0x4d'))){_0x3980f0[_0x19b1('0x30')]=qs[_0x19b1('0x30')](_0x1672cd[_0x19b1('0x45')][_0x19b1('0x30')]);_0x3980f0[_0x19b1('0x2f')]=qs[_0x19b1('0x2f')](_0x1672cd['query'][_0x19b1('0x2f')]);}_0x3980f0[_0x19b1('0x4e')]=qs[_0x19b1('0x4f')](_0x1672cd[_0x19b1('0x45')]['sort']);_0x3980f0[_0x19b1('0x50')]=qs[_0x19b1('0x46')](_[_0x19b1('0x51')](_0x1672cd[_0x19b1('0x45')],_0x8c5c33[_0x19b1('0x46')]),_0x519381);if(_0x1672cd[_0x19b1('0x45')][_0x19b1('0x52')]){_0x3980f0[_0x19b1('0x50')]=_[_0x19b1('0x53')](_0x3980f0[_0x19b1('0x50')],{'$or':_[_0x19b1('0x54')](_0x519381,function(_0x4c31e4){if(_0x4c31e4[_0x19b1('0x55')]!=='VIRTUAL'){var _0x356440={};_0x356440[_0x4c31e4[_0x19b1('0x3d')]]={'$like':'%'+_0x1672cd[_0x19b1('0x45')][_0x19b1('0x52')]+'%'};return _0x356440;}})});}_0x3980f0=_['merge']({},_0x3980f0,_0x1672cd[_0x19b1('0x56')]);var _0x3e24df={'where':_0x3980f0['where']};return db[_0x19b1('0x42')][_0x19b1('0x32')](_0x3e24df)['then'](function(_0x4ef3e8){_0x1d851b['count']=_0x4ef3e8;if(_0x1672cd['query'][_0x19b1('0x57')]){_0x3980f0[_0x19b1('0x58')]=[{'all':!![]}];}return db[_0x19b1('0x42')][_0x19b1('0x59')](_0x3980f0);})[_0x19b1('0x38')](function(_0x1f613c){_0x1d851b[_0x19b1('0x5a')]=_0x1f613c;return _0x1d851b;})[_0x19b1('0x38')](respondWithFilteredResult(_0x4a1492,_0x3980f0))[_0x19b1('0x2a')](handleError(_0x4a1492,null));};exports[_0x19b1('0x5b')]=function(_0x363a5a,_0x10e8c0){var _0x5351bb={'raw':![],'where':{'id':_0x363a5a[_0x19b1('0x5c')]['id']},'include':[{'model':db[_0x19b1('0x40')],'as':_0x19b1('0x41')}]},_0x58ea9f={};_0x58ea9f['model']=_[_0x19b1('0x5d')](db[_0x19b1('0x42')][_0x19b1('0x43')]);_0x58ea9f[_0x19b1('0x45')]=_['keys'](_0x363a5a[_0x19b1('0x45')]);_0x58ea9f[_0x19b1('0x46')]=_[_0x19b1('0x47')](_0x58ea9f['model'],_0x58ea9f['query']);_0x5351bb[_0x19b1('0x49')]=_['intersection'](_0x58ea9f['model'],qs[_0x19b1('0x4a')](_0x363a5a[_0x19b1('0x45')][_0x19b1('0x4a')]));_0x5351bb['attributes']=_0x5351bb[_0x19b1('0x49')]['length']?_0x5351bb[_0x19b1('0x49')]:_0x58ea9f[_0x19b1('0x48')];if(_0x363a5a[_0x19b1('0x45')][_0x19b1('0x57')]){_0x5351bb[_0x19b1('0x58')]=[{'all':!![]}];}_0x5351bb=_[_0x19b1('0x53')]({},_0x5351bb,_0x363a5a[_0x19b1('0x56')]);return db[_0x19b1('0x42')][_0x19b1('0x5e')](_0x5351bb)['then'](handleEntityNotFound(_0x10e8c0,null))[_0x19b1('0x38')](respondWithResult(_0x10e8c0,null))[_0x19b1('0x2a')](handleError(_0x10e8c0,null));};exports['create']=function(_0x304512,_0x1801f0){return db[_0x19b1('0x42')][_0x19b1('0x5f')](_0x304512[_0x19b1('0x60')],{})[_0x19b1('0x38')](function(_0x44e8ad){var _0x283c03=_0x304512['user'][_0x19b1('0x3a')]({'plain':!![]});if(!_0x283c03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x283c03[_0x19b1('0x61')]===_0x19b1('0x62')){var _0x55afa6=_0x44e8ad['get']({'plain':!![]});var _0x2cdfc8='FaxAccounts';return db[_0x19b1('0x63')][_0x19b1('0x5e')]({'where':{'name':_0x2cdfc8,'userProfileId':_0x283c03['userProfileId']},'raw':!![]})[_0x19b1('0x38')](function(_0x975e7a){if(_0x975e7a&&_0x975e7a[_0x19b1('0x64')]===0x0){return db[_0x19b1('0x65')][_0x19b1('0x5f')]({'name':_0x55afa6[_0x19b1('0x3d')],'resourceId':_0x55afa6['id'],'type':_0x975e7a[_0x19b1('0x3d')],'sectionId':_0x975e7a['id']},{})[_0x19b1('0x38')](function(){return _0x44e8ad;});}else{return _0x44e8ad;}})[_0x19b1('0x2a')](function(_0xf019bc){logger[_0x19b1('0x25')](_0x19b1('0x66'),_0xf019bc);throw _0xf019bc;});}return _0x44e8ad;})['then'](respondWithResult(_0x1801f0,0xc9))[_0x19b1('0x2a')](handleError(_0x1801f0,null));};exports['update']=function(_0x11dd44,_0x4fb83c){if(_0x11dd44[_0x19b1('0x60')]['id']){delete _0x11dd44[_0x19b1('0x60')]['id'];}return db[_0x19b1('0x42')][_0x19b1('0x5e')]({'where':{'id':_0x11dd44[_0x19b1('0x5c')]['id']},'include':[{'model':db[_0x19b1('0x40')],'as':_0x19b1('0x41')}]})[_0x19b1('0x38')](handleEntityNotFound(_0x4fb83c,null))[_0x19b1('0x38')](saveUpdates(_0x11dd44['body'],null))['then'](respondWithResult(_0x4fb83c,null))['catch'](handleError(_0x4fb83c,null));};exports[_0x19b1('0x39')]=function(_0x23e75e,_0x560287){return db[_0x19b1('0x42')][_0x19b1('0x5e')]({'where':{'id':_0x23e75e['params']['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0x560287,null))[_0x19b1('0x38')](removeEntity(_0x560287,null))['catch'](handleError(_0x560287,null));};exports['describe']=function(_0xc983e6,_0x240866){return db['FaxAccount']['describe']()[_0x19b1('0x38')](respondWithResult(_0x240866,null))[_0x19b1('0x2a')](handleError(_0x240866,null));};exports[_0x19b1('0x67')]=function(_0x5b4afc,_0x376d91,_0x222a84){if(_0x5b4afc['body']['id']){delete _0x5b4afc[_0x19b1('0x60')]['id'];}return db[_0x19b1('0x42')]['find']({'where':{'id':_0x5b4afc['params']['id']}})['then'](handleEntityNotFound(_0x376d91,null))[_0x19b1('0x38')](function(_0x351873){if(_0x351873){_0x5b4afc['body']['FaxAccountId']=_0x351873['id'];return db[_0x19b1('0x68')][_0x19b1('0x5f')](_0x5b4afc[_0x19b1('0x60')]);}})[_0x19b1('0x38')](respondWithResult(_0x376d91,null))[_0x19b1('0x2a')](handleError(_0x376d91,null));};exports['getDispositions']=function(_0xbfff2e,_0xdf4786,_0x432dad){var _0x2b9ca1={'raw':![],'where':{}};var _0x243a12={};var _0x350887={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xbfff2e[_0x19b1('0x5c')]['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0xdf4786,null))[_0x19b1('0x38')](function(_0x1ce6ce){if(_0x1ce6ce){_0x243a12[_0x19b1('0x48')]=_[_0x19b1('0x5d')](db[_0x19b1('0x68')]['rawAttributes']);_0x243a12[_0x19b1('0x45')]=_[_0x19b1('0x5d')](_0xbfff2e[_0x19b1('0x45')]);_0x243a12[_0x19b1('0x46')]=_['intersection'](_0x243a12[_0x19b1('0x48')],_0x243a12[_0x19b1('0x45')]);_0x2b9ca1[_0x19b1('0x49')]=_[_0x19b1('0x47')](_0x243a12['model'],qs[_0x19b1('0x4a')](_0xbfff2e[_0x19b1('0x45')][_0x19b1('0x4a')]));_0x2b9ca1[_0x19b1('0x49')]=_0x2b9ca1['attributes'][_0x19b1('0x4b')]?_0x2b9ca1[_0x19b1('0x49')]:_0x243a12[_0x19b1('0x48')];if(!_0xbfff2e[_0x19b1('0x45')][_0x19b1('0x4c')](_0x19b1('0x4d'))){_0x2b9ca1[_0x19b1('0x30')]=qs[_0x19b1('0x30')](_0xbfff2e['query']['limit']);_0x2b9ca1[_0x19b1('0x2f')]=qs[_0x19b1('0x2f')](_0xbfff2e[_0x19b1('0x45')]['offset']);}_0x2b9ca1[_0x19b1('0x4e')]=qs[_0x19b1('0x4f')](_0xbfff2e[_0x19b1('0x45')][_0x19b1('0x4f')]);_0x2b9ca1[_0x19b1('0x50')]=qs[_0x19b1('0x46')](_[_0x19b1('0x51')](_0xbfff2e['query'],_0x243a12[_0x19b1('0x46')]));_0x2b9ca1[_0x19b1('0x50')][_0x19b1('0x69')]=_0x1ce6ce['id'];if(_0xbfff2e[_0x19b1('0x45')]['filter']){_0x2b9ca1[_0x19b1('0x50')]=_[_0x19b1('0x53')](_0x2b9ca1[_0x19b1('0x50')],{'$or':_[_0x19b1('0x54')](_0x2b9ca1[_0x19b1('0x49')],function(_0x5c9374){var _0x540292={};_0x540292[_0x5c9374]={'$like':'%'+_0xbfff2e['query'][_0x19b1('0x52')]+'%'};return _0x540292;})});}_0x2b9ca1=_[_0x19b1('0x53')]({},_0x2b9ca1,_0xbfff2e['options']);return db[_0x19b1('0x68')][_0x19b1('0x32')]({'where':_0x2b9ca1[_0x19b1('0x50')]})[_0x19b1('0x38')](function(_0x458972){_0x350887[_0x19b1('0x32')]=_0x458972;if(_0xbfff2e[_0x19b1('0x45')][_0x19b1('0x57')]){_0x2b9ca1[_0x19b1('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2b9ca1);})[_0x19b1('0x38')](function(_0x56bb5c){_0x350887[_0x19b1('0x5a')]=_0x56bb5c;return _0x350887;});}})[_0x19b1('0x38')](respondWithFilteredResult(_0xdf4786,_0x2b9ca1))[_0x19b1('0x2a')](handleError(_0xdf4786,null));};exports['removeDispositions']=function(_0x4129cf,_0x2d0edb,_0x59c1f9){return db['FaxAccount'][_0x19b1('0x5e')]({'where':{'id':_0x4129cf[_0x19b1('0x5c')]['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0x2d0edb,null))[_0x19b1('0x38')](function(_0x40f6f1){if(_0x40f6f1){return _0x40f6f1['removeDispositions'](_0x4129cf[_0x19b1('0x45')]['ids']);}})[_0x19b1('0x38')](respondWithStatusCode(_0x2d0edb,null))['catch'](handleError(_0x2d0edb,null));};exports[_0x19b1('0x6a')]=function(_0x5a3b7f,_0x2116b5,_0x399fbf){if(_0x5a3b7f[_0x19b1('0x60')]['id']){delete _0x5a3b7f[_0x19b1('0x60')]['id'];}return db[_0x19b1('0x42')]['find']({'where':{'id':_0x5a3b7f['params']['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0x2116b5,null))[_0x19b1('0x38')](function(_0x5ec110){if(_0x5ec110){_0x5a3b7f[_0x19b1('0x60')][_0x19b1('0x69')]=_0x5ec110['id'];return db[_0x19b1('0x6b')][_0x19b1('0x5f')](_0x5a3b7f[_0x19b1('0x60')]);}})[_0x19b1('0x38')](respondWithResult(_0x2116b5,null))[_0x19b1('0x2a')](handleError(_0x2116b5,null));};exports[_0x19b1('0x6c')]=function(_0x2423e4,_0x102a04,_0x26aa9a){var _0x51220a={'raw':![],'where':{}};var _0x1f821c={};var _0x1d4498={'count':0x0,'rows':[]};return db[_0x19b1('0x42')][_0x19b1('0x6d')]({'where':{'id':_0x2423e4['params']['id']}})['then'](handleEntityNotFound(_0x102a04,null))[_0x19b1('0x38')](function(_0x3e8cb1){if(_0x3e8cb1){_0x1f821c[_0x19b1('0x48')]=_[_0x19b1('0x5d')](db[_0x19b1('0x6b')]['rawAttributes']);_0x1f821c[_0x19b1('0x45')]=_[_0x19b1('0x5d')](_0x2423e4[_0x19b1('0x45')]);_0x1f821c[_0x19b1('0x46')]=_[_0x19b1('0x47')](_0x1f821c['model'],_0x1f821c[_0x19b1('0x45')]);_0x51220a[_0x19b1('0x49')]=_['intersection'](_0x1f821c[_0x19b1('0x48')],qs[_0x19b1('0x4a')](_0x2423e4[_0x19b1('0x45')][_0x19b1('0x4a')]));_0x51220a[_0x19b1('0x49')]=_0x51220a['attributes'][_0x19b1('0x4b')]?_0x51220a[_0x19b1('0x49')]:_0x1f821c[_0x19b1('0x48')];if(!_0x2423e4[_0x19b1('0x45')][_0x19b1('0x4c')](_0x19b1('0x4d'))){_0x51220a['limit']=qs[_0x19b1('0x30')](_0x2423e4[_0x19b1('0x45')]['limit']);_0x51220a[_0x19b1('0x2f')]=qs['offset'](_0x2423e4[_0x19b1('0x45')][_0x19b1('0x2f')]);}_0x51220a[_0x19b1('0x4e')]=qs['sort'](_0x2423e4[_0x19b1('0x45')][_0x19b1('0x4f')]);_0x51220a[_0x19b1('0x50')]=qs['filters'](_[_0x19b1('0x51')](_0x2423e4['query'],_0x1f821c[_0x19b1('0x46')]));_0x51220a['where'][_0x19b1('0x69')]=_0x3e8cb1['id'];if(_0x2423e4[_0x19b1('0x45')][_0x19b1('0x52')]){_0x51220a[_0x19b1('0x50')]=_[_0x19b1('0x53')](_0x51220a[_0x19b1('0x50')],{'$or':_[_0x19b1('0x54')](_0x51220a[_0x19b1('0x49')],function(_0x4b4391){var _0x455b09={};_0x455b09[_0x4b4391]={'$like':'%'+_0x2423e4[_0x19b1('0x45')][_0x19b1('0x52')]+'%'};return _0x455b09;})});}_0x51220a=_['merge']({},_0x51220a,_0x2423e4['options']);return db[_0x19b1('0x6b')][_0x19b1('0x32')]({'where':_0x51220a[_0x19b1('0x50')]})[_0x19b1('0x38')](function(_0x353b84){_0x1d4498[_0x19b1('0x32')]=_0x353b84;if(_0x2423e4[_0x19b1('0x45')][_0x19b1('0x57')]){_0x51220a[_0x19b1('0x58')]=[{'all':!![]}];}return db[_0x19b1('0x6b')][_0x19b1('0x59')](_0x51220a);})['then'](function(_0x16e8c0){_0x1d4498[_0x19b1('0x5a')]=_0x16e8c0;return _0x1d4498;});}})[_0x19b1('0x38')](respondWithFilteredResult(_0x102a04,_0x51220a))[_0x19b1('0x2a')](handleError(_0x102a04,null));};exports[_0x19b1('0x6e')]=function(_0xbe41c1,_0x710155,_0x1c044b){return db[_0x19b1('0x42')][_0x19b1('0x5e')]({'where':{'id':_0xbe41c1[_0x19b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x710155,null))[_0x19b1('0x38')](function(_0x2bd568){if(_0x2bd568){return _0x2bd568[_0x19b1('0x6e')](_0xbe41c1[_0x19b1('0x45')][_0x19b1('0x6f')]);}})[_0x19b1('0x38')](respondWithStatusCode(_0x710155,null))['catch'](handleError(_0x710155,null));};exports[_0x19b1('0x70')]=function(_0x16fd17,_0x4537df,_0x21c61c){return db['FaxInteraction'][_0x19b1('0x5e')]({'where':{'id':_0x16fd17[_0x19b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4537df,null))[_0x19b1('0x38')](function(_0x5204b0){if(_0x5204b0){return _0x5204b0['addInteraction'](_0x16fd17['body']['ids'],_[_0x19b1('0x71')](_0x16fd17['body'],[_0x19b1('0x6f'),'id'])||{});}})[_0x19b1('0x38')](respondWithResult(_0x4537df,null))[_0x19b1('0x2a')](handleError(_0x4537df,null));};exports[_0x19b1('0x72')]=function(_0x173d3b,_0x86b5d6,_0x47d8ba){var _0x346657={'raw':![],'where':{}};var _0x273d00={};var _0x54009f={'count':0x0,'rows':[]};return db[_0x19b1('0x42')][_0x19b1('0x6d')]({'where':{'id':_0x173d3b['params']['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0x86b5d6,null))['then'](function(_0x246ff6){if(_0x246ff6){_0x273d00[_0x19b1('0x48')]=_[_0x19b1('0x5d')](db[_0x19b1('0x73')]['rawAttributes']);_0x273d00[_0x19b1('0x45')]=_['keys'](_0x173d3b['query']);_0x273d00[_0x19b1('0x46')]=_[_0x19b1('0x47')](_0x273d00['model'],_0x273d00['query']);_0x346657[_0x19b1('0x49')]=_[_0x19b1('0x47')](_0x273d00[_0x19b1('0x48')],qs[_0x19b1('0x4a')](_0x173d3b[_0x19b1('0x45')]['fields']));_0x346657[_0x19b1('0x49')]=_0x346657[_0x19b1('0x49')]['length']?_0x346657[_0x19b1('0x49')]:_0x273d00[_0x19b1('0x48')];if(!_0x173d3b[_0x19b1('0x45')][_0x19b1('0x4c')](_0x19b1('0x4d'))){_0x346657[_0x19b1('0x30')]=qs['limit'](_0x173d3b[_0x19b1('0x45')]['limit']);_0x346657[_0x19b1('0x2f')]=qs['offset'](_0x173d3b[_0x19b1('0x45')][_0x19b1('0x2f')]);}_0x346657[_0x19b1('0x4e')]=qs['sort'](_0x173d3b[_0x19b1('0x45')][_0x19b1('0x4f')]);_0x346657[_0x19b1('0x50')]=qs[_0x19b1('0x46')](_[_0x19b1('0x51')](_0x173d3b[_0x19b1('0x45')],_0x273d00['filters']));_0x346657['where'][_0x19b1('0x69')]=_0x246ff6['id'];if(_0x173d3b['query'][_0x19b1('0x52')]){_0x346657['where']=_[_0x19b1('0x53')](_0x346657[_0x19b1('0x50')],{'$or':_['map'](_0x346657[_0x19b1('0x49')],function(_0x3d8c9e){var _0x349afb={};_0x349afb[_0x3d8c9e]={'$like':'%'+_0x173d3b[_0x19b1('0x45')][_0x19b1('0x52')]+'%'};return _0x349afb;})});}_0x346657=_[_0x19b1('0x53')]({},_0x346657,_0x173d3b['options']);return db['FaxInteraction'][_0x19b1('0x32')]({'where':_0x346657[_0x19b1('0x50')]})[_0x19b1('0x38')](function(_0x2a6781){_0x54009f['count']=_0x2a6781;if(_0x173d3b[_0x19b1('0x45')][_0x19b1('0x57')]){_0x346657[_0x19b1('0x58')]=[{'model':db[_0x19b1('0x74')],'as':_0x19b1('0x75'),'required':![]},{'model':db[_0x19b1('0x76')],'as':_0x19b1('0x77'),'attributes':[_0x19b1('0x3d'),_0x19b1('0x78'),'internal'],'required':![]},{'model':db[_0x19b1('0x79')],'as':_0x19b1('0x7a'),'attributes':['id',_0x19b1('0x3d'),_0x19b1('0x7b')],'where':_0x173d3b[_0x19b1('0x45')][_0x19b1('0x7c')]?{'id':_0x173d3b[_0x19b1('0x45')][_0x19b1('0x7c')]}:undefined,'required':_0x173d3b[_0x19b1('0x45')][_0x19b1('0x7c')]?!![]:![]}];}return db[_0x19b1('0x73')][_0x19b1('0x59')](_0x346657);})['then'](function(_0x4f54c4){_0x54009f[_0x19b1('0x5a')]=_0x4f54c4;return _0x54009f;});}})[_0x19b1('0x38')](respondWithFilteredResult(_0x86b5d6,_0x346657))['catch'](handleError(_0x86b5d6,null));};exports[_0x19b1('0x7d')]=function(_0x23cbd2,_0x4d1c76){var _0x23bbc6=_0x23cbd2[_0x19b1('0x5c')]['id'];var _0x59a97b=_0x23cbd2['body'];var _0x2053e1=0xc8;var _0x4db06b=null;return db[_0x19b1('0x7e')][_0x19b1('0x7f')]({'isolationLevel':db[_0x19b1('0x7e')][_0x19b1('0x80')][_0x19b1('0x81')][_0x19b1('0x82')]},function(_0xf8627d){return db[_0x19b1('0x42')][_0x19b1('0x6d')]({'where':{'id':_0x23bbc6},'transaction':_0xf8627d})[_0x19b1('0x38')](function(_0x5ca608){if(_0x5ca608){return db[_0x19b1('0x83')]['destroy']({'where':{'FaxAccountId':_0x23bbc6},'transaction':_0xf8627d})[_0x19b1('0x38')](function(){var _0x113e2c=_['map'](_0x59a97b,function(_0x3aa00d){_0x3aa00d[_0x19b1('0x69')]=_0x23bbc6;return _0x3aa00d;});return db[_0x19b1('0x83')]['bulkCreate'](_0x113e2c,{'transaction':_0xf8627d});});}else{_0x2053e1=0x194;_0x4db06b=[];}});})['then'](function(){if(_0x2053e1!==0x194){return db[_0x19b1('0x83')][_0x19b1('0x84')]({'where':{'FaxAccountId':_0x23bbc6},'order':_0x19b1('0x85')})[_0x19b1('0x38')](function(_0x3f3a5d){_0x4db06b=_0x3f3a5d;});}})[_0x19b1('0x2a')](function(_0x4d112a){_0x2053e1=0x1f4;logger['error'](_0x4d112a[_0x19b1('0x3c')]);if(_0x4d112a[_0x19b1('0x3d')]){delete _0x4d112a[_0x19b1('0x3d')];}_0x4db06b=_0x4d112a;})[_0x19b1('0x86')](function(){if(_0x4db06b===null){_0x4d1c76[_0x19b1('0x2b')](_0x2053e1);}else{if(_0x2053e1===0x1f4){_0x4d1c76[_0x19b1('0x2c')](_0x2053e1)[_0x19b1('0x3e')](_0x4db06b);}else{_0x4d1c76['status'](_0x2053e1)['json'](_0x4db06b);}}});};exports[_0x19b1('0x87')]=function(_0x8f005c,_0x245790,_0x50d25b){var _0x55962a={};var _0x4f5ad3={};var _0xad6acc;var _0x31a898;return db[_0x19b1('0x42')][_0x19b1('0x6d')]({'where':{'id':_0x8f005c[_0x19b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x245790,null))[_0x19b1('0x38')](function(_0x260d1e){if(_0x260d1e){_0xad6acc=_0x260d1e;_0x4f5ad3['model']=_[_0x19b1('0x5d')](db[_0x19b1('0x83')][_0x19b1('0x43')]);_0x4f5ad3['query']=_[_0x19b1('0x5d')](_0x8f005c[_0x19b1('0x45')]);_0x4f5ad3[_0x19b1('0x46')]=_[_0x19b1('0x47')](_0x4f5ad3[_0x19b1('0x48')],_0x4f5ad3['query']);_0x55962a[_0x19b1('0x49')]=_[_0x19b1('0x47')](_0x4f5ad3[_0x19b1('0x48')],qs['fields'](_0x8f005c['query'][_0x19b1('0x4a')]));_0x55962a['attributes']=_0x55962a[_0x19b1('0x49')][_0x19b1('0x4b')]?_0x55962a[_0x19b1('0x49')]:_0x4f5ad3[_0x19b1('0x48')];_0x55962a['order']=qs[_0x19b1('0x4f')](_0x8f005c[_0x19b1('0x45')][_0x19b1('0x4f')]);_0x55962a[_0x19b1('0x50')]=qs[_0x19b1('0x46')](_[_0x19b1('0x51')](_0x8f005c[_0x19b1('0x45')],_0x4f5ad3[_0x19b1('0x46')]));if(_0x8f005c[_0x19b1('0x45')][_0x19b1('0x52')]){_0x55962a[_0x19b1('0x50')]=_[_0x19b1('0x53')](_0x55962a['where'],{'$or':_[_0x19b1('0x54')](_0x55962a[_0x19b1('0x49')],function(_0x2fed8a){var _0x483308={};_0x483308[_0x2fed8a]={'$like':'%'+_0x8f005c[_0x19b1('0x45')][_0x19b1('0x52')]+'%'};return _0x483308;})});}_0x55962a=_['merge']({},_0x55962a,_0x8f005c['options']);return _0xad6acc[_0x19b1('0x87')](_0x55962a);}})['then'](function(_0x9560b4){if(_0x9560b4){_0x31a898=_0x9560b4[_0x19b1('0x4b')];if(!_0x8f005c[_0x19b1('0x45')][_0x19b1('0x4c')](_0x19b1('0x4d'))){_0x55962a['limit']=qs[_0x19b1('0x30')](_0x8f005c[_0x19b1('0x45')][_0x19b1('0x30')]);_0x55962a['offset']=qs['offset'](_0x8f005c[_0x19b1('0x45')]['offset']);}return _0xad6acc[_0x19b1('0x87')](_0x55962a);}})[_0x19b1('0x38')](function(_0x3a587d){if(_0x3a587d){return _0x3a587d?{'count':_0x31a898,'rows':_0x3a587d}:null;}})['then'](respondWithResult(_0x245790,null))['catch'](handleError(_0x245790,null));};function Extension(_0x30cd7e,_0x4b0a5e,_0x245023,_0x75adf0){this['context']='from-voip-provider';this['exten']=_0x30cd7e['localstationid'];this['app']=_0x75adf0;this['type']=_0x19b1('0x88');this['description']='Fax\x20Extension';this[_0x19b1('0x69')]=_0x30cd7e['id'];this[_0x19b1('0x85')]=_0x4b0a5e;this[_0x19b1('0x89')]=_0x245023;}function createExtensionsReciveFax(_0x20e326){var _0x2f5877=0x1;var _0x530b02=[];_0x530b02[_0x19b1('0x8a')](new Extension(_0x20e326,_0x2f5877,'',_0x19b1('0x8b')));_0x2f5877+=0x1;_0x530b02['push'](new Extension(_0x20e326,_0x2f5877,_0x19b1('0x8c'),_0x19b1('0x8d')));_0x2f5877+=0x1;for(var _0x22761b in _0x20e326){if(_0x20e326[_0x19b1('0x4c')](_0x22761b)&&(_0x22761b===_0x19b1('0x8e')||_0x22761b==='localstationid'||_0x22761b===_0x19b1('0x8f')||_0x22761b===_0x19b1('0x90')||_0x22761b===_0x19b1('0x91')||_0x22761b===_0x19b1('0x92')||_0x22761b==='minrate'||_0x22761b===_0x19b1('0x93')||_0x22761b==='t38timeout')){_0x530b02[_0x19b1('0x8a')](new Extension(_0x20e326,_0x2f5877,_0x19b1('0x94')+_0x22761b+')='+_0x20e326[_0x22761b],_0x19b1('0x8d')));_0x2f5877+=0x1;}}_0x530b02[_0x19b1('0x8a')](new Extension(_0x20e326,_0x2f5877,'6','Wait'));_0x2f5877+=0x1;_0x530b02[_0x19b1('0x8a')](new Extension(_0x20e326,_0x2f5877,_0x19b1('0x95'),_0x19b1('0x96')));_0x2f5877=0x0;return _0x530b02;}exports[_0x19b1('0x97')]=function(_0x44aa5b,_0xa99517,_0x31d38c){var _0x48afa8;return db[_0x19b1('0x7e')][_0x19b1('0x7f')](function(_0x58f035){return db[_0x19b1('0x42')][_0x19b1('0x5f')](_0x44aa5b['body'],{'transaction':_0x58f035})[_0x19b1('0x38')](function(_0x2d620d){_0x48afa8=_0x2d620d[_0x19b1('0x3a')]({'plain':!![]});return db[_0x19b1('0x98')][_0x19b1('0x99')](createExtensionsReciveFax(_0x48afa8),{'transaction':_0x58f035});});})['then'](function(){return _0x48afa8;})[_0x19b1('0x38')](respondWithResult(_0xa99517,null))[_0x19b1('0x2a')](handleError(_0xa99517,null));};exports[_0x19b1('0x9a')]=function(_0x544d24,_0x1874e4,_0x593568){var _0x3d0f3a;return db[_0x19b1('0x7e')][_0x19b1('0x7f')](function(_0x5d077a){return db['FaxAccount']['update'](_0x544d24[_0x19b1('0x60')],{'where':{'id':_0x544d24[_0x19b1('0x60')]['id']},'transaction':_0x5d077a})['then'](function(_0x4ff2fa){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x544d24[_0x19b1('0x60')]['id']},'transaction':_0x5d077a})[_0x19b1('0x38')](function(_0x33c6e6){return db[_0x19b1('0x98')][_0x19b1('0x99')](createExtensionsReciveFax(_[_0x19b1('0x71')](_0x544d24['body'],[_0x19b1('0x9b'),_0x19b1('0x9c'),_0x19b1('0x9d'),_0x19b1('0x9e'),'TrunkId','ListId'])),{'transaction':_0x5d077a});});});})['then'](function(){return db[_0x19b1('0x42')][_0x19b1('0x9f')](_0x544d24[_0x19b1('0x60')]['id']);})[_0x19b1('0x38')](respondWithResult(_0x1874e4,null))['catch'](handleError(_0x1874e4,null));};exports[_0x19b1('0xa0')]=function(_0x345c55,_0x40a8a7,_0x524979){var _0xc0898b={'raw':!![],'where':{}};var _0xb7e0f6={};var _0x14f862={'count':0x0,'rows':[]};return db[_0x19b1('0x42')][_0x19b1('0x6d')]({'where':{'id':_0x345c55[_0x19b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x40a8a7,null))['then'](function(_0x581d0f){if(_0x581d0f){_0xb7e0f6[_0x19b1('0x48')]=_[_0x19b1('0x5d')](db[_0x19b1('0xa1')]['rawAttributes']);_0xb7e0f6['query']=_[_0x19b1('0x5d')](_0x345c55['query']);_0xb7e0f6['filters']=_[_0x19b1('0x47')](_0xb7e0f6[_0x19b1('0x48')],_0xb7e0f6['query']);_0xc0898b['attributes']=_[_0x19b1('0x47')](_0xb7e0f6[_0x19b1('0x48')],qs[_0x19b1('0x4a')](_0x345c55[_0x19b1('0x45')][_0x19b1('0x4a')]));_0xc0898b['attributes']=_0xc0898b[_0x19b1('0x49')][_0x19b1('0x4b')]?_0xc0898b[_0x19b1('0x49')]:_0xb7e0f6[_0x19b1('0x48')];if(!_0x345c55[_0x19b1('0x45')]['hasOwnProperty'](_0x19b1('0x4d'))){_0xc0898b[_0x19b1('0x30')]=qs[_0x19b1('0x30')](_0x345c55[_0x19b1('0x45')]['limit']);_0xc0898b[_0x19b1('0x2f')]=qs[_0x19b1('0x2f')](_0x345c55[_0x19b1('0x45')]['offset']);}_0xc0898b['order']=qs[_0x19b1('0x4f')](_0x345c55[_0x19b1('0x45')][_0x19b1('0x4f')]);_0xc0898b['where']=qs[_0x19b1('0x46')](_[_0x19b1('0x51')](_0x345c55[_0x19b1('0x45')],_0xb7e0f6[_0x19b1('0x46')]));_0xc0898b[_0x19b1('0x50')][_0x19b1('0x69')]=_0x581d0f['id'];if(_0x345c55[_0x19b1('0x45')][_0x19b1('0x52')]){_0xc0898b[_0x19b1('0x50')]=_[_0x19b1('0x53')](_0xc0898b['where'],{'$or':_[_0x19b1('0x54')](_0xc0898b[_0x19b1('0x49')],function(_0xbe72ed){var _0xca865e={};_0xca865e[_0xbe72ed]={'$like':'%'+_0x345c55[_0x19b1('0x45')][_0x19b1('0x52')]+'%'};return _0xca865e;})});}if(_0x345c55[_0x19b1('0x45')][_0x19b1('0xa2')]){var _0x1aacbf=_0x345c55[_0x19b1('0x45')][_0x19b1('0xa2')]['split'](',');var _0x183956={};_0x183956[_0x1aacbf[0x0]]={'$gte':moment(_0x1aacbf[0x1])[_0x19b1('0xa3')](_0x19b1('0xa4'))};_0xc0898b[_0x19b1('0x50')]=_[_0x19b1('0x53')](_0xc0898b[_0x19b1('0x50')],_0x183956);}_0xc0898b=_[_0x19b1('0x53')]({},_0xc0898b,_0x345c55['options']);return db[_0x19b1('0xa1')][_0x19b1('0x32')]({'where':_0xc0898b[_0x19b1('0x50')]})[_0x19b1('0x38')](function(_0x3aea51){_0x14f862[_0x19b1('0x32')]=_0x3aea51;if(_0x345c55['query'][_0x19b1('0x57')]){_0xc0898b[_0x19b1('0x58')]=[{'all':!![]}];}return db[_0x19b1('0xa1')]['findAll'](_0xc0898b);})[_0x19b1('0x38')](function(_0x4a4d92){_0x14f862['rows']=_0x4a4d92;return _0x14f862;});}})[_0x19b1('0x38')](respondWithFilteredResult(_0x40a8a7,_0xc0898b))[_0x19b1('0x2a')](handleError(_0x40a8a7,null));};exports['send']=function(_0x107d7c,_0x2798f2,_0x2bc959){var _0x1b3a53,_0x1ca73e={},_0x55a115;if(_0x107d7c[_0x19b1('0x60')]['to']){_0x55a115=_0x107d7c[_0x19b1('0x60')]['to'][0x0];}return db['FaxAccount'][_0x19b1('0x5e')]({'where':{'id':_0x107d7c[_0x19b1('0x5c')]['id']},'include':[{'model':db[_0x19b1('0xa5')],'as':_0x19b1('0xa6'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x55a115},'limit':0x1,'order':[[_0x19b1('0x9e'),_0x19b1('0xa7')]]}]}]})[_0x19b1('0x38')](handleEntityNotFound(_0x2798f2,null))[_0x19b1('0x38')](function(_0x4b527c){_0x1b3a53=_0x4b527c;if(_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')]&&_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')][_0x19b1('0x4b')]){for(var _0x1d3294=0x0;_0x1d3294<_0x107d7c['body']['attachments']['length'];_0x1d3294+=0x1){_0x107d7c['body'][_0x19b1('0xa8')][_0x1d3294]={'filename':_0x107d7c['body'][_0x19b1('0xa8')][_0x1d3294][_0x19b1('0x3d')],'id':_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')][_0x1d3294]['id'],'path':path[_0x19b1('0xa9')](config[_0x19b1('0xaa')],'server/files/attachments',_0x107d7c['body'][_0x19b1('0xa8')][_0x1d3294][_0x19b1('0xab')])};}}return respondWithRpcPromise(_0x19b1('0xac'),_0x19b1('0xac'),{'FaxAccountId':_[_0x19b1('0xad')](_0x107d7c[_0x19b1('0x5c')]['id'])?undefined:_0x107d7c[_0x19b1('0x5c')]['id'],'path':_['isNil'](_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')][0x0][_0x19b1('0x6')])?undefined:_0x107d7c['body']['attachments'][0x0][_0x19b1('0x6')],'fax':_[_0x19b1('0xad')](_0x107d7c[_0x19b1('0x60')]['to'][0x0])?undefined:_0x107d7c['body']['to'][0x0]},client9002);})['then'](function(){if(_0x1b3a53){if(_[_0x19b1('0xad')](_0x107d7c[_0x19b1('0x60')][_0x19b1('0xae')])){_0x107d7c[_0x19b1('0x60')]['from']=util['format'](_0x19b1('0xaf'),_0x1b3a53['name'],_0x1b3a53[_0x19b1('0xb0')]);}if(_0x1b3a53[_0x19b1('0xa6')]){if(_0x1b3a53[_0x19b1('0xa6')]['Contacts'][_0x19b1('0x4b')]){return _0x1b3a53[_0x19b1('0xa6')][_0x19b1('0xb1')][0x0];}else{return db[_0x19b1('0x74')][_0x19b1('0x5f')](_['defaults'](_0x107d7c[_0x19b1('0x60')],{'firstName':_0x107d7c[_0x19b1('0x60')]['to'][0x0],'phone':_0x107d7c[_0x19b1('0x60')]['to'][0x0],'fax':_0x107d7c[_0x19b1('0x60')]['to'][0x0],'ListId':_0x1b3a53[_0x19b1('0xb2')]}));}}else{throw new Error(_0x19b1('0xb3'));}}else{throw new Error(_0x19b1('0xb4'));}})[_0x19b1('0x38')](function(_0xba85bc){if(_0xba85bc){return db[_0x19b1('0x73')][_0x19b1('0x5e')]({'where':{'ContactId':_0xba85bc['id'],'closed':![],'FaxAccountId':_0x1b3a53['id']}})[_0x19b1('0x38')](function(_0x36fac1){if(_0x36fac1){return[_0x36fac1,![]];}return db[_0x19b1('0x73')][_0x19b1('0x5f')]({'UserId':_0x107d7c[_0x19b1('0x62')]['id'],'ContactId':_0xba85bc['id'],'FaxAccountId':_0x1b3a53['id'],'fax':_0x107d7c[_0x19b1('0x60')]['to'][0x0],'firstMsgDirection':_0x19b1('0xb5'),'Messages':[_[_0x19b1('0x53')](_0x107d7c[_0x19b1('0x60')],{'read':![],'body':_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')][0x0][_0x19b1('0xb6')],'FaxAccountId':_0x1b3a53['id'],'UserId':_0x107d7c[_0x19b1('0x62')]['id'],'ContactId':_0xba85bc['id'],'AttachmentId':_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x19b1('0xa1')],'as':_0x19b1('0xb7')}]})[_0x19b1('0x38')](function(_0x262c8d){return[_0x262c8d,!![]];});});}else{throw new Error(_0x19b1('0xb8'));}})['spread'](function(_0x554b9f,_0xd5bba6){if(_0xd5bba6){return _0x554b9f;}return db['FaxMessage'][_0x19b1('0x5f')]({'direction':_0x19b1('0xb5'),'read':![],'body':_0x107d7c['body'][_0x19b1('0xa8')][0x0][_0x19b1('0xb6')],'FaxAccountId':_0x1b3a53['id'],'FaxInteractionId':_0x554b9f['id'],'UserId':_0x107d7c[_0x19b1('0x62')]['id'],'ContactId':_0x554b9f[_0x19b1('0xb9')],'AttachmentId':_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')][0x0]['id']})[_0x19b1('0x38')](function(_0x5ebb3b){_0x554b9f[_0x19b1('0xba')][_0x19b1('0xb7')]=[];_0x554b9f[_0x19b1('0xba')][_0x19b1('0xb7')][_0x19b1('0x8a')](_0x5ebb3b[_0x19b1('0xba')]);return _0x554b9f;});})[_0x19b1('0x38')](function(_0x299dbb){respondWithRpcPromise(_0x19b1('0xbb'),_0x19b1('0xbb'),{'FaxAccountId':_[_0x19b1('0xad')](_0x107d7c['params']['id'])?undefined:_0x107d7c[_0x19b1('0x5c')]['id'],'path':_[_0x19b1('0xad')](_0x107d7c['body'][_0x19b1('0xa8')][0x0][_0x19b1('0x6')])?undefined:_0x107d7c[_0x19b1('0x60')][_0x19b1('0xa8')][0x0][_0x19b1('0x6')],'fax':_['isNil'](_0x107d7c[_0x19b1('0x60')]['to'][0x0])?undefined:_0x107d7c[_0x19b1('0x60')]['to'][0x0],'AttachmentId':_0x107d7c['body'][_0x19b1('0xa8')][0x0]['id']},client9002)[_0x19b1('0x38')](function(_0x5aa7fe){logger[_0x19b1('0x28')](_0x19b1('0xbc'),_0x5aa7fe);})[_0x19b1('0x2a')](function(_0x214c97){logger[_0x19b1('0x28')](_0x19b1('0xbc'),_0x214c97);});return _0x299dbb;})[_0x19b1('0x38')](respondWithResult(_0x2798f2,null))[_0x19b1('0x2a')](handleError(_0x2798f2,null));};exports[_0x19b1('0xbd')]=function(_0xad34d8,_0xc5bd29,_0x28b065){return db[_0x19b1('0x42')][_0x19b1('0x5e')]({'where':{'id':_0xad34d8[_0x19b1('0x5c')]['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0xc5bd29,null))[_0x19b1('0x38')](function(_0x22e71b){if(_0x22e71b){return _0x22e71b[_0x19b1('0xbd')](_0xad34d8[_0x19b1('0x60')][_0x19b1('0x6f')],_[_0x19b1('0x71')](_0xad34d8['body'],[_0x19b1('0x6f'),'id'])||{})['spread'](function(_0x52d9b8){for(var _0x159d29=0x0;_0x159d29<_0xad34d8[_0x19b1('0x60')]['ids'][_0x19b1('0x4b')];_0x159d29+=0x1){socket[_0x19b1('0xbe')]('userFaxAccount:save',{'UserId':Number(_0xad34d8[_0x19b1('0x60')]['ids'][_0x159d29]),'FaxAccountId':Number(_0xad34d8[_0x19b1('0x5c')]['id'])});}return _0x52d9b8;});}})[_0x19b1('0x38')](respondWithResult(_0xc5bd29,null))[_0x19b1('0x2a')](handleError(_0xc5bd29,null));};exports[_0x19b1('0xbf')]=function(_0x260f9d,_0x4a8bbc,_0x3ad93c){return db[_0x19b1('0x42')]['find']({'where':{'id':_0x260f9d[_0x19b1('0x5c')]['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0x4a8bbc,null))['then'](function(_0x3bcb82){if(_0x3bcb82){return _0x3bcb82['removeAgents'](_0x260f9d[_0x19b1('0x45')][_0x19b1('0x6f')])[_0x19b1('0x38')](function(){if(_[_0x19b1('0xc0')](_0x260f9d[_0x19b1('0x45')][_0x19b1('0x6f')])){for(var _0x50b318=0x0;_0x50b318<_0x260f9d[_0x19b1('0x45')][_0x19b1('0x6f')][_0x19b1('0x4b')];_0x50b318+=0x1){socket[_0x19b1('0xbe')](_0x19b1('0xc1'),{'UserId':Number(_0x260f9d[_0x19b1('0x45')][_0x19b1('0x6f')][_0x50b318]),'FaxAccountId':Number(_0x260f9d[_0x19b1('0x5c')]['id'])});}}else{socket[_0x19b1('0xbe')](_0x19b1('0xc1'),{'UserId':Number(_0x260f9d[_0x19b1('0x45')]['ids']),'FaxAccountId':Number(_0x260f9d[_0x19b1('0x5c')]['id'])});}});}})[_0x19b1('0x38')](respondWithStatusCode(_0x4a8bbc,null))['catch'](handleError(_0x4a8bbc,null));};exports[_0x19b1('0xc2')]=function(_0x3e3301,_0x2b1a42,_0x10b3a5){var _0x1b0a8d={};var _0x359806={};var _0x8c129b;var _0x390afe;return db['FaxAccount'][_0x19b1('0x6d')]({'where':{'id':_0x3e3301[_0x19b1('0x5c')]['id']}})[_0x19b1('0x38')](handleEntityNotFound(_0x2b1a42,null))[_0x19b1('0x38')](function(_0x15754d){if(_0x15754d){_0x8c129b=_0x15754d;_0x359806['model']=_[_0x19b1('0x5d')](db[_0x19b1('0x76')][_0x19b1('0x43')]);_0x359806['query']=_[_0x19b1('0x5d')](_0x3e3301[_0x19b1('0x45')]);_0x359806[_0x19b1('0x46')]=_[_0x19b1('0x47')](_0x359806[_0x19b1('0x48')],_0x359806['query']);_0x1b0a8d[_0x19b1('0x49')]=_['intersection'](_0x359806[_0x19b1('0x48')],qs[_0x19b1('0x4a')](_0x3e3301[_0x19b1('0x45')]['fields']));_0x1b0a8d[_0x19b1('0x49')]=_0x1b0a8d[_0x19b1('0x49')][_0x19b1('0x4b')]?_0x1b0a8d[_0x19b1('0x49')]:_0x359806[_0x19b1('0x48')];_0x1b0a8d[_0x19b1('0x4e')]=qs[_0x19b1('0x4f')](_0x3e3301['query']['sort']);_0x1b0a8d[_0x19b1('0x50')]=qs[_0x19b1('0x46')](_[_0x19b1('0x51')](_0x3e3301[_0x19b1('0x45')],_0x359806[_0x19b1('0x46')]));if(_0x3e3301['query']['filter']){_0x1b0a8d[_0x19b1('0x50')]=_[_0x19b1('0x53')](_0x1b0a8d['where'],{'$or':_[_0x19b1('0x54')](_0x1b0a8d[_0x19b1('0x49')],function(_0x3d3283){var _0x56c1ba={};_0x56c1ba[_0x3d3283]={'$like':'%'+_0x3e3301[_0x19b1('0x45')]['filter']+'%'};return _0x56c1ba;})});}_0x1b0a8d=_['merge']({},_0x1b0a8d,_0x3e3301[_0x19b1('0x56')]);return _0x8c129b[_0x19b1('0xc2')](_0x1b0a8d);}})[_0x19b1('0x38')](function(_0x4218da){if(_0x4218da){_0x390afe=_0x4218da[_0x19b1('0x4b')];if(!_0x3e3301[_0x19b1('0x45')][_0x19b1('0x4c')](_0x19b1('0x4d'))){_0x1b0a8d['limit']=qs['limit'](_0x3e3301[_0x19b1('0x45')][_0x19b1('0x30')]);_0x1b0a8d['offset']=qs[_0x19b1('0x2f')](_0x3e3301[_0x19b1('0x45')][_0x19b1('0x2f')]);}return _0x8c129b['getAgents'](_0x1b0a8d);}})[_0x19b1('0x38')](function(_0x2c2959){if(_0x2c2959){return _0x2c2959?{'count':_0x390afe,'rows':_0x2c2959}:null;}})[_0x19b1('0x38')](respondWithResult(_0x2b1a42,null))[_0x19b1('0x2a')](handleError(_0x2b1a42,null));};
\ No newline at end of file