39eb8c7ee76af2ee11e9e94d5ed7a7f1af88b511
[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 _0x69fd=['../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','finally','stop','error','moment'];(function(_0x22a6f6,_0x5d6ea9){var _0x464440=function(_0x147c88){while(--_0x147c88){_0x22a6f6['push'](_0x22a6f6['shift']());}};_0x464440(++_0x5d6ea9);}(_0x69fd,0x179));var _0xd69f=function(_0x3d70,_0x61adbe){_0x3d70=_0x3d70-0x0;var _0x59dc8a=_0x69fd[_0x3d70];return _0x59dc8a;};'use strict';var moment=require(_0xd69f('0x0'));var logger=require(_0xd69f('0x1'))('routing');var rpc={'chatInteraction':require(_0xd69f('0x2')),'openchannelInteraction':require(_0xd69f('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xd69f('0x4')),'whatsappInteraction':require(_0xd69f('0x5'))};exports[_0xd69f('0x6')]=function(_0x2f11fb,_0x249da8,_0x1a6c1f,_0x10741a){return function(_0x42777b){try{logger['info'](_0xd69f('0x7'),_0x2f11fb,_0x249da8[0x0]);var _0x4551c3={'closed':0x1,'closedAt':moment()[_0xd69f('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x249da8[0x0]};if(rpc[_0x10741a[_0xd69f('0x9')]+_0xd69f('0xa')]){rpc[_0x10741a[_0xd69f('0x9')]+_0xd69f('0xa')][_0xd69f('0xb')](_0x10741a[_0xd69f('0xc')]['id'],_0x4551c3)[_0xd69f('0xd')](function(_0x109108){logger[_0xd69f('0xe')](_0xd69f('0xf'),_0x2f11fb,_0x10741a['interaction']['id']);})[_0xd69f('0x10')](function(_0x446c87){logger['error']('[%s][CLOSE]\x20%s',_0x2f11fb,JSON[_0xd69f('0x11')](_0x446c87));})[_0xd69f('0x12')](function(){_0x42777b[_0xd69f('0x13')]();});}}catch(_0x1a7309){logger[_0xd69f('0x14')]('[%s][CLOSE]\x20%s',_0x2f11fb,JSON[_0xd69f('0x11')](_0x1a7309));_0x42777b[_0xd69f('0x13')]();}};};