Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / faxAccount / faxAccount.rpc.js
index ba8d639..05d6020 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef7c=['rpc','../../config/environment','jayson/promise','http','defaults','redis','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','FaxAccount','options','where','attributes','limit','map','include','model','GetFaxAccount','stringify','catch','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','updatedAt','CompanyId','from','from\x20is\x20mandatory','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','find','account','Contacts','DESC','Applications','get','applications','list','List','priority','asc','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0xef7c,0xa5));var _0xcef7=function(_0x3c2b2b,_0x5250d9){_0x3c2b2b=_0x3c2b2b-0x0;var _0x1484f5=_0xef7c[_0x3c2b2b];return _0x1484f5;};'use strict';var _=require(_0xcef7('0x0'));var util=require(_0xcef7('0x1'));var moment=require(_0xcef7('0x2'));var BPromise=require(_0xcef7('0x3'));var rs=require(_0xcef7('0x4'));var fs=require('fs');var Redis=require(_0xcef7('0x5'));var db=require(_0xcef7('0x6'))['db'];var utils=require(_0xcef7('0x7'));var logger=require(_0xcef7('0x8'))(_0xcef7('0x9'));var config=require(_0xcef7('0xa'));var jayson=require(_0xcef7('0xb'));var client=jayson['client'][_0xcef7('0xc')]({'port':0x232c});config['redis']=_[_0xcef7('0xd')](config[_0xcef7('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcef7('0xe')]));require(_0xcef7('0xf'))[_0xcef7('0x10')](socket);function respondWithRpcPromise(_0x401317,_0x580adc,_0x526b2c){return new BPromise(function(_0x16e18f,_0x1cb814){return client[_0xcef7('0x11')](_0x401317,_0x526b2c)[_0xcef7('0x12')](function(_0x4e2a46){logger[_0xcef7('0x13')](_0xcef7('0x14'),_0x580adc,_0xcef7('0x15'));logger[_0xcef7('0x16')](_0xcef7('0x17'),_0x580adc,_0xcef7('0x15'),JSON['stringify'](_0x4e2a46));if(_0x4e2a46['error']){if(_0x4e2a46[_0xcef7('0x18')]['code']===0x1f4){logger[_0xcef7('0x18')](_0xcef7('0x14'),_0x580adc,_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);return _0x1cb814(_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);}logger[_0xcef7('0x18')]('FaxAccount,\x20%s,\x20%s',_0x580adc,_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);return _0x16e18f(_0x4e2a46[_0xcef7('0x18')][_0xcef7('0x19')]);}else{logger['info'](_0xcef7('0x14'),_0x580adc,_0xcef7('0x15'));_0x16e18f(_0x4e2a46[_0xcef7('0x1a')][_0xcef7('0x19')]);}})['catch'](function(_0x3b7005){logger[_0xcef7('0x18')](_0xcef7('0x14'),_0x580adc,_0x3b7005);_0x1cb814(_0x3b7005);});});}exports['GetFaxAccount']=function(_0x5de7b5){var _0x59fea6=this;return new Promise(function(_0x565fab,_0x50f8e9){return db[_0xcef7('0x1b')]['findAll']({'raw':_0x5de7b5[_0xcef7('0x1c')]?_0x5de7b5[_0xcef7('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5de7b5[_0xcef7('0x1c')]?_0x5de7b5['options'][_0xcef7('0x1d')]||null:null,'attributes':_0x5de7b5[_0xcef7('0x1c')]?_0x5de7b5[_0xcef7('0x1c')][_0xcef7('0x1e')]||null:null,'limit':_0x5de7b5['options']?_0x5de7b5[_0xcef7('0x1c')][_0xcef7('0x1f')]||null:null,'include':_0x5de7b5[_0xcef7('0x1c')]?_0x5de7b5[_0xcef7('0x1c')]['include']?_[_0xcef7('0x20')](_0x5de7b5[_0xcef7('0x1c')][_0xcef7('0x21')],function(_0x47c36a){return{'model':db[_0x47c36a[_0xcef7('0x22')]],'as':_0x47c36a['as'],'attributes':_0x47c36a[_0xcef7('0x1e')],'include':_0x47c36a[_0xcef7('0x21')]?_[_0xcef7('0x20')](_0x47c36a['include'],function(_0x3b7789){return{'model':db[_0x3b7789[_0xcef7('0x22')]],'as':_0x3b7789['as'],'attributes':_0x3b7789['attributes'],'include':_0x3b7789[_0xcef7('0x21')]?_[_0xcef7('0x20')](_0x3b7789[_0xcef7('0x21')],function(_0x159f61){return{'model':db[_0x159f61[_0xcef7('0x22')]],'as':_0x159f61['as'],'attributes':_0x159f61[_0xcef7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcef7('0x12')](function(_0x22e918){logger['info'](_0xcef7('0x23'),_0x5de7b5);logger[_0xcef7('0x16')](_0xcef7('0x23'),_0x5de7b5,JSON[_0xcef7('0x24')](_0x22e918));_0x565fab(_0x22e918);})[_0xcef7('0x25')](function(_0x563455){logger[_0xcef7('0x18')](_0xcef7('0x23'),_0x563455[_0xcef7('0x19')],_0x5de7b5);_0x50f8e9(_0x59fea6[_0xcef7('0x18')](0x1f4,_0x563455['message']));});});};exports[_0xcef7('0x26')]=function(_0x26001a,_0x4e0846,_0x380d46){var _0x4f9c23=this;return new Promise(function(_0x5a55ab,_0x5d8c10){var _0x5116c6={'body':_0x26001a[_0xcef7('0x27')],'channel':_0xcef7('0x28')};var _0x29d629=[];var _0x1a639e=[];var _0x45397d={};return db[_0xcef7('0x29')]['describe']()[_0xcef7('0x12')](function(_0x5756f4){if(!_0x5756f4){throw new db[(_0xcef7('0x2a'))][(_0xcef7('0x2b'))]('no\x20available\x20attributes');}_0x29d629=_['difference'](_['keys'](_0x5756f4),['createdAt',_0xcef7('0x2c')]);_0x1a639e=_['difference'](_['keys'](_0x5756f4),['createdAt',_0xcef7('0x2c'),_0xcef7('0x2d'),'ListId']);if(_0x26001a[_0xcef7('0x27')]['id']){delete _0x26001a[_0xcef7('0x27')]['id'];}if(_['isNil'](_0x26001a[_0xcef7('0x27')][_0xcef7('0x2e')])){throw new db['Sequelize']['ValidationError'](_0xcef7('0x2f'));}if(_['isNil'](_0x26001a[_0xcef7('0x27')][_0xcef7('0x27')])||_0x26001a[_0xcef7('0x27')]['body']===''){throw new db[(_0xcef7('0x2a'))][(_0xcef7('0x2b'))](_0xcef7('0x30'));}if(_['isNil'](_0x26001a[_0xcef7('0x27')][_0xcef7('0x31')])){throw new db[(_0xcef7('0x2a'))][(_0xcef7('0x2b'))](_0xcef7('0x32')+_0x1a639e);}if(!_[_0xcef7('0x33')](_0x1a639e,_0x26001a['body'][_0xcef7('0x31')])){throw new db[(_0xcef7('0x2a'))]['ValidationError'](_0xcef7('0x34')+_0x1a639e);}_0x45397d[_0x26001a[_0xcef7('0x27')][_0xcef7('0x31')]]=_0x26001a['body']['from'];})[_0xcef7('0x12')](function(){return db[_0xcef7('0x1b')][_0xcef7('0x35')]({'where':{'id':_0x26001a[_0xcef7('0x36')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xcef7('0x29')],'as':_0xcef7('0x37'),'where':_0x45397d,'limit':0x1,'order':[[_0xcef7('0x2c'),_0xcef7('0x38')]]}]},{'model':db['FaxApplication'],'as':_0xcef7('0x39')}]});})['then'](function(_0x29b9cc){if(_0x29b9cc&&_0x29b9cc['List']){var _0x375e34=_0x29b9cc[_0xcef7('0x3a')]({'plain':!![]});_0x5116c6['account']=_0x375e34;_0x5116c6[_0xcef7('0x3b')]=_0x375e34[_0xcef7('0x39')];_0x5116c6[_0xcef7('0x3c')]=_0x375e34[_0xcef7('0x3d')];_0x5116c6[_0xcef7('0x3b')]=_['orderBy'](_0x5116c6[_0xcef7('0x3b')],[_0xcef7('0x3e')],[_0xcef7('0x3f')]);if(_0x5116c6['account']['Applications']){delete _0x5116c6[_0xcef7('0x36')][_0xcef7('0x39')];}if(_0x5116c6[_0xcef7('0x36')][_0xcef7('0x3d')]&&_0x5116c6[_0xcef7('0x36')]['List']['Contacts']['length']){return _0x5116c6['account'][_0xcef7('0x3d')][_0xcef7('0x37')][0x0];}var _0x1a5837=_['defaults'](_0x26001a[_0xcef7('0x27')],{'firstName':_0x26001a['body']['from'],'ListId':_0x375e34[_0xcef7('0x40')]});_0x1a5837[_0x26001a[_0xcef7('0x27')][_0xcef7('0x31')]]=_0x26001a[_0xcef7('0x27')][_0xcef7('0x2e')];return db[_0xcef7('0x29')][_0xcef7('0x41')](_0x1a5837,{'fields':_0x29d629,'raw':!![]});}})[_0xcef7('0x12')](function(_0x25f5b6){_0x5116c6[_0xcef7('0x42')]=_0x25f5b6;if(_0x25f5b6){var _0x8db49f={'ContactId':_0x25f5b6['id'],'FaxAccountId':_0x26001a[_0xcef7('0x36')]['id'],'fax':_0x25f5b6[_0xcef7('0x28')]};return db[_0xcef7('0x43')][_0xcef7('0x35')]({'where':{'ContactId':_0x25f5b6['id'],'closed':![],'FaxAccountId':_0x26001a['account']['id']}})[_0xcef7('0x12')](function(_0x5e3a61){if(_0x5e3a61){return[_0x5e3a61,![]];}return db[_0xcef7('0x43')][_0xcef7('0x41')](_0x8db49f)[_0xcef7('0x12')](function(_0x563673){return[_0x563673,!![]];});});}else{throw new Error(_0xcef7('0x44'));}})[_0xcef7('0x45')](function(_0x234ad8,_0x4a7336){var _0x5f214d=_0x234ad8['get']({'plain':!![]});if(_0x4a7336){if(_0x5116c6[_0xcef7('0x36')][_0xcef7('0x46')]){_0x5116c6['applications'][_0xcef7('0x47')]({'id':0x0,'priority':_0x5116c6[_0xcef7('0x3b')][_0xcef7('0x48')]+0x1,'app':_0xcef7('0x49'),'appdata':_0xcef7('0x4a'),'interval':_0xcef7('0x4b')});}_0x5f214d[_0xcef7('0x4c')]=!![];}else{_0x5f214d[_0xcef7('0x4c')]=![];}_0x5116c6[_0xcef7('0x4d')]=_0x5f214d;return db[_0xcef7('0x4e')]['create']({'body':_0x26001a[_0xcef7('0x27')]['body'],'FaxAccountId':_0x26001a['account']['id'],'FaxInteractionId':_0x234ad8['id'],'direction':'in','ContactId':_0x234ad8['ContactId'],'AttachmentId':_0x26001a[_0xcef7('0x27')][_0xcef7('0x4f')]});})['then'](function(_0x1f4cd8){_0x5116c6[_0xcef7('0x19')]=_0x1f4cd8;if(_0x5116c6[_0xcef7('0x4d')][_0xcef7('0x50')]){return db[_0xcef7('0x51')][_0xcef7('0x35')]({'attributes':['id',_0xcef7('0x52')],'where':{'id':_0x5116c6[_0xcef7('0x4d')][_0xcef7('0x50')]}})[_0xcef7('0x12')](function(_0xb4ce5){if(_0xb4ce5){_0x5116c6[_0xcef7('0x3b')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcef7('0x53'),'appdata':_0xb4ce5[_0xcef7('0x52')]+','+(_0x5116c6['account'][_0xcef7('0x54')]||0xa),'interval':_0xcef7('0x4b')});}return respondWithRpcPromise(_0xcef7('0x55'),_0xcef7('0x56'),_0x5116c6);});}return respondWithRpcPromise('Start',_0xcef7('0x56'),_0x5116c6);})['then'](function(_0x2d9184){_0x5a55ab(_0x2d9184);})['catch'](function(_0x1bfbcb){_0x5d8c10(_0x4f9c23[_0xcef7('0x18')](0x1f4,_0x1bfbcb['message']));});});};
\ No newline at end of file
+var _0xa8b5=['from','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','DESC','FaxApplication','Applications','get','applications','orderBy','priority','asc','Contacts','length','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include','model','attributes','map','NotifyFaxAccount','body','fax','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil'];(function(_0x279b1a,_0x2bb6df){var _0x316364=function(_0x67247f){while(--_0x67247f){_0x279b1a['push'](_0x279b1a['shift']());}};_0x316364(++_0x2bb6df);}(_0xa8b5,0x199));var _0x5a8b=function(_0x445309,_0x5c4b6d){_0x445309=_0x445309-0x0;var _0x14af02=_0xa8b5[_0x445309];return _0x14af02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a8b('0x0'));var BPromise=require(_0x5a8b('0x1'));var rs=require(_0x5a8b('0x2'));var fs=require('fs');var Redis=require(_0x5a8b('0x3'));var db=require(_0x5a8b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a8b('0x5'))(_0x5a8b('0x6'));var config=require(_0x5a8b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5a8b('0x8')]({'port':0x232c});config[_0x5a8b('0x9')]=_[_0x5a8b('0xa')](config['redis'],{'host':_0x5a8b('0xb'),'port':0x18eb});var socket=require(_0x5a8b('0xc'))(new Redis(config[_0x5a8b('0x9')]));require(_0x5a8b('0xd'))[_0x5a8b('0xe')](socket);function respondWithRpcPromise(_0x3466f6,_0x1a750b,_0x4110a6){return new BPromise(function(_0x2775d9,_0x4f58b6){return client[_0x5a8b('0xf')](_0x3466f6,_0x4110a6)[_0x5a8b('0x10')](function(_0x248d42){logger[_0x5a8b('0x11')](_0x5a8b('0x12'),_0x1a750b,_0x5a8b('0x13'));logger[_0x5a8b('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1a750b,_0x5a8b('0x13'),JSON[_0x5a8b('0x15')](_0x248d42));if(_0x248d42[_0x5a8b('0x16')]){if(_0x248d42[_0x5a8b('0x16')][_0x5a8b('0x17')]===0x1f4){logger[_0x5a8b('0x16')](_0x5a8b('0x12'),_0x1a750b,_0x248d42[_0x5a8b('0x16')][_0x5a8b('0x18')]);return _0x4f58b6(_0x248d42[_0x5a8b('0x16')]['message']);}logger[_0x5a8b('0x16')](_0x5a8b('0x12'),_0x1a750b,_0x248d42[_0x5a8b('0x16')][_0x5a8b('0x18')]);return _0x2775d9(_0x248d42[_0x5a8b('0x16')][_0x5a8b('0x18')]);}else{logger[_0x5a8b('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1a750b,'request\x20sent');_0x2775d9(_0x248d42[_0x5a8b('0x19')][_0x5a8b('0x18')]);}})[_0x5a8b('0x1a')](function(_0x2a7b55){logger['error'](_0x5a8b('0x12'),_0x1a750b,_0x2a7b55);_0x4f58b6(_0x2a7b55);});});}exports[_0x5a8b('0x1b')]=function(_0x2459c9){var _0x1efa4e=this;return new Promise(function(_0x575220,_0x1b355d){return db[_0x5a8b('0x1c')][_0x5a8b('0x1d')]({'raw':_0x2459c9['options']?_0x2459c9[_0x5a8b('0x1e')][_0x5a8b('0x1f')]===undefined?!![]:![]:!![],'where':_0x2459c9[_0x5a8b('0x1e')]?_0x2459c9[_0x5a8b('0x1e')][_0x5a8b('0x20')]||null:null,'attributes':_0x2459c9[_0x5a8b('0x1e')]?_0x2459c9['options']['attributes']||null:null,'limit':_0x2459c9['options']?_0x2459c9[_0x5a8b('0x1e')][_0x5a8b('0x21')]||null:null,'include':_0x2459c9[_0x5a8b('0x1e')]?_0x2459c9[_0x5a8b('0x1e')][_0x5a8b('0x22')]?_['map'](_0x2459c9['options'][_0x5a8b('0x22')],function(_0x573cda){return{'model':db[_0x573cda[_0x5a8b('0x23')]],'as':_0x573cda['as'],'attributes':_0x573cda[_0x5a8b('0x24')],'include':_0x573cda['include']?_[_0x5a8b('0x25')](_0x573cda[_0x5a8b('0x22')],function(_0x548a5c){return{'model':db[_0x548a5c['model']],'as':_0x548a5c['as'],'attributes':_0x548a5c[_0x5a8b('0x24')],'include':_0x548a5c[_0x5a8b('0x22')]?_[_0x5a8b('0x25')](_0x548a5c[_0x5a8b('0x22')],function(_0x1e1260){return{'model':db[_0x1e1260[_0x5a8b('0x23')]],'as':_0x1e1260['as'],'attributes':_0x1e1260[_0x5a8b('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5a8b('0x10')](function(_0x4f3a3e){logger['info'](_0x5a8b('0x1b'),_0x2459c9);logger[_0x5a8b('0x14')](_0x5a8b('0x1b'),_0x2459c9,JSON[_0x5a8b('0x15')](_0x4f3a3e));_0x575220(_0x4f3a3e);})[_0x5a8b('0x1a')](function(_0x1c51b0){logger[_0x5a8b('0x16')](_0x5a8b('0x1b'),_0x1c51b0[_0x5a8b('0x18')],_0x2459c9);_0x1b355d(_0x1efa4e['error'](0x1f4,_0x1c51b0['message']));});});};exports[_0x5a8b('0x26')]=function(_0x2d977c,_0x5e8c7a,_0x311314){var _0x4f89ee=this;return new Promise(function(_0x47ddfb,_0x2a1165){var _0x2e72b2={'body':_0x2d977c[_0x5a8b('0x27')],'channel':_0x5a8b('0x28')};var _0x23ae51=[];var _0x1f31c7=[];var _0x14f74b={};return db['CmContact'][_0x5a8b('0x29')]()[_0x5a8b('0x10')](function(_0x2d68f0){if(!_0x2d68f0){throw new db['Sequelize'][(_0x5a8b('0x2a'))](_0x5a8b('0x2b'));}_0x23ae51=_[_0x5a8b('0x2c')](_[_0x5a8b('0x2d')](_0x2d68f0),[_0x5a8b('0x2e'),_0x5a8b('0x2f')]);_0x1f31c7=_[_0x5a8b('0x2c')](_['keys'](_0x2d68f0),['createdAt',_0x5a8b('0x2f'),_0x5a8b('0x30'),_0x5a8b('0x31')]);if(_0x2d977c[_0x5a8b('0x27')]['id']){delete _0x2d977c[_0x5a8b('0x27')]['id'];}if(_[_0x5a8b('0x32')](_0x2d977c['body'][_0x5a8b('0x33')])){throw new db['Sequelize'][(_0x5a8b('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x5a8b('0x32')](_0x2d977c[_0x5a8b('0x27')]['body'])||_0x2d977c[_0x5a8b('0x27')]['body']===''){throw new db[(_0x5a8b('0x34'))][(_0x5a8b('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5a8b('0x32')](_0x2d977c['body']['mapKey'])){throw new db[(_0x5a8b('0x34'))][(_0x5a8b('0x2a'))](_0x5a8b('0x35')+_0x1f31c7);}if(!_[_0x5a8b('0x36')](_0x1f31c7,_0x2d977c[_0x5a8b('0x27')][_0x5a8b('0x37')])){throw new db['Sequelize'][(_0x5a8b('0x2a'))](_0x5a8b('0x38')+_0x1f31c7);}_0x14f74b[_0x2d977c[_0x5a8b('0x27')]['mapKey']]=_0x2d977c[_0x5a8b('0x27')]['from'];})[_0x5a8b('0x10')](function(){return db['FaxAccount'][_0x5a8b('0x39')]({'where':{'id':_0x2d977c[_0x5a8b('0x3a')]['id']},'include':[{'model':db[_0x5a8b('0x3b')],'as':_0x5a8b('0x3c'),'include':[{'model':db[_0x5a8b('0x3d')],'as':'Contacts','where':_0x14f74b,'limit':0x1,'order':[[_0x5a8b('0x2f'),_0x5a8b('0x3e')]]}]},{'model':db[_0x5a8b('0x3f')],'as':_0x5a8b('0x40')}]});})[_0x5a8b('0x10')](function(_0x3a7814){if(_0x3a7814&&_0x3a7814[_0x5a8b('0x3c')]){var _0x575380=_0x3a7814[_0x5a8b('0x41')]({'plain':!![]});_0x2e72b2[_0x5a8b('0x3a')]=_0x575380;_0x2e72b2['applications']=_0x575380['Applications'];_0x2e72b2['list']=_0x575380[_0x5a8b('0x3c')];_0x2e72b2[_0x5a8b('0x42')]=_[_0x5a8b('0x43')](_0x2e72b2['applications'],[_0x5a8b('0x44')],[_0x5a8b('0x45')]);if(_0x2e72b2[_0x5a8b('0x3a')][_0x5a8b('0x40')]){delete _0x2e72b2[_0x5a8b('0x3a')][_0x5a8b('0x40')];}if(_0x2e72b2[_0x5a8b('0x3a')]['List']&&_0x2e72b2[_0x5a8b('0x3a')][_0x5a8b('0x3c')][_0x5a8b('0x46')][_0x5a8b('0x47')]){return _0x2e72b2['account'][_0x5a8b('0x3c')]['Contacts'][0x0];}var _0x527aa6=_[_0x5a8b('0xa')](_0x2d977c['body'],{'firstName':_0x2d977c['body'][_0x5a8b('0x33')],'ListId':_0x575380[_0x5a8b('0x31')]});_0x527aa6[_0x2d977c[_0x5a8b('0x27')][_0x5a8b('0x37')]]=_0x2d977c[_0x5a8b('0x27')][_0x5a8b('0x33')];return db[_0x5a8b('0x3d')][_0x5a8b('0x48')](_0x527aa6,{'fields':_0x23ae51,'raw':!![]});}})[_0x5a8b('0x10')](function(_0x1ef87a){_0x2e72b2[_0x5a8b('0x49')]=_0x1ef87a;if(_0x1ef87a){var _0x341764={'ContactId':_0x1ef87a['id'],'FaxAccountId':_0x2d977c[_0x5a8b('0x3a')]['id'],'fax':_0x1ef87a[_0x5a8b('0x28')]};return db[_0x5a8b('0x4a')][_0x5a8b('0x39')]({'where':{'ContactId':_0x1ef87a['id'],'closed':![],'FaxAccountId':_0x2d977c[_0x5a8b('0x3a')]['id']}})[_0x5a8b('0x10')](function(_0x3b360f){if(_0x3b360f){return[_0x3b360f,![]];}return db['FaxInteraction'][_0x5a8b('0x48')](_0x341764)[_0x5a8b('0x10')](function(_0x426145){return[_0x426145,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x5a8b('0x4b')](function(_0x3c67b8,_0x4a67ce){var _0x3179ed=_0x3c67b8['get']({'plain':!![]});if(_0x4a67ce){if(_0x2e72b2[_0x5a8b('0x3a')][_0x5a8b('0x4c')]){_0x2e72b2[_0x5a8b('0x42')][_0x5a8b('0x4d')]({'id':0x0,'priority':_0x2e72b2[_0x5a8b('0x42')]['length']+0x1,'app':_0x5a8b('0x4e'),'appdata':_0x5a8b('0x4f'),'interval':'*,*,*,*'});}_0x3179ed[_0x5a8b('0x50')]=!![];}else{_0x3179ed[_0x5a8b('0x50')]=![];}_0x2e72b2[_0x5a8b('0x51')]=_0x3179ed;return db[_0x5a8b('0x52')][_0x5a8b('0x48')]({'body':_0x2d977c['body'][_0x5a8b('0x27')],'FaxAccountId':_0x2d977c[_0x5a8b('0x3a')]['id'],'FaxInteractionId':_0x3c67b8['id'],'direction':'in','ContactId':_0x3c67b8[_0x5a8b('0x53')],'AttachmentId':_0x2d977c[_0x5a8b('0x27')][_0x5a8b('0x54')]});})['then'](function(_0x32357e){_0x2e72b2[_0x5a8b('0x18')]=_0x32357e;if(_0x2e72b2[_0x5a8b('0x51')][_0x5a8b('0x55')]){return db[_0x5a8b('0x56')][_0x5a8b('0x39')]({'attributes':['id',_0x5a8b('0x57')],'where':{'id':_0x2e72b2['interaction']['UserId']}})[_0x5a8b('0x10')](function(_0x4f431b){if(_0x4f431b){_0x2e72b2[_0x5a8b('0x42')][_0x5a8b('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4f431b[_0x5a8b('0x57')]+','+(_0x2e72b2[_0x5a8b('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x5a8b('0x59')});}return respondWithRpcPromise(_0x5a8b('0x5a'),_0x5a8b('0x5b'),_0x2e72b2);});}return respondWithRpcPromise(_0x5a8b('0x5a'),'startRouting',_0x2e72b2);})['then'](function(_0x2837a5){_0x47ddfb(_0x2837a5);})['catch'](function(_0x41475e){_0x2a1165(_0x4f89ee[_0x5a8b('0x16')](0x1f4,_0x41475e[_0x5a8b('0x18')]));});});};
\ No newline at end of file