72493b56765a742b0e91f3f26ade915ecda7e351
[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 _0x9697=['db.CmHopper.UserId','../client','moment','getContacts','Request','GetCmHopper','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','ContactId','ListId','VoiceQueueId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','getContactDialerIvr','CmContact','ASC','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','VoiceQueue','Queue','name','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause'];(function(_0xab42b5,_0x1dd7c7){var _0x229114=function(_0x2bb2c0){while(--_0x2bb2c0){_0xab42b5['push'](_0xab42b5['shift']());}};_0x229114(++_0x1dd7c7);}(_0x9697,0x159));var _0x7969=function(_0x167e42,_0x2627f4){_0x167e42=_0x167e42-0x0;var _0x59fd9a=_0x9697[_0x167e42];return _0x59fd9a;};'use strict';var client=require(_0x7969('0x0'));var moment=require(_0x7969('0x1'));var _=require('lodash');exports[_0x7969('0x2')]=function(_0x56374a,_0x412dc1){return function(){return client[_0x7969('0x3')](_0x7969('0x4'),{'options':{'where':{'VoiceQueueId':_0x56374a},'include':[{'model':'CmContact','as':_0x7969('0x5')}],'limit':_0x412dc1,'raw':![]},'log':_0x7969('0x6')});};};exports[_0x7969('0x7')]=function(_0x131988,_0x410bbf,_0x355499){return function(){return client[_0x7969('0x3')](_0x7969('0x8'),{'body':_0x131988,'options':{'where':{'VoiceQueueId':_0x410bbf,'scheduledat':{'$lte':moment()[_0x7969('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x355499},'log':_0x7969('0x8')});};};exports['rescheduleContact']=function(_0x355e36){return function(){return client['Request'](_0x7969('0x8'),{'body':_0x355e36,'options':{'where':{'ContactId':_0x355e36[_0x7969('0xa')],'ListId':_0x355e36[_0x7969('0xb')],'VoiceQueueId':_0x355e36[_0x7969('0xc')],'CampaignId':_0x355e36[_0x7969('0xd')]}},'log':_0x7969('0xe')});};};exports[_0x7969('0xf')]=function(_0x7ea055,_0x2e6e5a,_0x3ee8cf){return function(){return client[_0x7969('0x3')](_0x7969('0x10'),{'options':{'where':{'VoiceQueueId':_0x7ea055,'ListId':_0x2e6e5a,'ContactId':_0x3ee8cf}},'log':_0x7969('0x10')});};};exports['getContactDialer']=function(_0x132f9c,_0xf69c1e,_0x1f7e6d,_0x2988f2){return function(){return client[_0x7969('0x3')](_0x7969('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x132f9c,'active':![],'scheduledat':{'$lte':moment()[_0x7969('0x9')](_0x7969('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0xf69c1e}}]},'order':[[_0x7969('0x13'),_0x7969('0x14')],[_0x7969('0x15'),_0x2988f2],['id','ASC']],'raw':!![],'limit':_0x1f7e6d},'log':_0x7969('0x11')});};};exports[_0x7969('0x16')]=function(_0x3ee2f1,_0x358a37,_0x4e371a){return function(){return client[_0x7969('0x3')](_0x7969('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3ee2f1,'active':![],'scheduledat':{'$lte':moment()['format'](_0x7969('0x12'))}},'include':[{'model':_0x7969('0x17'),'as':'Contact'}],'order':[[_0x7969('0x13'),_0x7969('0x14')],[_0x7969('0x15'),_0x4e371a],['id',_0x7969('0x18')]],'raw':!![],'limit':_0x358a37},'log':_0x7969('0x19')});};};exports[_0x7969('0x1a')]=function(_0x58b5c4,_0x4fb049){return function(){_0x58b5c4['campaign']=_0x58b5c4[_0x7969('0x1b')];return client[_0x7969('0x3')](_0x7969('0x1c'),{'body':_0x58b5c4,'options':{'where':{'ContactId':_0x58b5c4['ContactId'],'ListId':_0x58b5c4['ListId'],'VoiceQueueId':_0x58b5c4[_0x7969('0xc')],'CampaignId':_0x58b5c4['CampaignId'],'active':_0x4fb049?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports['countReScheduled']=function(_0x5a1523){return function(){return client[_0x7969('0x3')](_0x7969('0x1d'),{'options':{'where':{'VoiceQueueId':_0x5a1523['id']?_0x5a1523['id']||null:null}},'log':_0x7969('0x1e')});};};exports[_0x7969('0x1f')]=function(_0x5c98e0){return function(){return client[_0x7969('0x3')](_0x7969('0x20'),{'options':{'where':{'id':_0x5c98e0},'include':[{'model':'CmContact','as':_0x7969('0x5')},{'model':_0x7969('0x21'),'as':_0x7969('0x22'),'attributes':['id','name']},{'model':_0x7969('0x23'),'as':_0x7969('0x24'),'attributes':['id',_0x7969('0x25')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x7969('0x26')]=function(_0x3f0590,_0x2a3ac9,_0x2ad493){return function(){return client[_0x7969('0x3')](_0x7969('0x8'),{'body':_0x3f0590,'options':{'where':{'id':_0x2a3ac9},'limit':_0x2ad493},'log':_0x7969('0x8')});};};exports[_0x7969('0x27')]=function(_0x4b1845,_0x288817){return function(){return client[_0x7969('0x3')](_0x7969('0x28'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4b1845,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x7969('0x9')](_0x7969('0x12'))},'UserId':{'$in':_0x288817}},'order':[['priority',_0x7969('0x14')],[_0x7969('0x15'),'DESC'],['id',_0x7969('0x18')]],'include':[{'model':_0x7969('0x17'),'as':'Contact'},{'model':_0x7969('0x21'),'as':_0x7969('0x22'),'attributes':['id','name',_0x7969('0x29')]}],'group':_0x7969('0x2a'),'raw':!![]},'log':_0x7969('0x11')});};};