Built motion from commit f9526609.|2.6.29
[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 _0xef17=['util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','temp','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x4586a2,_0x598025){var _0x336e79=function(_0x56285c){while(--_0x56285c){_0x4586a2['push'](_0x4586a2['shift']());}};_0x336e79(++_0x598025);}(_0xef17,0x136));var _0x7ef1=function(_0x989fa7,_0x481df1){_0x989fa7=_0x989fa7-0x0;var _0x1133ab=_0xef17[_0x989fa7];return _0x1133ab;};'use strict';var util=require(_0x7ef1('0x0'));var logger=require(_0x7ef1('0x1'))(_0x7ef1('0x2'));var cmHopper=require(_0x7ef1('0x3'));var cmHopperAdditionalPhone=require(_0x7ef1('0x4'));var cmHopperBlack=require(_0x7ef1('0x5'));var cmHopperHistory=require(_0x7ef1('0x6'));function inspectError(_0x19a10d){return util[_0x7ef1('0x7')](_0x19a10d,{'showHidden':![],'depth':null});}function getContactDialer(_0x538a0a,_0x1d2f83,_0x514b70){return cmHopper[_0x7ef1('0x8')](_0x538a0a['id'],_0x1d2f83,_0x514b70,_0x538a0a['dialOrderByScheduledAt'])[_0x7ef1('0x9')](function(_0x4ba2f0){_0x538a0a['temp']=0x0;logger[_0x7ef1('0xa')](_0x7ef1('0xb'),inspectError(_0x4ba2f0));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0xeb10e9,_0x1d5b33){return cmHopper[_0x7ef1('0xc')](_0xeb10e9['id'],_0x1d5b33,_0xeb10e9[_0x7ef1('0xd')])[_0x7ef1('0x9')](function(_0x3ce78d){_0xeb10e9[_0x7ef1('0xe')]=0x0;logger['error']('[getContactDialerIvr]',inspectError(_0x3ce78d));});}exports[_0x7ef1('0xc')]=getContactDialerIvr;function countReScheduled(_0x4dc653){return cmHopper['countReScheduled'](_0x4dc653)['catch'](function(_0x122c8a){logger['error'](_0x7ef1('0xf'),inspectError(_0x122c8a));});}exports[_0x7ef1('0x10')]=countReScheduled;function rescheduleContact(_0x32eed0){return cmHopper[_0x7ef1('0x11')](_0x32eed0)[_0x7ef1('0x9')](function(_0x317125){logger[_0x7ef1('0xa')](_0x7ef1('0x12'),inspectError(_0x317125));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x4de80f,_0x267f0e,_0x5d0499){return cmHopper[_0x7ef1('0x13')](_0x4de80f,_0x267f0e,_0x5d0499)[_0x7ef1('0x9')](function(_0x55e84e){logger['error']('[unlockContact]',inspectError(_0x55e84e));});}exports[_0x7ef1('0x13')]=unlockContact;function moveContactManagedDialer(_0x4da0fa){return cmHopper[_0x7ef1('0x14')](_0x4da0fa)['catch'](function(_0x5a7b2b){logger['error'](_0x7ef1('0x15'),inspectError(_0x5a7b2b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x38c5a7){return cmHopperBlack[_0x7ef1('0x16')](_0x38c5a7)['catch'](function(_0x568d0a){logger[_0x7ef1('0xa')]('[checkIsBlackList]',inspectError(_0x568d0a));});}exports[_0x7ef1('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x33f89b){return cmHopperBlack[_0x7ef1('0x17')](_0x33f89b)[_0x7ef1('0x9')](function(_0x38edd8){logger[_0x7ef1('0xa')](_0x7ef1('0x18'),inspectError(_0x38edd8));});}exports[_0x7ef1('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x490162,_0x2a1bdd,_0x3b118f){return cmHopperAdditionalPhone[_0x7ef1('0x19')](_0x490162,_0x2a1bdd,_0x3b118f)[_0x7ef1('0x9')](function(_0x31b5bf){logger[_0x7ef1('0xa')](_0x7ef1('0x1a'),inspectError(_0x31b5bf));});}exports[_0x7ef1('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x508a5f,_0x4b1ace,_0x33e008){return cmHopperAdditionalPhone[_0x7ef1('0x1b')](_0x508a5f,_0x4b1ace,_0x33e008)[_0x7ef1('0x9')](function(_0xcfce5e){logger[_0x7ef1('0xa')]('[swapAdditionalPhone]',inspectError(_0xcfce5e));});}exports[_0x7ef1('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x9eca93){return cmHopperHistory[_0x7ef1('0x1c')](_0x9eca93)[_0x7ef1('0x9')](function(_0x232f4e){logger[_0x7ef1('0xa')](_0x7ef1('0x1d'),inspectError(_0x232f4e));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2e8f1b){return cmHopperHistory['createHistory'](_0x2e8f1b)[_0x7ef1('0x9')](function(_0x2546bf){logger['error']('[createHistory]',inspectError(_0x2546bf));});}exports[_0x7ef1('0x1e')]=createHistory;