Built motion from commit c0cdc9d8.|2.6.28
[motion2.git] / server / services / ami / dialer / utils / hopper.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 _0xa6b0=['[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x16d87d,_0x3393f5){_0x16d87d=_0x16d87d-0x0;var _0xd2774=_0xa6b0[_0x16d87d];return _0xd2774;};'use strict';var util=require(_0x0a6b('0x0'));var logger=require(_0x0a6b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x0a6b('0x2'));var cmHopperBlack=require(_0x0a6b('0x3'));var cmHopperHistory=require(_0x0a6b('0x4'));function inspectError(_0x4c9a84){return util[_0x0a6b('0x5')](_0x4c9a84,{'showHidden':![],'depth':null});}function getContactDialer(_0x33e8c3,_0x195697,_0xc7140c){return cmHopper[_0x0a6b('0x6')](_0x33e8c3['id'],_0x195697,_0xc7140c,_0x33e8c3[_0x0a6b('0x7')])[_0x0a6b('0x8')](function(_0xa908dd){_0x33e8c3[_0x0a6b('0x9')]=0x0;logger[_0x0a6b('0xa')](_0x0a6b('0xb'),inspectError(_0xa908dd));});}exports[_0x0a6b('0x6')]=getContactDialer;function getContactDialerIvr(_0x5046d8,_0x493948){return cmHopper[_0x0a6b('0xc')](_0x5046d8['id'],_0x493948,_0x5046d8[_0x0a6b('0x7')])[_0x0a6b('0x8')](function(_0x25ad47){_0x5046d8[_0x0a6b('0x9')]=0x0;logger[_0x0a6b('0xa')](_0x0a6b('0xd'),inspectError(_0x25ad47));});}exports[_0x0a6b('0xc')]=getContactDialerIvr;function countReScheduled(_0x8bbed9){return cmHopper[_0x0a6b('0xe')](_0x8bbed9)[_0x0a6b('0x8')](function(_0x890493){logger[_0x0a6b('0xa')](_0x0a6b('0xf'),inspectError(_0x890493));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x5e59a5){return cmHopper[_0x0a6b('0x10')](_0x5e59a5)[_0x0a6b('0x8')](function(_0x2abc4e){logger[_0x0a6b('0xa')](_0x0a6b('0x11'),inspectError(_0x2abc4e));});}exports[_0x0a6b('0x10')]=rescheduleContact;function unlockContact(_0x9bb98e,_0x19e84c,_0x1205a3){return cmHopper[_0x0a6b('0x12')](_0x9bb98e,_0x19e84c,_0x1205a3)['catch'](function(_0xa36d75){logger[_0x0a6b('0xa')]('[unlockContact]',inspectError(_0xa36d75));});}exports[_0x0a6b('0x12')]=unlockContact;function moveContactManagedDialer(_0x4d0e3b){return cmHopper[_0x0a6b('0x13')](_0x4d0e3b)[_0x0a6b('0x8')](function(_0x2cb10b){logger[_0x0a6b('0xa')]('[moveContactManagedDialer]',inspectError(_0x2cb10b));});}exports[_0x0a6b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x296162){return cmHopperBlack['checkIsBlackList'](_0x296162)[_0x0a6b('0x8')](function(_0x3f23b4){logger[_0x0a6b('0xa')]('[checkIsBlackList]',inspectError(_0x3f23b4));});}exports[_0x0a6b('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x93a465){return cmHopperBlack[_0x0a6b('0x15')](_0x93a465)['catch'](function(_0x220d3e){logger[_0x0a6b('0xa')](_0x0a6b('0x16'),inspectError(_0x220d3e));});}exports[_0x0a6b('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x122c19,_0x53848c,_0x1e5065){return cmHopperAdditionalPhone[_0x0a6b('0x17')](_0x122c19,_0x53848c,_0x1e5065)[_0x0a6b('0x8')](function(_0x5c77fb){logger[_0x0a6b('0xa')](_0x0a6b('0x18'),inspectError(_0x5c77fb));});}exports[_0x0a6b('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1b8b78,_0x3b12a2,_0x5b2229){return cmHopperAdditionalPhone[_0x0a6b('0x19')](_0x1b8b78,_0x3b12a2,_0x5b2229)[_0x0a6b('0x8')](function(_0x19a653){logger['error'](_0x0a6b('0x1a'),inspectError(_0x19a653));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0xecbf0c){return cmHopperHistory[_0x0a6b('0x1b')](_0xecbf0c)[_0x0a6b('0x8')](function(_0x4884a1){logger['error'](_0x0a6b('0x1c'),inspectError(_0x4884a1));});}exports[_0x0a6b('0x1b')]=avgHandleTime;function createHistory(_0x1aecc7){return cmHopperHistory[_0x0a6b('0x1d')](_0x1aecc7)[_0x0a6b('0x8')](function(_0x2bbcb1){logger['error'](_0x0a6b('0x1e'),inspectError(_0x2bbcb1));});}exports[_0x0a6b('0x1d')]=createHistory;