Built motion from commit 5293bb2a.|2.6.30
[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 _0x3714=['DESC','ASC','getContactDialerIvr','scheduledat','GetContactDialerIvr','moveContactManagedDialer','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','Request','CmContact','Contact','getCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority'];(function(_0x53ee22,_0x4465c5){var _0x792275=function(_0xe0fbe4){while(--_0xe0fbe4){_0x53ee22['push'](_0x53ee22['shift']());}};_0x792275(++_0x4465c5);}(_0x3714,0x95));var _0x4371=function(_0x246898,_0x4e02fc){_0x246898=_0x246898-0x0;var _0x2e9ee4=_0x3714[_0x246898];return _0x2e9ee4;};'use strict';var client=require(_0x4371('0x0'));var moment=require(_0x4371('0x1'));exports['getContacts']=function(_0x1e969d,_0x3f7fa8){return function(){return client[_0x4371('0x2')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x1e969d},'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')}],'limit':_0x3f7fa8,'raw':![]},'log':_0x4371('0x5')});};};exports['updateContacts']=function(_0x10028c,_0x5650a7,_0x349031){return function(){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x10028c,'options':{'where':{'VoiceQueueId':_0x5650a7,'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))}},'limit':_0x349031},'log':_0x4371('0x8')});};};exports[_0x4371('0x9')]=function(_0x4a2544){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x4a2544,'options':{'where':{'ContactId':_0x4a2544[_0x4371('0xa')],'ListId':_0x4a2544[_0x4371('0xb')],'VoiceQueueId':_0x4a2544[_0x4371('0xc')],'CampaignId':_0x4a2544[_0x4371('0xd')]}},'log':'rescheduleContact'});};exports[_0x4371('0xe')]=function(_0x263143,_0x48ef33,_0xe5b862){return function(){return client[_0x4371('0x2')](_0x4371('0xf'),{'options':{'where':{'VoiceQueueId':_0x263143,'ListId':_0x48ef33,'ContactId':_0xe5b862}},'log':_0x4371('0xf')});};};exports[_0x4371('0x10')]=function(_0x48f881,_0x447bad,_0x3ebaaa,_0x3decc7){return client[_0x4371('0x2')](_0x4371('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x48f881,'active':![],'scheduledat':{'$lte':moment()['format'](_0x4371('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x447bad}}]},'order':[[_0x4371('0x12'),_0x4371('0x13')],['scheduledat',_0x3decc7],['id',_0x4371('0x14')]],'raw':!![],'limit':_0x3ebaaa},'log':_0x4371('0x11')});};exports[_0x4371('0x15')]=function(_0xa229c4,_0xa5b63f,_0x41a55f){return client[_0x4371('0x2')](_0x4371('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0xa229c4,'active':![],'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))}},'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')}],'order':[[_0x4371('0x12'),'DESC'],[_0x4371('0x16'),_0x41a55f],['id',_0x4371('0x14')]],'raw':!![],'limit':_0xa5b63f},'log':_0x4371('0x17')});};exports[_0x4371('0x18')]=function(_0x2ad3cf,_0x4c40fe){_0x2ad3cf['campaign']=_0x2ad3cf['queue'];return client[_0x4371('0x2')]('MoveContactManagedDialer',{'body':_0x2ad3cf,'options':{'where':{'ContactId':_0x2ad3cf[_0x4371('0xa')],'ListId':_0x2ad3cf[_0x4371('0xb')],'VoiceQueueId':_0x2ad3cf[_0x4371('0xc')],'CampaignId':_0x2ad3cf[_0x4371('0xd')],'active':_0x4c40fe?undefined:!![]}},'log':_0x4371('0x19')});};exports[_0x4371('0x1a')]=function(_0x1b245d){return client[_0x4371('0x2')](_0x4371('0x1b'),{'options':{'where':{'VoiceQueueId':_0x1b245d['id']?_0x1b245d['id']||null:null}},'log':_0x4371('0x1a')});};exports[_0x4371('0x1c')]=function(_0x6478bf){return function(){return client[_0x4371('0x2')](_0x4371('0x1d'),{'options':{'where':{'id':_0x6478bf},'include':[{'model':_0x4371('0x3'),'as':'Contact'},{'model':_0x4371('0x1e'),'as':'Agent','attributes':['id',_0x4371('0x1f')]},{'model':_0x4371('0x20'),'as':_0x4371('0x21'),'attributes':['id',_0x4371('0x1f')]}],'raw':!![]},'log':_0x4371('0x5')});};};exports[_0x4371('0x22')]=function(_0x479e2c,_0x54b4ec,_0x137d76){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x479e2c,'options':{'where':{'id':_0x54b4ec},'limit':_0x137d76},'log':_0x4371('0x8')});};exports[_0x4371('0x23')]=function(_0x2e7cd7,_0x3acddd){return function(){return client[_0x4371('0x2')](_0x4371('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2e7cd7,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))},'UserId':{'$in':_0x3acddd}},'order':[[_0x4371('0x12'),_0x4371('0x13')],[_0x4371('0x16'),_0x4371('0x13')],['id','ASC']],'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')},{'model':_0x4371('0x1e'),'as':'Agent','attributes':['id','name',_0x4371('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x4371('0x11')});};};exports[_0x4371('0x26')]=function(_0x2fc70c,_0x899a78){return client[_0x4371('0x2')](_0x4371('0x27'),{'body':_0x2fc70c,'options':_0x899a78||{},'log':_0x4371('0x27')});};exports[_0x4371('0x28')]=function(_0x5775c8,_0x346a78,_0x1af2a1){return function(){return client[_0x4371('0x2')](_0x4371('0x29'),{'body':{'where':{'voiceQueueIds':_0x5775c8,'interval':_0x346a78,'availableAgentsIds':_0x1af2a1}},'log':'handlePreviewRecallNotifications'});};};