Built motion from commit eddce310.|2.6.12
[motion2.git] / server / services / ami / preview / rpcDb.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 _0x2ac7=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','exten','xcally-motion-preview','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','createAgentHistory','rescheduleContact','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0xfc2edb,_0x27d74f){var _0x42814a=function(_0x84afa0){while(--_0x84afa0){_0xfc2edb['push'](_0xfc2edb['shift']());}};_0x42814a(++_0x27d74f);}(_0x2ac7,0xd8));var _0x72ac=function(_0x1982c5,_0xdf080c){_0x1982c5=_0x1982c5-0x0;var _0xdadbeb=_0x2ac7[_0x1982c5];return _0xdadbeb;};'use strict';var util=require(_0x72ac('0x0'));var BPromise=require('bluebird');var logger=require(_0x72ac('0x1'))(_0x72ac('0x2'));var cmHopper=require(_0x72ac('0x3'));var cmHopperHistory=require(_0x72ac('0x4'));var cmHopperBlack=require(_0x72ac('0x5'));var agentReportPreview=require(_0x72ac('0x6'));var voiceQueueReport=require(_0x72ac('0x7'));function loggerCatch(_0x2bb9be){return function(_0x2160c1){logger[_0x72ac('0x8')](_0x2bb9be,util[_0x72ac('0x9')](_0x2160c1,{'showHidden':![],'depth':null}));};}function create(_0x519fb0){return cmHopperHistory[_0x72ac('0xa')](_0x519fb0)[_0x72ac('0xb')](loggerCatch(_0x72ac('0xc')));}function createAgent(_0x335f8b){return BPromise['resolve']()[_0x72ac('0xd')](agentReportPreview[_0x72ac('0xa')](_0x335f8b))[_0x72ac('0xb')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5f1cc4){return cmHopper[_0x72ac('0xe')](_0x5f1cc4,!![])[_0x72ac('0xb')](loggerCatch(_0x72ac('0xf')));}exports[_0x72ac('0x10')]=function(_0x4e5ea3){return cmHopperBlack[_0x72ac('0x10')](_0x4e5ea3)[_0x72ac('0xb')](loggerCatch(_0x72ac('0x11')));};exports[_0x72ac('0x12')]=function(_0x5da87b){return BPromise[_0x72ac('0x13')]()[_0x72ac('0xd')](cmHopper[_0x72ac('0x12')](_0x5da87b))[_0x72ac('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0x72ac('0xa')]=function(_0x5c8d8b,_0x182fa7){create(_0x5c8d8b)[_0x72ac('0xb')](loggerCatch(_0x182fa7));moveContact(_0x5c8d8b)[_0x72ac('0xb')](loggerCatch(_0x182fa7));};exports[_0x72ac('0x14')]=function(_0x2878c6,_0x1b631d){createAgent(_0x2878c6)[_0x72ac('0xb')](loggerCatch(_0x1b631d));};exports['createCustomerHistory']=function(_0x3f479a,_0x3458f9){create(_0x3f479a)['catch'](loggerCatch(_0x3458f9));};exports['createCustomerFinal']=function(_0x18d818,_0x461f48){moveContact(_0x18d818)['catch'](loggerCatch(_0x461f48));};exports[_0x72ac('0x15')]=function(_0x426918,_0x4f9af2,_0x53fbda){if(_0x4f9af2){_0x426918['UserId']=null;}if(_0x53fbda){_0x426918['active']=![];}return cmHopper[_0x72ac('0x15')](_0x426918)[_0x72ac('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x72ac('0x16')]=function(_0x1a4374){return cmHopper[_0x72ac('0x16')](_0x1a4374)[_0x72ac('0xb')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x56e318){return cmHopper[_0x72ac('0x17')]({'UserId':null},_0x56e318,0x1)[_0x72ac('0xb')](loggerCatch(_0x72ac('0x18')));};exports[_0x72ac('0x19')]=function(_0x4e9a0d){return cmHopper[_0x72ac('0x17')]({'active':![]},_0x4e9a0d,0x1)[_0x72ac('0xb')](loggerCatch(_0x72ac('0x1a')));};exports[_0x72ac('0x1b')]=function(_0x24c7d7){var _0x416103={};_0x416103[_0x72ac('0x1c')]=_0x24c7d7[_0x72ac('0x1c')];_0x416103['uniqueid']=_0x24c7d7[_0x72ac('0x1d')];_0x416103[_0x72ac('0x1e')]=_0x24c7d7[_0x72ac('0x1e')];_0x416103[_0x72ac('0x1f')]=_0x24c7d7[_0x72ac('0x1f')];_0x416103[_0x72ac('0x20')]=_0x24c7d7[_0x72ac('0x20')];_0x416103[_0x72ac('0x21')]=_0x24c7d7['answertime'];_0x416103[_0x72ac('0x22')]=_0x24c7d7[_0x72ac('0x23')];_0x416103[_0x72ac('0x24')]=0x1;_0x416103[_0x72ac('0x25')]=_0x24c7d7['endtime'];_0x416103[_0x72ac('0x26')]=_0x24c7d7['membername'];_0x416103[_0x72ac('0x27')]='from-sip';_0x416103[_0x72ac('0x28')]=_0x72ac('0x29');_0x416103['holdtime']=0x0;_0x416103['assigned']=0x1;_0x416103[_0x72ac('0x2a')]=_0x24c7d7[_0x72ac('0x2b')];_0x416103['queuecallerexitreason']=_0x72ac('0x2c');return BPromise[_0x72ac('0x13')]()[_0x72ac('0xd')](voiceQueueReport['create'](_0x416103))[_0x72ac('0xb')](loggerCatch(_0x72ac('0x2d')));};exports['getContactRecallMe']=function(_0xf83b9f,_0x58a557){return BPromise['resolve']()[_0x72ac('0xd')](cmHopper[_0x72ac('0x2e')](_0xf83b9f,_0x58a557))[_0x72ac('0xb')](loggerCatch(_0x72ac('0x2f')));};exports[_0x72ac('0x30')]=function(_0x29e09a){return cmHopper['rescheduleContact'](_0x29e09a,!![],!![])[_0x72ac('0xb')](loggerCatch('[rescheduleContactInQueue]\x20'));};