Built motion from commit b0a9a629.|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 _0xbcc0=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','info','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','interaction','catch','error','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger'];(function(_0x4fb4c7,_0x856112){var _0x10eab0=function(_0x3196be){while(--_0x3196be){_0x4fb4c7['push'](_0x4fb4c7['shift']());}};_0x10eab0(++_0x856112);}(_0xbcc0,0xfd));var _0x0bcc=function(_0x204893,_0x4daa6e){_0x204893=_0x204893-0x0;var _0x58512b=_0xbcc0[_0x204893];return _0x58512b;};'use strict';var moment=require(_0x0bcc('0x0'));var logger=require(_0x0bcc('0x1'))(_0x0bcc('0x2'));var rpc={'chatInteraction':require(_0x0bcc('0x3')),'openchannelInteraction':require(_0x0bcc('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0bcc('0x5'))};exports['consequence']=function(_0x259c7c,_0x18fb3e,_0x38fe40,_0x453cd7){return function(_0x1a034b){try{logger[_0x0bcc('0x6')]('[%s][CLOSE]\x20reason\x20%s',_0x259c7c,_0x18fb3e[0x0]);var _0x4bd74d={'closed':0x1,'closedAt':moment()[_0x0bcc('0x7')](_0x0bcc('0x8')),'closeReason':'system','disposition':_0x18fb3e[0x0]};if(rpc[_0x453cd7['channel']+_0x0bcc('0x9')]){rpc[_0x453cd7[_0x0bcc('0xa')]+'Interaction']['update'](_0x453cd7[_0x0bcc('0xb')]['id'],_0x4bd74d)['then'](function(_0x7a4b8a){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x259c7c,_0x453cd7['interaction']['id']);})[_0x0bcc('0xc')](function(_0x120c55){logger[_0x0bcc('0xd')]('[%s][CLOSE]\x20%s',_0x259c7c,JSON['stringify'](_0x120c55));})[_0x0bcc('0xe')](function(){_0x1a034b[_0x0bcc('0xf')]();});}}catch(_0x27f169){logger[_0x0bcc('0xd')](_0x0bcc('0x10'),_0x259c7c,JSON['stringify'](_0x27f169));_0x1a034b[_0x0bcc('0xf')]();}};};