09e7ba84b06a691576ae4b689436d93bd7a17e97
[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 _0x5574=['Interaction','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','channel'];(function(_0x422162,_0x159c4c){var _0x5af2f8=function(_0x46f5ad){while(--_0x46f5ad){_0x422162['push'](_0x422162['shift']());}};_0x5af2f8(++_0x159c4c);}(_0x5574,0xe6));var _0x4557=function(_0x29fdd7,_0x252b01){_0x29fdd7=_0x29fdd7-0x0;var _0x53357a=_0x5574[_0x29fdd7];return _0x53357a;};'use strict';var moment=require(_0x4557('0x0'));var logger=require('../../../../config/logger')(_0x4557('0x1'));var rpc={'chatInteraction':require(_0x4557('0x2')),'openchannelInteraction':require(_0x4557('0x3')),'smsInteraction':require(_0x4557('0x4')),'mailInteraction':require(_0x4557('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4557('0x6'))};exports[_0x4557('0x7')]=function(_0x362251,_0xf6383c,_0x42dcc2,_0x2ab204){return function(_0xf347b6){try{logger['info'](_0x4557('0x8'),_0x362251,_0xf6383c[0x0]);var _0x32fb4f={'closed':0x1,'closedAt':moment()[_0x4557('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x4557('0xa'),'disposition':_0xf6383c[0x0]};if(rpc[_0x2ab204[_0x4557('0xb')]+'Interaction']){rpc[_0x2ab204[_0x4557('0xb')]+_0x4557('0xc')]['update'](_0x2ab204[_0x4557('0xd')]['id'],_0x32fb4f)[_0x4557('0xe')](function(_0x419573){logger[_0x4557('0xf')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x362251,_0x2ab204[_0x4557('0xd')]['id']);})[_0x4557('0x10')](function(_0x18888a){logger[_0x4557('0x11')](_0x4557('0x12'),_0x362251,JSON['stringify'](_0x18888a));})[_0x4557('0x13')](function(){_0xf347b6['stop']();});}}catch(_0x57a93a){logger[_0x4557('0x11')](_0x4557('0x12'),_0x362251,JSON[_0x4557('0x14')](_0x57a93a));_0xf347b6[_0x4557('0x15')]();}};};