Built motion from commit aab208717af8d15f4fa224cdb6a202877019af9b. Version 3.0.0...
[motion-next.git] / server / api / faxAccount / faxAccount.rpc.js
index ec8204e..c1330d9 100644 (file)
@@ -1 +1 @@
-const a189_0x4034=['request\x20sent','Start','findAll','from','info','AttachmentId','Applications','autoclose','CmContact','map','attributes','../../mysqldb','get','client','include','*,*,*,*','sequelize','error','UserId','isNil','priority','contact','catch','rpc','difference','includes','create','stringify','interaction','List','where','register','ContactId','FaxAccount,\x20%s,\x20%s','unshift','body\x20is\x20mandatory\x20and\x20not\x20empty','FaxInteraction','FaxMessage','keys','DESC','created','CmList','Contacts','model','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','then','FaxAccount,\x20%s,\x20%s,\x20%s','waitForTheAssignedAgent','body','asc','options','updatedAt','agent','http','../../config/logger','code','describe','findOne','GetFaxAccount','createdAt','ListId','mapKey','Contact\x20not\x20found','debug','unmanaged','../../rediscache','FaxAccount','result','push','User','account','applications','fax','lodash','defaults','name','list','message'];(function(_0x241f4a,_0x403438){const _0x12a0f0=function(_0x58a4d7){while(--_0x58a4d7){_0x241f4a['push'](_0x241f4a['shift']());}};_0x12a0f0(++_0x403438);}(a189_0x4034,0x8f));const a189_0x12a0=function(_0x241f4a,_0x403438){_0x241f4a=_0x241f4a-0x0;let _0x12a0f0=a189_0x4034[_0x241f4a];return _0x12a0f0;};const _0x3b2199=a189_0x12a0;'use strict';const _=require(_0x3b2199('0x8')),db=require(_0x3b2199('0x18'))['db'],{ValidationError}=require(_0x3b2199('0x1d')),logger=require(_0x3b2199('0x43'))(_0x3b2199('0x24')),{getSocket}=require(_0x3b2199('0x0')),socket=getSocket(),jayson=require('jayson/promise'),client=jayson[_0x3b2199('0x1a')][_0x3b2199('0x42')]({'port':0x232c});require('./faxAccount.socket')[_0x3b2199('0x2c')](socket);function respondWithRpcPromise(_0x58a4d7,_0x3d514a,_0x3fd3cf){return new Promise(function(_0x3598ca,_0xb48019){const _0x5ce126=a189_0x12a0;return client['request'](_0x58a4d7,_0x3fd3cf)[_0x5ce126('0x3a')](function(_0x16862d){const _0x323e77=_0x5ce126;logger['info'](_0x323e77('0x2e'),_0x3d514a,_0x323e77('0xd')),logger[_0x323e77('0x4c')](_0x323e77('0x3b'),_0x3d514a,_0x323e77('0xd'),JSON[_0x323e77('0x28')](_0x16862d));if(_0x16862d['error']){if(_0x16862d[_0x323e77('0x1e')][_0x323e77('0x44')]===0x1f4)return logger[_0x323e77('0x1e')](_0x323e77('0x2e'),_0x3d514a,_0x16862d['error']['message']),_0xb48019(_0x16862d['error'][_0x323e77('0xc')]);return logger[_0x323e77('0x1e')](_0x323e77('0x2e'),_0x3d514a,_0x16862d[_0x323e77('0x1e')][_0x323e77('0xc')]),_0x3598ca(_0x16862d[_0x323e77('0x1e')][_0x323e77('0xc')]);}else logger[_0x323e77('0x11')](_0x323e77('0x2e'),_0x3d514a,_0x323e77('0xd')),_0x3598ca(_0x16862d[_0x323e77('0x2')][_0x323e77('0xc')]);})[_0x5ce126('0x23')](function(_0x45d47a){const _0x53b0aa=_0x5ce126;logger['error'](_0x53b0aa('0x2e'),_0x3d514a,_0x45d47a),_0xb48019(_0x45d47a);});});}exports[_0x3b2199('0x47')]=function(_0x5fb79b){const _0x236665=this;return new Promise(function(_0x18c65c,_0x47ed83){const _0x13d975=a189_0x12a0;return db[_0x13d975('0x1')][_0x13d975('0xf')]({'raw':_0x5fb79b[_0x13d975('0x3f')]?_0x5fb79b[_0x13d975('0x3f')]['raw']===undefined?!![]:![]:!![],'where':_0x5fb79b[_0x13d975('0x3f')]?_0x5fb79b[_0x13d975('0x3f')][_0x13d975('0x2b')]||null:null,'attributes':_0x5fb79b[_0x13d975('0x3f')]?_0x5fb79b[_0x13d975('0x3f')]['attributes']||null:null,'limit':_0x5fb79b[_0x13d975('0x3f')]?_0x5fb79b['options']['limit']||null:null,'include':_0x5fb79b['options']?_0x5fb79b[_0x13d975('0x3f')][_0x13d975('0x1b')]?_['map'](_0x5fb79b['options']['include'],function(_0x5af328){const _0x2d40fa=_0x13d975;return{'model':db[_0x5af328[_0x2d40fa('0x38')]],'as':_0x5af328['as'],'attributes':_0x5af328['attributes'],'include':_0x5af328[_0x2d40fa('0x1b')]?_['map'](_0x5af328['include'],function(_0x5bc0f0){const _0x303350=_0x2d40fa;return{'model':db[_0x5bc0f0[_0x303350('0x38')]],'as':_0x5bc0f0['as'],'attributes':_0x5bc0f0[_0x303350('0x17')],'include':_0x5bc0f0[_0x303350('0x1b')]?_[_0x303350('0x16')](_0x5bc0f0[_0x303350('0x1b')],function(_0x43deaa){const _0x2bc833=_0x303350;return{'model':db[_0x43deaa[_0x2bc833('0x38')]],'as':_0x43deaa['as'],'attributes':_0x43deaa[_0x2bc833('0x17')]};}):[]};}):[]};}):[]:[]})[_0x13d975('0x3a')](function(_0x390144){const _0x2d181a=_0x13d975;logger['info'](_0x2d181a('0x47'),_0x5fb79b),logger[_0x2d181a('0x4c')](_0x2d181a('0x47'),_0x5fb79b,JSON[_0x2d181a('0x28')](_0x390144)),_0x18c65c(_0x390144);})['catch'](function(_0xdee7d8){const _0x2b237c=_0x13d975;logger['error'](_0x2b237c('0x47'),_0xdee7d8['message'],_0x5fb79b),_0x47ed83(_0x236665[_0x2b237c('0x1e')](0x1f4,_0xdee7d8['message']));});});},exports['NotifyFaxAccount']=function(_0x1beb85){const _0x4010f6=this;return new Promise(function(_0x21c685,_0x4c9e65){const _0x275769=a189_0x12a0,_0x308b90={'body':_0x1beb85['body'],'channel':_0x275769('0x7')};let _0x1e57e0=[],_0x53a4da=[];const _0x517722={};return db[_0x275769('0x15')][_0x275769('0x45')]()['then'](function(_0x10cfd8){const _0x8718c3=_0x275769;if(!_0x10cfd8)throw new ValidationError('no\x20available\x20attributes');_0x1e57e0=_[_0x8718c3('0x25')](_[_0x8718c3('0x33')](_0x10cfd8),[_0x8718c3('0x48'),_0x8718c3('0x40')]),_0x53a4da=_[_0x8718c3('0x25')](_['keys'](_0x10cfd8),['createdAt',_0x8718c3('0x40'),'CompanyId',_0x8718c3('0x49')]);_0x1beb85['body']['id']&&delete _0x1beb85[_0x8718c3('0x3d')]['id'];if(_['isNil'](_0x1beb85[_0x8718c3('0x3d')][_0x8718c3('0x10')]))throw new ValidationError('from\x20is\x20mandatory');if(_[_0x8718c3('0x20')](_0x1beb85[_0x8718c3('0x3d')]['body'])||_0x1beb85[_0x8718c3('0x3d')][_0x8718c3('0x3d')]==='')throw new ValidationError(_0x8718c3('0x30'));if(_[_0x8718c3('0x20')](_0x1beb85[_0x8718c3('0x3d')][_0x8718c3('0x4a')]))throw new ValidationError(_0x8718c3('0x39')+_0x53a4da);if(!_[_0x8718c3('0x26')](_0x53a4da,_0x1beb85['body'][_0x8718c3('0x4a')]))throw new ValidationError('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x53a4da);_0x517722[_0x1beb85[_0x8718c3('0x3d')][_0x8718c3('0x4a')]]=_0x1beb85[_0x8718c3('0x3d')][_0x8718c3('0x10')];})[_0x275769('0x3a')](function(){const _0x5554ee=_0x275769;return db[_0x5554ee('0x1')][_0x5554ee('0x46')]({'where':{'id':_0x1beb85[_0x5554ee('0x5')]['id']},'include':[{'model':db[_0x5554ee('0x36')],'as':_0x5554ee('0x2a'),'include':[{'model':db[_0x5554ee('0x15')],'as':_0x5554ee('0x37'),'where':_0x517722,'limit':0x1,'order':[['updatedAt',_0x5554ee('0x34')]]}]},{'model':db['FaxApplication'],'as':_0x5554ee('0x13')}]});})[_0x275769('0x3a')](function(_0x2740a9){const _0x1b0b90=_0x275769;if(_0x2740a9&&_0x2740a9[_0x1b0b90('0x2a')]){const _0x1af716=_0x2740a9[_0x1b0b90('0x19')]({'plain':!![]});_0x308b90['account']=_0x1af716,_0x308b90[_0x1b0b90('0x6')]=_0x1af716[_0x1b0b90('0x13')],_0x308b90[_0x1b0b90('0xb')]=_0x1af716['List'],_0x308b90[_0x1b0b90('0x6')]=_['orderBy'](_0x308b90[_0x1b0b90('0x6')],[_0x1b0b90('0x21')],[_0x1b0b90('0x3e')]);_0x308b90['account'][_0x1b0b90('0x13')]&&delete _0x308b90[_0x1b0b90('0x5')]['Applications'];if(_0x308b90[_0x1b0b90('0x5')][_0x1b0b90('0x2a')]&&_0x308b90[_0x1b0b90('0x5')][_0x1b0b90('0x2a')][_0x1b0b90('0x37')]['length'])return _0x308b90[_0x1b0b90('0x5')][_0x1b0b90('0x2a')][_0x1b0b90('0x37')][0x0];const _0x1c2164=_[_0x1b0b90('0x9')](_0x1beb85[_0x1b0b90('0x3d')],{'firstName':_0x1beb85[_0x1b0b90('0x3d')]['from'],'ListId':_0x1af716[_0x1b0b90('0x49')]});return _0x1c2164[_0x1beb85['body']['mapKey']]=_0x1beb85['body'][_0x1b0b90('0x10')],db[_0x1b0b90('0x15')][_0x1b0b90('0x27')](_0x1c2164,{'fields':_0x1e57e0,'raw':!![]});}})[_0x275769('0x3a')](function(_0x51381d){const _0x4a6349=_0x275769;_0x308b90[_0x4a6349('0x22')]=_0x51381d;if(_0x51381d){const _0x35c86f={'ContactId':_0x51381d['id'],'FaxAccountId':_0x1beb85['account']['id'],'fax':_0x51381d[_0x4a6349('0x7')]};return db[_0x4a6349('0x31')][_0x4a6349('0x46')]({'where':{'ContactId':_0x51381d['id'],'closed':![],'FaxAccountId':_0x1beb85[_0x4a6349('0x5')]['id']}})[_0x4a6349('0x3a')](function(_0x286131){const _0x22b7f7=_0x4a6349;if(_0x286131)return[_0x286131,![]];return db[_0x22b7f7('0x31')][_0x22b7f7('0x27')](_0x35c86f)[_0x22b7f7('0x3a')](function(_0x1a6291){return[_0x1a6291,!![]];});});}else throw new Error(_0x4a6349('0x4b'));})[_0x275769('0x3a')](function([_0x436375,_0x1e75d4]){const _0x403739=_0x275769,_0x257980=_0x436375[_0x403739('0x19')]({'plain':!![]});return _0x1e75d4?(_0x308b90['account'][_0x403739('0x14')]&&_0x308b90[_0x403739('0x6')][_0x403739('0x3')]({'id':0x0,'priority':_0x308b90['applications']['length']+0x1,'app':'close','appdata':_0x403739('0x4d'),'interval':_0x403739('0x1c')}),_0x257980[_0x403739('0x35')]=!![]):_0x257980[_0x403739('0x35')]=![],_0x308b90[_0x403739('0x29')]=_0x257980,db[_0x403739('0x32')][_0x403739('0x27')]({'body':_0x1beb85[_0x403739('0x3d')][_0x403739('0x3d')],'FaxAccountId':_0x1beb85['account']['id'],'FaxInteractionId':_0x436375['id'],'direction':'in','ContactId':_0x436375[_0x403739('0x2d')],'AttachmentId':_0x1beb85['body'][_0x403739('0x12')]});})[_0x275769('0x3a')](function(_0x3f069d){const _0x5d6071=_0x275769;_0x308b90['message']=_0x3f069d;if(_0x308b90['interaction']['UserId'])return db[_0x5d6071('0x4')]['findOne']({'attributes':['id',_0x5d6071('0xa')],'where':{'id':_0x308b90['interaction'][_0x5d6071('0x1f')]}})[_0x5d6071('0x3a')](function(_0x5560b2){const _0x363062=_0x5d6071;return _0x5560b2&&_0x308b90[_0x363062('0x6')][_0x363062('0x2f')]({'id':0x0,'priority':0x0,'app':_0x363062('0x41'),'appdata':_0x5560b2[_0x363062('0xa')]+','+(_0x308b90['account'][_0x363062('0x3c')]||0xa),'interval':_0x363062('0x1c')}),respondWithRpcPromise(_0x363062('0xe'),'startRouting',_0x308b90);});return respondWithRpcPromise(_0x5d6071('0xe'),'startRouting',_0x308b90);})[_0x275769('0x3a')](function(_0x3f4d20){_0x21c685(_0x3f4d20);})['catch'](function(_0x46e6b8){const _0x5a561f=_0x275769;_0x4c9e65(_0x4010f6[_0x5a561f('0x1e')](0x1f4,_0x46e6b8[_0x5a561f('0xc')]));});});};
\ No newline at end of file
+const a189_0x3cde=['result','findAll','waitForTheAssignedAgent','*,*,*,*','NotifyFaxAccount','register','describe','no\x20available\x20attributes','FaxAccount,\x20%s,\x20%s','defaults','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','request','push','List','DESC','name','ListId','close','error','UserId','isNil','FaxMessage','interaction','from','../../rediscache','GetFaxAccount','createdAt','agent','asc','lodash','message','ContactId','then','catch','sequelize','./faxAccount.socket','info','attributes','Applications','CmList','../../mysqldb','create','../../config/logger','jayson/promise','include','FaxAccount,\x20%s,\x20%s,\x20%s','model','priority','mapKey','FaxInteraction','stringify','unmanaged','map','request\x20sent','created','CmContact','CompanyId','from\x20is\x20mandatory','autoclose','difference','code','options','where','findOne','FaxAccount','keys','AttachmentId','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','get','account','body','Start','startRouting','applications','fax','unshift','updatedAt','length','contact','client','Contacts'];(function(_0x292cf8,_0x3cdee4){const _0x8c5707=function(_0x5a4b5f){while(--_0x5a4b5f){_0x292cf8['push'](_0x292cf8['shift']());}};_0x8c5707(++_0x3cdee4);}(a189_0x3cde,0x1e9));const a189_0x8c57=function(_0x292cf8,_0x3cdee4){_0x292cf8=_0x292cf8-0x0;let _0x8c5707=a189_0x3cde[_0x292cf8];return _0x8c5707;};const _0x3b3453=a189_0x8c57;'use strict';const _=require(_0x3b3453('0x1a')),db=require(_0x3b3453('0x25'))['db'],{ValidationError}=require(_0x3b3453('0x1f')),logger=require(_0x3b3453('0x27'))('rpc'),{getSocket}=require(_0x3b3453('0x15')),socket=getSocket(),jayson=require(_0x3b3453('0x28')),client=jayson[_0x3b3453('0x4c')]['http']({'port':0x232c});require(_0x3b3453('0x20'))[_0x3b3453('0x2')](socket);function respondWithRpcPromise(_0x5a4b5f,_0x418f66,_0x44eabb){return new Promise(function(_0x4914a9,_0x4d7d28){const _0x39a993=a189_0x8c57;return client[_0x39a993('0x8')](_0x5a4b5f,_0x44eabb)[_0x39a993('0x1d')](function(_0x513d74){const _0x240caa=_0x39a993;logger[_0x240caa('0x21')](_0x240caa('0x5'),_0x418f66,'request\x20sent'),logger['debug'](_0x240caa('0x2a'),_0x418f66,_0x240caa('0x32'),JSON[_0x240caa('0x2f')](_0x513d74));if(_0x513d74['error']){if(_0x513d74[_0x240caa('0xf')][_0x240caa('0x39')]===0x1f4)return logger[_0x240caa('0xf')](_0x240caa('0x5'),_0x418f66,_0x513d74[_0x240caa('0xf')]['message']),_0x4d7d28(_0x513d74[_0x240caa('0xf')]['message']);return logger[_0x240caa('0xf')](_0x240caa('0x5'),_0x418f66,_0x513d74[_0x240caa('0xf')]['message']),_0x4914a9(_0x513d74[_0x240caa('0xf')][_0x240caa('0x1b')]);}else logger[_0x240caa('0x21')](_0x240caa('0x5'),_0x418f66,_0x240caa('0x32')),_0x4914a9(_0x513d74[_0x240caa('0x4e')][_0x240caa('0x1b')]);})[_0x39a993('0x1e')](function(_0x122fca){const _0x3294f2=_0x39a993;logger['error'](_0x3294f2('0x5'),_0x418f66,_0x122fca),_0x4d7d28(_0x122fca);});});}exports[_0x3b3453('0x16')]=function(_0x4b0c38){const _0x54a5a6=this;return new Promise(function(_0x50011e,_0x58ccd5){const _0x45db73=a189_0x8c57;return db[_0x45db73('0x3d')][_0x45db73('0x4f')]({'raw':_0x4b0c38[_0x45db73('0x3a')]?_0x4b0c38[_0x45db73('0x3a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b0c38[_0x45db73('0x3a')]?_0x4b0c38[_0x45db73('0x3a')][_0x45db73('0x3b')]||null:null,'attributes':_0x4b0c38[_0x45db73('0x3a')]?_0x4b0c38[_0x45db73('0x3a')][_0x45db73('0x22')]||null:null,'limit':_0x4b0c38[_0x45db73('0x3a')]?_0x4b0c38[_0x45db73('0x3a')]['limit']||null:null,'include':_0x4b0c38[_0x45db73('0x3a')]?_0x4b0c38[_0x45db73('0x3a')][_0x45db73('0x29')]?_[_0x45db73('0x31')](_0x4b0c38[_0x45db73('0x3a')]['include'],function(_0xc3ef50){const _0x4a4455=_0x45db73;return{'model':db[_0xc3ef50[_0x4a4455('0x2b')]],'as':_0xc3ef50['as'],'attributes':_0xc3ef50['attributes'],'include':_0xc3ef50[_0x4a4455('0x29')]?_[_0x4a4455('0x31')](_0xc3ef50[_0x4a4455('0x29')],function(_0xa02bcf){const _0x3ce533=_0x4a4455;return{'model':db[_0xa02bcf[_0x3ce533('0x2b')]],'as':_0xa02bcf['as'],'attributes':_0xa02bcf[_0x3ce533('0x22')],'include':_0xa02bcf[_0x3ce533('0x29')]?_['map'](_0xa02bcf['include'],function(_0x50cd28){const _0x441646=_0x3ce533;return{'model':db[_0x50cd28['model']],'as':_0x50cd28['as'],'attributes':_0x50cd28[_0x441646('0x22')]};}):[]};}):[]};}):[]:[]})[_0x45db73('0x1d')](function(_0x3546f9){const _0x5da303=_0x45db73;logger['info'](_0x5da303('0x16'),_0x4b0c38),logger['debug'](_0x5da303('0x16'),_0x4b0c38,JSON[_0x5da303('0x2f')](_0x3546f9)),_0x50011e(_0x3546f9);})[_0x45db73('0x1e')](function(_0x27cabf){const _0x165c98=_0x45db73;logger[_0x165c98('0xf')](_0x165c98('0x16'),_0x27cabf[_0x165c98('0x1b')],_0x4b0c38),_0x58ccd5(_0x54a5a6[_0x165c98('0xf')](0x1f4,_0x27cabf['message']));});});},exports[_0x3b3453('0x1')]=function(_0x155dab){const _0x450be9=this;return new Promise(function(_0x14419e,_0x121552){const _0x2addea=a189_0x8c57,_0x388003={'body':_0x155dab[_0x2addea('0x43')],'channel':_0x2addea('0x47')};let _0x5144ba=[],_0xb3eb1e=[];const _0x35c36e={};return db['CmContact'][_0x2addea('0x3')]()[_0x2addea('0x1d')](function(_0x34b5ee){const _0x15321c=_0x2addea;if(!_0x34b5ee)throw new ValidationError(_0x15321c('0x4'));_0x5144ba=_[_0x15321c('0x38')](_[_0x15321c('0x3e')](_0x34b5ee),[_0x15321c('0x17'),_0x15321c('0x49')]),_0xb3eb1e=_[_0x15321c('0x38')](_[_0x15321c('0x3e')](_0x34b5ee),[_0x15321c('0x17'),'updatedAt',_0x15321c('0x35'),_0x15321c('0xd')]);_0x155dab[_0x15321c('0x43')]['id']&&delete _0x155dab['body']['id'];if(_['isNil'](_0x155dab[_0x15321c('0x43')]['from']))throw new ValidationError(_0x15321c('0x36'));if(_['isNil'](_0x155dab[_0x15321c('0x43')][_0x15321c('0x43')])||_0x155dab[_0x15321c('0x43')][_0x15321c('0x43')]==='')throw new ValidationError('body\x20is\x20mandatory\x20and\x20not\x20empty');if(_[_0x15321c('0x11')](_0x155dab[_0x15321c('0x43')][_0x15321c('0x2d')]))throw new ValidationError(_0x15321c('0x7')+_0xb3eb1e);if(!_['includes'](_0xb3eb1e,_0x155dab[_0x15321c('0x43')]['mapKey']))throw new ValidationError(_0x15321c('0x40')+_0xb3eb1e);_0x35c36e[_0x155dab[_0x15321c('0x43')][_0x15321c('0x2d')]]=_0x155dab[_0x15321c('0x43')][_0x15321c('0x14')];})[_0x2addea('0x1d')](function(){const _0x30c0b9=_0x2addea;return db[_0x30c0b9('0x3d')][_0x30c0b9('0x3c')]({'where':{'id':_0x155dab[_0x30c0b9('0x42')]['id']},'include':[{'model':db[_0x30c0b9('0x24')],'as':_0x30c0b9('0xa'),'include':[{'model':db[_0x30c0b9('0x34')],'as':'Contacts','where':_0x35c36e,'limit':0x1,'order':[[_0x30c0b9('0x49'),_0x30c0b9('0xb')]]}]},{'model':db['FaxApplication'],'as':_0x30c0b9('0x23')}]});})[_0x2addea('0x1d')](function(_0x27e6c7){const _0x1749d2=_0x2addea;if(_0x27e6c7&&_0x27e6c7['List']){const _0x119a2b=_0x27e6c7[_0x1749d2('0x41')]({'plain':!![]});_0x388003[_0x1749d2('0x42')]=_0x119a2b,_0x388003[_0x1749d2('0x46')]=_0x119a2b[_0x1749d2('0x23')],_0x388003['list']=_0x119a2b[_0x1749d2('0xa')],_0x388003[_0x1749d2('0x46')]=_['orderBy'](_0x388003['applications'],[_0x1749d2('0x2c')],[_0x1749d2('0x19')]);_0x388003[_0x1749d2('0x42')][_0x1749d2('0x23')]&&delete _0x388003['account'][_0x1749d2('0x23')];if(_0x388003[_0x1749d2('0x42')][_0x1749d2('0xa')]&&_0x388003['account'][_0x1749d2('0xa')][_0x1749d2('0x4d')][_0x1749d2('0x4a')])return _0x388003['account'][_0x1749d2('0xa')][_0x1749d2('0x4d')][0x0];const _0x4b80c6=_[_0x1749d2('0x6')](_0x155dab['body'],{'firstName':_0x155dab[_0x1749d2('0x43')][_0x1749d2('0x14')],'ListId':_0x119a2b['ListId']});return _0x4b80c6[_0x155dab[_0x1749d2('0x43')][_0x1749d2('0x2d')]]=_0x155dab[_0x1749d2('0x43')][_0x1749d2('0x14')],db[_0x1749d2('0x34')][_0x1749d2('0x26')](_0x4b80c6,{'fields':_0x5144ba,'raw':!![]});}})[_0x2addea('0x1d')](function(_0x1776c9){const _0x3b094c=_0x2addea;_0x388003[_0x3b094c('0x4b')]=_0x1776c9;if(_0x1776c9){const _0x4552d1={'ContactId':_0x1776c9['id'],'FaxAccountId':_0x155dab[_0x3b094c('0x42')]['id'],'fax':_0x1776c9[_0x3b094c('0x47')]};return db['FaxInteraction'][_0x3b094c('0x3c')]({'where':{'ContactId':_0x1776c9['id'],'closed':![],'FaxAccountId':_0x155dab[_0x3b094c('0x42')]['id']}})['then'](function(_0x373834){const _0x181be1=_0x3b094c;if(_0x373834)return[_0x373834,![]];return db[_0x181be1('0x2e')]['create'](_0x4552d1)['then'](function(_0x398b29){return[_0x398b29,!![]];});});}else throw new Error('Contact\x20not\x20found');})[_0x2addea('0x1d')](function([_0x37d74a,_0x37238e]){const _0x4ad5cc=_0x2addea,_0x3499ff=_0x37d74a[_0x4ad5cc('0x41')]({'plain':!![]});return _0x37238e?(_0x388003[_0x4ad5cc('0x42')][_0x4ad5cc('0x37')]&&_0x388003[_0x4ad5cc('0x46')][_0x4ad5cc('0x9')]({'id':0x0,'priority':_0x388003[_0x4ad5cc('0x46')]['length']+0x1,'app':_0x4ad5cc('0xe'),'appdata':_0x4ad5cc('0x30'),'interval':_0x4ad5cc('0x0')}),_0x3499ff['created']=!![]):_0x3499ff[_0x4ad5cc('0x33')]=![],_0x388003['interaction']=_0x3499ff,db[_0x4ad5cc('0x12')]['create']({'body':_0x155dab['body'][_0x4ad5cc('0x43')],'FaxAccountId':_0x155dab[_0x4ad5cc('0x42')]['id'],'FaxInteractionId':_0x37d74a['id'],'direction':'in','ContactId':_0x37d74a[_0x4ad5cc('0x1c')],'AttachmentId':_0x155dab[_0x4ad5cc('0x43')][_0x4ad5cc('0x3f')]});})['then'](function(_0x1fae1d){const _0x1c81a8=_0x2addea;_0x388003['message']=_0x1fae1d;if(_0x388003[_0x1c81a8('0x13')][_0x1c81a8('0x10')])return db['User'][_0x1c81a8('0x3c')]({'attributes':['id','name'],'where':{'id':_0x388003[_0x1c81a8('0x13')][_0x1c81a8('0x10')]}})[_0x1c81a8('0x1d')](function(_0x3292b5){const _0x5eebc4=_0x1c81a8;return _0x3292b5&&_0x388003['applications'][_0x5eebc4('0x48')]({'id':0x0,'priority':0x0,'app':_0x5eebc4('0x18'),'appdata':_0x3292b5[_0x5eebc4('0xc')]+','+(_0x388003[_0x5eebc4('0x42')][_0x5eebc4('0x50')]||0xa),'interval':_0x5eebc4('0x0')}),respondWithRpcPromise(_0x5eebc4('0x44'),_0x5eebc4('0x45'),_0x388003);});return respondWithRpcPromise(_0x1c81a8('0x44'),_0x1c81a8('0x45'),_0x388003);})['then'](function(_0x12be7c){_0x14419e(_0x12be7c);})['catch'](function(_0x17a99e){const _0x4184b4=_0x2addea;_0x121552(_0x450be9[_0x4184b4('0xf')](0x1f4,_0x17a99e[_0x4184b4('0x1b')]));});});};
\ No newline at end of file