Built motion from commit c738b9ac.|2.6.25
[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 _0xc1c6=['verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','temp','error','[getContactDialer]','catch','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]'];(function(_0x3a4f87,_0x3eb334){var _0x1ad862=function(_0x7bc77b){while(--_0x7bc77b){_0x3a4f87['push'](_0x3a4f87['shift']());}};_0x1ad862(++_0x3eb334);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4defcf,_0x1acf19){_0x4defcf=_0x4defcf-0x0;var _0xfa4a1=_0xc1c6[_0x4defcf];return _0xfa4a1;};'use strict';var util=require(_0x6c1c('0x0'));var logger=require(_0x6c1c('0x1'))(_0x6c1c('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x6c1c('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x6c1c('0x4'));function inspectError(_0x40ff59){return util[_0x6c1c('0x5')](_0x40ff59,{'showHidden':![],'depth':null});}function getContactDialer(_0x59f799,_0x56ed6f,_0x32af84){return cmHopper['getContactDialer'](_0x59f799['id'],_0x56ed6f,_0x32af84,_0x59f799[_0x6c1c('0x6')])['catch'](function(_0xe510ca){_0x59f799[_0x6c1c('0x7')]=0x0;logger[_0x6c1c('0x8')](_0x6c1c('0x9'),inspectError(_0xe510ca));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x35f9ab,_0x3ca985){return cmHopper['getContactDialerIvr'](_0x35f9ab['id'],_0x3ca985,_0x35f9ab[_0x6c1c('0x6')])[_0x6c1c('0xa')](function(_0xb3bd12){_0x35f9ab[_0x6c1c('0x7')]=0x0;logger['error'](_0x6c1c('0xb'),inspectError(_0xb3bd12));});}exports[_0x6c1c('0xc')]=getContactDialerIvr;function countReScheduled(_0x40cebf){return cmHopper['countReScheduled'](_0x40cebf)[_0x6c1c('0xa')](function(_0x12a9e6){logger[_0x6c1c('0x8')]('[countReScheduled]',inspectError(_0x12a9e6));});}exports[_0x6c1c('0xd')]=countReScheduled;function rescheduleContact(_0x5e64b7){return cmHopper[_0x6c1c('0xe')](_0x5e64b7)[_0x6c1c('0xa')](function(_0x2d279e){logger[_0x6c1c('0x8')](_0x6c1c('0xf'),inspectError(_0x2d279e));});}exports[_0x6c1c('0xe')]=rescheduleContact;function unlockContact(_0x297c33,_0x41aa74,_0x448f35){return cmHopper['unlockContact'](_0x297c33,_0x41aa74,_0x448f35)[_0x6c1c('0xa')](function(_0x174657){logger['error'](_0x6c1c('0x10'),inspectError(_0x174657));});}exports[_0x6c1c('0x11')]=unlockContact;function moveContactManagedDialer(_0x494ffc){return cmHopper[_0x6c1c('0x12')](_0x494ffc)['catch'](function(_0x338dc2){logger[_0x6c1c('0x8')]('[moveContactManagedDialer]',inspectError(_0x338dc2));});}exports[_0x6c1c('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x59ab38){return cmHopperBlack[_0x6c1c('0x13')](_0x59ab38)[_0x6c1c('0xa')](function(_0x23470e){logger[_0x6c1c('0x8')](_0x6c1c('0x14'),inspectError(_0x23470e));});}exports[_0x6c1c('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1993c5){return cmHopperBlack[_0x6c1c('0x15')](_0x1993c5)[_0x6c1c('0xa')](function(_0x19f4af){logger[_0x6c1c('0x8')](_0x6c1c('0x16'),inspectError(_0x19f4af));});}exports[_0x6c1c('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x9c6c55,_0x31fed2,_0x19c269){return cmHopperAdditionalPhone[_0x6c1c('0x17')](_0x9c6c55,_0x31fed2,_0x19c269)[_0x6c1c('0xa')](function(_0x3a3f13){logger[_0x6c1c('0x8')](_0x6c1c('0x18'),inspectError(_0x3a3f13));});}exports[_0x6c1c('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2ef382,_0x7ff10d,_0x18452d){return cmHopperAdditionalPhone[_0x6c1c('0x19')](_0x2ef382,_0x7ff10d,_0x18452d)[_0x6c1c('0xa')](function(_0x1b9d7d){logger[_0x6c1c('0x8')]('[swapAdditionalPhone]',inspectError(_0x1b9d7d));});}exports[_0x6c1c('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x4d73aa){return cmHopperHistory[_0x6c1c('0x1a')](_0x4d73aa)['catch'](function(_0xcd3179){logger['error'](_0x6c1c('0x1b'),inspectError(_0xcd3179));});}exports[_0x6c1c('0x1a')]=avgHandleTime;function createHistory(_0x504348){return cmHopperHistory[_0x6c1c('0x1c')](_0x504348)[_0x6c1c('0xa')](function(_0x4e13e3){logger[_0x6c1c('0x8')](_0x6c1c('0x1d'),inspectError(_0x4e13e3));});}exports[_0x6c1c('0x1c')]=createHistory;