Built motion from commit (unavailable).|2.4.5
[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 _0x333b=['AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','faxQueues','showFaxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','agent','Agent\x20not\x20found','From','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','MemberReport','user','length','format','updateAttributes','INTERACTION','SIP/%s','interface','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5e987c,_0x5148f0){var _0x37c36a=function(_0x1e83f7){while(--_0x1e83f7){_0x5e987c['push'](_0x5e987c['shift']());}};_0x37c36a(++_0x5148f0);}(_0x333b,0x18f));var _0xb333=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x333b[_0x1cbcf1];return _0x3a06f0;};'use strict';var BPromise=require(_0xb333('0x0'));var moment=require(_0xb333('0x1'));var _=require(_0xb333('0x2'));var util=require(_0xb333('0x3'));var db=require(_0xb333('0x4'))['db'];var logger=require(_0xb333('0x5'))(_0xb333('0x6'));var jayson=require(_0xb333('0x7'));var amiClient=jayson[_0xb333('0x8')]['http']({'port':0x232a});var mailClient=jayson[_0xb333('0x8')][_0xb333('0x9')]({'port':0x232b});var routingClient=jayson[_0xb333('0x8')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3aa88b,_0x290141,_0xbd4fe1){return new BPromise(function(_0x4bc367,_0x33adb6){var _0x1ece2c=_0xbd4fe1?_0xbd4fe1:amiClient;return _0x1ece2c[_0xb333('0xa')](_0x3aa88b,_0x290141)[_0xb333('0xb')](function(_0x123f8a){if(_0x123f8a[_0xb333('0xc')]){if(_0x123f8a[_0xb333('0xc')][_0xb333('0xd')]===0x1f4){return _0x33adb6(_0x123f8a[_0xb333('0xc')][_0xb333('0xe')]);}return _0x4bc367(_0x123f8a[_0xb333('0xc')][_0xb333('0xe')]);}else{_0x4bc367(_0x123f8a[_0xb333('0xf')]);}})[_0xb333('0x10')](function(_0x4ec9a2){_0x33adb6(_0x4ec9a2);});});}function respondWithResult(_0x5adff7,_0x1a36b4){_0x1a36b4=_0x1a36b4||0xc8;return function(_0xf877f0){if(_0xf877f0){return _0x5adff7[_0xb333('0x11')](_0x1a36b4)['json'](_0xf877f0);}return _0x5adff7[_0xb333('0x12')](0x194);};}function handleError(_0x546ab2,_0x380179){_0x380179=_0x380179||0x1f4;return function(_0x926ce4){logger[_0xb333('0xc')](_0x926ce4[_0xb333('0x13')]);if(_0x926ce4[_0xb333('0x14')]){delete _0x926ce4[_0xb333('0x14')];}_0x546ab2['status'](_0x380179)[_0xb333('0x15')](_0x926ce4);};}function findById(_0x495d50){return function(_0x211cfe){if(!_[_0xb333('0x16')](_0x495d50)&&!_[_0xb333('0x16')](_0x211cfe)&&!_[_0xb333('0x16')](_0x211cfe[_0xb333('0x17')])){return _[_0xb333('0x18')](_0x211cfe[_0xb333('0x17')],function(_0x3d4824){return _0x3d4824['id']==_0x495d50;});}return null;};}exports[_0xb333('0x19')]=function(_0x7c4f9f,_0x4ccad8){return respondWithRpcPromise(_0xb333('0x1a'),_0x7c4f9f[_0xb333('0x1b')])[_0xb333('0xb')](respondWithResult(_0x4ccad8,null))['catch'](handleError(_0x4ccad8,null));};exports[_0xb333('0x1c')]=function(_0x3ebff6,_0x1293c8){return respondWithRpcPromise(_0xb333('0x1d'),_[_0xb333('0x1e')](_0x3ebff6[_0xb333('0x1b')],_0x3ebff6[_0xb333('0x1f')]))[_0xb333('0xb')](respondWithResult(_0x1293c8,null))[_0xb333('0x10')](handleError(_0x1293c8,null));};exports[_0xb333('0x20')]=function(_0x4c7380,_0x50764e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x4c7380[_0xb333('0x1b')],_0x4c7380[_0xb333('0x1f')]))['then'](respondWithResult(_0x50764e,null))[_0xb333('0x10')](handleError(_0x50764e,null));};exports[_0xb333('0x21')]=function(_0x9a9999,_0x260f04){return respondWithRpcPromise('VoiceQueues',_0x9a9999[_0xb333('0x1b')])['then'](respondWithResult(_0x260f04,null))[_0xb333('0x10')](handleError(_0x260f04,null));};exports[_0xb333('0x22')]=function(_0x18afbd,_0x2598a6){return respondWithRpcPromise(_0xb333('0x23'),_0x18afbd[_0xb333('0x1b')])[_0xb333('0xb')](findById(_0x18afbd['params']['id']))['then'](respondWithResult(_0x2598a6,null))[_0xb333('0x10')](handleError(_0x2598a6,null));};exports[_0xb333('0x24')]=function(_0x1be81f,_0x2fb9f9){return respondWithRpcPromise(_0xb333('0x25'),_[_0xb333('0x1e')](_0x1be81f[_0xb333('0x1b')],_0x1be81f['params']))[_0xb333('0xb')](respondWithResult(_0x2fb9f9,null))[_0xb333('0x10')](handleError(_0x2fb9f9,null));};exports[_0xb333('0x26')]=function(_0x4e1715,_0x3ec4ab){return respondWithRpcPromise(_0xb333('0x27'),_0x4e1715[_0xb333('0x1b')])[_0xb333('0xb')](respondWithResult(_0x3ec4ab,null))[_0xb333('0x10')](handleError(_0x3ec4ab,null));};exports[_0xb333('0x28')]=function(_0x72866f,_0x1c0f11){return respondWithRpcPromise(_0xb333('0x29'),_[_0xb333('0x1e')](_0x72866f['query'],_0x72866f[_0xb333('0x1f')]))['then'](respondWithResult(_0x1c0f11,null))[_0xb333('0x10')](handleError(_0x1c0f11,null));};exports[_0xb333('0x2a')]=function(_0x3cf0d4,_0x2b57ec){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb333('0x1e')](_0x3cf0d4[_0xb333('0x1b')],_0x3cf0d4[_0xb333('0x1f')]))[_0xb333('0xb')](respondWithResult(_0x2b57ec,null))[_0xb333('0x10')](handleError(_0x2b57ec,null));};exports['voiceQueuesChannelRedirect']=function(_0x2af241,_0x41172c){return respondWithRpcPromise(_0xb333('0x2b'),_[_0xb333('0x1e')](_0x2af241[_0xb333('0x1b')],_0x2af241['params']))[_0xb333('0xb')](respondWithResult(_0x41172c,null))['catch'](handleError(_0x41172c,null));};exports[_0xb333('0x2c')]=function(_0x527f05,_0x471109){return respondWithRpcPromise(_0xb333('0x2d'),_0x527f05[_0xb333('0x1b')])['then'](respondWithResult(_0x471109,null))[_0xb333('0x10')](handleError(_0x471109,null));};exports[_0xb333('0x2e')]=function(_0x5e9172,_0x499bda){return respondWithRpcPromise(_0xb333('0x2f'),_0x5e9172[_0xb333('0x1b')])[_0xb333('0xb')](respondWithResult(_0x499bda,null))[_0xb333('0x10')](handleError(_0x499bda,null));};exports['agents']=function(_0x6a9273,_0x1239e4){var _0x2a5014;return respondWithRpcPromise('Agents',_0x6a9273['query'])[_0xb333('0xb')](function(_0x49afb7){_0x2a5014=_0x49afb7;return respondWithRpcPromise(_0xb333('0x30'),_0x6a9273[_0xb333('0x1b')],routingClient);})[_0xb333('0xb')](function(_0xa59c08){return _['merge']({},_0xa59c08,_0x2a5014);})[_0xb333('0xb')](respondWithResult(_0x1239e4,null))[_0xb333('0x10')](handleError(_0x1239e4,null));};exports[_0xb333('0x31')]=function(_0x3f8108,_0x39df43){if(_0x3f8108['body']&&_0x3f8108[_0xb333('0x32')][_0xb333('0x33')]&&_0x3f8108['user']&&_0x3f8108['user']['name']){for(var _0x58938b in _0x3f8108[_0xb333('0x32')][_0xb333('0x33')]){if(_0x3f8108['body'][_0xb333('0x33')]['hasOwnProperty'](_0x58938b)){db[_0xb333('0x34')]['findAll']({'where':{'channel':_0x58938b,'membername':_0x3f8108[_0xb333('0x35')][_0xb333('0x14')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3f8108[_0xb333('0x32')][_0xb333('0x33')][_0x58938b]&&_0x3f8108[_0xb333('0x32')][_0xb333('0x33')][_0x58938b][_0xb333('0x36')]?{'$notIn':_0x3f8108[_0xb333('0x32')][_0xb333('0x33')][_0x58938b]}:{'$ne':null}}})[_0xb333('0xb')](function(_0x437ad6){var _0x37683c=moment()[_0xb333('0x37')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x547f4f=0x0,_0x5b6115=_0x437ad6[_0xb333('0x36')];_0x547f4f<_0x5b6115;_0x547f4f+=0x1){_0x437ad6[_0x547f4f][_0xb333('0x38')]({'exitAt':_0x37683c});}});for(var _0x21f34a=0x0;_0x21f34a<_0x3f8108['body'][_0xb333('0x33')][_0x58938b][_0xb333('0x36')];_0x21f34a+=0x1){db[_0xb333('0x34')]['findOrCreate']({'where':{'channel':_0x58938b,'membername':_0x3f8108[_0xb333('0x35')][_0xb333('0x14')],'type':_0xb333('0x39'),'uniqueid':_0x3f8108[_0xb333('0x32')][_0xb333('0x33')][_0x58938b][_0x21f34a],'exitAt':null},'defaults':{'channel':_0x58938b,'membername':_0x3f8108[_0xb333('0x35')]['name'],'interface':_[_0xb333('0x16')](_0x3f8108['user']['interface'])?util[_0xb333('0x37')](_0xb333('0x3a'),_0x3f8108['user'][_0xb333('0x14')]):_0x3f8108[_0xb333('0x35')][_0xb333('0x3b')],'type':_0xb333('0x39'),'enterAt':moment()[_0xb333('0x37')](_0xb333('0x3c')),'role':'agent','internal':_0x3f8108[_0xb333('0x35')]['internal'],'uniqueid':_0x3f8108['body'][_0xb333('0x33')][_0x58938b][_0x21f34a]}});}}}}return respondWithRpcPromise(_0xb333('0x3d'),{'id':_0x3f8108[_0xb333('0x1f')]['id'],'capacity':_0x3f8108[_0xb333('0x32')][_0xb333('0x3e')]},routingClient)['then'](respondWithResult(_0x39df43,null))['catch'](handleError(_0x39df43,null));};exports[_0xb333('0x3f')]=function(_0x145c30,_0x3ff85d){return respondWithRpcPromise(_0xb333('0x40'),_0x145c30[_0xb333('0x1b')])['then'](respondWithResult(_0x3ff85d,null))[_0xb333('0x10')](handleError(_0x3ff85d,null));};exports[_0xb333('0x41')]=function(_0x1392b5,_0x5c9ed1){return respondWithRpcPromise(_0xb333('0x42'),_0x1392b5[_0xb333('0x1b')])['then'](respondWithResult(_0x5c9ed1,null))[_0xb333('0x10')](handleError(_0x5c9ed1,null));};exports[_0xb333('0x43')]=function(_0x2677f8,_0x529e88){return respondWithRpcPromise(_0xb333('0x44'),_0x2677f8[_0xb333('0x1b')])[_0xb333('0xb')](respondWithResult(_0x529e88,null))['catch'](handleError(_0x529e88,null));};exports['chatQueues']=function(_0x298e76,_0x16171f){return respondWithRpcPromise(_0xb333('0x45'),_0x298e76[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](respondWithResult(_0x16171f,null))[_0xb333('0x10')](handleError(_0x16171f,null));};exports[_0xb333('0x46')]=function(_0x247bfb,_0x742ce3){return respondWithRpcPromise('ChatQueues',_0x247bfb[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](findById(_0x247bfb[_0xb333('0x1f')]['id']))[_0xb333('0xb')](respondWithResult(_0x742ce3,null))[_0xb333('0x10')](handleError(_0x742ce3,null));};exports[_0xb333('0x47')]=function(_0x48e768,_0x389b1a){return respondWithRpcPromise('MailQueues',_0x48e768['query'],routingClient)['then'](respondWithResult(_0x389b1a,null))[_0xb333('0x10')](handleError(_0x389b1a,null));};exports[_0xb333('0x48')]=function(_0x167e99,_0x126005){return respondWithRpcPromise(_0xb333('0x49'),_0x167e99[_0xb333('0x1b')],routingClient)['then'](findById(_0x167e99[_0xb333('0x1f')]['id']))[_0xb333('0xb')](respondWithResult(_0x126005,null))[_0xb333('0x10')](handleError(_0x126005,null));};exports[_0xb333('0x4a')]=function(_0x318104,_0xe13d9e){return respondWithRpcPromise(_0xb333('0x4b'),_0x318104[_0xb333('0x1b')],mailClient)[_0xb333('0xb')](respondWithResult(_0xe13d9e,null))[_0xb333('0x10')](handleError(_0xe13d9e,null));};exports[_0xb333('0x4c')]=function(_0x2e1c7e,_0x4cf53f){return respondWithRpcPromise(_0xb333('0x4d'),_0x2e1c7e['query'],routingClient)[_0xb333('0xb')](respondWithResult(_0x4cf53f,null))[_0xb333('0x10')](handleError(_0x4cf53f,null));};exports['showOpenchannelQueues']=function(_0x201dfc,_0x5ad6bd){return respondWithRpcPromise('OpenchannelQueues',_0x201dfc['query'],routingClient)[_0xb333('0xb')](findById(_0x201dfc['params']['id']))[_0xb333('0xb')](respondWithResult(_0x5ad6bd,null))[_0xb333('0x10')](handleError(_0x5ad6bd,null));};exports['smsQueues']=function(_0x31a5f4,_0x76477){return respondWithRpcPromise(_0xb333('0x4e'),_0x31a5f4[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](respondWithResult(_0x76477,null))[_0xb333('0x10')](handleError(_0x76477,null));};exports['showSmsQueues']=function(_0x4c5361,_0x537c2d){return respondWithRpcPromise(_0xb333('0x4e'),_0x4c5361[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](findById(_0x4c5361['params']['id']))[_0xb333('0xb')](respondWithResult(_0x537c2d,null))[_0xb333('0x10')](handleError(_0x537c2d,null));};exports[_0xb333('0x4f')]=function(_0x5bda46,_0x4cf478){return respondWithRpcPromise('FaxQueues',_0x5bda46[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](respondWithResult(_0x4cf478,null))['catch'](handleError(_0x4cf478,null));};exports[_0xb333('0x50')]=function(_0x146b65,_0x463c55){return respondWithRpcPromise(_0xb333('0x51'),_0x146b65[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](findById(_0x146b65[_0xb333('0x1f')]['id']))[_0xb333('0xb')](respondWithResult(_0x463c55,null))[_0xb333('0x10')](handleError(_0x463c55,null));};exports['faxAccounts']=function(_0x34ff80,_0x3399b5){return respondWithRpcPromise(_0xb333('0x52'),_0x34ff80[_0xb333('0x1b')])[_0xb333('0xb')](respondWithResult(_0x3399b5,null))['catch'](handleError(_0x3399b5,null));};exports[_0xb333('0x53')]=function(_0x31bddc,_0x3ac455){return respondWithRpcPromise(_0xb333('0x54'),_0x31bddc[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](respondWithResult(_0x3ac455,null))[_0xb333('0x10')](handleError(_0x3ac455,null));};exports['mailQueuesWaitingInteractions']=function(_0x2f5765,_0x24971c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2f5765[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](respondWithResult(_0x24971c,null))[_0xb333('0x10')](handleError(_0x24971c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x113052,_0x14ce36){return respondWithRpcPromise(_0xb333('0x55'),_0x113052[_0xb333('0x1b')],routingClient)[_0xb333('0xb')](respondWithResult(_0x14ce36,null))[_0xb333('0x10')](handleError(_0x14ce36,null));};exports['smsQueuesWaitingInteractions']=function(_0x180985,_0x350cbd){return respondWithRpcPromise(_0xb333('0x56'),_0x180985[_0xb333('0x1b')],routingClient)['then'](respondWithResult(_0x350cbd,null))[_0xb333('0x10')](handleError(_0x350cbd,null));};exports['faxQueuesWaitingInteractions']=function(_0x5cbc18,_0x45af27){return respondWithRpcPromise(_0xb333('0x57'),_0x5cbc18['query'],routingClient)[_0xb333('0xb')](respondWithResult(_0x45af27,null))[_0xb333('0x10')](handleError(_0x45af27,null));};exports[_0xb333('0x58')]=function(_0x4905cb){return function(_0x2c8aae,_0x5955d8){var _0xd7aac7,_0xe86abf;var _0x446ec2=_['capitalize'](_0x4905cb);var _0x5c4fb3=_0x4905cb===_0xb333('0x59')?'Website':_0xb333('0x5a');return db[_0x446ec2+_0xb333('0x5b')][_0xb333('0x5c')]({'raw':!![],'where':{'id':_0x2c8aae[_0xb333('0x1f')]['id']}})['then'](function(_0x4649cc){if(_[_0xb333('0x16')](_0x4649cc)){throw new Error(_0x446ec2+_0xb333('0x5d'));}_0xd7aac7=_0x4649cc;return db[_0x446ec2+_0xb333('0x5e')]['findOne']({'where':{'id':_0x2c8aae[_0xb333('0x32')][_0xb333('0x5f')]},'include':[{'model':db[_0x446ec2+'Interaction'],'as':_0xb333('0x60')},{'model':db[_0x446ec2+_0x5c4fb3],'as':_0xb333('0x5a')}]});})[_0xb333('0xb')](function(_0x5b59ea){if(_[_0xb333('0x16')](_0x5b59ea)){throw new Error(_0x446ec2+_0xb333('0x61'));}_0xe86abf=_0x5b59ea;return _0x5b59ea[_0xb333('0x62')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb333('0xb')](function(){var _0x464756={'uniqueid':_0x4905cb+'.'+_0xe86abf['id']+'.'+_0xe86abf[_0xb333('0x60')]['id'],'FromUserId':_0x2c8aae[_0xb333('0x35')]['id'],'type':_0xb333('0x63')};_0x464756[_0x446ec2+_0xb333('0x64')]=_0xe86abf['id'];_0x464756[_0x446ec2+_0xb333('0x65')]=_0xe86abf[_0xb333('0x60')]['id'];_0x464756['From'+_0x446ec2+_0x5c4fb3+'Id']=_0xe86abf[_0xb333('0x5a')]['id'];_0x464756['To'+_0x446ec2+_0xb333('0x66')]=_0xd7aac7['id'];return db[_0x446ec2+_0xb333('0x67')]['create'](_0x464756);})['then'](function(){return respondWithRpcPromise(_0xb333('0x68'),{'channel':_0x4905cb,'interaction':_0xe86abf['Interaction'],'message':_0xe86abf,'account':_0xe86abf[_0xb333('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb333('0x63'),'appdata':_0xd7aac7[_0xb333('0x14')]+','+(_0xe86abf[_0xb333('0x5a')][_0xb333('0x69')]||0x12c),'interval':_0xb333('0x6a')}]},routingClient);})[_0xb333('0xb')](respondWithResult(_0x5955d8,null))[_0xb333('0x10')](handleError(_0x5955d8,null));};};exports[_0xb333('0x6b')]=function(_0x2c1e7c,_0x23d92d){var _0x2e9fc4,_0x3a4f13;if(_[_0xb333('0x16')](_0x2c1e7c[_0xb333('0x32')][_0xb333('0x6c')])){throw new Error(_0xb333('0x6d'));}var _0x3ee042=_0x2c1e7c[_0xb333('0x32')][_0xb333('0x6c')];var _0x30c5f7=_['capitalize'](_0x3ee042);var _0x334d22=_0x3ee042==='chat'?_0xb333('0x6e'):_0xb333('0x5a');return db['User'][_0xb333('0x5c')]({'raw':!![],'where':{'id':_0x2c1e7c[_0xb333('0x1f')]['id'],'role':_0xb333('0x6f')}})['then'](function(_0x4ba3d7){if(_[_0xb333('0x16')](_0x4ba3d7)){throw new Error(_0xb333('0x70'));}_0x2e9fc4=_0x4ba3d7;return db[_0x30c5f7+_0xb333('0x5e')][_0xb333('0x5c')]({'where':{'id':_0x2c1e7c['body']['messageId']},'include':[{'model':db[_0x30c5f7+_0xb333('0x60')],'as':_0xb333('0x60')},{'model':db[_0x30c5f7+_0x334d22],'as':_0xb333('0x5a')}]});})[_0xb333('0xb')](function(_0x129f9f){if(_[_0xb333('0x16')](_0x129f9f)){throw new Error(_0x30c5f7+_0xb333('0x61'));}_0x3a4f13=_0x129f9f;return _0x129f9f[_0xb333('0x62')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb333('0xb')](function(){var _0xd4420a={'uniqueid':_0x3ee042+'.'+_0x3a4f13['id']+'.'+_0x3a4f13[_0xb333('0x60')]['id'],'FromUserId':_0x2c1e7c['user']['id'],'type':_0xb333('0x63'),'ToUserId':_0x2e9fc4['id']};_0xd4420a[_0x30c5f7+_0xb333('0x64')]=_0x3a4f13['id'];_0xd4420a[_0x30c5f7+_0xb333('0x65')]=_0x3a4f13[_0xb333('0x60')]['id'];_0xd4420a[_0xb333('0x71')+_0x30c5f7+_0x334d22+'Id']=_0x3a4f13['Account']['id'];return db[_0x30c5f7+_0xb333('0x67')]['create'](_0xd4420a);})[_0xb333('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x3ee042,'interaction':_0x3a4f13[_0xb333('0x60')],'message':_0x3a4f13,'account':_0x3a4f13[_0xb333('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2e9fc4[_0xb333('0x14')]+','+(_0x3a4f13[_0xb333('0x5a')][_0xb333('0x72')]||0x12c),'interval':_0xb333('0x6a')}]},routingClient);})['then'](respondWithResult(_0x23d92d,null))[_0xb333('0x10')](handleError(_0x23d92d,null));};