Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / config / socketio.js
index c3a3e0a..5628b7d 100644 (file)
@@ -1 +1 @@
-const a1047_0x3e96=['removeChatInteractions','WhatsappQueue','then','nsp','user_has_chat_interactions:remove','remoteAddress','length','ChatQueues','leave','findAll','getChatQueues','WhatsappInteraction','UserProfileResource','getVoiceQueues','userProfileId','role','Trunks','log','FaxQueues','../mysqldb','request','query','WhatsappInteractions','VoiceQueue','getOpenchannelQueues','findOne','MailInteraction','getSmsQueues','name','whatsapp','Trunk','connection','address','WhatsappQueues','user_has_fax_interactions:remove','ChatQueue','removeWhatsappInteractions','OpenchannelQueues','User','removeOpenchannelInteractions','format','join','ivr','agent','fax','openchannel','voice:outbound','UserProfileSection','ChatInteraction','where','removeSmsInteractions','OpenchannelInteraction','disconnect','getWhatsappQueues','emit','FaxInteraction','Campaign','VoiceQueues','getMailQueues','include','campaign:%s:%s','admin','voice','SmsQueues','util','ChatInteractions','OpenchannelQueue','Agents','IvrCampaigns','DISCONNECTED','Telephones','FaxInteractions','SmsInteractions','user:%s','user_has_whatsapp_interactions:remove','setMaxListeners','getFaxQueues','MailInteractions','lodash','map','resourceId','MailQueues','FaxQueue','SmsQueue','MailQueue','CONNECTED','SocketIO\x20','trunk:%s','voice:inbound','user_has_openchannel_interactions:remove','type','push','remotePort','undefined','user_has_sms_interactions:remove','telephone'];(function(_0x3e5732,_0x3d9dd8){const _0x3e9680=function(_0x472269){while(--_0x472269){_0x3e5732['push'](_0x3e5732['shift']());}};_0x3e9680(++_0x3d9dd8);}(a1047_0x3e96,0x1e6));const a1047_0x4722=function(_0x3e5732,_0x3d9dd8){_0x3e5732=_0x3e5732-0xab;let _0x3e9680=a1047_0x3e96[_0x3e5732];return _0x3e9680;};const a1047_0x28ff99=a1047_0x4722;'use strict';const _=require(a1047_0x28ff99(0xf3)),util=require(a1047_0x28ff99(0xe5)),{db}=require(a1047_0x28ff99(0xb8)),queryQueues={'attributes':['id','name'],'include':[{'as':a1047_0x28ff99(0xe8),'model':db[a1047_0x28ff99(0xcb)],'attributes':['id',a1047_0x28ff99(0xc1),'role'],'raw':!![],'where':{'role':a1047_0x28ff99(0xd0)},'required':![]}]},queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':a1047_0x28ff99(0x104)}},queryTrunks={'raw':!![],'attributes':['id',a1047_0x28ff99(0xc1)]},queryAgents={'raw':!![],'attributes':['id',a1047_0x28ff99(0xc1)],'where':{'role':a1047_0x28ff99(0xd0)}},queryCampaigns={'raw':!![],'attributes':['id','name',a1047_0x28ff99(0xff)],'where':{'type':a1047_0x28ff99(0xcf)}};function getAssociatedResources(_0x1e22f4,_0x1453c3,_0x791fea){const _0x526cd7=a1047_0x28ff99;return db[_0x526cd7(0xd4)][_0x526cd7(0xbe)]({'where':{'name':_0x1e22f4,'userProfileId':_0x1453c3},'raw':!![]})[_0x526cd7(0x107)](function(_0x4e3e7c){const _0x58fc8e=_0x526cd7;if(_0x4e3e7c){if(_0x4e3e7c['autoAssociation']){let _0xcf369d;switch(_0x1e22f4){case _0x58fc8e(0xde):case _0x58fc8e(0xac):case'FaxQueues':case _0x58fc8e(0xe4):case _0x58fc8e(0xf6):case _0x58fc8e(0xca):case _0x58fc8e(0xc6):_0xcf369d=queryQueues;break;case _0x58fc8e(0xeb):_0xcf369d=queryTelephones;break;case _0x58fc8e(0xb5):_0xcf369d=queryTrunks;break;case _0x58fc8e(0xe9):_0xcf369d=queryCampaigns;break;default:break;}return _0xcf369d?db[_0x791fea][_0x58fc8e(0xae)](_0xcf369d):_0xcf369d;}else return db[_0x58fc8e(0xb1)]['findAll']({'attributes':[_0x58fc8e(0xf5)],'where':{'sectionId':_0x4e3e7c['id']},'raw':!![]})[_0x58fc8e(0x107)](function(_0x57a6ea){const _0x1b1592=_0x58fc8e;if(_0x57a6ea){const _0x22bbe8={'where':{'id':_[_0x1b1592(0xf4)](_0x57a6ea,_0x1b1592(0xf5))},'raw':!![]};switch(_0x791fea){case'User':_0x22bbe8[_0x1b1592(0xd6)][_0x1b1592(0xb4)]=_0x1b1592(0x104);break;case'Campaign':_0x22bbe8[_0x1b1592(0xd6)][_0x1b1592(0xff)]=_0x1b1592(0xcf);break;}return db[_0x791fea][_0x1b1592(0xae)](_0x22bbe8);}else return[];});}else return[];})[_0x526cd7(0x107)](function(_0x138727){return _0x138727;});}function joinOrLeaveQueues(_0x31d206,_0x4361ff,_0x5c744c,_0x202ada){const _0x44e5de=a1047_0x28ff99;_0x31d206[_0x4361ff](util['format']('%s:queue:%s',_0x5c744c,_0x202ada[_0x44e5de(0xc1)]));if(_0x202ada['Agents'])for(let _0x209aed=0x0;_0x209aed<_0x202ada[_0x44e5de(0xe8)]['length'];_0x209aed+=0x1){_0x31d206[_0x4361ff](util[_0x44e5de(0xcd)]('user:%s',_0x202ada[_0x44e5de(0xe8)][_0x209aed][_0x44e5de(0xc1)]));}}function joinOrLeave(_0x4a7e74,_0x4432af,_0x477e53){const _0x516acf=a1047_0x28ff99;let _0x240b88;_0x4a7e74['handshake'][_0x516acf(0xba)]['id']&&db[_0x516acf(0xcb)][_0x516acf(0xbe)]({'attributes':['id','name',_0x516acf(0xb4),'userProfileId'],'where':{'id':_0x4a7e74['handshake'][_0x516acf(0xba)]['id']},'include':[{'model':db[_0x516acf(0xd5)],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x516acf(0xbf)],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x516acf(0xdc)],'as':_0x516acf(0xec),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x516acf(0xd8)],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x516acf(0xb0)],'as':_0x516acf(0xbb),'attributes':['id'],'raw':!![]}]})[_0x516acf(0x107)](function(_0x1127ad){const _0x55047c=_0x516acf;if(_0x1127ad){_0x240b88=_0x1127ad,_0x4a7e74[_0x4432af](util[_0x55047c(0xcd)](_0x55047c(0xee),_0x1127ad[_0x55047c(0xc1)]));const _0x1255c8=[];switch(_0x1127ad[_0x55047c(0xb4)]){case _0x55047c(0xe2):_0x4a7e74[_0x4432af]('voice:inbound'),_0x4a7e74[_0x4432af]('voice:outbound');typeof queryQueues[_0x55047c(0xe0)]!==_0x55047c(0x102)&&delete queryQueues[_0x55047c(0xe0)];_0x1255c8[_0x55047c(0x100)](db[_0x55047c(0xbc)][_0x55047c(0xae)](queryQueues)),_0x1255c8[_0x55047c(0x100)](db['ChatQueue'][_0x55047c(0xae)](queryQueues)),_0x1255c8['push'](db[_0x55047c(0xf7)][_0x55047c(0xae)](queryQueues)),_0x1255c8[_0x55047c(0x100)](db[_0x55047c(0xf8)][_0x55047c(0xae)](queryQueues)),_0x1255c8[_0x55047c(0x100)](db['MailQueue']['findAll'](queryQueues)),_0x1255c8['push'](db[_0x55047c(0xe7)][_0x55047c(0xae)](queryQueues)),_0x1255c8[_0x55047c(0x100)](db[_0x55047c(0x106)][_0x55047c(0xae)](queryQueues)),_0x1255c8[_0x55047c(0x100)](db[_0x55047c(0xcb)]['findAll'](queryTelephones)),_0x1255c8['push'](db[_0x55047c(0xc3)][_0x55047c(0xae)](queryTrunks)),_0x1255c8[_0x55047c(0x100)](db[_0x55047c(0xdd)][_0x55047c(0xae)](queryCampaigns)),_0x1255c8[_0x55047c(0x100)](db[_0x55047c(0xcb)][_0x55047c(0xae)](queryAgents));break;case'user':_0x4a7e74[_0x4432af]('voice:inbound'),_0x4a7e74[_0x4432af](_0x55047c(0xd3)),_0x1255c8[_0x55047c(0x100)](getAssociatedResources('VoiceQueues',_0x1127ad[_0x55047c(0xb3)],_0x55047c(0xbc))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources('ChatQueues',_0x1127ad[_0x55047c(0xb3)],_0x55047c(0xc8))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources(_0x55047c(0xb7),_0x1127ad[_0x55047c(0xb3)],_0x55047c(0xf7))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources(_0x55047c(0xe4),_0x1127ad[_0x55047c(0xb3)],_0x55047c(0xf8))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources(_0x55047c(0xf6),_0x1127ad[_0x55047c(0xb3)],_0x55047c(0xf9))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources(_0x55047c(0xca),_0x1127ad['userProfileId'],_0x55047c(0xe7))),_0x1255c8['push'](getAssociatedResources(_0x55047c(0xc6),_0x1127ad[_0x55047c(0xb3)],_0x55047c(0x106))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources(_0x55047c(0xeb),_0x1127ad['userProfileId'],_0x55047c(0xcb))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources('Trunks',_0x1127ad[_0x55047c(0xb3)],_0x55047c(0xc3))),_0x1255c8[_0x55047c(0x100)](getAssociatedResources(_0x55047c(0xe9),_0x1127ad[_0x55047c(0xb3)],_0x55047c(0xdd))),_0x1255c8[_0x55047c(0x100)](db[_0x55047c(0xcb)]['findAll'](queryAgents));break;case _0x55047c(0xd0):_0x4a7e74[_0x4432af](_0x55047c(0xfd)),_0x4a7e74[_0x4432af](_0x55047c(0xd3)),_0x1255c8[_0x55047c(0x100)](_0x1127ad[_0x55047c(0xb2)]({'attributes':['id',_0x55047c(0xc1)]})),_0x1255c8[_0x55047c(0x100)](_0x1127ad[_0x55047c(0xaf)]({'attributes':['id','name']})),_0x1255c8['push'](_0x1127ad[_0x55047c(0xf1)]({'attributes':['id',_0x55047c(0xc1)]})),_0x1255c8[_0x55047c(0x100)](_0x1127ad[_0x55047c(0xc0)]({'attributes':['id',_0x55047c(0xc1)]})),_0x1255c8['push'](_0x1127ad[_0x55047c(0xdf)]({'attributes':['id',_0x55047c(0xc1)]})),_0x1255c8[_0x55047c(0x100)](_0x1127ad[_0x55047c(0xbd)]({'attributes':['id',_0x55047c(0xc1)]})),_0x1255c8['push'](_0x1127ad[_0x55047c(0xda)]({'attributes':['id',_0x55047c(0xc1)]}));break;}return Promise['all'](_0x1255c8);}})[_0x516acf(0x107)](function(_0x207f2b){const _0x195f47=_0x516acf;if(_0x207f2b&&_0x207f2b[_0x195f47(0xab)])for(let _0x164c1c=0x0;_0x164c1c<_0x207f2b['length'];_0x164c1c+=0x1){for(let _0x3d7f38=0x0;_0x3d7f38<_0x207f2b[_0x164c1c][_0x195f47(0xab)];_0x3d7f38+=0x1){switch(_0x164c1c){case 0x0:joinOrLeaveQueues(_0x4a7e74,_0x4432af,_0x195f47(0xe3),_0x207f2b[_0x164c1c][_0x3d7f38]);break;case 0x1:joinOrLeaveQueues(_0x4a7e74,_0x4432af,'chat',_0x207f2b[_0x164c1c][_0x3d7f38]);break;case 0x2:joinOrLeaveQueues(_0x4a7e74,_0x4432af,_0x195f47(0xd1),_0x207f2b[_0x164c1c][_0x3d7f38]);break;case 0x3:joinOrLeaveQueues(_0x4a7e74,_0x4432af,'sms',_0x207f2b[_0x164c1c][_0x3d7f38]);break;case 0x4:joinOrLeaveQueues(_0x4a7e74,_0x4432af,'mail',_0x207f2b[_0x164c1c][_0x3d7f38]);break;case 0x5:joinOrLeaveQueues(_0x4a7e74,_0x4432af,_0x195f47(0xd2),_0x207f2b[_0x164c1c][_0x3d7f38]);break;case 0x6:joinOrLeaveQueues(_0x4a7e74,_0x4432af,_0x195f47(0xc2),_0x207f2b[_0x164c1c][_0x3d7f38]);break;case 0x7:_0x4a7e74[_0x4432af](util['format']('telephone:%s',_0x207f2b[_0x164c1c][_0x3d7f38]['name']));break;case 0x8:_0x4a7e74[_0x4432af](util[_0x195f47(0xcd)](_0x195f47(0xfc),_0x207f2b[_0x164c1c][_0x3d7f38][_0x195f47(0xc1)]));break;case 0x9:_0x4a7e74[_0x4432af](util[_0x195f47(0xcd)](_0x195f47(0xe1),_0x207f2b[_0x164c1c][_0x3d7f38][_0x195f47(0xff)],_0x207f2b[_0x164c1c][_0x3d7f38][_0x195f47(0xc1)]));break;case 0xa:_0x4a7e74[_0x4432af](util[_0x195f47(0xcd)](_0x195f47(0xee),_0x207f2b[_0x164c1c][_0x3d7f38][_0x195f47(0xc1)]));break;}}}})[_0x516acf(0x107)](function(){const _0x939b22=_0x516acf;if(_0x4432af===_0x939b22(0xad)){const _0x7da9ee=_[_0x939b22(0xf4)](_0x240b88[_0x939b22(0xe6)],'id');return _0x240b88[_0x939b22(0x105)](_0x7da9ee)[_0x939b22(0x107)](function(){const _0x56301a=_0x939b22;for(let _0x57b983=0x0;_0x57b983<_0x7da9ee[_0x56301a(0xab)];_0x57b983+=0x1){_0x477e53[_0x56301a(0xdb)](_0x56301a(0x109),{'ChatInteractionId':Number(_0x7da9ee[_0x57b983]),'UserId':Number(_0x240b88['id'])});}});}})[_0x516acf(0x107)](function(){const _0x16a4eb=_0x516acf;if(_0x4432af==='leave'){const _0x24256d=_[_0x16a4eb(0xf4)](_0x240b88[_0x16a4eb(0xf2)],'id');return _0x240b88['removeMailInteractions'](_0x24256d)[_0x16a4eb(0x107)](function(){const _0x49dd31=_0x16a4eb;for(let _0x77bc1f=0x0;_0x77bc1f<_0x24256d[_0x49dd31(0xab)];_0x77bc1f+=0x1){_0x477e53[_0x49dd31(0xdb)]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x24256d[_0x77bc1f]),'UserId':Number(_0x240b88['id'])});}});}})[_0x516acf(0x107)](function(){const _0x1f019f=_0x516acf;if(_0x4432af===_0x1f019f(0xad)){const _0x1a4f18=_[_0x1f019f(0xf4)](_0x240b88[_0x1f019f(0xec)],'id');return _0x240b88['removeFaxInteractions'](_0x1a4f18)[_0x1f019f(0x107)](function(){const _0x38c3af=_0x1f019f;for(let _0xaec229=0x0;_0xaec229<_0x1a4f18[_0x38c3af(0xab)];_0xaec229+=0x1){_0x477e53['emit'](_0x38c3af(0xc7),{'FaxInteractionId':Number(_0x1a4f18[_0xaec229]),'UserId':Number(_0x240b88['id'])});}});}})[_0x516acf(0x107)](function(){const _0x2d50ab=_0x516acf;if(_0x4432af===_0x2d50ab(0xad)){const _0x4fdf0e=_[_0x2d50ab(0xf4)](_0x240b88[_0x2d50ab(0xed)],'id');return _0x240b88[_0x2d50ab(0xd7)](_0x4fdf0e)[_0x2d50ab(0x107)](function(){const _0x720775=_0x2d50ab;for(let _0x283c3c=0x0;_0x283c3c<_0x4fdf0e[_0x720775(0xab)];_0x283c3c+=0x1){_0x477e53[_0x720775(0xdb)](_0x720775(0x103),{'SmsInteractionId':Number(_0x4fdf0e[_0x283c3c]),'UserId':Number(_0x240b88['id'])});}});}})['then'](function(){const _0x5d6bdd=_0x516acf;if(_0x4432af==='leave'){const _0x4b7c85=_['map'](_0x240b88['OpenchannelInteractions'],'id');return _0x240b88[_0x5d6bdd(0xcc)](_0x4b7c85)[_0x5d6bdd(0x107)](function(){const _0x3f1128=_0x5d6bdd;for(let _0x30073b=0x0;_0x30073b<_0x4b7c85[_0x3f1128(0xab)];_0x30073b+=0x1){_0x477e53[_0x3f1128(0xdb)](_0x3f1128(0xfe),{'OpenchannelInteractionId':Number(_0x4b7c85[_0x30073b]),'UserId':Number(_0x240b88['id'])});}});}})[_0x516acf(0x107)](function(){const _0x488c9b=_0x516acf;if(_0x4432af===_0x488c9b(0xad)){const _0x2653b5=_[_0x488c9b(0xf4)](_0x240b88[_0x488c9b(0xbb)],'id');return _0x240b88[_0x488c9b(0xc9)](_0x2653b5)[_0x488c9b(0x107)](function(){const _0x4ee543=_0x488c9b;for(let _0x502447=0x0;_0x502447<_0x2653b5[_0x4ee543(0xab)];_0x502447+=0x1){_0x477e53['emit'](_0x4ee543(0xef),{'WhatsappInteractionId':Number(_0x2653b5[_0x502447]),'UserId':Number(_0x240b88['id'])});}});}})['catch'](function(_0x20b466){_0x4a7e74['log'](_0x20b466);});}function onDisconnect(_0x4fbd58,_0x139f42){const _0x1cd9fd=a1047_0x28ff99;joinOrLeave(_0x4fbd58,_0x1cd9fd(0xad),_0x139f42);}function onConnect(_0x21975c){const _0x1bb34d=a1047_0x28ff99;joinOrLeave(_0x21975c,_0x1bb34d(0xce));}exports['default']=function(_0x2d0e17){_0x2d0e17['on']('connection',function(_0xbd1a01){const _0xa7c605=a1047_0x4722;_0xbd1a01[_0xa7c605(0xf0)](0x0),_0xbd1a01[_0xa7c605(0xc5)]=_0xbd1a01[_0xa7c605(0xb9)][_0xa7c605(0xc4)][_0xa7c605(0x10a)]+':'+_0xbd1a01[_0xa7c605(0xb9)][_0xa7c605(0xc4)][_0xa7c605(0x101)],_0xbd1a01['connectedAt']=new Date(),_0xbd1a01['log']=function(_0x162836){const _0x39ebee=_0xa7c605;console['log'](_0x39ebee(0xfb)+_0xbd1a01[_0x39ebee(0x108)][_0x39ebee(0xc1)]+'['+_0xbd1a01[_0x39ebee(0xc5)]+']',_0x162836);},_0xbd1a01['on'](_0xa7c605(0xd9),function(){const _0x41e10d=_0xa7c605;onDisconnect(_0xbd1a01,_0x2d0e17),_0xbd1a01[_0x41e10d(0xb6)](_0x41e10d(0xea));}),onConnect(_0xbd1a01),_0xbd1a01[_0xa7c605(0xb6)](_0xa7c605(0xfa));});};
\ No newline at end of file
+const a1050_0x4a24=['role','name','ChatQueue','resourceId','query','User','user_has_chat_interactions:remove','log','WhatsappInteraction','telephone:%s','removeFaxInteractions','user','user_has_whatsapp_interactions:remove','user_has_sms_interactions:remove','FaxInteractions','address','getWhatsappQueues','MailInteraction','WhatsappQueues','push','openchannel','WhatsappQueue','DISCONNECTED','OpenchannelInteractions','user_has_fax_interactions:remove','undefined','OpenchannelInteraction','connectedAt','default','connection','SmsInteraction','whatsapp','WhatsappInteractions','ChatInteractions','Telephones','SmsQueue','Trunks','%s:queue:%s','fax','lodash','OpenchannelQueues','voice:outbound','length','user:%s','ChatQueues','Campaign','ChatInteraction','getMailQueues','FaxQueue','SocketIO\x20','telephone','format','getChatQueues','voice:inbound','findAll','VoiceQueues','ivr','getOpenchannelQueues','request','agent','Agents','FaxQueues','removeMailInteractions','then','where','userProfileId','MailInteractions','trunk:%s','user_has_openchannel_interactions:remove','catch','MailQueue','IvrCampaigns','findOne','map','removeWhatsappInteractions','mail','handshake','campaign:%s:%s','autoAssociation','OpenchannelQueue','Trunk','voice','getVoiceQueues','all','MailQueues','SmsQueues','emit','nsp','admin','socketIOConfig','sms','../mysqldb','type','util','removeOpenchannelInteractions','UserProfileResource','leave'];(function(_0x1ad105,_0x1b63bd){const _0x4a24d0=function(_0x481ed1){while(--_0x481ed1){_0x1ad105['push'](_0x1ad105['shift']());}};_0x4a24d0(++_0x1b63bd);}(a1050_0x4a24,0x1d5));const a1050_0x481e=function(_0x1ad105,_0x1b63bd){_0x1ad105=_0x1ad105-0x98;let _0x4a24d0=a1050_0x4a24[_0x1ad105];return _0x4a24d0;};const a1050_0x478979=a1050_0x481e;'use strict';const _=require(a1050_0x478979(0xcf)),util=require(a1050_0x478979(0xa4)),{db}=require(a1050_0x478979(0xa2)),queryQueues={'attributes':['id','name'],'include':[{'as':a1050_0x478979(0xe4),'model':db['User'],'attributes':['id',a1050_0x478979(0xa9),a1050_0x478979(0xa8)],'raw':!![],'where':{'role':a1050_0x478979(0xe3)},'required':![]}]},queryTelephones={'raw':!![],'attributes':['id',a1050_0x478979(0xa9)],'where':{'role':a1050_0x478979(0xda)}},queryTrunks={'raw':!![],'attributes':['id','name']},queryAgents={'raw':!![],'attributes':['id',a1050_0x478979(0xa9)],'where':{'role':'agent'}},queryCampaigns={'raw':!![],'attributes':['id',a1050_0x478979(0xa9),a1050_0x478979(0xa3)],'where':{'type':a1050_0x478979(0xe0)}};function getAssociatedResources(_0x1b379c,_0x2ba4f7,_0xb4aad9){const _0x5368f0=a1050_0x478979;return db['UserProfileSection'][_0x5368f0(0xf0)]({'where':{'name':_0x1b379c,'userProfileId':_0x2ba4f7},'raw':!![]})[_0x5368f0(0xe7)](function(_0x5921cd){const _0x483a80=_0x5368f0;if(_0x5921cd){if(_0x5921cd[_0x483a80(0xf6)]){let _0x300208;switch(_0x1b379c){case _0x483a80(0xdf):case _0x483a80(0xd4):case _0x483a80(0xe5):case _0x483a80(0x9c):case _0x483a80(0x9b):case'OpenchannelQueues':case _0x483a80(0xba):_0x300208=queryQueues;break;case _0x483a80(0xca):_0x300208=queryTelephones;break;case _0x483a80(0xcc):_0x300208=queryTrunks;break;case _0x483a80(0xef):_0x300208=queryCampaigns;break;default:break;}return _0x300208?db[_0xb4aad9][_0x483a80(0xde)](_0x300208):_0x300208;}else return db[_0x483a80(0xa6)]['findAll']({'attributes':[_0x483a80(0xab)],'where':{'sectionId':_0x5921cd['id']},'raw':!![]})[_0x483a80(0xe7)](function(_0x59233f){const _0x5ef863=_0x483a80;if(_0x59233f){const _0x226447={'where':{'id':_['map'](_0x59233f,_0x5ef863(0xab))},'raw':!![]};switch(_0xb4aad9){case'User':_0x226447[_0x5ef863(0xe8)][_0x5ef863(0xa8)]=_0x5ef863(0xda);break;case'Campaign':_0x226447[_0x5ef863(0xe8)][_0x5ef863(0xa3)]='ivr';break;}return db[_0xb4aad9][_0x5ef863(0xde)](_0x226447);}else return[];});}else return[];})[_0x5368f0(0xe7)](function(_0x437089){return _0x437089;});}function joinOrLeaveQueues(_0x1644b8,_0x110ff6,_0x1d8682,_0x39d25e){const _0x60d96=a1050_0x478979;_0x1644b8[_0x110ff6](util[_0x60d96(0xdb)](_0x60d96(0xcd),_0x1d8682,_0x39d25e[_0x60d96(0xa9)]));if(_0x39d25e['Agents'])for(let _0x5797b3=0x0;_0x5797b3<_0x39d25e[_0x60d96(0xe4)][_0x60d96(0xd2)];_0x5797b3+=0x1){_0x1644b8[_0x110ff6](util[_0x60d96(0xdb)](_0x60d96(0xd3),_0x39d25e[_0x60d96(0xe4)][_0x5797b3][_0x60d96(0xa9)]));}}function joinOrLeave(_0x4324a8,_0x5f39e0,_0x55cd5c){const _0x2f8401=a1050_0x478979;let _0x3ce357;_0x4324a8[_0x2f8401(0xf4)]['query']['id']&&db[_0x2f8401(0xad)]['findOne']({'attributes':['id',_0x2f8401(0xa9),_0x2f8401(0xa8),'userProfileId'],'where':{'id':_0x4324a8[_0x2f8401(0xf4)][_0x2f8401(0xac)]['id']},'include':[{'model':db[_0x2f8401(0xd6)],'as':_0x2f8401(0xc9),'attributes':['id'],'raw':!![]},{'model':db[_0x2f8401(0xb9)],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x2f8401(0xb6),'attributes':['id'],'raw':!![]},{'model':db[_0x2f8401(0xc6)],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2f8401(0xc2)],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2f8401(0xb0)],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x2f8401(0xe7)](function(_0x471c09){const _0x3a5586=_0x2f8401;if(_0x471c09){_0x3ce357=_0x471c09,_0x4324a8[_0x5f39e0](util[_0x3a5586(0xdb)](_0x3a5586(0xd3),_0x471c09[_0x3a5586(0xa9)]));const _0xa50b4e=[];switch(_0x471c09[_0x3a5586(0xa8)]){case _0x3a5586(0x9f):_0x4324a8[_0x5f39e0](_0x3a5586(0xdd)),_0x4324a8[_0x5f39e0](_0x3a5586(0xd1));typeof queryQueues['include']!==_0x3a5586(0xc1)&&delete queryQueues['include'];_0xa50b4e[_0x3a5586(0xbb)](db['VoiceQueue'][_0x3a5586(0xde)](queryQueues)),_0xa50b4e['push'](db['ChatQueue'][_0x3a5586(0xde)](queryQueues)),_0xa50b4e[_0x3a5586(0xbb)](db[_0x3a5586(0xd8)][_0x3a5586(0xde)](queryQueues)),_0xa50b4e['push'](db[_0x3a5586(0xcb)][_0x3a5586(0xde)](queryQueues)),_0xa50b4e[_0x3a5586(0xbb)](db[_0x3a5586(0xee)][_0x3a5586(0xde)](queryQueues)),_0xa50b4e[_0x3a5586(0xbb)](db['OpenchannelQueue']['findAll'](queryQueues)),_0xa50b4e['push'](db[_0x3a5586(0xbd)][_0x3a5586(0xde)](queryQueues)),_0xa50b4e[_0x3a5586(0xbb)](db[_0x3a5586(0xad)]['findAll'](queryTelephones)),_0xa50b4e[_0x3a5586(0xbb)](db['Trunk'][_0x3a5586(0xde)](queryTrunks)),_0xa50b4e[_0x3a5586(0xbb)](db[_0x3a5586(0xd5)][_0x3a5586(0xde)](queryCampaigns)),_0xa50b4e[_0x3a5586(0xbb)](db[_0x3a5586(0xad)][_0x3a5586(0xde)](queryAgents));break;case _0x3a5586(0xb3):_0x4324a8[_0x5f39e0]('voice:inbound'),_0x4324a8[_0x5f39e0](_0x3a5586(0xd1)),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources(_0x3a5586(0xdf),_0x471c09[_0x3a5586(0xe9)],'VoiceQueue')),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources(_0x3a5586(0xd4),_0x471c09[_0x3a5586(0xe9)],_0x3a5586(0xaa))),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources('FaxQueues',_0x471c09[_0x3a5586(0xe9)],_0x3a5586(0xd8))),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources(_0x3a5586(0x9c),_0x471c09[_0x3a5586(0xe9)],_0x3a5586(0xcb))),_0xa50b4e['push'](getAssociatedResources(_0x3a5586(0x9b),_0x471c09[_0x3a5586(0xe9)],_0x3a5586(0xee))),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources(_0x3a5586(0xd0),_0x471c09[_0x3a5586(0xe9)],_0x3a5586(0xf7))),_0xa50b4e['push'](getAssociatedResources(_0x3a5586(0xba),_0x471c09[_0x3a5586(0xe9)],_0x3a5586(0xbd))),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources('Telephones',_0x471c09['userProfileId'],_0x3a5586(0xad))),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources(_0x3a5586(0xcc),_0x471c09[_0x3a5586(0xe9)],_0x3a5586(0xf8))),_0xa50b4e[_0x3a5586(0xbb)](getAssociatedResources(_0x3a5586(0xef),_0x471c09[_0x3a5586(0xe9)],'Campaign')),_0xa50b4e[_0x3a5586(0xbb)](db['User']['findAll'](queryAgents));break;case _0x3a5586(0xe3):_0x4324a8[_0x5f39e0](_0x3a5586(0xdd)),_0x4324a8[_0x5f39e0](_0x3a5586(0xd1)),_0xa50b4e[_0x3a5586(0xbb)](_0x471c09[_0x3a5586(0x99)]({'attributes':['id',_0x3a5586(0xa9)]})),_0xa50b4e[_0x3a5586(0xbb)](_0x471c09[_0x3a5586(0xdc)]({'attributes':['id','name']})),_0xa50b4e[_0x3a5586(0xbb)](_0x471c09['getFaxQueues']({'attributes':['id',_0x3a5586(0xa9)]})),_0xa50b4e[_0x3a5586(0xbb)](_0x471c09['getSmsQueues']({'attributes':['id',_0x3a5586(0xa9)]})),_0xa50b4e[_0x3a5586(0xbb)](_0x471c09[_0x3a5586(0xd7)]({'attributes':['id','name']})),_0xa50b4e['push'](_0x471c09[_0x3a5586(0xe1)]({'attributes':['id',_0x3a5586(0xa9)]})),_0xa50b4e[_0x3a5586(0xbb)](_0x471c09[_0x3a5586(0xb8)]({'attributes':['id','name']}));break;}return Promise[_0x3a5586(0x9a)](_0xa50b4e);}})[_0x2f8401(0xe7)](function(_0x25868f){const _0xba4d1d=_0x2f8401;if(_0x25868f&&_0x25868f[_0xba4d1d(0xd2)])for(let _0x242a0c=0x0;_0x242a0c<_0x25868f[_0xba4d1d(0xd2)];_0x242a0c+=0x1){for(let _0x3d4751=0x0;_0x3d4751<_0x25868f[_0x242a0c][_0xba4d1d(0xd2)];_0x3d4751+=0x1){switch(_0x242a0c){case 0x0:joinOrLeaveQueues(_0x4324a8,_0x5f39e0,_0xba4d1d(0x98),_0x25868f[_0x242a0c][_0x3d4751]);break;case 0x1:joinOrLeaveQueues(_0x4324a8,_0x5f39e0,'chat',_0x25868f[_0x242a0c][_0x3d4751]);break;case 0x2:joinOrLeaveQueues(_0x4324a8,_0x5f39e0,_0xba4d1d(0xce),_0x25868f[_0x242a0c][_0x3d4751]);break;case 0x3:joinOrLeaveQueues(_0x4324a8,_0x5f39e0,_0xba4d1d(0xa1),_0x25868f[_0x242a0c][_0x3d4751]);break;case 0x4:joinOrLeaveQueues(_0x4324a8,_0x5f39e0,_0xba4d1d(0xf3),_0x25868f[_0x242a0c][_0x3d4751]);break;case 0x5:joinOrLeaveQueues(_0x4324a8,_0x5f39e0,_0xba4d1d(0xbc),_0x25868f[_0x242a0c][_0x3d4751]);break;case 0x6:joinOrLeaveQueues(_0x4324a8,_0x5f39e0,_0xba4d1d(0xc7),_0x25868f[_0x242a0c][_0x3d4751]);break;case 0x7:_0x4324a8[_0x5f39e0](util[_0xba4d1d(0xdb)](_0xba4d1d(0xb1),_0x25868f[_0x242a0c][_0x3d4751][_0xba4d1d(0xa9)]));break;case 0x8:_0x4324a8[_0x5f39e0](util[_0xba4d1d(0xdb)](_0xba4d1d(0xeb),_0x25868f[_0x242a0c][_0x3d4751][_0xba4d1d(0xa9)]));break;case 0x9:_0x4324a8[_0x5f39e0](util['format'](_0xba4d1d(0xf5),_0x25868f[_0x242a0c][_0x3d4751]['type'],_0x25868f[_0x242a0c][_0x3d4751]['name']));break;case 0xa:_0x4324a8[_0x5f39e0](util[_0xba4d1d(0xdb)](_0xba4d1d(0xd3),_0x25868f[_0x242a0c][_0x3d4751][_0xba4d1d(0xa9)]));break;}}}})[_0x2f8401(0xe7)](function(){const _0x37596a=_0x2f8401;if(_0x5f39e0==='leave'){const _0x3cbc59=_[_0x37596a(0xf1)](_0x3ce357['ChatInteractions'],'id');return _0x3ce357['removeChatInteractions'](_0x3cbc59)[_0x37596a(0xe7)](function(){const _0x49014b=_0x37596a;for(let _0x309c59=0x0;_0x309c59<_0x3cbc59[_0x49014b(0xd2)];_0x309c59+=0x1){_0x55cd5c['emit'](_0x49014b(0xae),{'ChatInteractionId':Number(_0x3cbc59[_0x309c59]),'UserId':Number(_0x3ce357['id'])});}});}})['then'](function(){const _0x40fe71=_0x2f8401;if(_0x5f39e0===_0x40fe71(0xa7)){const _0x5a24e6=_[_0x40fe71(0xf1)](_0x3ce357[_0x40fe71(0xea)],'id');return _0x3ce357[_0x40fe71(0xe6)](_0x5a24e6)[_0x40fe71(0xe7)](function(){const _0x10a276=_0x40fe71;for(let _0x49da0e=0x0;_0x49da0e<_0x5a24e6['length'];_0x49da0e+=0x1){_0x55cd5c[_0x10a276(0x9d)]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5a24e6[_0x49da0e]),'UserId':Number(_0x3ce357['id'])});}});}})[_0x2f8401(0xe7)](function(){const _0x2ca086=_0x2f8401;if(_0x5f39e0==='leave'){const _0x3287cb=_['map'](_0x3ce357[_0x2ca086(0xb6)],'id');return _0x3ce357[_0x2ca086(0xb2)](_0x3287cb)['then'](function(){const _0x295d94=_0x2ca086;for(let _0x16aa43=0x0;_0x16aa43<_0x3287cb[_0x295d94(0xd2)];_0x16aa43+=0x1){_0x55cd5c[_0x295d94(0x9d)](_0x295d94(0xc0),{'FaxInteractionId':Number(_0x3287cb[_0x16aa43]),'UserId':Number(_0x3ce357['id'])});}});}})['then'](function(){const _0x58f083=_0x2f8401;if(_0x5f39e0===_0x58f083(0xa7)){const _0x1905b2=_[_0x58f083(0xf1)](_0x3ce357['SmsInteractions'],'id');return _0x3ce357['removeSmsInteractions'](_0x1905b2)[_0x58f083(0xe7)](function(){const _0x5491b6=_0x58f083;for(let _0x4c61a8=0x0;_0x4c61a8<_0x1905b2[_0x5491b6(0xd2)];_0x4c61a8+=0x1){_0x55cd5c[_0x5491b6(0x9d)](_0x5491b6(0xb5),{'SmsInteractionId':Number(_0x1905b2[_0x4c61a8]),'UserId':Number(_0x3ce357['id'])});}});}})[_0x2f8401(0xe7)](function(){const _0x1e1419=_0x2f8401;if(_0x5f39e0==='leave'){const _0x3ec2f2=_['map'](_0x3ce357[_0x1e1419(0xbf)],'id');return _0x3ce357[_0x1e1419(0xa5)](_0x3ec2f2)[_0x1e1419(0xe7)](function(){const _0x1e5b70=_0x1e1419;for(let _0x3ca3d2=0x0;_0x3ca3d2<_0x3ec2f2['length'];_0x3ca3d2+=0x1){_0x55cd5c[_0x1e5b70(0x9d)](_0x1e5b70(0xec),{'OpenchannelInteractionId':Number(_0x3ec2f2[_0x3ca3d2]),'UserId':Number(_0x3ce357['id'])});}});}})[_0x2f8401(0xe7)](function(){const _0x425d91=_0x2f8401;if(_0x5f39e0==='leave'){const _0x4b4e8b=_[_0x425d91(0xf1)](_0x3ce357[_0x425d91(0xc8)],'id');return _0x3ce357[_0x425d91(0xf2)](_0x4b4e8b)[_0x425d91(0xe7)](function(){const _0x374de9=_0x425d91;for(let _0x1809ce=0x0;_0x1809ce<_0x4b4e8b['length'];_0x1809ce+=0x1){_0x55cd5c[_0x374de9(0x9d)](_0x374de9(0xb4),{'WhatsappInteractionId':Number(_0x4b4e8b[_0x1809ce]),'UserId':Number(_0x3ce357['id'])});}});}})[_0x2f8401(0xed)](function(_0x46d5bd){const _0x192cee=_0x2f8401;_0x4324a8[_0x192cee(0xaf)](_0x46d5bd);});}function onDisconnect(_0x32a835,_0x374360){const _0x466464=a1050_0x478979;joinOrLeave(_0x32a835,_0x466464(0xa7),_0x374360);}function onConnect(_0x5a5721){joinOrLeave(_0x5a5721,'join');}function socketIOConfig(_0x16ebea){const _0x25d771=a1050_0x478979;_0x16ebea['on'](_0x25d771(0xc5),function(_0x927203){const _0x237bd2=_0x25d771;_0x927203['setMaxListeners'](0x0),_0x927203[_0x237bd2(0xb7)]=_0x927203[_0x237bd2(0xe2)][_0x237bd2(0xc5)]['remoteAddress']+':'+_0x927203[_0x237bd2(0xe2)]['connection']['remotePort'],_0x927203[_0x237bd2(0xc3)]=new Date(),_0x927203[_0x237bd2(0xaf)]=function(_0x4ff978){const _0x2d0a0d=_0x237bd2;console['log'](_0x2d0a0d(0xd9)+_0x927203[_0x2d0a0d(0x9e)][_0x2d0a0d(0xa9)]+'['+_0x927203[_0x2d0a0d(0xb7)]+']',_0x4ff978);},_0x927203['on']('disconnect',function(){const _0x4df9cf=_0x237bd2;onDisconnect(_0x927203,_0x16ebea),_0x927203[_0x4df9cf(0xaf)](_0x4df9cf(0xbe));}),onConnect(_0x927203),_0x927203[_0x237bd2(0xaf)]('CONNECTED');});}exports[a1050_0x478979(0xa0)]=socketIOConfig,exports[a1050_0x478979(0xc4)]=socketIOConfig;
\ No newline at end of file