Built motion from commit 9d1906d1.|2.5.40
[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 _0x3a7c=['[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x492445,_0x1454f9){var _0x34ca20=function(_0x33e606){while(--_0x33e606){_0x492445['push'](_0x492445['shift']());}};_0x34ca20(++_0x1454f9);}(_0x3a7c,0x115));var _0xc3a7=function(_0x50e001,_0x45aa55){_0x50e001=_0x50e001-0x0;var _0x3fe4a2=_0x3a7c[_0x50e001];return _0x3fe4a2;};'use strict';var moment=require(_0xc3a7('0x0'));var logger=require(_0xc3a7('0x1'))(_0xc3a7('0x2'));var rpc={'chatInteraction':require(_0xc3a7('0x3')),'openchannelInteraction':require(_0xc3a7('0x4')),'smsInteraction':require(_0xc3a7('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xc3a7('0x6')),'whatsappInteraction':require(_0xc3a7('0x7'))};exports[_0xc3a7('0x8')]=function(_0x22ca79,_0xf3c44c,_0x327f37,_0x57bac6){return function(_0x572716){try{logger[_0xc3a7('0x9')](_0xc3a7('0xa'),_0x22ca79,_0xf3c44c[0x0]);var _0x3bfe41={'closed':0x1,'closedAt':moment()['format'](_0xc3a7('0xb')),'closeReason':'system','disposition':_0xf3c44c[0x0]};if(rpc[_0x57bac6['channel']+_0xc3a7('0xc')]){rpc[_0x57bac6['channel']+_0xc3a7('0xc')][_0xc3a7('0xd')](_0x57bac6['interaction']['id'],_0x3bfe41)['then'](function(_0xe4f4a5){logger[_0xc3a7('0x9')](_0xc3a7('0xe'),_0x22ca79,_0x57bac6['interaction']['id']);})[_0xc3a7('0xf')](function(_0x1803d7){logger[_0xc3a7('0x10')](_0xc3a7('0x11'),_0x22ca79,JSON[_0xc3a7('0x12')](_0x1803d7));})[_0xc3a7('0x13')](function(){_0x572716[_0xc3a7('0x14')]();});}}catch(_0x3fbe04){logger[_0xc3a7('0x10')](_0xc3a7('0x11'),_0x22ca79,JSON['stringify'](_0x3fbe04));_0x572716[_0xc3a7('0x14')]();}};};