Built motion from commit 21186556.|2.6.19
[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 _0x4317=['getContactRecallMe','GetContactRecallMe','ASC','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','moment','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','priority','scheduledat','DESC','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','VoiceQueue','unlockContact'];(function(_0x5bcec7,_0x2db044){var _0x44d420=function(_0x581ab5){while(--_0x581ab5){_0x5bcec7['push'](_0x5bcec7['shift']());}};_0x44d420(++_0x2db044);}(_0x4317,0x7c));var _0x7431=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4317[_0x502c7d];return _0x30b7ed;};'use strict';var client=require('../client');var moment=require(_0x7431('0x0'));exports[_0x7431('0x1')]=function(_0x1ad054,_0x598dd1){return function(){return client[_0x7431('0x2')](_0x7431('0x3'),{'options':{'where':{'VoiceQueueId':_0x1ad054},'include':[{'model':_0x7431('0x4'),'as':_0x7431('0x5')}],'limit':_0x598dd1,'raw':![]},'log':_0x7431('0x6')});};};exports[_0x7431('0x7')]=function(_0x4eb033,_0x57adc1,_0x1e1f35){return function(){return client[_0x7431('0x2')](_0x7431('0x8'),{'body':_0x4eb033,'options':{'where':{'VoiceQueueId':_0x57adc1,'scheduledat':{'$lte':moment()[_0x7431('0x9')](_0x7431('0xa'))}},'limit':_0x1e1f35},'log':_0x7431('0x8')});};};exports[_0x7431('0xb')]=function(_0x2294b8){return client[_0x7431('0x2')](_0x7431('0x8'),{'body':_0x2294b8,'options':{'where':{'ContactId':_0x2294b8[_0x7431('0xc')],'ListId':_0x2294b8[_0x7431('0xd')],'VoiceQueueId':_0x2294b8[_0x7431('0xe')],'CampaignId':_0x2294b8[_0x7431('0xf')]}},'log':_0x7431('0xb')});};exports[_0x7431('0x10')]=function(_0xb01fee,_0x1b23b8,_0x26219e){return function(){return client[_0x7431('0x2')](_0x7431('0x11'),{'options':{'where':{'VoiceQueueId':_0xb01fee,'ListId':_0x1b23b8,'ContactId':_0x26219e}},'log':_0x7431('0x11')});};};exports[_0x7431('0x12')]=function(_0x2257e7,_0x52b047,_0x185f3a,_0x1b13cc){return client[_0x7431('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2257e7,'active':![],'scheduledat':{'$lte':moment()[_0x7431('0x9')](_0x7431('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x52b047}}]},'order':[[_0x7431('0x13'),'DESC'],[_0x7431('0x14'),_0x1b13cc],['id','ASC']],'raw':!![],'limit':_0x185f3a},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x245ed0,_0x1f5096,_0x2fe0df){return client[_0x7431('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x245ed0,'active':![],'scheduledat':{'$lte':moment()['format'](_0x7431('0xa'))}},'include':[{'model':_0x7431('0x4'),'as':_0x7431('0x5')}],'order':[[_0x7431('0x13'),_0x7431('0x15')],[_0x7431('0x14'),_0x2fe0df],['id','ASC']],'raw':!![],'limit':_0x1f5096},'log':'GetContactDialerIvr'});};exports['moveContactManagedDialer']=function(_0x354e0c,_0x901aa2){_0x354e0c['campaign']=_0x354e0c[_0x7431('0x16')];return client[_0x7431('0x2')](_0x7431('0x17'),{'body':_0x354e0c,'options':{'where':{'ContactId':_0x354e0c['ContactId'],'ListId':_0x354e0c[_0x7431('0xd')],'VoiceQueueId':_0x354e0c[_0x7431('0xe')],'CampaignId':_0x354e0c[_0x7431('0xf')],'active':_0x901aa2?undefined:!![]}},'log':_0x7431('0x17')});};exports['countReScheduled']=function(_0x2e9fe7){return client[_0x7431('0x2')](_0x7431('0x18'),{'options':{'where':{'VoiceQueueId':_0x2e9fe7['id']?_0x2e9fe7['id']||null:null}},'log':_0x7431('0x19')});};exports[_0x7431('0x1a')]=function(_0x1eb56c){return function(){return client[_0x7431('0x2')](_0x7431('0x1b'),{'options':{'where':{'id':_0x1eb56c},'include':[{'model':_0x7431('0x4'),'as':_0x7431('0x5')},{'model':_0x7431('0x1c'),'as':_0x7431('0x1d'),'attributes':['id','name']},{'model':_0x7431('0x1e'),'as':'Queue','attributes':['id','name']}],'raw':!![]},'log':_0x7431('0x6')});};};exports[_0x7431('0x1f')]=function(_0x4fd9d4,_0x3052fc,_0x2d3f56){return client[_0x7431('0x2')](_0x7431('0x8'),{'body':_0x4fd9d4,'options':{'where':{'id':_0x3052fc},'limit':_0x2d3f56},'log':_0x7431('0x8')});};exports[_0x7431('0x20')]=function(_0xb184c,_0x26a1be){return function(){return client[_0x7431('0x2')](_0x7431('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xb184c,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x7431('0x9')](_0x7431('0xa'))},'UserId':{'$in':_0x26a1be}},'order':[['priority',_0x7431('0x15')],[_0x7431('0x14'),_0x7431('0x15')],['id',_0x7431('0x22')]],'include':[{'model':'CmContact','as':_0x7431('0x5')},{'model':_0x7431('0x1c'),'as':_0x7431('0x1d'),'attributes':['id','name','voicePause']}],'group':_0x7431('0x23'),'raw':!![]},'log':'GetContactDialer'});};};exports['resetActiveCalls']=function(_0x87e55,_0x5d50f7){return client[_0x7431('0x2')](_0x7431('0x24'),{'body':_0x87e55,'options':_0x5d50f7||{},'log':'ResetActiveCalls'});};exports[_0x7431('0x25')]=function(_0xfd1fb1,_0x54949c,_0x179628){return function(){return client[_0x7431('0x2')](_0x7431('0x26'),{'body':{'where':{'voiceQueueIds':_0xfd1fb1,'interval':_0x54949c,'availableAgentsIds':_0x179628}},'log':_0x7431('0x25')});};};