d867477512ce178b83721a7453c34de9fb4aed34
[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 _0xed1c=['rescheduleContact','[unlockContact]','unlockContact','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','util','../../../../config/logger','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','countReScheduled','[countReScheduled]','[rescheduleContact]'];(function(_0x560546,_0x25f996){var _0x5318d8=function(_0x5b030c){while(--_0x5b030c){_0x560546['push'](_0x560546['shift']());}};_0x5318d8(++_0x25f996);}(_0xed1c,0xe4));var _0xced1=function(_0x50c397,_0xa7af67){_0x50c397=_0x50c397-0x0;var _0x10ecf7=_0xed1c[_0x50c397];return _0x10ecf7;};'use strict';var util=require(_0xced1('0x0'));var logger=require(_0xced1('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xced1('0x2'));function inspectError(_0x329a0a){return util[_0xced1('0x3')](_0x329a0a,{'showHidden':![],'depth':null});}function getContactDialer(_0x47a45c,_0x1e23a9,_0x445160){return cmHopper[_0xced1('0x4')](_0x47a45c['id'],_0x1e23a9,_0x445160,_0x47a45c[_0xced1('0x5')])['catch'](function(_0x2bcf42){_0x47a45c[_0xced1('0x6')]=0x0;logger[_0xced1('0x7')](_0xced1('0x8'),inspectError(_0x2bcf42));});}exports[_0xced1('0x4')]=getContactDialer;function getContactDialerIvr(_0x3221b6,_0x325dd2){return cmHopper[_0xced1('0x9')](_0x3221b6['id'],_0x325dd2,_0x3221b6['dialOrderByScheduledAt'])[_0xced1('0xa')](function(_0x59c820){_0x3221b6[_0xced1('0x6')]=0x0;logger[_0xced1('0x7')](_0xced1('0xb'),inspectError(_0x59c820));});}exports[_0xced1('0x9')]=getContactDialerIvr;function countReScheduled(_0x15f678){return cmHopper[_0xced1('0xc')](_0x15f678)[_0xced1('0xa')](function(_0x5e5637){logger[_0xced1('0x7')](_0xced1('0xd'),inspectError(_0x5e5637));});}exports[_0xced1('0xc')]=countReScheduled;function rescheduleContact(_0x52d96a){return cmHopper['rescheduleContact'](_0x52d96a)[_0xced1('0xa')](function(_0x31a32c){logger['error'](_0xced1('0xe'),inspectError(_0x31a32c));});}exports[_0xced1('0xf')]=rescheduleContact;function unlockContact(_0x3708b1,_0x32100b,_0x47baec){return cmHopper['unlockContact'](_0x3708b1,_0x32100b,_0x47baec)[_0xced1('0xa')](function(_0x4178d8){logger[_0xced1('0x7')](_0xced1('0x10'),inspectError(_0x4178d8));});}exports[_0xced1('0x11')]=unlockContact;function moveContactManagedDialer(_0x292997){return cmHopper['moveContactManagedDialer'](_0x292997)['catch'](function(_0x2a92c8){logger[_0xced1('0x7')](_0xced1('0x12'),inspectError(_0x2a92c8));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x1eac14){return cmHopperBlack[_0xced1('0x13')](_0x1eac14)[_0xced1('0xa')](function(_0x4eed16){logger[_0xced1('0x7')](_0xced1('0x14'),inspectError(_0x4eed16));});}exports[_0xced1('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x4819fd){return cmHopperBlack[_0xced1('0x15')](_0x4819fd)[_0xced1('0xa')](function(_0xc1bd39){logger['error']('[checkIsBlackListIvr]',inspectError(_0xc1bd39));});}exports[_0xced1('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x41ee91,_0x2a6248,_0x20dcb4){return cmHopperAdditionalPhone[_0xced1('0x16')](_0x41ee91,_0x2a6248,_0x20dcb4)['catch'](function(_0x14f47e){logger[_0xced1('0x7')]('[verifyAdditionalPhone]',inspectError(_0x14f47e));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x38f738,_0x258c9a,_0x3af9c0){return cmHopperAdditionalPhone[_0xced1('0x17')](_0x38f738,_0x258c9a,_0x3af9c0)[_0xced1('0xa')](function(_0x25b6e7){logger['error'](_0xced1('0x18'),inspectError(_0x25b6e7));});}exports[_0xced1('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x43cdec){return cmHopperHistory[_0xced1('0x19')](_0x43cdec)[_0xced1('0xa')](function(_0x8b3ffb){logger[_0xced1('0x7')]('[avgHandleTime]',inspectError(_0x8b3ffb));});}exports[_0xced1('0x19')]=avgHandleTime;function createHistory(_0x4ef64e){return cmHopperHistory[_0xced1('0x1a')](_0x4ef64e)[_0xced1('0xa')](function(_0x6dc558){logger[_0xced1('0x7')]('[createHistory]',inspectError(_0x6dc558));});}exports['createHistory']=createHistory;