Built motion from commit (unavailable).|2.5.26
[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 _0xe558=['../../rpc/whatsappInteraction','info','format','system','channel','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','stop','error','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xe558,0x70));var _0x8e55=function(_0x462cdc,_0x1222e0){_0x462cdc=_0x462cdc-0x0;var _0x28bd92=_0xe558[_0x462cdc];return _0x28bd92;};'use strict';var moment=require(_0x8e55('0x0'));var logger=require(_0x8e55('0x1'))(_0x8e55('0x2'));var rpc={'chatInteraction':require(_0x8e55('0x3')),'openchannelInteraction':require(_0x8e55('0x4')),'smsInteraction':require(_0x8e55('0x5')),'mailInteraction':require(_0x8e55('0x6')),'faxInteraction':require(_0x8e55('0x7')),'whatsappInteraction':require(_0x8e55('0x8'))};exports['consequence']=function(_0xf125cc,_0x127fb4,_0x34d4ec,_0x3dff04){return function(_0x3cef42){try{logger[_0x8e55('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0xf125cc,_0x127fb4[0x0]);var _0xe27f09={'closed':0x1,'closedAt':moment()[_0x8e55('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x8e55('0xb'),'disposition':_0x127fb4[0x0]};if(rpc[_0x3dff04['channel']+'Interaction']){rpc[_0x3dff04[_0x8e55('0xc')]+'Interaction']['update'](_0x3dff04['interaction']['id'],_0xe27f09)[_0x8e55('0xd')](function(_0x39fa76){logger[_0x8e55('0x9')](_0x8e55('0xe'),_0xf125cc,_0x3dff04['interaction']['id']);})[_0x8e55('0xf')](function(_0x4fae32){logger['error']('[%s][CLOSE]\x20%s',_0xf125cc,JSON[_0x8e55('0x10')](_0x4fae32));})['finally'](function(){_0x3cef42[_0x8e55('0x11')]();});}}catch(_0x2a5545){logger[_0x8e55('0x12')](_0x8e55('0x13'),_0xf125cc,JSON[_0x8e55('0x10')](_0x2a5545));_0x3cef42[_0x8e55('0x11')]();}};};