Built motion from commit (unavailable).|2.2.0
[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 _0x159c=['capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','TransferReport','create','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','result','catch','status','json','sendStatus','send','isNil','find','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','agentCapacity','body','interaction','name','MemberReport','findAll','user','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','interface','SIP/%s','INTERACTION','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify'];(function(_0x295f4e,_0x62822e){var _0x454dc8=function(_0x6c0c1c){while(--_0x6c0c1c){_0x295f4e['push'](_0x295f4e['shift']());}};_0x454dc8(++_0x62822e);}(_0x159c,0x88));var _0xc159=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x159c[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xc159('0x0'));var moment=require(_0xc159('0x1'));var _=require(_0xc159('0x2'));var util=require('util');var db=require(_0xc159('0x3'))['db'];var logger=require(_0xc159('0x4'))(_0xc159('0x5'));var jayson=require(_0xc159('0x6'));var amiClient=jayson[_0xc159('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xc159('0x7')][_0xc159('0x8')]({'port':0x232b});var routingClient=jayson[_0xc159('0x7')][_0xc159('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x25981b,_0x4d3a97,_0x151b1a){return new BPromise(function(_0xaddc87,_0x27030f){var _0x3cf415=_0x151b1a?_0x151b1a:amiClient;return _0x3cf415[_0xc159('0x9')](_0x25981b,_0x4d3a97)['then'](function(_0x3c9a66){if(_0x3c9a66[_0xc159('0xa')]){if(_0x3c9a66[_0xc159('0xa')][_0xc159('0xb')]===0x1f4){return _0x27030f(_0x3c9a66['error']['message']);}return _0xaddc87(_0x3c9a66['error'][_0xc159('0xc')]);}else{_0xaddc87(_0x3c9a66[_0xc159('0xd')]);}})[_0xc159('0xe')](function(_0xf91bd3){_0x27030f(_0xf91bd3);});});}function respondWithResult(_0x20ed78,_0x115a97){_0x115a97=_0x115a97||0xc8;return function(_0x46dcb3){if(_0x46dcb3){return _0x20ed78[_0xc159('0xf')](_0x115a97)[_0xc159('0x10')](_0x46dcb3);}return _0x20ed78[_0xc159('0x11')](0x194);};}function handleError(_0x288342,_0x4917a2){_0x4917a2=_0x4917a2||0x1f4;return function(_0x20f07d){logger['error'](_0x20f07d['stack']);if(_0x20f07d['name']){delete _0x20f07d['name'];}_0x288342[_0xc159('0xf')](_0x4917a2)[_0xc159('0x12')](_0x20f07d);};}function findById(_0x264965){return function(_0x473f64){if(!_[_0xc159('0x13')](_0x264965)&&!_['isNil'](_0x473f64)&&!_[_0xc159('0x13')](_0x473f64['rows'])){return _[_0xc159('0x14')](_0x473f64[_0xc159('0x15')],function(_0x54116b){return _0x54116b['id']==_0x264965;});}return null;};}exports[_0xc159('0x16')]=function(_0x22cc28,_0x46cbca){return respondWithRpcPromise(_0xc159('0x17'),_0x22cc28[_0xc159('0x18')])[_0xc159('0x19')](respondWithResult(_0x46cbca,null))['catch'](handleError(_0x46cbca,null));};exports['voiceChannelMixMonitor']=function(_0x440347,_0x4ff42b){return respondWithRpcPromise(_0xc159('0x1a'),_[_0xc159('0x1b')](_0x440347[_0xc159('0x18')],_0x440347[_0xc159('0x1c')]))[_0xc159('0x19')](respondWithResult(_0x4ff42b,null))[_0xc159('0xe')](handleError(_0x4ff42b,null));};exports[_0xc159('0x1d')]=function(_0x25abe9,_0x3d2b50){return respondWithRpcPromise(_0xc159('0x1e'),_[_0xc159('0x1b')](_0x25abe9[_0xc159('0x18')],_0x25abe9[_0xc159('0x1c')]))[_0xc159('0x19')](respondWithResult(_0x3d2b50,null))[_0xc159('0xe')](handleError(_0x3d2b50,null));};exports['voiceQueues']=function(_0x1278d0,_0xdb1bcb){return respondWithRpcPromise(_0xc159('0x1f'),_0x1278d0[_0xc159('0x18')])[_0xc159('0x19')](respondWithResult(_0xdb1bcb,null))[_0xc159('0xe')](handleError(_0xdb1bcb,null));};exports[_0xc159('0x20')]=function(_0x19605f,_0x740212){return respondWithRpcPromise('VoiceQueues',_0x19605f[_0xc159('0x18')])[_0xc159('0x19')](findById(_0x19605f[_0xc159('0x1c')]['id']))['then'](respondWithResult(_0x740212,null))[_0xc159('0xe')](handleError(_0x740212,null));};exports[_0xc159('0x21')]=function(_0x40f7a6,_0x3f370a){return respondWithRpcPromise(_0xc159('0x22'),_[_0xc159('0x1b')](_0x40f7a6[_0xc159('0x18')],_0x40f7a6[_0xc159('0x1c')]))[_0xc159('0x19')](respondWithResult(_0x3f370a,null))['catch'](handleError(_0x3f370a,null));};exports[_0xc159('0x23')]=function(_0xefc38,_0xc0e2e8){return respondWithRpcPromise(_0xc159('0x24'),_0xefc38['query'])[_0xc159('0x19')](respondWithResult(_0xc0e2e8,null))[_0xc159('0xe')](handleError(_0xc0e2e8,null));};exports[_0xc159('0x25')]=function(_0x147557,_0x3f08e9){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xc159('0x1b')](_0x147557[_0xc159('0x18')],_0x147557[_0xc159('0x1c')]))[_0xc159('0x19')](respondWithResult(_0x3f08e9,null))[_0xc159('0xe')](handleError(_0x3f08e9,null));};exports[_0xc159('0x26')]=function(_0x95e3d,_0x200da2){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xc159('0x1b')](_0x95e3d[_0xc159('0x18')],_0x95e3d[_0xc159('0x1c')]))[_0xc159('0x19')](respondWithResult(_0x200da2,null))[_0xc159('0xe')](handleError(_0x200da2,null));};exports[_0xc159('0x27')]=function(_0x4df7a9,_0x5805df){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x4df7a9[_0xc159('0x18')],_0x4df7a9[_0xc159('0x1c')]))[_0xc159('0x19')](respondWithResult(_0x5805df,null))[_0xc159('0xe')](handleError(_0x5805df,null));};exports[_0xc159('0x28')]=function(_0x195ce2,_0x15fb7c){return respondWithRpcPromise(_0xc159('0x29'),_0x195ce2[_0xc159('0x18')])['then'](respondWithResult(_0x15fb7c,null))[_0xc159('0xe')](handleError(_0x15fb7c,null));};exports['outboundChannels']=function(_0x6ef210,_0x35dbf4){return respondWithRpcPromise(_0xc159('0x2a'),_0x6ef210[_0xc159('0x18')])[_0xc159('0x19')](respondWithResult(_0x35dbf4,null))[_0xc159('0xe')](handleError(_0x35dbf4,null));};exports['agents']=function(_0x182349,_0x197361){var _0x2d9870;return respondWithRpcPromise(_0xc159('0x2b'),_0x182349[_0xc159('0x18')])[_0xc159('0x19')](function(_0x2fb5e8){_0x2d9870=_0x2fb5e8;return respondWithRpcPromise(_0xc159('0x2b'),_0x182349['query'],routingClient);})['then'](function(_0x11ccaf){return _[_0xc159('0x1b')]({},_0x11ccaf,_0x2d9870);})['then'](respondWithResult(_0x197361,null))[_0xc159('0xe')](handleError(_0x197361,null));};exports[_0xc159('0x2c')]=function(_0x3866d4,_0x4f301d){if(_0x3866d4[_0xc159('0x2d')]&&_0x3866d4[_0xc159('0x2d')][_0xc159('0x2e')]&&_0x3866d4['user']&&_0x3866d4['user'][_0xc159('0x2f')]){for(var _0x10d99e in _0x3866d4[_0xc159('0x2d')][_0xc159('0x2e')]){if(_0x3866d4['body'][_0xc159('0x2e')]['hasOwnProperty'](_0x10d99e)){db[_0xc159('0x30')][_0xc159('0x31')]({'where':{'channel':_0x10d99e,'membername':_0x3866d4[_0xc159('0x32')][_0xc159('0x2f')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3866d4['body'][_0xc159('0x2e')][_0x10d99e]&&_0x3866d4['body'][_0xc159('0x2e')][_0x10d99e]['length']?{'$notIn':_0x3866d4[_0xc159('0x2d')][_0xc159('0x2e')][_0x10d99e]}:{'$ne':null}}})[_0xc159('0x19')](function(_0x850ca9){var _0x591f96=moment()[_0xc159('0x33')](_0xc159('0x34'));for(var _0x149a69=0x0,_0x3ed31b=_0x850ca9['length'];_0x149a69<_0x3ed31b;_0x149a69+=0x1){_0x850ca9[_0x149a69][_0xc159('0x35')]({'exitAt':_0x591f96});}});for(var _0x277bbb=0x0;_0x277bbb<_0x3866d4[_0xc159('0x2d')][_0xc159('0x2e')][_0x10d99e][_0xc159('0x36')];_0x277bbb+=0x1){db[_0xc159('0x30')]['findOrCreate']({'where':{'channel':_0x10d99e,'membername':_0x3866d4[_0xc159('0x32')][_0xc159('0x2f')],'type':'INTERACTION','uniqueid':_0x3866d4[_0xc159('0x2d')][_0xc159('0x2e')][_0x10d99e][_0x277bbb],'exitAt':null},'defaults':{'channel':_0x10d99e,'membername':_0x3866d4[_0xc159('0x32')][_0xc159('0x2f')],'interface':_[_0xc159('0x13')](_0x3866d4[_0xc159('0x32')][_0xc159('0x37')])?util[_0xc159('0x33')](_0xc159('0x38'),_0x3866d4[_0xc159('0x32')]['name']):_0x3866d4[_0xc159('0x32')]['interface'],'type':_0xc159('0x39'),'enterAt':moment()['format'](_0xc159('0x34')),'role':_0xc159('0x3a'),'internal':_0x3866d4[_0xc159('0x32')][_0xc159('0x3b')],'uniqueid':_0x3866d4[_0xc159('0x2d')]['interaction'][_0x10d99e][_0x277bbb]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3866d4[_0xc159('0x1c')]['id'],'capacity':_0x3866d4[_0xc159('0x2d')][_0xc159('0x3c')]},routingClient)[_0xc159('0x19')](respondWithResult(_0x4f301d,null))[_0xc159('0xe')](handleError(_0x4f301d,null));};exports[_0xc159('0x3d')]=function(_0x5a5532,_0x264ca5){return respondWithRpcPromise(_0xc159('0x3e'),_0x5a5532['query'])[_0xc159('0x19')](respondWithResult(_0x264ca5,null))[_0xc159('0xe')](handleError(_0x264ca5,null));};exports[_0xc159('0x3f')]=function(_0x4c54f6,_0x53c149){return respondWithRpcPromise(_0xc159('0x40'),_0x4c54f6[_0xc159('0x18')])['then'](respondWithResult(_0x53c149,null))[_0xc159('0xe')](handleError(_0x53c149,null));};exports[_0xc159('0x41')]=function(_0x494984,_0x4ca6a4){return respondWithRpcPromise(_0xc159('0x42'),_0x494984[_0xc159('0x18')])[_0xc159('0x19')](respondWithResult(_0x4ca6a4,null))[_0xc159('0xe')](handleError(_0x4ca6a4,null));};exports[_0xc159('0x43')]=function(_0x2cf994,_0x3bae62){return respondWithRpcPromise(_0xc159('0x44'),_0x2cf994[_0xc159('0x18')],routingClient)[_0xc159('0x19')](respondWithResult(_0x3bae62,null))[_0xc159('0xe')](handleError(_0x3bae62,null));};exports[_0xc159('0x45')]=function(_0x3b9e00,_0x2370aa){return respondWithRpcPromise(_0xc159('0x44'),_0x3b9e00[_0xc159('0x18')],routingClient)[_0xc159('0x19')](findById(_0x3b9e00[_0xc159('0x1c')]['id']))[_0xc159('0x19')](respondWithResult(_0x2370aa,null))['catch'](handleError(_0x2370aa,null));};exports[_0xc159('0x46')]=function(_0x3fcbcc,_0x4519e8){return respondWithRpcPromise(_0xc159('0x47'),_0x3fcbcc[_0xc159('0x18')],routingClient)[_0xc159('0x19')](respondWithResult(_0x4519e8,null))[_0xc159('0xe')](handleError(_0x4519e8,null));};exports[_0xc159('0x48')]=function(_0x2e5bea,_0x4f52dd){return respondWithRpcPromise('MailQueues',_0x2e5bea[_0xc159('0x18')],routingClient)[_0xc159('0x19')](findById(_0x2e5bea[_0xc159('0x1c')]['id']))['then'](respondWithResult(_0x4f52dd,null))[_0xc159('0xe')](handleError(_0x4f52dd,null));};exports[_0xc159('0x49')]=function(_0x1ece62,_0x1d53e2){return respondWithRpcPromise(_0xc159('0x4a'),_0x1ece62[_0xc159('0x18')],mailClient)[_0xc159('0x19')](respondWithResult(_0x1d53e2,null))[_0xc159('0xe')](handleError(_0x1d53e2,null));};exports[_0xc159('0x4b')]=function(_0x30af95,_0x28416d){return respondWithRpcPromise(_0xc159('0x4c'),_0x30af95[_0xc159('0x18')],routingClient)[_0xc159('0x19')](respondWithResult(_0x28416d,null))['catch'](handleError(_0x28416d,null));};exports[_0xc159('0x4d')]=function(_0x161473,_0xbdd3dd){return respondWithRpcPromise('OpenchannelQueues',_0x161473['query'],routingClient)[_0xc159('0x19')](findById(_0x161473[_0xc159('0x1c')]['id']))[_0xc159('0x19')](respondWithResult(_0xbdd3dd,null))[_0xc159('0xe')](handleError(_0xbdd3dd,null));};exports['smsQueues']=function(_0x34c214,_0x5ca43a){return respondWithRpcPromise(_0xc159('0x4e'),_0x34c214[_0xc159('0x18')],routingClient)['then'](respondWithResult(_0x5ca43a,null))[_0xc159('0xe')](handleError(_0x5ca43a,null));};exports['showSmsQueues']=function(_0x4a5ed1,_0x33fedf){return respondWithRpcPromise(_0xc159('0x4e'),_0x4a5ed1[_0xc159('0x18')],routingClient)[_0xc159('0x19')](findById(_0x4a5ed1[_0xc159('0x1c')]['id']))[_0xc159('0x19')](respondWithResult(_0x33fedf,null))[_0xc159('0xe')](handleError(_0x33fedf,null));};exports['faxQueues']=function(_0x2d8097,_0x27d7a1){return respondWithRpcPromise('FaxQueues',_0x2d8097[_0xc159('0x18')],routingClient)[_0xc159('0x19')](respondWithResult(_0x27d7a1,null))['catch'](handleError(_0x27d7a1,null));};exports[_0xc159('0x4f')]=function(_0x9e11d0,_0x1f1c54){return respondWithRpcPromise('FaxQueues',_0x9e11d0[_0xc159('0x18')],routingClient)[_0xc159('0x19')](findById(_0x9e11d0[_0xc159('0x1c')]['id']))['then'](respondWithResult(_0x1f1c54,null))[_0xc159('0xe')](handleError(_0x1f1c54,null));};exports['faxAccounts']=function(_0x35b52f,_0x49d57a){return respondWithRpcPromise('FaxAccounts',_0x35b52f[_0xc159('0x18')])[_0xc159('0x19')](respondWithResult(_0x49d57a,null))[_0xc159('0xe')](handleError(_0x49d57a,null));};exports[_0xc159('0x50')]=function(_0x3db3a8,_0x5b34e8){return respondWithRpcPromise(_0xc159('0x51'),_0x3db3a8['query'],routingClient)['then'](respondWithResult(_0x5b34e8,null))['catch'](handleError(_0x5b34e8,null));};exports[_0xc159('0x52')]=function(_0x2d74d5,_0xdfff4f){return respondWithRpcPromise(_0xc159('0x53'),_0x2d74d5[_0xc159('0x18')],routingClient)[_0xc159('0x19')](respondWithResult(_0xdfff4f,null))['catch'](handleError(_0xdfff4f,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2ee008,_0x2d6c1b){return respondWithRpcPromise(_0xc159('0x54'),_0x2ee008['query'],routingClient)[_0xc159('0x19')](respondWithResult(_0x2d6c1b,null))[_0xc159('0xe')](handleError(_0x2d6c1b,null));};exports[_0xc159('0x55')]=function(_0x387c5f,_0x50634d){return respondWithRpcPromise(_0xc159('0x56'),_0x387c5f['query'],routingClient)['then'](respondWithResult(_0x50634d,null))['catch'](handleError(_0x50634d,null));};exports[_0xc159('0x57')]=function(_0x513a8e,_0x1fc3ba){return respondWithRpcPromise(_0xc159('0x58'),_0x513a8e[_0xc159('0x18')],routingClient)[_0xc159('0x19')](respondWithResult(_0x1fc3ba,null))['catch'](handleError(_0x1fc3ba,null));};exports[_0xc159('0x59')]=function(_0x1366f8){return function(_0x371153,_0x2da0c8){var _0x453800,_0x105d7a;var _0x5c7252=_[_0xc159('0x5a')](_0x1366f8);var _0x544ffc=_0x1366f8===_0xc159('0x5b')?_0xc159('0x5c'):_0xc159('0x5d');return db[_0x5c7252+_0xc159('0x5e')][_0xc159('0x5f')]({'raw':!![],'where':{'id':_0x371153[_0xc159('0x1c')]['id']}})[_0xc159('0x19')](function(_0x216ef9){if(_[_0xc159('0x13')](_0x216ef9)){throw new Error(_0x5c7252+_0xc159('0x60'));}_0x453800=_0x216ef9;return db[_0x5c7252+_0xc159('0x61')][_0xc159('0x5f')]({'where':{'id':_0x371153[_0xc159('0x2d')][_0xc159('0x62')]},'include':[{'model':db[_0x5c7252+'Interaction'],'as':_0xc159('0x63')},{'model':db[_0x5c7252+_0x544ffc],'as':_0xc159('0x5d')}]});})[_0xc159('0x19')](function(_0xf94ff){if(_['isNil'](_0xf94ff)){throw new Error(_0x5c7252+_0xc159('0x64'));}_0x105d7a=_0xf94ff;return _0xf94ff[_0xc159('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xc159('0x19')](function(){var _0x260ae0={'uniqueid':_0x1366f8+'.'+_0x105d7a['id']+'.'+_0x105d7a[_0xc159('0x63')]['id'],'FromUserId':_0x371153[_0xc159('0x32')]['id'],'type':_0xc159('0x66')};_0x260ae0[_0x5c7252+'MessageId']=_0x105d7a['id'];_0x260ae0[_0x5c7252+_0xc159('0x67')]=_0x105d7a[_0xc159('0x63')]['id'];_0x260ae0[_0xc159('0x68')+_0x5c7252+_0x544ffc+'Id']=_0x105d7a[_0xc159('0x5d')]['id'];_0x260ae0['To'+_0x5c7252+'QueueId']=_0x453800['id'];return db[_0x5c7252+'TransferReport']['create'](_0x260ae0);})['then'](function(){return respondWithRpcPromise(_0xc159('0x69'),{'channel':_0x1366f8,'interaction':_0x105d7a['Interaction'],'message':_0x105d7a,'account':_0x105d7a[_0xc159('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xc159('0x66'),'appdata':_0x453800[_0xc159('0x2f')]+','+(_0x105d7a[_0xc159('0x5d')][_0xc159('0x6a')]||0x12c),'interval':_0xc159('0x6b')}]},routingClient);})[_0xc159('0x19')](respondWithResult(_0x2da0c8,null))[_0xc159('0xe')](handleError(_0x2da0c8,null));};};exports['agentNotify']=function(_0x2170be,_0x10fc33){var _0x389496,_0x5b4aaa;if(_['isNil'](_0x2170be[_0xc159('0x2d')][_0xc159('0x6c')])){throw new Error(_0xc159('0x6d'));}var _0x5d54b8=_0x2170be[_0xc159('0x2d')]['channel'];var _0x1aa57d=_[_0xc159('0x5a')](_0x5d54b8);var _0x9c6db9=_0x5d54b8===_0xc159('0x5b')?'Website':_0xc159('0x5d');return db['User'][_0xc159('0x5f')]({'raw':!![],'where':{'id':_0x2170be['params']['id'],'role':'agent'}})['then'](function(_0x37cbd8){if(_[_0xc159('0x13')](_0x37cbd8)){throw new Error(_0xc159('0x6e'));}_0x389496=_0x37cbd8;return db[_0x1aa57d+'Message'][_0xc159('0x5f')]({'where':{'id':_0x2170be[_0xc159('0x2d')]['messageId']},'include':[{'model':db[_0x1aa57d+_0xc159('0x63')],'as':_0xc159('0x63')},{'model':db[_0x1aa57d+_0x9c6db9],'as':_0xc159('0x5d')}]});})[_0xc159('0x19')](function(_0x2b7f8a){if(_['isNil'](_0x2b7f8a)){throw new Error(_0x1aa57d+_0xc159('0x64'));}_0x5b4aaa=_0x2b7f8a;return _0x2b7f8a[_0xc159('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xc159('0x19')](function(){var _0x57be15={'uniqueid':_0x5d54b8+'.'+_0x5b4aaa['id']+'.'+_0x5b4aaa['Interaction']['id'],'FromUserId':_0x2170be['user']['id'],'type':_0xc159('0x66'),'ToUserId':_0x389496['id']};_0x57be15[_0x1aa57d+'MessageId']=_0x5b4aaa['id'];_0x57be15[_0x1aa57d+'InteractionId']=_0x5b4aaa[_0xc159('0x63')]['id'];_0x57be15[_0xc159('0x68')+_0x1aa57d+_0x9c6db9+'Id']=_0x5b4aaa['Account']['id'];return db[_0x1aa57d+_0xc159('0x6f')][_0xc159('0x70')](_0x57be15);})[_0xc159('0x19')](function(){return respondWithRpcPromise(_0xc159('0x69'),{'channel':_0x5d54b8,'interaction':_0x5b4aaa[_0xc159('0x63')],'message':_0x5b4aaa,'account':_0x5b4aaa[_0xc159('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x389496[_0xc159('0x2f')]+','+(_0x5b4aaa[_0xc159('0x5d')]['agentTransferTimeout']||0x12c),'interval':_0xc159('0x6b')}]},routingClient);})[_0xc159('0x19')](respondWithResult(_0x10fc33,null))[_0xc159('0xe')](handleError(_0x10fc33,null));};