Built motion from commit (unavailable).|2.2.1
[motion2.git] / server / api / rpc / rpc.controller.js
index 46e063c..e5c193d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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));};
\ No newline at end of file
+var _0x4d72=['faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','create','Start','queueTransferTimeout','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','agent','Agent\x20not\x20found','TransferReport','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','client','http','then','error','code','message','result','catch','json','sendStatus','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','body','interaction','user','hasOwnProperty','MemberReport','length','format','updateAttributes','findOrCreate','INTERACTION','SIP/%s','interface','AgentCapacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','faxQueues','showFaxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x42f2ba,_0x454a98){var _0x18ead4=function(_0x3b7bfe){while(--_0x3b7bfe){_0x42f2ba['push'](_0x42f2ba['shift']());}};_0x18ead4(++_0x454a98);}(_0x4d72,0x15c));var _0x24d7=function(_0x4c62db,_0x31f9bf){_0x4c62db=_0x4c62db-0x0;var _0x48e398=_0x4d72[_0x4c62db];return _0x48e398;};'use strict';var BPromise=require(_0x24d7('0x0'));var moment=require(_0x24d7('0x1'));var _=require(_0x24d7('0x2'));var util=require(_0x24d7('0x3'));var db=require(_0x24d7('0x4'))['db'];var logger=require(_0x24d7('0x5'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x24d7('0x6')][_0x24d7('0x7')]({'port':0x232a});var mailClient=jayson[_0x24d7('0x6')][_0x24d7('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0x24d7('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x5bc84d,_0x3b32d8,_0x595b1f){return new BPromise(function(_0x4386b1,_0x24d118){var _0x2feb58=_0x595b1f?_0x595b1f:amiClient;return _0x2feb58['request'](_0x5bc84d,_0x3b32d8)[_0x24d7('0x8')](function(_0x1242e5){if(_0x1242e5[_0x24d7('0x9')]){if(_0x1242e5[_0x24d7('0x9')][_0x24d7('0xa')]===0x1f4){return _0x24d118(_0x1242e5[_0x24d7('0x9')][_0x24d7('0xb')]);}return _0x4386b1(_0x1242e5[_0x24d7('0x9')]['message']);}else{_0x4386b1(_0x1242e5[_0x24d7('0xc')]);}})[_0x24d7('0xd')](function(_0xc1d066){_0x24d118(_0xc1d066);});});}function respondWithResult(_0x568693,_0x4cd490){_0x4cd490=_0x4cd490||0xc8;return function(_0x4aaba9){if(_0x4aaba9){return _0x568693['status'](_0x4cd490)[_0x24d7('0xe')](_0x4aaba9);}return _0x568693[_0x24d7('0xf')](0x194);};}function handleError(_0x3e0b68,_0x5356b9){_0x5356b9=_0x5356b9||0x1f4;return function(_0x292c64){logger[_0x24d7('0x9')](_0x292c64['stack']);if(_0x292c64['name']){delete _0x292c64[_0x24d7('0x10')];}_0x3e0b68['status'](_0x5356b9)[_0x24d7('0x11')](_0x292c64);};}function findById(_0x54829f){return function(_0x3d89c9){if(!_[_0x24d7('0x12')](_0x54829f)&&!_['isNil'](_0x3d89c9)&&!_['isNil'](_0x3d89c9[_0x24d7('0x13')])){return _[_0x24d7('0x14')](_0x3d89c9[_0x24d7('0x13')],function(_0x2b0329){return _0x2b0329['id']==_0x54829f;});}return null;};}exports[_0x24d7('0x15')]=function(_0x18f594,_0x3cb904){return respondWithRpcPromise('VoiceChannels',_0x18f594[_0x24d7('0x16')])[_0x24d7('0x8')](respondWithResult(_0x3cb904,null))[_0x24d7('0xd')](handleError(_0x3cb904,null));};exports[_0x24d7('0x17')]=function(_0x1ae362,_0x177481){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x24d7('0x18')](_0x1ae362[_0x24d7('0x16')],_0x1ae362[_0x24d7('0x19')]))[_0x24d7('0x8')](respondWithResult(_0x177481,null))[_0x24d7('0xd')](handleError(_0x177481,null));};exports[_0x24d7('0x1a')]=function(_0x14a1d6,_0xe362b9){return respondWithRpcPromise(_0x24d7('0x1b'),_[_0x24d7('0x18')](_0x14a1d6['query'],_0x14a1d6[_0x24d7('0x19')]))[_0x24d7('0x8')](respondWithResult(_0xe362b9,null))['catch'](handleError(_0xe362b9,null));};exports['voiceQueues']=function(_0x2a066a,_0xbdb59b){return respondWithRpcPromise(_0x24d7('0x1c'),_0x2a066a[_0x24d7('0x16')])[_0x24d7('0x8')](respondWithResult(_0xbdb59b,null))[_0x24d7('0xd')](handleError(_0xbdb59b,null));};exports[_0x24d7('0x1d')]=function(_0x507cfe,_0x2b1390){return respondWithRpcPromise(_0x24d7('0x1c'),_0x507cfe[_0x24d7('0x16')])[_0x24d7('0x8')](findById(_0x507cfe[_0x24d7('0x19')]['id']))[_0x24d7('0x8')](respondWithResult(_0x2b1390,null))[_0x24d7('0xd')](handleError(_0x2b1390,null));};exports['voiceQueuesPreview']=function(_0x1e74c0,_0x7896b7){return respondWithRpcPromise(_0x24d7('0x1e'),_[_0x24d7('0x18')](_0x1e74c0['query'],_0x1e74c0['params']))[_0x24d7('0x8')](respondWithResult(_0x7896b7,null))[_0x24d7('0xd')](handleError(_0x7896b7,null));};exports[_0x24d7('0x1f')]=function(_0x5e0e48,_0x4b59a5){return respondWithRpcPromise(_0x24d7('0x20'),_0x5e0e48[_0x24d7('0x16')])[_0x24d7('0x8')](respondWithResult(_0x4b59a5,null))[_0x24d7('0xd')](handleError(_0x4b59a5,null));};exports[_0x24d7('0x21')]=function(_0x2c9a6c,_0x501f44){return respondWithRpcPromise(_0x24d7('0x22'),_['merge'](_0x2c9a6c[_0x24d7('0x16')],_0x2c9a6c['params']))[_0x24d7('0x8')](respondWithResult(_0x501f44,null))[_0x24d7('0xd')](handleError(_0x501f44,null));};exports['voiceQueuesChannelHangup']=function(_0x3779fd,_0x53ccaa){return respondWithRpcPromise(_0x24d7('0x23'),_[_0x24d7('0x18')](_0x3779fd[_0x24d7('0x16')],_0x3779fd['params']))['then'](respondWithResult(_0x53ccaa,null))['catch'](handleError(_0x53ccaa,null));};exports['voiceQueuesChannelRedirect']=function(_0x3c453d,_0x12b06e){return respondWithRpcPromise(_0x24d7('0x24'),_[_0x24d7('0x18')](_0x3c453d['query'],_0x3c453d['params']))[_0x24d7('0x8')](respondWithResult(_0x12b06e,null))[_0x24d7('0xd')](handleError(_0x12b06e,null));};exports[_0x24d7('0x25')]=function(_0x5cc2ae,_0x1bbb4f){return respondWithRpcPromise(_0x24d7('0x26'),_0x5cc2ae[_0x24d7('0x16')])[_0x24d7('0x8')](respondWithResult(_0x1bbb4f,null))['catch'](handleError(_0x1bbb4f,null));};exports['outboundChannels']=function(_0x2ad886,_0x1c8fe3){return respondWithRpcPromise(_0x24d7('0x27'),_0x2ad886[_0x24d7('0x16')])[_0x24d7('0x8')](respondWithResult(_0x1c8fe3,null))[_0x24d7('0xd')](handleError(_0x1c8fe3,null));};exports['agents']=function(_0x1dc773,_0x270be1){var _0x3d0eb9;return respondWithRpcPromise('Agents',_0x1dc773['query'])['then'](function(_0x22c875){_0x3d0eb9=_0x22c875;return respondWithRpcPromise(_0x24d7('0x28'),_0x1dc773[_0x24d7('0x16')],routingClient);})[_0x24d7('0x8')](function(_0x3b0ca0){return _[_0x24d7('0x18')]({},_0x3b0ca0,_0x3d0eb9);})['then'](respondWithResult(_0x270be1,null))[_0x24d7('0xd')](handleError(_0x270be1,null));};exports['agentCapacity']=function(_0x299326,_0x38db2e){if(_0x299326[_0x24d7('0x29')]&&_0x299326[_0x24d7('0x29')][_0x24d7('0x2a')]&&_0x299326[_0x24d7('0x2b')]&&_0x299326[_0x24d7('0x2b')][_0x24d7('0x10')]){for(var _0x4c51ca in _0x299326[_0x24d7('0x29')]['interaction']){if(_0x299326['body']['interaction'][_0x24d7('0x2c')](_0x4c51ca)){db[_0x24d7('0x2d')]['findAll']({'where':{'channel':_0x4c51ca,'membername':_0x299326['user'][_0x24d7('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x299326[_0x24d7('0x29')][_0x24d7('0x2a')][_0x4c51ca]&&_0x299326[_0x24d7('0x29')][_0x24d7('0x2a')][_0x4c51ca][_0x24d7('0x2e')]?{'$notIn':_0x299326['body']['interaction'][_0x4c51ca]}:{'$ne':null}}})['then'](function(_0x38ee8b){var _0x3c4a07=moment()[_0x24d7('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x14b659=0x0,_0x25b5c7=_0x38ee8b['length'];_0x14b659<_0x25b5c7;_0x14b659+=0x1){_0x38ee8b[_0x14b659][_0x24d7('0x30')]({'exitAt':_0x3c4a07});}});for(var _0x3e89ef=0x0;_0x3e89ef<_0x299326[_0x24d7('0x29')][_0x24d7('0x2a')][_0x4c51ca][_0x24d7('0x2e')];_0x3e89ef+=0x1){db[_0x24d7('0x2d')][_0x24d7('0x31')]({'where':{'channel':_0x4c51ca,'membername':_0x299326[_0x24d7('0x2b')][_0x24d7('0x10')],'type':_0x24d7('0x32'),'uniqueid':_0x299326[_0x24d7('0x29')]['interaction'][_0x4c51ca][_0x3e89ef],'exitAt':null},'defaults':{'channel':_0x4c51ca,'membername':_0x299326[_0x24d7('0x2b')][_0x24d7('0x10')],'interface':_[_0x24d7('0x12')](_0x299326[_0x24d7('0x2b')]['interface'])?util['format'](_0x24d7('0x33'),_0x299326[_0x24d7('0x2b')]['name']):_0x299326['user'][_0x24d7('0x34')],'type':'INTERACTION','enterAt':moment()[_0x24d7('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x299326[_0x24d7('0x2b')]['internal'],'uniqueid':_0x299326[_0x24d7('0x29')][_0x24d7('0x2a')][_0x4c51ca][_0x3e89ef]}});}}}}return respondWithRpcPromise(_0x24d7('0x35'),{'id':_0x299326[_0x24d7('0x19')]['id'],'capacity':_0x299326[_0x24d7('0x29')]['capacity']},routingClient)[_0x24d7('0x8')](respondWithResult(_0x38db2e,null))[_0x24d7('0xd')](handleError(_0x38db2e,null));};exports[_0x24d7('0x36')]=function(_0x550910,_0x3cb4c7){return respondWithRpcPromise('Telephones',_0x550910[_0x24d7('0x16')])[_0x24d7('0x8')](respondWithResult(_0x3cb4c7,null))[_0x24d7('0xd')](handleError(_0x3cb4c7,null));};exports[_0x24d7('0x37')]=function(_0x5b6c24,_0x3586d5){return respondWithRpcPromise(_0x24d7('0x38'),_0x5b6c24['query'])[_0x24d7('0x8')](respondWithResult(_0x3586d5,null))[_0x24d7('0xd')](handleError(_0x3586d5,null));};exports[_0x24d7('0x39')]=function(_0x3c3c94,_0x1613b8){return respondWithRpcPromise(_0x24d7('0x3a'),_0x3c3c94['query'])[_0x24d7('0x8')](respondWithResult(_0x1613b8,null))[_0x24d7('0xd')](handleError(_0x1613b8,null));};exports[_0x24d7('0x3b')]=function(_0x254d91,_0x54c84b){return respondWithRpcPromise('ChatQueues',_0x254d91['query'],routingClient)['then'](respondWithResult(_0x54c84b,null))['catch'](handleError(_0x54c84b,null));};exports[_0x24d7('0x3c')]=function(_0x32558e,_0x58ace6){return respondWithRpcPromise('ChatQueues',_0x32558e[_0x24d7('0x16')],routingClient)['then'](findById(_0x32558e['params']['id']))[_0x24d7('0x8')](respondWithResult(_0x58ace6,null))[_0x24d7('0xd')](handleError(_0x58ace6,null));};exports[_0x24d7('0x3d')]=function(_0x47dae0,_0x2f2a5d){return respondWithRpcPromise(_0x24d7('0x3e'),_0x47dae0[_0x24d7('0x16')],routingClient)[_0x24d7('0x8')](respondWithResult(_0x2f2a5d,null))['catch'](handleError(_0x2f2a5d,null));};exports[_0x24d7('0x3f')]=function(_0x446e0b,_0x2ba195){return respondWithRpcPromise(_0x24d7('0x3e'),_0x446e0b[_0x24d7('0x16')],routingClient)[_0x24d7('0x8')](findById(_0x446e0b[_0x24d7('0x19')]['id']))[_0x24d7('0x8')](respondWithResult(_0x2ba195,null))['catch'](handleError(_0x2ba195,null));};exports[_0x24d7('0x40')]=function(_0x49dd10,_0x50da88){return respondWithRpcPromise(_0x24d7('0x41'),_0x49dd10[_0x24d7('0x16')],mailClient)[_0x24d7('0x8')](respondWithResult(_0x50da88,null))['catch'](handleError(_0x50da88,null));};exports[_0x24d7('0x42')]=function(_0x68171f,_0x5c0fdb){return respondWithRpcPromise('OpenchannelQueues',_0x68171f['query'],routingClient)[_0x24d7('0x8')](respondWithResult(_0x5c0fdb,null))['catch'](handleError(_0x5c0fdb,null));};exports['showOpenchannelQueues']=function(_0x5422b2,_0x2802a7){return respondWithRpcPromise(_0x24d7('0x43'),_0x5422b2['query'],routingClient)[_0x24d7('0x8')](findById(_0x5422b2['params']['id']))[_0x24d7('0x8')](respondWithResult(_0x2802a7,null))[_0x24d7('0xd')](handleError(_0x2802a7,null));};exports[_0x24d7('0x44')]=function(_0x3ca50d,_0x32fd50){return respondWithRpcPromise(_0x24d7('0x45'),_0x3ca50d[_0x24d7('0x16')],routingClient)['then'](respondWithResult(_0x32fd50,null))[_0x24d7('0xd')](handleError(_0x32fd50,null));};exports['showSmsQueues']=function(_0x369e4b,_0x12e97d){return respondWithRpcPromise('SmsQueues',_0x369e4b[_0x24d7('0x16')],routingClient)[_0x24d7('0x8')](findById(_0x369e4b['params']['id']))[_0x24d7('0x8')](respondWithResult(_0x12e97d,null))[_0x24d7('0xd')](handleError(_0x12e97d,null));};exports[_0x24d7('0x46')]=function(_0x1587ed,_0x43910b){return respondWithRpcPromise('FaxQueues',_0x1587ed[_0x24d7('0x16')],routingClient)[_0x24d7('0x8')](respondWithResult(_0x43910b,null))[_0x24d7('0xd')](handleError(_0x43910b,null));};exports[_0x24d7('0x47')]=function(_0x55e447,_0xffa697){return respondWithRpcPromise(_0x24d7('0x48'),_0x55e447[_0x24d7('0x16')],routingClient)[_0x24d7('0x8')](findById(_0x55e447[_0x24d7('0x19')]['id']))['then'](respondWithResult(_0xffa697,null))['catch'](handleError(_0xffa697,null));};exports['faxAccounts']=function(_0x107369,_0x679e2){return respondWithRpcPromise('FaxAccounts',_0x107369[_0x24d7('0x16')])[_0x24d7('0x8')](respondWithResult(_0x679e2,null))['catch'](handleError(_0x679e2,null));};exports[_0x24d7('0x49')]=function(_0x7382e3,_0x17b55c){return respondWithRpcPromise(_0x24d7('0x4a'),_0x7382e3['query'],routingClient)['then'](respondWithResult(_0x17b55c,null))['catch'](handleError(_0x17b55c,null));};exports[_0x24d7('0x4b')]=function(_0x51217b,_0x1f6f87){return respondWithRpcPromise(_0x24d7('0x4c'),_0x51217b[_0x24d7('0x16')],routingClient)[_0x24d7('0x8')](respondWithResult(_0x1f6f87,null))[_0x24d7('0xd')](handleError(_0x1f6f87,null));};exports[_0x24d7('0x4d')]=function(_0xd9c5a1,_0x2cc9d8){return respondWithRpcPromise(_0x24d7('0x4e'),_0xd9c5a1[_0x24d7('0x16')],routingClient)[_0x24d7('0x8')](respondWithResult(_0x2cc9d8,null))[_0x24d7('0xd')](handleError(_0x2cc9d8,null));};exports[_0x24d7('0x4f')]=function(_0x3d7dd6,_0x264545){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x3d7dd6['query'],routingClient)['then'](respondWithResult(_0x264545,null))[_0x24d7('0xd')](handleError(_0x264545,null));};exports[_0x24d7('0x50')]=function(_0x436649,_0x59c390){return respondWithRpcPromise(_0x24d7('0x51'),_0x436649[_0x24d7('0x16')],routingClient)['then'](respondWithResult(_0x59c390,null))[_0x24d7('0xd')](handleError(_0x59c390,null));};exports[_0x24d7('0x52')]=function(_0x454bf7){return function(_0x5432d2,_0x1db9af){var _0x407f6c,_0x45b7b0;var _0x46dcbf=_['capitalize'](_0x454bf7);var _0x4820cb=_0x454bf7===_0x24d7('0x53')?'Website':_0x24d7('0x54');return db[_0x46dcbf+'Queue'][_0x24d7('0x55')]({'raw':!![],'where':{'id':_0x5432d2[_0x24d7('0x19')]['id']}})[_0x24d7('0x8')](function(_0xfaaf0){if(_[_0x24d7('0x12')](_0xfaaf0)){throw new Error(_0x46dcbf+_0x24d7('0x56'));}_0x407f6c=_0xfaaf0;return db[_0x46dcbf+_0x24d7('0x57')][_0x24d7('0x55')]({'where':{'id':_0x5432d2[_0x24d7('0x29')][_0x24d7('0x58')]},'include':[{'model':db[_0x46dcbf+_0x24d7('0x59')],'as':_0x24d7('0x59')},{'model':db[_0x46dcbf+_0x4820cb],'as':_0x24d7('0x54')}]});})[_0x24d7('0x8')](function(_0x5907b7){if(_['isNil'](_0x5907b7)){throw new Error(_0x46dcbf+_0x24d7('0x5a'));}_0x45b7b0=_0x5907b7;return _0x5907b7[_0x24d7('0x5b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x24d7('0x8')](function(){var _0x44ad2e={'uniqueid':_0x454bf7+'.'+_0x45b7b0['id']+'.'+_0x45b7b0[_0x24d7('0x59')]['id'],'FromUserId':_0x5432d2[_0x24d7('0x2b')]['id'],'type':_0x24d7('0x5c')};_0x44ad2e[_0x46dcbf+_0x24d7('0x5d')]=_0x45b7b0['id'];_0x44ad2e[_0x46dcbf+_0x24d7('0x5e')]=_0x45b7b0[_0x24d7('0x59')]['id'];_0x44ad2e[_0x24d7('0x5f')+_0x46dcbf+_0x4820cb+'Id']=_0x45b7b0['Account']['id'];_0x44ad2e['To'+_0x46dcbf+'QueueId']=_0x407f6c['id'];return db[_0x46dcbf+'TransferReport'][_0x24d7('0x60')](_0x44ad2e);})['then'](function(){return respondWithRpcPromise(_0x24d7('0x61'),{'channel':_0x454bf7,'interaction':_0x45b7b0[_0x24d7('0x59')],'message':_0x45b7b0,'account':_0x45b7b0[_0x24d7('0x54')],'applications':[{'id':0x0,'priority':0x1,'app':_0x24d7('0x5c'),'appdata':_0x407f6c[_0x24d7('0x10')]+','+(_0x45b7b0[_0x24d7('0x54')][_0x24d7('0x62')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1db9af,null))[_0x24d7('0xd')](handleError(_0x1db9af,null));};};exports['agentNotify']=function(_0x574059,_0x3a0943){var _0x14979e,_0x5a71e7;if(_[_0x24d7('0x12')](_0x574059[_0x24d7('0x29')][_0x24d7('0x63')])){throw new Error(_0x24d7('0x64'));}var _0x17006f=_0x574059['body'][_0x24d7('0x63')];var _0x4d30cf=_[_0x24d7('0x65')](_0x17006f);var _0x4f0ef9=_0x17006f===_0x24d7('0x53')?'Website':'Account';return db[_0x24d7('0x66')][_0x24d7('0x55')]({'raw':!![],'where':{'id':_0x574059['params']['id'],'role':_0x24d7('0x67')}})[_0x24d7('0x8')](function(_0x9df56d){if(_[_0x24d7('0x12')](_0x9df56d)){throw new Error(_0x24d7('0x68'));}_0x14979e=_0x9df56d;return db[_0x4d30cf+_0x24d7('0x57')][_0x24d7('0x55')]({'where':{'id':_0x574059[_0x24d7('0x29')]['messageId']},'include':[{'model':db[_0x4d30cf+'Interaction'],'as':_0x24d7('0x59')},{'model':db[_0x4d30cf+_0x4f0ef9],'as':'Account'}]});})[_0x24d7('0x8')](function(_0xd0257a){if(_[_0x24d7('0x12')](_0xd0257a)){throw new Error(_0x4d30cf+_0x24d7('0x5a'));}_0x5a71e7=_0xd0257a;return _0xd0257a[_0x24d7('0x5b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x24d7('0x8')](function(){var _0x3ffeb4={'uniqueid':_0x17006f+'.'+_0x5a71e7['id']+'.'+_0x5a71e7['Interaction']['id'],'FromUserId':_0x574059['user']['id'],'type':'queue','ToUserId':_0x14979e['id']};_0x3ffeb4[_0x4d30cf+'MessageId']=_0x5a71e7['id'];_0x3ffeb4[_0x4d30cf+'InteractionId']=_0x5a71e7[_0x24d7('0x59')]['id'];_0x3ffeb4[_0x24d7('0x5f')+_0x4d30cf+_0x4f0ef9+'Id']=_0x5a71e7[_0x24d7('0x54')]['id'];return db[_0x4d30cf+_0x24d7('0x69')][_0x24d7('0x60')](_0x3ffeb4);})[_0x24d7('0x8')](function(){return respondWithRpcPromise(_0x24d7('0x61'),{'channel':_0x17006f,'interaction':_0x5a71e7[_0x24d7('0x59')],'message':_0x5a71e7,'account':_0x5a71e7[_0x24d7('0x54')],'applications':[{'id':0x0,'priority':0x1,'app':_0x24d7('0x67'),'appdata':_0x14979e[_0x24d7('0x10')]+','+(_0x5a71e7[_0x24d7('0x54')]['agentTransferTimeout']||0x12c),'interval':_0x24d7('0x6a')}]},routingClient);})[_0x24d7('0x8')](respondWithResult(_0x3a0943,null))[_0x24d7('0xd')](handleError(_0x3a0943,null));};
\ No newline at end of file