b9243989bce3701ddaf1c35ffa3a7d45eb25231d
[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 _0x15c7=['stringify','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','finally','stop','error'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x15c7,0x127));var _0x715c=function(_0x1b6817,_0x6e8d44){_0x1b6817=_0x1b6817-0x0;var _0x53cac8=_0x15c7[_0x1b6817];return _0x53cac8;};'use strict';var moment=require('moment');var logger=require(_0x715c('0x0'))('routing');var rpc={'chatInteraction':require(_0x715c('0x1')),'openchannelInteraction':require(_0x715c('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x715c('0x3'))};exports[_0x715c('0x4')]=function(_0x3569e6,_0x2ba4e0,_0x5ebb80,_0x34f7a7){return function(_0x520d9c){try{logger['info'](_0x715c('0x5'),_0x3569e6,_0x2ba4e0[0x0]);var _0x54f9d4={'closed':0x1,'closedAt':moment()[_0x715c('0x6')](_0x715c('0x7')),'closeReason':_0x715c('0x8'),'disposition':_0x2ba4e0[0x0]};if(rpc[_0x34f7a7[_0x715c('0x9')]+_0x715c('0xa')]){rpc[_0x34f7a7[_0x715c('0x9')]+_0x715c('0xa')]['update'](_0x34f7a7[_0x715c('0xb')]['id'],_0x54f9d4)[_0x715c('0xc')](function(_0x959dc4){logger[_0x715c('0xd')](_0x715c('0xe'),_0x3569e6,_0x34f7a7[_0x715c('0xb')]['id']);})[_0x715c('0xf')](function(_0x392f49){logger['error'](_0x715c('0x10'),_0x3569e6,JSON['stringify'](_0x392f49));})[_0x715c('0x11')](function(){_0x520d9c[_0x715c('0x12')]();});}}catch(_0x1d45e7){logger[_0x715c('0x13')]('[%s][CLOSE]\x20%s',_0x3569e6,JSON[_0x715c('0x14')](_0x1d45e7));_0x520d9c[_0x715c('0x12')]();}};};