e5dc65a4aa1ac375c3957ff3770c70f9181c0850
[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 _0x20ea=['error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x20ea,0x8f));var _0xa20e=function(_0x5dc10e,_0x45bd12){_0x5dc10e=_0x5dc10e-0x0;var _0x1d107f=_0x20ea[_0x5dc10e];return _0x1d107f;};'use strict';var moment=require(_0xa20e('0x0'));var logger=require('../../../../config/logger')(_0xa20e('0x1'));var rpc={'chatInteraction':require(_0xa20e('0x2')),'openchannelInteraction':require(_0xa20e('0x3')),'smsInteraction':require(_0xa20e('0x4')),'mailInteraction':require(_0xa20e('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa20e('0x6'))};exports[_0xa20e('0x7')]=function(_0x43fd1f,_0x5408f0,_0x291567,_0x3be1db){return function(_0x57fb90){try{logger[_0xa20e('0x8')](_0xa20e('0x9'),_0x43fd1f,_0x5408f0[0x0]);var _0x336561={'closed':0x1,'closedAt':moment()[_0xa20e('0xa')](_0xa20e('0xb')),'closeReason':_0xa20e('0xc'),'disposition':_0x5408f0[0x0]};if(rpc[_0x3be1db['channel']+_0xa20e('0xd')]){rpc[_0x3be1db['channel']+_0xa20e('0xd')][_0xa20e('0xe')](_0x3be1db['interaction']['id'],_0x336561)[_0xa20e('0xf')](function(_0x1aafef){logger['info'](_0xa20e('0x10'),_0x43fd1f,_0x3be1db['interaction']['id']);})[_0xa20e('0x11')](function(_0x20482e){logger[_0xa20e('0x12')](_0xa20e('0x13'),_0x43fd1f,JSON[_0xa20e('0x14')](_0x20482e));})[_0xa20e('0x15')](function(){_0x57fb90[_0xa20e('0x16')]();});}}catch(_0x6a8eb2){logger[_0xa20e('0x12')](_0xa20e('0x13'),_0x43fd1f,JSON[_0xa20e('0x14')](_0x6a8eb2));_0x57fb90[_0xa20e('0x16')]();}};};