Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / faxAccount / faxAccount.rpc.js
index ae87517..f3a0387 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf97=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmContact','Contacts','DESC','FaxApplication','Applications','get','list','List','orderBy','applications','priority','asc','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','NotifyFaxAccount','body','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x2ecd27,_0x167995){var _0x154c06=function(_0x7a1bdf){while(--_0x7a1bdf){_0x2ecd27['push'](_0x2ecd27['shift']());}};_0x154c06(++_0x167995);}(_0xbf97,0x1a1));var _0x7bf9=function(_0x38189a,_0x508d10){_0x38189a=_0x38189a-0x0;var _0x44c4d3=_0xbf97[_0x38189a];return _0x44c4d3;};'use strict';var _=require(_0x7bf9('0x0'));var util=require(_0x7bf9('0x1'));var moment=require(_0x7bf9('0x2'));var BPromise=require(_0x7bf9('0x3'));var rs=require(_0x7bf9('0x4'));var fs=require('fs');var Redis=require(_0x7bf9('0x5'));var db=require(_0x7bf9('0x6'))['db'];var utils=require(_0x7bf9('0x7'));var logger=require('../../config/logger')(_0x7bf9('0x8'));var config=require(_0x7bf9('0x9'));var jayson=require(_0x7bf9('0xa'));var client=jayson[_0x7bf9('0xb')]['http']({'port':0x232c});config[_0x7bf9('0xc')]=_[_0x7bf9('0xd')](config[_0x7bf9('0xc')],{'host':_0x7bf9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bf9('0xc')]));require(_0x7bf9('0xf'))['register'](socket);function respondWithRpcPromise(_0x1ded9d,_0x2da1d4,_0x51a9a9){return new BPromise(function(_0x3ebce9,_0x58fc01){return client[_0x7bf9('0x10')](_0x1ded9d,_0x51a9a9)[_0x7bf9('0x11')](function(_0x4b46fe){logger[_0x7bf9('0x12')]('FaxAccount,\x20%s,\x20%s',_0x2da1d4,_0x7bf9('0x13'));logger[_0x7bf9('0x14')](_0x7bf9('0x15'),_0x2da1d4,_0x7bf9('0x13'),JSON[_0x7bf9('0x16')](_0x4b46fe));if(_0x4b46fe[_0x7bf9('0x17')]){if(_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x18')]===0x1f4){logger[_0x7bf9('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2da1d4,_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x19')]);return _0x58fc01(_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x19')]);}logger[_0x7bf9('0x17')](_0x7bf9('0x1a'),_0x2da1d4,_0x4b46fe['error'][_0x7bf9('0x19')]);return _0x3ebce9(_0x4b46fe[_0x7bf9('0x17')][_0x7bf9('0x19')]);}else{logger[_0x7bf9('0x12')](_0x7bf9('0x1a'),_0x2da1d4,_0x7bf9('0x13'));_0x3ebce9(_0x4b46fe[_0x7bf9('0x1b')]['message']);}})[_0x7bf9('0x1c')](function(_0x1e70e6){logger[_0x7bf9('0x17')](_0x7bf9('0x1a'),_0x2da1d4,_0x1e70e6);_0x58fc01(_0x1e70e6);});});}exports[_0x7bf9('0x1d')]=function(_0x18d8ae){var _0x90a423=this;return new Promise(function(_0x16ea4d,_0x24a5a0){return db[_0x7bf9('0x1e')][_0x7bf9('0x1f')]({'raw':_0x18d8ae['options']?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x21')]===undefined?!![]:![]:!![],'where':_0x18d8ae['options']?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x22')]||null:null,'attributes':_0x18d8ae[_0x7bf9('0x20')]?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x23')]||null:null,'limit':_0x18d8ae[_0x7bf9('0x20')]?_0x18d8ae[_0x7bf9('0x20')][_0x7bf9('0x24')]||null:null,'include':_0x18d8ae[_0x7bf9('0x20')]?_0x18d8ae['options']['include']?_[_0x7bf9('0x25')](_0x18d8ae[_0x7bf9('0x20')]['include'],function(_0xe79349){return{'model':db[_0xe79349['model']],'as':_0xe79349['as'],'attributes':_0xe79349[_0x7bf9('0x23')],'include':_0xe79349[_0x7bf9('0x26')]?_[_0x7bf9('0x25')](_0xe79349['include'],function(_0x5b5daa){return{'model':db[_0x5b5daa[_0x7bf9('0x27')]],'as':_0x5b5daa['as'],'attributes':_0x5b5daa['attributes'],'include':_0x5b5daa[_0x7bf9('0x26')]?_[_0x7bf9('0x25')](_0x5b5daa['include'],function(_0x21714e){return{'model':db[_0x21714e[_0x7bf9('0x27')]],'as':_0x21714e['as'],'attributes':_0x21714e[_0x7bf9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7bf9('0x11')](function(_0x238ee9){logger[_0x7bf9('0x12')](_0x7bf9('0x1d'),_0x18d8ae);logger['debug'](_0x7bf9('0x1d'),_0x18d8ae,JSON[_0x7bf9('0x16')](_0x238ee9));_0x16ea4d(_0x238ee9);})[_0x7bf9('0x1c')](function(_0x42acc9){logger[_0x7bf9('0x17')](_0x7bf9('0x1d'),_0x42acc9[_0x7bf9('0x19')],_0x18d8ae);_0x24a5a0(_0x90a423[_0x7bf9('0x17')](0x1f4,_0x42acc9[_0x7bf9('0x19')]));});});};exports[_0x7bf9('0x28')]=function(_0x58d3a7,_0x5d1532,_0x142d4b){var _0x1741e4=this;return new Promise(function(_0x55c047,_0x12020d){var _0x4b54a5={'body':_0x58d3a7[_0x7bf9('0x29')],'channel':'fax'};var _0x459610=[];var _0x2d233f=[];var _0x56fc21={};return db['CmContact']['describe']()[_0x7bf9('0x11')](function(_0x311d13){if(!_0x311d13){throw new db['Sequelize'][(_0x7bf9('0x2a'))](_0x7bf9('0x2b'));}_0x459610=_[_0x7bf9('0x2c')](_[_0x7bf9('0x2d')](_0x311d13),['createdAt','updatedAt']);_0x2d233f=_['difference'](_['keys'](_0x311d13),[_0x7bf9('0x2e'),_0x7bf9('0x2f'),_0x7bf9('0x30'),_0x7bf9('0x31')]);if(_0x58d3a7[_0x7bf9('0x29')]['id']){delete _0x58d3a7[_0x7bf9('0x29')]['id'];}if(_[_0x7bf9('0x32')](_0x58d3a7['body'][_0x7bf9('0x33')])){throw new db[(_0x7bf9('0x34'))][(_0x7bf9('0x2a'))](_0x7bf9('0x35'));}if(_['isNil'](_0x58d3a7['body'][_0x7bf9('0x29')])||_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x29')]===''){throw new db['Sequelize'][(_0x7bf9('0x2a'))](_0x7bf9('0x36'));}if(_[_0x7bf9('0x32')](_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')])){throw new db['Sequelize'][(_0x7bf9('0x2a'))](_0x7bf9('0x38')+_0x2d233f);}if(!_[_0x7bf9('0x39')](_0x2d233f,_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')])){throw new db[(_0x7bf9('0x34'))][(_0x7bf9('0x2a'))](_0x7bf9('0x3a')+_0x2d233f);}_0x56fc21[_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')]]=_0x58d3a7['body'][_0x7bf9('0x33')];})[_0x7bf9('0x11')](function(){return db[_0x7bf9('0x1e')][_0x7bf9('0x3b')]({'where':{'id':_0x58d3a7[_0x7bf9('0x3c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7bf9('0x3d')],'as':_0x7bf9('0x3e'),'where':_0x56fc21,'limit':0x1,'order':[[_0x7bf9('0x2f'),_0x7bf9('0x3f')]]}]},{'model':db[_0x7bf9('0x40')],'as':_0x7bf9('0x41')}]});})[_0x7bf9('0x11')](function(_0x3a5451){if(_0x3a5451&&_0x3a5451['List']){var _0x5effdc=_0x3a5451[_0x7bf9('0x42')]({'plain':!![]});_0x4b54a5[_0x7bf9('0x3c')]=_0x5effdc;_0x4b54a5['applications']=_0x5effdc['Applications'];_0x4b54a5[_0x7bf9('0x43')]=_0x5effdc[_0x7bf9('0x44')];_0x4b54a5['applications']=_[_0x7bf9('0x45')](_0x4b54a5[_0x7bf9('0x46')],[_0x7bf9('0x47')],[_0x7bf9('0x48')]);if(_0x4b54a5['account'][_0x7bf9('0x41')]){delete _0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x41')];}if(_0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x44')]&&_0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x44')][_0x7bf9('0x3e')]['length']){return _0x4b54a5['account'][_0x7bf9('0x44')][_0x7bf9('0x3e')][0x0];}var _0x5ca8bf=_[_0x7bf9('0xd')](_0x58d3a7[_0x7bf9('0x29')],{'firstName':_0x58d3a7['body'][_0x7bf9('0x33')],'ListId':_0x5effdc[_0x7bf9('0x31')]});_0x5ca8bf[_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x37')]]=_0x58d3a7['body'][_0x7bf9('0x33')];return db[_0x7bf9('0x3d')][_0x7bf9('0x49')](_0x5ca8bf,{'fields':_0x459610,'raw':!![]});}})['then'](function(_0x58d5f5){_0x4b54a5[_0x7bf9('0x4a')]=_0x58d5f5;if(_0x58d5f5){var _0x33b40b={'ContactId':_0x58d5f5['id'],'FaxAccountId':_0x58d3a7[_0x7bf9('0x3c')]['id'],'fax':_0x58d5f5[_0x7bf9('0x4b')]};return db[_0x7bf9('0x4c')]['find']({'where':{'ContactId':_0x58d5f5['id'],'closed':![],'FaxAccountId':_0x58d3a7['account']['id']}})[_0x7bf9('0x11')](function(_0x3c31e4){if(_0x3c31e4){return[_0x3c31e4,![]];}return db[_0x7bf9('0x4c')][_0x7bf9('0x49')](_0x33b40b)[_0x7bf9('0x11')](function(_0x23396e){return[_0x23396e,!![]];});});}else{throw new Error(_0x7bf9('0x4d'));}})[_0x7bf9('0x4e')](function(_0x355fc4,_0x5aea43){var _0x10969b=_0x355fc4[_0x7bf9('0x42')]({'plain':!![]});if(_0x5aea43){if(_0x4b54a5[_0x7bf9('0x3c')]['autoclose']){_0x4b54a5[_0x7bf9('0x46')][_0x7bf9('0x4f')]({'id':0x0,'priority':_0x4b54a5['applications'][_0x7bf9('0x50')]+0x1,'app':_0x7bf9('0x51'),'appdata':_0x7bf9('0x52'),'interval':_0x7bf9('0x53')});}_0x10969b[_0x7bf9('0x54')]=!![];}else{_0x10969b[_0x7bf9('0x54')]=![];}_0x4b54a5[_0x7bf9('0x55')]=_0x10969b;return db[_0x7bf9('0x56')][_0x7bf9('0x49')]({'body':_0x58d3a7[_0x7bf9('0x29')][_0x7bf9('0x29')],'FaxAccountId':_0x58d3a7[_0x7bf9('0x3c')]['id'],'FaxInteractionId':_0x355fc4['id'],'direction':'in','ContactId':_0x355fc4['ContactId'],'AttachmentId':_0x58d3a7['body'][_0x7bf9('0x57')]});})[_0x7bf9('0x11')](function(_0x1fed37){_0x4b54a5[_0x7bf9('0x19')]=_0x1fed37;if(_0x4b54a5[_0x7bf9('0x55')][_0x7bf9('0x58')]){return db['User']['find']({'attributes':['id',_0x7bf9('0x59')],'where':{'id':_0x4b54a5['interaction'][_0x7bf9('0x58')]}})[_0x7bf9('0x11')](function(_0x66964b){if(_0x66964b){_0x4b54a5[_0x7bf9('0x46')][_0x7bf9('0x5a')]({'id':0x0,'priority':0x0,'app':_0x7bf9('0x5b'),'appdata':_0x66964b['name']+','+(_0x4b54a5[_0x7bf9('0x3c')][_0x7bf9('0x5c')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7bf9('0x5d'),'startRouting',_0x4b54a5);});}return respondWithRpcPromise(_0x7bf9('0x5d'),_0x7bf9('0x5e'),_0x4b54a5);})['then'](function(_0x27bb6d){_0x55c047(_0x27bb6d);})[_0x7bf9('0x1c')](function(_0x5f7d9e){_0x12020d(_0x1741e4[_0x7bf9('0x17')](0x1f4,_0x5f7d9e[_0x7bf9('0x19')]));});});};
\ No newline at end of file
+var _0xf641=['interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','message','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','FaxApplication','get','Applications','list','applications','priority','asc','length','defaults','ListId','contact','FaxInteraction','find','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created'];(function(_0x324111,_0x1b6daf){var _0x46e69b=function(_0x49e9c5){while(--_0x49e9c5){_0x324111['push'](_0x324111['shift']());}};_0x46e69b(++_0x1b6daf);}(_0xf641,0x17d));var _0x1f64=function(_0x35f2d6,_0x1eacc1){_0x35f2d6=_0x35f2d6-0x0;var _0x33a492=_0xf641[_0x35f2d6];return _0x33a492;};'use strict';var _=require(_0x1f64('0x0'));var util=require(_0x1f64('0x1'));var moment=require('moment');var BPromise=require(_0x1f64('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f64('0x3'));var db=require(_0x1f64('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f64('0x5'))(_0x1f64('0x6'));var config=require(_0x1f64('0x7'));var jayson=require(_0x1f64('0x8'));var client=jayson[_0x1f64('0x9')][_0x1f64('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0x1f64('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f64('0xc'))(new Redis(config[_0x1f64('0xb')]));require(_0x1f64('0xd'))[_0x1f64('0xe')](socket);function respondWithRpcPromise(_0x595de1,_0x498c93,_0x11b966){return new BPromise(function(_0xbc2e15,_0x28805c){return client[_0x1f64('0xf')](_0x595de1,_0x11b966)[_0x1f64('0x10')](function(_0x7b8f98){logger[_0x1f64('0x11')]('FaxAccount,\x20%s,\x20%s',_0x498c93,'request\x20sent');logger[_0x1f64('0x12')](_0x1f64('0x13'),_0x498c93,_0x1f64('0x14'),JSON[_0x1f64('0x15')](_0x7b8f98));if(_0x7b8f98[_0x1f64('0x16')]){if(_0x7b8f98[_0x1f64('0x16')]['code']===0x1f4){logger['error'](_0x1f64('0x17'),_0x498c93,_0x7b8f98[_0x1f64('0x16')]['message']);return _0x28805c(_0x7b8f98[_0x1f64('0x16')]['message']);}logger['error'](_0x1f64('0x17'),_0x498c93,_0x7b8f98[_0x1f64('0x16')]['message']);return _0xbc2e15(_0x7b8f98[_0x1f64('0x16')]['message']);}else{logger[_0x1f64('0x11')]('FaxAccount,\x20%s,\x20%s',_0x498c93,'request\x20sent');_0xbc2e15(_0x7b8f98[_0x1f64('0x18')]['message']);}})['catch'](function(_0x4cbb1a){logger[_0x1f64('0x16')]('FaxAccount,\x20%s,\x20%s',_0x498c93,_0x4cbb1a);_0x28805c(_0x4cbb1a);});});}exports[_0x1f64('0x19')]=function(_0x12eadd){var _0x1b744f=this;return new Promise(function(_0x312189,_0x2bd5d6){return db[_0x1f64('0x1a')][_0x1f64('0x1b')]({'raw':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x1d')]===undefined?!![]:![]:!![],'where':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x1e')]||null:null,'attributes':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x1f')]||null:null,'limit':_0x12eadd['options']?_0x12eadd[_0x1f64('0x1c')][_0x1f64('0x20')]||null:null,'include':_0x12eadd[_0x1f64('0x1c')]?_0x12eadd['options']['include']?_['map'](_0x12eadd['options'][_0x1f64('0x21')],function(_0x4faf36){return{'model':db[_0x4faf36[_0x1f64('0x22')]],'as':_0x4faf36['as'],'attributes':_0x4faf36[_0x1f64('0x1f')],'include':_0x4faf36[_0x1f64('0x21')]?_['map'](_0x4faf36[_0x1f64('0x21')],function(_0x19660f){return{'model':db[_0x19660f[_0x1f64('0x22')]],'as':_0x19660f['as'],'attributes':_0x19660f['attributes'],'include':_0x19660f['include']?_['map'](_0x19660f[_0x1f64('0x21')],function(_0xf9da63){return{'model':db[_0xf9da63[_0x1f64('0x22')]],'as':_0xf9da63['as'],'attributes':_0xf9da63[_0x1f64('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1f64('0x10')](function(_0x2ef604){logger[_0x1f64('0x11')](_0x1f64('0x19'),_0x12eadd);logger[_0x1f64('0x12')]('GetFaxAccount',_0x12eadd,JSON[_0x1f64('0x15')](_0x2ef604));_0x312189(_0x2ef604);})['catch'](function(_0x1b52c){logger[_0x1f64('0x16')](_0x1f64('0x19'),_0x1b52c[_0x1f64('0x23')],_0x12eadd);_0x2bd5d6(_0x1b744f[_0x1f64('0x16')](0x1f4,_0x1b52c['message']));});});};exports[_0x1f64('0x24')]=function(_0x4cf4c0,_0x574b38,_0x2bf856){var _0x5ace16=this;return new Promise(function(_0x55cdf8,_0x59ea7c){var _0xe629be={'body':_0x4cf4c0[_0x1f64('0x25')],'channel':_0x1f64('0x26')};var _0x1243cc=[];var _0x5e31d9=[];var _0xba687d={};return db[_0x1f64('0x27')][_0x1f64('0x28')]()[_0x1f64('0x10')](function(_0x2663cd){if(!_0x2663cd){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))]('no\x20available\x20attributes');}_0x1243cc=_[_0x1f64('0x2b')](_[_0x1f64('0x2c')](_0x2663cd),[_0x1f64('0x2d'),_0x1f64('0x2e')]);_0x5e31d9=_[_0x1f64('0x2b')](_[_0x1f64('0x2c')](_0x2663cd),[_0x1f64('0x2d'),_0x1f64('0x2e'),'CompanyId','ListId']);if(_0x4cf4c0[_0x1f64('0x25')]['id']){delete _0x4cf4c0[_0x1f64('0x25')]['id'];}if(_[_0x1f64('0x2f')](_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x30')])){throw new db[(_0x1f64('0x29'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1f64('0x2f')](_0x4cf4c0['body'][_0x1f64('0x25')])||_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x25')]===''){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))](_0x1f64('0x31'));}if(_[_0x1f64('0x2f')](_0x4cf4c0['body'][_0x1f64('0x32')])){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))](_0x1f64('0x33')+_0x5e31d9);}if(!_[_0x1f64('0x34')](_0x5e31d9,_0x4cf4c0[_0x1f64('0x25')]['mapKey'])){throw new db[(_0x1f64('0x29'))][(_0x1f64('0x2a'))](_0x1f64('0x35')+_0x5e31d9);}_0xba687d[_0x4cf4c0[_0x1f64('0x25')]['mapKey']]=_0x4cf4c0['body']['from'];})['then'](function(){return db[_0x1f64('0x1a')]['find']({'where':{'id':_0x4cf4c0[_0x1f64('0x36')]['id']},'include':[{'model':db[_0x1f64('0x37')],'as':_0x1f64('0x38'),'include':[{'model':db[_0x1f64('0x27')],'as':_0x1f64('0x39'),'where':_0xba687d,'limit':0x1,'order':[[_0x1f64('0x2e'),'DESC']]}]},{'model':db[_0x1f64('0x3a')],'as':'Applications'}]});})[_0x1f64('0x10')](function(_0x40bd6b){if(_0x40bd6b&&_0x40bd6b['List']){var _0x3c3b25=_0x40bd6b[_0x1f64('0x3b')]({'plain':!![]});_0xe629be[_0x1f64('0x36')]=_0x3c3b25;_0xe629be['applications']=_0x3c3b25[_0x1f64('0x3c')];_0xe629be[_0x1f64('0x3d')]=_0x3c3b25[_0x1f64('0x38')];_0xe629be['applications']=_['orderBy'](_0xe629be[_0x1f64('0x3e')],[_0x1f64('0x3f')],[_0x1f64('0x40')]);if(_0xe629be[_0x1f64('0x36')][_0x1f64('0x3c')]){delete _0xe629be[_0x1f64('0x36')][_0x1f64('0x3c')];}if(_0xe629be['account'][_0x1f64('0x38')]&&_0xe629be[_0x1f64('0x36')][_0x1f64('0x38')]['Contacts'][_0x1f64('0x41')]){return _0xe629be[_0x1f64('0x36')]['List']['Contacts'][0x0];}var _0x258804=_[_0x1f64('0x42')](_0x4cf4c0[_0x1f64('0x25')],{'firstName':_0x4cf4c0['body'][_0x1f64('0x30')],'ListId':_0x3c3b25[_0x1f64('0x43')]});_0x258804[_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x32')]]=_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x30')];return db[_0x1f64('0x27')]['create'](_0x258804,{'fields':_0x1243cc,'raw':!![]});}})[_0x1f64('0x10')](function(_0x18917e){_0xe629be[_0x1f64('0x44')]=_0x18917e;if(_0x18917e){var _0x293900={'ContactId':_0x18917e['id'],'FaxAccountId':_0x4cf4c0['account']['id'],'fax':_0x18917e[_0x1f64('0x26')]};return db[_0x1f64('0x45')][_0x1f64('0x46')]({'where':{'ContactId':_0x18917e['id'],'closed':![],'FaxAccountId':_0x4cf4c0[_0x1f64('0x36')]['id']}})[_0x1f64('0x10')](function(_0x3abe67){if(_0x3abe67){return[_0x3abe67,![]];}return db[_0x1f64('0x45')][_0x1f64('0x47')](_0x293900)[_0x1f64('0x10')](function(_0x2abefe){return[_0x2abefe,!![]];});});}else{throw new Error(_0x1f64('0x48'));}})[_0x1f64('0x49')](function(_0x1ec2b9,_0x521afb){var _0x16ece8=_0x1ec2b9[_0x1f64('0x3b')]({'plain':!![]});if(_0x521afb){if(_0xe629be[_0x1f64('0x36')][_0x1f64('0x4a')]){_0xe629be[_0x1f64('0x3e')][_0x1f64('0x4b')]({'id':0x0,'priority':_0xe629be[_0x1f64('0x3e')][_0x1f64('0x41')]+0x1,'app':_0x1f64('0x4c'),'appdata':_0x1f64('0x4d'),'interval':'*,*,*,*'});}_0x16ece8[_0x1f64('0x4e')]=!![];}else{_0x16ece8[_0x1f64('0x4e')]=![];}_0xe629be[_0x1f64('0x4f')]=_0x16ece8;return db[_0x1f64('0x50')][_0x1f64('0x47')]({'body':_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x25')],'FaxAccountId':_0x4cf4c0[_0x1f64('0x36')]['id'],'FaxInteractionId':_0x1ec2b9['id'],'direction':'in','ContactId':_0x1ec2b9[_0x1f64('0x51')],'AttachmentId':_0x4cf4c0[_0x1f64('0x25')][_0x1f64('0x52')]});})[_0x1f64('0x10')](function(_0xca1035){_0xe629be[_0x1f64('0x23')]=_0xca1035;if(_0xe629be['interaction'][_0x1f64('0x53')]){return db[_0x1f64('0x54')][_0x1f64('0x46')]({'attributes':['id',_0x1f64('0x55')],'where':{'id':_0xe629be[_0x1f64('0x4f')][_0x1f64('0x53')]}})[_0x1f64('0x10')](function(_0x5e97c1){if(_0x5e97c1){_0xe629be[_0x1f64('0x3e')][_0x1f64('0x56')]({'id':0x0,'priority':0x0,'app':_0x1f64('0x57'),'appdata':_0x5e97c1[_0x1f64('0x55')]+','+(_0xe629be['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1f64('0x58')});}return respondWithRpcPromise(_0x1f64('0x59'),_0x1f64('0x5a'),_0xe629be);});}return respondWithRpcPromise(_0x1f64('0x59'),_0x1f64('0x5a'),_0xe629be);})[_0x1f64('0x10')](function(_0x892401){_0x55cdf8(_0x892401);})[_0x1f64('0x5b')](function(_0x282e4b){_0x59ea7c(_0x5ace16[_0x1f64('0x16')](0x1f4,_0x282e4b['message']));});});};
\ No newline at end of file