97d52de91f4e8c7d35b82441c7553910e9ec0acb
[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 _0xfb15=['format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x23291e,_0x42779e){var _0x3083e0=function(_0x3bd78){while(--_0x3bd78){_0x23291e['push'](_0x23291e['shift']());}};_0x3083e0(++_0x42779e);}(_0xfb15,0x12f));var _0x5fb1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfb15[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x5fb1('0x0'));var logger=require(_0x5fb1('0x1'))(_0x5fb1('0x2'));var rpc={'chatInteraction':require(_0x5fb1('0x3')),'openchannelInteraction':require(_0x5fb1('0x4')),'smsInteraction':require(_0x5fb1('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5fb1('0x6')),'whatsappInteraction':require(_0x5fb1('0x7'))};exports[_0x5fb1('0x8')]=function(_0x139471,_0x41fcda,_0x23e770,_0x51a96b){return function(_0x2e68c9){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x139471,_0x41fcda[0x0]);var _0x267223={'closed':0x1,'closedAt':moment()[_0x5fb1('0x9')](_0x5fb1('0xa')),'closeReason':_0x5fb1('0xb'),'disposition':_0x41fcda[0x0]};if(rpc[_0x51a96b[_0x5fb1('0xc')]+_0x5fb1('0xd')]){rpc[_0x51a96b[_0x5fb1('0xc')]+_0x5fb1('0xd')][_0x5fb1('0xe')](_0x51a96b[_0x5fb1('0xf')]['id'],_0x267223)[_0x5fb1('0x10')](function(_0x226f2d){logger[_0x5fb1('0x11')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x139471,_0x51a96b[_0x5fb1('0xf')]['id']);})[_0x5fb1('0x12')](function(_0x57593c){logger[_0x5fb1('0x13')](_0x5fb1('0x14'),_0x139471,JSON['stringify'](_0x57593c));})[_0x5fb1('0x15')](function(){_0x2e68c9[_0x5fb1('0x16')]();});}}catch(_0x348c9f){logger[_0x5fb1('0x13')](_0x5fb1('0x14'),_0x139471,JSON[_0x5fb1('0x17')](_0x348c9f));_0x2e68c9[_0x5fb1('0x16')]();}};};