44e6a75b7eb96440afc4a4536c48ff473301d212
[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 _0x5d86=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger'];(function(_0x19d75a,_0x5ccb8b){var _0x387dc5=function(_0x1bd9ff){while(--_0x1bd9ff){_0x19d75a['push'](_0x19d75a['shift']());}};_0x387dc5(++_0x5ccb8b);}(_0x5d86,0x76));var _0x65d8=function(_0x1d3fdc,_0x2b5c54){_0x1d3fdc=_0x1d3fdc-0x0;var _0x128bb0=_0x5d86[_0x1d3fdc];return _0x128bb0;};'use strict';var moment=require(_0x65d8('0x0'));var logger=require(_0x65d8('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x65d8('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x65d8('0x3')),'faxInteraction':require(_0x65d8('0x4'))};exports['consequence']=function(_0x275f44,_0x5c4bb3,_0x8aeb53,_0x50c922){return function(_0x1581a6){try{logger[_0x65d8('0x5')]('[%s][CLOSE]\x20reason\x20%s',_0x275f44,_0x5c4bb3[0x0]);var _0x41a4d8={'closed':0x1,'closedAt':moment()[_0x65d8('0x6')](_0x65d8('0x7')),'closeReason':_0x65d8('0x8'),'disposition':_0x5c4bb3[0x0]};if(rpc[_0x50c922[_0x65d8('0x9')]+_0x65d8('0xa')]){rpc[_0x50c922[_0x65d8('0x9')]+'Interaction']['update'](_0x50c922['interaction']['id'],_0x41a4d8)[_0x65d8('0xb')](function(_0xee232){logger[_0x65d8('0x5')](_0x65d8('0xc'),_0x275f44,_0x50c922[_0x65d8('0xd')]['id']);})[_0x65d8('0xe')](function(_0xa80464){logger[_0x65d8('0xf')]('[%s][CLOSE]\x20%s',_0x275f44,JSON[_0x65d8('0x10')](_0xa80464));})[_0x65d8('0x11')](function(){_0x1581a6[_0x65d8('0x12')]();});}}catch(_0x57c9cd){logger['error'](_0x65d8('0x13'),_0x275f44,JSON[_0x65d8('0x10')](_0x57c9cd));_0x1581a6[_0x65d8('0x12')]();}};};