Built motion from commit bfc7a72f7045b27461c9a5d1f71c1a658cfd0b8b. Version 3.0.0...
[motion-next.git] / server / api / faxAccount / faxAccount.rpc.js
index 2257143..d826f5a 100644 (file)
@@ -1 +1 @@
-const a189_0x540a=['Contact\x20not\x20found','attributes','applications','isNil','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','priority','from\x20is\x20mandatory','result','findAll','CmContact','register','contact','request','CmList','defaults','length','message','account','info','get','created','orderBy','FaxAccount,\x20%s,\x20%s','code','then','raw','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','agent','keys','waitForTheAssignedAgent','map','catch','User','ListId','DESC','http','close','createdAt','options','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','fax','unmanaged','rpc','../../rediscache','client','from','GetFaxAccount','Contacts','create','mapKey','Applications','name','error','Start','difference','findOne','FaxApplication','FaxInteraction','list','model','jayson/promise','limit','startRouting','unshift','interaction','no\x20available\x20attributes','asc','sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','debug','ContactId','body','List','*,*,*,*','include','updatedAt','request\x20sent','../../config/logger','describe','FaxAccount','lodash'];(function(_0x4aeb41,_0x540a4a){const _0x8c5a1c=function(_0x46e23e){while(--_0x46e23e){_0x4aeb41['push'](_0x4aeb41['shift']());}};_0x8c5a1c(++_0x540a4a);}(a189_0x540a,0x1f4));const a189_0x8c5a=function(_0x4aeb41,_0x540a4a){_0x4aeb41=_0x4aeb41-0x0;let _0x8c5a1c=a189_0x540a[_0x4aeb41];return _0x8c5a1c;};const _0x50b46a=a189_0x8c5a;'use strict';const _=require(_0x50b46a('0x49')),db=require('../../mysqldb')['db'],{ValidationError}=require(_0x50b46a('0x3c')),logger=require(_0x50b46a('0x46'))(_0x50b46a('0x23')),{getSocket}=require(_0x50b46a('0x24')),socket=getSocket(),jayson=require(_0x50b46a('0x35')),client=jayson[_0x50b46a('0x25')][_0x50b46a('0x1b')]({'port':0x232c});require('./faxAccount.socket')[_0x50b46a('0x2')](socket);function respondWithRpcPromise(_0x46e23e,_0x359f3,_0x7f7e7b){return new Promise(function(_0x412c06,_0x558963){const _0x2d6e9c=a189_0x8c5a;return client[_0x2d6e9c('0x4')](_0x46e23e,_0x7f7e7b)[_0x2d6e9c('0x10')](function(_0x163042){const _0x3a3821=_0x2d6e9c;logger[_0x3a3821('0xa')](_0x3a3821('0xe'),_0x359f3,_0x3a3821('0x45')),logger[_0x3a3821('0x3e')](_0x3a3821('0x1f'),_0x359f3,_0x3a3821('0x45'),JSON[_0x3a3821('0x20')](_0x163042));if(_0x163042['error']){if(_0x163042['error'][_0x3a3821('0xf')]===0x1f4)return logger[_0x3a3821('0x2d')](_0x3a3821('0xe'),_0x359f3,_0x163042[_0x3a3821('0x2d')]['message']),_0x558963(_0x163042[_0x3a3821('0x2d')][_0x3a3821('0x8')]);return logger['error']('FaxAccount,\x20%s,\x20%s',_0x359f3,_0x163042[_0x3a3821('0x2d')][_0x3a3821('0x8')]),_0x412c06(_0x163042['error']['message']);}else logger[_0x3a3821('0xa')](_0x3a3821('0xe'),_0x359f3,_0x3a3821('0x45')),_0x412c06(_0x163042[_0x3a3821('0x51')]['message']);})[_0x2d6e9c('0x17')](function(_0x139a83){logger['error']('FaxAccount,\x20%s,\x20%s',_0x359f3,_0x139a83),_0x558963(_0x139a83);});});}exports[_0x50b46a('0x27')]=function(_0x114e18){const _0x58f614=this;return new Promise(function(_0x5dc04e,_0x3587d1){const _0x2aff96=a189_0x8c5a;return db['FaxAccount'][_0x2aff96('0x0')]({'raw':_0x114e18[_0x2aff96('0x1e')]?_0x114e18[_0x2aff96('0x1e')][_0x2aff96('0x11')]===undefined?!![]:![]:!![],'where':_0x114e18[_0x2aff96('0x1e')]?_0x114e18[_0x2aff96('0x1e')]['where']||null:null,'attributes':_0x114e18[_0x2aff96('0x1e')]?_0x114e18['options'][_0x2aff96('0x4b')]||null:null,'limit':_0x114e18[_0x2aff96('0x1e')]?_0x114e18[_0x2aff96('0x1e')][_0x2aff96('0x36')]||null:null,'include':_0x114e18[_0x2aff96('0x1e')]?_0x114e18[_0x2aff96('0x1e')][_0x2aff96('0x43')]?_[_0x2aff96('0x16')](_0x114e18['options'][_0x2aff96('0x43')],function(_0x535445){const _0x10781c=_0x2aff96;return{'model':db[_0x535445[_0x10781c('0x34')]],'as':_0x535445['as'],'attributes':_0x535445[_0x10781c('0x4b')],'include':_0x535445[_0x10781c('0x43')]?_[_0x10781c('0x16')](_0x535445['include'],function(_0xcf0cae){const _0x581600=_0x10781c;return{'model':db[_0xcf0cae[_0x581600('0x34')]],'as':_0xcf0cae['as'],'attributes':_0xcf0cae[_0x581600('0x4b')],'include':_0xcf0cae[_0x581600('0x43')]?_[_0x581600('0x16')](_0xcf0cae[_0x581600('0x43')],function(_0x156e99){const _0x9777e0=_0x581600;return{'model':db[_0x156e99[_0x9777e0('0x34')]],'as':_0x156e99['as'],'attributes':_0x156e99[_0x9777e0('0x4b')]};}):[]};}):[]};}):[]:[]})[_0x2aff96('0x10')](function(_0x3f6ed3){const _0x5a760c=_0x2aff96;logger[_0x5a760c('0xa')](_0x5a760c('0x27'),_0x114e18),logger[_0x5a760c('0x3e')](_0x5a760c('0x27'),_0x114e18,JSON[_0x5a760c('0x20')](_0x3f6ed3)),_0x5dc04e(_0x3f6ed3);})['catch'](function(_0x40bc5f){const _0x136761=_0x2aff96;logger['error'](_0x136761('0x27'),_0x40bc5f[_0x136761('0x8')],_0x114e18),_0x3587d1(_0x58f614[_0x136761('0x2d')](0x1f4,_0x40bc5f[_0x136761('0x8')]));});});},exports['NotifyFaxAccount']=function(_0x42b9d4){const _0x2c0263=this;return new Promise(function(_0x55e17d,_0x2197fc){const _0x19f762=a189_0x8c5a,_0x15d617={'body':_0x42b9d4['body'],'channel':_0x19f762('0x21')};let _0x521871=[],_0x179ba6=[];const _0x28efc8={};return db[_0x19f762('0x1')][_0x19f762('0x47')]()[_0x19f762('0x10')](function(_0xb33e51){const _0x41fe37=_0x19f762;if(!_0xb33e51)throw new ValidationError(_0x41fe37('0x3a'));_0x521871=_[_0x41fe37('0x2f')](_[_0x41fe37('0x14')](_0xb33e51),[_0x41fe37('0x1d'),'updatedAt']),_0x179ba6=_[_0x41fe37('0x2f')](_[_0x41fe37('0x14')](_0xb33e51),[_0x41fe37('0x1d'),_0x41fe37('0x44'),'CompanyId','ListId']);_0x42b9d4[_0x41fe37('0x40')]['id']&&delete _0x42b9d4[_0x41fe37('0x40')]['id'];if(_[_0x41fe37('0x4d')](_0x42b9d4[_0x41fe37('0x40')]['from']))throw new ValidationError(_0x41fe37('0x50'));if(_[_0x41fe37('0x4d')](_0x42b9d4[_0x41fe37('0x40')][_0x41fe37('0x40')])||_0x42b9d4[_0x41fe37('0x40')][_0x41fe37('0x40')]==='')throw new ValidationError(_0x41fe37('0x3d'));if(_[_0x41fe37('0x4d')](_0x42b9d4['body'][_0x41fe37('0x2a')]))throw new ValidationError(_0x41fe37('0x12')+_0x179ba6);if(!_['includes'](_0x179ba6,_0x42b9d4[_0x41fe37('0x40')]['mapKey']))throw new ValidationError(_0x41fe37('0x4e')+_0x179ba6);_0x28efc8[_0x42b9d4[_0x41fe37('0x40')][_0x41fe37('0x2a')]]=_0x42b9d4[_0x41fe37('0x40')][_0x41fe37('0x26')];})[_0x19f762('0x10')](function(){const _0x21ad05=_0x19f762;return db[_0x21ad05('0x48')][_0x21ad05('0x30')]({'where':{'id':_0x42b9d4[_0x21ad05('0x9')]['id']},'include':[{'model':db[_0x21ad05('0x5')],'as':_0x21ad05('0x41'),'include':[{'model':db['CmContact'],'as':_0x21ad05('0x28'),'where':_0x28efc8,'limit':0x1,'order':[[_0x21ad05('0x44'),_0x21ad05('0x1a')]]}]},{'model':db[_0x21ad05('0x31')],'as':_0x21ad05('0x2b')}]});})[_0x19f762('0x10')](function(_0x25d83a){const _0x5a527d=_0x19f762;if(_0x25d83a&&_0x25d83a[_0x5a527d('0x41')]){const _0x513b67=_0x25d83a['get']({'plain':!![]});_0x15d617['account']=_0x513b67,_0x15d617['applications']=_0x513b67['Applications'],_0x15d617[_0x5a527d('0x33')]=_0x513b67[_0x5a527d('0x41')],_0x15d617[_0x5a527d('0x4c')]=_[_0x5a527d('0xd')](_0x15d617[_0x5a527d('0x4c')],[_0x5a527d('0x4f')],[_0x5a527d('0x3b')]);_0x15d617['account'][_0x5a527d('0x2b')]&&delete _0x15d617[_0x5a527d('0x9')]['Applications'];if(_0x15d617[_0x5a527d('0x9')][_0x5a527d('0x41')]&&_0x15d617['account'][_0x5a527d('0x41')][_0x5a527d('0x28')][_0x5a527d('0x7')])return _0x15d617[_0x5a527d('0x9')][_0x5a527d('0x41')][_0x5a527d('0x28')][0x0];const _0x58455b=_[_0x5a527d('0x6')](_0x42b9d4[_0x5a527d('0x40')],{'firstName':_0x42b9d4[_0x5a527d('0x40')][_0x5a527d('0x26')],'ListId':_0x513b67[_0x5a527d('0x19')]});return _0x58455b[_0x42b9d4[_0x5a527d('0x40')]['mapKey']]=_0x42b9d4[_0x5a527d('0x40')][_0x5a527d('0x26')],db[_0x5a527d('0x1')][_0x5a527d('0x29')](_0x58455b,{'fields':_0x521871,'raw':!![]});}})['then'](function(_0x27123d){const _0x117b20=_0x19f762;_0x15d617[_0x117b20('0x3')]=_0x27123d;if(_0x27123d){const _0xc2679={'ContactId':_0x27123d['id'],'FaxAccountId':_0x42b9d4[_0x117b20('0x9')]['id'],'fax':_0x27123d[_0x117b20('0x21')]};return db[_0x117b20('0x32')][_0x117b20('0x30')]({'where':{'ContactId':_0x27123d['id'],'closed':![],'FaxAccountId':_0x42b9d4[_0x117b20('0x9')]['id']}})[_0x117b20('0x10')](function(_0x48bce9){const _0x551141=_0x117b20;if(_0x48bce9)return[_0x48bce9,![]];return db[_0x551141('0x32')][_0x551141('0x29')](_0xc2679)[_0x551141('0x10')](function(_0x4f963e){return[_0x4f963e,!![]];});});}else throw new Error(_0x117b20('0x4a'));})['then'](function([_0x79e640,_0x39cc87]){const _0x4a63af=_0x19f762,_0x3be334=_0x79e640[_0x4a63af('0xb')]({'plain':!![]});return _0x39cc87?(_0x15d617[_0x4a63af('0x9')]['autoclose']&&_0x15d617[_0x4a63af('0x4c')]['push']({'id':0x0,'priority':_0x15d617[_0x4a63af('0x4c')][_0x4a63af('0x7')]+0x1,'app':_0x4a63af('0x1c'),'appdata':_0x4a63af('0x22'),'interval':_0x4a63af('0x42')}),_0x3be334[_0x4a63af('0xc')]=!![]):_0x3be334[_0x4a63af('0xc')]=![],_0x15d617['interaction']=_0x3be334,db['FaxMessage'][_0x4a63af('0x29')]({'body':_0x42b9d4['body'][_0x4a63af('0x40')],'FaxAccountId':_0x42b9d4[_0x4a63af('0x9')]['id'],'FaxInteractionId':_0x79e640['id'],'direction':'in','ContactId':_0x79e640[_0x4a63af('0x3f')],'AttachmentId':_0x42b9d4[_0x4a63af('0x40')]['AttachmentId']});})[_0x19f762('0x10')](function(_0x18b137){const _0xe7cd7b=_0x19f762;_0x15d617[_0xe7cd7b('0x8')]=_0x18b137;if(_0x15d617[_0xe7cd7b('0x39')]['UserId'])return db[_0xe7cd7b('0x18')][_0xe7cd7b('0x30')]({'attributes':['id',_0xe7cd7b('0x2c')],'where':{'id':_0x15d617[_0xe7cd7b('0x39')]['UserId']}})['then'](function(_0x23149f){const _0x5c6640=_0xe7cd7b;return _0x23149f&&_0x15d617[_0x5c6640('0x4c')][_0x5c6640('0x38')]({'id':0x0,'priority':0x0,'app':_0x5c6640('0x13'),'appdata':_0x23149f['name']+','+(_0x15d617[_0x5c6640('0x9')][_0x5c6640('0x15')]||0xa),'interval':_0x5c6640('0x42')}),respondWithRpcPromise(_0x5c6640('0x2e'),_0x5c6640('0x37'),_0x15d617);});return respondWithRpcPromise(_0xe7cd7b('0x2e'),_0xe7cd7b('0x37'),_0x15d617);})[_0x19f762('0x10')](function(_0x3ecd25){_0x55e17d(_0x3ecd25);})[_0x19f762('0x17')](function(_0x221c47){const _0x499420=_0x19f762;_0x2197fc(_0x2c0263[_0x499420('0x2d')](0x1f4,_0x221c47[_0x499420('0x8')]));});});};
\ No newline at end of file
+const a189_0x4189=['startRouting','ContactId','*,*,*,*','includes','limit','../../mysqldb','findAll','body\x20is\x20mandatory\x20and\x20not\x20empty','body','register','keys','then','GetFaxAccount','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOne','User','../../rediscache','contact','orderBy','fax','Contacts','close','length','catch','account','List','CompanyId','FaxAccount,\x20%s,\x20%s','name','ListId','lodash','error','../../config/logger','result','from\x20is\x20mandatory','describe','FaxInteraction','CmList','interaction','debug','FaxApplication','create','UserId','priority','where','agent','FaxAccount,\x20%s,\x20%s,\x20%s','FaxAccount','raw','Start','FaxMessage','difference','NotifyFaxAccount','push','sequelize','message','applications','attributes','rpc','info','createdAt','from','model','client','stringify','map','CmContact','AttachmentId','request','options','jayson/promise','unshift','Contact\x20not\x20found','updatedAt','Applications','get','isNil','mapKey','./faxAccount.socket','request\x20sent','include','waitForTheAssignedAgent'];(function(_0x6b82c2,_0x41898a){const _0x364a76=function(_0x55cf5d){while(--_0x55cf5d){_0x6b82c2['push'](_0x6b82c2['shift']());}};_0x364a76(++_0x41898a);}(a189_0x4189,0x1c1));const a189_0x364a=function(_0x6b82c2,_0x41898a){_0x6b82c2=_0x6b82c2-0x0;let _0x364a76=a189_0x4189[_0x6b82c2];return _0x364a76;};const _0x58e63c=a189_0x364a;'use strict';const _=require(_0x58e63c('0x49')),db=require(_0x58e63c('0x30'))['db'],{ValidationError}=require(_0x58e63c('0xf')),logger=require(_0x58e63c('0x4b'))(_0x58e63c('0x13')),{getSocket}=require(_0x58e63c('0x3b')),socket=getSocket(),jayson=require(_0x58e63c('0x1f')),client=jayson[_0x58e63c('0x18')]['http']({'port':0x232c});require(_0x58e63c('0x27'))[_0x58e63c('0x34')](socket);function respondWithRpcPromise(_0x55cf5d,_0x1a5a72,_0x45666e){return new Promise(function(_0x4ddec0,_0x10a6be){const _0x52149e=a189_0x364a;return client[_0x52149e('0x1d')](_0x55cf5d,_0x45666e)[_0x52149e('0x36')](function(_0x3a3687){const _0x283c25=_0x52149e;logger[_0x283c25('0x14')](_0x283c25('0x46'),_0x1a5a72,'request\x20sent'),logger[_0x283c25('0x0')](_0x283c25('0x7'),_0x1a5a72,_0x283c25('0x28'),JSON[_0x283c25('0x19')](_0x3a3687));if(_0x3a3687[_0x283c25('0x4a')]){if(_0x3a3687[_0x283c25('0x4a')]['code']===0x1f4)return logger[_0x283c25('0x4a')]('FaxAccount,\x20%s,\x20%s',_0x1a5a72,_0x3a3687['error'][_0x283c25('0x10')]),_0x10a6be(_0x3a3687[_0x283c25('0x4a')]['message']);return logger[_0x283c25('0x4a')]('FaxAccount,\x20%s,\x20%s',_0x1a5a72,_0x3a3687[_0x283c25('0x4a')][_0x283c25('0x10')]),_0x4ddec0(_0x3a3687[_0x283c25('0x4a')][_0x283c25('0x10')]);}else logger[_0x283c25('0x14')](_0x283c25('0x46'),_0x1a5a72,'request\x20sent'),_0x4ddec0(_0x3a3687[_0x283c25('0x4c')][_0x283c25('0x10')]);})[_0x52149e('0x42')](function(_0x3e2870){const _0x1ecadc=_0x52149e;logger[_0x1ecadc('0x4a')](_0x1ecadc('0x46'),_0x1a5a72,_0x3e2870),_0x10a6be(_0x3e2870);});});}exports[_0x58e63c('0x37')]=function(_0x3adbd6){const _0x4cd3c1=this;return new Promise(function(_0x1d9424,_0x589560){const _0x5c2dc7=a189_0x364a;return db[_0x5c2dc7('0x8')][_0x5c2dc7('0x31')]({'raw':_0x3adbd6[_0x5c2dc7('0x1e')]?_0x3adbd6[_0x5c2dc7('0x1e')][_0x5c2dc7('0x9')]===undefined?!![]:![]:!![],'where':_0x3adbd6[_0x5c2dc7('0x1e')]?_0x3adbd6['options'][_0x5c2dc7('0x5')]||null:null,'attributes':_0x3adbd6[_0x5c2dc7('0x1e')]?_0x3adbd6[_0x5c2dc7('0x1e')]['attributes']||null:null,'limit':_0x3adbd6['options']?_0x3adbd6['options'][_0x5c2dc7('0x2f')]||null:null,'include':_0x3adbd6[_0x5c2dc7('0x1e')]?_0x3adbd6[_0x5c2dc7('0x1e')]['include']?_[_0x5c2dc7('0x1a')](_0x3adbd6[_0x5c2dc7('0x1e')][_0x5c2dc7('0x29')],function(_0x154de7){const _0x3ce182=_0x5c2dc7;return{'model':db[_0x154de7[_0x3ce182('0x17')]],'as':_0x154de7['as'],'attributes':_0x154de7['attributes'],'include':_0x154de7[_0x3ce182('0x29')]?_[_0x3ce182('0x1a')](_0x154de7[_0x3ce182('0x29')],function(_0x397784){const _0x18d05c=_0x3ce182;return{'model':db[_0x397784[_0x18d05c('0x17')]],'as':_0x397784['as'],'attributes':_0x397784['attributes'],'include':_0x397784[_0x18d05c('0x29')]?_[_0x18d05c('0x1a')](_0x397784[_0x18d05c('0x29')],function(_0x407e66){const _0x4ac666=_0x18d05c;return{'model':db[_0x407e66[_0x4ac666('0x17')]],'as':_0x407e66['as'],'attributes':_0x407e66[_0x4ac666('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2885a2){const _0x55bb6b=_0x5c2dc7;logger[_0x55bb6b('0x14')]('GetFaxAccount',_0x3adbd6),logger[_0x55bb6b('0x0')](_0x55bb6b('0x37'),_0x3adbd6,JSON[_0x55bb6b('0x19')](_0x2885a2)),_0x1d9424(_0x2885a2);})[_0x5c2dc7('0x42')](function(_0x3198aa){const _0x81faae=_0x5c2dc7;logger['error'](_0x81faae('0x37'),_0x3198aa[_0x81faae('0x10')],_0x3adbd6),_0x589560(_0x4cd3c1[_0x81faae('0x4a')](0x1f4,_0x3198aa[_0x81faae('0x10')]));});});},exports[_0x58e63c('0xd')]=function(_0x5cab85){const _0x184a04=this;return new Promise(function(_0x2a773d,_0x12b480){const _0x3ed39f=a189_0x364a,_0x3fcedd={'body':_0x5cab85[_0x3ed39f('0x33')],'channel':_0x3ed39f('0x3e')};let _0x20c6e0=[],_0x1f85f3=[];const _0x5a5373={};return db[_0x3ed39f('0x1b')][_0x3ed39f('0x4e')]()[_0x3ed39f('0x36')](function(_0xcf62a0){const _0x3a9a92=_0x3ed39f;if(!_0xcf62a0)throw new ValidationError('no\x20available\x20attributes');_0x20c6e0=_['difference'](_[_0x3a9a92('0x35')](_0xcf62a0),[_0x3a9a92('0x15'),_0x3a9a92('0x22')]),_0x1f85f3=_[_0x3a9a92('0xc')](_[_0x3a9a92('0x35')](_0xcf62a0),[_0x3a9a92('0x15'),_0x3a9a92('0x22'),_0x3a9a92('0x45'),_0x3a9a92('0x48')]);_0x5cab85[_0x3a9a92('0x33')]['id']&&delete _0x5cab85[_0x3a9a92('0x33')]['id'];if(_[_0x3a9a92('0x25')](_0x5cab85[_0x3a9a92('0x33')][_0x3a9a92('0x16')]))throw new ValidationError(_0x3a9a92('0x4d'));if(_['isNil'](_0x5cab85['body']['body'])||_0x5cab85['body'][_0x3a9a92('0x33')]==='')throw new ValidationError(_0x3a9a92('0x32'));if(_[_0x3a9a92('0x25')](_0x5cab85[_0x3a9a92('0x33')][_0x3a9a92('0x26')]))throw new ValidationError(_0x3a9a92('0x38')+_0x1f85f3);if(!_[_0x3a9a92('0x2e')](_0x1f85f3,_0x5cab85[_0x3a9a92('0x33')][_0x3a9a92('0x26')]))throw new ValidationError('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f85f3);_0x5a5373[_0x5cab85[_0x3a9a92('0x33')][_0x3a9a92('0x26')]]=_0x5cab85[_0x3a9a92('0x33')][_0x3a9a92('0x16')];})[_0x3ed39f('0x36')](function(){const _0x39197e=_0x3ed39f;return db[_0x39197e('0x8')][_0x39197e('0x39')]({'where':{'id':_0x5cab85[_0x39197e('0x43')]['id']},'include':[{'model':db[_0x39197e('0x50')],'as':'List','include':[{'model':db[_0x39197e('0x1b')],'as':'Contacts','where':_0x5a5373,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x39197e('0x1')],'as':'Applications'}]});})[_0x3ed39f('0x36')](function(_0x329325){const _0x3dda8c=_0x3ed39f;if(_0x329325&&_0x329325[_0x3dda8c('0x44')]){const _0x123f3d=_0x329325['get']({'plain':!![]});_0x3fcedd['account']=_0x123f3d,_0x3fcedd[_0x3dda8c('0x11')]=_0x123f3d[_0x3dda8c('0x23')],_0x3fcedd['list']=_0x123f3d['List'],_0x3fcedd[_0x3dda8c('0x11')]=_[_0x3dda8c('0x3d')](_0x3fcedd['applications'],[_0x3dda8c('0x4')],['asc']);_0x3fcedd['account'][_0x3dda8c('0x23')]&&delete _0x3fcedd['account']['Applications'];if(_0x3fcedd[_0x3dda8c('0x43')][_0x3dda8c('0x44')]&&_0x3fcedd[_0x3dda8c('0x43')][_0x3dda8c('0x44')][_0x3dda8c('0x3f')][_0x3dda8c('0x41')])return _0x3fcedd[_0x3dda8c('0x43')][_0x3dda8c('0x44')][_0x3dda8c('0x3f')][0x0];const _0x21f338=_['defaults'](_0x5cab85[_0x3dda8c('0x33')],{'firstName':_0x5cab85[_0x3dda8c('0x33')][_0x3dda8c('0x16')],'ListId':_0x123f3d[_0x3dda8c('0x48')]});return _0x21f338[_0x5cab85['body']['mapKey']]=_0x5cab85[_0x3dda8c('0x33')][_0x3dda8c('0x16')],db['CmContact'][_0x3dda8c('0x2')](_0x21f338,{'fields':_0x20c6e0,'raw':!![]});}})[_0x3ed39f('0x36')](function(_0x56197f){const _0x49e730=_0x3ed39f;_0x3fcedd[_0x49e730('0x3c')]=_0x56197f;if(_0x56197f){const _0x2f879e={'ContactId':_0x56197f['id'],'FaxAccountId':_0x5cab85[_0x49e730('0x43')]['id'],'fax':_0x56197f[_0x49e730('0x3e')]};return db[_0x49e730('0x4f')][_0x49e730('0x39')]({'where':{'ContactId':_0x56197f['id'],'closed':![],'FaxAccountId':_0x5cab85[_0x49e730('0x43')]['id']}})['then'](function(_0x2e3d0f){const _0x43248f=_0x49e730;if(_0x2e3d0f)return[_0x2e3d0f,![]];return db['FaxInteraction']['create'](_0x2f879e)[_0x43248f('0x36')](function(_0x5461d0){return[_0x5461d0,!![]];});});}else throw new Error(_0x49e730('0x21'));})['then'](function([_0x216fbe,_0x595701]){const _0x27e9d6=_0x3ed39f,_0x48cae9=_0x216fbe[_0x27e9d6('0x24')]({'plain':!![]});return _0x595701?(_0x3fcedd[_0x27e9d6('0x43')]['autoclose']&&_0x3fcedd[_0x27e9d6('0x11')][_0x27e9d6('0xe')]({'id':0x0,'priority':_0x3fcedd[_0x27e9d6('0x11')][_0x27e9d6('0x41')]+0x1,'app':_0x27e9d6('0x40'),'appdata':'unmanaged','interval':_0x27e9d6('0x2d')}),_0x48cae9['created']=!![]):_0x48cae9['created']=![],_0x3fcedd[_0x27e9d6('0x51')]=_0x48cae9,db[_0x27e9d6('0xb')]['create']({'body':_0x5cab85['body'][_0x27e9d6('0x33')],'FaxAccountId':_0x5cab85[_0x27e9d6('0x43')]['id'],'FaxInteractionId':_0x216fbe['id'],'direction':'in','ContactId':_0x216fbe[_0x27e9d6('0x2c')],'AttachmentId':_0x5cab85[_0x27e9d6('0x33')][_0x27e9d6('0x1c')]});})[_0x3ed39f('0x36')](function(_0x4511c3){const _0x44f8a6=_0x3ed39f;_0x3fcedd[_0x44f8a6('0x10')]=_0x4511c3;if(_0x3fcedd[_0x44f8a6('0x51')]['UserId'])return db[_0x44f8a6('0x3a')][_0x44f8a6('0x39')]({'attributes':['id',_0x44f8a6('0x47')],'where':{'id':_0x3fcedd[_0x44f8a6('0x51')][_0x44f8a6('0x3')]}})[_0x44f8a6('0x36')](function(_0x5b932d){const _0x6b6dd6=_0x44f8a6;return _0x5b932d&&_0x3fcedd[_0x6b6dd6('0x11')][_0x6b6dd6('0x20')]({'id':0x0,'priority':0x0,'app':_0x6b6dd6('0x6'),'appdata':_0x5b932d['name']+','+(_0x3fcedd[_0x6b6dd6('0x43')][_0x6b6dd6('0x2a')]||0xa),'interval':_0x6b6dd6('0x2d')}),respondWithRpcPromise('Start','startRouting',_0x3fcedd);});return respondWithRpcPromise(_0x44f8a6('0xa'),_0x44f8a6('0x2b'),_0x3fcedd);})[_0x3ed39f('0x36')](function(_0x3537d7){_0x2a773d(_0x3537d7);})['catch'](function(_0x51e2e3){const _0x2b5b65=_0x3ed39f;_0x12b480(_0x184a04['error'](0x1f4,_0x51e2e3[_0x2b5b65('0x10')]));});});};
\ No newline at end of file