Built motion from commit da617fac.|2.6.6
[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 _0xd591=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger'];(function(_0x1ae861,_0x3d11ad){var _0x121d0d=function(_0x9f27ac){while(--_0x9f27ac){_0x1ae861['push'](_0x1ae861['shift']());}};_0x121d0d(++_0x3d11ad);}(_0xd591,0x176));var _0x1d59=function(_0x344346,_0x685e03){_0x344346=_0x344346-0x0;var _0x3defd2=_0xd591[_0x344346];return _0x3defd2;};'use strict';var moment=require('moment');var logger=require(_0x1d59('0x0'))(_0x1d59('0x1'));var rpc={'chatInteraction':require(_0x1d59('0x2')),'openchannelInteraction':require(_0x1d59('0x3')),'smsInteraction':require(_0x1d59('0x4')),'mailInteraction':require(_0x1d59('0x5')),'faxInteraction':require(_0x1d59('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x1d59('0x7')]=function(_0x1b5a44,_0x2d386c,_0xe0b596,_0x327e40){return function(_0x126ca1){try{logger[_0x1d59('0x8')](_0x1d59('0x9'),_0x1b5a44,_0x2d386c[0x0]);var _0x16fafc={'closed':0x1,'closedAt':moment()[_0x1d59('0xa')](_0x1d59('0xb')),'closeReason':_0x1d59('0xc'),'disposition':_0x2d386c[0x0]};if(rpc[_0x327e40['channel']+_0x1d59('0xd')]){rpc[_0x327e40[_0x1d59('0xe')]+'Interaction'][_0x1d59('0xf')](_0x327e40['interaction']['id'],_0x16fafc)[_0x1d59('0x10')](function(_0x3a9fbb){logger[_0x1d59('0x8')](_0x1d59('0x11'),_0x1b5a44,_0x327e40[_0x1d59('0x12')]['id']);})[_0x1d59('0x13')](function(_0x30a173){logger[_0x1d59('0x14')](_0x1d59('0x15'),_0x1b5a44,JSON[_0x1d59('0x16')](_0x30a173));})[_0x1d59('0x17')](function(){_0x126ca1[_0x1d59('0x18')]();});}}catch(_0x2806ec){logger[_0x1d59('0x14')](_0x1d59('0x15'),_0x1b5a44,JSON[_0x1d59('0x16')](_0x2806ec));_0x126ca1[_0x1d59('0x18')]();}};};