47f40390b18402f6de933dd60966b5be37b86f4c
[motion2.git] / server / services / routing / server / applications / close.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 _0x0986=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger'];(function(_0x4bceba,_0x2bae02){var _0x4a343f=function(_0x28f071){while(--_0x28f071){_0x4bceba['push'](_0x4bceba['shift']());}};_0x4a343f(++_0x2bae02);}(_0x0986,0x106));var _0x6098=function(_0xbc653a,_0x3d6de3){_0xbc653a=_0xbc653a-0x0;var _0x184455=_0x0986[_0xbc653a];return _0x184455;};'use strict';var moment=require(_0x6098('0x0'));var logger=require(_0x6098('0x1'))('routing');var rpc={'chatInteraction':require(_0x6098('0x2')),'openchannelInteraction':require(_0x6098('0x3')),'smsInteraction':require(_0x6098('0x4')),'mailInteraction':require(_0x6098('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6098('0x6'))};exports[_0x6098('0x7')]=function(_0x522452,_0x58b643,_0x1e8261,_0xae6140){return function(_0x3a3d3d){try{logger[_0x6098('0x8')](_0x6098('0x9'),_0x522452,_0x58b643[0x0]);var _0x1cc209={'closed':0x1,'closedAt':moment()[_0x6098('0xa')](_0x6098('0xb')),'closeReason':'system','disposition':_0x58b643[0x0]};if(rpc[_0xae6140[_0x6098('0xc')]+_0x6098('0xd')]){rpc[_0xae6140[_0x6098('0xc')]+_0x6098('0xd')][_0x6098('0xe')](_0xae6140[_0x6098('0xf')]['id'],_0x1cc209)[_0x6098('0x10')](function(_0x1e9d64){logger[_0x6098('0x8')](_0x6098('0x11'),_0x522452,_0xae6140[_0x6098('0xf')]['id']);})[_0x6098('0x12')](function(_0x5d9b16){logger['error'](_0x6098('0x13'),_0x522452,JSON[_0x6098('0x14')](_0x5d9b16));})[_0x6098('0x15')](function(){_0x3a3d3d[_0x6098('0x16')]();});}}catch(_0x370215){logger[_0x6098('0x17')](_0x6098('0x13'),_0x522452,JSON[_0x6098('0x14')](_0x370215));_0x3a3d3d['stop']();}};};