1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x091c=['interaction','catch','[%s][CLOSE]\x20%s','finally','stop','error','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then'];(function(_0x3b906d,_0x4c4f17){var _0x321dc2=function(_0x36dd72){while(--_0x36dd72){_0x3b906d['push'](_0x3b906d['shift']());}};_0x321dc2(++_0x4c4f17);}(_0x091c,0x19f));var _0xc091=function(_0xf135f8,_0x5cc146){_0xf135f8=_0xf135f8-0x0;var _0x4241b4=_0x091c[_0xf135f8];return _0x4241b4;};'use strict';var moment=require(_0xc091('0x0'));var logger=require(_0xc091('0x1'))(_0xc091('0x2'));var rpc={'chatInteraction':require(_0xc091('0x3')),'openchannelInteraction':require(_0xc091('0x4')),'smsInteraction':require(_0xc091('0x5')),'mailInteraction':require(_0xc091('0x6')),'faxInteraction':require(_0xc091('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xc091('0x8')]=function(_0x5569b1,_0x3f67e8,_0x587298,_0x3472ef){return function(_0x148276){try{logger[_0xc091('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x5569b1,_0x3f67e8[0x0]);var _0x2ed683={'closed':0x1,'closedAt':moment()[_0xc091('0xa')](_0xc091('0xb')),'closeReason':_0xc091('0xc'),'disposition':_0x3f67e8[0x0]};if(rpc[_0x3472ef[_0xc091('0xd')]+_0xc091('0xe')]){rpc[_0x3472ef[_0xc091('0xd')]+_0xc091('0xe')][_0xc091('0xf')](_0x3472ef['interaction']['id'],_0x2ed683)[_0xc091('0x10')](function(_0x53fd67){logger[_0xc091('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5569b1,_0x3472ef[_0xc091('0x11')]['id']);})[_0xc091('0x12')](function(_0x5b7aae){logger['error'](_0xc091('0x13'),_0x5569b1,JSON['stringify'](_0x5b7aae));})[_0xc091('0x14')](function(){_0x148276[_0xc091('0x15')]();});}}catch(_0x351c0){logger[_0xc091('0x16')]('[%s][CLOSE]\x20%s',_0x5569b1,JSON[_0xc091('0x17')](_0x351c0));_0x148276['stop']();}};};