Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / faxAccount / faxAccount.rpc.js
index 68aaeac..8e07297 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4bc3=['orderBy','Contacts','length','defaults','create','contact','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','*,*,*,*','startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','describe','then','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','find','account','CmList','DESC','FaxApplication','Applications','List','get','applications'];(function(_0x21c991,_0xb2401c){var _0x3f99fa=function(_0x198c53){while(--_0x198c53){_0x21c991['push'](_0x21c991['shift']());}};_0x3f99fa(++_0xb2401c);}(_0x4bc3,0x107));var _0x34bc=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x4bc3[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require(_0x34bc('0x4'));var db=require(_0x34bc('0x5'))['db'];var utils=require(_0x34bc('0x6'));var logger=require(_0x34bc('0x7'))(_0x34bc('0x8'));var config=require(_0x34bc('0x9'));var jayson=require(_0x34bc('0xa'));var client=jayson['client']['http']({'port':0x232c});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x2afc2c,_0x52fb79,_0x609053){return new BPromise(function(_0x40d800,_0x447339){return client[_0x34bc('0x10')](_0x2afc2c,_0x609053)['then'](function(_0x8fdfc3){logger[_0x34bc('0x11')](_0x34bc('0x12'),_0x52fb79,_0x34bc('0x13'));logger[_0x34bc('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x52fb79,_0x34bc('0x13'),JSON[_0x34bc('0x15')](_0x8fdfc3));if(_0x8fdfc3[_0x34bc('0x16')]){if(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x52fb79,_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);return _0x447339(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);}logger[_0x34bc('0x16')](_0x34bc('0x12'),_0x52fb79,_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);return _0x40d800(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);}else{logger[_0x34bc('0x11')](_0x34bc('0x12'),_0x52fb79,_0x34bc('0x13'));_0x40d800(_0x8fdfc3['result']['message']);}})['catch'](function(_0x4b537a){logger['error'](_0x34bc('0x12'),_0x52fb79,_0x4b537a);_0x447339(_0x4b537a);});});}exports[_0x34bc('0x19')]=function(_0x27912e){var _0x29425d=this;return new Promise(function(_0x474ee8,_0x2450f0){return db[_0x34bc('0x1a')][_0x34bc('0x1b')]({'raw':_0x27912e[_0x34bc('0x1c')]?_0x27912e[_0x34bc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x27912e[_0x34bc('0x1c')]?_0x27912e['options']['where']||null:null,'attributes':_0x27912e[_0x34bc('0x1c')]?_0x27912e['options'][_0x34bc('0x1d')]||null:null,'limit':_0x27912e['options']?_0x27912e[_0x34bc('0x1c')][_0x34bc('0x1e')]||null:null,'include':_0x27912e[_0x34bc('0x1c')]?_0x27912e[_0x34bc('0x1c')][_0x34bc('0x1f')]?_[_0x34bc('0x20')](_0x27912e['options']['include'],function(_0x42c4f2){return{'model':db[_0x42c4f2[_0x34bc('0x21')]],'as':_0x42c4f2['as'],'attributes':_0x42c4f2['attributes'],'include':_0x42c4f2['include']?_[_0x34bc('0x20')](_0x42c4f2['include'],function(_0x2a1d22){return{'model':db[_0x2a1d22[_0x34bc('0x21')]],'as':_0x2a1d22['as'],'attributes':_0x2a1d22['attributes'],'include':_0x2a1d22[_0x34bc('0x1f')]?_['map'](_0x2a1d22['include'],function(_0x1545ca){return{'model':db[_0x1545ca[_0x34bc('0x21')]],'as':_0x1545ca['as'],'attributes':_0x1545ca[_0x34bc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdc37d9){logger[_0x34bc('0x11')](_0x34bc('0x19'),_0x27912e);logger[_0x34bc('0x14')](_0x34bc('0x19'),_0x27912e,JSON[_0x34bc('0x15')](_0xdc37d9));_0x474ee8(_0xdc37d9);})[_0x34bc('0x22')](function(_0x3544b2){logger[_0x34bc('0x16')]('GetFaxAccount',_0x3544b2[_0x34bc('0x18')],_0x27912e);_0x2450f0(_0x29425d[_0x34bc('0x16')](0x1f4,_0x3544b2['message']));});});};exports[_0x34bc('0x23')]=function(_0x1f5fa6,_0x2c48ea,_0x5aa528){var _0x3ee096=this;return new Promise(function(_0x146ff3,_0x28f948){var _0x498ad4={'body':_0x1f5fa6[_0x34bc('0x24')],'channel':_0x34bc('0x25')};var _0x1dfcc4=[];var _0x2b7e52=[];var _0x2a37dc={};return db[_0x34bc('0x26')][_0x34bc('0x27')]()[_0x34bc('0x28')](function(_0x5d9ba5){if(!_0x5d9ba5){throw new db[(_0x34bc('0x29'))][(_0x34bc('0x2a'))]('no\x20available\x20attributes');}_0x1dfcc4=_[_0x34bc('0x2b')](_[_0x34bc('0x2c')](_0x5d9ba5),[_0x34bc('0x2d'),_0x34bc('0x2e')]);_0x2b7e52=_[_0x34bc('0x2b')](_[_0x34bc('0x2c')](_0x5d9ba5),[_0x34bc('0x2d'),'updatedAt','CompanyId',_0x34bc('0x2f')]);if(_0x1f5fa6[_0x34bc('0x24')]['id']){delete _0x1f5fa6['body']['id'];}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')]['from'])){throw new db[(_0x34bc('0x29'))][(_0x34bc('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')])||_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')]===''){throw new db['Sequelize'][(_0x34bc('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')])){throw new db['Sequelize'][(_0x34bc('0x2a'))](_0x34bc('0x31')+_0x2b7e52);}if(!_[_0x34bc('0x32')](_0x2b7e52,_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b7e52);}_0x2a37dc[_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')]]=_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x33')];})['then'](function(){return db[_0x34bc('0x1a')][_0x34bc('0x34')]({'where':{'id':_0x1f5fa6[_0x34bc('0x35')]['id']},'include':[{'model':db[_0x34bc('0x36')],'as':'List','include':[{'model':db[_0x34bc('0x26')],'as':'Contacts','where':_0x2a37dc,'limit':0x1,'order':[['updatedAt',_0x34bc('0x37')]]}]},{'model':db[_0x34bc('0x38')],'as':_0x34bc('0x39')}]});})['then'](function(_0x22b6fd){if(_0x22b6fd&&_0x22b6fd[_0x34bc('0x3a')]){var _0x4307c2=_0x22b6fd[_0x34bc('0x3b')]({'plain':!![]});_0x498ad4['account']=_0x4307c2;_0x498ad4[_0x34bc('0x3c')]=_0x4307c2['Applications'];_0x498ad4['list']=_0x4307c2[_0x34bc('0x3a')];_0x498ad4[_0x34bc('0x3c')]=_[_0x34bc('0x3d')](_0x498ad4[_0x34bc('0x3c')],['priority'],['asc']);if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x39')]){delete _0x498ad4[_0x34bc('0x35')][_0x34bc('0x39')];}if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x3a')]&&_0x498ad4[_0x34bc('0x35')][_0x34bc('0x3a')][_0x34bc('0x3e')][_0x34bc('0x3f')]){return _0x498ad4[_0x34bc('0x35')]['List']['Contacts'][0x0];}var _0x74c65b=_[_0x34bc('0x40')](_0x1f5fa6[_0x34bc('0x24')],{'firstName':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x33')],'ListId':_0x4307c2[_0x34bc('0x2f')]});_0x74c65b[_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')]]=_0x1f5fa6[_0x34bc('0x24')]['from'];return db['CmContact'][_0x34bc('0x41')](_0x74c65b,{'fields':_0x1dfcc4,'raw':!![]});}})[_0x34bc('0x28')](function(_0x22b818){_0x498ad4[_0x34bc('0x42')]=_0x22b818;if(_0x22b818){var _0x2979d0={'ContactId':_0x22b818['id'],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id'],'fax':_0x22b818[_0x34bc('0x25')]};return db['FaxInteraction'][_0x34bc('0x34')]({'where':{'ContactId':_0x22b818['id'],'closed':![],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id']}})['then'](function(_0x1ed46e){if(_0x1ed46e){return[_0x1ed46e,![]];}return db['FaxInteraction']['create'](_0x2979d0)[_0x34bc('0x28')](function(_0x243e64){return[_0x243e64,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x34bc('0x43')](function(_0x521474,_0x85c0e){var _0x5d9ec2=_0x521474[_0x34bc('0x3b')]({'plain':!![]});if(_0x85c0e){if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x44')]){_0x498ad4['applications']['push']({'id':0x0,'priority':_0x498ad4[_0x34bc('0x3c')][_0x34bc('0x3f')]+0x1,'app':_0x34bc('0x45'),'appdata':_0x34bc('0x46'),'interval':'*,*,*,*'});}_0x5d9ec2[_0x34bc('0x47')]=!![];}else{_0x5d9ec2[_0x34bc('0x47')]=![];}_0x498ad4[_0x34bc('0x48')]=_0x5d9ec2;return db[_0x34bc('0x49')][_0x34bc('0x41')]({'body':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id'],'FaxInteractionId':_0x521474['id'],'direction':'in','ContactId':_0x521474[_0x34bc('0x4a')],'AttachmentId':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x4b')]});})['then'](function(_0x32bff4){_0x498ad4[_0x34bc('0x18')]=_0x32bff4;if(_0x498ad4['interaction']['UserId']){return db[_0x34bc('0x4c')]['find']({'attributes':['id',_0x34bc('0x4d')],'where':{'id':_0x498ad4['interaction']['UserId']}})['then'](function(_0x5e1aaa){if(_0x5e1aaa){_0x498ad4[_0x34bc('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e1aaa[_0x34bc('0x4d')]+','+(_0x498ad4[_0x34bc('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0x34bc('0x4e')});}return respondWithRpcPromise('Start',_0x34bc('0x4f'),_0x498ad4);});}return respondWithRpcPromise(_0x34bc('0x50'),_0x34bc('0x4f'),_0x498ad4);})[_0x34bc('0x28')](function(_0x1f803a){_0x146ff3(_0x1f803a);})[_0x34bc('0x22')](function(_0x7226da){_0x28f948(_0x3ee096[_0x34bc('0x16')](0x1f4,_0x7226da[_0x34bc('0x18')]));});});};
\ No newline at end of file
+var _0xabf5=['keys','createdAt','updatedAt','ListId','body','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','FaxMessage','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference'];(function(_0x1376e7,_0x5e4644){var _0x1917d2=function(_0x28ccd5){while(--_0x28ccd5){_0x1376e7['push'](_0x1376e7['shift']());}};_0x1917d2(++_0x5e4644);}(_0xabf5,0x88));var _0x5abf=function(_0x261369,_0x525896){_0x261369=_0x261369-0x0;var _0xb03456=_0xabf5[_0x261369];return _0xb03456;};'use strict';var _=require('lodash');var util=require(_0x5abf('0x0'));var moment=require(_0x5abf('0x1'));var BPromise=require(_0x5abf('0x2'));var rs=require(_0x5abf('0x3'));var fs=require('fs');var Redis=require(_0x5abf('0x4'));var db=require(_0x5abf('0x5'))['db'];var utils=require(_0x5abf('0x6'));var logger=require(_0x5abf('0x7'))(_0x5abf('0x8'));var config=require(_0x5abf('0x9'));var jayson=require(_0x5abf('0xa'));var client=jayson[_0x5abf('0xb')][_0x5abf('0xc')]({'port':0x232c});config[_0x5abf('0xd')]=_[_0x5abf('0xe')](config[_0x5abf('0xd')],{'host':_0x5abf('0xf'),'port':0x18eb});var socket=require(_0x5abf('0x10'))(new Redis(config['redis']));require(_0x5abf('0x11'))['register'](socket);function respondWithRpcPromise(_0x568d4c,_0x316fa0,_0x3a4c0a){return new BPromise(function(_0x170cb7,_0xa42018){return client[_0x5abf('0x12')](_0x568d4c,_0x3a4c0a)[_0x5abf('0x13')](function(_0x37dc39){logger['info'](_0x5abf('0x14'),_0x316fa0,_0x5abf('0x15'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x316fa0,_0x5abf('0x15'),JSON['stringify'](_0x37dc39));if(_0x37dc39[_0x5abf('0x16')]){if(_0x37dc39['error'][_0x5abf('0x17')]===0x1f4){logger['error'](_0x5abf('0x14'),_0x316fa0,_0x37dc39[_0x5abf('0x16')]['message']);return _0xa42018(_0x37dc39[_0x5abf('0x16')]['message']);}logger[_0x5abf('0x16')](_0x5abf('0x14'),_0x316fa0,_0x37dc39[_0x5abf('0x16')]['message']);return _0x170cb7(_0x37dc39[_0x5abf('0x16')][_0x5abf('0x18')]);}else{logger[_0x5abf('0x19')](_0x5abf('0x14'),_0x316fa0,_0x5abf('0x15'));_0x170cb7(_0x37dc39[_0x5abf('0x1a')][_0x5abf('0x18')]);}})[_0x5abf('0x1b')](function(_0x5dedba){logger[_0x5abf('0x16')](_0x5abf('0x14'),_0x316fa0,_0x5dedba);_0xa42018(_0x5dedba);});});}exports[_0x5abf('0x1c')]=function(_0x2aad99){var _0x31df97=this;return new Promise(function(_0xf28d6a,_0x48dad7){return db[_0x5abf('0x1d')][_0x5abf('0x1e')]({'raw':_0x2aad99[_0x5abf('0x1f')]?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x20')]===undefined?!![]:![]:!![],'where':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')]['where']||null:null,'attributes':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x21')]||null:null,'limit':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x22')]||null:null,'include':_0x2aad99[_0x5abf('0x1f')]?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x23')]?_[_0x5abf('0x24')](_0x2aad99['options'][_0x5abf('0x23')],function(_0x3a83a9){return{'model':db[_0x3a83a9[_0x5abf('0x25')]],'as':_0x3a83a9['as'],'attributes':_0x3a83a9[_0x5abf('0x21')],'include':_0x3a83a9['include']?_['map'](_0x3a83a9['include'],function(_0x23dc4b){return{'model':db[_0x23dc4b[_0x5abf('0x25')]],'as':_0x23dc4b['as'],'attributes':_0x23dc4b[_0x5abf('0x21')],'include':_0x23dc4b['include']?_[_0x5abf('0x24')](_0x23dc4b['include'],function(_0x2a95cf){return{'model':db[_0x2a95cf[_0x5abf('0x25')]],'as':_0x2a95cf['as'],'attributes':_0x2a95cf[_0x5abf('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c63c1){logger[_0x5abf('0x19')](_0x5abf('0x1c'),_0x2aad99);logger[_0x5abf('0x26')](_0x5abf('0x1c'),_0x2aad99,JSON[_0x5abf('0x27')](_0x4c63c1));_0xf28d6a(_0x4c63c1);})[_0x5abf('0x1b')](function(_0x5d0eb7){logger[_0x5abf('0x16')]('GetFaxAccount',_0x5d0eb7[_0x5abf('0x18')],_0x2aad99);_0x48dad7(_0x31df97[_0x5abf('0x16')](0x1f4,_0x5d0eb7[_0x5abf('0x18')]));});});};exports[_0x5abf('0x28')]=function(_0x4e4b5f,_0x550710,_0xecd507){var _0x245afb=this;return new Promise(function(_0x43a50a,_0x552e7c){var _0x346ebb={'body':_0x4e4b5f['body'],'channel':_0x5abf('0x29')};var _0x4b551e=[];var _0x1af3e0=[];var _0x4a81f7={};return db[_0x5abf('0x2a')][_0x5abf('0x2b')]()[_0x5abf('0x13')](function(_0x11730e){if(!_0x11730e){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x2e'));}_0x4b551e=_[_0x5abf('0x2f')](_[_0x5abf('0x30')](_0x11730e),[_0x5abf('0x31'),_0x5abf('0x32')]);_0x1af3e0=_[_0x5abf('0x2f')](_[_0x5abf('0x30')](_0x11730e),[_0x5abf('0x31'),'updatedAt','CompanyId',_0x5abf('0x33')]);if(_0x4e4b5f[_0x5abf('0x34')]['id']){delete _0x4e4b5f['body']['id'];}if(_['isNil'](_0x4e4b5f['body'][_0x5abf('0x35')])){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))]('from\x20is\x20mandatory');}if(_[_0x5abf('0x36')](_0x4e4b5f['body'][_0x5abf('0x34')])||_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x34')]===''){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x37'));}if(_[_0x5abf('0x36')](_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x38')])){throw new db[(_0x5abf('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1af3e0);}if(!_['includes'](_0x1af3e0,_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x38')])){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x39')+_0x1af3e0);}_0x4a81f7[_0x4e4b5f[_0x5abf('0x34')]['mapKey']]=_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x35')];})['then'](function(){return db[_0x5abf('0x1d')][_0x5abf('0x3a')]({'where':{'id':_0x4e4b5f[_0x5abf('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0x5abf('0x3c'),'include':[{'model':db[_0x5abf('0x2a')],'as':_0x5abf('0x3d'),'where':_0x4a81f7,'limit':0x1,'order':[[_0x5abf('0x32'),_0x5abf('0x3e')]]}]},{'model':db[_0x5abf('0x3f')],'as':'Applications'}]});})[_0x5abf('0x13')](function(_0x4825cd){if(_0x4825cd&&_0x4825cd[_0x5abf('0x3c')]){var _0x38d82c=_0x4825cd[_0x5abf('0x40')]({'plain':!![]});_0x346ebb[_0x5abf('0x3b')]=_0x38d82c;_0x346ebb[_0x5abf('0x41')]=_0x38d82c[_0x5abf('0x42')];_0x346ebb[_0x5abf('0x43')]=_0x38d82c['List'];_0x346ebb[_0x5abf('0x41')]=_[_0x5abf('0x44')](_0x346ebb[_0x5abf('0x41')],[_0x5abf('0x45')],['asc']);if(_0x346ebb[_0x5abf('0x3b')]['Applications']){delete _0x346ebb['account']['Applications'];}if(_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')]&&_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')]['Contacts']['length']){return _0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')][_0x5abf('0x3d')][0x0];}var _0x4d1635=_[_0x5abf('0xe')](_0x4e4b5f['body'],{'firstName':_0x4e4b5f[_0x5abf('0x34')]['from'],'ListId':_0x38d82c[_0x5abf('0x33')]});_0x4d1635[_0x4e4b5f['body'][_0x5abf('0x38')]]=_0x4e4b5f[_0x5abf('0x34')]['from'];return db[_0x5abf('0x2a')][_0x5abf('0x46')](_0x4d1635,{'fields':_0x4b551e,'raw':!![]});}})[_0x5abf('0x13')](function(_0x1a7033){_0x346ebb[_0x5abf('0x47')]=_0x1a7033;if(_0x1a7033){var _0x23e686={'ContactId':_0x1a7033['id'],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id'],'fax':_0x1a7033[_0x5abf('0x29')]};return db[_0x5abf('0x48')][_0x5abf('0x3a')]({'where':{'ContactId':_0x1a7033['id'],'closed':![],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id']}})[_0x5abf('0x13')](function(_0x1f5d2a){if(_0x1f5d2a){return[_0x1f5d2a,![]];}return db[_0x5abf('0x48')]['create'](_0x23e686)[_0x5abf('0x13')](function(_0x1bbf81){return[_0x1bbf81,!![]];});});}else{throw new Error(_0x5abf('0x49'));}})[_0x5abf('0x4a')](function(_0x538a99,_0x4b5011){var _0x1529bd=_0x538a99['get']({'plain':!![]});if(_0x4b5011){if(_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x4b')]){_0x346ebb[_0x5abf('0x41')][_0x5abf('0x4c')]({'id':0x0,'priority':_0x346ebb[_0x5abf('0x41')][_0x5abf('0x4d')]+0x1,'app':_0x5abf('0x4e'),'appdata':_0x5abf('0x4f'),'interval':_0x5abf('0x50')});}_0x1529bd['created']=!![];}else{_0x1529bd['created']=![];}_0x346ebb['interaction']=_0x1529bd;return db[_0x5abf('0x51')][_0x5abf('0x46')]({'body':_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x34')],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id'],'FaxInteractionId':_0x538a99['id'],'direction':'in','ContactId':_0x538a99['ContactId'],'AttachmentId':_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x52')]});})[_0x5abf('0x13')](function(_0x3bcaac){_0x346ebb[_0x5abf('0x18')]=_0x3bcaac;if(_0x346ebb[_0x5abf('0x53')][_0x5abf('0x54')]){return db[_0x5abf('0x55')][_0x5abf('0x3a')]({'attributes':['id',_0x5abf('0x56')],'where':{'id':_0x346ebb['interaction'][_0x5abf('0x54')]}})[_0x5abf('0x13')](function(_0x232c88){if(_0x232c88){_0x346ebb[_0x5abf('0x41')][_0x5abf('0x57')]({'id':0x0,'priority':0x0,'app':_0x5abf('0x58'),'appdata':_0x232c88[_0x5abf('0x56')]+','+(_0x346ebb['account'][_0x5abf('0x59')]||0xa),'interval':_0x5abf('0x50')});}return respondWithRpcPromise(_0x5abf('0x5a'),_0x5abf('0x5b'),_0x346ebb);});}return respondWithRpcPromise(_0x5abf('0x5a'),_0x5abf('0x5b'),_0x346ebb);})[_0x5abf('0x13')](function(_0x3979df){_0x43a50a(_0x3979df);})[_0x5abf('0x1b')](function(_0x4816e1){_0x552e7c(_0x245afb[_0x5abf('0x16')](0x1f4,_0x4816e1[_0x5abf('0x18')]));});});};
\ No newline at end of file