Built motion from commit (unavailable).|2.3.4
[motion2.git] / server / api / rpc / rpc.controller.js
index 1ea789b..e895813 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f26=['Agent\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','stack','name','send','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','length','updateAttributes','INTERACTION','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','queueNotify','chat','Website','Account','Message','findOne','messageId','\x20Message\x20not\x20found','Interaction','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User'];(function(_0x268624,_0x3f1032){var _0x18faf4=function(_0x33cc11){while(--_0x33cc11){_0x268624['push'](_0x268624['shift']());}};_0x18faf4(++_0x3f1032);}(_0x9f26,0xe5));var _0x69f2=function(_0x4f7786,_0x4ffc01){_0x4f7786=_0x4f7786-0x0;var _0x42fbb9=_0x9f26[_0x4f7786];return _0x42fbb9;};'use strict';var BPromise=require(_0x69f2('0x0'));var moment=require(_0x69f2('0x1'));var _=require('lodash');var util=require(_0x69f2('0x2'));var db=require(_0x69f2('0x3'))['db'];var logger=require(_0x69f2('0x4'))(_0x69f2('0x5'));var jayson=require(_0x69f2('0x6'));var amiClient=jayson['client'][_0x69f2('0x7')]({'port':0x232a});var mailClient=jayson[_0x69f2('0x8')][_0x69f2('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0x69f2('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x295746,_0x9fb1bb,_0x396c3f){return new BPromise(function(_0x254633,_0x1f0837){var _0xac0fe8=_0x396c3f?_0x396c3f:amiClient;return _0xac0fe8[_0x69f2('0x9')](_0x295746,_0x9fb1bb)[_0x69f2('0xa')](function(_0x1df263){if(_0x1df263[_0x69f2('0xb')]){if(_0x1df263[_0x69f2('0xb')][_0x69f2('0xc')]===0x1f4){return _0x1f0837(_0x1df263[_0x69f2('0xb')][_0x69f2('0xd')]);}return _0x254633(_0x1df263['error'][_0x69f2('0xd')]);}else{_0x254633(_0x1df263[_0x69f2('0xe')]);}})[_0x69f2('0xf')](function(_0x3281ae){_0x1f0837(_0x3281ae);});});}function respondWithResult(_0x597e05,_0x235b21){_0x235b21=_0x235b21||0xc8;return function(_0x5978ef){if(_0x5978ef){return _0x597e05[_0x69f2('0x10')](_0x235b21)['json'](_0x5978ef);}return _0x597e05['sendStatus'](0x194);};}function handleError(_0x595fb5,_0x35bf26){_0x35bf26=_0x35bf26||0x1f4;return function(_0x25aeb9){logger[_0x69f2('0xb')](_0x25aeb9[_0x69f2('0x11')]);if(_0x25aeb9[_0x69f2('0x12')]){delete _0x25aeb9[_0x69f2('0x12')];}_0x595fb5[_0x69f2('0x10')](_0x35bf26)[_0x69f2('0x13')](_0x25aeb9);};}function findById(_0x6ac365){return function(_0x2a48f3){if(!_[_0x69f2('0x14')](_0x6ac365)&&!_['isNil'](_0x2a48f3)&&!_['isNil'](_0x2a48f3[_0x69f2('0x15')])){return _[_0x69f2('0x16')](_0x2a48f3['rows'],function(_0x1551df){return _0x1551df['id']==_0x6ac365;});}return null;};}exports['voiceChannels']=function(_0x5bf4e7,_0x4f6bf7){return respondWithRpcPromise(_0x69f2('0x17'),_0x5bf4e7[_0x69f2('0x18')])[_0x69f2('0xa')](respondWithResult(_0x4f6bf7,null))['catch'](handleError(_0x4f6bf7,null));};exports[_0x69f2('0x19')]=function(_0x8f92f3,_0x50ada1){return respondWithRpcPromise(_0x69f2('0x1a'),_['merge'](_0x8f92f3[_0x69f2('0x18')],_0x8f92f3[_0x69f2('0x1b')]))[_0x69f2('0xa')](respondWithResult(_0x50ada1,null))['catch'](handleError(_0x50ada1,null));};exports['voiceChannelStopMixMonitor']=function(_0x340d11,_0x2456ab){return respondWithRpcPromise(_0x69f2('0x1c'),_[_0x69f2('0x1d')](_0x340d11[_0x69f2('0x18')],_0x340d11['params']))['then'](respondWithResult(_0x2456ab,null))['catch'](handleError(_0x2456ab,null));};exports[_0x69f2('0x1e')]=function(_0x425467,_0x502a79){return respondWithRpcPromise(_0x69f2('0x1f'),_0x425467['query'])[_0x69f2('0xa')](respondWithResult(_0x502a79,null))[_0x69f2('0xf')](handleError(_0x502a79,null));};exports['showVoiceQueues']=function(_0x5aad8d,_0x13f916){return respondWithRpcPromise('VoiceQueues',_0x5aad8d[_0x69f2('0x18')])[_0x69f2('0xa')](findById(_0x5aad8d[_0x69f2('0x1b')]['id']))[_0x69f2('0xa')](respondWithResult(_0x13f916,null))[_0x69f2('0xf')](handleError(_0x13f916,null));};exports[_0x69f2('0x20')]=function(_0x3c0651,_0x29c46a){return respondWithRpcPromise(_0x69f2('0x21'),_['merge'](_0x3c0651[_0x69f2('0x18')],_0x3c0651['params']))[_0x69f2('0xa')](respondWithResult(_0x29c46a,null))[_0x69f2('0xf')](handleError(_0x29c46a,null));};exports['voiceQueuesChannels']=function(_0x4bb66c,_0x2cb443){return respondWithRpcPromise(_0x69f2('0x22'),_0x4bb66c[_0x69f2('0x18')])[_0x69f2('0xa')](respondWithResult(_0x2cb443,null))['catch'](handleError(_0x2cb443,null));};exports[_0x69f2('0x23')]=function(_0x118eb1,_0x29dbe2){return respondWithRpcPromise(_0x69f2('0x24'),_[_0x69f2('0x1d')](_0x118eb1['query'],_0x118eb1[_0x69f2('0x1b')]))[_0x69f2('0xa')](respondWithResult(_0x29dbe2,null))['catch'](handleError(_0x29dbe2,null));};exports[_0x69f2('0x25')]=function(_0x5ab0fd,_0x2fae25){return respondWithRpcPromise(_0x69f2('0x26'),_['merge'](_0x5ab0fd[_0x69f2('0x18')],_0x5ab0fd[_0x69f2('0x1b')]))[_0x69f2('0xa')](respondWithResult(_0x2fae25,null))[_0x69f2('0xf')](handleError(_0x2fae25,null));};exports[_0x69f2('0x27')]=function(_0x37c5a1,_0x1033ee){return respondWithRpcPromise(_0x69f2('0x28'),_['merge'](_0x37c5a1[_0x69f2('0x18')],_0x37c5a1[_0x69f2('0x1b')]))[_0x69f2('0xa')](respondWithResult(_0x1033ee,null))[_0x69f2('0xf')](handleError(_0x1033ee,null));};exports['outbound']=function(_0x4ecb2d,_0x440209){return respondWithRpcPromise(_0x69f2('0x29'),_0x4ecb2d[_0x69f2('0x18')])[_0x69f2('0xa')](respondWithResult(_0x440209,null))[_0x69f2('0xf')](handleError(_0x440209,null));};exports[_0x69f2('0x2a')]=function(_0x369201,_0x3df784){return respondWithRpcPromise(_0x69f2('0x2b'),_0x369201[_0x69f2('0x18')])[_0x69f2('0xa')](respondWithResult(_0x3df784,null))['catch'](handleError(_0x3df784,null));};exports[_0x69f2('0x2c')]=function(_0x1769ff,_0x12bf4d){var _0x13a6d7;return respondWithRpcPromise(_0x69f2('0x2d'),_0x1769ff[_0x69f2('0x18')])[_0x69f2('0xa')](function(_0x3f1df7){_0x13a6d7=_0x3f1df7;return respondWithRpcPromise(_0x69f2('0x2d'),_0x1769ff[_0x69f2('0x18')],routingClient);})[_0x69f2('0xa')](function(_0x254060){return _[_0x69f2('0x1d')]({},_0x254060,_0x13a6d7);})[_0x69f2('0xa')](respondWithResult(_0x12bf4d,null))['catch'](handleError(_0x12bf4d,null));};exports['agentCapacity']=function(_0x482cc2,_0xcd6905){if(_0x482cc2[_0x69f2('0x2e')]&&_0x482cc2[_0x69f2('0x2e')]['interaction']&&_0x482cc2[_0x69f2('0x2f')]&&_0x482cc2[_0x69f2('0x2f')][_0x69f2('0x12')]){for(var _0x4806d8 in _0x482cc2[_0x69f2('0x2e')][_0x69f2('0x30')]){if(_0x482cc2[_0x69f2('0x2e')]['interaction'][_0x69f2('0x31')](_0x4806d8)){db[_0x69f2('0x32')]['findAll']({'where':{'channel':_0x4806d8,'membername':_0x482cc2[_0x69f2('0x2f')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x482cc2[_0x69f2('0x2e')][_0x69f2('0x30')][_0x4806d8]&&_0x482cc2[_0x69f2('0x2e')][_0x69f2('0x30')][_0x4806d8][_0x69f2('0x33')]?{'$notIn':_0x482cc2[_0x69f2('0x2e')][_0x69f2('0x30')][_0x4806d8]}:{'$ne':null}}})[_0x69f2('0xa')](function(_0x57b630){var _0x4f3bd9=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x345b34=0x0,_0x512689=_0x57b630[_0x69f2('0x33')];_0x345b34<_0x512689;_0x345b34+=0x1){_0x57b630[_0x345b34][_0x69f2('0x34')]({'exitAt':_0x4f3bd9});}});for(var _0x23a30f=0x0;_0x23a30f<_0x482cc2[_0x69f2('0x2e')][_0x69f2('0x30')][_0x4806d8]['length'];_0x23a30f+=0x1){db[_0x69f2('0x32')]['findOrCreate']({'where':{'channel':_0x4806d8,'membername':_0x482cc2[_0x69f2('0x2f')][_0x69f2('0x12')],'type':_0x69f2('0x35'),'uniqueid':_0x482cc2[_0x69f2('0x2e')]['interaction'][_0x4806d8][_0x23a30f],'exitAt':null},'defaults':{'channel':_0x4806d8,'membername':_0x482cc2[_0x69f2('0x2f')][_0x69f2('0x12')],'interface':_[_0x69f2('0x14')](_0x482cc2[_0x69f2('0x2f')][_0x69f2('0x36')])?util[_0x69f2('0x37')]('SIP/%s',_0x482cc2[_0x69f2('0x2f')][_0x69f2('0x12')]):_0x482cc2[_0x69f2('0x2f')][_0x69f2('0x36')],'type':'INTERACTION','enterAt':moment()[_0x69f2('0x37')](_0x69f2('0x38')),'role':_0x69f2('0x39'),'internal':_0x482cc2[_0x69f2('0x2f')][_0x69f2('0x3a')],'uniqueid':_0x482cc2[_0x69f2('0x2e')]['interaction'][_0x4806d8][_0x23a30f]}});}}}}return respondWithRpcPromise(_0x69f2('0x3b'),{'id':_0x482cc2[_0x69f2('0x1b')]['id'],'capacity':_0x482cc2[_0x69f2('0x2e')][_0x69f2('0x3c')]},routingClient)[_0x69f2('0xa')](respondWithResult(_0xcd6905,null))['catch'](handleError(_0xcd6905,null));};exports[_0x69f2('0x3d')]=function(_0x17c36d,_0x1abb20){return respondWithRpcPromise('Telephones',_0x17c36d['query'])[_0x69f2('0xa')](respondWithResult(_0x1abb20,null))[_0x69f2('0xf')](handleError(_0x1abb20,null));};exports['trunks']=function(_0x458b71,_0x19c8eb){return respondWithRpcPromise(_0x69f2('0x3e'),_0x458b71[_0x69f2('0x18')])[_0x69f2('0xa')](respondWithResult(_0x19c8eb,null))['catch'](handleError(_0x19c8eb,null));};exports[_0x69f2('0x3f')]=function(_0x1552b8,_0x5c78d2){return respondWithRpcPromise('Campaigns',_0x1552b8['query'])[_0x69f2('0xa')](respondWithResult(_0x5c78d2,null))[_0x69f2('0xf')](handleError(_0x5c78d2,null));};exports[_0x69f2('0x40')]=function(_0x37dd2b,_0x26f5f9){return respondWithRpcPromise(_0x69f2('0x41'),_0x37dd2b[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](respondWithResult(_0x26f5f9,null))[_0x69f2('0xf')](handleError(_0x26f5f9,null));};exports[_0x69f2('0x42')]=function(_0xb68d0f,_0x389f18){return respondWithRpcPromise(_0x69f2('0x41'),_0xb68d0f[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](findById(_0xb68d0f[_0x69f2('0x1b')]['id']))[_0x69f2('0xa')](respondWithResult(_0x389f18,null))[_0x69f2('0xf')](handleError(_0x389f18,null));};exports['mailQueues']=function(_0x14b11a,_0x294115){return respondWithRpcPromise(_0x69f2('0x43'),_0x14b11a[_0x69f2('0x18')],routingClient)['then'](respondWithResult(_0x294115,null))['catch'](handleError(_0x294115,null));};exports[_0x69f2('0x44')]=function(_0x1e664d,_0x5b2361){return respondWithRpcPromise('MailQueues',_0x1e664d[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](findById(_0x1e664d[_0x69f2('0x1b')]['id']))[_0x69f2('0xa')](respondWithResult(_0x5b2361,null))[_0x69f2('0xf')](handleError(_0x5b2361,null));};exports[_0x69f2('0x45')]=function(_0x520340,_0x52d50d){return respondWithRpcPromise(_0x69f2('0x46'),_0x520340[_0x69f2('0x18')],mailClient)[_0x69f2('0xa')](respondWithResult(_0x52d50d,null))[_0x69f2('0xf')](handleError(_0x52d50d,null));};exports[_0x69f2('0x47')]=function(_0x18dfa4,_0x103009){return respondWithRpcPromise(_0x69f2('0x48'),_0x18dfa4[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](respondWithResult(_0x103009,null))[_0x69f2('0xf')](handleError(_0x103009,null));};exports[_0x69f2('0x49')]=function(_0x47fe55,_0x30dd77){return respondWithRpcPromise(_0x69f2('0x48'),_0x47fe55['query'],routingClient)[_0x69f2('0xa')](findById(_0x47fe55[_0x69f2('0x1b')]['id']))[_0x69f2('0xa')](respondWithResult(_0x30dd77,null))['catch'](handleError(_0x30dd77,null));};exports[_0x69f2('0x4a')]=function(_0x20318f,_0x5ce8ae){return respondWithRpcPromise(_0x69f2('0x4b'),_0x20318f[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](respondWithResult(_0x5ce8ae,null))[_0x69f2('0xf')](handleError(_0x5ce8ae,null));};exports[_0x69f2('0x4c')]=function(_0x361b33,_0x52d75d){return respondWithRpcPromise(_0x69f2('0x4b'),_0x361b33['query'],routingClient)[_0x69f2('0xa')](findById(_0x361b33[_0x69f2('0x1b')]['id']))['then'](respondWithResult(_0x52d75d,null))['catch'](handleError(_0x52d75d,null));};exports[_0x69f2('0x4d')]=function(_0x3221f3,_0x28fdc9){return respondWithRpcPromise(_0x69f2('0x4e'),_0x3221f3[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](respondWithResult(_0x28fdc9,null))['catch'](handleError(_0x28fdc9,null));};exports[_0x69f2('0x4f')]=function(_0x8e88cd,_0x5ed715){return respondWithRpcPromise(_0x69f2('0x4e'),_0x8e88cd[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](findById(_0x8e88cd[_0x69f2('0x1b')]['id']))[_0x69f2('0xa')](respondWithResult(_0x5ed715,null))['catch'](handleError(_0x5ed715,null));};exports[_0x69f2('0x50')]=function(_0x55b259,_0x1071d3){return respondWithRpcPromise(_0x69f2('0x51'),_0x55b259[_0x69f2('0x18')])[_0x69f2('0xa')](respondWithResult(_0x1071d3,null))[_0x69f2('0xf')](handleError(_0x1071d3,null));};exports[_0x69f2('0x52')]=function(_0x594ee8,_0x19e0bf){return respondWithRpcPromise(_0x69f2('0x53'),_0x594ee8[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](respondWithResult(_0x19e0bf,null))[_0x69f2('0xf')](handleError(_0x19e0bf,null));};exports[_0x69f2('0x54')]=function(_0xea9ec9,_0x481dd0){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0xea9ec9[_0x69f2('0x18')],routingClient)[_0x69f2('0xa')](respondWithResult(_0x481dd0,null))['catch'](handleError(_0x481dd0,null));};exports[_0x69f2('0x55')]=function(_0x3a8e37,_0x13db20){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3a8e37[_0x69f2('0x18')],routingClient)['then'](respondWithResult(_0x13db20,null))[_0x69f2('0xf')](handleError(_0x13db20,null));};exports[_0x69f2('0x56')]=function(_0x1fd509,_0x1d5e50){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1fd509['query'],routingClient)['then'](respondWithResult(_0x1d5e50,null))[_0x69f2('0xf')](handleError(_0x1d5e50,null));};exports['faxQueuesWaitingInteractions']=function(_0x35b8ef,_0x15fbd3){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x35b8ef['query'],routingClient)['then'](respondWithResult(_0x15fbd3,null))['catch'](handleError(_0x15fbd3,null));};exports[_0x69f2('0x57')]=function(_0x926f){return function(_0x599c1d,_0x297068){var _0x57a2b0,_0xd1ee6;var _0x491b73=_['capitalize'](_0x926f);var _0x387007=_0x926f===_0x69f2('0x58')?_0x69f2('0x59'):_0x69f2('0x5a');return db[_0x491b73+'Queue']['findOne']({'raw':!![],'where':{'id':_0x599c1d[_0x69f2('0x1b')]['id']}})[_0x69f2('0xa')](function(_0x17f892){if(_[_0x69f2('0x14')](_0x17f892)){throw new Error(_0x491b73+'\x20Queue\x20not\x20found');}_0x57a2b0=_0x17f892;return db[_0x491b73+_0x69f2('0x5b')][_0x69f2('0x5c')]({'where':{'id':_0x599c1d['body'][_0x69f2('0x5d')]},'include':[{'model':db[_0x491b73+'Interaction'],'as':'Interaction'},{'model':db[_0x491b73+_0x387007],'as':'Account'}]});})['then'](function(_0x19008b){if(_[_0x69f2('0x14')](_0x19008b)){throw new Error(_0x491b73+_0x69f2('0x5e'));}_0xd1ee6=_0x19008b;return _0x19008b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x69f2('0xa')](function(){var _0x137668={'uniqueid':_0x926f+'.'+_0xd1ee6['id']+'.'+_0xd1ee6[_0x69f2('0x5f')]['id'],'FromUserId':_0x599c1d[_0x69f2('0x2f')]['id'],'type':'queue'};_0x137668[_0x491b73+'MessageId']=_0xd1ee6['id'];_0x137668[_0x491b73+_0x69f2('0x60')]=_0xd1ee6[_0x69f2('0x5f')]['id'];_0x137668[_0x69f2('0x61')+_0x491b73+_0x387007+'Id']=_0xd1ee6[_0x69f2('0x5a')]['id'];_0x137668['To'+_0x491b73+_0x69f2('0x62')]=_0x57a2b0['id'];return db[_0x491b73+_0x69f2('0x63')][_0x69f2('0x64')](_0x137668);})[_0x69f2('0xa')](function(){return respondWithRpcPromise(_0x69f2('0x65'),{'channel':_0x926f,'interaction':_0xd1ee6[_0x69f2('0x5f')],'message':_0xd1ee6,'account':_0xd1ee6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x69f2('0x66'),'appdata':_0x57a2b0[_0x69f2('0x12')]+','+(_0xd1ee6[_0x69f2('0x5a')][_0x69f2('0x67')]||0x12c),'interval':_0x69f2('0x68')}]},routingClient);})[_0x69f2('0xa')](respondWithResult(_0x297068,null))[_0x69f2('0xf')](handleError(_0x297068,null));};};exports[_0x69f2('0x69')]=function(_0x246da3,_0x378d05){var _0x7611c2,_0x127975;if(_['isNil'](_0x246da3['body'][_0x69f2('0x6a')])){throw new Error(_0x69f2('0x6b'));}var _0x2e25f7=_0x246da3['body'][_0x69f2('0x6a')];var _0x327ed7=_[_0x69f2('0x6c')](_0x2e25f7);var _0x3fde45=_0x2e25f7===_0x69f2('0x58')?_0x69f2('0x59'):_0x69f2('0x5a');return db[_0x69f2('0x6d')][_0x69f2('0x5c')]({'raw':!![],'where':{'id':_0x246da3[_0x69f2('0x1b')]['id'],'role':_0x69f2('0x39')}})['then'](function(_0x3c4d36){if(_[_0x69f2('0x14')](_0x3c4d36)){throw new Error(_0x69f2('0x6e'));}_0x7611c2=_0x3c4d36;return db[_0x327ed7+_0x69f2('0x5b')][_0x69f2('0x5c')]({'where':{'id':_0x246da3['body'][_0x69f2('0x5d')]},'include':[{'model':db[_0x327ed7+_0x69f2('0x5f')],'as':'Interaction'},{'model':db[_0x327ed7+_0x3fde45],'as':_0x69f2('0x5a')}]});})[_0x69f2('0xa')](function(_0x1f2e8d){if(_[_0x69f2('0x14')](_0x1f2e8d)){throw new Error(_0x327ed7+'\x20Message\x20not\x20found');}_0x127975=_0x1f2e8d;return _0x1f2e8d['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x69f2('0xa')](function(){var _0x55ba6b={'uniqueid':_0x2e25f7+'.'+_0x127975['id']+'.'+_0x127975[_0x69f2('0x5f')]['id'],'FromUserId':_0x246da3[_0x69f2('0x2f')]['id'],'type':_0x69f2('0x66'),'ToUserId':_0x7611c2['id']};_0x55ba6b[_0x327ed7+_0x69f2('0x6f')]=_0x127975['id'];_0x55ba6b[_0x327ed7+_0x69f2('0x60')]=_0x127975['Interaction']['id'];_0x55ba6b[_0x69f2('0x61')+_0x327ed7+_0x3fde45+'Id']=_0x127975[_0x69f2('0x5a')]['id'];return db[_0x327ed7+'TransferReport'][_0x69f2('0x64')](_0x55ba6b);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x2e25f7,'interaction':_0x127975[_0x69f2('0x5f')],'message':_0x127975,'account':_0x127975[_0x69f2('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x69f2('0x39'),'appdata':_0x7611c2[_0x69f2('0x12')]+','+(_0x127975['Account'][_0x69f2('0x70')]||0x12c),'interval':_0x69f2('0x68')}]},routingClient);})['then'](respondWithResult(_0x378d05,null))[_0x69f2('0xf')](handleError(_0x378d05,null));};
\ No newline at end of file
+var _0x18a7=['\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','lodash','util','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','stack','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','params','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','Account'];(function(_0x437a21,_0x3bcbd6){var _0x490f61=function(_0x57f395){while(--_0x57f395){_0x437a21['push'](_0x437a21['shift']());}};_0x490f61(++_0x3bcbd6);}(_0x18a7,0x104));var _0x718a=function(_0x204cd8,_0x16d4f1){_0x204cd8=_0x204cd8-0x0;var _0x2f6fca=_0x18a7[_0x204cd8];return _0x2f6fca;};'use strict';var BPromise=require(_0x718a('0x0'));var moment=require('moment');var _=require(_0x718a('0x1'));var util=require(_0x718a('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x718a('0x3'))('api');var jayson=require(_0x718a('0x4'));var amiClient=jayson[_0x718a('0x5')][_0x718a('0x6')]({'port':0x232a});var mailClient=jayson[_0x718a('0x5')][_0x718a('0x6')]({'port':0x232b});var routingClient=jayson[_0x718a('0x5')][_0x718a('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x2d16a3,_0x228050,_0x1e1c60){return new BPromise(function(_0x7f131,_0x11c57c){var _0x1615ae=_0x1e1c60?_0x1e1c60:amiClient;return _0x1615ae[_0x718a('0x7')](_0x2d16a3,_0x228050)[_0x718a('0x8')](function(_0x25a06d){if(_0x25a06d['error']){if(_0x25a06d[_0x718a('0x9')]['code']===0x1f4){return _0x11c57c(_0x25a06d[_0x718a('0x9')][_0x718a('0xa')]);}return _0x7f131(_0x25a06d[_0x718a('0x9')][_0x718a('0xa')]);}else{_0x7f131(_0x25a06d[_0x718a('0xb')]);}})[_0x718a('0xc')](function(_0x45e658){_0x11c57c(_0x45e658);});});}function respondWithResult(_0x113dd4,_0x27a4e9){_0x27a4e9=_0x27a4e9||0xc8;return function(_0x5a6102){if(_0x5a6102){return _0x113dd4[_0x718a('0xd')](_0x27a4e9)[_0x718a('0xe')](_0x5a6102);}return _0x113dd4[_0x718a('0xf')](0x194);};}function handleError(_0x3663e1,_0x930de1){_0x930de1=_0x930de1||0x1f4;return function(_0x1cec4b){logger[_0x718a('0x9')](_0x1cec4b[_0x718a('0x10')]);if(_0x1cec4b['name']){delete _0x1cec4b['name'];}_0x3663e1[_0x718a('0xd')](_0x930de1)[_0x718a('0x11')](_0x1cec4b);};}function findById(_0x461701){return function(_0x1da22c){if(!_[_0x718a('0x12')](_0x461701)&&!_[_0x718a('0x12')](_0x1da22c)&&!_[_0x718a('0x12')](_0x1da22c[_0x718a('0x13')])){return _['find'](_0x1da22c[_0x718a('0x13')],function(_0x302b79){return _0x302b79['id']==_0x461701;});}return null;};}exports[_0x718a('0x14')]=function(_0x513bf1,_0x12b0f2){return respondWithRpcPromise(_0x718a('0x15'),_0x513bf1[_0x718a('0x16')])[_0x718a('0x8')](respondWithResult(_0x12b0f2,null))[_0x718a('0xc')](handleError(_0x12b0f2,null));};exports[_0x718a('0x17')]=function(_0x5ec6a8,_0x5d4007){return respondWithRpcPromise(_0x718a('0x18'),_[_0x718a('0x19')](_0x5ec6a8[_0x718a('0x16')],_0x5ec6a8['params']))[_0x718a('0x8')](respondWithResult(_0x5d4007,null))[_0x718a('0xc')](handleError(_0x5d4007,null));};exports[_0x718a('0x1a')]=function(_0x38d5ac,_0x3396ce){return respondWithRpcPromise(_0x718a('0x1b'),_[_0x718a('0x19')](_0x38d5ac['query'],_0x38d5ac['params']))[_0x718a('0x8')](respondWithResult(_0x3396ce,null))['catch'](handleError(_0x3396ce,null));};exports[_0x718a('0x1c')]=function(_0x3daafe,_0x1f393b){return respondWithRpcPromise(_0x718a('0x1d'),_0x3daafe[_0x718a('0x16')])['then'](respondWithResult(_0x1f393b,null))['catch'](handleError(_0x1f393b,null));};exports[_0x718a('0x1e')]=function(_0x1d225d,_0xc523e4){return respondWithRpcPromise('VoiceQueues',_0x1d225d[_0x718a('0x16')])[_0x718a('0x8')](findById(_0x1d225d['params']['id']))['then'](respondWithResult(_0xc523e4,null))[_0x718a('0xc')](handleError(_0xc523e4,null));};exports[_0x718a('0x1f')]=function(_0x2c73c5,_0x4bc6dc){return respondWithRpcPromise(_0x718a('0x20'),_[_0x718a('0x19')](_0x2c73c5['query'],_0x2c73c5['params']))[_0x718a('0x8')](respondWithResult(_0x4bc6dc,null))[_0x718a('0xc')](handleError(_0x4bc6dc,null));};exports[_0x718a('0x21')]=function(_0x309c6e,_0x46c128){return respondWithRpcPromise(_0x718a('0x22'),_0x309c6e[_0x718a('0x16')])[_0x718a('0x8')](respondWithResult(_0x46c128,null))[_0x718a('0xc')](handleError(_0x46c128,null));};exports[_0x718a('0x23')]=function(_0x517141,_0x4c6591){return respondWithRpcPromise(_0x718a('0x24'),_[_0x718a('0x19')](_0x517141[_0x718a('0x16')],_0x517141[_0x718a('0x25')]))[_0x718a('0x8')](respondWithResult(_0x4c6591,null))[_0x718a('0xc')](handleError(_0x4c6591,null));};exports['voiceQueuesChannelHangup']=function(_0x1801cd,_0x4e186f){return respondWithRpcPromise(_0x718a('0x26'),_['merge'](_0x1801cd[_0x718a('0x16')],_0x1801cd[_0x718a('0x25')]))['then'](respondWithResult(_0x4e186f,null))[_0x718a('0xc')](handleError(_0x4e186f,null));};exports[_0x718a('0x27')]=function(_0x35ab48,_0x8e07b5){return respondWithRpcPromise(_0x718a('0x28'),_['merge'](_0x35ab48[_0x718a('0x16')],_0x35ab48[_0x718a('0x25')]))[_0x718a('0x8')](respondWithResult(_0x8e07b5,null))['catch'](handleError(_0x8e07b5,null));};exports[_0x718a('0x29')]=function(_0x54e929,_0x2de879){return respondWithRpcPromise(_0x718a('0x2a'),_0x54e929['query'])[_0x718a('0x8')](respondWithResult(_0x2de879,null))['catch'](handleError(_0x2de879,null));};exports['outboundChannels']=function(_0x12e0c8,_0x2009c0){return respondWithRpcPromise(_0x718a('0x2b'),_0x12e0c8['query'])[_0x718a('0x8')](respondWithResult(_0x2009c0,null))['catch'](handleError(_0x2009c0,null));};exports[_0x718a('0x2c')]=function(_0xf0e6d7,_0x39c790){var _0x5c4350;return respondWithRpcPromise('Agents',_0xf0e6d7['query'])[_0x718a('0x8')](function(_0x4232ad){_0x5c4350=_0x4232ad;return respondWithRpcPromise(_0x718a('0x2d'),_0xf0e6d7['query'],routingClient);})['then'](function(_0x9766fa){return _[_0x718a('0x19')]({},_0x9766fa,_0x5c4350);})[_0x718a('0x8')](respondWithResult(_0x39c790,null))['catch'](handleError(_0x39c790,null));};exports[_0x718a('0x2e')]=function(_0x465678,_0x278bf9){if(_0x465678['body']&&_0x465678[_0x718a('0x2f')][_0x718a('0x30')]&&_0x465678[_0x718a('0x31')]&&_0x465678[_0x718a('0x31')][_0x718a('0x32')]){for(var _0x57a926 in _0x465678[_0x718a('0x2f')]['interaction']){if(_0x465678[_0x718a('0x2f')][_0x718a('0x30')][_0x718a('0x33')](_0x57a926)){db[_0x718a('0x34')][_0x718a('0x35')]({'where':{'channel':_0x57a926,'membername':_0x465678[_0x718a('0x31')][_0x718a('0x32')],'type':_0x718a('0x36'),'exitAt':null,'uniqueid':_0x465678['body'][_0x718a('0x30')][_0x57a926]&&_0x465678[_0x718a('0x2f')]['interaction'][_0x57a926][_0x718a('0x37')]?{'$notIn':_0x465678['body'][_0x718a('0x30')][_0x57a926]}:{'$ne':null}}})[_0x718a('0x8')](function(_0x542ece){var _0x125b16=moment()[_0x718a('0x38')](_0x718a('0x39'));for(var _0x54ef50=0x0,_0x4720f7=_0x542ece['length'];_0x54ef50<_0x4720f7;_0x54ef50+=0x1){_0x542ece[_0x54ef50][_0x718a('0x3a')]({'exitAt':_0x125b16});}});for(var _0x3249fe=0x0;_0x3249fe<_0x465678[_0x718a('0x2f')][_0x718a('0x30')][_0x57a926]['length'];_0x3249fe+=0x1){db[_0x718a('0x34')][_0x718a('0x3b')]({'where':{'channel':_0x57a926,'membername':_0x465678[_0x718a('0x31')][_0x718a('0x32')],'type':_0x718a('0x36'),'uniqueid':_0x465678[_0x718a('0x2f')]['interaction'][_0x57a926][_0x3249fe],'exitAt':null},'defaults':{'channel':_0x57a926,'membername':_0x465678[_0x718a('0x31')][_0x718a('0x32')],'interface':_[_0x718a('0x12')](_0x465678[_0x718a('0x31')][_0x718a('0x3c')])?util[_0x718a('0x38')](_0x718a('0x3d'),_0x465678['user'][_0x718a('0x32')]):_0x465678['user'][_0x718a('0x3c')],'type':_0x718a('0x36'),'enterAt':moment()[_0x718a('0x38')](_0x718a('0x39')),'role':_0x718a('0x3e'),'internal':_0x465678[_0x718a('0x31')][_0x718a('0x3f')],'uniqueid':_0x465678[_0x718a('0x2f')][_0x718a('0x30')][_0x57a926][_0x3249fe]}});}}}}return respondWithRpcPromise(_0x718a('0x40'),{'id':_0x465678[_0x718a('0x25')]['id'],'capacity':_0x465678[_0x718a('0x2f')][_0x718a('0x41')]},routingClient)[_0x718a('0x8')](respondWithResult(_0x278bf9,null))['catch'](handleError(_0x278bf9,null));};exports[_0x718a('0x42')]=function(_0x9509bb,_0x2c6a62){return respondWithRpcPromise(_0x718a('0x43'),_0x9509bb[_0x718a('0x16')])['then'](respondWithResult(_0x2c6a62,null))[_0x718a('0xc')](handleError(_0x2c6a62,null));};exports[_0x718a('0x44')]=function(_0x42de39,_0x3e05a6){return respondWithRpcPromise(_0x718a('0x45'),_0x42de39[_0x718a('0x16')])[_0x718a('0x8')](respondWithResult(_0x3e05a6,null))[_0x718a('0xc')](handleError(_0x3e05a6,null));};exports[_0x718a('0x46')]=function(_0x2f48e0,_0x41466e){return respondWithRpcPromise('Campaigns',_0x2f48e0[_0x718a('0x16')])['then'](respondWithResult(_0x41466e,null))[_0x718a('0xc')](handleError(_0x41466e,null));};exports[_0x718a('0x47')]=function(_0x2eff85,_0x51012e){return respondWithRpcPromise(_0x718a('0x48'),_0x2eff85[_0x718a('0x16')],routingClient)[_0x718a('0x8')](respondWithResult(_0x51012e,null))[_0x718a('0xc')](handleError(_0x51012e,null));};exports['showChatQueues']=function(_0x1d601b,_0x41ca60){return respondWithRpcPromise(_0x718a('0x48'),_0x1d601b[_0x718a('0x16')],routingClient)[_0x718a('0x8')](findById(_0x1d601b[_0x718a('0x25')]['id']))[_0x718a('0x8')](respondWithResult(_0x41ca60,null))['catch'](handleError(_0x41ca60,null));};exports[_0x718a('0x49')]=function(_0x1f20be,_0x2b4354){return respondWithRpcPromise('MailQueues',_0x1f20be[_0x718a('0x16')],routingClient)[_0x718a('0x8')](respondWithResult(_0x2b4354,null))[_0x718a('0xc')](handleError(_0x2b4354,null));};exports[_0x718a('0x4a')]=function(_0xf39daf,_0x310bbe){return respondWithRpcPromise(_0x718a('0x4b'),_0xf39daf[_0x718a('0x16')],routingClient)['then'](findById(_0xf39daf[_0x718a('0x25')]['id']))[_0x718a('0x8')](respondWithResult(_0x310bbe,null))['catch'](handleError(_0x310bbe,null));};exports[_0x718a('0x4c')]=function(_0x35780e,_0x4512ef){return respondWithRpcPromise(_0x718a('0x4d'),_0x35780e[_0x718a('0x16')],mailClient)['then'](respondWithResult(_0x4512ef,null))['catch'](handleError(_0x4512ef,null));};exports[_0x718a('0x4e')]=function(_0x38d0e0,_0x433920){return respondWithRpcPromise('OpenchannelQueues',_0x38d0e0[_0x718a('0x16')],routingClient)['then'](respondWithResult(_0x433920,null))[_0x718a('0xc')](handleError(_0x433920,null));};exports[_0x718a('0x4f')]=function(_0x3b058a,_0x1abfde){return respondWithRpcPromise('OpenchannelQueues',_0x3b058a[_0x718a('0x16')],routingClient)[_0x718a('0x8')](findById(_0x3b058a[_0x718a('0x25')]['id']))['then'](respondWithResult(_0x1abfde,null))[_0x718a('0xc')](handleError(_0x1abfde,null));};exports[_0x718a('0x50')]=function(_0x25be75,_0x49ca3e){return respondWithRpcPromise(_0x718a('0x51'),_0x25be75[_0x718a('0x16')],routingClient)['then'](respondWithResult(_0x49ca3e,null))[_0x718a('0xc')](handleError(_0x49ca3e,null));};exports[_0x718a('0x52')]=function(_0x2e582b,_0x300ca0){return respondWithRpcPromise(_0x718a('0x51'),_0x2e582b[_0x718a('0x16')],routingClient)[_0x718a('0x8')](findById(_0x2e582b[_0x718a('0x25')]['id']))[_0x718a('0x8')](respondWithResult(_0x300ca0,null))[_0x718a('0xc')](handleError(_0x300ca0,null));};exports[_0x718a('0x53')]=function(_0x5e6a1e,_0x107c30){return respondWithRpcPromise(_0x718a('0x54'),_0x5e6a1e[_0x718a('0x16')],routingClient)[_0x718a('0x8')](respondWithResult(_0x107c30,null))['catch'](handleError(_0x107c30,null));};exports['showFaxQueues']=function(_0x355f2b,_0x4eabae){return respondWithRpcPromise('FaxQueues',_0x355f2b[_0x718a('0x16')],routingClient)[_0x718a('0x8')](findById(_0x355f2b[_0x718a('0x25')]['id']))[_0x718a('0x8')](respondWithResult(_0x4eabae,null))['catch'](handleError(_0x4eabae,null));};exports[_0x718a('0x55')]=function(_0x153c25,_0x587c96){return respondWithRpcPromise(_0x718a('0x56'),_0x153c25['query'])[_0x718a('0x8')](respondWithResult(_0x587c96,null))['catch'](handleError(_0x587c96,null));};exports['chatQueuesWaitingInteractions']=function(_0x48a425,_0xfcd6ef){return respondWithRpcPromise(_0x718a('0x57'),_0x48a425[_0x718a('0x16')],routingClient)[_0x718a('0x8')](respondWithResult(_0xfcd6ef,null))[_0x718a('0xc')](handleError(_0xfcd6ef,null));};exports['mailQueuesWaitingInteractions']=function(_0x3fb901,_0x38c95e){return respondWithRpcPromise(_0x718a('0x58'),_0x3fb901[_0x718a('0x16')],routingClient)[_0x718a('0x8')](respondWithResult(_0x38c95e,null))[_0x718a('0xc')](handleError(_0x38c95e,null));};exports[_0x718a('0x59')]=function(_0x5f0991,_0x5d98cd){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5f0991[_0x718a('0x16')],routingClient)[_0x718a('0x8')](respondWithResult(_0x5d98cd,null))['catch'](handleError(_0x5d98cd,null));};exports[_0x718a('0x5a')]=function(_0x57f24b,_0x1201ea){return respondWithRpcPromise(_0x718a('0x5b'),_0x57f24b[_0x718a('0x16')],routingClient)[_0x718a('0x8')](respondWithResult(_0x1201ea,null))[_0x718a('0xc')](handleError(_0x1201ea,null));};exports[_0x718a('0x5c')]=function(_0x14e0e8,_0x32619d){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x14e0e8[_0x718a('0x16')],routingClient)['then'](respondWithResult(_0x32619d,null))['catch'](handleError(_0x32619d,null));};exports['queueNotify']=function(_0xa38ad0){return function(_0x4d4a82,_0x1f15d2){var _0x18284f,_0x43fe2d;var _0x309c80=_['capitalize'](_0xa38ad0);var _0x3ce240=_0xa38ad0==='chat'?_0x718a('0x5d'):'Account';return db[_0x309c80+_0x718a('0x5e')]['findOne']({'raw':!![],'where':{'id':_0x4d4a82[_0x718a('0x25')]['id']}})[_0x718a('0x8')](function(_0x4eea84){if(_[_0x718a('0x12')](_0x4eea84)){throw new Error(_0x309c80+_0x718a('0x5f'));}_0x18284f=_0x4eea84;return db[_0x309c80+'Message'][_0x718a('0x60')]({'where':{'id':_0x4d4a82['body'][_0x718a('0x61')]},'include':[{'model':db[_0x309c80+_0x718a('0x62')],'as':_0x718a('0x62')},{'model':db[_0x309c80+_0x3ce240],'as':_0x718a('0x63')}]});})[_0x718a('0x8')](function(_0x4ab3aa){if(_[_0x718a('0x12')](_0x4ab3aa)){throw new Error(_0x309c80+_0x718a('0x64'));}_0x43fe2d=_0x4ab3aa;return _0x4ab3aa[_0x718a('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0x718a('0x8')](function(){var _0x25c27b={'uniqueid':_0xa38ad0+'.'+_0x43fe2d['id']+'.'+_0x43fe2d['Interaction']['id'],'FromUserId':_0x4d4a82['user']['id'],'type':'queue'};_0x25c27b[_0x309c80+_0x718a('0x66')]=_0x43fe2d['id'];_0x25c27b[_0x309c80+_0x718a('0x67')]=_0x43fe2d['Interaction']['id'];_0x25c27b[_0x718a('0x68')+_0x309c80+_0x3ce240+'Id']=_0x43fe2d[_0x718a('0x63')]['id'];_0x25c27b['To'+_0x309c80+_0x718a('0x69')]=_0x18284f['id'];return db[_0x309c80+_0x718a('0x6a')][_0x718a('0x6b')](_0x25c27b);})[_0x718a('0x8')](function(){return respondWithRpcPromise(_0x718a('0x6c'),{'channel':_0xa38ad0,'interaction':_0x43fe2d[_0x718a('0x62')],'message':_0x43fe2d,'account':_0x43fe2d[_0x718a('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x718a('0x6d'),'appdata':_0x18284f[_0x718a('0x32')]+','+(_0x43fe2d[_0x718a('0x63')][_0x718a('0x6e')]||0x12c),'interval':_0x718a('0x6f')}]},routingClient);})[_0x718a('0x8')](respondWithResult(_0x1f15d2,null))['catch'](handleError(_0x1f15d2,null));};};exports[_0x718a('0x70')]=function(_0x5599f2,_0x5a2856){var _0x242b4e,_0x18c579;if(_[_0x718a('0x12')](_0x5599f2[_0x718a('0x2f')][_0x718a('0x71')])){throw new Error(_0x718a('0x72'));}var _0x725f0c=_0x5599f2[_0x718a('0x2f')][_0x718a('0x71')];var _0x391d73=_[_0x718a('0x73')](_0x725f0c);var _0x35d477=_0x725f0c===_0x718a('0x74')?_0x718a('0x5d'):_0x718a('0x63');return db['User'][_0x718a('0x60')]({'raw':!![],'where':{'id':_0x5599f2[_0x718a('0x25')]['id'],'role':_0x718a('0x3e')}})[_0x718a('0x8')](function(_0xc79ea5){if(_[_0x718a('0x12')](_0xc79ea5)){throw new Error(_0x718a('0x75'));}_0x242b4e=_0xc79ea5;return db[_0x391d73+_0x718a('0x76')]['findOne']({'where':{'id':_0x5599f2[_0x718a('0x2f')]['messageId']},'include':[{'model':db[_0x391d73+_0x718a('0x62')],'as':_0x718a('0x62')},{'model':db[_0x391d73+_0x35d477],'as':_0x718a('0x63')}]});})[_0x718a('0x8')](function(_0x15a014){if(_['isNil'](_0x15a014)){throw new Error(_0x391d73+_0x718a('0x64'));}_0x18c579=_0x15a014;return _0x15a014[_0x718a('0x65')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x138c03={'uniqueid':_0x725f0c+'.'+_0x18c579['id']+'.'+_0x18c579[_0x718a('0x62')]['id'],'FromUserId':_0x5599f2['user']['id'],'type':_0x718a('0x6d'),'ToUserId':_0x242b4e['id']};_0x138c03[_0x391d73+_0x718a('0x66')]=_0x18c579['id'];_0x138c03[_0x391d73+_0x718a('0x67')]=_0x18c579[_0x718a('0x62')]['id'];_0x138c03['From'+_0x391d73+_0x35d477+'Id']=_0x18c579['Account']['id'];return db[_0x391d73+_0x718a('0x6a')]['create'](_0x138c03);})[_0x718a('0x8')](function(){return respondWithRpcPromise(_0x718a('0x6c'),{'channel':_0x725f0c,'interaction':_0x18c579[_0x718a('0x62')],'message':_0x18c579,'account':_0x18c579[_0x718a('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x718a('0x3e'),'appdata':_0x242b4e[_0x718a('0x32')]+','+(_0x18c579[_0x718a('0x63')][_0x718a('0x77')]||0x12c),'interval':_0x718a('0x6f')}]},routingClient);})[_0x718a('0x8')](respondWithResult(_0x5a2856,null))[_0x718a('0xc')](handleError(_0x5a2856,null));};
\ No newline at end of file