Built motion from commit d6d69adf.|2.6.33
[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 _0xe49a=['finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','Interaction','channel','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x4a662d,_0x1c3104){var _0x4bcbf7=function(_0x44b74b){while(--_0x44b74b){_0x4a662d['push'](_0x4a662d['shift']());}};_0x4bcbf7(++_0x1c3104);}(_0xe49a,0x152));var _0xae49=function(_0x337dd7,_0x2b4f7c){_0x337dd7=_0x337dd7-0x0;var _0x539e7d=_0xe49a[_0x337dd7];return _0x539e7d;};'use strict';var moment=require(_0xae49('0x0'));var logger=require('../../../../config/logger')(_0xae49('0x1'));var rpc={'chatInteraction':require(_0xae49('0x2')),'openchannelInteraction':require(_0xae49('0x3')),'smsInteraction':require(_0xae49('0x4')),'mailInteraction':require(_0xae49('0x5')),'faxInteraction':require(_0xae49('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xae49('0x7')]=function(_0x251151,_0x4523b5,_0x14fd42,_0x1d4ec6){return function(_0xd3f308){try{logger[_0xae49('0x8')](_0xae49('0x9'),_0x251151,_0x4523b5[0x0]);var _0x3042ac={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x4523b5[0x0]};if(rpc[_0x1d4ec6['channel']+_0xae49('0xa')]){rpc[_0x1d4ec6[_0xae49('0xb')]+'Interaction'][_0xae49('0xc')](_0x1d4ec6[_0xae49('0xd')]['id'],_0x3042ac)[_0xae49('0xe')](function(_0x4c06e5){logger[_0xae49('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x251151,_0x1d4ec6[_0xae49('0xd')]['id']);})[_0xae49('0xf')](function(_0x4bbe53){logger[_0xae49('0x10')](_0xae49('0x11'),_0x251151,JSON[_0xae49('0x12')](_0x4bbe53));})[_0xae49('0x13')](function(){_0xd3f308[_0xae49('0x14')]();});}}catch(_0x1ae909){logger[_0xae49('0x10')](_0xae49('0x11'),_0x251151,JSON[_0xae49('0x12')](_0x1ae909));_0xd3f308[_0xae49('0x14')]();}};};