Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / rpc / rpc.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x000a=['showSmsQueues','FaxQueues','faxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','TransferReport','channel','capitalize','User','Agent\x20not\x20found','Message','update','create','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','interface','format','INTERACTION','agent','internal','capacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x7e06a8,_0x5ccb8c){var _0x2487a6=function(_0x27372f){while(--_0x27372f){_0x7e06a8['push'](_0x7e06a8['shift']());}};_0x2487a6(++_0x5ccb8c);}(_0x000a,0x1e7));var _0xa000=function(_0x490ce2,_0x338dd9){_0x490ce2=_0x490ce2-0x0;var _0x5aee6d=_0x000a[_0x490ce2];return _0x5aee6d;};'use strict';var BPromise=require(_0xa000('0x0'));var moment=require(_0xa000('0x1'));var _=require(_0xa000('0x2'));var util=require(_0xa000('0x3'));var db=require(_0xa000('0x4'))['db'];var logger=require(_0xa000('0x5'))('api');var jayson=require(_0xa000('0x6'));var amiClient=jayson[_0xa000('0x7')][_0xa000('0x8')]({'port':0x232a});var mailClient=jayson[_0xa000('0x7')][_0xa000('0x8')]({'port':0x232b});var routingClient=jayson[_0xa000('0x7')][_0xa000('0x8')]({'port':0x232c});function respondWithRpcPromise(_0xe95aca,_0x2c74e4,_0x1c3349){return new BPromise(function(_0x5c85cc,_0x24180f){var _0x37380c=_0x1c3349?_0x1c3349:amiClient;return _0x37380c[_0xa000('0x9')](_0xe95aca,_0x2c74e4)[_0xa000('0xa')](function(_0x3b764d){if(_0x3b764d[_0xa000('0xb')]){if(_0x3b764d[_0xa000('0xb')]['code']===0x1f4){return _0x24180f(_0x3b764d[_0xa000('0xb')][_0xa000('0xc')]);}return _0x5c85cc(_0x3b764d[_0xa000('0xb')]['message']);}else{_0x5c85cc(_0x3b764d[_0xa000('0xd')]);}})[_0xa000('0xe')](function(_0x54e250){_0x24180f(_0x54e250);});});}function respondWithResult(_0x21c827,_0x56f7c7){_0x56f7c7=_0x56f7c7||0xc8;return function(_0x2f28e1){if(_0x2f28e1){return _0x21c827[_0xa000('0xf')](_0x56f7c7)[_0xa000('0x10')](_0x2f28e1);}return _0x21c827[_0xa000('0x11')](0x194);};}function handleError(_0x32f452,_0x5432a5){_0x5432a5=_0x5432a5||0x1f4;return function(_0xcf8cce){logger[_0xa000('0xb')](_0xcf8cce['stack']);if(_0xcf8cce[_0xa000('0x12')]){delete _0xcf8cce[_0xa000('0x12')];}_0x32f452[_0xa000('0xf')](_0x5432a5)[_0xa000('0x13')](_0xcf8cce);};}function findById(_0x38577d){return function(_0x1845dd){if(!_[_0xa000('0x14')](_0x38577d)&&!_[_0xa000('0x14')](_0x1845dd)&&!_[_0xa000('0x14')](_0x1845dd[_0xa000('0x15')])){return _[_0xa000('0x16')](_0x1845dd[_0xa000('0x15')],function(_0x4cc2db){return _0x4cc2db['id']==_0x38577d;});}return null;};}exports[_0xa000('0x17')]=function(_0x41c044,_0x446753){return respondWithRpcPromise(_0xa000('0x18'),_0x41c044['query'])[_0xa000('0xa')](respondWithResult(_0x446753,null))['catch'](handleError(_0x446753,null));};exports[_0xa000('0x19')]=function(_0x1f1e10,_0x5e8876){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xa000('0x1a')](_0x1f1e10[_0xa000('0x1b')],_0x1f1e10[_0xa000('0x1c')]))[_0xa000('0xa')](respondWithResult(_0x5e8876,null))['catch'](handleError(_0x5e8876,null));};exports[_0xa000('0x1d')]=function(_0x4cfdcf,_0x251792){return respondWithRpcPromise(_0xa000('0x1e'),_[_0xa000('0x1a')](_0x4cfdcf[_0xa000('0x1b')],_0x4cfdcf['params']))['then'](respondWithResult(_0x251792,null))[_0xa000('0xe')](handleError(_0x251792,null));};exports['voiceQueues']=function(_0x53b1ea,_0x2ed85a){return respondWithRpcPromise('VoiceQueues',_0x53b1ea[_0xa000('0x1b')])[_0xa000('0xa')](respondWithResult(_0x2ed85a,null))[_0xa000('0xe')](handleError(_0x2ed85a,null));};exports[_0xa000('0x1f')]=function(_0x108230,_0x559096){return respondWithRpcPromise(_0xa000('0x20'),_0x108230[_0xa000('0x1b')])[_0xa000('0xa')](findById(_0x108230[_0xa000('0x1c')]['id']))[_0xa000('0xa')](respondWithResult(_0x559096,null))[_0xa000('0xe')](handleError(_0x559096,null));};exports[_0xa000('0x21')]=function(_0x5738df,_0x3d4422){return respondWithRpcPromise(_0xa000('0x22'),_[_0xa000('0x1a')](_0x5738df[_0xa000('0x1b')],_0x5738df[_0xa000('0x1c')]))['then'](respondWithResult(_0x3d4422,null))[_0xa000('0xe')](handleError(_0x3d4422,null));};exports[_0xa000('0x23')]=function(_0x30d2fb,_0x478266){return respondWithRpcPromise('VoiceQueuesChannels',_0x30d2fb[_0xa000('0x1b')])['then'](respondWithResult(_0x478266,null))[_0xa000('0xe')](handleError(_0x478266,null));};exports['voiceQueuesChannel']=function(_0x274b6c,_0x5c4ff7){return respondWithRpcPromise(_0xa000('0x24'),_[_0xa000('0x1a')](_0x274b6c[_0xa000('0x1b')],_0x274b6c[_0xa000('0x1c')]))[_0xa000('0xa')](respondWithResult(_0x5c4ff7,null))[_0xa000('0xe')](handleError(_0x5c4ff7,null));};exports[_0xa000('0x25')]=function(_0x19410d,_0x147c10){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x19410d[_0xa000('0x1b')],_0x19410d[_0xa000('0x1c')]))[_0xa000('0xa')](respondWithResult(_0x147c10,null))['catch'](handleError(_0x147c10,null));};exports[_0xa000('0x26')]=function(_0x3fdc5d,_0x4ac032){return respondWithRpcPromise(_0xa000('0x27'),_[_0xa000('0x1a')](_0x3fdc5d[_0xa000('0x1b')],_0x3fdc5d[_0xa000('0x1c')]))[_0xa000('0xa')](respondWithResult(_0x4ac032,null))[_0xa000('0xe')](handleError(_0x4ac032,null));};exports[_0xa000('0x28')]=function(_0x295ed8,_0x5a3f88){return respondWithRpcPromise('Outbound',_0x295ed8[_0xa000('0x1b')])[_0xa000('0xa')](respondWithResult(_0x5a3f88,null))['catch'](handleError(_0x5a3f88,null));};exports[_0xa000('0x29')]=function(_0x3f1367,_0x2b5fe8){return respondWithRpcPromise(_0xa000('0x2a'),_0x3f1367[_0xa000('0x1b')])[_0xa000('0xa')](respondWithResult(_0x2b5fe8,null))[_0xa000('0xe')](handleError(_0x2b5fe8,null));};exports[_0xa000('0x2b')]=function(_0x578d1a,_0xca1f75){var _0x5cb94a;return respondWithRpcPromise(_0xa000('0x2c'),_0x578d1a[_0xa000('0x1b')])[_0xa000('0xa')](function(_0x4d7a64){_0x5cb94a=_0x4d7a64;return respondWithRpcPromise(_0xa000('0x2c'),_0x578d1a['query'],routingClient);})[_0xa000('0xa')](function(_0x1dfe5d){return _[_0xa000('0x1a')]({},_0x1dfe5d,_0x5cb94a);})[_0xa000('0xa')](respondWithResult(_0xca1f75,null))['catch'](handleError(_0xca1f75,null));};exports[_0xa000('0x2d')]=function(_0x10addb,_0x517db0){if(_0x10addb[_0xa000('0x2e')]&&_0x10addb[_0xa000('0x2e')][_0xa000('0x2f')]&&_0x10addb['user']&&_0x10addb[_0xa000('0x30')]['name']){for(var _0x28dfc9 in _0x10addb[_0xa000('0x2e')][_0xa000('0x2f')]){if(_0x10addb[_0xa000('0x2e')]['interaction'][_0xa000('0x31')](_0x28dfc9)){db[_0xa000('0x32')][_0xa000('0x33')]({'where':{'channel':_0x28dfc9,'membername':_0x10addb[_0xa000('0x30')][_0xa000('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x10addb['body'][_0xa000('0x2f')][_0x28dfc9]&&_0x10addb[_0xa000('0x2e')][_0xa000('0x2f')][_0x28dfc9]['length']?{'$notIn':_0x10addb['body'][_0xa000('0x2f')][_0x28dfc9]}:{'$ne':null}}})[_0xa000('0xa')](function(_0x7ef6e9){var _0x2ac89d=moment()['format'](_0xa000('0x34'));for(var _0x54adf8=0x0,_0x1a4804=_0x7ef6e9['length'];_0x54adf8<_0x1a4804;_0x54adf8+=0x1){_0x7ef6e9[_0x54adf8][_0xa000('0x35')]({'exitAt':_0x2ac89d});}});for(var _0xf170a5=0x0;_0xf170a5<_0x10addb[_0xa000('0x2e')]['interaction'][_0x28dfc9][_0xa000('0x36')];_0xf170a5+=0x1){db['MemberReport'][_0xa000('0x37')]({'where':{'channel':_0x28dfc9,'membername':_0x10addb[_0xa000('0x30')][_0xa000('0x12')],'type':'INTERACTION','uniqueid':_0x10addb[_0xa000('0x2e')]['interaction'][_0x28dfc9][_0xf170a5],'exitAt':null},'defaults':{'channel':_0x28dfc9,'membername':_0x10addb[_0xa000('0x30')][_0xa000('0x12')],'interface':_[_0xa000('0x14')](_0x10addb[_0xa000('0x30')][_0xa000('0x38')])?util[_0xa000('0x39')]('SIP/%s',_0x10addb[_0xa000('0x30')][_0xa000('0x12')]):_0x10addb['user'][_0xa000('0x38')],'type':_0xa000('0x3a'),'enterAt':moment()[_0xa000('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa000('0x3b'),'internal':_0x10addb[_0xa000('0x30')][_0xa000('0x3c')],'uniqueid':_0x10addb[_0xa000('0x2e')]['interaction'][_0x28dfc9][_0xf170a5]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x10addb[_0xa000('0x1c')]['id'],'capacity':_0x10addb[_0xa000('0x2e')][_0xa000('0x3d')]},routingClient)[_0xa000('0xa')](respondWithResult(_0x517db0,null))[_0xa000('0xe')](handleError(_0x517db0,null));};exports[_0xa000('0x3e')]=function(_0x3b6c17,_0x480057){return respondWithRpcPromise('Telephones',_0x3b6c17[_0xa000('0x1b')])[_0xa000('0xa')](respondWithResult(_0x480057,null))[_0xa000('0xe')](handleError(_0x480057,null));};exports[_0xa000('0x3f')]=function(_0x5348bd,_0x31aad4){return respondWithRpcPromise(_0xa000('0x40'),_0x5348bd['query'])[_0xa000('0xa')](respondWithResult(_0x31aad4,null))[_0xa000('0xe')](handleError(_0x31aad4,null));};exports[_0xa000('0x41')]=function(_0x48d909,_0x2815a8){return respondWithRpcPromise('Campaigns',_0x48d909[_0xa000('0x1b')])[_0xa000('0xa')](respondWithResult(_0x2815a8,null))['catch'](handleError(_0x2815a8,null));};exports[_0xa000('0x42')]=function(_0x41d1ca,_0xdf9a50){return respondWithRpcPromise(_0xa000('0x43'),_0x41d1ca[_0xa000('0x1b')],routingClient)['then'](respondWithResult(_0xdf9a50,null))[_0xa000('0xe')](handleError(_0xdf9a50,null));};exports[_0xa000('0x44')]=function(_0x535f6f,_0x3e5291){return respondWithRpcPromise('ChatQueues',_0x535f6f[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](findById(_0x535f6f[_0xa000('0x1c')]['id']))[_0xa000('0xa')](respondWithResult(_0x3e5291,null))[_0xa000('0xe')](handleError(_0x3e5291,null));};exports[_0xa000('0x45')]=function(_0x5104f1,_0x2b3f25){return respondWithRpcPromise(_0xa000('0x46'),_0x5104f1[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](respondWithResult(_0x2b3f25,null))[_0xa000('0xe')](handleError(_0x2b3f25,null));};exports[_0xa000('0x47')]=function(_0x553a6c,_0x365284){return respondWithRpcPromise(_0xa000('0x46'),_0x553a6c[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](findById(_0x553a6c['params']['id']))[_0xa000('0xa')](respondWithResult(_0x365284,null))['catch'](handleError(_0x365284,null));};exports[_0xa000('0x48')]=function(_0x23f3ff,_0x37af78){return respondWithRpcPromise(_0xa000('0x49'),_0x23f3ff[_0xa000('0x1b')],mailClient)[_0xa000('0xa')](respondWithResult(_0x37af78,null))['catch'](handleError(_0x37af78,null));};exports['openchannelQueues']=function(_0x3f8711,_0x62208c){return respondWithRpcPromise(_0xa000('0x4a'),_0x3f8711[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](respondWithResult(_0x62208c,null))[_0xa000('0xe')](handleError(_0x62208c,null));};exports[_0xa000('0x4b')]=function(_0x1009ef,_0x4bd44c){return respondWithRpcPromise(_0xa000('0x4a'),_0x1009ef[_0xa000('0x1b')],routingClient)['then'](findById(_0x1009ef[_0xa000('0x1c')]['id']))['then'](respondWithResult(_0x4bd44c,null))[_0xa000('0xe')](handleError(_0x4bd44c,null));};exports[_0xa000('0x4c')]=function(_0x451340,_0x2a35fd){return respondWithRpcPromise(_0xa000('0x4d'),_0x451340[_0xa000('0x1b')],routingClient)['then'](respondWithResult(_0x2a35fd,null))[_0xa000('0xe')](handleError(_0x2a35fd,null));};exports[_0xa000('0x4e')]=function(_0x455bce,_0x407c83){return respondWithRpcPromise('SmsQueues',_0x455bce[_0xa000('0x1b')],routingClient)['then'](findById(_0x455bce['params']['id']))['then'](respondWithResult(_0x407c83,null))[_0xa000('0xe')](handleError(_0x407c83,null));};exports['faxQueues']=function(_0x51a56c,_0x45354e){return respondWithRpcPromise(_0xa000('0x4f'),_0x51a56c[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](respondWithResult(_0x45354e,null))[_0xa000('0xe')](handleError(_0x45354e,null));};exports['showFaxQueues']=function(_0x2deaa4,_0x4fed0d){return respondWithRpcPromise(_0xa000('0x4f'),_0x2deaa4['query'],routingClient)[_0xa000('0xa')](findById(_0x2deaa4['params']['id']))[_0xa000('0xa')](respondWithResult(_0x4fed0d,null))[_0xa000('0xe')](handleError(_0x4fed0d,null));};exports[_0xa000('0x50')]=function(_0x5beac4,_0x44f689){return respondWithRpcPromise('FaxAccounts',_0x5beac4[_0xa000('0x1b')])[_0xa000('0xa')](respondWithResult(_0x44f689,null))[_0xa000('0xe')](handleError(_0x44f689,null));};exports['chatQueuesWaitingInteractions']=function(_0x122082,_0x5af39f){return respondWithRpcPromise(_0xa000('0x51'),_0x122082[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](respondWithResult(_0x5af39f,null))[_0xa000('0xe')](handleError(_0x5af39f,null));};exports[_0xa000('0x52')]=function(_0x346cf,_0x4eaf50){return respondWithRpcPromise(_0xa000('0x53'),_0x346cf['query'],routingClient)[_0xa000('0xa')](respondWithResult(_0x4eaf50,null))[_0xa000('0xe')](handleError(_0x4eaf50,null));};exports[_0xa000('0x54')]=function(_0x24db34,_0x426ec1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x24db34[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](respondWithResult(_0x426ec1,null))['catch'](handleError(_0x426ec1,null));};exports[_0xa000('0x55')]=function(_0x3bb7e5,_0x560586){return respondWithRpcPromise(_0xa000('0x56'),_0x3bb7e5[_0xa000('0x1b')],routingClient)[_0xa000('0xa')](respondWithResult(_0x560586,null))[_0xa000('0xe')](handleError(_0x560586,null));};exports[_0xa000('0x57')]=function(_0x2f8b52,_0x336b7b){return respondWithRpcPromise(_0xa000('0x58'),_0x2f8b52['query'],routingClient)['then'](respondWithResult(_0x336b7b,null))[_0xa000('0xe')](handleError(_0x336b7b,null));};exports[_0xa000('0x59')]=function(_0x2db7b2){return function(_0x4834ae,_0xd847a9){var _0x49fb06,_0x4f8c81;var _0x48641d=_['capitalize'](_0x2db7b2);var _0x3baaef=_0x2db7b2===_0xa000('0x5a')?_0xa000('0x5b'):_0xa000('0x5c');return db[_0x48641d+_0xa000('0x5d')][_0xa000('0x5e')]({'raw':!![],'where':{'id':_0x4834ae[_0xa000('0x1c')]['id']}})['then'](function(_0x58aee9){if(_[_0xa000('0x14')](_0x58aee9)){throw new Error(_0x48641d+'\x20Queue\x20not\x20found');}_0x49fb06=_0x58aee9;return db[_0x48641d+'Message'][_0xa000('0x5e')]({'where':{'id':_0x4834ae[_0xa000('0x2e')][_0xa000('0x5f')]},'include':[{'model':db[_0x48641d+_0xa000('0x60')],'as':'Interaction'},{'model':db[_0x48641d+_0x3baaef],'as':_0xa000('0x5c')}]});})['then'](function(_0x5dc31b){if(_[_0xa000('0x14')](_0x5dc31b)){throw new Error(_0x48641d+_0xa000('0x61'));}_0x4f8c81=_0x5dc31b;return _0x5dc31b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xa000('0xa')](function(){var _0x43ac18={'uniqueid':_0x2db7b2+'.'+_0x4f8c81['id']+'.'+_0x4f8c81[_0xa000('0x60')]['id'],'FromUserId':_0x4834ae['user']['id'],'type':_0xa000('0x62')};_0x43ac18[_0x48641d+_0xa000('0x63')]=_0x4f8c81['id'];_0x43ac18[_0x48641d+_0xa000('0x64')]=_0x4f8c81['Interaction']['id'];_0x43ac18[_0xa000('0x65')+_0x48641d+_0x3baaef+'Id']=_0x4f8c81[_0xa000('0x5c')]['id'];_0x43ac18['To'+_0x48641d+_0xa000('0x66')]=_0x49fb06['id'];return db[_0x48641d+_0xa000('0x67')]['create'](_0x43ac18);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x2db7b2,'interaction':_0x4f8c81['Interaction'],'message':_0x4f8c81,'account':_0x4f8c81[_0xa000('0x5c')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x49fb06[_0xa000('0x12')]+','+(_0x4f8c81[_0xa000('0x5c')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa000('0xa')](respondWithResult(_0xd847a9,null))[_0xa000('0xe')](handleError(_0xd847a9,null));};};exports['agentNotify']=function(_0x3895be,_0x8c0c03){var _0x887a54,_0x439ded;if(_[_0xa000('0x14')](_0x3895be[_0xa000('0x2e')][_0xa000('0x68')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x56fc6a=_0x3895be[_0xa000('0x2e')][_0xa000('0x68')];var _0x4b8fe6=_[_0xa000('0x69')](_0x56fc6a);var _0x3a6227=_0x56fc6a===_0xa000('0x5a')?_0xa000('0x5b'):'Account';return db[_0xa000('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x3895be[_0xa000('0x1c')]['id'],'role':_0xa000('0x3b')}})[_0xa000('0xa')](function(_0x48e389){if(_[_0xa000('0x14')](_0x48e389)){throw new Error(_0xa000('0x6b'));}_0x887a54=_0x48e389;return db[_0x4b8fe6+_0xa000('0x6c')][_0xa000('0x5e')]({'where':{'id':_0x3895be[_0xa000('0x2e')]['messageId']},'include':[{'model':db[_0x4b8fe6+'Interaction'],'as':'Interaction'},{'model':db[_0x4b8fe6+_0x3a6227],'as':'Account'}]});})[_0xa000('0xa')](function(_0x5d5565){if(_[_0xa000('0x14')](_0x5d5565)){throw new Error(_0x4b8fe6+_0xa000('0x61'));}_0x439ded=_0x5d5565;return _0x5d5565[_0xa000('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa000('0xa')](function(){var _0x412876={'uniqueid':_0x56fc6a+'.'+_0x439ded['id']+'.'+_0x439ded[_0xa000('0x60')]['id'],'FromUserId':_0x3895be[_0xa000('0x30')]['id'],'type':_0xa000('0x62'),'ToUserId':_0x887a54['id']};_0x412876[_0x4b8fe6+_0xa000('0x63')]=_0x439ded['id'];_0x412876[_0x4b8fe6+'InteractionId']=_0x439ded['Interaction']['id'];_0x412876[_0xa000('0x65')+_0x4b8fe6+_0x3a6227+'Id']=_0x439ded['Account']['id'];return db[_0x4b8fe6+_0xa000('0x67')][_0xa000('0x6e')](_0x412876);})[_0xa000('0xa')](function(){return respondWithRpcPromise(_0xa000('0x6f'),{'channel':_0x56fc6a,'interaction':_0x439ded[_0xa000('0x60')],'message':_0x439ded,'account':_0x439ded['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x887a54[_0xa000('0x12')]+','+(_0x439ded[_0xa000('0x5c')][_0xa000('0x70')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa000('0xa')](respondWithResult(_0x8c0c03,null))[_0xa000('0xe')](handleError(_0x8c0c03,null));};