Built motion from commit (unavailable).|2.4.12
[motion2.git] / server / api / rpc / rpc.controller.js
index 8d36330..0770996 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b30=['isNil','rows','query','catch','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','format','SIP/%s','interface','YYYY-MM-DD\x20HH:mm:ss','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','update','From','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','api','http','client','request','then','error','message','result','status','json','sendStatus','name','send'];(function(_0x4ea161,_0x2986c6){var _0x29efc2=function(_0x3ca917){while(--_0x3ca917){_0x4ea161['push'](_0x4ea161['shift']());}};_0x29efc2(++_0x2986c6);}(_0x1b30,0x14a));var _0x01b3=function(_0x11c97f,_0x5e0be5){_0x11c97f=_0x11c97f-0x0;var _0x75fe87=_0x1b30[_0x11c97f];return _0x75fe87;};'use strict';var BPromise=require(_0x01b3('0x0'));var moment=require(_0x01b3('0x1'));var _=require(_0x01b3('0x2'));var util=require(_0x01b3('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x01b3('0x4'))(_0x01b3('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x01b3('0x6')]({'port':0x232a});var mailClient=jayson[_0x01b3('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x01b3('0x7')][_0x01b3('0x6')]({'port':0x232c});function respondWithRpcPromise(_0xb677bb,_0x53c49c,_0x31a403){return new BPromise(function(_0x3f61f3,_0x3e16b1){var _0x284c7d=_0x31a403?_0x31a403:amiClient;return _0x284c7d[_0x01b3('0x8')](_0xb677bb,_0x53c49c)[_0x01b3('0x9')](function(_0x46afc5){if(_0x46afc5[_0x01b3('0xa')]){if(_0x46afc5[_0x01b3('0xa')]['code']===0x1f4){return _0x3e16b1(_0x46afc5['error'][_0x01b3('0xb')]);}return _0x3f61f3(_0x46afc5['error'][_0x01b3('0xb')]);}else{_0x3f61f3(_0x46afc5[_0x01b3('0xc')]);}})['catch'](function(_0x13ce38){_0x3e16b1(_0x13ce38);});});}function respondWithResult(_0x142945,_0x5baea1){_0x5baea1=_0x5baea1||0xc8;return function(_0x29c78a){if(_0x29c78a){return _0x142945[_0x01b3('0xd')](_0x5baea1)[_0x01b3('0xe')](_0x29c78a);}return _0x142945[_0x01b3('0xf')](0x194);};}function handleError(_0x46107f,_0x1c5bd4){_0x1c5bd4=_0x1c5bd4||0x1f4;return function(_0x4365d6){logger[_0x01b3('0xa')](_0x4365d6['stack']);if(_0x4365d6[_0x01b3('0x10')]){delete _0x4365d6[_0x01b3('0x10')];}_0x46107f[_0x01b3('0xd')](_0x1c5bd4)[_0x01b3('0x11')](_0x4365d6);};}function findById(_0x2610bf){return function(_0x59fe69){if(!_[_0x01b3('0x12')](_0x2610bf)&&!_[_0x01b3('0x12')](_0x59fe69)&&!_[_0x01b3('0x12')](_0x59fe69['rows'])){return _['find'](_0x59fe69[_0x01b3('0x13')],function(_0x43b682){return _0x43b682['id']==_0x2610bf;});}return null;};}exports['voiceChannels']=function(_0xaca832,_0x16086d){return respondWithRpcPromise('VoiceChannels',_0xaca832[_0x01b3('0x14')])['then'](respondWithResult(_0x16086d,null))[_0x01b3('0x15')](handleError(_0x16086d,null));};exports[_0x01b3('0x16')]=function(_0x3a2a90,_0x29c627){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x01b3('0x17')](_0x3a2a90[_0x01b3('0x14')],_0x3a2a90[_0x01b3('0x18')]))[_0x01b3('0x9')](respondWithResult(_0x29c627,null))['catch'](handleError(_0x29c627,null));};exports[_0x01b3('0x19')]=function(_0x1c6781,_0x396021){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x01b3('0x17')](_0x1c6781[_0x01b3('0x14')],_0x1c6781[_0x01b3('0x18')]))[_0x01b3('0x9')](respondWithResult(_0x396021,null))[_0x01b3('0x15')](handleError(_0x396021,null));};exports[_0x01b3('0x1a')]=function(_0x508ea4,_0x493d70){return respondWithRpcPromise('VoiceQueues',_0x508ea4['query'])[_0x01b3('0x9')](respondWithResult(_0x493d70,null))['catch'](handleError(_0x493d70,null));};exports['showVoiceQueues']=function(_0x48081e,_0x50af38){return respondWithRpcPromise(_0x01b3('0x1b'),_0x48081e[_0x01b3('0x14')])[_0x01b3('0x9')](findById(_0x48081e['params']['id']))[_0x01b3('0x9')](respondWithResult(_0x50af38,null))['catch'](handleError(_0x50af38,null));};exports[_0x01b3('0x1c')]=function(_0x472166,_0x42b615){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x01b3('0x17')](_0x472166[_0x01b3('0x14')],_0x472166[_0x01b3('0x18')]))[_0x01b3('0x9')](respondWithResult(_0x42b615,null))['catch'](handleError(_0x42b615,null));};exports[_0x01b3('0x1d')]=function(_0x3a6a8d,_0x2cf317){return respondWithRpcPromise(_0x01b3('0x1e'),_0x3a6a8d['query'])['then'](respondWithResult(_0x2cf317,null))[_0x01b3('0x15')](handleError(_0x2cf317,null));};exports[_0x01b3('0x1f')]=function(_0xcae77e,_0x51a933){return respondWithRpcPromise(_0x01b3('0x20'),_['merge'](_0xcae77e[_0x01b3('0x14')],_0xcae77e[_0x01b3('0x18')]))[_0x01b3('0x9')](respondWithResult(_0x51a933,null))[_0x01b3('0x15')](handleError(_0x51a933,null));};exports[_0x01b3('0x21')]=function(_0x39525b,_0x5de371){return respondWithRpcPromise(_0x01b3('0x22'),_[_0x01b3('0x17')](_0x39525b[_0x01b3('0x14')],_0x39525b[_0x01b3('0x18')]))[_0x01b3('0x9')](respondWithResult(_0x5de371,null))[_0x01b3('0x15')](handleError(_0x5de371,null));};exports[_0x01b3('0x23')]=function(_0x18b1a6,_0xe9ec24){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x01b3('0x17')](_0x18b1a6[_0x01b3('0x14')],_0x18b1a6[_0x01b3('0x18')]))[_0x01b3('0x9')](respondWithResult(_0xe9ec24,null))[_0x01b3('0x15')](handleError(_0xe9ec24,null));};exports[_0x01b3('0x24')]=function(_0x49d3f5,_0x599a43){return respondWithRpcPromise(_0x01b3('0x25'),_0x49d3f5['query'])[_0x01b3('0x9')](respondWithResult(_0x599a43,null))[_0x01b3('0x15')](handleError(_0x599a43,null));};exports[_0x01b3('0x26')]=function(_0x5c1e22,_0x4a9023){return respondWithRpcPromise('OutboundChannels',_0x5c1e22[_0x01b3('0x14')])[_0x01b3('0x9')](respondWithResult(_0x4a9023,null))['catch'](handleError(_0x4a9023,null));};exports[_0x01b3('0x27')]=function(_0x4ebfd1,_0x3ae9b8){var _0x9c5504;return respondWithRpcPromise(_0x01b3('0x28'),_0x4ebfd1[_0x01b3('0x14')])[_0x01b3('0x9')](function(_0x405853){_0x9c5504=_0x405853;return respondWithRpcPromise(_0x01b3('0x28'),_0x4ebfd1[_0x01b3('0x14')],routingClient);})[_0x01b3('0x9')](function(_0x32b79b){return _[_0x01b3('0x17')]({},_0x32b79b,_0x9c5504);})['then'](respondWithResult(_0x3ae9b8,null))[_0x01b3('0x15')](handleError(_0x3ae9b8,null));};exports[_0x01b3('0x29')]=function(_0x48732f,_0x46f7e2){if(_0x48732f[_0x01b3('0x2a')]&&_0x48732f[_0x01b3('0x2a')]['interaction']&&_0x48732f[_0x01b3('0x2b')]&&_0x48732f[_0x01b3('0x2b')][_0x01b3('0x10')]){for(var _0x64b798 in _0x48732f[_0x01b3('0x2a')]['interaction']){if(_0x48732f['body'][_0x01b3('0x2c')]['hasOwnProperty'](_0x64b798)){db[_0x01b3('0x2d')][_0x01b3('0x2e')]({'where':{'channel':_0x64b798,'membername':_0x48732f[_0x01b3('0x2b')]['name'],'type':_0x01b3('0x2f'),'exitAt':null,'uniqueid':_0x48732f[_0x01b3('0x2a')]['interaction'][_0x64b798]&&_0x48732f['body'][_0x01b3('0x2c')][_0x64b798]['length']?{'$notIn':_0x48732f[_0x01b3('0x2a')]['interaction'][_0x64b798]}:{'$ne':null}}})['then'](function(_0x2f2e19){var _0x3fb9f1=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x35e70e=0x0,_0x4ce7ab=_0x2f2e19[_0x01b3('0x30')];_0x35e70e<_0x4ce7ab;_0x35e70e+=0x1){_0x2f2e19[_0x35e70e][_0x01b3('0x31')]({'exitAt':_0x3fb9f1});}});for(var _0x290a51=0x0;_0x290a51<_0x48732f[_0x01b3('0x2a')]['interaction'][_0x64b798][_0x01b3('0x30')];_0x290a51+=0x1){db[_0x01b3('0x2d')][_0x01b3('0x32')]({'where':{'channel':_0x64b798,'membername':_0x48732f[_0x01b3('0x2b')][_0x01b3('0x10')],'type':_0x01b3('0x2f'),'uniqueid':_0x48732f[_0x01b3('0x2a')][_0x01b3('0x2c')][_0x64b798][_0x290a51],'exitAt':null},'defaults':{'channel':_0x64b798,'membername':_0x48732f[_0x01b3('0x2b')][_0x01b3('0x10')],'interface':_[_0x01b3('0x12')](_0x48732f[_0x01b3('0x2b')]['interface'])?util[_0x01b3('0x33')](_0x01b3('0x34'),_0x48732f[_0x01b3('0x2b')]['name']):_0x48732f[_0x01b3('0x2b')][_0x01b3('0x35')],'type':_0x01b3('0x2f'),'enterAt':moment()[_0x01b3('0x33')](_0x01b3('0x36')),'role':'agent','internal':_0x48732f[_0x01b3('0x2b')][_0x01b3('0x37')],'uniqueid':_0x48732f[_0x01b3('0x2a')][_0x01b3('0x2c')][_0x64b798][_0x290a51]}});}}}}return respondWithRpcPromise(_0x01b3('0x38'),{'id':_0x48732f[_0x01b3('0x18')]['id'],'capacity':_0x48732f[_0x01b3('0x2a')][_0x01b3('0x39')]},routingClient)[_0x01b3('0x9')](respondWithResult(_0x46f7e2,null))['catch'](handleError(_0x46f7e2,null));};exports[_0x01b3('0x3a')]=function(_0x571db7,_0x318ac6){return respondWithRpcPromise('Telephones',_0x571db7[_0x01b3('0x14')])['then'](respondWithResult(_0x318ac6,null))[_0x01b3('0x15')](handleError(_0x318ac6,null));};exports[_0x01b3('0x3b')]=function(_0x36072c,_0x335212){return respondWithRpcPromise(_0x01b3('0x3c'),_0x36072c['query'])[_0x01b3('0x9')](respondWithResult(_0x335212,null))[_0x01b3('0x15')](handleError(_0x335212,null));};exports[_0x01b3('0x3d')]=function(_0x1e54c9,_0x53e8c1){return respondWithRpcPromise(_0x01b3('0x3e'),_0x1e54c9[_0x01b3('0x14')])[_0x01b3('0x9')](respondWithResult(_0x53e8c1,null))[_0x01b3('0x15')](handleError(_0x53e8c1,null));};exports[_0x01b3('0x3f')]=function(_0x5f063b,_0x46d2e0){return respondWithRpcPromise(_0x01b3('0x40'),_0x5f063b[_0x01b3('0x14')],routingClient)['then'](respondWithResult(_0x46d2e0,null))[_0x01b3('0x15')](handleError(_0x46d2e0,null));};exports[_0x01b3('0x41')]=function(_0x1cd6bc,_0x31481d){return respondWithRpcPromise(_0x01b3('0x40'),_0x1cd6bc[_0x01b3('0x14')],routingClient)['then'](findById(_0x1cd6bc[_0x01b3('0x18')]['id']))[_0x01b3('0x9')](respondWithResult(_0x31481d,null))[_0x01b3('0x15')](handleError(_0x31481d,null));};exports[_0x01b3('0x42')]=function(_0x883971,_0xc99794){return respondWithRpcPromise(_0x01b3('0x43'),_0x883971[_0x01b3('0x14')],routingClient)[_0x01b3('0x9')](respondWithResult(_0xc99794,null))[_0x01b3('0x15')](handleError(_0xc99794,null));};exports[_0x01b3('0x44')]=function(_0x1433eb,_0x150f2a){return respondWithRpcPromise('MailQueues',_0x1433eb['query'],routingClient)['then'](findById(_0x1433eb[_0x01b3('0x18')]['id']))[_0x01b3('0x9')](respondWithResult(_0x150f2a,null))['catch'](handleError(_0x150f2a,null));};exports[_0x01b3('0x45')]=function(_0x239dd2,_0x109df9){return respondWithRpcPromise(_0x01b3('0x46'),_0x239dd2[_0x01b3('0x14')],mailClient)['then'](respondWithResult(_0x109df9,null))[_0x01b3('0x15')](handleError(_0x109df9,null));};exports['openchannelQueues']=function(_0x40a632,_0x3f2246){return respondWithRpcPromise(_0x01b3('0x47'),_0x40a632['query'],routingClient)[_0x01b3('0x9')](respondWithResult(_0x3f2246,null))['catch'](handleError(_0x3f2246,null));};exports[_0x01b3('0x48')]=function(_0x3b2ade,_0x1bb726){return respondWithRpcPromise(_0x01b3('0x47'),_0x3b2ade['query'],routingClient)[_0x01b3('0x9')](findById(_0x3b2ade['params']['id']))['then'](respondWithResult(_0x1bb726,null))['catch'](handleError(_0x1bb726,null));};exports[_0x01b3('0x49')]=function(_0x349afd,_0x1cad27){return respondWithRpcPromise('SmsQueues',_0x349afd['query'],routingClient)[_0x01b3('0x9')](respondWithResult(_0x1cad27,null))[_0x01b3('0x15')](handleError(_0x1cad27,null));};exports[_0x01b3('0x4a')]=function(_0x480722,_0x2b7b28){return respondWithRpcPromise(_0x01b3('0x4b'),_0x480722['query'],routingClient)[_0x01b3('0x9')](findById(_0x480722[_0x01b3('0x18')]['id']))[_0x01b3('0x9')](respondWithResult(_0x2b7b28,null))[_0x01b3('0x15')](handleError(_0x2b7b28,null));};exports[_0x01b3('0x4c')]=function(_0x1c4143,_0x41ac0c){return respondWithRpcPromise(_0x01b3('0x4d'),_0x1c4143['query'],routingClient)[_0x01b3('0x9')](respondWithResult(_0x41ac0c,null))[_0x01b3('0x15')](handleError(_0x41ac0c,null));};exports[_0x01b3('0x4e')]=function(_0xf80a87,_0x2a4e2d){return respondWithRpcPromise(_0x01b3('0x4d'),_0xf80a87[_0x01b3('0x14')],routingClient)[_0x01b3('0x9')](findById(_0xf80a87[_0x01b3('0x18')]['id']))[_0x01b3('0x9')](respondWithResult(_0x2a4e2d,null))[_0x01b3('0x15')](handleError(_0x2a4e2d,null));};exports[_0x01b3('0x4f')]=function(_0x5765b2,_0x44fe1d){return respondWithRpcPromise(_0x01b3('0x50'),_0x5765b2[_0x01b3('0x14')])['then'](respondWithResult(_0x44fe1d,null))['catch'](handleError(_0x44fe1d,null));};exports['chatQueuesWaitingInteractions']=function(_0x2747de,_0x33c005){return respondWithRpcPromise(_0x01b3('0x51'),_0x2747de[_0x01b3('0x14')],routingClient)[_0x01b3('0x9')](respondWithResult(_0x33c005,null))[_0x01b3('0x15')](handleError(_0x33c005,null));};exports[_0x01b3('0x52')]=function(_0x4fe0de,_0xe1cd89){return respondWithRpcPromise(_0x01b3('0x53'),_0x4fe0de['query'],routingClient)[_0x01b3('0x9')](respondWithResult(_0xe1cd89,null))[_0x01b3('0x15')](handleError(_0xe1cd89,null));};exports[_0x01b3('0x54')]=function(_0x1ca908,_0x241849){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1ca908['query'],routingClient)[_0x01b3('0x9')](respondWithResult(_0x241849,null))[_0x01b3('0x15')](handleError(_0x241849,null));};exports[_0x01b3('0x55')]=function(_0x3c9003,_0x15c6f1){return respondWithRpcPromise(_0x01b3('0x56'),_0x3c9003[_0x01b3('0x14')],routingClient)[_0x01b3('0x9')](respondWithResult(_0x15c6f1,null))[_0x01b3('0x15')](handleError(_0x15c6f1,null));};exports[_0x01b3('0x57')]=function(_0x5e6322,_0x46ab9f){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5e6322[_0x01b3('0x14')],routingClient)[_0x01b3('0x9')](respondWithResult(_0x46ab9f,null))[_0x01b3('0x15')](handleError(_0x46ab9f,null));};exports[_0x01b3('0x58')]=function(_0x5ad5c1){return function(_0xda6b0b,_0x51c611){var _0x159f94,_0x4abbfa;var _0x12d6a2=_[_0x01b3('0x59')](_0x5ad5c1);var _0x63a826=_0x5ad5c1===_0x01b3('0x5a')?_0x01b3('0x5b'):_0x01b3('0x5c');return db[_0x12d6a2+'Queue']['findOne']({'raw':!![],'where':{'id':_0xda6b0b[_0x01b3('0x18')]['id']}})[_0x01b3('0x9')](function(_0x2b5522){if(_[_0x01b3('0x12')](_0x2b5522)){throw new Error(_0x12d6a2+_0x01b3('0x5d'));}_0x159f94=_0x2b5522;return db[_0x12d6a2+_0x01b3('0x5e')][_0x01b3('0x5f')]({'where':{'id':_0xda6b0b['body'][_0x01b3('0x60')]},'include':[{'model':db[_0x12d6a2+_0x01b3('0x61')],'as':_0x01b3('0x61')},{'model':db[_0x12d6a2+_0x63a826],'as':_0x01b3('0x5c')}]});})['then'](function(_0x21d14e){if(_[_0x01b3('0x12')](_0x21d14e)){throw new Error(_0x12d6a2+_0x01b3('0x62'));}_0x4abbfa=_0x21d14e;return _0x21d14e['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x8197f0={'uniqueid':_0x5ad5c1+'.'+_0x4abbfa['id']+'.'+_0x4abbfa['Interaction']['id'],'FromUserId':_0xda6b0b['user']['id'],'type':_0x01b3('0x63')};_0x8197f0[_0x12d6a2+_0x01b3('0x64')]=_0x4abbfa['id'];_0x8197f0[_0x12d6a2+_0x01b3('0x65')]=_0x4abbfa[_0x01b3('0x61')]['id'];_0x8197f0['From'+_0x12d6a2+_0x63a826+'Id']=_0x4abbfa['Account']['id'];_0x8197f0['To'+_0x12d6a2+'QueueId']=_0x159f94['id'];return db[_0x12d6a2+_0x01b3('0x66')][_0x01b3('0x67')](_0x8197f0);})[_0x01b3('0x9')](function(){return respondWithRpcPromise(_0x01b3('0x68'),{'channel':_0x5ad5c1,'interaction':_0x4abbfa[_0x01b3('0x61')],'message':_0x4abbfa,'account':_0x4abbfa[_0x01b3('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x01b3('0x63'),'appdata':_0x159f94[_0x01b3('0x10')]+','+(_0x4abbfa[_0x01b3('0x5c')][_0x01b3('0x69')]||0x12c),'interval':_0x01b3('0x6a')}]},routingClient);})[_0x01b3('0x9')](respondWithResult(_0x51c611,null))[_0x01b3('0x15')](handleError(_0x51c611,null));};};exports[_0x01b3('0x6b')]=function(_0x12f06c,_0x21f868){var _0x36beb5,_0x3118f2;if(_[_0x01b3('0x12')](_0x12f06c['body'][_0x01b3('0x6c')])){throw new Error(_0x01b3('0x6d'));}var _0x3a070e=_0x12f06c['body']['channel'];var _0x4a8544=_[_0x01b3('0x59')](_0x3a070e);var _0x55d27f=_0x3a070e===_0x01b3('0x5a')?'Website':_0x01b3('0x5c');return db[_0x01b3('0x6e')][_0x01b3('0x5f')]({'raw':!![],'where':{'id':_0x12f06c[_0x01b3('0x18')]['id'],'role':_0x01b3('0x6f')}})[_0x01b3('0x9')](function(_0x4cbc80){if(_['isNil'](_0x4cbc80)){throw new Error(_0x01b3('0x70'));}_0x36beb5=_0x4cbc80;return db[_0x4a8544+_0x01b3('0x5e')]['findOne']({'where':{'id':_0x12f06c[_0x01b3('0x2a')]['messageId']},'include':[{'model':db[_0x4a8544+_0x01b3('0x61')],'as':_0x01b3('0x61')},{'model':db[_0x4a8544+_0x55d27f],'as':_0x01b3('0x5c')}]});})[_0x01b3('0x9')](function(_0x4527cc){if(_['isNil'](_0x4527cc)){throw new Error(_0x4a8544+_0x01b3('0x62'));}_0x3118f2=_0x4527cc;return _0x4527cc[_0x01b3('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x01b3('0x9')](function(){var _0x11e8e3={'uniqueid':_0x3a070e+'.'+_0x3118f2['id']+'.'+_0x3118f2[_0x01b3('0x61')]['id'],'FromUserId':_0x12f06c['user']['id'],'type':'queue','ToUserId':_0x36beb5['id']};_0x11e8e3[_0x4a8544+_0x01b3('0x64')]=_0x3118f2['id'];_0x11e8e3[_0x4a8544+_0x01b3('0x65')]=_0x3118f2['Interaction']['id'];_0x11e8e3[_0x01b3('0x72')+_0x4a8544+_0x55d27f+'Id']=_0x3118f2[_0x01b3('0x5c')]['id'];return db[_0x4a8544+_0x01b3('0x66')][_0x01b3('0x67')](_0x11e8e3);})[_0x01b3('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x3a070e,'interaction':_0x3118f2['Interaction'],'message':_0x3118f2,'account':_0x3118f2[_0x01b3('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x01b3('0x6f'),'appdata':_0x36beb5[_0x01b3('0x10')]+','+(_0x3118f2['Account'][_0x01b3('0x73')]||0x12c),'interval':_0x01b3('0x6a')}]},routingClient);})['then'](respondWithResult(_0x21f868,null))[_0x01b3('0x15')](handleError(_0x21f868,null));};
\ No newline at end of file
+var _0xe414=['agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','Account','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','chat','Website','User','Agent\x20not\x20found','MessageId','InteractionId','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','voiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe414,0x117));var _0x4e41=function(_0x142472,_0x179995){_0x142472=_0x142472-0x0;var _0x18e8a4=_0xe414[_0x142472];return _0x18e8a4;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x4e41('0x0'));var jayson=require(_0x4e41('0x1'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson['client'][_0x4e41('0x2')]({'port':0x232b});var routingClient=jayson[_0x4e41('0x3')][_0x4e41('0x2')]({'port':0x232c});function respondWithRpcPromise(_0x349baa,_0x4f77bd,_0x2c7a16){return new BPromise(function(_0x34cd92,_0x41180a){var _0x27f6d4=_0x2c7a16?_0x2c7a16:amiClient;return _0x27f6d4[_0x4e41('0x4')](_0x349baa,_0x4f77bd)[_0x4e41('0x5')](function(_0xf3e6ea){if(_0xf3e6ea[_0x4e41('0x6')]){if(_0xf3e6ea['error'][_0x4e41('0x7')]===0x1f4){return _0x41180a(_0xf3e6ea['error'][_0x4e41('0x8')]);}return _0x34cd92(_0xf3e6ea[_0x4e41('0x6')]['message']);}else{_0x34cd92(_0xf3e6ea[_0x4e41('0x9')]);}})[_0x4e41('0xa')](function(_0x3c49bf){_0x41180a(_0x3c49bf);});});}function respondWithResult(_0xbd31f3,_0x237357){_0x237357=_0x237357||0xc8;return function(_0x211474){if(_0x211474){return _0xbd31f3[_0x4e41('0xb')](_0x237357)['json'](_0x211474);}return _0xbd31f3[_0x4e41('0xc')](0x194);};}function handleError(_0x529a9,_0x2fd0e9){_0x2fd0e9=_0x2fd0e9||0x1f4;return function(_0x4eaf27){logger[_0x4e41('0x6')](_0x4eaf27[_0x4e41('0xd')]);if(_0x4eaf27[_0x4e41('0xe')]){delete _0x4eaf27[_0x4e41('0xe')];}_0x529a9['status'](_0x2fd0e9)[_0x4e41('0xf')](_0x4eaf27);};}function findById(_0x346d83){return function(_0x36a30b){if(!_[_0x4e41('0x10')](_0x346d83)&&!_[_0x4e41('0x10')](_0x36a30b)&&!_[_0x4e41('0x10')](_0x36a30b['rows'])){return _['find'](_0x36a30b['rows'],function(_0x693a7b){return _0x693a7b['id']==_0x346d83;});}return null;};}exports[_0x4e41('0x11')]=function(_0x584527,_0x4213ae){return respondWithRpcPromise('VoiceChannels',_0x584527[_0x4e41('0x12')])[_0x4e41('0x5')](respondWithResult(_0x4213ae,null))[_0x4e41('0xa')](handleError(_0x4213ae,null));};exports[_0x4e41('0x13')]=function(_0xba9f5e,_0x2aa449){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x4e41('0x14')](_0xba9f5e['query'],_0xba9f5e[_0x4e41('0x15')]))['then'](respondWithResult(_0x2aa449,null))['catch'](handleError(_0x2aa449,null));};exports[_0x4e41('0x16')]=function(_0x59da33,_0x3c2c7f){return respondWithRpcPromise(_0x4e41('0x17'),_[_0x4e41('0x14')](_0x59da33['query'],_0x59da33['params']))['then'](respondWithResult(_0x3c2c7f,null))[_0x4e41('0xa')](handleError(_0x3c2c7f,null));};exports[_0x4e41('0x18')]=function(_0xb5a934,_0x4bf487){return respondWithRpcPromise(_0x4e41('0x19'),_0xb5a934[_0x4e41('0x12')])[_0x4e41('0x5')](respondWithResult(_0x4bf487,null))['catch'](handleError(_0x4bf487,null));};exports['showVoiceQueues']=function(_0x50bd20,_0x2a4ff7){return respondWithRpcPromise(_0x4e41('0x19'),_0x50bd20[_0x4e41('0x12')])[_0x4e41('0x5')](findById(_0x50bd20[_0x4e41('0x15')]['id']))[_0x4e41('0x5')](respondWithResult(_0x2a4ff7,null))[_0x4e41('0xa')](handleError(_0x2a4ff7,null));};exports['voiceQueuesPreview']=function(_0x52183c,_0x4aea48){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x4e41('0x14')](_0x52183c[_0x4e41('0x12')],_0x52183c['params']))['then'](respondWithResult(_0x4aea48,null))[_0x4e41('0xa')](handleError(_0x4aea48,null));};exports[_0x4e41('0x1a')]=function(_0x15559e,_0x430294){return respondWithRpcPromise('VoiceQueuesChannels',_0x15559e['query'])[_0x4e41('0x5')](respondWithResult(_0x430294,null))['catch'](handleError(_0x430294,null));};exports[_0x4e41('0x1b')]=function(_0x363362,_0xac13eb){return respondWithRpcPromise(_0x4e41('0x1c'),_['merge'](_0x363362[_0x4e41('0x12')],_0x363362[_0x4e41('0x15')]))[_0x4e41('0x5')](respondWithResult(_0xac13eb,null))[_0x4e41('0xa')](handleError(_0xac13eb,null));};exports['voiceQueuesChannelHangup']=function(_0x4f0e01,_0x4c0407){return respondWithRpcPromise(_0x4e41('0x1d'),_[_0x4e41('0x14')](_0x4f0e01[_0x4e41('0x12')],_0x4f0e01['params']))[_0x4e41('0x5')](respondWithResult(_0x4c0407,null))[_0x4e41('0xa')](handleError(_0x4c0407,null));};exports[_0x4e41('0x1e')]=function(_0x48a246,_0x14c8f2){return respondWithRpcPromise(_0x4e41('0x1f'),_['merge'](_0x48a246[_0x4e41('0x12')],_0x48a246[_0x4e41('0x15')]))[_0x4e41('0x5')](respondWithResult(_0x14c8f2,null))[_0x4e41('0xa')](handleError(_0x14c8f2,null));};exports['outbound']=function(_0x310bbf,_0x258a62){return respondWithRpcPromise(_0x4e41('0x20'),_0x310bbf[_0x4e41('0x12')])[_0x4e41('0x5')](respondWithResult(_0x258a62,null))['catch'](handleError(_0x258a62,null));};exports['outboundChannels']=function(_0x32ed7e,_0x58c609){return respondWithRpcPromise(_0x4e41('0x21'),_0x32ed7e[_0x4e41('0x12')])[_0x4e41('0x5')](respondWithResult(_0x58c609,null))['catch'](handleError(_0x58c609,null));};exports[_0x4e41('0x22')]=function(_0x6017d3,_0x564e3c){var _0x409fed;return respondWithRpcPromise(_0x4e41('0x23'),_0x6017d3[_0x4e41('0x12')])[_0x4e41('0x5')](function(_0x4998da){_0x409fed=_0x4998da;return respondWithRpcPromise(_0x4e41('0x23'),_0x6017d3[_0x4e41('0x12')],routingClient);})[_0x4e41('0x5')](function(_0x1d08e0){return _['merge']({},_0x1d08e0,_0x409fed);})[_0x4e41('0x5')](respondWithResult(_0x564e3c,null))[_0x4e41('0xa')](handleError(_0x564e3c,null));};exports[_0x4e41('0x24')]=function(_0x4b44e3,_0x2dde4d){if(_0x4b44e3[_0x4e41('0x25')]&&_0x4b44e3[_0x4e41('0x25')][_0x4e41('0x26')]&&_0x4b44e3[_0x4e41('0x27')]&&_0x4b44e3[_0x4e41('0x27')][_0x4e41('0xe')]){for(var _0xc24fc8 in _0x4b44e3['body'][_0x4e41('0x26')]){if(_0x4b44e3[_0x4e41('0x25')]['interaction'][_0x4e41('0x28')](_0xc24fc8)){db[_0x4e41('0x29')][_0x4e41('0x2a')]({'where':{'channel':_0xc24fc8,'membername':_0x4b44e3['user'][_0x4e41('0xe')],'type':_0x4e41('0x2b'),'exitAt':null,'uniqueid':_0x4b44e3['body'][_0x4e41('0x26')][_0xc24fc8]&&_0x4b44e3[_0x4e41('0x25')][_0x4e41('0x26')][_0xc24fc8][_0x4e41('0x2c')]?{'$notIn':_0x4b44e3[_0x4e41('0x25')][_0x4e41('0x26')][_0xc24fc8]}:{'$ne':null}}})[_0x4e41('0x5')](function(_0x37a65c){var _0x30cd73=moment()[_0x4e41('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x375450=0x0,_0x43be32=_0x37a65c[_0x4e41('0x2c')];_0x375450<_0x43be32;_0x375450+=0x1){_0x37a65c[_0x375450][_0x4e41('0x2e')]({'exitAt':_0x30cd73});}});for(var _0x16cf6f=0x0;_0x16cf6f<_0x4b44e3['body'][_0x4e41('0x26')][_0xc24fc8][_0x4e41('0x2c')];_0x16cf6f+=0x1){db[_0x4e41('0x29')]['findOrCreate']({'where':{'channel':_0xc24fc8,'membername':_0x4b44e3[_0x4e41('0x27')][_0x4e41('0xe')],'type':_0x4e41('0x2b'),'uniqueid':_0x4b44e3['body'][_0x4e41('0x26')][_0xc24fc8][_0x16cf6f],'exitAt':null},'defaults':{'channel':_0xc24fc8,'membername':_0x4b44e3[_0x4e41('0x27')][_0x4e41('0xe')],'interface':_[_0x4e41('0x10')](_0x4b44e3[_0x4e41('0x27')][_0x4e41('0x2f')])?util[_0x4e41('0x2d')](_0x4e41('0x30'),_0x4b44e3[_0x4e41('0x27')][_0x4e41('0xe')]):_0x4b44e3['user'][_0x4e41('0x2f')],'type':_0x4e41('0x2b'),'enterAt':moment()['format'](_0x4e41('0x31')),'role':_0x4e41('0x32'),'internal':_0x4b44e3[_0x4e41('0x27')]['internal'],'uniqueid':_0x4b44e3[_0x4e41('0x25')][_0x4e41('0x26')][_0xc24fc8][_0x16cf6f]}});}}}}return respondWithRpcPromise(_0x4e41('0x33'),{'id':_0x4b44e3['params']['id'],'capacity':_0x4b44e3[_0x4e41('0x25')][_0x4e41('0x34')]},routingClient)[_0x4e41('0x5')](respondWithResult(_0x2dde4d,null))[_0x4e41('0xa')](handleError(_0x2dde4d,null));};exports[_0x4e41('0x35')]=function(_0x5627e0,_0x7fb750){return respondWithRpcPromise(_0x4e41('0x36'),_0x5627e0['query'])[_0x4e41('0x5')](respondWithResult(_0x7fb750,null))['catch'](handleError(_0x7fb750,null));};exports[_0x4e41('0x37')]=function(_0x23346c,_0x4a3e03){return respondWithRpcPromise(_0x4e41('0x38'),_0x23346c[_0x4e41('0x12')])[_0x4e41('0x5')](respondWithResult(_0x4a3e03,null))['catch'](handleError(_0x4a3e03,null));};exports[_0x4e41('0x39')]=function(_0x21844f,_0x2e0632){return respondWithRpcPromise(_0x4e41('0x3a'),_0x21844f[_0x4e41('0x12')])[_0x4e41('0x5')](respondWithResult(_0x2e0632,null))[_0x4e41('0xa')](handleError(_0x2e0632,null));};exports[_0x4e41('0x3b')]=function(_0xcd6a2e,_0x13f2b1){return respondWithRpcPromise(_0x4e41('0x3c'),_0xcd6a2e[_0x4e41('0x12')],routingClient)['then'](respondWithResult(_0x13f2b1,null))['catch'](handleError(_0x13f2b1,null));};exports[_0x4e41('0x3d')]=function(_0x511f59,_0x1b1269){return respondWithRpcPromise('ChatQueues',_0x511f59[_0x4e41('0x12')],routingClient)['then'](findById(_0x511f59['params']['id']))[_0x4e41('0x5')](respondWithResult(_0x1b1269,null))[_0x4e41('0xa')](handleError(_0x1b1269,null));};exports[_0x4e41('0x3e')]=function(_0x10382a,_0x42c5e5){return respondWithRpcPromise('MailQueues',_0x10382a[_0x4e41('0x12')],routingClient)['then'](respondWithResult(_0x42c5e5,null))[_0x4e41('0xa')](handleError(_0x42c5e5,null));};exports[_0x4e41('0x3f')]=function(_0x1f1ede,_0x101f4f){return respondWithRpcPromise('MailQueues',_0x1f1ede[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](findById(_0x1f1ede[_0x4e41('0x15')]['id']))['then'](respondWithResult(_0x101f4f,null))[_0x4e41('0xa')](handleError(_0x101f4f,null));};exports[_0x4e41('0x40')]=function(_0x433384,_0x410642){return respondWithRpcPromise(_0x4e41('0x41'),_0x433384['query'],mailClient)[_0x4e41('0x5')](respondWithResult(_0x410642,null))[_0x4e41('0xa')](handleError(_0x410642,null));};exports[_0x4e41('0x42')]=function(_0x42d9d2,_0x47e572){return respondWithRpcPromise(_0x4e41('0x43'),_0x42d9d2[_0x4e41('0x12')],routingClient)['then'](respondWithResult(_0x47e572,null))['catch'](handleError(_0x47e572,null));};exports[_0x4e41('0x44')]=function(_0x4aaace,_0x30b18f){return respondWithRpcPromise(_0x4e41('0x43'),_0x4aaace[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](findById(_0x4aaace[_0x4e41('0x15')]['id']))[_0x4e41('0x5')](respondWithResult(_0x30b18f,null))['catch'](handleError(_0x30b18f,null));};exports[_0x4e41('0x45')]=function(_0x62b652,_0x54165f){return respondWithRpcPromise(_0x4e41('0x46'),_0x62b652[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](respondWithResult(_0x54165f,null))[_0x4e41('0xa')](handleError(_0x54165f,null));};exports[_0x4e41('0x47')]=function(_0x35dd54,_0x1229ea){return respondWithRpcPromise(_0x4e41('0x46'),_0x35dd54[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](findById(_0x35dd54[_0x4e41('0x15')]['id']))[_0x4e41('0x5')](respondWithResult(_0x1229ea,null))['catch'](handleError(_0x1229ea,null));};exports[_0x4e41('0x48')]=function(_0x422725,_0x5159cc){return respondWithRpcPromise(_0x4e41('0x49'),_0x422725[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](respondWithResult(_0x5159cc,null))['catch'](handleError(_0x5159cc,null));};exports[_0x4e41('0x4a')]=function(_0x5a0e71,_0xc14068){return respondWithRpcPromise('FaxQueues',_0x5a0e71[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](findById(_0x5a0e71[_0x4e41('0x15')]['id']))['then'](respondWithResult(_0xc14068,null))['catch'](handleError(_0xc14068,null));};exports['faxAccounts']=function(_0x235989,_0x48dd8a){return respondWithRpcPromise('FaxAccounts',_0x235989[_0x4e41('0x12')])['then'](respondWithResult(_0x48dd8a,null))[_0x4e41('0xa')](handleError(_0x48dd8a,null));};exports[_0x4e41('0x4b')]=function(_0x2d9c8f,_0x2d6e5d){return respondWithRpcPromise(_0x4e41('0x4c'),_0x2d9c8f[_0x4e41('0x12')],routingClient)['then'](respondWithResult(_0x2d6e5d,null))[_0x4e41('0xa')](handleError(_0x2d6e5d,null));};exports['mailQueuesWaitingInteractions']=function(_0x329114,_0x18653a){return respondWithRpcPromise(_0x4e41('0x4d'),_0x329114[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](respondWithResult(_0x18653a,null))[_0x4e41('0xa')](handleError(_0x18653a,null));};exports[_0x4e41('0x4e')]=function(_0x312d47,_0x347c2b){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x312d47[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](respondWithResult(_0x347c2b,null))[_0x4e41('0xa')](handleError(_0x347c2b,null));};exports[_0x4e41('0x4f')]=function(_0x39eda1,_0x163923){return respondWithRpcPromise(_0x4e41('0x50'),_0x39eda1[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](respondWithResult(_0x163923,null))[_0x4e41('0xa')](handleError(_0x163923,null));};exports[_0x4e41('0x51')]=function(_0x18a4ae,_0x2a1aba){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x18a4ae[_0x4e41('0x12')],routingClient)[_0x4e41('0x5')](respondWithResult(_0x2a1aba,null))[_0x4e41('0xa')](handleError(_0x2a1aba,null));};exports['queueNotify']=function(_0x3a5e3a){return function(_0x3daaf5,_0x4a9ce0){var _0x5cb741,_0x54b51c;var _0x5c56fc=_[_0x4e41('0x52')](_0x3a5e3a);var _0x49055c=_0x3a5e3a==='chat'?'Website':_0x4e41('0x53');return db[_0x5c56fc+'Queue']['findOne']({'raw':!![],'where':{'id':_0x3daaf5['params']['id']}})[_0x4e41('0x5')](function(_0x1dc761){if(_[_0x4e41('0x10')](_0x1dc761)){throw new Error(_0x5c56fc+'\x20Queue\x20not\x20found');}_0x5cb741=_0x1dc761;return db[_0x5c56fc+_0x4e41('0x54')][_0x4e41('0x55')]({'where':{'id':_0x3daaf5['body'][_0x4e41('0x56')]},'include':[{'model':db[_0x5c56fc+_0x4e41('0x57')],'as':'Interaction'},{'model':db[_0x5c56fc+_0x49055c],'as':_0x4e41('0x53')}]});})[_0x4e41('0x5')](function(_0x8fbd77){if(_[_0x4e41('0x10')](_0x8fbd77)){throw new Error(_0x5c56fc+_0x4e41('0x58'));}_0x54b51c=_0x8fbd77;return _0x8fbd77[_0x4e41('0x59')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4e41('0x5')](function(){var _0x3f07bc={'uniqueid':_0x3a5e3a+'.'+_0x54b51c['id']+'.'+_0x54b51c[_0x4e41('0x57')]['id'],'FromUserId':_0x3daaf5[_0x4e41('0x27')]['id'],'type':_0x4e41('0x5a')};_0x3f07bc[_0x5c56fc+'MessageId']=_0x54b51c['id'];_0x3f07bc[_0x5c56fc+'InteractionId']=_0x54b51c['Interaction']['id'];_0x3f07bc[_0x4e41('0x5b')+_0x5c56fc+_0x49055c+'Id']=_0x54b51c[_0x4e41('0x53')]['id'];_0x3f07bc['To'+_0x5c56fc+_0x4e41('0x5c')]=_0x5cb741['id'];return db[_0x5c56fc+_0x4e41('0x5d')][_0x4e41('0x5e')](_0x3f07bc);})[_0x4e41('0x5')](function(){return respondWithRpcPromise(_0x4e41('0x5f'),{'channel':_0x3a5e3a,'interaction':_0x54b51c[_0x4e41('0x57')],'message':_0x54b51c,'account':_0x54b51c[_0x4e41('0x53')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4e41('0x5a'),'appdata':_0x5cb741[_0x4e41('0xe')]+','+(_0x54b51c[_0x4e41('0x53')]['queueTransferTimeout']||0x12c),'interval':_0x4e41('0x60')}]},routingClient);})[_0x4e41('0x5')](respondWithResult(_0x4a9ce0,null))[_0x4e41('0xa')](handleError(_0x4a9ce0,null));};};exports['agentNotify']=function(_0x2b18c6,_0x3df324){var _0x459c04,_0x353c83;if(_[_0x4e41('0x10')](_0x2b18c6[_0x4e41('0x25')][_0x4e41('0x61')])){throw new Error(_0x4e41('0x62'));}var _0x161326=_0x2b18c6['body']['channel'];var _0x4d9c71=_[_0x4e41('0x52')](_0x161326);var _0x3664b5=_0x161326===_0x4e41('0x63')?_0x4e41('0x64'):_0x4e41('0x53');return db[_0x4e41('0x65')][_0x4e41('0x55')]({'raw':!![],'where':{'id':_0x2b18c6[_0x4e41('0x15')]['id'],'role':'agent'}})[_0x4e41('0x5')](function(_0x30a88c){if(_[_0x4e41('0x10')](_0x30a88c)){throw new Error(_0x4e41('0x66'));}_0x459c04=_0x30a88c;return db[_0x4d9c71+_0x4e41('0x54')]['findOne']({'where':{'id':_0x2b18c6[_0x4e41('0x25')][_0x4e41('0x56')]},'include':[{'model':db[_0x4d9c71+_0x4e41('0x57')],'as':'Interaction'},{'model':db[_0x4d9c71+_0x3664b5],'as':_0x4e41('0x53')}]});})[_0x4e41('0x5')](function(_0x5c0514){if(_['isNil'](_0x5c0514)){throw new Error(_0x4d9c71+'\x20Message\x20not\x20found');}_0x353c83=_0x5c0514;return _0x5c0514[_0x4e41('0x59')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x44b249={'uniqueid':_0x161326+'.'+_0x353c83['id']+'.'+_0x353c83['Interaction']['id'],'FromUserId':_0x2b18c6[_0x4e41('0x27')]['id'],'type':'queue','ToUserId':_0x459c04['id']};_0x44b249[_0x4d9c71+_0x4e41('0x67')]=_0x353c83['id'];_0x44b249[_0x4d9c71+_0x4e41('0x68')]=_0x353c83[_0x4e41('0x57')]['id'];_0x44b249[_0x4e41('0x5b')+_0x4d9c71+_0x3664b5+'Id']=_0x353c83['Account']['id'];return db[_0x4d9c71+'TransferReport'][_0x4e41('0x5e')](_0x44b249);})[_0x4e41('0x5')](function(){return respondWithRpcPromise('Start',{'channel':_0x161326,'interaction':_0x353c83[_0x4e41('0x57')],'message':_0x353c83,'account':_0x353c83[_0x4e41('0x53')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4e41('0x32'),'appdata':_0x459c04['name']+','+(_0x353c83[_0x4e41('0x53')]['agentTransferTimeout']||0x12c),'interval':_0x4e41('0x60')}]},routingClient);})[_0x4e41('0x5')](respondWithResult(_0x3df324,null))['catch'](handleError(_0x3df324,null));};
\ No newline at end of file