f6a6682bed98a34330b84996ba5c11195f3fed0c
[motion2.git] / server / services / ami / rpc / cmHopper.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xd5b2=['ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','getContactDialer','format','priority','DESC','ASC','GetContactDialer','scheduledat','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','GetCmHopperPreview','User','Agent','name','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','moment','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact'];(function(_0x4519d0,_0x58d60a){var _0x14d95e=function(_0x3b0eb9){while(--_0x3b0eb9){_0x4519d0['push'](_0x4519d0['shift']());}};_0x14d95e(++_0x58d60a);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xd5b2[_0x24061a];return _0x82054e;};'use strict';var client=require('../client');var moment=require(_0x2d5b('0x0'));exports[_0x2d5b('0x1')]=function(_0x5c9f7a,_0x42b9d5){return function(){return client[_0x2d5b('0x2')](_0x2d5b('0x3'),{'options':{'where':{'VoiceQueueId':_0x5c9f7a},'include':[{'model':_0x2d5b('0x4'),'as':_0x2d5b('0x5')}],'limit':_0x42b9d5,'raw':![]},'log':_0x2d5b('0x6')});};};exports['updateContacts']=function(_0x5c6eba,_0x58cff9,_0x2e1867){return function(){return client['Request'](_0x2d5b('0x7'),{'body':_0x5c6eba,'options':{'where':{'VoiceQueueId':_0x58cff9,'scheduledat':{'$lte':moment()['format'](_0x2d5b('0x8'))}},'limit':_0x2e1867},'log':'UpdateCmHopper'});};};exports[_0x2d5b('0x9')]=function(_0x15b736){return client[_0x2d5b('0x2')](_0x2d5b('0x7'),{'body':_0x15b736,'options':{'where':{'ContactId':_0x15b736[_0x2d5b('0xa')],'ListId':_0x15b736[_0x2d5b('0xb')],'VoiceQueueId':_0x15b736[_0x2d5b('0xc')],'CampaignId':_0x15b736[_0x2d5b('0xd')]}},'log':_0x2d5b('0x9')});};exports[_0x2d5b('0xe')]=function(_0x141e69,_0x5aa39f,_0x426aad){return function(){return client[_0x2d5b('0x2')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x141e69,'ListId':_0x5aa39f,'ContactId':_0x426aad}},'log':'DestroyCmHopper'});};};exports[_0x2d5b('0xf')]=function(_0x3dee67,_0x38a7c1,_0x21c6e2,_0x40ec2c){return client[_0x2d5b('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3dee67,'active':![],'scheduledat':{'$lte':moment()[_0x2d5b('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x38a7c1}}]},'order':[[_0x2d5b('0x11'),_0x2d5b('0x12')],['scheduledat',_0x40ec2c],['id',_0x2d5b('0x13')]],'raw':!![],'limit':_0x21c6e2},'log':_0x2d5b('0x14')});};exports['getContactDialerIvr']=function(_0x10652d,_0x29fb39,_0x4cecb5){return client[_0x2d5b('0x2')](_0x2d5b('0x14'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x10652d,'active':![],'scheduledat':{'$lte':moment()[_0x2d5b('0x10')](_0x2d5b('0x8'))}},'include':[{'model':_0x2d5b('0x4'),'as':_0x2d5b('0x5')}],'order':[[_0x2d5b('0x11'),'DESC'],[_0x2d5b('0x15'),_0x4cecb5],['id',_0x2d5b('0x13')]],'raw':!![],'limit':_0x29fb39},'log':_0x2d5b('0x16')});};exports[_0x2d5b('0x17')]=function(_0x4a5201,_0x13a713){_0x4a5201['campaign']=_0x4a5201[_0x2d5b('0x18')];return client[_0x2d5b('0x2')](_0x2d5b('0x19'),{'body':_0x4a5201,'options':{'where':{'ContactId':_0x4a5201[_0x2d5b('0xa')],'ListId':_0x4a5201[_0x2d5b('0xb')],'VoiceQueueId':_0x4a5201['VoiceQueueId'],'CampaignId':_0x4a5201[_0x2d5b('0xd')],'active':_0x13a713?undefined:!![]}},'log':_0x2d5b('0x19')});};exports['countReScheduled']=function(_0x4e8372){return client[_0x2d5b('0x2')](_0x2d5b('0x1a'),{'options':{'where':{'VoiceQueueId':_0x4e8372['id']?_0x4e8372['id']||null:null}},'log':'countReScheduled'});};exports['getContactPreview']=function(_0x214067){return function(){return client[_0x2d5b('0x2')](_0x2d5b('0x1b'),{'options':{'where':{'id':_0x214067},'include':[{'model':_0x2d5b('0x4'),'as':_0x2d5b('0x5')},{'model':_0x2d5b('0x1c'),'as':_0x2d5b('0x1d'),'attributes':['id',_0x2d5b('0x1e')]},{'model':'VoiceQueue','as':'Queue','attributes':['id',_0x2d5b('0x1e')]}],'raw':!![]},'log':_0x2d5b('0x6')});};};exports[_0x2d5b('0x1f')]=function(_0x2aa2cf,_0x3cacd5,_0x560ee1){return client[_0x2d5b('0x2')](_0x2d5b('0x7'),{'body':_0x2aa2cf,'options':{'where':{'id':_0x3cacd5},'limit':_0x560ee1},'log':_0x2d5b('0x7')});};exports[_0x2d5b('0x20')]=function(_0x57a897,_0x4c95ee){return function(){return client[_0x2d5b('0x2')](_0x2d5b('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x57a897,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x2d5b('0x10')](_0x2d5b('0x8'))},'UserId':{'$in':_0x4c95ee}},'order':[[_0x2d5b('0x11'),_0x2d5b('0x12')],[_0x2d5b('0x15'),_0x2d5b('0x12')],['id','ASC']],'include':[{'model':_0x2d5b('0x4'),'as':'Contact'},{'model':_0x2d5b('0x1c'),'as':_0x2d5b('0x1d'),'attributes':['id','name',_0x2d5b('0x22')]}],'group':_0x2d5b('0x23'),'raw':!![]},'log':_0x2d5b('0x14')});};};exports[_0x2d5b('0x24')]=function(_0xb970e8,_0x3e03ba){return client['Request'](_0x2d5b('0x25'),{'body':_0xb970e8,'options':_0x3e03ba||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x4c2031,_0xc63424,_0x1d7b7f){return function(){return client[_0x2d5b('0x2')](_0x2d5b('0x26'),{'body':{'where':{'voiceQueueIds':_0x4c2031,'interval':_0xc63424,'availableAgentsIds':_0x1d7b7f}},'log':_0x2d5b('0x27')});};};