Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / rpc / rpc.controller.js
index d964a24..883d0cc 100644 (file)
@@ -1 +1 @@
-const a527_0x3930=['showFaxQueues','queueTransferTimeout','../../mysqldb','VoiceChannelStopMixMonitor','showWhatsappQueues','undefined','MessageId','status','WhatsappQueues','VoiceChannelMixMonitor','InteractionId','notIn','FaxQueuesWaitingInteractions','mailQueues','interface','SmsQueues','Telephones','Channel\x20field\x20is\x20mandatory','filter','http','isNil','../../config/logger','find','showChatQueues','mailQueuesWaitingInteractions','agentCapacity','findOrCreate','\x20Queue\x20not\x20found','VoiceQueuesChannel','agentTransferTimeout','agent','catch','value','findAll','json','faxQueuesWaitingInteractions','query','faxQueues','merge','rows','interaction','create','Website','Campaigns','whatsappQueuesWaitingInteractions','then','queueNotify','FaxAccounts','faxAccounts','send','*,*,*,*','voiceQueuesPreview','params','VoiceQueuesChannelRedirect','From','queue','moment','openchannelQueuesIdWaitingInteractions','outboundChannels','INTERACTION','QueueId','MailQueues','TransferReport','VoiceQueuesPreview','capitalize','MailAccounts','showOpenchannelQueues','messageId','api','length','FaxQueues','type','error','sequelize','voiceQueuesChannelHangup','showVoiceQueues','map','voiceQueuesChannel','util','VoiceQueues','voiceQueuesChannels','findOne','whatsappQueues','\x20Message\x20not\x20found','VoiceQueuesChannelHangup','Queue','stack','outbound','queue_id','client','MailQueuesWaitingInteractions','Message','OpenchannelQueuesWaitingInteractions','Agents','agentNotify','name','body','ChatQueues','voiceQueuesChannelRedirect','user','Interaction','jayson/promise','message','chatQueuesWaitingInteractions','MemberReport','chat','showSmsQueues','sendStatus','telephones','internal','Start','format','Account','showMailQueues','YYYY-MM-DD\x20HH:mm:ss','campaigns','voiceChannelMixMonitor','lodash','OutboundChannels','update'];(function(_0x4ccefd,_0x393020){const _0x398f54=function(_0x586d2c){while(--_0x586d2c){_0x4ccefd['push'](_0x4ccefd['shift']());}};_0x398f54(++_0x393020);}(a527_0x3930,0x87));const a527_0x398f=function(_0x4ccefd,_0x393020){_0x4ccefd=_0x4ccefd-0x0;let _0x398f54=a527_0x3930[_0x4ccefd];return _0x398f54;};const _0x2f2bba=a527_0x398f;'use strict';const moment=require(_0x2f2bba('0x29')),_=require(_0x2f2bba('0x66')),util=require(_0x2f2bba('0x3f')),db=require(_0x2f2bba('0x6b'))['db'],{Op}=require(_0x2f2bba('0x3a')),logger=require(_0x2f2bba('0x6'))(_0x2f2bba('0x35')),jayson=require(_0x2f2bba('0x56')),amiClient=jayson[_0x2f2bba('0x4a')][_0x2f2bba('0x4')]({'port':0x232a}),mailClient=jayson[_0x2f2bba('0x4a')][_0x2f2bba('0x4')]({'port':0x232b}),routingClient=jayson[_0x2f2bba('0x4a')][_0x2f2bba('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x586d2c,_0x3b8ca4,_0x51fbeb){return new Promise(function(_0x3c3416,_0x3fc71b){const _0x402f9d=a527_0x398f,_0x5308a4=_0x51fbeb?_0x51fbeb:amiClient;return _0x5308a4['request'](_0x586d2c,_0x3b8ca4)[_0x402f9d('0x1e')](function(_0x1404cc){const _0x145a55=_0x402f9d;if(_0x1404cc[_0x145a55('0x39')]){if(_0x1404cc['error']['code']===0x1f4)return _0x3fc71b(_0x1404cc[_0x145a55('0x39')][_0x145a55('0x57')]);return _0x3c3416(_0x1404cc['error'][_0x145a55('0x57')]);}else _0x3c3416(_0x1404cc['result']);})[_0x402f9d('0x10')](function(_0x1e945d){_0x3fc71b(_0x1e945d);});});}function respondWithResult(_0x442d55,_0x48273d){return _0x48273d=_0x48273d||0xc8,function(_0x7911e0){const _0x8ab63d=a527_0x398f;if(_0x7911e0)return _0x442d55[_0x8ab63d('0x70')](_0x48273d)[_0x8ab63d('0x13')](_0x7911e0);return _0x442d55[_0x8ab63d('0x5c')](0x194);};}function handleError(_0x3490d6,_0x56e794){return _0x56e794=_0x56e794||0x1f4,function(_0x396851){const _0x31db4d=a527_0x398f;logger[_0x31db4d('0x39')](_0x396851[_0x31db4d('0x47')]),_0x396851[_0x31db4d('0x50')]&&delete _0x396851['name'],_0x3490d6[_0x31db4d('0x70')](_0x56e794)[_0x31db4d('0x22')](_0x396851);};}function findById(_0xf09d0d){return function(_0x5a8636){const _0x1388b3=a527_0x398f;if(!_[_0x1388b3('0x5')](_0xf09d0d)&&!_['isNil'](_0x5a8636)&&!_[_0x1388b3('0x5')](_0x5a8636[_0x1388b3('0x18')]))return _[_0x1388b3('0x7')](_0x5a8636[_0x1388b3('0x18')],function(_0x58b11b){return _0x58b11b['id']==_0xf09d0d;});return null;};}exports['voiceChannels']=function(_0x266237,_0x1fbfd3){const _0x5b3300=_0x2f2bba;return respondWithRpcPromise('VoiceChannels',_0x266237[_0x5b3300('0x15')])['then'](respondWithResult(_0x1fbfd3,null))[_0x5b3300('0x10')](handleError(_0x1fbfd3,null));},exports[_0x2f2bba('0x65')]=function(_0x645dd0,_0x15dc4e){const _0x15aa85=_0x2f2bba;return respondWithRpcPromise(_0x15aa85('0x72'),_[_0x15aa85('0x17')](_0x645dd0['query'],_0x645dd0[_0x15aa85('0x25')]))[_0x15aa85('0x1e')](respondWithResult(_0x15dc4e,null))[_0x15aa85('0x10')](handleError(_0x15dc4e,null));},exports['voiceChannelStopMixMonitor']=function(_0x3dda8d,_0x2b42db){const _0x413f29=_0x2f2bba;return respondWithRpcPromise(_0x413f29('0x6c'),_[_0x413f29('0x17')](_0x3dda8d[_0x413f29('0x15')],_0x3dda8d[_0x413f29('0x25')]))[_0x413f29('0x1e')](respondWithResult(_0x2b42db,null))[_0x413f29('0x10')](handleError(_0x2b42db,null));},exports['voiceQueues']=function(_0x310b6d,_0x2495c4){const _0x125552=_0x2f2bba;return respondWithRpcPromise(_0x125552('0x40'),_0x310b6d[_0x125552('0x15')])[_0x125552('0x1e')](respondWithResult(_0x2495c4,null))[_0x125552('0x10')](handleError(_0x2495c4,null));},exports[_0x2f2bba('0x3c')]=function(_0x2e444b,_0x49023d){const _0x384225=_0x2f2bba;return respondWithRpcPromise(_0x384225('0x40'),_0x2e444b[_0x384225('0x15')])[_0x384225('0x1e')](findById(_0x2e444b['params']['id']))[_0x384225('0x1e')](respondWithResult(_0x49023d,null))['catch'](handleError(_0x49023d,null));},exports[_0x2f2bba('0x24')]=function(_0x287020,_0x45d07e){const _0x3253f6=_0x2f2bba;return respondWithRpcPromise(_0x3253f6('0x30'),_[_0x3253f6('0x17')](_0x287020[_0x3253f6('0x15')],_0x287020[_0x3253f6('0x25')]))[_0x3253f6('0x1e')](respondWithResult(_0x45d07e,null))[_0x3253f6('0x10')](handleError(_0x45d07e,null));},exports[_0x2f2bba('0x41')]=function(_0x149afd,_0x551953){const _0x4ebcc4=_0x2f2bba;return respondWithRpcPromise('VoiceQueuesChannels',_0x149afd[_0x4ebcc4('0x15')])['then'](respondWithResult(_0x551953,null))[_0x4ebcc4('0x10')](handleError(_0x551953,null));},exports[_0x2f2bba('0x3e')]=function(_0x4eae3c,_0x484030){const _0x31426e=_0x2f2bba;return respondWithRpcPromise(_0x31426e('0xd'),_['merge'](_0x4eae3c[_0x31426e('0x15')],_0x4eae3c[_0x31426e('0x25')]))[_0x31426e('0x1e')](respondWithResult(_0x484030,null))[_0x31426e('0x10')](handleError(_0x484030,null));},exports[_0x2f2bba('0x3b')]=function(_0x1f56e8,_0x32e287){const _0xa009d=_0x2f2bba;return respondWithRpcPromise(_0xa009d('0x45'),_['merge'](_0x1f56e8[_0xa009d('0x15')],_0x1f56e8[_0xa009d('0x25')]))['then'](respondWithResult(_0x32e287,null))[_0xa009d('0x10')](handleError(_0x32e287,null));},exports[_0x2f2bba('0x53')]=function(_0x8b7555,_0x497b4c){const _0x4f83cc=_0x2f2bba;return respondWithRpcPromise(_0x4f83cc('0x26'),_[_0x4f83cc('0x17')](_0x8b7555[_0x4f83cc('0x15')],_0x8b7555[_0x4f83cc('0x25')]))[_0x4f83cc('0x1e')](respondWithResult(_0x497b4c,null))[_0x4f83cc('0x10')](handleError(_0x497b4c,null));},exports[_0x2f2bba('0x48')]=function(_0x377f76,_0x2de10e){const _0x4c0603=_0x2f2bba;return respondWithRpcPromise('Outbound',_0x377f76[_0x4c0603('0x15')])[_0x4c0603('0x1e')](respondWithResult(_0x2de10e,null))[_0x4c0603('0x10')](handleError(_0x2de10e,null));},exports[_0x2f2bba('0x2b')]=function(_0x2ae894,_0x418818){const _0x462b41=_0x2f2bba;return respondWithRpcPromise(_0x462b41('0x67'),_0x2ae894[_0x462b41('0x15')])['then'](respondWithResult(_0x418818,null))[_0x462b41('0x10')](handleError(_0x418818,null));},exports['agents']=function(_0x38609c,_0x2a074){const _0x4dae36=_0x2f2bba;let _0x31fc60;return respondWithRpcPromise(_0x4dae36('0x4e'),_0x38609c[_0x4dae36('0x15')])['then'](function(_0x4ff82b){const _0x225339=_0x4dae36;return _0x31fc60=_0x4ff82b,respondWithRpcPromise(_0x225339('0x4e'),_0x38609c['query'],routingClient);})[_0x4dae36('0x1e')](function(_0xc2e676){const _0x326fb0=_0x4dae36;return _[_0x326fb0('0x17')]({},_0xc2e676,_0x31fc60);})[_0x4dae36('0x1e')](respondWithResult(_0x2a074,null))[_0x4dae36('0x10')](handleError(_0x2a074,null));},exports[_0x2f2bba('0xa')]=function(_0x172128,_0x1bca4b){const _0x3ad941=_0x2f2bba;if(_0x172128[_0x3ad941('0x51')]&&_0x172128[_0x3ad941('0x51')][_0x3ad941('0x19')]&&_0x172128['user']&&_0x172128[_0x3ad941('0x54')][_0x3ad941('0x50')])for(const _0x1aee33 in _0x172128['body'][_0x3ad941('0x19')]){if(typeof _0x172128[_0x3ad941('0x51')][_0x3ad941('0x19')][_0x1aee33]!==_0x3ad941('0x6e')){db[_0x3ad941('0x59')][_0x3ad941('0x12')]({'where':{'channel':_0x1aee33,'membername':_0x172128[_0x3ad941('0x54')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x172128[_0x3ad941('0x51')][_0x3ad941('0x19')][_0x1aee33]&&_0x172128[_0x3ad941('0x51')][_0x3ad941('0x19')][_0x1aee33][_0x3ad941('0x36')]?{[Op[_0x3ad941('0x74')]]:_0x172128[_0x3ad941('0x51')][_0x3ad941('0x19')][_0x1aee33]}:{[Op['ne']]:null}}})[_0x3ad941('0x1e')](function(_0x39c171){const _0x335ba0=_0x3ad941,_0x55e19f=moment()[_0x335ba0('0x60')]('YYYY-MM-DD\x20HH:mm:ss');for(let _0x50fc08=0x0,_0x34f3bc=_0x39c171[_0x335ba0('0x36')];_0x50fc08<_0x34f3bc;_0x50fc08+=0x1){_0x39c171[_0x50fc08][_0x335ba0('0x68')]({'exitAt':_0x55e19f});}});for(let _0x23bf1e=0x0;_0x23bf1e<_0x172128['body'][_0x3ad941('0x19')][_0x1aee33]['length'];_0x23bf1e+=0x1){db['MemberReport'][_0x3ad941('0xb')]({'where':{'channel':_0x1aee33,'membername':_0x172128['user'][_0x3ad941('0x50')],'type':'INTERACTION','uniqueid':_0x172128[_0x3ad941('0x51')][_0x3ad941('0x19')][_0x1aee33][_0x23bf1e],'exitAt':null},'defaults':{'channel':_0x1aee33,'membername':_0x172128['user'][_0x3ad941('0x50')],'interface':_[_0x3ad941('0x5')](_0x172128['user']['interface'])?util['format']('SIP/%s',_0x172128[_0x3ad941('0x54')][_0x3ad941('0x50')]):_0x172128[_0x3ad941('0x54')][_0x3ad941('0x77')],'type':_0x3ad941('0x2c'),'enterAt':moment()[_0x3ad941('0x60')](_0x3ad941('0x63')),'role':'agent','internal':_0x172128[_0x3ad941('0x54')][_0x3ad941('0x5e')],'uniqueid':_0x172128[_0x3ad941('0x51')][_0x3ad941('0x19')][_0x1aee33][_0x23bf1e]}});}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x172128[_0x3ad941('0x25')]['id'],'capacity':_0x172128[_0x3ad941('0x51')]['capacity']},routingClient)[_0x3ad941('0x1e')](respondWithResult(_0x1bca4b,null))['catch'](handleError(_0x1bca4b,null));},exports[_0x2f2bba('0x5d')]=function(_0x3e753c,_0x19ad93){const _0x426d6d=_0x2f2bba;return respondWithRpcPromise(_0x426d6d('0x1'),_0x3e753c[_0x426d6d('0x15')])[_0x426d6d('0x1e')](respondWithResult(_0x19ad93,null))[_0x426d6d('0x10')](handleError(_0x19ad93,null));},exports['trunks']=function(_0x4c146e,_0x218954){const _0x5002d9=_0x2f2bba;return respondWithRpcPromise('Trunks',_0x4c146e[_0x5002d9('0x15')])[_0x5002d9('0x1e')](respondWithResult(_0x218954,null))[_0x5002d9('0x10')](handleError(_0x218954,null));},exports[_0x2f2bba('0x64')]=function(_0x7e2f7e,_0x2736b6){const _0x441498=_0x2f2bba;return respondWithRpcPromise(_0x441498('0x1c'),_0x7e2f7e[_0x441498('0x15')])[_0x441498('0x1e')](respondWithResult(_0x2736b6,null))['catch'](handleError(_0x2736b6,null));},exports['chatQueues']=function(_0xc09f99,_0x45e270){const _0x17b3a4=_0x2f2bba;return respondWithRpcPromise(_0x17b3a4('0x52'),_0xc09f99[_0x17b3a4('0x15')],routingClient)[_0x17b3a4('0x1e')](respondWithResult(_0x45e270,null))[_0x17b3a4('0x10')](handleError(_0x45e270,null));},exports[_0x2f2bba('0x8')]=function(_0x1b1115,_0x560300){const _0x4f0e87=_0x2f2bba;return respondWithRpcPromise(_0x4f0e87('0x52'),_0x1b1115[_0x4f0e87('0x15')],routingClient)[_0x4f0e87('0x1e')](findById(_0x1b1115[_0x4f0e87('0x25')]['id']))[_0x4f0e87('0x1e')](respondWithResult(_0x560300,null))[_0x4f0e87('0x10')](handleError(_0x560300,null));},exports[_0x2f2bba('0x76')]=function(_0x55301d,_0x20bd5f){const _0x463c81=_0x2f2bba;return respondWithRpcPromise('MailQueues',_0x55301d['query'],routingClient)[_0x463c81('0x1e')](respondWithResult(_0x20bd5f,null))[_0x463c81('0x10')](handleError(_0x20bd5f,null));},exports[_0x2f2bba('0x62')]=function(_0x46ac0e,_0x16b904){const _0x4b9338=_0x2f2bba;return respondWithRpcPromise(_0x4b9338('0x2e'),_0x46ac0e[_0x4b9338('0x15')],routingClient)[_0x4b9338('0x1e')](findById(_0x46ac0e[_0x4b9338('0x25')]['id']))['then'](respondWithResult(_0x16b904,null))[_0x4b9338('0x10')](handleError(_0x16b904,null));},exports['mailAccounts']=function(_0x455324,_0x32a3c8){const _0x59fb79=_0x2f2bba;return respondWithRpcPromise(_0x59fb79('0x32'),_0x455324[_0x59fb79('0x15')],mailClient)[_0x59fb79('0x1e')](respondWithResult(_0x32a3c8,null))['catch'](handleError(_0x32a3c8,null));},exports['openchannelQueues']=function(_0x9804ce,_0x2ac494){const _0x53e636=_0x2f2bba;return respondWithRpcPromise('OpenchannelQueues',_0x9804ce[_0x53e636('0x15')],routingClient)[_0x53e636('0x1e')](respondWithResult(_0x2ac494,null))[_0x53e636('0x10')](handleError(_0x2ac494,null));},exports[_0x2f2bba('0x33')]=function(_0x2bfebc,_0x36fd85){const _0x21df70=_0x2f2bba;return respondWithRpcPromise('OpenchannelQueues',_0x2bfebc[_0x21df70('0x15')],routingClient)[_0x21df70('0x1e')](findById(_0x2bfebc[_0x21df70('0x25')]['id']))[_0x21df70('0x1e')](respondWithResult(_0x36fd85,null))[_0x21df70('0x10')](handleError(_0x36fd85,null));},exports['smsQueues']=function(_0x176fd4,_0x229414){const _0x1912b7=_0x2f2bba;return respondWithRpcPromise(_0x1912b7('0x0'),_0x176fd4[_0x1912b7('0x15')],routingClient)[_0x1912b7('0x1e')](respondWithResult(_0x229414,null))[_0x1912b7('0x10')](handleError(_0x229414,null));},exports[_0x2f2bba('0x5b')]=function(_0xd970d,_0x4a1748){const _0x4f2890=_0x2f2bba;return respondWithRpcPromise(_0x4f2890('0x0'),_0xd970d[_0x4f2890('0x15')],routingClient)[_0x4f2890('0x1e')](findById(_0xd970d['params']['id']))[_0x4f2890('0x1e')](respondWithResult(_0x4a1748,null))[_0x4f2890('0x10')](handleError(_0x4a1748,null));},exports[_0x2f2bba('0x43')]=function(_0x4c2326,_0x339678){const _0x55804c=_0x2f2bba;return respondWithRpcPromise(_0x55804c('0x71'),_0x4c2326[_0x55804c('0x15')],routingClient)['then'](respondWithResult(_0x339678,null))[_0x55804c('0x10')](handleError(_0x339678,null));},exports[_0x2f2bba('0x6d')]=function(_0x35f607,_0x10fafc){const _0x15855f=_0x2f2bba;return respondWithRpcPromise('WhatsappQueues',_0x35f607[_0x15855f('0x15')],routingClient)['then'](findById(_0x35f607[_0x15855f('0x25')]['id']))[_0x15855f('0x1e')](respondWithResult(_0x10fafc,null))[_0x15855f('0x10')](handleError(_0x10fafc,null));},exports[_0x2f2bba('0x16')]=function(_0x19319d,_0x941a6d){const _0x35ef1c=_0x2f2bba;return respondWithRpcPromise(_0x35ef1c('0x37'),_0x19319d[_0x35ef1c('0x15')],routingClient)[_0x35ef1c('0x1e')](respondWithResult(_0x941a6d,null))['catch'](handleError(_0x941a6d,null));},exports[_0x2f2bba('0x69')]=function(_0x5f414b,_0x17b397){const _0x101589=_0x2f2bba;return respondWithRpcPromise(_0x101589('0x37'),_0x5f414b['query'],routingClient)[_0x101589('0x1e')](findById(_0x5f414b[_0x101589('0x25')]['id']))[_0x101589('0x1e')](respondWithResult(_0x17b397,null))[_0x101589('0x10')](handleError(_0x17b397,null));},exports[_0x2f2bba('0x21')]=function(_0x199886,_0x240630){const _0x233e8e=_0x2f2bba;return respondWithRpcPromise(_0x233e8e('0x20'),_0x199886['query'])[_0x233e8e('0x1e')](respondWithResult(_0x240630,null))[_0x233e8e('0x10')](handleError(_0x240630,null));},exports[_0x2f2bba('0x58')]=function(_0x2f2a2e,_0x2ad104){const _0x551d47=_0x2f2bba;return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x2f2a2e[_0x551d47('0x15')],routingClient)[_0x551d47('0x1e')](respondWithResult(_0x2ad104,null))[_0x551d47('0x10')](handleError(_0x2ad104,null));},exports[_0x2f2bba('0x9')]=function(_0x14d0eb,_0x144eab){const _0x22bca2=_0x2f2bba;return respondWithRpcPromise(_0x22bca2('0x4b'),_0x14d0eb[_0x22bca2('0x15')],routingClient)[_0x22bca2('0x1e')](respondWithResult(_0x144eab,null))['catch'](handleError(_0x144eab,null));},exports['openchannelQueuesWaitingInteractions']=function(_0x40cc9a,_0x4161ff){const _0x5590d7=_0x2f2bba;return respondWithRpcPromise(_0x5590d7('0x4d'),_0x40cc9a['query'],routingClient)[_0x5590d7('0x1e')](respondWithResult(_0x4161ff,null))[_0x5590d7('0x10')](handleError(_0x4161ff,null));},exports[_0x2f2bba('0x2a')]=function(_0x36ea29,_0x55df09){const _0x2bc405=_0x2f2bba;return respondWithRpcPromise(_0x2bc405('0x4d'),_0x36ea29[_0x2bc405('0x15')],routingClient)[_0x2bc405('0x1e')](function(_0x4f345b){const _0x3fa756=_0x2bc405;if(_0x36ea29[_0x3fa756('0x15')][_0x3fa756('0x38')]!==undefined){const _0x20f551=_(_0x4f345b['rows'])[_0x3fa756('0x3')]([_0x36ea29['query'][_0x3fa756('0x38')],_0x36ea29[_0x3fa756('0x25')]['id']])[_0x3fa756('0x3d')]('queue_id')['uniq']()[_0x3fa756('0x11')]();return _0x4f345b[_0x3fa756('0x18')]['filter'](function(_0x2eec4f){return _0x20f551['indexOf'](_0x2eec4f['queue_id'])>-0x1;});}else return _0x4f345b[_0x3fa756('0x18')][_0x3fa756('0x3')](function(_0x1788bd){const _0x432475=_0x3fa756;return _0x1788bd[_0x432475('0x49')]===parseInt(_0x36ea29[_0x432475('0x25')]['id']);});})[_0x2bc405('0x1e')](respondWithResult(_0x55df09,null))['catch'](handleError(_0x55df09,null));},exports['smsQueuesWaitingInteractions']=function(_0x120d54,_0x375d66){const _0x4ce14a=_0x2f2bba;return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x120d54[_0x4ce14a('0x15')],routingClient)[_0x4ce14a('0x1e')](respondWithResult(_0x375d66,null))[_0x4ce14a('0x10')](handleError(_0x375d66,null));},exports[_0x2f2bba('0x1d')]=function(_0x593d09,_0xbc5dfd){const _0x22e88d=_0x2f2bba;return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x593d09['query'],routingClient)[_0x22e88d('0x1e')](respondWithResult(_0xbc5dfd,null))[_0x22e88d('0x10')](handleError(_0xbc5dfd,null));},exports[_0x2f2bba('0x14')]=function(_0x4a1d09,_0xc97694){const _0xb48ea4=_0x2f2bba;return respondWithRpcPromise(_0xb48ea4('0x75'),_0x4a1d09[_0xb48ea4('0x15')],routingClient)[_0xb48ea4('0x1e')](respondWithResult(_0xc97694,null))[_0xb48ea4('0x10')](handleError(_0xc97694,null));},exports[_0x2f2bba('0x1f')]=function(_0x41aeb6){return function(_0x2d7429,_0x506326){const _0x19951a=a527_0x398f;let _0x59f0a5,_0x1cc265;const _0x4a24ae=_[_0x19951a('0x31')](_0x41aeb6),_0x1c95cd=_0x41aeb6==='chat'?_0x19951a('0x1b'):_0x19951a('0x61');return db[_0x4a24ae+_0x19951a('0x46')][_0x19951a('0x42')]({'raw':!![],'where':{'id':_0x2d7429[_0x19951a('0x25')]['id']}})['then'](function(_0x477900){const _0x16a477=_0x19951a;if(_[_0x16a477('0x5')](_0x477900))throw new Error(_0x4a24ae+_0x16a477('0xc'));return _0x59f0a5=_0x477900,db[_0x4a24ae+_0x16a477('0x4c')]['findOne']({'where':{'id':_0x2d7429[_0x16a477('0x51')][_0x16a477('0x34')]},'include':[{'model':db[_0x4a24ae+'Interaction'],'as':'Interaction'},{'model':db[_0x4a24ae+_0x1c95cd],'as':'Account'}]});})[_0x19951a('0x1e')](function(_0xf16662){const _0xf6c00=_0x19951a;if(_[_0xf6c00('0x5')](_0xf16662))throw new Error(_0x4a24ae+'\x20Message\x20not\x20found');return _0x1cc265=_0xf16662,_0xf16662[_0xf6c00('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x19951a('0x1e')](function(){const _0xaff900=_0x19951a,_0x4d9513={'uniqueid':_0x41aeb6+'.'+_0x1cc265['id']+'.'+_0x1cc265[_0xaff900('0x55')]['id'],'FromUserId':_0x2d7429[_0xaff900('0x54')]['id'],'type':_0xaff900('0x28')};return _0x4d9513[_0x4a24ae+_0xaff900('0x6f')]=_0x1cc265['id'],_0x4d9513[_0x4a24ae+_0xaff900('0x73')]=_0x1cc265['Interaction']['id'],_0x4d9513[_0xaff900('0x27')+_0x4a24ae+_0x1c95cd+'Id']=_0x1cc265[_0xaff900('0x61')]['id'],_0x4d9513['To'+_0x4a24ae+_0xaff900('0x2d')]=_0x59f0a5['id'],db[_0x4a24ae+'TransferReport'][_0xaff900('0x1a')](_0x4d9513);})[_0x19951a('0x1e')](function(){const _0x141bdd=_0x19951a;return respondWithRpcPromise(_0x141bdd('0x5f'),{'channel':_0x41aeb6,'interaction':_0x1cc265[_0x141bdd('0x55')],'message':_0x1cc265,'account':_0x1cc265['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x141bdd('0x28'),'appdata':_0x59f0a5[_0x141bdd('0x50')]+','+(_0x1cc265[_0x141bdd('0x61')][_0x141bdd('0x6a')]||0x12c),'interval':_0x141bdd('0x23')}]},routingClient);})['then'](respondWithResult(_0x506326,null))[_0x19951a('0x10')](handleError(_0x506326,null));};},exports[_0x2f2bba('0x4f')]=function(_0x5d002e,_0x1dcb32){const _0x162ddd=_0x2f2bba;let _0x58d442,_0x546bf5;if(_[_0x162ddd('0x5')](_0x5d002e['body']['channel']))throw new Error(_0x162ddd('0x2'));const _0xadcc25=_0x5d002e[_0x162ddd('0x51')]['channel'],_0x1889bf=_[_0x162ddd('0x31')](_0xadcc25),_0x31e92a=_0xadcc25===_0x162ddd('0x5a')?'Website':'Account';return db['User'][_0x162ddd('0x42')]({'raw':!![],'where':{'id':_0x5d002e[_0x162ddd('0x25')]['id'],'role':'agent'}})[_0x162ddd('0x1e')](function(_0x5bc1f4){const _0x136f1a=_0x162ddd;if(_[_0x136f1a('0x5')](_0x5bc1f4))throw new Error('Agent\x20not\x20found');return _0x58d442=_0x5bc1f4,db[_0x1889bf+_0x136f1a('0x4c')]['findOne']({'where':{'id':_0x5d002e[_0x136f1a('0x51')][_0x136f1a('0x34')]},'include':[{'model':db[_0x1889bf+_0x136f1a('0x55')],'as':_0x136f1a('0x55')},{'model':db[_0x1889bf+_0x31e92a],'as':'Account'}]});})[_0x162ddd('0x1e')](function(_0x338ee2){const _0x75774d=_0x162ddd;if(_['isNil'](_0x338ee2))throw new Error(_0x1889bf+_0x75774d('0x44'));return _0x546bf5=_0x338ee2,_0x338ee2[_0x75774d('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x162ddd('0x1e')](function(){const _0x49e7b4=_0x162ddd,_0x41d220={'uniqueid':_0xadcc25+'.'+_0x546bf5['id']+'.'+_0x546bf5[_0x49e7b4('0x55')]['id'],'FromUserId':_0x5d002e['user']['id'],'type':_0x49e7b4('0x28'),'ToUserId':_0x58d442['id']};return _0x41d220[_0x1889bf+'MessageId']=_0x546bf5['id'],_0x41d220[_0x1889bf+_0x49e7b4('0x73')]=_0x546bf5[_0x49e7b4('0x55')]['id'],_0x41d220[_0x49e7b4('0x27')+_0x1889bf+_0x31e92a+'Id']=_0x546bf5[_0x49e7b4('0x61')]['id'],db[_0x1889bf+_0x49e7b4('0x2f')][_0x49e7b4('0x1a')](_0x41d220);})[_0x162ddd('0x1e')](function(){const _0x48197b=_0x162ddd;return respondWithRpcPromise(_0x48197b('0x5f'),{'channel':_0xadcc25,'interaction':_0x546bf5[_0x48197b('0x55')],'message':_0x546bf5,'account':_0x546bf5[_0x48197b('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x48197b('0xf'),'appdata':_0x58d442[_0x48197b('0x50')]+','+(_0x546bf5[_0x48197b('0x61')][_0x48197b('0xe')]||0x12c),'interval':_0x48197b('0x23')}]},routingClient);})['then'](respondWithResult(_0x1dcb32,null))['catch'](handleError(_0x1dcb32,null));};
\ No newline at end of file
+const a527_0x121c=['Start','query','VoiceQueuesChannel','\x20Queue\x20not\x20found','voiceQueuesChannel','interface','user','mailAccounts','update','smsQueues','Interaction','voiceChannelMixMonitor','create','showMailQueues','send','TransferReport','body','name','find','From','http','MailQueues','openchannelQueues','INTERACTION','agentNotify','messageId','showVoiceQueues','Campaigns','VoiceChannelStopMixMonitor','whatsappQueuesWaitingInteractions','showOpenchannelQueues','isNil','length','queueTransferTimeout','rows','showChatQueues','../../config/logger','Outbound','campaigns','status','outbound','ChatQueues','User','telephones','then','whatsappQueues','VoiceQueuesChannelHangup','VoiceChannelMixMonitor','chatQueues','agent','filter','uniq','smsQueuesWaitingInteractions','value','Telephones','MailQueuesWaitingInteractions','voiceChannels','VoiceChannels','SmsQueues','openchannelQueuesWaitingInteractions','VoiceQueues','type','FaxAccounts','OutboundChannels','YYYY-MM-DD\x20HH:mm:ss','trunks','ChatQueuesWaitingInteractions','Website','map','capitalize','format','VoiceQueuesPreview','chat','*,*,*,*','undefined','jayson/promise','WhatsappQueues','showWhatsappQueues','Account','Queue','agentCapacity','lodash','WhatsappQueuesWaitingInteractions','error','queue','agents','faxQueuesWaitingInteractions','findOne','findOrCreate','json','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','mailQueues','stack','\x20Message\x20not\x20found','internal','Trunks','MessageId','FaxQueuesWaitingInteractions','sequelize','VoiceQueuesChannelRedirect','interaction','queue_id','showSmsQueues','FaxQueues','InteractionId','SmsQueuesWaitingInteractions','util','voiceQueuesPreview','MailAccounts','notIn','agentTransferTimeout','VoiceQueuesChannels','faxAccounts','merge','catch','../../mysqldb','chatQueuesWaitingInteractions','outboundChannels','request','Agents','params','indexOf'];(function(_0x10a4e0,_0x121c1e){const _0x1917e8=function(_0x2b2445){while(--_0x2b2445){_0x10a4e0['push'](_0x10a4e0['shift']());}};_0x1917e8(++_0x121c1e);}(a527_0x121c,0x16b));const a527_0x1917=function(_0x10a4e0,_0x121c1e){_0x10a4e0=_0x10a4e0-0x0;let _0x1917e8=a527_0x121c[_0x10a4e0];return _0x1917e8;};const _0x1b59b3=a527_0x1917;'use strict';const moment=require('moment'),_=require(_0x1b59b3('0x57')),util=require(_0x1b59b3('0x71')),db=require(_0x1b59b3('0x7a'))['db'],{Op}=require(_0x1b59b3('0x69')),logger=require(_0x1b59b3('0x2a'))('api'),jayson=require(_0x1b59b3('0x51')),amiClient=jayson['client'][_0x1b59b3('0x1a')]({'port':0x232a}),mailClient=jayson['client'][_0x1b59b3('0x1a')]({'port':0x232b}),routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2b2445,_0x3ca109,_0x1a5903){return new Promise(function(_0x5a0be6,_0x5a68c0){const _0x1507cc=a527_0x1917,_0x348dbb=_0x1a5903?_0x1a5903:amiClient;return _0x348dbb[_0x1507cc('0x2')](_0x2b2445,_0x3ca109)[_0x1507cc('0x32')](function(_0x5b88df){const _0x3c7983=_0x1507cc;if(_0x5b88df['error']){if(_0x5b88df['error']['code']===0x1f4)return _0x5a68c0(_0x5b88df[_0x3c7983('0x59')]['message']);return _0x5a0be6(_0x5b88df[_0x3c7983('0x59')]['message']);}else _0x5a0be6(_0x5b88df['result']);})[_0x1507cc('0x79')](function(_0x2df2a2){_0x5a68c0(_0x2df2a2);});});}function respondWithResult(_0x278be8,_0x220732){return _0x220732=_0x220732||0xc8,function(_0x350e64){const _0x2202e4=a527_0x1917;if(_0x350e64)return _0x278be8['status'](_0x220732)[_0x2202e4('0x5f')](_0x350e64);return _0x278be8['sendStatus'](0x194);};}function handleError(_0x3db26d,_0x16de5b){return _0x16de5b=_0x16de5b||0x1f4,function(_0x18f284){const _0x423e73=a527_0x1917;logger[_0x423e73('0x59')](_0x18f284[_0x423e73('0x63')]),_0x18f284[_0x423e73('0x17')]&&delete _0x18f284[_0x423e73('0x17')],_0x3db26d[_0x423e73('0x2d')](_0x16de5b)[_0x423e73('0x14')](_0x18f284);};}function findById(_0x17f956){return function(_0x495eba){const _0x47c15b=a527_0x1917;if(!_[_0x47c15b('0x25')](_0x17f956)&&!_[_0x47c15b('0x25')](_0x495eba)&&!_[_0x47c15b('0x25')](_0x495eba[_0x47c15b('0x28')]))return _[_0x47c15b('0x18')](_0x495eba[_0x47c15b('0x28')],function(_0x50da0c){return _0x50da0c['id']==_0x17f956;});return null;};}exports[_0x1b59b3('0x3e')]=function(_0xf84d,_0x2ec831){const _0x529316=_0x1b59b3;return respondWithRpcPromise(_0x529316('0x3f'),_0xf84d[_0x529316('0x7')])[_0x529316('0x32')](respondWithResult(_0x2ec831,null))[_0x529316('0x79')](handleError(_0x2ec831,null));},exports[_0x1b59b3('0x11')]=function(_0x32770e,_0x1325b4){const _0x55bb78=_0x1b59b3;return respondWithRpcPromise(_0x55bb78('0x35'),_[_0x55bb78('0x78')](_0x32770e[_0x55bb78('0x7')],_0x32770e['params']))[_0x55bb78('0x32')](respondWithResult(_0x1325b4,null))[_0x55bb78('0x79')](handleError(_0x1325b4,null));},exports['voiceChannelStopMixMonitor']=function(_0x40455e,_0x260efe){const _0x2a409a=_0x1b59b3;return respondWithRpcPromise(_0x2a409a('0x22'),_['merge'](_0x40455e[_0x2a409a('0x7')],_0x40455e[_0x2a409a('0x4')]))[_0x2a409a('0x32')](respondWithResult(_0x260efe,null))[_0x2a409a('0x79')](handleError(_0x260efe,null));},exports['voiceQueues']=function(_0x306270,_0x5561e8){const _0xc2bda3=_0x1b59b3;return respondWithRpcPromise('VoiceQueues',_0x306270['query'])[_0xc2bda3('0x32')](respondWithResult(_0x5561e8,null))['catch'](handleError(_0x5561e8,null));},exports[_0x1b59b3('0x20')]=function(_0x344c7c,_0x2765ed){const _0x1eae30=_0x1b59b3;return respondWithRpcPromise(_0x1eae30('0x42'),_0x344c7c[_0x1eae30('0x7')])[_0x1eae30('0x32')](findById(_0x344c7c[_0x1eae30('0x4')]['id']))['then'](respondWithResult(_0x2765ed,null))[_0x1eae30('0x79')](handleError(_0x2765ed,null));},exports[_0x1b59b3('0x72')]=function(_0x21fc93,_0x2b95cf){const _0xdc27c=_0x1b59b3;return respondWithRpcPromise(_0xdc27c('0x4d'),_['merge'](_0x21fc93[_0xdc27c('0x7')],_0x21fc93[_0xdc27c('0x4')]))[_0xdc27c('0x32')](respondWithResult(_0x2b95cf,null))['catch'](handleError(_0x2b95cf,null));},exports['voiceQueuesChannels']=function(_0x19ccc0,_0xdd3d36){const _0x58e76b=_0x1b59b3;return respondWithRpcPromise(_0x58e76b('0x76'),_0x19ccc0['query'])[_0x58e76b('0x32')](respondWithResult(_0xdd3d36,null))['catch'](handleError(_0xdd3d36,null));},exports[_0x1b59b3('0xa')]=function(_0x1f9861,_0x564bf1){const _0x3f7bb1=_0x1b59b3;return respondWithRpcPromise(_0x3f7bb1('0x8'),_['merge'](_0x1f9861[_0x3f7bb1('0x7')],_0x1f9861[_0x3f7bb1('0x4')]))['then'](respondWithResult(_0x564bf1,null))[_0x3f7bb1('0x79')](handleError(_0x564bf1,null));},exports['voiceQueuesChannelHangup']=function(_0x7f8ae8,_0x4e498e){const _0x33a38f=_0x1b59b3;return respondWithRpcPromise(_0x33a38f('0x34'),_[_0x33a38f('0x78')](_0x7f8ae8['query'],_0x7f8ae8[_0x33a38f('0x4')]))['then'](respondWithResult(_0x4e498e,null))['catch'](handleError(_0x4e498e,null));},exports['voiceQueuesChannelRedirect']=function(_0x8ead7b,_0x4936db){const _0x57d86e=_0x1b59b3;return respondWithRpcPromise(_0x57d86e('0x6a'),_[_0x57d86e('0x78')](_0x8ead7b[_0x57d86e('0x7')],_0x8ead7b['params']))[_0x57d86e('0x32')](respondWithResult(_0x4936db,null))[_0x57d86e('0x79')](handleError(_0x4936db,null));},exports[_0x1b59b3('0x2e')]=function(_0x20af80,_0x3465aa){const _0x47af31=_0x1b59b3;return respondWithRpcPromise(_0x47af31('0x2b'),_0x20af80[_0x47af31('0x7')])['then'](respondWithResult(_0x3465aa,null))[_0x47af31('0x79')](handleError(_0x3465aa,null));},exports[_0x1b59b3('0x1')]=function(_0x357bbe,_0x12bf94){const _0x4a82f7=_0x1b59b3;return respondWithRpcPromise(_0x4a82f7('0x45'),_0x357bbe[_0x4a82f7('0x7')])[_0x4a82f7('0x32')](respondWithResult(_0x12bf94,null))[_0x4a82f7('0x79')](handleError(_0x12bf94,null));},exports[_0x1b59b3('0x5b')]=function(_0x4db49c,_0x4fe394){const _0x2318e0=_0x1b59b3;let _0x338d60;return respondWithRpcPromise(_0x2318e0('0x3'),_0x4db49c[_0x2318e0('0x7')])['then'](function(_0x2b48af){const _0x3fa6bf=_0x2318e0;return _0x338d60=_0x2b48af,respondWithRpcPromise(_0x3fa6bf('0x3'),_0x4db49c[_0x3fa6bf('0x7')],routingClient);})['then'](function(_0x30f2c5){return _['merge']({},_0x30f2c5,_0x338d60);})[_0x2318e0('0x32')](respondWithResult(_0x4fe394,null))[_0x2318e0('0x79')](handleError(_0x4fe394,null));},exports[_0x1b59b3('0x56')]=function(_0x3d895c,_0x359376){const _0x3a6871=_0x1b59b3;if(_0x3d895c[_0x3a6871('0x16')]&&_0x3d895c['body']['interaction']&&_0x3d895c[_0x3a6871('0xc')]&&_0x3d895c[_0x3a6871('0xc')][_0x3a6871('0x17')])for(const _0x4eb7dd in _0x3d895c[_0x3a6871('0x16')][_0x3a6871('0x6b')]){if(typeof _0x3d895c[_0x3a6871('0x16')][_0x3a6871('0x6b')][_0x4eb7dd]!==_0x3a6871('0x50')){db['MemberReport']['findAll']({'where':{'channel':_0x4eb7dd,'membername':_0x3d895c[_0x3a6871('0xc')][_0x3a6871('0x17')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3d895c[_0x3a6871('0x16')][_0x3a6871('0x6b')][_0x4eb7dd]&&_0x3d895c['body'][_0x3a6871('0x6b')][_0x4eb7dd][_0x3a6871('0x26')]?{[Op[_0x3a6871('0x74')]]:_0x3d895c['body'][_0x3a6871('0x6b')][_0x4eb7dd]}:{[Op['ne']]:null}}})[_0x3a6871('0x32')](function(_0x4afb4c){const _0xfe80f4=_0x3a6871,_0x499a19=moment()['format'](_0xfe80f4('0x46'));for(let _0x7db201=0x0,_0x167078=_0x4afb4c[_0xfe80f4('0x26')];_0x7db201<_0x167078;_0x7db201+=0x1){_0x4afb4c[_0x7db201][_0xfe80f4('0xe')]({'exitAt':_0x499a19});}});for(let _0x1ad028=0x0;_0x1ad028<_0x3d895c[_0x3a6871('0x16')][_0x3a6871('0x6b')][_0x4eb7dd][_0x3a6871('0x26')];_0x1ad028+=0x1){db['MemberReport'][_0x3a6871('0x5e')]({'where':{'channel':_0x4eb7dd,'membername':_0x3d895c[_0x3a6871('0xc')][_0x3a6871('0x17')],'type':_0x3a6871('0x1d'),'uniqueid':_0x3d895c[_0x3a6871('0x16')][_0x3a6871('0x6b')][_0x4eb7dd][_0x1ad028],'exitAt':null},'defaults':{'channel':_0x4eb7dd,'membername':_0x3d895c[_0x3a6871('0xc')][_0x3a6871('0x17')],'interface':_[_0x3a6871('0x25')](_0x3d895c['user'][_0x3a6871('0xb')])?util[_0x3a6871('0x4c')]('SIP/%s',_0x3d895c[_0x3a6871('0xc')][_0x3a6871('0x17')]):_0x3d895c[_0x3a6871('0xc')]['interface'],'type':_0x3a6871('0x1d'),'enterAt':moment()[_0x3a6871('0x4c')](_0x3a6871('0x46')),'role':_0x3a6871('0x37'),'internal':_0x3d895c[_0x3a6871('0xc')][_0x3a6871('0x65')],'uniqueid':_0x3d895c['body']['interaction'][_0x4eb7dd][_0x1ad028]}});}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3d895c['params']['id'],'capacity':_0x3d895c[_0x3a6871('0x16')]['capacity']},routingClient)[_0x3a6871('0x32')](respondWithResult(_0x359376,null))[_0x3a6871('0x79')](handleError(_0x359376,null));},exports[_0x1b59b3('0x31')]=function(_0x4670af,_0x55af73){const _0x157fed=_0x1b59b3;return respondWithRpcPromise(_0x157fed('0x3c'),_0x4670af[_0x157fed('0x7')])[_0x157fed('0x32')](respondWithResult(_0x55af73,null))[_0x157fed('0x79')](handleError(_0x55af73,null));},exports[_0x1b59b3('0x47')]=function(_0x328c99,_0x597e93){const _0x166da=_0x1b59b3;return respondWithRpcPromise(_0x166da('0x66'),_0x328c99[_0x166da('0x7')])[_0x166da('0x32')](respondWithResult(_0x597e93,null))[_0x166da('0x79')](handleError(_0x597e93,null));},exports[_0x1b59b3('0x2c')]=function(_0x2dc9ac,_0x40891f){const _0x67ecba=_0x1b59b3;return respondWithRpcPromise(_0x67ecba('0x21'),_0x2dc9ac[_0x67ecba('0x7')])[_0x67ecba('0x32')](respondWithResult(_0x40891f,null))[_0x67ecba('0x79')](handleError(_0x40891f,null));},exports[_0x1b59b3('0x36')]=function(_0x4bbe9b,_0x40eab6){const _0x25084f=_0x1b59b3;return respondWithRpcPromise('ChatQueues',_0x4bbe9b[_0x25084f('0x7')],routingClient)['then'](respondWithResult(_0x40eab6,null))[_0x25084f('0x79')](handleError(_0x40eab6,null));},exports[_0x1b59b3('0x29')]=function(_0x245bce,_0x1d0d96){const _0x3507c5=_0x1b59b3;return respondWithRpcPromise(_0x3507c5('0x2f'),_0x245bce[_0x3507c5('0x7')],routingClient)[_0x3507c5('0x32')](findById(_0x245bce[_0x3507c5('0x4')]['id']))[_0x3507c5('0x32')](respondWithResult(_0x1d0d96,null))[_0x3507c5('0x79')](handleError(_0x1d0d96,null));},exports[_0x1b59b3('0x62')]=function(_0x334645,_0x33e1dc){const _0x133779=_0x1b59b3;return respondWithRpcPromise(_0x133779('0x1b'),_0x334645[_0x133779('0x7')],routingClient)[_0x133779('0x32')](respondWithResult(_0x33e1dc,null))[_0x133779('0x79')](handleError(_0x33e1dc,null));},exports[_0x1b59b3('0x13')]=function(_0x4afe8a,_0x29e3e8){const _0x45f191=_0x1b59b3;return respondWithRpcPromise(_0x45f191('0x1b'),_0x4afe8a[_0x45f191('0x7')],routingClient)[_0x45f191('0x32')](findById(_0x4afe8a[_0x45f191('0x4')]['id']))[_0x45f191('0x32')](respondWithResult(_0x29e3e8,null))[_0x45f191('0x79')](handleError(_0x29e3e8,null));},exports[_0x1b59b3('0xd')]=function(_0x3bff97,_0x331561){const _0x367b09=_0x1b59b3;return respondWithRpcPromise(_0x367b09('0x73'),_0x3bff97[_0x367b09('0x7')],mailClient)['then'](respondWithResult(_0x331561,null))['catch'](handleError(_0x331561,null));},exports[_0x1b59b3('0x1c')]=function(_0x291f10,_0x313a60){const _0xd20cee=_0x1b59b3;return respondWithRpcPromise('OpenchannelQueues',_0x291f10[_0xd20cee('0x7')],routingClient)['then'](respondWithResult(_0x313a60,null))['catch'](handleError(_0x313a60,null));},exports[_0x1b59b3('0x24')]=function(_0x11d911,_0x3b10ca){const _0x4b7603=_0x1b59b3;return respondWithRpcPromise('OpenchannelQueues',_0x11d911[_0x4b7603('0x7')],routingClient)[_0x4b7603('0x32')](findById(_0x11d911[_0x4b7603('0x4')]['id']))['then'](respondWithResult(_0x3b10ca,null))[_0x4b7603('0x79')](handleError(_0x3b10ca,null));},exports[_0x1b59b3('0xf')]=function(_0x4c5124,_0x336ba2){const _0x2be21e=_0x1b59b3;return respondWithRpcPromise(_0x2be21e('0x40'),_0x4c5124['query'],routingClient)[_0x2be21e('0x32')](respondWithResult(_0x336ba2,null))[_0x2be21e('0x79')](handleError(_0x336ba2,null));},exports[_0x1b59b3('0x6d')]=function(_0x148837,_0x47f37f){const _0x51fb1b=_0x1b59b3;return respondWithRpcPromise(_0x51fb1b('0x40'),_0x148837[_0x51fb1b('0x7')],routingClient)['then'](findById(_0x148837[_0x51fb1b('0x4')]['id']))[_0x51fb1b('0x32')](respondWithResult(_0x47f37f,null))['catch'](handleError(_0x47f37f,null));},exports[_0x1b59b3('0x33')]=function(_0x415a5f,_0x25f699){const _0x2bb1b5=_0x1b59b3;return respondWithRpcPromise('WhatsappQueues',_0x415a5f['query'],routingClient)[_0x2bb1b5('0x32')](respondWithResult(_0x25f699,null))['catch'](handleError(_0x25f699,null));},exports[_0x1b59b3('0x53')]=function(_0x9f6802,_0x1eb350){const _0x1cc7dc=_0x1b59b3;return respondWithRpcPromise(_0x1cc7dc('0x52'),_0x9f6802['query'],routingClient)[_0x1cc7dc('0x32')](findById(_0x9f6802[_0x1cc7dc('0x4')]['id']))[_0x1cc7dc('0x32')](respondWithResult(_0x1eb350,null))['catch'](handleError(_0x1eb350,null));},exports['faxQueues']=function(_0xc61ef9,_0x4efa93){const _0x538aa8=_0x1b59b3;return respondWithRpcPromise(_0x538aa8('0x6e'),_0xc61ef9[_0x538aa8('0x7')],routingClient)[_0x538aa8('0x32')](respondWithResult(_0x4efa93,null))['catch'](handleError(_0x4efa93,null));},exports['showFaxQueues']=function(_0x242b4b,_0x167542){const _0x4283f5=_0x1b59b3;return respondWithRpcPromise('FaxQueues',_0x242b4b[_0x4283f5('0x7')],routingClient)['then'](findById(_0x242b4b[_0x4283f5('0x4')]['id']))[_0x4283f5('0x32')](respondWithResult(_0x167542,null))[_0x4283f5('0x79')](handleError(_0x167542,null));},exports[_0x1b59b3('0x77')]=function(_0x1b5b29,_0x3eabc1){const _0x17f6fe=_0x1b59b3;return respondWithRpcPromise(_0x17f6fe('0x44'),_0x1b5b29[_0x17f6fe('0x7')])['then'](respondWithResult(_0x3eabc1,null))['catch'](handleError(_0x3eabc1,null));},exports[_0x1b59b3('0x0')]=function(_0xcf80c0,_0x326b9b){const _0x586812=_0x1b59b3;return respondWithRpcPromise(_0x586812('0x48'),_0xcf80c0[_0x586812('0x7')],routingClient)['then'](respondWithResult(_0x326b9b,null))[_0x586812('0x79')](handleError(_0x326b9b,null));},exports[_0x1b59b3('0x60')]=function(_0x40c349,_0x539807){const _0x3066cd=_0x1b59b3;return respondWithRpcPromise(_0x3066cd('0x3d'),_0x40c349[_0x3066cd('0x7')],routingClient)['then'](respondWithResult(_0x539807,null))[_0x3066cd('0x79')](handleError(_0x539807,null));},exports[_0x1b59b3('0x41')]=function(_0x3c75ab,_0x7e06d5){const _0x530a67=_0x1b59b3;return respondWithRpcPromise(_0x530a67('0x61'),_0x3c75ab[_0x530a67('0x7')],routingClient)[_0x530a67('0x32')](respondWithResult(_0x7e06d5,null))[_0x530a67('0x79')](handleError(_0x7e06d5,null));},exports['openchannelQueuesIdWaitingInteractions']=function(_0xb8ea29,_0x8f0405){const _0x202ff7=_0x1b59b3;return respondWithRpcPromise(_0x202ff7('0x61'),_0xb8ea29[_0x202ff7('0x7')],routingClient)[_0x202ff7('0x32')](function(_0xa790f8){const _0x1855d1=_0x202ff7;if(_0xb8ea29[_0x1855d1('0x7')][_0x1855d1('0x43')]!==undefined){const _0x35bfe7=_(_0xa790f8[_0x1855d1('0x28')])['filter']([_0xb8ea29[_0x1855d1('0x7')][_0x1855d1('0x43')],_0xb8ea29[_0x1855d1('0x4')]['id']])[_0x1855d1('0x4a')]('queue_id')[_0x1855d1('0x39')]()[_0x1855d1('0x3b')]();return _0xa790f8[_0x1855d1('0x28')][_0x1855d1('0x38')](function(_0x13e783){const _0x517d87=_0x1855d1;return _0x35bfe7[_0x517d87('0x5')](_0x13e783[_0x517d87('0x6c')])>-0x1;});}else return _0xa790f8['rows']['filter'](function(_0x28c3f5){const _0x521f08=_0x1855d1;return _0x28c3f5[_0x521f08('0x6c')]===parseInt(_0xb8ea29[_0x521f08('0x4')]['id']);});})[_0x202ff7('0x32')](respondWithResult(_0x8f0405,null))[_0x202ff7('0x79')](handleError(_0x8f0405,null));},exports[_0x1b59b3('0x3a')]=function(_0xf9ac0d,_0x480f67){const _0x20d401=_0x1b59b3;return respondWithRpcPromise(_0x20d401('0x70'),_0xf9ac0d['query'],routingClient)[_0x20d401('0x32')](respondWithResult(_0x480f67,null))[_0x20d401('0x79')](handleError(_0x480f67,null));},exports[_0x1b59b3('0x23')]=function(_0x975081,_0x79c0a7){const _0x50ae30=_0x1b59b3;return respondWithRpcPromise(_0x50ae30('0x58'),_0x975081[_0x50ae30('0x7')],routingClient)[_0x50ae30('0x32')](respondWithResult(_0x79c0a7,null))[_0x50ae30('0x79')](handleError(_0x79c0a7,null));},exports[_0x1b59b3('0x5c')]=function(_0x303c80,_0x2cf52d){const _0x311be9=_0x1b59b3;return respondWithRpcPromise(_0x311be9('0x68'),_0x303c80[_0x311be9('0x7')],routingClient)[_0x311be9('0x32')](respondWithResult(_0x2cf52d,null))[_0x311be9('0x79')](handleError(_0x2cf52d,null));},exports['queueNotify']=function(_0x50c5e5){return function(_0x41bc32,_0x5c18b6){const _0xc19642=a527_0x1917;let _0xed1a06,_0x2989ea;const _0x226689=_[_0xc19642('0x4b')](_0x50c5e5),_0x39eeac=_0x50c5e5===_0xc19642('0x4e')?_0xc19642('0x49'):_0xc19642('0x54');return db[_0x226689+_0xc19642('0x55')][_0xc19642('0x5d')]({'raw':!![],'where':{'id':_0x41bc32[_0xc19642('0x4')]['id']}})[_0xc19642('0x32')](function(_0x3ebc23){const _0x5ec39d=_0xc19642;if(_[_0x5ec39d('0x25')](_0x3ebc23))throw new Error(_0x226689+_0x5ec39d('0x9'));return _0xed1a06=_0x3ebc23,db[_0x226689+'Message'][_0x5ec39d('0x5d')]({'where':{'id':_0x41bc32[_0x5ec39d('0x16')][_0x5ec39d('0x1f')]},'include':[{'model':db[_0x226689+'Interaction'],'as':_0x5ec39d('0x10')},{'model':db[_0x226689+_0x39eeac],'as':_0x5ec39d('0x54')}]});})[_0xc19642('0x32')](function(_0x1b8244){const _0x3482cd=_0xc19642;if(_[_0x3482cd('0x25')](_0x1b8244))throw new Error(_0x226689+_0x3482cd('0x64'));return _0x2989ea=_0x1b8244,_0x1b8244[_0x3482cd('0xe')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){const _0x4b1f9d=_0xc19642,_0x2ec95c={'uniqueid':_0x50c5e5+'.'+_0x2989ea['id']+'.'+_0x2989ea[_0x4b1f9d('0x10')]['id'],'FromUserId':_0x41bc32[_0x4b1f9d('0xc')]['id'],'type':'queue'};return _0x2ec95c[_0x226689+'MessageId']=_0x2989ea['id'],_0x2ec95c[_0x226689+_0x4b1f9d('0x6f')]=_0x2989ea['Interaction']['id'],_0x2ec95c[_0x4b1f9d('0x19')+_0x226689+_0x39eeac+'Id']=_0x2989ea[_0x4b1f9d('0x54')]['id'],_0x2ec95c['To'+_0x226689+'QueueId']=_0xed1a06['id'],db[_0x226689+_0x4b1f9d('0x15')][_0x4b1f9d('0x12')](_0x2ec95c);})['then'](function(){const _0x3b8f71=_0xc19642;return respondWithRpcPromise(_0x3b8f71('0x6'),{'channel':_0x50c5e5,'interaction':_0x2989ea['Interaction'],'message':_0x2989ea,'account':_0x2989ea[_0x3b8f71('0x54')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3b8f71('0x5a'),'appdata':_0xed1a06['name']+','+(_0x2989ea[_0x3b8f71('0x54')][_0x3b8f71('0x27')]||0x12c),'interval':_0x3b8f71('0x4f')}]},routingClient);})[_0xc19642('0x32')](respondWithResult(_0x5c18b6,null))[_0xc19642('0x79')](handleError(_0x5c18b6,null));};},exports[_0x1b59b3('0x1e')]=function(_0x2a8837,_0xf52672){const _0x25d03e=_0x1b59b3;let _0x1e9ecb,_0xe34959;if(_[_0x25d03e('0x25')](_0x2a8837[_0x25d03e('0x16')]['channel']))throw new Error('Channel\x20field\x20is\x20mandatory');const _0x2d6f06=_0x2a8837['body']['channel'],_0x5980e0=_[_0x25d03e('0x4b')](_0x2d6f06),_0x1cafb6=_0x2d6f06===_0x25d03e('0x4e')?_0x25d03e('0x49'):'Account';return db[_0x25d03e('0x30')][_0x25d03e('0x5d')]({'raw':!![],'where':{'id':_0x2a8837[_0x25d03e('0x4')]['id'],'role':'agent'}})[_0x25d03e('0x32')](function(_0x1106af){const _0x204d30=_0x25d03e;if(_[_0x204d30('0x25')](_0x1106af))throw new Error('Agent\x20not\x20found');return _0x1e9ecb=_0x1106af,db[_0x5980e0+'Message'][_0x204d30('0x5d')]({'where':{'id':_0x2a8837['body'][_0x204d30('0x1f')]},'include':[{'model':db[_0x5980e0+'Interaction'],'as':'Interaction'},{'model':db[_0x5980e0+_0x1cafb6],'as':_0x204d30('0x54')}]});})[_0x25d03e('0x32')](function(_0x164b67){const _0x91b9bd=_0x25d03e;if(_[_0x91b9bd('0x25')](_0x164b67))throw new Error(_0x5980e0+'\x20Message\x20not\x20found');return _0xe34959=_0x164b67,_0x164b67[_0x91b9bd('0xe')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){const _0x321044=_0x25d03e,_0x5c6704={'uniqueid':_0x2d6f06+'.'+_0xe34959['id']+'.'+_0xe34959[_0x321044('0x10')]['id'],'FromUserId':_0x2a8837[_0x321044('0xc')]['id'],'type':_0x321044('0x5a'),'ToUserId':_0x1e9ecb['id']};return _0x5c6704[_0x5980e0+_0x321044('0x67')]=_0xe34959['id'],_0x5c6704[_0x5980e0+'InteractionId']=_0xe34959[_0x321044('0x10')]['id'],_0x5c6704[_0x321044('0x19')+_0x5980e0+_0x1cafb6+'Id']=_0xe34959[_0x321044('0x54')]['id'],db[_0x5980e0+_0x321044('0x15')][_0x321044('0x12')](_0x5c6704);})[_0x25d03e('0x32')](function(){const _0x33a7c4=_0x25d03e;return respondWithRpcPromise(_0x33a7c4('0x6'),{'channel':_0x2d6f06,'interaction':_0xe34959['Interaction'],'message':_0xe34959,'account':_0xe34959[_0x33a7c4('0x54')],'applications':[{'id':0x0,'priority':0x1,'app':_0x33a7c4('0x37'),'appdata':_0x1e9ecb[_0x33a7c4('0x17')]+','+(_0xe34959['Account'][_0x33a7c4('0x75')]||0x12c),'interval':_0x33a7c4('0x4f')}]},routingClient);})['then'](respondWithResult(_0xf52672,null))['catch'](handleError(_0xf52672,null));};
\ No newline at end of file