d8d5f97d7316f144809ed202847cf937749ceef3
[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 _0x897d=['getContactRecallMe','ASC','voicePause','db.CmHopper.UserId','../client','moment','getContacts','Request','GetCmHopper','Contact','getCmHopper','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','ContactId','ListId','VoiceQueueId','CampaignId','rescheduleContact','DestroyCmHopper','GetContactDialer','priority','DESC','scheduledat','CmContact','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue'];(function(_0x2ac0e1,_0xbaaa63){var _0x2d40ad=function(_0x4baf3d){while(--_0x4baf3d){_0x2ac0e1['push'](_0x2ac0e1['shift']());}};_0x2d40ad(++_0xbaaa63);}(_0x897d,0xbd));var _0xd897=function(_0xbf5a9,_0x58e315){_0xbf5a9=_0xbf5a9-0x0;var _0x138d27=_0x897d[_0xbf5a9];return _0x138d27;};'use strict';var client=require(_0xd897('0x0'));var moment=require(_0xd897('0x1'));var _=require('lodash');exports[_0xd897('0x2')]=function(_0x321c9a,_0x4daa40){return function(){return client[_0xd897('0x3')](_0xd897('0x4'),{'options':{'where':{'VoiceQueueId':_0x321c9a},'include':[{'model':'CmContact','as':_0xd897('0x5')}],'limit':_0x4daa40,'raw':![]},'log':_0xd897('0x6')});};};exports[_0xd897('0x7')]=function(_0x108694,_0x5164de,_0xd30c5f){return function(){return client['Request']('UpdateCmHopper',{'body':_0x108694,'options':{'where':{'VoiceQueueId':_0x5164de,'scheduledat':{'$lte':moment()[_0xd897('0x8')](_0xd897('0x9'))}},'limit':_0xd30c5f},'log':_0xd897('0xa')});};};exports['rescheduleContact']=function(_0x17b30a){return function(){return client[_0xd897('0x3')](_0xd897('0xa'),{'body':_0x17b30a,'options':{'where':{'ContactId':_0x17b30a[_0xd897('0xb')],'ListId':_0x17b30a[_0xd897('0xc')],'VoiceQueueId':_0x17b30a[_0xd897('0xd')],'CampaignId':_0x17b30a[_0xd897('0xe')]}},'log':_0xd897('0xf')});};};exports['destroyContact']=function(_0x38d592,_0x5ec0c3,_0x18e229){return function(){return client[_0xd897('0x3')](_0xd897('0x10'),{'options':{'where':{'VoiceQueueId':_0x38d592,'ListId':_0x5ec0c3,'ContactId':_0x18e229}},'log':_0xd897('0x10')});};};exports['getContactDialer']=function(_0x1f99bc,_0x480aba,_0x5f097c,_0x30f333){return function(){return client[_0xd897('0x3')](_0xd897('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1f99bc,'active':![],'scheduledat':{'$lte':moment()[_0xd897('0x8')](_0xd897('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x480aba}}]},'order':[[_0xd897('0x12'),_0xd897('0x13')],[_0xd897('0x14'),_0x30f333],['id','ASC']],'raw':!![],'limit':_0x5f097c},'log':'GetContactDialer'});};};exports['getContactDialerIvr']=function(_0x5b967c,_0x1be558,_0x5d23b4){return function(){return client['Request'](_0xd897('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5b967c,'active':![],'scheduledat':{'$lte':moment()[_0xd897('0x8')](_0xd897('0x9'))}},'include':[{'model':_0xd897('0x15'),'as':'Contact'}],'order':[[_0xd897('0x12'),_0xd897('0x13')],[_0xd897('0x14'),_0x5d23b4],['id','ASC']],'raw':!![],'limit':_0x1be558},'log':'GetContactDialerIvr'});};};exports[_0xd897('0x16')]=function(_0x67d010,_0x162797){return function(){_0x67d010['campaign']=_0x67d010[_0xd897('0x17')];return client['Request'](_0xd897('0x18'),{'body':_0x67d010,'options':{'where':{'ContactId':_0x67d010[_0xd897('0xb')],'ListId':_0x67d010[_0xd897('0xc')],'VoiceQueueId':_0x67d010[_0xd897('0xd')],'CampaignId':_0x67d010[_0xd897('0xe')],'active':_0x162797?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports['countReScheduled']=function(_0x53f144){return function(){return client[_0xd897('0x3')](_0xd897('0x19'),{'options':{'where':{'VoiceQueueId':_0x53f144['id']?_0x53f144['id']||null:null}},'log':'countReScheduled'});};};exports[_0xd897('0x1a')]=function(_0x1a1a00){return function(){return client['Request'](_0xd897('0x1b'),{'options':{'where':{'id':_0x1a1a00},'include':[{'model':'CmContact','as':'Contact'},{'model':_0xd897('0x1c'),'as':_0xd897('0x1d'),'attributes':['id',_0xd897('0x1e')]},{'model':_0xd897('0x1f'),'as':_0xd897('0x20'),'attributes':['id',_0xd897('0x1e')]}],'raw':!![]},'log':_0xd897('0x6')});};};exports['unlockContact']=function(_0x509f6a,_0x205a98,_0x39531d){return function(){return client['Request'](_0xd897('0xa'),{'body':_0x509f6a,'options':{'where':{'id':_0x205a98},'limit':_0x39531d},'log':_0xd897('0xa')});};};exports[_0xd897('0x21')]=function(_0x541c66,_0x59f93c){return function(){return client[_0xd897('0x3')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x541c66,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xd897('0x8')](_0xd897('0x9'))},'UserId':{'$in':_0x59f93c}},'order':[[_0xd897('0x12'),_0xd897('0x13')],[_0xd897('0x14'),_0xd897('0x13')],['id',_0xd897('0x22')]],'include':[{'model':_0xd897('0x15'),'as':_0xd897('0x5')},{'model':_0xd897('0x1c'),'as':_0xd897('0x1d'),'attributes':['id',_0xd897('0x1e'),_0xd897('0x23')]}],'group':_0xd897('0x24'),'raw':!![]},'log':_0xd897('0x11')});};};