bce8414a8fc3895726b0347c67633038384afd14
[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 _0x32ad=['interaction','catch','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','info'];(function(_0x3b9028,_0x57ac10){var _0x4106bd=function(_0x431d03){while(--_0x431d03){_0x3b9028['push'](_0x3b9028['shift']());}};_0x4106bd(++_0x57ac10);}(_0x32ad,0xba));var _0xd32a=function(_0x3c5797,_0x3b59e2){_0x3c5797=_0x3c5797-0x0;var _0x49798d=_0x32ad[_0x3c5797];return _0x49798d;};'use strict';var moment=require(_0xd32a('0x0'));var logger=require(_0xd32a('0x1'))('routing');var rpc={'chatInteraction':require(_0xd32a('0x2')),'openchannelInteraction':require(_0xd32a('0x3')),'smsInteraction':require(_0xd32a('0x4')),'mailInteraction':require(_0xd32a('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd32a('0x6'))};exports[_0xd32a('0x7')]=function(_0x427ef2,_0x598a42,_0x3cd3fc,_0x585a35){return function(_0x4d9d4a){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x427ef2,_0x598a42[0x0]);var _0x4e417a={'closed':0x1,'closedAt':moment()['format'](_0xd32a('0x8')),'closeReason':_0xd32a('0x9'),'disposition':_0x598a42[0x0]};if(rpc[_0x585a35[_0xd32a('0xa')]+'Interaction']){rpc[_0x585a35[_0xd32a('0xa')]+_0xd32a('0xb')]['update'](_0x585a35['interaction']['id'],_0x4e417a)[_0xd32a('0xc')](function(_0x11712b){logger[_0xd32a('0xd')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x427ef2,_0x585a35[_0xd32a('0xe')]['id']);})[_0xd32a('0xf')](function(_0x2e50c2){logger['error']('[%s][CLOSE]\x20%s',_0x427ef2,JSON[_0xd32a('0x10')](_0x2e50c2));})[_0xd32a('0x11')](function(){_0x4d9d4a[_0xd32a('0x12')]();});}}catch(_0x1b4b01){logger['error'](_0xd32a('0x13'),_0x427ef2,JSON[_0xd32a('0x10')](_0x1b4b01));_0x4d9d4a[_0xd32a('0x12')]();}};};