Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / faxAccount / faxAccount.controller.js
index 328cb69..4bebe7d 100644 (file)
@@ -1 +1 @@
-const a186_0x3d4c=['Content-Range','bulkCreate','attributes','client','limit','sort','tag','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','Wait','count','Send\x20Fax\x20failed','addDisposition','getApplications','push','message','$gte','FaxAccount,\x20%s,\x20%s,\x20%s','filename','filter','Contact','error','removeDispositions','FaxAccount,\x20%s,\x20%s','code','nolimit','../../mysqldb','findAll','List','\x22%s\x22\x20<%s>','getMessages','omit','TrunkId','stringify','update','status','Tags','length','index','includeAll','fields','autoAssociation','ids','sequelize','FaxAccounts','send','order','FaxAccountId','request\x20sent','../../config/environment','List\x20not\x20found','addApplications','userFaxAccount:save','gateway','pick','findOne','exten','moment','priority','basename','CmContact','path','fieldName','from','model','Contacts','intersection','request','findAndCountAll','http','keys','userFaxAccount:remove','tech','appdata','VIRTUAL','query','destroy','isNil','name','jayson/promise','removeAnswers','role','emit','CmList','FaxAccount','FaxMessage','then','mandatoryDispositionPause','userProfileId','CDR(type)=inbound-fax','Disposition','describe','FaxApplication','type','like','rawAttributes','offset','end','../../rediscache','updatedAt','include','UserProfileResource','catch','minrate','getInteractions','undefined','debug','getAgents','root','defaults','addAgents','addInteraction','internal','format','server/files/attachments','VoiceExtension','Messages','split','Set','attachments','register','fax','params','json','../../config/logger','out','faxdetect','sendStatus','util','join','SendFax','merge','map','user','FaxInteraction','color','./faxAccount.socket','rows','createdAt','dataValues','show','Fax\x20Extension','localstationid','context','YYYY-MM-DD\x20HH:mm:ss','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','api','transaction','create','headerinfo','stack','updateAccountApplications','options','Pause','addAccountApplications','filters','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','get','body','set','ListId','where','fullname','CannedAnswer','getAnswers','../../components/parsers/qs','CheckAfterSend','SendFaxRpc,\x20%s','maxrate','info','Tag','from-voip-provider','getDispositions','t38timeout','ContactId'];(function(_0x2d6a49,_0x3d4c10){const _0x4ee0e7=function(_0x4b40bc){while(--_0x4b40bc){_0x2d6a49['push'](_0x2d6a49['shift']());}};_0x4ee0e7(++_0x3d4c10);}(a186_0x3d4c,0x7c));const a186_0x4ee0=function(_0x2d6a49,_0x3d4c10){_0x2d6a49=_0x2d6a49-0x0;let _0x4ee0e7=a186_0x3d4c[_0x2d6a49];return _0x4ee0e7;};const _0x559f70=a186_0x4ee0;'use strict';const moment=require(_0x559f70('0x6d')),util=require(_0x559f70('0x4')),path=require(_0x559f70('0x71')),_=require('lodash'),{getSocket}=require(_0x559f70('0x96')),socket=getSocket(),qs=require(_0x559f70('0x2a')),logger=require(_0x559f70('0x0'))(_0x559f70('0x16')),config=require(_0x559f70('0x65')),db=require(_0x559f70('0x4e'))['db'],{Op}=require(_0x559f70('0x5f'));require(_0x559f70('0xc'))[_0x559f70('0xac')](socket);const jayson=require(_0x559f70('0x83')),client=jayson['client'][_0x559f70('0x79')]({'port':0x232c}),client9002=jayson[_0x559f70('0x37')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b40bc,_0x41ad5b,_0x3300ee,_0x4254f2){return new Promise(function(_0x3f4712,_0x349b43){const _0x4e3b30=a186_0x4ee0,_0x5242ac=_0x4254f2||client;return _0x5242ac[_0x4e3b30('0x77')](_0x4b40bc,_0x3300ee)[_0x4e3b30('0x8a')](function(_0x3ea678){const _0x48fc79=_0x4e3b30;logger[_0x48fc79('0x2e')](_0x48fc79('0x4b'),_0x41ad5b,_0x48fc79('0x64')),logger[_0x48fc79('0x9e')](_0x48fc79('0x45'),_0x41ad5b,_0x48fc79('0x64'),JSON[_0x48fc79('0x55')](_0x3ea678));if(_0x3ea678[_0x48fc79('0x49')]){if(_0x3ea678['error'][_0x48fc79('0x4c')]===0x1f4)return logger[_0x48fc79('0x49')](_0x48fc79('0x4b'),_0x41ad5b,_0x3ea678[_0x48fc79('0x49')][_0x48fc79('0x43')]),_0x349b43(_0x3ea678[_0x48fc79('0x49')][_0x48fc79('0x43')]);return logger[_0x48fc79('0x49')](_0x48fc79('0x4b'),_0x41ad5b,_0x3ea678['error'][_0x48fc79('0x43')]),_0x3f4712(_0x3ea678['error']['message']);}else logger[_0x48fc79('0x2e')](_0x48fc79('0x4b'),_0x41ad5b,_0x48fc79('0x64')),_0x3f4712(_0x3ea678['result'][_0x48fc79('0x43')]);})['catch'](function(_0x672af4){const _0x85ef7f=_0x4e3b30;logger[_0x85ef7f('0x49')]('FaxAccount,\x20%s,\x20%s',_0x41ad5b,_0x672af4),_0x349b43(_0x672af4);});});}function respondWithStatusCode(_0x552b6b,_0x15485c){return _0x15485c=_0x15485c||0xcc,function(_0x49574a){const _0x31e4ca=a186_0x4ee0;if(_0x49574a)return _0x552b6b['sendStatus'](_0x15485c);return _0x552b6b[_0x31e4ca('0x57')](_0x15485c)['end']();};}function respondWithResult(_0x561a25,_0x1084ce){return _0x1084ce=_0x1084ce||0xc8,function(_0x202914){const _0x3f78df=a186_0x4ee0;if(_0x202914)return _0x561a25[_0x3f78df('0x57')](_0x1084ce)[_0x3f78df('0xaf')](_0x202914);};}function respondWithFilteredResult(_0x157236,_0x38775c){return function(_0x3d6310){const _0x5874a8=a186_0x4ee0;if(_0x3d6310){const _0x59befe=_0x3d6310[_0x5874a8('0x3e')],_0x1d5787=_0x38775c['offset'];let _0x182ce6=_0x38775c[_0x5874a8('0x94')]+_0x38775c[_0x5874a8('0x38')],_0x3a2fd0;return _0x182ce6>=_0x59befe?(_0x182ce6=_0x59befe,_0x3a2fd0=0xc8):_0x3a2fd0=0xce,_0x157236[_0x5874a8('0x57')](_0x3a2fd0),_0x157236[_0x5874a8('0x24')](_0x5874a8('0x34'),_0x1d5787+'-'+_0x182ce6+'/'+_0x59befe)[_0x5874a8('0xaf')](_0x3d6310);}return null;};}function saveUpdates(_0x255bec){return function(_0x356bd1){const _0x32b4e3=a186_0x4ee0;if(_0x356bd1)return _0x356bd1[_0x32b4e3('0x56')](_0x255bec)[_0x32b4e3('0x8a')](function(_0x1f6ee9){return _0x1f6ee9;});return null;};}function removeEntity(_0x52a099){return function(_0x23ef8a){const _0x25a3a2=a186_0x4ee0;if(_0x23ef8a)return _0x23ef8a[_0x25a3a2('0x80')]()[_0x25a3a2('0x8a')](function(){const _0x318240=_0x25a3a2,_0x7d1463=_0x23ef8a[_0x318240('0x22')]({'plain':!![]}),_0x232cba=_0x318240('0x60');return db[_0x318240('0x99')][_0x318240('0x80')]({'where':{'type':_0x232cba,'resourceId':_0x7d1463['id']}})['then'](function(){return _0x23ef8a;});})[_0x25a3a2('0x8a')](function(){const _0x5b3d28=_0x25a3a2;_0x52a099[_0x5b3d28('0x57')](0xcc)[_0x5b3d28('0x95')]();});};}function handleEntityNotFound(_0x524855){return function(_0x3ac95){const _0x4c74af=a186_0x4ee0;return!_0x3ac95&&_0x524855[_0x4c74af('0x3')](0x194),_0x3ac95;};}function handleError(_0x58f11e,_0x5cc8e0){return _0x5cc8e0=_0x5cc8e0||0x1f4,function(_0x2f3e3c){const _0x2b790f=a186_0x4ee0;logger[_0x2b790f('0x49')](_0x2f3e3c[_0x2b790f('0x1a')]),_0x2f3e3c[_0x2b790f('0x82')]&&delete _0x2f3e3c[_0x2b790f('0x82')],_0x58f11e[_0x2b790f('0x57')](_0x5cc8e0)[_0x2b790f('0x61')](_0x2f3e3c);};}exports[_0x559f70('0x5a')]=function(_0x41fadd,_0x450d39){const _0x20cf47=_0x559f70;let _0xc30c54={'include':[{'model':db[_0x20cf47('0x1d')],'as':_0x20cf47('0x8b')}]};const _0x2e61c0={},_0x2263e0={'count':0x0,'rows':[]},_0x5546d6=_[_0x20cf47('0x8')](db[_0x20cf47('0x88')][_0x20cf47('0x93')],function(_0x236bd0){const _0x980886=_0x20cf47;return{'name':_0x236bd0[_0x980886('0x72')],'type':_0x236bd0[_0x980886('0x91')]['key']};});_0x2e61c0[_0x20cf47('0x74')]=_[_0x20cf47('0x8')](_0x5546d6,'name'),_0x2e61c0['query']=_[_0x20cf47('0x7a')](_0x41fadd['query']),_0x2e61c0['filters']=_[_0x20cf47('0x76')](_0x2e61c0[_0x20cf47('0x74')],_0x2e61c0['query']),_0xc30c54[_0x20cf47('0x36')]=_[_0x20cf47('0x76')](_0x2e61c0[_0x20cf47('0x74')],qs[_0x20cf47('0x5c')](_0x41fadd[_0x20cf47('0x7f')][_0x20cf47('0x5c')])),_0xc30c54[_0x20cf47('0x36')]=_0xc30c54['attributes']['length']?_0xc30c54[_0x20cf47('0x36')]:_0x2e61c0['model'];typeof _0x41fadd['query'][_0x20cf47('0x4d')]===_0x20cf47('0x9d')&&(_0xc30c54[_0x20cf47('0x38')]=qs[_0x20cf47('0x38')](_0x41fadd[_0x20cf47('0x7f')]['limit']),_0xc30c54['offset']=qs[_0x20cf47('0x94')](_0x41fadd[_0x20cf47('0x7f')][_0x20cf47('0x94')]));_0xc30c54[_0x20cf47('0x62')]=qs[_0x20cf47('0x39')](_0x41fadd[_0x20cf47('0x7f')][_0x20cf47('0x39')]),_0xc30c54[_0x20cf47('0x26')]=qs['filters'](_[_0x20cf47('0x6a')](_0x41fadd[_0x20cf47('0x7f')],_0x2e61c0[_0x20cf47('0x1f')]),_0x5546d6);_0x41fadd[_0x20cf47('0x7f')]['filter']&&(_0xc30c54[_0x20cf47('0x26')]=_[_0x20cf47('0x7')](_0xc30c54[_0x20cf47('0x26')],{[Op['or']]:_[_0x20cf47('0x8')](_0x5546d6,function(_0x19c82f){const _0x165d76=_0x20cf47;if(_0x19c82f[_0x165d76('0x91')]!==_0x165d76('0x7e')){const _0x7ca805={};return _0x7ca805[_0x19c82f[_0x165d76('0x82')]]={[Op[_0x165d76('0x92')]]:'%'+_0x41fadd[_0x165d76('0x7f')][_0x165d76('0x47')]+'%'},_0x7ca805;}})}));_0xc30c54=_[_0x20cf47('0x7')]({},_0xc30c54,_0x41fadd[_0x20cf47('0x1c')]);const _0x223e7b={'where':_0xc30c54[_0x20cf47('0x26')]};return db[_0x20cf47('0x88')][_0x20cf47('0x3e')](_0x223e7b)[_0x20cf47('0x8a')](function(_0x421114){const _0x584d5a=_0x20cf47;return _0x2263e0[_0x584d5a('0x3e')]=_0x421114,_0x41fadd['query'][_0x584d5a('0x5b')]&&(_0xc30c54[_0x584d5a('0x98')]=[{'all':!![]}]),db[_0x584d5a('0x88')][_0x584d5a('0x4f')](_0xc30c54);})[_0x20cf47('0x8a')](function(_0x5b4f06){const _0x191aa0=_0x20cf47;return _0x2263e0[_0x191aa0('0xd')]=_0x5b4f06,_0x2263e0;})[_0x20cf47('0x8a')](respondWithFilteredResult(_0x450d39,_0xc30c54))['catch'](handleError(_0x450d39,null));},exports[_0x559f70('0x10')]=function(_0x421c44,_0x3ce157){const _0x18733c=_0x559f70;let _0x3b6d0d={'raw':![],'where':{'id':_0x421c44['params']['id']},'include':[{'model':db[_0x18733c('0x1d')],'as':_0x18733c('0x8b')}]};const _0x3d76b1={};return _0x3d76b1[_0x18733c('0x74')]=_[_0x18733c('0x7a')](db['FaxAccount'][_0x18733c('0x93')]),_0x3d76b1[_0x18733c('0x7f')]=_[_0x18733c('0x7a')](_0x421c44[_0x18733c('0x7f')]),_0x3d76b1[_0x18733c('0x1f')]=_[_0x18733c('0x76')](_0x3d76b1['model'],_0x3d76b1['query']),_0x3b6d0d[_0x18733c('0x36')]=_[_0x18733c('0x76')](_0x3d76b1[_0x18733c('0x74')],qs[_0x18733c('0x5c')](_0x421c44[_0x18733c('0x7f')][_0x18733c('0x5c')])),_0x3b6d0d[_0x18733c('0x36')]=_0x3b6d0d['attributes'][_0x18733c('0x59')]?_0x3b6d0d[_0x18733c('0x36')]:_0x3d76b1['model'],_0x421c44[_0x18733c('0x7f')][_0x18733c('0x5b')]&&(_0x3b6d0d[_0x18733c('0x98')]=[{'all':!![]}]),_0x3b6d0d=_[_0x18733c('0x7')]({},_0x3b6d0d,_0x421c44[_0x18733c('0x1c')]),db[_0x18733c('0x88')][_0x18733c('0x6b')](_0x3b6d0d)[_0x18733c('0x8a')](handleEntityNotFound(_0x3ce157,null))['then'](respondWithResult(_0x3ce157,null))['catch'](handleError(_0x3ce157,null));},exports[_0x559f70('0x18')]=function(_0x1dc253,_0x4d1560){const _0x4f21b7=_0x559f70;return db[_0x4f21b7('0x88')][_0x4f21b7('0x18')](_0x1dc253[_0x4f21b7('0x23')],{})[_0x4f21b7('0x8a')](function(_0x4d0b8e){const _0x41e180=_0x4f21b7,_0x3a98df=_0x1dc253[_0x41e180('0x9')][_0x41e180('0x22')]({'plain':!![]});if(!_0x3a98df)throw new Error(_0x41e180('0x3c'));if(_0x3a98df[_0x41e180('0x85')]===_0x41e180('0x9')){const _0x4a9b1b=_0x4d0b8e[_0x41e180('0x22')]({'plain':!![]}),_0x384d10=_0x41e180('0x60');return db['UserProfileSection']['findOne']({'where':{'name':_0x384d10,'userProfileId':_0x3a98df[_0x41e180('0x8c')]},'raw':!![]})[_0x41e180('0x8a')](function(_0x1621b2){const _0x473508=_0x41e180;return _0x1621b2&&_0x1621b2[_0x473508('0x5d')]===0x0?db[_0x473508('0x99')][_0x473508('0x18')]({'name':_0x4a9b1b[_0x473508('0x82')],'resourceId':_0x4a9b1b['id'],'type':_0x1621b2[_0x473508('0x82')],'sectionId':_0x1621b2['id']},{})['then'](function(){return _0x4d0b8e;}):_0x4d0b8e;})[_0x41e180('0x9a')](function(_0x30bfd4){const _0x5592a1=_0x41e180;logger[_0x5592a1('0x49')](_0x5592a1('0x15'),_0x30bfd4);throw _0x30bfd4;});}return _0x4d0b8e;})[_0x4f21b7('0x8a')](respondWithResult(_0x4d1560,0xc9))[_0x4f21b7('0x9a')](handleError(_0x4d1560,null));},exports['update']=function(_0x543b10,_0x195a0e){const _0x374fb3=_0x559f70;return _0x543b10[_0x374fb3('0x23')]['id']&&delete _0x543b10[_0x374fb3('0x23')]['id'],db[_0x374fb3('0x88')][_0x374fb3('0x6b')]({'where':{'id':_0x543b10[_0x374fb3('0xae')]['id']},'include':[{'model':db['Pause'],'as':_0x374fb3('0x8b')}]})[_0x374fb3('0x8a')](handleEntityNotFound(_0x195a0e,null))['then'](saveUpdates(_0x543b10[_0x374fb3('0x23')],null))[_0x374fb3('0x8a')](respondWithResult(_0x195a0e,null))[_0x374fb3('0x9a')](handleError(_0x195a0e,null));},exports['destroy']=function(_0x51ece4,_0x152b84){const _0x361457=_0x559f70;return db[_0x361457('0x88')]['findOne']({'where':{'id':_0x51ece4['params']['id']}})[_0x361457('0x8a')](handleEntityNotFound(_0x152b84,null))[_0x361457('0x8a')](removeEntity(_0x152b84,null))[_0x361457('0x9a')](handleError(_0x152b84,null));},exports[_0x559f70('0x8f')]=function(_0x2ed43b,_0x571564){const _0x1b002b=_0x559f70;return db[_0x1b002b('0x88')]['describe']()['then'](respondWithResult(_0x571564,null))[_0x1b002b('0x9a')](handleError(_0x571564,null));},exports[_0x559f70('0x40')]=function(_0x108e7c,_0x1917d2){const _0x59d96a=_0x559f70;return _0x108e7c[_0x59d96a('0x23')]['id']&&delete _0x108e7c[_0x59d96a('0x23')]['id'],db['FaxAccount'][_0x59d96a('0x6b')]({'where':{'id':_0x108e7c[_0x59d96a('0xae')]['id']}})[_0x59d96a('0x8a')](handleEntityNotFound(_0x1917d2,null))[_0x59d96a('0x8a')](function(_0x459a18){const _0x230e40=_0x59d96a;if(_0x459a18)return _0x108e7c[_0x230e40('0x23')][_0x230e40('0x63')]=_0x459a18['id'],db[_0x230e40('0x8e')][_0x230e40('0x18')](_0x108e7c[_0x230e40('0x23')]);})[_0x59d96a('0x8a')](respondWithResult(_0x1917d2,null))[_0x59d96a('0x9a')](handleError(_0x1917d2,null));},exports[_0x559f70('0x31')]=function(_0x4b9fb1,_0x51566f){const _0x59d1d1=_0x559f70;let _0x46bb05={'raw':![],'where':{}};const _0x23abc9={},_0x83a484={'count':0x0,'rows':[]};return db[_0x59d1d1('0x88')][_0x59d1d1('0x6b')]({'where':{'id':_0x4b9fb1[_0x59d1d1('0xae')]['id']}})[_0x59d1d1('0x8a')](handleEntityNotFound(_0x51566f,null))['then'](function(_0x434604){const _0x186a4d=_0x59d1d1;if(_0x434604)return _0x23abc9['model']=_[_0x186a4d('0x7a')](db['Disposition']['rawAttributes']),_0x23abc9[_0x186a4d('0x7f')]=_['keys'](_0x4b9fb1[_0x186a4d('0x7f')]),_0x23abc9[_0x186a4d('0x1f')]=_[_0x186a4d('0x76')](_0x23abc9[_0x186a4d('0x74')],_0x23abc9[_0x186a4d('0x7f')]),_0x46bb05[_0x186a4d('0x36')]=_[_0x186a4d('0x76')](_0x23abc9[_0x186a4d('0x74')],qs[_0x186a4d('0x5c')](_0x4b9fb1[_0x186a4d('0x7f')][_0x186a4d('0x5c')])),_0x46bb05['attributes']=_0x46bb05[_0x186a4d('0x36')][_0x186a4d('0x59')]?_0x46bb05['attributes']:_0x23abc9[_0x186a4d('0x74')],typeof _0x4b9fb1[_0x186a4d('0x7f')][_0x186a4d('0x4d')]===_0x186a4d('0x9d')&&(_0x46bb05[_0x186a4d('0x38')]=qs[_0x186a4d('0x38')](_0x4b9fb1[_0x186a4d('0x7f')]['limit']),_0x46bb05[_0x186a4d('0x94')]=qs[_0x186a4d('0x94')](_0x4b9fb1[_0x186a4d('0x7f')][_0x186a4d('0x94')])),_0x46bb05['order']=qs[_0x186a4d('0x39')](_0x4b9fb1['query'][_0x186a4d('0x39')]),_0x46bb05[_0x186a4d('0x26')]=qs['filters'](_[_0x186a4d('0x6a')](_0x4b9fb1[_0x186a4d('0x7f')],_0x23abc9[_0x186a4d('0x1f')])),_0x46bb05[_0x186a4d('0x26')]['FaxAccountId']=_0x434604['id'],_0x4b9fb1[_0x186a4d('0x7f')][_0x186a4d('0x47')]&&(_0x46bb05['where']=_[_0x186a4d('0x7')](_0x46bb05[_0x186a4d('0x26')],{[Op['or']]:_[_0x186a4d('0x8')](_0x46bb05[_0x186a4d('0x36')],function(_0x1c0ad1){const _0x58751c=_0x186a4d,_0x331997={};return _0x331997[_0x1c0ad1]={[Op[_0x58751c('0x92')]]:'%'+_0x4b9fb1[_0x58751c('0x7f')][_0x58751c('0x47')]+'%'},_0x331997;})})),_0x46bb05=_['merge']({},_0x46bb05,_0x4b9fb1[_0x186a4d('0x1c')]),db[_0x186a4d('0x8e')]['count']({'where':_0x46bb05[_0x186a4d('0x26')]})['then'](function(_0x22de7f){const _0x39b014=_0x186a4d;return _0x83a484['count']=_0x22de7f,_0x4b9fb1[_0x39b014('0x7f')][_0x39b014('0x5b')]&&(_0x46bb05[_0x39b014('0x98')]=[{'all':!![]}]),db[_0x39b014('0x8e')]['findAll'](_0x46bb05);})['then'](function(_0x376e70){const _0x5df3bd=_0x186a4d;return _0x83a484[_0x5df3bd('0xd')]=_0x376e70,_0x83a484;});})[_0x59d1d1('0x8a')](respondWithFilteredResult(_0x51566f,_0x46bb05))[_0x59d1d1('0x9a')](handleError(_0x51566f,null));},exports[_0x559f70('0x4a')]=function(_0xb17da5,_0x204769){const _0x3b7122=_0x559f70;return db['FaxAccount'][_0x3b7122('0x6b')]({'where':{'id':_0xb17da5['params']['id']}})[_0x3b7122('0x8a')](handleEntityNotFound(_0x204769,null))[_0x3b7122('0x8a')](function(_0x4b9ca6){const _0x11ef3d=_0x3b7122;if(_0x4b9ca6)return _0x4b9ca6[_0x11ef3d('0x4a')](_0xb17da5[_0x11ef3d('0x7f')][_0x11ef3d('0x5e')]);})['then'](respondWithStatusCode(_0x204769,null))[_0x3b7122('0x9a')](handleError(_0x204769,null));},exports['addAnswer']=function(_0x15596a,_0x35429e){const _0x1e1fc6=_0x559f70;return _0x15596a[_0x1e1fc6('0x23')]['id']&&delete _0x15596a[_0x1e1fc6('0x23')]['id'],db['FaxAccount'][_0x1e1fc6('0x6b')]({'where':{'id':_0x15596a[_0x1e1fc6('0xae')]['id']}})['then'](handleEntityNotFound(_0x35429e,null))[_0x1e1fc6('0x8a')](function(_0xf3b742){const _0x426949=_0x1e1fc6;if(_0xf3b742)return _0x15596a[_0x426949('0x23')][_0x426949('0x63')]=_0xf3b742['id'],db['CannedAnswer']['create'](_0x15596a[_0x426949('0x23')]);})[_0x1e1fc6('0x8a')](respondWithResult(_0x35429e,null))['catch'](handleError(_0x35429e,null));},exports[_0x559f70('0x29')]=function(_0x2d2a81,_0x34716b){const _0x5426ba=_0x559f70;let _0x17aa00={'raw':![],'where':{}};const _0x4237c6={},_0xd7a347={'count':0x0,'rows':[]};return db[_0x5426ba('0x88')][_0x5426ba('0x6b')]({'where':{'id':_0x2d2a81[_0x5426ba('0xae')]['id']}})[_0x5426ba('0x8a')](handleEntityNotFound(_0x34716b,null))[_0x5426ba('0x8a')](function(_0x5079dd){const _0xd8e941=_0x5426ba;if(_0x5079dd)return _0x4237c6[_0xd8e941('0x74')]=_[_0xd8e941('0x7a')](db[_0xd8e941('0x28')][_0xd8e941('0x93')]),_0x4237c6[_0xd8e941('0x7f')]=_[_0xd8e941('0x7a')](_0x2d2a81['query']),_0x4237c6['filters']=_[_0xd8e941('0x76')](_0x4237c6[_0xd8e941('0x74')],_0x4237c6[_0xd8e941('0x7f')]),_0x17aa00[_0xd8e941('0x36')]=_[_0xd8e941('0x76')](_0x4237c6[_0xd8e941('0x74')],qs[_0xd8e941('0x5c')](_0x2d2a81[_0xd8e941('0x7f')][_0xd8e941('0x5c')])),_0x17aa00['attributes']=_0x17aa00['attributes'][_0xd8e941('0x59')]?_0x17aa00[_0xd8e941('0x36')]:_0x4237c6['model'],typeof _0x2d2a81[_0xd8e941('0x7f')][_0xd8e941('0x4d')]==='undefined'&&(_0x17aa00[_0xd8e941('0x38')]=qs[_0xd8e941('0x38')](_0x2d2a81['query'][_0xd8e941('0x38')]),_0x17aa00[_0xd8e941('0x94')]=qs['offset'](_0x2d2a81[_0xd8e941('0x7f')][_0xd8e941('0x94')])),_0x17aa00[_0xd8e941('0x62')]=qs[_0xd8e941('0x39')](_0x2d2a81['query'][_0xd8e941('0x39')]),_0x17aa00['where']=qs[_0xd8e941('0x1f')](_[_0xd8e941('0x6a')](_0x2d2a81[_0xd8e941('0x7f')],_0x4237c6[_0xd8e941('0x1f')])),_0x17aa00['where'][_0xd8e941('0x63')]=_0x5079dd['id'],_0x2d2a81[_0xd8e941('0x7f')][_0xd8e941('0x47')]&&(_0x17aa00[_0xd8e941('0x26')]=_['merge'](_0x17aa00[_0xd8e941('0x26')],{[Op['or']]:_[_0xd8e941('0x8')](_0x17aa00[_0xd8e941('0x36')],function(_0x477e39){const _0x5237e5=_0xd8e941,_0x58f039={};return _0x58f039[_0x477e39]={[Op[_0x5237e5('0x92')]]:'%'+_0x2d2a81['query'][_0x5237e5('0x47')]+'%'},_0x58f039;})})),_0x17aa00=_[_0xd8e941('0x7')]({},_0x17aa00,_0x2d2a81[_0xd8e941('0x1c')]),db[_0xd8e941('0x28')]['count']({'where':_0x17aa00['where']})[_0xd8e941('0x8a')](function(_0x439b03){const _0xc1b41e=_0xd8e941;return _0xd7a347['count']=_0x439b03,_0x2d2a81[_0xc1b41e('0x7f')][_0xc1b41e('0x5b')]&&(_0x17aa00[_0xc1b41e('0x98')]=[{'all':!![]}]),db['CannedAnswer'][_0xc1b41e('0x4f')](_0x17aa00);})['then'](function(_0x51af45){return _0xd7a347['rows']=_0x51af45,_0xd7a347;});})['then'](respondWithFilteredResult(_0x34716b,_0x17aa00))[_0x5426ba('0x9a')](handleError(_0x34716b,null));},exports[_0x559f70('0x84')]=function(_0x3ae147,_0x16a64a){const _0x49b931=_0x559f70;return db['FaxAccount'][_0x49b931('0x6b')]({'where':{'id':_0x3ae147[_0x49b931('0xae')]['id']}})[_0x49b931('0x8a')](handleEntityNotFound(_0x16a64a,null))['then'](function(_0xbc0eb4){const _0x3296fc=_0x49b931;if(_0xbc0eb4)return _0xbc0eb4[_0x3296fc('0x84')](_0x3ae147[_0x3296fc('0x7f')]['ids']);})[_0x49b931('0x8a')](respondWithStatusCode(_0x16a64a,null))[_0x49b931('0x9a')](handleError(_0x16a64a,null));},exports[_0x559f70('0xa3')]=function(_0x2f6003,_0x1cad6f){const _0xec7b8c=_0x559f70;return db['FaxInteraction']['findOne']({'where':{'id':_0x2f6003[_0xec7b8c('0xae')]['id']}})[_0xec7b8c('0x8a')](function(_0x45a04f){const _0x52710c=_0xec7b8c;if(_0x45a04f)return _0x45a04f[_0x52710c('0xa3')](_0x2f6003[_0x52710c('0x23')][_0x52710c('0x5e')],{'through':_[_0x52710c('0x53')](_0x2f6003[_0x52710c('0x23')],['ids','id'])});})[_0xec7b8c('0x8a')](respondWithResult(_0x1cad6f,null))[_0xec7b8c('0x9a')](handleError(_0x1cad6f,null));},exports[_0x559f70('0x9c')]=function(_0x4a46d8,_0x6093ab){const _0x3cc23a=_0x559f70;let _0x43692b={'raw':![],'where':{}};const _0x516e20={},_0x3dc22e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4a46d8[_0x3cc23a('0xae')]['id']}})['then'](handleEntityNotFound(_0x6093ab,null))['then'](function(_0x3ebacc){const _0x51b6d2=_0x3cc23a;if(_0x3ebacc)return _0x516e20[_0x51b6d2('0x74')]=_[_0x51b6d2('0x7a')](db['FaxInteraction'][_0x51b6d2('0x93')]),_0x516e20[_0x51b6d2('0x7f')]=_[_0x51b6d2('0x7a')](_0x4a46d8[_0x51b6d2('0x7f')]),_0x516e20[_0x51b6d2('0x1f')]=_[_0x51b6d2('0x76')](_0x516e20[_0x51b6d2('0x74')],_0x516e20[_0x51b6d2('0x7f')]),_0x43692b[_0x51b6d2('0x36')]=_['intersection'](_0x516e20['model'],qs[_0x51b6d2('0x5c')](_0x4a46d8[_0x51b6d2('0x7f')]['fields'])),_0x43692b[_0x51b6d2('0x36')]=_0x43692b[_0x51b6d2('0x36')][_0x51b6d2('0x59')]?_0x43692b['attributes']:_0x516e20[_0x51b6d2('0x74')],typeof _0x4a46d8[_0x51b6d2('0x7f')][_0x51b6d2('0x4d')]==='undefined'&&(_0x43692b[_0x51b6d2('0x38')]=qs[_0x51b6d2('0x38')](_0x4a46d8['query'][_0x51b6d2('0x38')]),_0x43692b[_0x51b6d2('0x94')]=qs[_0x51b6d2('0x94')](_0x4a46d8[_0x51b6d2('0x7f')][_0x51b6d2('0x94')])),_0x43692b[_0x51b6d2('0x62')]=qs['sort'](_0x4a46d8[_0x51b6d2('0x7f')]['sort']),_0x43692b['where']=qs['filters'](_['pick'](_0x4a46d8[_0x51b6d2('0x7f')],_0x516e20[_0x51b6d2('0x1f')])),_0x43692b['where'][_0x51b6d2('0x63')]=_0x3ebacc['id'],_0x4a46d8[_0x51b6d2('0x7f')][_0x51b6d2('0x47')]&&(_0x43692b['where']=_[_0x51b6d2('0x7')](_0x43692b[_0x51b6d2('0x26')],{[Op['or']]:_[_0x51b6d2('0x8')](_0x43692b[_0x51b6d2('0x36')],function(_0x5def00){const _0x53e572=_0x51b6d2,_0x34db49={};return _0x34db49[_0x5def00]={[Op[_0x53e572('0x92')]]:'%'+_0x4a46d8[_0x53e572('0x7f')]['filter']+'%'},_0x34db49;})})),_0x43692b=_[_0x51b6d2('0x7')]({},_0x43692b,_0x4a46d8['options']),db[_0x51b6d2('0xa')][_0x51b6d2('0x3e')]({'where':_0x43692b[_0x51b6d2('0x26')]})[_0x51b6d2('0x8a')](function(_0x5511c6){const _0x41456f=_0x51b6d2;return _0x3dc22e['count']=_0x5511c6,_0x4a46d8['query'][_0x41456f('0x5b')]&&(_0x43692b['include']=[{'model':db[_0x41456f('0x70')],'as':_0x41456f('0x48'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x41456f('0x27'),_0x41456f('0xa4')],'required':![]},{'model':db[_0x41456f('0x2f')],'as':_0x41456f('0x58'),'attributes':['id',_0x41456f('0x82'),_0x41456f('0xb')],'where':_0x4a46d8[_0x41456f('0x7f')][_0x41456f('0x3a')]?{'id':_0x4a46d8[_0x41456f('0x7f')][_0x41456f('0x3a')]}:undefined,'required':_0x4a46d8[_0x41456f('0x7f')][_0x41456f('0x3a')]?!![]:![]}]),db[_0x41456f('0xa')][_0x41456f('0x4f')](_0x43692b);})[_0x51b6d2('0x8a')](function(_0x4586dd){const _0x471f46=_0x51b6d2;return _0x3dc22e[_0x471f46('0xd')]=_0x4586dd,_0x3dc22e;});})[_0x3cc23a('0x8a')](respondWithFilteredResult(_0x6093ab,_0x43692b))['catch'](handleError(_0x6093ab,null));},exports[_0x559f70('0x67')]=function(_0x349bcf,_0x3182f1){const _0x2e34ed=_0x559f70;return db[_0x2e34ed('0x88')][_0x2e34ed('0x6b')]({'where':{'id':_0x349bcf['params']['id']}})[_0x2e34ed('0x8a')](handleEntityNotFound(_0x3182f1,null))[_0x2e34ed('0x8a')](function(_0x282fd6){const _0x1dfcc7=_0x2e34ed;if(_0x282fd6)return db[_0x1dfcc7('0x5f')]['transaction'](function(_0x4b517){const _0x12b2d8=_0x1dfcc7;return db[_0x12b2d8('0x90')][_0x12b2d8('0x80')]({'where':{'FaxAccountId':_0x349bcf[_0x12b2d8('0xae')]['id']},'transaction':_0x4b517})[_0x12b2d8('0x8a')](function(){const _0x550457=_0x12b2d8,_0x2766a8=_[_0x550457('0x8')](_0x349bcf[_0x550457('0x23')],function(_0xa829b2){const _0x70abac=_0x550457;return _0xa829b2[_0x70abac('0x63')]=_0x349bcf[_0x70abac('0xae')]['id'],_0xa829b2;});return db['FaxApplication'][_0x550457('0x35')](_0x2766a8,{'transaction':_0x4b517});});})[_0x1dfcc7('0x8a')](function(){const _0x2f8e95=_0x1dfcc7;return db[_0x2f8e95('0x90')][_0x2f8e95('0x78')]({'where':{'FaxAccountId':_0x349bcf[_0x2f8e95('0xae')]['id']},'order':_0x2f8e95('0x6e')});});})[_0x2e34ed('0x8a')](respondWithResult(_0x3182f1,null))['catch'](handleError(_0x3182f1,null));},exports[_0x559f70('0x41')]=function(_0xf19d9b,_0x23b85c){const _0x6c88da=_0x559f70;let _0x1c9487={};const _0x2e55cd={};let _0x79baf6,_0x5e7fff;return db[_0x6c88da('0x88')]['findOne']({'where':{'id':_0xf19d9b[_0x6c88da('0xae')]['id']}})['then'](handleEntityNotFound(_0x23b85c,null))[_0x6c88da('0x8a')](function(_0x16bc77){const _0x875fdc=_0x6c88da;if(_0x16bc77)return _0x79baf6=_0x16bc77,_0x2e55cd[_0x875fdc('0x74')]=_[_0x875fdc('0x7a')](db[_0x875fdc('0x90')][_0x875fdc('0x93')]),_0x2e55cd[_0x875fdc('0x7f')]=_[_0x875fdc('0x7a')](_0xf19d9b[_0x875fdc('0x7f')]),_0x2e55cd[_0x875fdc('0x1f')]=_[_0x875fdc('0x76')](_0x2e55cd['model'],_0x2e55cd[_0x875fdc('0x7f')]),_0x1c9487[_0x875fdc('0x36')]=_[_0x875fdc('0x76')](_0x2e55cd[_0x875fdc('0x74')],qs[_0x875fdc('0x5c')](_0xf19d9b[_0x875fdc('0x7f')]['fields'])),_0x1c9487[_0x875fdc('0x36')]=_0x1c9487[_0x875fdc('0x36')]['length']?_0x1c9487[_0x875fdc('0x36')]:_0x2e55cd[_0x875fdc('0x74')],_0x1c9487[_0x875fdc('0x62')]=qs[_0x875fdc('0x39')](_0xf19d9b[_0x875fdc('0x7f')][_0x875fdc('0x39')]),_0x1c9487['where']=qs[_0x875fdc('0x1f')](_[_0x875fdc('0x6a')](_0xf19d9b[_0x875fdc('0x7f')],_0x2e55cd[_0x875fdc('0x1f')])),_0xf19d9b[_0x875fdc('0x7f')]['filter']&&(_0x1c9487[_0x875fdc('0x26')]=_[_0x875fdc('0x7')](_0x1c9487[_0x875fdc('0x26')],{[Op['or']]:_[_0x875fdc('0x8')](_0x1c9487[_0x875fdc('0x36')],function(_0x19314a){const _0x296e33={};return _0x296e33[_0x19314a]={[Op['like']]:'%'+_0xf19d9b['query']['filter']+'%'},_0x296e33;})})),_0x1c9487=_[_0x875fdc('0x7')]({},_0x1c9487,_0xf19d9b[_0x875fdc('0x1c')]),_0x79baf6[_0x875fdc('0x41')](_0x1c9487);})[_0x6c88da('0x8a')](function(_0x5a992b){const _0x518634=_0x6c88da;if(_0x5a992b)return _0x5e7fff=_0x5a992b[_0x518634('0x59')],typeof _0xf19d9b[_0x518634('0x7f')][_0x518634('0x4d')]===_0x518634('0x9d')&&(_0x1c9487['limit']=qs[_0x518634('0x38')](_0xf19d9b[_0x518634('0x7f')][_0x518634('0x38')]),_0x1c9487[_0x518634('0x94')]=qs[_0x518634('0x94')](_0xf19d9b['query'][_0x518634('0x94')])),_0x79baf6[_0x518634('0x41')](_0x1c9487);})['then'](function(_0x19a770){if(_0x19a770)return _0x19a770?{'count':_0x5e7fff,'rows':_0x19a770}:null;})[_0x6c88da('0x8a')](respondWithResult(_0x23b85c,null))[_0x6c88da('0x9a')](handleError(_0x23b85c,null));};function Extension(_0x3a0127,_0x26bcd6,_0xf56943,_0x35118a){const _0x7c5cda=_0x559f70;this[_0x7c5cda('0x13')]=_0x7c5cda('0x30'),this[_0x7c5cda('0x6c')]=_0x3a0127[_0x7c5cda('0x12')],this['app']=_0x35118a,this['type']='system',this[_0x7c5cda('0x3b')]=_0x7c5cda('0x11'),this[_0x7c5cda('0x63')]=_0x3a0127['id'],this[_0x7c5cda('0x6e')]=_0x26bcd6,this[_0x7c5cda('0x7d')]=_0xf56943;}function createExtensionsReciveFax(_0x5dad1e){const _0x42f95a=_0x559f70;let _0x405a52=0x1;const _0x1c5a3e=[];_0x1c5a3e[_0x42f95a('0x42')](new Extension(_0x5dad1e,_0x405a52,'','Answer')),_0x405a52+=0x1,_0x1c5a3e[_0x42f95a('0x42')](new Extension(_0x5dad1e,_0x405a52,_0x42f95a('0x8d'),_0x42f95a('0xaa'))),_0x405a52+=0x1;for(const _0x1ab1ec in _0x5dad1e){typeof _0x5dad1e[_0x1ab1ec]!=='undefined'&&(_0x1ab1ec==='ecm'||_0x1ab1ec==='localstationid'||_0x1ab1ec===_0x42f95a('0x69')||_0x1ab1ec===_0x42f95a('0x2')||_0x1ab1ec===_0x42f95a('0x19')||_0x1ab1ec===_0x42f95a('0x2d')||_0x1ab1ec===_0x42f95a('0x9b')||_0x1ab1ec==='modem'||_0x1ab1ec===_0x42f95a('0x32'))&&(_0x1c5a3e[_0x42f95a('0x42')](new Extension(_0x5dad1e,_0x405a52,_0x42f95a('0x20')+_0x1ab1ec+')='+_0x5dad1e[_0x1ab1ec],'Set')),_0x405a52+=0x1);}return _0x1c5a3e['push'](new Extension(_0x5dad1e,_0x405a52,'6',_0x42f95a('0x3d'))),_0x405a52+=0x1,_0x1c5a3e[_0x42f95a('0x42')](new Extension(_0x5dad1e,_0x405a52,_0x42f95a('0x21'),'ReceiveFax')),_0x405a52=0x0,_0x1c5a3e;}exports[_0x559f70('0x1e')]=function(_0x138173,_0x3e9a3c){const _0x4ba83d=_0x559f70;let _0x2a6070;return db[_0x4ba83d('0x5f')][_0x4ba83d('0x17')](function(_0x2c4aaa){const _0x42f07f=_0x4ba83d;return db['FaxAccount']['create'](_0x138173['body'],{'transaction':_0x2c4aaa})[_0x42f07f('0x8a')](function(_0x209da8){const _0x2016d1=_0x42f07f;return _0x2a6070=_0x209da8[_0x2016d1('0x22')]({'plain':!![]}),db[_0x2016d1('0xa7')]['bulkCreate'](createExtensionsReciveFax(_0x2a6070),{'transaction':_0x2c4aaa});});})['then'](function(){return _0x2a6070;})['then'](respondWithResult(_0x3e9a3c,null))[_0x4ba83d('0x9a')](handleError(_0x3e9a3c,null));},exports[_0x559f70('0x1b')]=function(_0xb1d3ac,_0x3aa8fd){const _0x47e2f2=_0x559f70;return db[_0x47e2f2('0x5f')]['transaction'](function(_0x32742a){const _0x535603=_0x47e2f2;return db[_0x535603('0x88')][_0x535603('0x56')](_0xb1d3ac[_0x535603('0x23')],{'where':{'id':_0xb1d3ac['body']['id']},'transaction':_0x32742a})['then'](function(){const _0x493de2=_0x535603;return db[_0x493de2('0xa7')][_0x493de2('0x80')]({'where':{'FaxAccountId':_0xb1d3ac[_0x493de2('0x23')]['id']},'transaction':_0x32742a})[_0x493de2('0x8a')](function(){const _0x29cb70=_0x493de2;return db['VoiceExtension'][_0x29cb70('0x35')](createExtensionsReciveFax(_[_0x29cb70('0x53')](_0xb1d3ac[_0x29cb70('0x23')],[_0x29cb70('0x7c'),'key',_0x29cb70('0xe'),_0x29cb70('0x97'),_0x29cb70('0x54'),_0x29cb70('0x25')])),{'transaction':_0x32742a});});});})['then'](function(){const _0x1a05a1=_0x47e2f2;return db[_0x1a05a1('0x88')]['findByPk'](_0xb1d3ac[_0x1a05a1('0x23')]['id']);})[_0x47e2f2('0x8a')](respondWithResult(_0x3aa8fd,null))[_0x47e2f2('0x9a')](handleError(_0x3aa8fd,null));},exports[_0x559f70('0x52')]=function(_0x3bfa28,_0x25a687){const _0xf63961=_0x559f70;let _0x357968={'raw':!![],'where':{}};const _0x2dc108={},_0x4d281e={'count':0x0,'rows':[]};return db[_0xf63961('0x88')][_0xf63961('0x6b')]({'where':{'id':_0x3bfa28[_0xf63961('0xae')]['id']}})[_0xf63961('0x8a')](handleEntityNotFound(_0x25a687,null))[_0xf63961('0x8a')](function(_0x4d70b2){const _0x2c55f2=_0xf63961;if(_0x4d70b2){_0x2dc108['model']=_[_0x2c55f2('0x7a')](db[_0x2c55f2('0x89')][_0x2c55f2('0x93')]),_0x2dc108['query']=_['keys'](_0x3bfa28[_0x2c55f2('0x7f')]),_0x2dc108['filters']=_[_0x2c55f2('0x76')](_0x2dc108[_0x2c55f2('0x74')],_0x2dc108[_0x2c55f2('0x7f')]),_0x357968[_0x2c55f2('0x36')]=_[_0x2c55f2('0x76')](_0x2dc108[_0x2c55f2('0x74')],qs[_0x2c55f2('0x5c')](_0x3bfa28[_0x2c55f2('0x7f')][_0x2c55f2('0x5c')])),_0x357968[_0x2c55f2('0x36')]=_0x357968[_0x2c55f2('0x36')][_0x2c55f2('0x59')]?_0x357968['attributes']:_0x2dc108[_0x2c55f2('0x74')];typeof _0x3bfa28['query'][_0x2c55f2('0x4d')]===_0x2c55f2('0x9d')&&(_0x357968['limit']=qs[_0x2c55f2('0x38')](_0x3bfa28[_0x2c55f2('0x7f')]['limit']),_0x357968[_0x2c55f2('0x94')]=qs[_0x2c55f2('0x94')](_0x3bfa28['query'][_0x2c55f2('0x94')]));_0x357968[_0x2c55f2('0x62')]=qs['sort'](_0x3bfa28['query']['sort']),_0x357968[_0x2c55f2('0x26')]=qs[_0x2c55f2('0x1f')](_[_0x2c55f2('0x6a')](_0x3bfa28[_0x2c55f2('0x7f')],_0x2dc108['filters'])),_0x357968[_0x2c55f2('0x26')][_0x2c55f2('0x63')]=_0x4d70b2['id'];_0x3bfa28[_0x2c55f2('0x7f')][_0x2c55f2('0x47')]&&(_0x357968[_0x2c55f2('0x26')]=_[_0x2c55f2('0x7')](_0x357968[_0x2c55f2('0x26')],{[Op['or']]:_[_0x2c55f2('0x8')](_0x357968[_0x2c55f2('0x36')],function(_0x5e1798){const _0x36002c=_0x2c55f2,_0x2a6f55={};return _0x2a6f55[_0x5e1798]={[Op['like']]:'%'+_0x3bfa28['query'][_0x36002c('0x47')]+'%'},_0x2a6f55;})}));if(_0x3bfa28[_0x2c55f2('0x7f')][_0x2c55f2('0x44')]){const _0x3018b8=_0x3bfa28[_0x2c55f2('0x7f')][_0x2c55f2('0x44')][_0x2c55f2('0xa9')](','),_0x4f3332={};_0x4f3332[_0x3018b8[0x0]]={[Op['gte']]:moment(_0x3018b8[0x1])[_0x2c55f2('0xa5')](_0x2c55f2('0x14'))},_0x357968[_0x2c55f2('0x26')]=_[_0x2c55f2('0x7')](_0x357968[_0x2c55f2('0x26')],_0x4f3332);}return _0x357968=_[_0x2c55f2('0x7')]({},_0x357968,_0x3bfa28[_0x2c55f2('0x1c')]),db[_0x2c55f2('0x89')][_0x2c55f2('0x3e')]({'where':_0x357968[_0x2c55f2('0x26')]})[_0x2c55f2('0x8a')](function(_0x5a52b3){const _0x41437b=_0x2c55f2;return _0x4d281e['count']=_0x5a52b3,_0x3bfa28[_0x41437b('0x7f')][_0x41437b('0x5b')]&&(_0x357968[_0x41437b('0x98')]=[{'all':!![]}]),db[_0x41437b('0x89')]['findAll'](_0x357968);})[_0x2c55f2('0x8a')](function(_0x468cf4){const _0x1db17d=_0x2c55f2;return _0x4d281e[_0x1db17d('0xd')]=_0x468cf4,_0x4d281e;});}})[_0xf63961('0x8a')](respondWithFilteredResult(_0x25a687,_0x357968))[_0xf63961('0x9a')](handleError(_0x25a687,null));},exports[_0x559f70('0x61')]=function(_0x59ba1c,_0x1f9b26){const _0x2f16ce=_0x559f70;let _0x3d41b9,_0x42d5b4;return _0x59ba1c[_0x2f16ce('0x23')]['to']&&(_0x42d5b4=_0x59ba1c[_0x2f16ce('0x23')]['to'][0x0]),db[_0x2f16ce('0x88')][_0x2f16ce('0x6b')]({'where':{'id':_0x59ba1c[_0x2f16ce('0xae')]['id']},'include':[{'model':db[_0x2f16ce('0x87')],'as':_0x2f16ce('0x50'),'include':[{'model':db[_0x2f16ce('0x70')],'as':_0x2f16ce('0x75'),'where':{'fax':_0x42d5b4},'limit':0x1,'order':[[_0x2f16ce('0x97'),'DESC']]}]}]})[_0x2f16ce('0x8a')](handleEntityNotFound(_0x1f9b26,null))[_0x2f16ce('0x8a')](function(_0x5c7f87){const _0x2e011b=_0x2f16ce;_0x3d41b9=_0x5c7f87;if(_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')]&&_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')][_0x2e011b('0x59')])for(let _0x59727c=0x0;_0x59727c<_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')]['length'];_0x59727c+=0x1){_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')][_0x59727c]={'filename':_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')][_0x59727c][_0x2e011b('0x82')],'id':_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')][_0x59727c]['id'],'path':path[_0x2e011b('0x5')](config[_0x2e011b('0xa0')],_0x2e011b('0xa6'),_0x59ba1c['body']['attachments'][_0x59727c][_0x2e011b('0x6f')])};}return respondWithRpcPromise(_0x2e011b('0x2b'),_0x2e011b('0x2b'),{'FaxAccountId':_[_0x2e011b('0x81')](_0x59ba1c[_0x2e011b('0xae')]['id'])?undefined:_0x59ba1c['params']['id'],'path':_[_0x2e011b('0x81')](_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')][0x0]['path'])?undefined:_0x59ba1c[_0x2e011b('0x23')][_0x2e011b('0xab')][0x0][_0x2e011b('0x71')],'fax':_['isNil'](_0x59ba1c[_0x2e011b('0x23')]['to'][0x0])?undefined:_0x59ba1c[_0x2e011b('0x23')]['to'][0x0]},client9002);})['then'](function(){const _0xe7010a=_0x2f16ce;if(_0x3d41b9){_['isNil'](_0x59ba1c['body'][_0xe7010a('0x73')])&&(_0x59ba1c['body'][_0xe7010a('0x73')]=util['format'](_0xe7010a('0x51'),_0x3d41b9[_0xe7010a('0x82')],_0x3d41b9[_0xe7010a('0xad')]));if(_0x3d41b9[_0xe7010a('0x50')])return _0x3d41b9[_0xe7010a('0x50')][_0xe7010a('0x75')][_0xe7010a('0x59')]?_0x3d41b9[_0xe7010a('0x50')][_0xe7010a('0x75')][0x0]:db[_0xe7010a('0x70')]['create'](_[_0xe7010a('0xa1')](_0x59ba1c['body'],{'firstName':_0x59ba1c[_0xe7010a('0x23')]['to'][0x0],'phone':_0x59ba1c[_0xe7010a('0x23')]['to'][0x0],'fax':_0x59ba1c['body']['to'][0x0],'ListId':_0x3d41b9[_0xe7010a('0x25')]}));else throw new Error(_0xe7010a('0x66'));}else throw new Error(_0xe7010a('0x3f'));})['then'](function(_0x9db280){const _0x2a45e9=_0x2f16ce;if(_0x9db280)return db[_0x2a45e9('0xa')][_0x2a45e9('0x6b')]({'where':{'ContactId':_0x9db280['id'],'closed':![],'FaxAccountId':_0x3d41b9['id']}})[_0x2a45e9('0x8a')](function(_0x5b94bb){const _0x2a99e0=_0x2a45e9;if(_0x5b94bb)return[_0x5b94bb,![]];return db['FaxInteraction'][_0x2a99e0('0x18')]({'UserId':_0x59ba1c['user']['id'],'ContactId':_0x9db280['id'],'FaxAccountId':_0x3d41b9['id'],'fax':_0x59ba1c['body']['to'][0x0],'firstMsgDirection':_0x2a99e0('0x1'),'Messages':[_[_0x2a99e0('0x7')](_0x59ba1c[_0x2a99e0('0x23')],{'read':![],'body':_0x59ba1c[_0x2a99e0('0x23')][_0x2a99e0('0xab')][0x0][_0x2a99e0('0x46')],'FaxAccountId':_0x3d41b9['id'],'UserId':_0x59ba1c[_0x2a99e0('0x9')]['id'],'ContactId':_0x9db280['id'],'AttachmentId':_0x59ba1c[_0x2a99e0('0x23')][_0x2a99e0('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x2a99e0('0xa8')}]})[_0x2a99e0('0x8a')](function(_0x151870){return[_0x151870,!![]];});});else throw new Error('Contact\x20not\x20found');})[_0x2f16ce('0x8a')](function([_0x39809d,_0x26d211]){const _0x58361c=_0x2f16ce;if(_0x26d211)return _0x39809d;return db[_0x58361c('0x89')][_0x58361c('0x18')]({'direction':_0x58361c('0x1'),'read':![],'body':_0x59ba1c[_0x58361c('0x23')]['attachments'][0x0][_0x58361c('0x46')],'FaxAccountId':_0x3d41b9['id'],'FaxInteractionId':_0x39809d['id'],'UserId':_0x59ba1c['user']['id'],'ContactId':_0x39809d[_0x58361c('0x33')],'AttachmentId':_0x59ba1c[_0x58361c('0x23')]['attachments'][0x0]['id']})[_0x58361c('0x8a')](function(_0x43df1d){const _0x51bfe0=_0x58361c;return _0x39809d[_0x51bfe0('0xf')][_0x51bfe0('0xa8')]=[],_0x39809d[_0x51bfe0('0xf')][_0x51bfe0('0xa8')][_0x51bfe0('0x42')](_0x43df1d[_0x51bfe0('0xf')]),_0x39809d;});})['then'](function(_0x5e1ee3){const _0xdee675=_0x2f16ce;return respondWithRpcPromise(_0xdee675('0x6'),'SendFax',{'FaxAccountId':_[_0xdee675('0x81')](_0x59ba1c[_0xdee675('0xae')]['id'])?undefined:_0x59ba1c[_0xdee675('0xae')]['id'],'path':_[_0xdee675('0x81')](_0x59ba1c[_0xdee675('0x23')][_0xdee675('0xab')][0x0][_0xdee675('0x71')])?undefined:_0x59ba1c[_0xdee675('0x23')][_0xdee675('0xab')][0x0][_0xdee675('0x71')],'fax':_[_0xdee675('0x81')](_0x59ba1c['body']['to'][0x0])?undefined:_0x59ba1c['body']['to'][0x0],'AttachmentId':_0x59ba1c[_0xdee675('0x23')][_0xdee675('0xab')][0x0]['id']},client9002)[_0xdee675('0x8a')](function(_0x55b8ab){const _0x4ad075=_0xdee675;logger[_0x4ad075('0x2e')](_0x4ad075('0x2c'),_0x55b8ab);})[_0xdee675('0x9a')](function(_0x53c5ec){const _0x2c4315=_0xdee675;logger[_0x2c4315('0x2e')]('SendFaxRpc,\x20%s',_0x53c5ec);}),_0x5e1ee3;})['then'](respondWithResult(_0x1f9b26,null))[_0x2f16ce('0x9a')](handleError(_0x1f9b26,null));},exports['addAgents']=function(_0x55484a,_0x39225b){const _0x112f18=_0x559f70;return db[_0x112f18('0x88')][_0x112f18('0x6b')]({'where':{'id':_0x55484a[_0x112f18('0xae')]['id']}})[_0x112f18('0x8a')](function(_0x401e7d){const _0x34c9ac=_0x112f18;if(_0x401e7d)return _0x401e7d[_0x34c9ac('0xa2')](_0x55484a[_0x34c9ac('0x23')][_0x34c9ac('0x5e')],{'through':_['omit'](_0x55484a[_0x34c9ac('0x23')],[_0x34c9ac('0x5e'),'id'])})[_0x34c9ac('0x8a')](function(_0x5de288){const _0x2e2f1e=_0x34c9ac;for(let _0x3e5e99=0x0;_0x3e5e99<_0x55484a[_0x2e2f1e('0x23')][_0x2e2f1e('0x5e')][_0x2e2f1e('0x59')];_0x3e5e99+=0x1){socket[_0x2e2f1e('0x86')](_0x2e2f1e('0x68'),{'UserId':_0x55484a[_0x2e2f1e('0x23')][_0x2e2f1e('0x5e')][_0x3e5e99],'FaxAccountId':_0x55484a[_0x2e2f1e('0xae')]['id']});}return _0x5de288;});})[_0x112f18('0x8a')](respondWithResult(_0x39225b,null))[_0x112f18('0x9a')](handleError(_0x39225b,null));},exports['removeAgents']=function(_0x23a58d,_0x5e6683){const _0x42243b=_0x559f70;return db['FaxAccount']['findOne']({'where':{'id':_0x23a58d['params']['id']}})[_0x42243b('0x8a')](handleEntityNotFound(_0x5e6683,null))['then'](function(_0x2fa58c){const _0x26abd4=_0x42243b;if(_0x2fa58c)return _0x2fa58c['removeAgents'](_0x23a58d['query']['ids'])[_0x26abd4('0x8a')](function(){const _0xe0b25d=_0x26abd4;if(_['isArray'](_0x23a58d['query'][_0xe0b25d('0x5e')]))for(let _0x5de409=0x0;_0x5de409<_0x23a58d['query'][_0xe0b25d('0x5e')][_0xe0b25d('0x59')];_0x5de409+=0x1){socket[_0xe0b25d('0x86')](_0xe0b25d('0x7b'),{'UserId':Number(_0x23a58d['query']['ids'][_0x5de409]),'FaxAccountId':Number(_0x23a58d[_0xe0b25d('0xae')]['id'])});}else socket[_0xe0b25d('0x86')](_0xe0b25d('0x7b'),{'UserId':Number(_0x23a58d[_0xe0b25d('0x7f')][_0xe0b25d('0x5e')]),'FaxAccountId':Number(_0x23a58d[_0xe0b25d('0xae')]['id'])});});})['then'](respondWithStatusCode(_0x5e6683,null))[_0x42243b('0x9a')](handleError(_0x5e6683,null));},exports[_0x559f70('0x9f')]=function(_0xeef999,_0x50ee98){const _0x7ecdc8=_0x559f70;let _0x10c5c5={};const _0x3dde54={};let _0x1b9362,_0x3464d3;return db['FaxAccount']['findOne']({'where':{'id':_0xeef999['params']['id']}})[_0x7ecdc8('0x8a')](handleEntityNotFound(_0x50ee98,null))[_0x7ecdc8('0x8a')](function(_0x5b7ac4){const _0x553aea=_0x7ecdc8;if(_0x5b7ac4)return _0x1b9362=_0x5b7ac4,_0x3dde54[_0x553aea('0x74')]=_[_0x553aea('0x7a')](db['User']['rawAttributes']),_0x3dde54[_0x553aea('0x7f')]=_[_0x553aea('0x7a')](_0xeef999[_0x553aea('0x7f')]),_0x3dde54[_0x553aea('0x1f')]=_[_0x553aea('0x76')](_0x3dde54[_0x553aea('0x74')],_0x3dde54[_0x553aea('0x7f')]),_0x10c5c5[_0x553aea('0x36')]=_[_0x553aea('0x76')](_0x3dde54[_0x553aea('0x74')],qs[_0x553aea('0x5c')](_0xeef999[_0x553aea('0x7f')][_0x553aea('0x5c')])),_0x10c5c5[_0x553aea('0x36')]=_0x10c5c5[_0x553aea('0x36')]['length']?_0x10c5c5['attributes']:_0x3dde54[_0x553aea('0x74')],_0x10c5c5[_0x553aea('0x62')]=qs[_0x553aea('0x39')](_0xeef999[_0x553aea('0x7f')][_0x553aea('0x39')]),_0x10c5c5[_0x553aea('0x26')]=qs['filters'](_[_0x553aea('0x6a')](_0xeef999[_0x553aea('0x7f')],_0x3dde54[_0x553aea('0x1f')])),_0xeef999[_0x553aea('0x7f')]['filter']&&(_0x10c5c5[_0x553aea('0x26')]=_['merge'](_0x10c5c5[_0x553aea('0x26')],{[Op['or']]:_[_0x553aea('0x8')](_0x10c5c5[_0x553aea('0x36')],function(_0x2d7a22){const _0x17cc25=_0x553aea,_0xef87e7={};return _0xef87e7[_0x2d7a22]={[Op[_0x17cc25('0x92')]]:'%'+_0xeef999[_0x17cc25('0x7f')][_0x17cc25('0x47')]+'%'},_0xef87e7;})})),_0x10c5c5=_[_0x553aea('0x7')]({},_0x10c5c5,_0xeef999[_0x553aea('0x1c')]),_0x1b9362[_0x553aea('0x9f')](_0x10c5c5);})[_0x7ecdc8('0x8a')](function(_0x3d00ee){const _0x4621db=_0x7ecdc8;if(_0x3d00ee)return _0x3464d3=_0x3d00ee[_0x4621db('0x59')],typeof _0xeef999[_0x4621db('0x7f')]['nolimit']===_0x4621db('0x9d')&&(_0x10c5c5[_0x4621db('0x38')]=qs[_0x4621db('0x38')](_0xeef999['query'][_0x4621db('0x38')]),_0x10c5c5[_0x4621db('0x94')]=qs[_0x4621db('0x94')](_0xeef999[_0x4621db('0x7f')]['offset'])),_0x1b9362['getAgents'](_0x10c5c5);})['then'](function(_0x2dbd2f){if(_0x2dbd2f)return _0x2dbd2f?{'count':_0x3464d3,'rows':_0x2dbd2f}:null;})[_0x7ecdc8('0x8a')](respondWithResult(_0x50ee98,null))[_0x7ecdc8('0x9a')](handleError(_0x50ee98,null));};
\ No newline at end of file
+const a186_0x2f60=['count','Disposition','name','Messages','nolimit','map','transaction','client','app','Content-Range','color','CmContact','dataValues','like','$gte','attributes','FaxAccount','FaxMessage','push','stack','request','context','Contacts','findOne','request\x20sent','tag','t38timeout','ids','api','./faxAccount.socket','../../config/environment','Pause','undefined','info','emit','addDisposition','getApplications','moment','fields','FaxInteraction','describe','pick','localstationid','../../config/logger','basename','intersection','UserProfileResource','create','http','catch','error','Unable\x20to\x20retrieve\x20the\x20current\x20user','userFaxAccount:save','updatedAt','order','from-voip-provider','removeDispositions','server/files/attachments','filename','role','sort','FaxAccount,\x20%s,\x20%s','createdAt','omit','addInteraction','../../mysqldb','sendStatus','where','Fax\x20Extension','priority','limit','json','ListId','include','Tags','findAndCountAll','userProfileId','offset','ReceiveFax','result','CmList','isNil','then','path','user','CannedAnswer','headerinfo','status','autoAssociation','ecm','List','type','params','Set','addAgents','destroy','send','SendFaxRpc,\x20%s','key','format','from','util','getAgents','Send\x20Fax\x20failed','findByPk','internal','body','CheckAfterSend','FaxApplication','options','includeAll','get','stringify','\x22%s\x22\x20<%s>','addApplications','Wait','SendFax','defaults','set','description','FaxAccounts','gateway','out','sequelize','updateAccountApplications','FaxAccountId','/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','CDR(type)=inbound-fax','getInteractions','../../components/parsers/qs','Answer','update','getMessages','removeAgents','bulkCreate','User','fax','query','message','tech','filters','userFaxAccount:remove','faxdetect','ContactId','mandatoryDispositionPause','VoiceExtension','TrunkId','keys','split','rawAttributes','length','maxrate','model','merge','show','findAll','rows','filter','VIRTUAL','../../rediscache','attachments','lodash','minrate'];(function(_0x5173d4,_0x2f60f7){const _0x51c2e9=function(_0xc06d94){while(--_0xc06d94){_0x5173d4['push'](_0x5173d4['shift']());}};_0x51c2e9(++_0x2f60f7);}(a186_0x2f60,0x101));const a186_0x51c2=function(_0x5173d4,_0x2f60f7){_0x5173d4=_0x5173d4-0x0;let _0x51c2e9=a186_0x2f60[_0x5173d4];return _0x51c2e9;};const _0x26bbbf=a186_0x51c2;'use strict';const moment=require(_0x26bbbf('0x6a')),util=require(_0x26bbbf('0x7')),path=require(_0x26bbbf('0x98')),_=require(_0x26bbbf('0x43')),{getSocket}=require(_0x26bbbf('0x41')),socket=getSocket(),qs=require(_0x26bbbf('0x23')),logger=require(_0x26bbbf('0x70'))(_0x26bbbf('0x61')),config=require(_0x26bbbf('0x63')),db=require(_0x26bbbf('0x86'))['db'],{Op}=require('sequelize');require(_0x26bbbf('0x62'))['register'](socket);const jayson=require('jayson/promise'),client=jayson[_0x26bbbf('0x4c')][_0x26bbbf('0x75')]({'port':0x232c}),client9002=jayson[_0x26bbbf('0x4c')][_0x26bbbf('0x75')]({'port':0x232a});function respondWithRpcPromise(_0xc06d94,_0x3ee900,_0x132621,_0x9179e3){return new Promise(function(_0x2b834c,_0x435cab){const _0x312060=a186_0x51c2,_0x30d2d8=_0x9179e3||client;return _0x30d2d8[_0x312060('0x59')](_0xc06d94,_0x132621)[_0x312060('0x97')](function(_0x35f329){const _0x28991a=_0x312060;logger['info']('FaxAccount,\x20%s,\x20%s',_0x3ee900,_0x28991a('0x5d')),logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3ee900,_0x28991a('0x5d'),JSON[_0x28991a('0x12')](_0x35f329));if(_0x35f329[_0x28991a('0x77')]){if(_0x35f329[_0x28991a('0x77')]['code']===0x1f4)return logger[_0x28991a('0x77')]('FaxAccount,\x20%s,\x20%s',_0x3ee900,_0x35f329[_0x28991a('0x77')]['message']),_0x435cab(_0x35f329[_0x28991a('0x77')][_0x28991a('0x2c')]);return logger['error'](_0x28991a('0x82'),_0x3ee900,_0x35f329[_0x28991a('0x77')][_0x28991a('0x2c')]),_0x2b834c(_0x35f329[_0x28991a('0x77')]['message']);}else logger['info']('FaxAccount,\x20%s,\x20%s',_0x3ee900,_0x28991a('0x5d')),_0x2b834c(_0x35f329[_0x28991a('0x94')][_0x28991a('0x2c')]);})[_0x312060('0x76')](function(_0x5f27d1){const _0x3b15ae=_0x312060;logger[_0x3b15ae('0x77')]('FaxAccount,\x20%s,\x20%s',_0x3ee900,_0x5f27d1),_0x435cab(_0x5f27d1);});});}function respondWithStatusCode(_0x373536,_0x362d79){return _0x362d79=_0x362d79||0xcc,function(_0x43c595){const _0x2a2236=a186_0x51c2;if(_0x43c595)return _0x373536[_0x2a2236('0x87')](_0x362d79);return _0x373536[_0x2a2236('0x9c')](_0x362d79)['end']();};}function respondWithResult(_0x58b625,_0x2f121f){return _0x2f121f=_0x2f121f||0xc8,function(_0x477b62){const _0x3b5582=a186_0x51c2;if(_0x477b62)return _0x58b625[_0x3b5582('0x9c')](_0x2f121f)[_0x3b5582('0x8c')](_0x477b62);};}function respondWithFilteredResult(_0xab5217,_0x5edb8d){return function(_0x5df011){const _0x3bc26d=a186_0x51c2;if(_0x5df011){const _0x210c77=_0x5df011[_0x3bc26d('0x45')],_0x41ef23=_0x5edb8d[_0x3bc26d('0x92')];let _0x57336e=_0x5edb8d[_0x3bc26d('0x92')]+_0x5edb8d[_0x3bc26d('0x8b')],_0x5e4d34;return _0x57336e>=_0x210c77?(_0x57336e=_0x210c77,_0x5e4d34=0xc8):_0x5e4d34=0xce,_0xab5217[_0x3bc26d('0x9c')](_0x5e4d34),_0xab5217[_0x3bc26d('0x18')](_0x3bc26d('0x4e'),_0x41ef23+'-'+_0x57336e+'/'+_0x210c77)[_0x3bc26d('0x8c')](_0x5df011);}return null;};}function saveUpdates(_0x1c8150){return function(_0x4c9747){const _0x1e98af=a186_0x51c2;if(_0x4c9747)return _0x4c9747[_0x1e98af('0x25')](_0x1c8150)[_0x1e98af('0x97')](function(_0xbf54d6){return _0xbf54d6;});return null;};}function removeEntity(_0x54da92){return function(_0x4d399e){const _0x2898cf=a186_0x51c2;if(_0x4d399e)return _0x4d399e[_0x2898cf('0x1')]()[_0x2898cf('0x97')](function(){const _0x35896e=_0x2898cf,_0x497af6=_0x4d399e[_0x35896e('0x11')]({'plain':!![]}),_0x3eaace=_0x35896e('0x1a');return db[_0x35896e('0x73')][_0x35896e('0x1')]({'where':{'type':_0x3eaace,'resourceId':_0x497af6['id']}})[_0x35896e('0x97')](function(){return _0x4d399e;});})[_0x2898cf('0x97')](function(){const _0x24329a=_0x2898cf;_0x54da92[_0x24329a('0x9c')](0xcc)['end']();});};}function handleEntityNotFound(_0x6ba3fd){return function(_0x11a0b7){const _0x2598aa=a186_0x51c2;return!_0x11a0b7&&_0x6ba3fd[_0x2598aa('0x87')](0x194),_0x11a0b7;};}function handleError(_0x15a6c5,_0x2f80e6){return _0x2f80e6=_0x2f80e6||0x1f4,function(_0x501688){const _0x20e3cb=a186_0x51c2;logger[_0x20e3cb('0x77')](_0x501688[_0x20e3cb('0x58')]),_0x501688[_0x20e3cb('0x47')]&&delete _0x501688['name'],_0x15a6c5[_0x20e3cb('0x9c')](_0x2f80e6)[_0x20e3cb('0x2')](_0x501688);};}exports['index']=function(_0x5ce1bc,_0x2ac492){const _0x50b5b4=_0x26bbbf;let _0x532f53={'include':[{'model':db[_0x50b5b4('0x64')],'as':_0x50b5b4('0x32')}]};const _0x75f9c5={},_0x97e6e2={'count':0x0,'rows':[]},_0x453c35=_['map'](db[_0x50b5b4('0x55')]['rawAttributes'],function(_0x2a8dc6){const _0x4134ca=_0x50b5b4;return{'name':_0x2a8dc6['fieldName'],'type':_0x2a8dc6[_0x4134ca('0xa0')][_0x4134ca('0x4')]};});_0x75f9c5[_0x50b5b4('0x3a')]=_[_0x50b5b4('0x4a')](_0x453c35,'name'),_0x75f9c5[_0x50b5b4('0x2b')]=_[_0x50b5b4('0x35')](_0x5ce1bc[_0x50b5b4('0x2b')]),_0x75f9c5[_0x50b5b4('0x2e')]=_[_0x50b5b4('0x72')](_0x75f9c5[_0x50b5b4('0x3a')],_0x75f9c5[_0x50b5b4('0x2b')]),_0x532f53[_0x50b5b4('0x54')]=_[_0x50b5b4('0x72')](_0x75f9c5[_0x50b5b4('0x3a')],qs['fields'](_0x5ce1bc['query']['fields'])),_0x532f53['attributes']=_0x532f53[_0x50b5b4('0x54')][_0x50b5b4('0x38')]?_0x532f53[_0x50b5b4('0x54')]:_0x75f9c5[_0x50b5b4('0x3a')];typeof _0x5ce1bc[_0x50b5b4('0x2b')][_0x50b5b4('0x49')]===_0x50b5b4('0x65')&&(_0x532f53[_0x50b5b4('0x8b')]=qs['limit'](_0x5ce1bc[_0x50b5b4('0x2b')][_0x50b5b4('0x8b')]),_0x532f53[_0x50b5b4('0x92')]=qs[_0x50b5b4('0x92')](_0x5ce1bc[_0x50b5b4('0x2b')][_0x50b5b4('0x92')]));_0x532f53['order']=qs[_0x50b5b4('0x81')](_0x5ce1bc[_0x50b5b4('0x2b')][_0x50b5b4('0x81')]),_0x532f53['where']=qs['filters'](_['pick'](_0x5ce1bc[_0x50b5b4('0x2b')],_0x75f9c5[_0x50b5b4('0x2e')]),_0x453c35);_0x5ce1bc[_0x50b5b4('0x2b')][_0x50b5b4('0x3f')]&&(_0x532f53[_0x50b5b4('0x88')]=_['merge'](_0x532f53[_0x50b5b4('0x88')],{[Op['or']]:_[_0x50b5b4('0x4a')](_0x453c35,function(_0x2f0494){const _0x431f3d=_0x50b5b4;if(_0x2f0494[_0x431f3d('0xa0')]!==_0x431f3d('0x40')){const _0x2b185d={};return _0x2b185d[_0x2f0494[_0x431f3d('0x47')]]={[Op['like']]:'%'+_0x5ce1bc[_0x431f3d('0x2b')][_0x431f3d('0x3f')]+'%'},_0x2b185d;}})}));_0x532f53=_[_0x50b5b4('0x3b')]({},_0x532f53,_0x5ce1bc['options']);const _0x36eab2={'where':_0x532f53[_0x50b5b4('0x88')]};return db[_0x50b5b4('0x55')]['count'](_0x36eab2)[_0x50b5b4('0x97')](function(_0x4a778f){const _0x22c1a5=_0x50b5b4;return _0x97e6e2[_0x22c1a5('0x45')]=_0x4a778f,_0x5ce1bc[_0x22c1a5('0x2b')][_0x22c1a5('0x10')]&&(_0x532f53[_0x22c1a5('0x8e')]=[{'all':!![]}]),db[_0x22c1a5('0x55')]['findAll'](_0x532f53);})['then'](function(_0x37361b){return _0x97e6e2['rows']=_0x37361b,_0x97e6e2;})[_0x50b5b4('0x97')](respondWithFilteredResult(_0x2ac492,_0x532f53))[_0x50b5b4('0x76')](handleError(_0x2ac492,null));},exports[_0x26bbbf('0x3c')]=function(_0x34db64,_0x2064c5){const _0x2f3f9b=_0x26bbbf;let _0x5e2dbc={'raw':![],'where':{'id':_0x34db64[_0x2f3f9b('0xa1')]['id']},'include':[{'model':db[_0x2f3f9b('0x64')],'as':_0x2f3f9b('0x32')}]};const _0x1833d5={};return _0x1833d5[_0x2f3f9b('0x3a')]=_[_0x2f3f9b('0x35')](db[_0x2f3f9b('0x55')][_0x2f3f9b('0x37')]),_0x1833d5['query']=_[_0x2f3f9b('0x35')](_0x34db64['query']),_0x1833d5[_0x2f3f9b('0x2e')]=_[_0x2f3f9b('0x72')](_0x1833d5['model'],_0x1833d5[_0x2f3f9b('0x2b')]),_0x5e2dbc[_0x2f3f9b('0x54')]=_[_0x2f3f9b('0x72')](_0x1833d5[_0x2f3f9b('0x3a')],qs[_0x2f3f9b('0x6b')](_0x34db64['query'][_0x2f3f9b('0x6b')])),_0x5e2dbc['attributes']=_0x5e2dbc['attributes'][_0x2f3f9b('0x38')]?_0x5e2dbc['attributes']:_0x1833d5[_0x2f3f9b('0x3a')],_0x34db64[_0x2f3f9b('0x2b')][_0x2f3f9b('0x10')]&&(_0x5e2dbc[_0x2f3f9b('0x8e')]=[{'all':!![]}]),_0x5e2dbc=_[_0x2f3f9b('0x3b')]({},_0x5e2dbc,_0x34db64[_0x2f3f9b('0xf')]),db[_0x2f3f9b('0x55')][_0x2f3f9b('0x5c')](_0x5e2dbc)[_0x2f3f9b('0x97')](handleEntityNotFound(_0x2064c5,null))[_0x2f3f9b('0x97')](respondWithResult(_0x2064c5,null))[_0x2f3f9b('0x76')](handleError(_0x2064c5,null));},exports['create']=function(_0x360b2f,_0x2da164){const _0xff23d6=_0x26bbbf;return db[_0xff23d6('0x55')][_0xff23d6('0x74')](_0x360b2f[_0xff23d6('0xc')],{})[_0xff23d6('0x97')](function(_0x4c313f){const _0x60784c=_0xff23d6,_0x526c9f=_0x360b2f[_0x60784c('0x99')]['get']({'plain':!![]});if(!_0x526c9f)throw new Error(_0x60784c('0x78'));if(_0x526c9f[_0x60784c('0x80')]==='user'){const _0x33136d=_0x4c313f[_0x60784c('0x11')]({'plain':!![]}),_0x1d05f6='FaxAccounts';return db['UserProfileSection'][_0x60784c('0x5c')]({'where':{'name':_0x1d05f6,'userProfileId':_0x526c9f[_0x60784c('0x91')]},'raw':!![]})[_0x60784c('0x97')](function(_0x3ef703){const _0x2a448a=_0x60784c;return _0x3ef703&&_0x3ef703[_0x2a448a('0x9d')]===0x0?db[_0x2a448a('0x73')][_0x2a448a('0x74')]({'name':_0x33136d['name'],'resourceId':_0x33136d['id'],'type':_0x3ef703['name'],'sectionId':_0x3ef703['id']},{})[_0x2a448a('0x97')](function(){return _0x4c313f;}):_0x4c313f;})['catch'](function(_0x1d9240){const _0x3331e4=_0x60784c;logger[_0x3331e4('0x77')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d9240);throw _0x1d9240;});}return _0x4c313f;})[_0xff23d6('0x97')](respondWithResult(_0x2da164,0xc9))['catch'](handleError(_0x2da164,null));},exports[_0x26bbbf('0x25')]=function(_0x488c82,_0xf6d47e){const _0x193e17=_0x26bbbf;return _0x488c82['body']['id']&&delete _0x488c82[_0x193e17('0xc')]['id'],db[_0x193e17('0x55')]['findOne']({'where':{'id':_0x488c82[_0x193e17('0xa1')]['id']},'include':[{'model':db['Pause'],'as':_0x193e17('0x32')}]})[_0x193e17('0x97')](handleEntityNotFound(_0xf6d47e,null))['then'](saveUpdates(_0x488c82[_0x193e17('0xc')],null))[_0x193e17('0x97')](respondWithResult(_0xf6d47e,null))['catch'](handleError(_0xf6d47e,null));},exports[_0x26bbbf('0x1')]=function(_0x1b8d46,_0x1a0d51){const _0x405934=_0x26bbbf;return db[_0x405934('0x55')][_0x405934('0x5c')]({'where':{'id':_0x1b8d46[_0x405934('0xa1')]['id']}})['then'](handleEntityNotFound(_0x1a0d51,null))[_0x405934('0x97')](removeEntity(_0x1a0d51,null))[_0x405934('0x76')](handleError(_0x1a0d51,null));},exports[_0x26bbbf('0x6d')]=function(_0x3e2468,_0x36acae){const _0x1b66b5=_0x26bbbf;return db['FaxAccount'][_0x1b66b5('0x6d')]()[_0x1b66b5('0x97')](respondWithResult(_0x36acae,null))[_0x1b66b5('0x76')](handleError(_0x36acae,null));},exports[_0x26bbbf('0x68')]=function(_0x2d46dc,_0x5ef4d4){const _0xe4f752=_0x26bbbf;return _0x2d46dc[_0xe4f752('0xc')]['id']&&delete _0x2d46dc[_0xe4f752('0xc')]['id'],db[_0xe4f752('0x55')][_0xe4f752('0x5c')]({'where':{'id':_0x2d46dc[_0xe4f752('0xa1')]['id']}})['then'](handleEntityNotFound(_0x5ef4d4,null))['then'](function(_0x2ae2a5){const _0x2f706e=_0xe4f752;if(_0x2ae2a5)return _0x2d46dc[_0x2f706e('0xc')][_0x2f706e('0x1f')]=_0x2ae2a5['id'],db[_0x2f706e('0x46')][_0x2f706e('0x74')](_0x2d46dc[_0x2f706e('0xc')]);})[_0xe4f752('0x97')](respondWithResult(_0x5ef4d4,null))[_0xe4f752('0x76')](handleError(_0x5ef4d4,null));},exports['getDispositions']=function(_0x3afffe,_0x17661c){const _0x9b3b73=_0x26bbbf;let _0x3d075a={'raw':![],'where':{}};const _0x1b4fb0={},_0x2eff27={'count':0x0,'rows':[]};return db[_0x9b3b73('0x55')][_0x9b3b73('0x5c')]({'where':{'id':_0x3afffe[_0x9b3b73('0xa1')]['id']}})[_0x9b3b73('0x97')](handleEntityNotFound(_0x17661c,null))[_0x9b3b73('0x97')](function(_0x363b59){const _0x10d366=_0x9b3b73;if(_0x363b59)return _0x1b4fb0[_0x10d366('0x3a')]=_[_0x10d366('0x35')](db[_0x10d366('0x46')][_0x10d366('0x37')]),_0x1b4fb0[_0x10d366('0x2b')]=_[_0x10d366('0x35')](_0x3afffe[_0x10d366('0x2b')]),_0x1b4fb0[_0x10d366('0x2e')]=_[_0x10d366('0x72')](_0x1b4fb0[_0x10d366('0x3a')],_0x1b4fb0[_0x10d366('0x2b')]),_0x3d075a[_0x10d366('0x54')]=_['intersection'](_0x1b4fb0[_0x10d366('0x3a')],qs['fields'](_0x3afffe[_0x10d366('0x2b')]['fields'])),_0x3d075a[_0x10d366('0x54')]=_0x3d075a[_0x10d366('0x54')][_0x10d366('0x38')]?_0x3d075a['attributes']:_0x1b4fb0['model'],typeof _0x3afffe[_0x10d366('0x2b')]['nolimit']==='undefined'&&(_0x3d075a['limit']=qs[_0x10d366('0x8b')](_0x3afffe['query'][_0x10d366('0x8b')]),_0x3d075a['offset']=qs['offset'](_0x3afffe[_0x10d366('0x2b')]['offset'])),_0x3d075a[_0x10d366('0x7b')]=qs[_0x10d366('0x81')](_0x3afffe[_0x10d366('0x2b')][_0x10d366('0x81')]),_0x3d075a[_0x10d366('0x88')]=qs[_0x10d366('0x2e')](_[_0x10d366('0x6e')](_0x3afffe[_0x10d366('0x2b')],_0x1b4fb0['filters'])),_0x3d075a[_0x10d366('0x88')][_0x10d366('0x1f')]=_0x363b59['id'],_0x3afffe['query']['filter']&&(_0x3d075a[_0x10d366('0x88')]=_[_0x10d366('0x3b')](_0x3d075a[_0x10d366('0x88')],{[Op['or']]:_[_0x10d366('0x4a')](_0x3d075a[_0x10d366('0x54')],function(_0x2d5313){const _0x32fcfb=_0x10d366,_0x551377={};return _0x551377[_0x2d5313]={[Op[_0x32fcfb('0x52')]]:'%'+_0x3afffe['query'][_0x32fcfb('0x3f')]+'%'},_0x551377;})})),_0x3d075a=_['merge']({},_0x3d075a,_0x3afffe['options']),db[_0x10d366('0x46')][_0x10d366('0x45')]({'where':_0x3d075a[_0x10d366('0x88')]})[_0x10d366('0x97')](function(_0x17a424){const _0x236357=_0x10d366;return _0x2eff27[_0x236357('0x45')]=_0x17a424,_0x3afffe[_0x236357('0x2b')][_0x236357('0x10')]&&(_0x3d075a[_0x236357('0x8e')]=[{'all':!![]}]),db['Disposition'][_0x236357('0x3d')](_0x3d075a);})[_0x10d366('0x97')](function(_0x1611ad){const _0x3f3afa=_0x10d366;return _0x2eff27[_0x3f3afa('0x3e')]=_0x1611ad,_0x2eff27;});})['then'](respondWithFilteredResult(_0x17661c,_0x3d075a))[_0x9b3b73('0x76')](handleError(_0x17661c,null));},exports[_0x26bbbf('0x7d')]=function(_0x475a09,_0x257e8d){const _0x2ae27f=_0x26bbbf;return db[_0x2ae27f('0x55')][_0x2ae27f('0x5c')]({'where':{'id':_0x475a09[_0x2ae27f('0xa1')]['id']}})[_0x2ae27f('0x97')](handleEntityNotFound(_0x257e8d,null))['then'](function(_0x4940f2){const _0x41520f=_0x2ae27f;if(_0x4940f2)return _0x4940f2[_0x41520f('0x7d')](_0x475a09[_0x41520f('0x2b')]['ids']);})[_0x2ae27f('0x97')](respondWithStatusCode(_0x257e8d,null))['catch'](handleError(_0x257e8d,null));},exports['addAnswer']=function(_0x2d0d4a,_0x1c90a0){const _0x5ee6d9=_0x26bbbf;return _0x2d0d4a['body']['id']&&delete _0x2d0d4a[_0x5ee6d9('0xc')]['id'],db[_0x5ee6d9('0x55')][_0x5ee6d9('0x5c')]({'where':{'id':_0x2d0d4a['params']['id']}})[_0x5ee6d9('0x97')](handleEntityNotFound(_0x1c90a0,null))[_0x5ee6d9('0x97')](function(_0x1e2733){const _0x52362b=_0x5ee6d9;if(_0x1e2733)return _0x2d0d4a[_0x52362b('0xc')][_0x52362b('0x1f')]=_0x1e2733['id'],db[_0x52362b('0x9a')][_0x52362b('0x74')](_0x2d0d4a[_0x52362b('0xc')]);})[_0x5ee6d9('0x97')](respondWithResult(_0x1c90a0,null))[_0x5ee6d9('0x76')](handleError(_0x1c90a0,null));},exports['getAnswers']=function(_0xb7d2dd,_0x52beb2){const _0x1ead6a=_0x26bbbf;let _0x4cbc43={'raw':![],'where':{}};const _0x589ea7={},_0x57f280={'count':0x0,'rows':[]};return db[_0x1ead6a('0x55')]['findOne']({'where':{'id':_0xb7d2dd[_0x1ead6a('0xa1')]['id']}})[_0x1ead6a('0x97')](handleEntityNotFound(_0x52beb2,null))[_0x1ead6a('0x97')](function(_0x2246bd){const _0x5a3e96=_0x1ead6a;if(_0x2246bd)return _0x589ea7[_0x5a3e96('0x3a')]=_['keys'](db[_0x5a3e96('0x9a')]['rawAttributes']),_0x589ea7[_0x5a3e96('0x2b')]=_[_0x5a3e96('0x35')](_0xb7d2dd[_0x5a3e96('0x2b')]),_0x589ea7[_0x5a3e96('0x2e')]=_[_0x5a3e96('0x72')](_0x589ea7[_0x5a3e96('0x3a')],_0x589ea7[_0x5a3e96('0x2b')]),_0x4cbc43['attributes']=_[_0x5a3e96('0x72')](_0x589ea7[_0x5a3e96('0x3a')],qs[_0x5a3e96('0x6b')](_0xb7d2dd[_0x5a3e96('0x2b')][_0x5a3e96('0x6b')])),_0x4cbc43[_0x5a3e96('0x54')]=_0x4cbc43[_0x5a3e96('0x54')][_0x5a3e96('0x38')]?_0x4cbc43[_0x5a3e96('0x54')]:_0x589ea7['model'],typeof _0xb7d2dd['query'][_0x5a3e96('0x49')]===_0x5a3e96('0x65')&&(_0x4cbc43[_0x5a3e96('0x8b')]=qs[_0x5a3e96('0x8b')](_0xb7d2dd[_0x5a3e96('0x2b')]['limit']),_0x4cbc43['offset']=qs[_0x5a3e96('0x92')](_0xb7d2dd[_0x5a3e96('0x2b')][_0x5a3e96('0x92')])),_0x4cbc43[_0x5a3e96('0x7b')]=qs[_0x5a3e96('0x81')](_0xb7d2dd[_0x5a3e96('0x2b')][_0x5a3e96('0x81')]),_0x4cbc43['where']=qs[_0x5a3e96('0x2e')](_[_0x5a3e96('0x6e')](_0xb7d2dd['query'],_0x589ea7[_0x5a3e96('0x2e')])),_0x4cbc43[_0x5a3e96('0x88')][_0x5a3e96('0x1f')]=_0x2246bd['id'],_0xb7d2dd[_0x5a3e96('0x2b')][_0x5a3e96('0x3f')]&&(_0x4cbc43[_0x5a3e96('0x88')]=_[_0x5a3e96('0x3b')](_0x4cbc43[_0x5a3e96('0x88')],{[Op['or']]:_[_0x5a3e96('0x4a')](_0x4cbc43[_0x5a3e96('0x54')],function(_0x2c6c24){const _0x30358c=_0x5a3e96,_0x3ba9d4={};return _0x3ba9d4[_0x2c6c24]={[Op['like']]:'%'+_0xb7d2dd[_0x30358c('0x2b')][_0x30358c('0x3f')]+'%'},_0x3ba9d4;})})),_0x4cbc43=_['merge']({},_0x4cbc43,_0xb7d2dd['options']),db['CannedAnswer'][_0x5a3e96('0x45')]({'where':_0x4cbc43['where']})[_0x5a3e96('0x97')](function(_0x16368c){const _0x815419=_0x5a3e96;return _0x57f280['count']=_0x16368c,_0xb7d2dd[_0x815419('0x2b')][_0x815419('0x10')]&&(_0x4cbc43[_0x815419('0x8e')]=[{'all':!![]}]),db[_0x815419('0x9a')]['findAll'](_0x4cbc43);})[_0x5a3e96('0x97')](function(_0x45c448){const _0x4ce5bc=_0x5a3e96;return _0x57f280[_0x4ce5bc('0x3e')]=_0x45c448,_0x57f280;});})[_0x1ead6a('0x97')](respondWithFilteredResult(_0x52beb2,_0x4cbc43))[_0x1ead6a('0x76')](handleError(_0x52beb2,null));},exports['removeAnswers']=function(_0x5121f5,_0x516979){const _0x1b1e29=_0x26bbbf;return db['FaxAccount'][_0x1b1e29('0x5c')]({'where':{'id':_0x5121f5['params']['id']}})['then'](handleEntityNotFound(_0x516979,null))['then'](function(_0x5456a2){const _0x579967=_0x1b1e29;if(_0x5456a2)return _0x5456a2['removeAnswers'](_0x5121f5[_0x579967('0x2b')][_0x579967('0x60')]);})[_0x1b1e29('0x97')](respondWithStatusCode(_0x516979,null))[_0x1b1e29('0x76')](handleError(_0x516979,null));},exports[_0x26bbbf('0x85')]=function(_0x5a5713,_0x580388){const _0x53883e=_0x26bbbf;return db[_0x53883e('0x6c')][_0x53883e('0x5c')]({'where':{'id':_0x5a5713[_0x53883e('0xa1')]['id']}})[_0x53883e('0x97')](function(_0x20294e){const _0x252047=_0x53883e;if(_0x20294e)return _0x20294e[_0x252047('0x85')](_0x5a5713[_0x252047('0xc')][_0x252047('0x60')],{'through':_[_0x252047('0x84')](_0x5a5713['body'],['ids','id'])});})[_0x53883e('0x97')](respondWithResult(_0x580388,null))[_0x53883e('0x76')](handleError(_0x580388,null));},exports[_0x26bbbf('0x22')]=function(_0x25dcca,_0x3e9bd8){const _0x3cb7c6=_0x26bbbf;let _0x3af20a={'raw':![],'where':{}};const _0x4cc85a={},_0xc71d4c={'count':0x0,'rows':[]};return db[_0x3cb7c6('0x55')]['findOne']({'where':{'id':_0x25dcca[_0x3cb7c6('0xa1')]['id']}})[_0x3cb7c6('0x97')](handleEntityNotFound(_0x3e9bd8,null))[_0x3cb7c6('0x97')](function(_0x3a805b){const _0x2b6b7f=_0x3cb7c6;if(_0x3a805b)return _0x4cc85a[_0x2b6b7f('0x3a')]=_[_0x2b6b7f('0x35')](db[_0x2b6b7f('0x6c')][_0x2b6b7f('0x37')]),_0x4cc85a['query']=_[_0x2b6b7f('0x35')](_0x25dcca[_0x2b6b7f('0x2b')]),_0x4cc85a[_0x2b6b7f('0x2e')]=_[_0x2b6b7f('0x72')](_0x4cc85a[_0x2b6b7f('0x3a')],_0x4cc85a[_0x2b6b7f('0x2b')]),_0x3af20a[_0x2b6b7f('0x54')]=_[_0x2b6b7f('0x72')](_0x4cc85a[_0x2b6b7f('0x3a')],qs[_0x2b6b7f('0x6b')](_0x25dcca['query']['fields'])),_0x3af20a[_0x2b6b7f('0x54')]=_0x3af20a[_0x2b6b7f('0x54')][_0x2b6b7f('0x38')]?_0x3af20a[_0x2b6b7f('0x54')]:_0x4cc85a[_0x2b6b7f('0x3a')],typeof _0x25dcca[_0x2b6b7f('0x2b')][_0x2b6b7f('0x49')]==='undefined'&&(_0x3af20a[_0x2b6b7f('0x8b')]=qs[_0x2b6b7f('0x8b')](_0x25dcca[_0x2b6b7f('0x2b')]['limit']),_0x3af20a['offset']=qs['offset'](_0x25dcca[_0x2b6b7f('0x2b')][_0x2b6b7f('0x92')])),_0x3af20a[_0x2b6b7f('0x7b')]=qs['sort'](_0x25dcca[_0x2b6b7f('0x2b')][_0x2b6b7f('0x81')]),_0x3af20a[_0x2b6b7f('0x88')]=qs[_0x2b6b7f('0x2e')](_[_0x2b6b7f('0x6e')](_0x25dcca[_0x2b6b7f('0x2b')],_0x4cc85a[_0x2b6b7f('0x2e')])),_0x3af20a[_0x2b6b7f('0x88')][_0x2b6b7f('0x1f')]=_0x3a805b['id'],_0x25dcca[_0x2b6b7f('0x2b')][_0x2b6b7f('0x3f')]&&(_0x3af20a[_0x2b6b7f('0x88')]=_['merge'](_0x3af20a[_0x2b6b7f('0x88')],{[Op['or']]:_['map'](_0x3af20a['attributes'],function(_0x3112b1){const _0x1628db=_0x2b6b7f,_0x3220e2={};return _0x3220e2[_0x3112b1]={[Op[_0x1628db('0x52')]]:'%'+_0x25dcca[_0x1628db('0x2b')]['filter']+'%'},_0x3220e2;})})),_0x3af20a=_[_0x2b6b7f('0x3b')]({},_0x3af20a,_0x25dcca[_0x2b6b7f('0xf')]),db[_0x2b6b7f('0x6c')][_0x2b6b7f('0x45')]({'where':_0x3af20a['where']})[_0x2b6b7f('0x97')](function(_0x19a1d5){const _0x112b9d=_0x2b6b7f;return _0xc71d4c[_0x112b9d('0x45')]=_0x19a1d5,_0x25dcca[_0x112b9d('0x2b')][_0x112b9d('0x10')]&&(_0x3af20a[_0x112b9d('0x8e')]=[{'model':db[_0x112b9d('0x50')],'as':'Contact','required':![]},{'model':db[_0x112b9d('0x29')],'as':'Owner','attributes':[_0x112b9d('0x47'),'fullname',_0x112b9d('0xb')],'required':![]},{'model':db['Tag'],'as':_0x112b9d('0x8f'),'attributes':['id',_0x112b9d('0x47'),_0x112b9d('0x4f')],'where':_0x25dcca[_0x112b9d('0x2b')]['tag']?{'id':_0x25dcca[_0x112b9d('0x2b')]['tag']}:undefined,'required':_0x25dcca[_0x112b9d('0x2b')][_0x112b9d('0x5e')]?!![]:![]}]),db[_0x112b9d('0x6c')][_0x112b9d('0x3d')](_0x3af20a);})[_0x2b6b7f('0x97')](function(_0x42e6ad){return _0xc71d4c['rows']=_0x42e6ad,_0xc71d4c;});})['then'](respondWithFilteredResult(_0x3e9bd8,_0x3af20a))[_0x3cb7c6('0x76')](handleError(_0x3e9bd8,null));},exports[_0x26bbbf('0x14')]=function(_0x2e7ac9,_0x45ff7b){const _0x136e9e=_0x26bbbf;return db['FaxAccount'][_0x136e9e('0x5c')]({'where':{'id':_0x2e7ac9['params']['id']}})[_0x136e9e('0x97')](handleEntityNotFound(_0x45ff7b,null))[_0x136e9e('0x97')](function(_0x229968){const _0x1a9610=_0x136e9e;if(_0x229968)return db[_0x1a9610('0x1d')]['transaction'](function(_0x5db233){const _0x47447e=_0x1a9610;return db[_0x47447e('0xe')]['destroy']({'where':{'FaxAccountId':_0x2e7ac9[_0x47447e('0xa1')]['id']},'transaction':_0x5db233})[_0x47447e('0x97')](function(){const _0xe498b2=_0x47447e,_0x468b89=_[_0xe498b2('0x4a')](_0x2e7ac9['body'],function(_0x1cc14a){const _0x156fdb=_0xe498b2;return _0x1cc14a[_0x156fdb('0x1f')]=_0x2e7ac9['params']['id'],_0x1cc14a;});return db[_0xe498b2('0xe')][_0xe498b2('0x28')](_0x468b89,{'transaction':_0x5db233});});})[_0x1a9610('0x97')](function(){const _0x3fe0b4=_0x1a9610;return db[_0x3fe0b4('0xe')][_0x3fe0b4('0x90')]({'where':{'FaxAccountId':_0x2e7ac9[_0x3fe0b4('0xa1')]['id']},'order':_0x3fe0b4('0x8a')});});})['then'](respondWithResult(_0x45ff7b,null))[_0x136e9e('0x76')](handleError(_0x45ff7b,null));},exports[_0x26bbbf('0x69')]=function(_0x4256d2,_0xc2e7b0){const _0x38f4b0=_0x26bbbf;let _0x2a5e8e={};const _0x236c23={};let _0x15bf58,_0x5cab0a;return db[_0x38f4b0('0x55')][_0x38f4b0('0x5c')]({'where':{'id':_0x4256d2[_0x38f4b0('0xa1')]['id']}})[_0x38f4b0('0x97')](handleEntityNotFound(_0xc2e7b0,null))['then'](function(_0x6b2f40){const _0x3c8cbc=_0x38f4b0;if(_0x6b2f40)return _0x15bf58=_0x6b2f40,_0x236c23[_0x3c8cbc('0x3a')]=_[_0x3c8cbc('0x35')](db[_0x3c8cbc('0xe')][_0x3c8cbc('0x37')]),_0x236c23[_0x3c8cbc('0x2b')]=_[_0x3c8cbc('0x35')](_0x4256d2['query']),_0x236c23[_0x3c8cbc('0x2e')]=_[_0x3c8cbc('0x72')](_0x236c23[_0x3c8cbc('0x3a')],_0x236c23[_0x3c8cbc('0x2b')]),_0x2a5e8e[_0x3c8cbc('0x54')]=_[_0x3c8cbc('0x72')](_0x236c23[_0x3c8cbc('0x3a')],qs[_0x3c8cbc('0x6b')](_0x4256d2[_0x3c8cbc('0x2b')][_0x3c8cbc('0x6b')])),_0x2a5e8e[_0x3c8cbc('0x54')]=_0x2a5e8e[_0x3c8cbc('0x54')][_0x3c8cbc('0x38')]?_0x2a5e8e['attributes']:_0x236c23['model'],_0x2a5e8e['order']=qs[_0x3c8cbc('0x81')](_0x4256d2[_0x3c8cbc('0x2b')][_0x3c8cbc('0x81')]),_0x2a5e8e['where']=qs[_0x3c8cbc('0x2e')](_[_0x3c8cbc('0x6e')](_0x4256d2['query'],_0x236c23[_0x3c8cbc('0x2e')])),_0x4256d2[_0x3c8cbc('0x2b')][_0x3c8cbc('0x3f')]&&(_0x2a5e8e['where']=_['merge'](_0x2a5e8e[_0x3c8cbc('0x88')],{[Op['or']]:_[_0x3c8cbc('0x4a')](_0x2a5e8e[_0x3c8cbc('0x54')],function(_0x16ce72){const _0x3c5952=_0x3c8cbc,_0x3aa2bb={};return _0x3aa2bb[_0x16ce72]={[Op[_0x3c5952('0x52')]]:'%'+_0x4256d2[_0x3c5952('0x2b')][_0x3c5952('0x3f')]+'%'},_0x3aa2bb;})})),_0x2a5e8e=_[_0x3c8cbc('0x3b')]({},_0x2a5e8e,_0x4256d2[_0x3c8cbc('0xf')]),_0x15bf58[_0x3c8cbc('0x69')](_0x2a5e8e);})[_0x38f4b0('0x97')](function(_0x27c2a7){const _0x4e5454=_0x38f4b0;if(_0x27c2a7)return _0x5cab0a=_0x27c2a7[_0x4e5454('0x38')],typeof _0x4256d2['query'][_0x4e5454('0x49')]===_0x4e5454('0x65')&&(_0x2a5e8e[_0x4e5454('0x8b')]=qs['limit'](_0x4256d2[_0x4e5454('0x2b')][_0x4e5454('0x8b')]),_0x2a5e8e[_0x4e5454('0x92')]=qs[_0x4e5454('0x92')](_0x4256d2[_0x4e5454('0x2b')][_0x4e5454('0x92')])),_0x15bf58[_0x4e5454('0x69')](_0x2a5e8e);})[_0x38f4b0('0x97')](function(_0xb37ab6){if(_0xb37ab6)return _0xb37ab6?{'count':_0x5cab0a,'rows':_0xb37ab6}:null;})[_0x38f4b0('0x97')](respondWithResult(_0xc2e7b0,null))[_0x38f4b0('0x76')](handleError(_0xc2e7b0,null));};function Extension(_0x281cc7,_0x34f584,_0x3391f3,_0x24f089){const _0x2234d4=_0x26bbbf;this[_0x2234d4('0x5a')]=_0x2234d4('0x7c'),this['exten']=_0x281cc7[_0x2234d4('0x6f')],this[_0x2234d4('0x4d')]=_0x24f089,this['type']='system',this[_0x2234d4('0x19')]=_0x2234d4('0x89'),this['FaxAccountId']=_0x281cc7['id'],this['priority']=_0x34f584,this['appdata']=_0x3391f3;}function createExtensionsReciveFax(_0x4a5c3e){const _0x36d7e4=_0x26bbbf;let _0x5a1f55=0x1;const _0x4a2ff2=[];_0x4a2ff2[_0x36d7e4('0x57')](new Extension(_0x4a5c3e,_0x5a1f55,'',_0x36d7e4('0x24'))),_0x5a1f55+=0x1,_0x4a2ff2[_0x36d7e4('0x57')](new Extension(_0x4a5c3e,_0x5a1f55,_0x36d7e4('0x21'),'Set')),_0x5a1f55+=0x1;for(const _0xe7331d in _0x4a5c3e){typeof _0x4a5c3e[_0xe7331d]!==_0x36d7e4('0x65')&&(_0xe7331d===_0x36d7e4('0x9e')||_0xe7331d===_0x36d7e4('0x6f')||_0xe7331d===_0x36d7e4('0x1b')||_0xe7331d===_0x36d7e4('0x30')||_0xe7331d===_0x36d7e4('0x9b')||_0xe7331d===_0x36d7e4('0x39')||_0xe7331d===_0x36d7e4('0x44')||_0xe7331d==='modem'||_0xe7331d===_0x36d7e4('0x5f'))&&(_0x4a2ff2[_0x36d7e4('0x57')](new Extension(_0x4a5c3e,_0x5a1f55,'FAXOPT('+_0xe7331d+')='+_0x4a5c3e[_0xe7331d],_0x36d7e4('0xa2'))),_0x5a1f55+=0x1);}return _0x4a2ff2[_0x36d7e4('0x57')](new Extension(_0x4a5c3e,_0x5a1f55,'6',_0x36d7e4('0x15'))),_0x5a1f55+=0x1,_0x4a2ff2[_0x36d7e4('0x57')](new Extension(_0x4a5c3e,_0x5a1f55,_0x36d7e4('0x20'),_0x36d7e4('0x93'))),_0x5a1f55=0x0,_0x4a2ff2;}exports['addAccountApplications']=function(_0x3f6ac5,_0x34b3ff){const _0x29e62f=_0x26bbbf;let _0x2e9340;return db['sequelize'][_0x29e62f('0x4b')](function(_0x45d9cd){const _0x5600df=_0x29e62f;return db[_0x5600df('0x55')][_0x5600df('0x74')](_0x3f6ac5[_0x5600df('0xc')],{'transaction':_0x45d9cd})['then'](function(_0x61f2b3){const _0x34d65a=_0x5600df;return _0x2e9340=_0x61f2b3[_0x34d65a('0x11')]({'plain':!![]}),db[_0x34d65a('0x33')][_0x34d65a('0x28')](createExtensionsReciveFax(_0x2e9340),{'transaction':_0x45d9cd});});})['then'](function(){return _0x2e9340;})['then'](respondWithResult(_0x34b3ff,null))[_0x29e62f('0x76')](handleError(_0x34b3ff,null));},exports[_0x26bbbf('0x1e')]=function(_0xb495a0,_0x15a77d){const _0x428b39=_0x26bbbf;return db[_0x428b39('0x1d')][_0x428b39('0x4b')](function(_0x29b6d0){const _0x3dcb23=_0x428b39;return db[_0x3dcb23('0x55')][_0x3dcb23('0x25')](_0xb495a0[_0x3dcb23('0xc')],{'where':{'id':_0xb495a0[_0x3dcb23('0xc')]['id']},'transaction':_0x29b6d0})['then'](function(){const _0x3983a7=_0x3dcb23;return db[_0x3983a7('0x33')][_0x3983a7('0x1')]({'where':{'FaxAccountId':_0xb495a0['body']['id']},'transaction':_0x29b6d0})['then'](function(){const _0x38453e=_0x3983a7;return db[_0x38453e('0x33')][_0x38453e('0x28')](createExtensionsReciveFax(_[_0x38453e('0x84')](_0xb495a0[_0x38453e('0xc')],[_0x38453e('0x2d'),'key',_0x38453e('0x83'),_0x38453e('0x7a'),_0x38453e('0x34'),_0x38453e('0x8d')])),{'transaction':_0x29b6d0});});});})[_0x428b39('0x97')](function(){const _0x49870c=_0x428b39;return db['FaxAccount'][_0x49870c('0xa')](_0xb495a0[_0x49870c('0xc')]['id']);})[_0x428b39('0x97')](respondWithResult(_0x15a77d,null))[_0x428b39('0x76')](handleError(_0x15a77d,null));},exports[_0x26bbbf('0x26')]=function(_0x1c99a1,_0x2a7af9){const _0x56bb0f=_0x26bbbf;let _0x124a89={'raw':!![],'where':{}};const _0x35b0f1={},_0x35f3df={'count':0x0,'rows':[]};return db['FaxAccount'][_0x56bb0f('0x5c')]({'where':{'id':_0x1c99a1['params']['id']}})[_0x56bb0f('0x97')](handleEntityNotFound(_0x2a7af9,null))[_0x56bb0f('0x97')](function(_0x222081){const _0x2c5dab=_0x56bb0f;if(_0x222081){_0x35b0f1[_0x2c5dab('0x3a')]=_[_0x2c5dab('0x35')](db[_0x2c5dab('0x56')]['rawAttributes']),_0x35b0f1['query']=_['keys'](_0x1c99a1[_0x2c5dab('0x2b')]),_0x35b0f1['filters']=_[_0x2c5dab('0x72')](_0x35b0f1['model'],_0x35b0f1['query']),_0x124a89[_0x2c5dab('0x54')]=_['intersection'](_0x35b0f1[_0x2c5dab('0x3a')],qs[_0x2c5dab('0x6b')](_0x1c99a1['query']['fields'])),_0x124a89[_0x2c5dab('0x54')]=_0x124a89[_0x2c5dab('0x54')][_0x2c5dab('0x38')]?_0x124a89['attributes']:_0x35b0f1['model'];typeof _0x1c99a1['query'][_0x2c5dab('0x49')]==='undefined'&&(_0x124a89[_0x2c5dab('0x8b')]=qs['limit'](_0x1c99a1[_0x2c5dab('0x2b')][_0x2c5dab('0x8b')]),_0x124a89[_0x2c5dab('0x92')]=qs[_0x2c5dab('0x92')](_0x1c99a1[_0x2c5dab('0x2b')][_0x2c5dab('0x92')]));_0x124a89[_0x2c5dab('0x7b')]=qs['sort'](_0x1c99a1[_0x2c5dab('0x2b')][_0x2c5dab('0x81')]),_0x124a89[_0x2c5dab('0x88')]=qs[_0x2c5dab('0x2e')](_[_0x2c5dab('0x6e')](_0x1c99a1['query'],_0x35b0f1[_0x2c5dab('0x2e')])),_0x124a89['where'][_0x2c5dab('0x1f')]=_0x222081['id'];_0x1c99a1['query'][_0x2c5dab('0x3f')]&&(_0x124a89[_0x2c5dab('0x88')]=_['merge'](_0x124a89[_0x2c5dab('0x88')],{[Op['or']]:_['map'](_0x124a89['attributes'],function(_0x4a69b5){const _0x46f4d0=_0x2c5dab,_0x5930b8={};return _0x5930b8[_0x4a69b5]={[Op[_0x46f4d0('0x52')]]:'%'+_0x1c99a1[_0x46f4d0('0x2b')][_0x46f4d0('0x3f')]+'%'},_0x5930b8;})}));if(_0x1c99a1[_0x2c5dab('0x2b')]['$gte']){const _0x18c66d=_0x1c99a1[_0x2c5dab('0x2b')][_0x2c5dab('0x53')][_0x2c5dab('0x36')](','),_0x2b17c={};_0x2b17c[_0x18c66d[0x0]]={[Op['gte']]:moment(_0x18c66d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')},_0x124a89[_0x2c5dab('0x88')]=_[_0x2c5dab('0x3b')](_0x124a89['where'],_0x2b17c);}return _0x124a89=_['merge']({},_0x124a89,_0x1c99a1['options']),db[_0x2c5dab('0x56')][_0x2c5dab('0x45')]({'where':_0x124a89[_0x2c5dab('0x88')]})['then'](function(_0x57b405){const _0x6a0197=_0x2c5dab;return _0x35f3df['count']=_0x57b405,_0x1c99a1[_0x6a0197('0x2b')][_0x6a0197('0x10')]&&(_0x124a89['include']=[{'all':!![]}]),db[_0x6a0197('0x56')][_0x6a0197('0x3d')](_0x124a89);})[_0x2c5dab('0x97')](function(_0x4bbd65){const _0x475d86=_0x2c5dab;return _0x35f3df[_0x475d86('0x3e')]=_0x4bbd65,_0x35f3df;});}})[_0x56bb0f('0x97')](respondWithFilteredResult(_0x2a7af9,_0x124a89))[_0x56bb0f('0x76')](handleError(_0x2a7af9,null));},exports[_0x26bbbf('0x2')]=function(_0x2a0990,_0x485a1e){const _0x12d1e0=_0x26bbbf;let _0xde36a5,_0x11aa2a;return _0x2a0990['body']['to']&&(_0x11aa2a=_0x2a0990[_0x12d1e0('0xc')]['to'][0x0]),db[_0x12d1e0('0x55')][_0x12d1e0('0x5c')]({'where':{'id':_0x2a0990[_0x12d1e0('0xa1')]['id']},'include':[{'model':db[_0x12d1e0('0x95')],'as':_0x12d1e0('0x9f'),'include':[{'model':db[_0x12d1e0('0x50')],'as':'Contacts','where':{'fax':_0x11aa2a},'limit':0x1,'order':[[_0x12d1e0('0x7a'),'DESC']]}]}]})[_0x12d1e0('0x97')](handleEntityNotFound(_0x485a1e,null))['then'](function(_0x2d316e){const _0x887ff3=_0x12d1e0;_0xde36a5=_0x2d316e;if(_0x2a0990[_0x887ff3('0xc')][_0x887ff3('0x42')]&&_0x2a0990[_0x887ff3('0xc')][_0x887ff3('0x42')]['length'])for(let _0x16e7c9=0x0;_0x16e7c9<_0x2a0990[_0x887ff3('0xc')]['attachments'][_0x887ff3('0x38')];_0x16e7c9+=0x1){_0x2a0990['body'][_0x887ff3('0x42')][_0x16e7c9]={'filename':_0x2a0990[_0x887ff3('0xc')][_0x887ff3('0x42')][_0x16e7c9][_0x887ff3('0x47')],'id':_0x2a0990[_0x887ff3('0xc')][_0x887ff3('0x42')][_0x16e7c9]['id'],'path':path['join'](config['root'],_0x887ff3('0x7e'),_0x2a0990[_0x887ff3('0xc')][_0x887ff3('0x42')][_0x16e7c9][_0x887ff3('0x71')])};}return respondWithRpcPromise(_0x887ff3('0xd'),_0x887ff3('0xd'),{'FaxAccountId':_[_0x887ff3('0x96')](_0x2a0990[_0x887ff3('0xa1')]['id'])?undefined:_0x2a0990[_0x887ff3('0xa1')]['id'],'path':_['isNil'](_0x2a0990[_0x887ff3('0xc')][_0x887ff3('0x42')][0x0]['path'])?undefined:_0x2a0990['body'][_0x887ff3('0x42')][0x0]['path'],'fax':_[_0x887ff3('0x96')](_0x2a0990[_0x887ff3('0xc')]['to'][0x0])?undefined:_0x2a0990['body']['to'][0x0]},client9002);})['then'](function(){const _0x4a2b12=_0x12d1e0;if(_0xde36a5){_[_0x4a2b12('0x96')](_0x2a0990[_0x4a2b12('0xc')]['from'])&&(_0x2a0990[_0x4a2b12('0xc')][_0x4a2b12('0x6')]=util[_0x4a2b12('0x5')](_0x4a2b12('0x13'),_0xde36a5[_0x4a2b12('0x47')],_0xde36a5[_0x4a2b12('0x2a')]));if(_0xde36a5[_0x4a2b12('0x9f')])return _0xde36a5[_0x4a2b12('0x9f')][_0x4a2b12('0x5b')][_0x4a2b12('0x38')]?_0xde36a5[_0x4a2b12('0x9f')][_0x4a2b12('0x5b')][0x0]:db[_0x4a2b12('0x50')]['create'](_[_0x4a2b12('0x17')](_0x2a0990[_0x4a2b12('0xc')],{'firstName':_0x2a0990[_0x4a2b12('0xc')]['to'][0x0],'phone':_0x2a0990[_0x4a2b12('0xc')]['to'][0x0],'fax':_0x2a0990[_0x4a2b12('0xc')]['to'][0x0],'ListId':_0xde36a5[_0x4a2b12('0x8d')]}));else throw new Error('List\x20not\x20found');}else throw new Error(_0x4a2b12('0x9'));})[_0x12d1e0('0x97')](function(_0x12a8fe){if(_0x12a8fe)return db['FaxInteraction']['findOne']({'where':{'ContactId':_0x12a8fe['id'],'closed':![],'FaxAccountId':_0xde36a5['id']}})['then'](function(_0x4fa374){const _0xc45242=a186_0x51c2;if(_0x4fa374)return[_0x4fa374,![]];return db[_0xc45242('0x6c')][_0xc45242('0x74')]({'UserId':_0x2a0990[_0xc45242('0x99')]['id'],'ContactId':_0x12a8fe['id'],'FaxAccountId':_0xde36a5['id'],'fax':_0x2a0990[_0xc45242('0xc')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xc45242('0x3b')](_0x2a0990[_0xc45242('0xc')],{'read':![],'body':_0x2a0990['body'][_0xc45242('0x42')][0x0][_0xc45242('0x7f')],'FaxAccountId':_0xde36a5['id'],'UserId':_0x2a0990[_0xc45242('0x99')]['id'],'ContactId':_0x12a8fe['id'],'AttachmentId':_0x2a0990['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xc45242('0x56')],'as':_0xc45242('0x48')}]})[_0xc45242('0x97')](function(_0x1dacd8){return[_0x1dacd8,!![]];});});else throw new Error('Contact\x20not\x20found');})[_0x12d1e0('0x97')](function([_0x53e07d,_0x1f7684]){const _0x2994e2=_0x12d1e0;if(_0x1f7684)return _0x53e07d;return db[_0x2994e2('0x56')]['create']({'direction':_0x2994e2('0x1c'),'read':![],'body':_0x2a0990[_0x2994e2('0xc')]['attachments'][0x0]['filename'],'FaxAccountId':_0xde36a5['id'],'FaxInteractionId':_0x53e07d['id'],'UserId':_0x2a0990['user']['id'],'ContactId':_0x53e07d[_0x2994e2('0x31')],'AttachmentId':_0x2a0990[_0x2994e2('0xc')][_0x2994e2('0x42')][0x0]['id']})[_0x2994e2('0x97')](function(_0x11fc4e){const _0x4c122a=_0x2994e2;return _0x53e07d[_0x4c122a('0x51')][_0x4c122a('0x48')]=[],_0x53e07d['dataValues'][_0x4c122a('0x48')][_0x4c122a('0x57')](_0x11fc4e['dataValues']),_0x53e07d;});})[_0x12d1e0('0x97')](function(_0x20141f){const _0x28e5e0=_0x12d1e0;return respondWithRpcPromise(_0x28e5e0('0x16'),_0x28e5e0('0x16'),{'FaxAccountId':_[_0x28e5e0('0x96')](_0x2a0990['params']['id'])?undefined:_0x2a0990[_0x28e5e0('0xa1')]['id'],'path':_[_0x28e5e0('0x96')](_0x2a0990[_0x28e5e0('0xc')][_0x28e5e0('0x42')][0x0]['path'])?undefined:_0x2a0990['body'][_0x28e5e0('0x42')][0x0][_0x28e5e0('0x98')],'fax':_[_0x28e5e0('0x96')](_0x2a0990['body']['to'][0x0])?undefined:_0x2a0990[_0x28e5e0('0xc')]['to'][0x0],'AttachmentId':_0x2a0990[_0x28e5e0('0xc')][_0x28e5e0('0x42')][0x0]['id']},client9002)[_0x28e5e0('0x97')](function(_0xc86bf3){const _0x4e137e=_0x28e5e0;logger[_0x4e137e('0x66')](_0x4e137e('0x3'),_0xc86bf3);})['catch'](function(_0x891777){logger['info']('SendFaxRpc,\x20%s',_0x891777);}),_0x20141f;})['then'](respondWithResult(_0x485a1e,null))[_0x12d1e0('0x76')](handleError(_0x485a1e,null));},exports[_0x26bbbf('0x0')]=function(_0x38c475,_0x1b4be5){const _0x297302=_0x26bbbf;return db[_0x297302('0x55')][_0x297302('0x5c')]({'where':{'id':_0x38c475[_0x297302('0xa1')]['id']}})[_0x297302('0x97')](function(_0x50f088){const _0x226bf6=_0x297302;if(_0x50f088)return _0x50f088[_0x226bf6('0x0')](_0x38c475[_0x226bf6('0xc')][_0x226bf6('0x60')],{'through':_[_0x226bf6('0x84')](_0x38c475['body'],[_0x226bf6('0x60'),'id'])})[_0x226bf6('0x97')](function(_0x20df42){const _0x296e92=_0x226bf6;for(let _0xda1abb=0x0;_0xda1abb<_0x38c475['body'][_0x296e92('0x60')][_0x296e92('0x38')];_0xda1abb+=0x1){socket[_0x296e92('0x67')](_0x296e92('0x79'),{'UserId':_0x38c475[_0x296e92('0xc')][_0x296e92('0x60')][_0xda1abb],'FaxAccountId':_0x38c475[_0x296e92('0xa1')]['id']});}return _0x20df42;});})['then'](respondWithResult(_0x1b4be5,null))[_0x297302('0x76')](handleError(_0x1b4be5,null));},exports[_0x26bbbf('0x27')]=function(_0x2bdaa9,_0x24dc34){const _0x56c48d=_0x26bbbf;return db[_0x56c48d('0x55')][_0x56c48d('0x5c')]({'where':{'id':_0x2bdaa9[_0x56c48d('0xa1')]['id']}})[_0x56c48d('0x97')](handleEntityNotFound(_0x24dc34,null))['then'](function(_0x5d76f7){const _0x155cc5=_0x56c48d;if(_0x5d76f7)return _0x5d76f7[_0x155cc5('0x27')](_0x2bdaa9['query'][_0x155cc5('0x60')])[_0x155cc5('0x97')](function(){const _0x21199c=_0x155cc5;if(_['isArray'](_0x2bdaa9['query'][_0x21199c('0x60')]))for(let _0x17714f=0x0;_0x17714f<_0x2bdaa9['query'][_0x21199c('0x60')]['length'];_0x17714f+=0x1){socket[_0x21199c('0x67')](_0x21199c('0x2f'),{'UserId':Number(_0x2bdaa9[_0x21199c('0x2b')][_0x21199c('0x60')][_0x17714f]),'FaxAccountId':Number(_0x2bdaa9[_0x21199c('0xa1')]['id'])});}else socket[_0x21199c('0x67')](_0x21199c('0x2f'),{'UserId':Number(_0x2bdaa9['query'][_0x21199c('0x60')]),'FaxAccountId':Number(_0x2bdaa9[_0x21199c('0xa1')]['id'])});});})[_0x56c48d('0x97')](respondWithStatusCode(_0x24dc34,null))['catch'](handleError(_0x24dc34,null));},exports[_0x26bbbf('0x8')]=function(_0x1f4af9,_0x12d5f0){const _0x2de5a3=_0x26bbbf;let _0x38e2bc={};const _0x146d51={};let _0x4a4b34,_0x496713;return db[_0x2de5a3('0x55')]['findOne']({'where':{'id':_0x1f4af9[_0x2de5a3('0xa1')]['id']}})[_0x2de5a3('0x97')](handleEntityNotFound(_0x12d5f0,null))['then'](function(_0x4e5e12){const _0x1255d3=_0x2de5a3;if(_0x4e5e12)return _0x4a4b34=_0x4e5e12,_0x146d51[_0x1255d3('0x3a')]=_[_0x1255d3('0x35')](db[_0x1255d3('0x29')]['rawAttributes']),_0x146d51[_0x1255d3('0x2b')]=_[_0x1255d3('0x35')](_0x1f4af9[_0x1255d3('0x2b')]),_0x146d51[_0x1255d3('0x2e')]=_[_0x1255d3('0x72')](_0x146d51[_0x1255d3('0x3a')],_0x146d51[_0x1255d3('0x2b')]),_0x38e2bc[_0x1255d3('0x54')]=_[_0x1255d3('0x72')](_0x146d51[_0x1255d3('0x3a')],qs[_0x1255d3('0x6b')](_0x1f4af9['query']['fields'])),_0x38e2bc[_0x1255d3('0x54')]=_0x38e2bc[_0x1255d3('0x54')][_0x1255d3('0x38')]?_0x38e2bc[_0x1255d3('0x54')]:_0x146d51[_0x1255d3('0x3a')],_0x38e2bc[_0x1255d3('0x7b')]=qs['sort'](_0x1f4af9[_0x1255d3('0x2b')][_0x1255d3('0x81')]),_0x38e2bc[_0x1255d3('0x88')]=qs[_0x1255d3('0x2e')](_['pick'](_0x1f4af9[_0x1255d3('0x2b')],_0x146d51[_0x1255d3('0x2e')])),_0x1f4af9[_0x1255d3('0x2b')][_0x1255d3('0x3f')]&&(_0x38e2bc[_0x1255d3('0x88')]=_[_0x1255d3('0x3b')](_0x38e2bc['where'],{[Op['or']]:_[_0x1255d3('0x4a')](_0x38e2bc['attributes'],function(_0x4cd990){const _0x353d05=_0x1255d3,_0x5c2cf1={};return _0x5c2cf1[_0x4cd990]={[Op['like']]:'%'+_0x1f4af9[_0x353d05('0x2b')][_0x353d05('0x3f')]+'%'},_0x5c2cf1;})})),_0x38e2bc=_[_0x1255d3('0x3b')]({},_0x38e2bc,_0x1f4af9['options']),_0x4a4b34['getAgents'](_0x38e2bc);})['then'](function(_0x1565f8){const _0x545918=_0x2de5a3;if(_0x1565f8)return _0x496713=_0x1565f8[_0x545918('0x38')],typeof _0x1f4af9[_0x545918('0x2b')][_0x545918('0x49')]==='undefined'&&(_0x38e2bc['limit']=qs['limit'](_0x1f4af9['query']['limit']),_0x38e2bc[_0x545918('0x92')]=qs[_0x545918('0x92')](_0x1f4af9['query']['offset'])),_0x4a4b34['getAgents'](_0x38e2bc);})['then'](function(_0x3c303a){if(_0x3c303a)return _0x3c303a?{'count':_0x496713,'rows':_0x3c303a}:null;})['then'](respondWithResult(_0x12d5f0,null))['catch'](handleError(_0x12d5f0,null));};
\ No newline at end of file