8848dd8e4be4c1c95431a6ca18cd4d4ebf6bf04c
[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 _0x4fb4=['moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]'];(function(_0x5ade16,_0x3ab6c0){var _0x13696b=function(_0x2e16b5){while(--_0x2e16b5){_0x5ade16['push'](_0x5ade16['shift']());}};_0x13696b(++_0x3ab6c0);}(_0x4fb4,0x190));var _0x44fb=function(_0x57bcaa,_0x229400){_0x57bcaa=_0x57bcaa-0x0;var _0x56f274=_0x4fb4[_0x57bcaa];return _0x56f274;};'use strict';var util=require('util');var logger=require(_0x44fb('0x0'))(_0x44fb('0x1'));var cmHopper=require(_0x44fb('0x2'));var cmHopperAdditionalPhone=require(_0x44fb('0x3'));var cmHopperBlack=require(_0x44fb('0x4'));var cmHopperHistory=require(_0x44fb('0x5'));function inspectError(_0x53ee5d){return util[_0x44fb('0x6')](_0x53ee5d,{'showHidden':![],'depth':null});}function getContactDialer(_0x953327,_0x308b96,_0x26fbd6){return cmHopper[_0x44fb('0x7')](_0x953327['id'],_0x308b96,_0x26fbd6,_0x953327[_0x44fb('0x8')])[_0x44fb('0x9')](function(_0x2a4d75){_0x953327['temp']=0x0;logger[_0x44fb('0xa')](_0x44fb('0xb'),inspectError(_0x2a4d75));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x42fcc2,_0x3d9002){return cmHopper[_0x44fb('0xc')](_0x42fcc2['id'],_0x3d9002,_0x42fcc2[_0x44fb('0x8')])[_0x44fb('0x9')](function(_0x44c83b){_0x42fcc2[_0x44fb('0xd')]=0x0;logger[_0x44fb('0xa')](_0x44fb('0xe'),inspectError(_0x44c83b));});}exports[_0x44fb('0xc')]=getContactDialerIvr;function countReScheduled(_0x4b202d){return cmHopper[_0x44fb('0xf')](_0x4b202d)[_0x44fb('0x9')](function(_0x40cb86){logger[_0x44fb('0xa')](_0x44fb('0x10'),inspectError(_0x40cb86));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x1fc8fa){return cmHopper[_0x44fb('0x11')](_0x1fc8fa)[_0x44fb('0x9')](function(_0x449150){logger[_0x44fb('0xa')]('[rescheduleContact]',inspectError(_0x449150));});}exports[_0x44fb('0x11')]=rescheduleContact;function unlockContact(_0x18268c,_0x472658,_0x147fe0){return cmHopper[_0x44fb('0x12')](_0x18268c,_0x472658,_0x147fe0)[_0x44fb('0x9')](function(_0x19b828){logger['error'](_0x44fb('0x13'),inspectError(_0x19b828));});}exports[_0x44fb('0x12')]=unlockContact;function moveContactManagedDialer(_0x2e0efd){return cmHopper[_0x44fb('0x14')](_0x2e0efd)[_0x44fb('0x9')](function(_0x22c2eb){logger[_0x44fb('0xa')](_0x44fb('0x15'),inspectError(_0x22c2eb));});}exports[_0x44fb('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1fc48c){return cmHopperBlack['checkIsBlackList'](_0x1fc48c)['catch'](function(_0x4b50f5){logger[_0x44fb('0xa')](_0x44fb('0x16'),inspectError(_0x4b50f5));});}exports[_0x44fb('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x544647){return cmHopperBlack[_0x44fb('0x18')](_0x544647)[_0x44fb('0x9')](function(_0x3394e2){logger['error']('[checkIsBlackListIvr]',inspectError(_0x3394e2));});}exports[_0x44fb('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5cf7ec,_0x441d79,_0x4fc66d){return cmHopperAdditionalPhone[_0x44fb('0x19')](_0x5cf7ec,_0x441d79,_0x4fc66d)[_0x44fb('0x9')](function(_0x1f3d5c){logger['error']('[verifyAdditionalPhone]',inspectError(_0x1f3d5c));});}exports[_0x44fb('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xa50a49,_0x1c831e,_0x733c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xa50a49,_0x1c831e,_0x733c)[_0x44fb('0x9')](function(_0x3a7cd1){logger['error']('[swapAdditionalPhone]',inspectError(_0x3a7cd1));});}exports[_0x44fb('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x2611d6){return cmHopperHistory[_0x44fb('0x1b')](_0x2611d6)[_0x44fb('0x9')](function(_0xb7e5e8){logger[_0x44fb('0xa')](_0x44fb('0x1c'),inspectError(_0xb7e5e8));});}exports[_0x44fb('0x1b')]=avgHandleTime;function createHistory(_0x6bd0b4){return cmHopperHistory['createHistory'](_0x6bd0b4)['catch'](function(_0x587984){logger[_0x44fb('0xa')]('[createHistory]',inspectError(_0x587984));});}exports[_0x44fb('0x1d')]=createHistory;