5786aad56d984dae3926b294c3daa7d510be1080
[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 _0xa685=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x1cac7d,_0x587638){var _0x468636=function(_0x455ba1){while(--_0x455ba1){_0x1cac7d['push'](_0x1cac7d['shift']());}};_0x468636(++_0x587638);}(_0xa685,0xc1));var _0x5a68=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xa685[_0x2a56ad];return _0x425175;};'use strict';var moment=require(_0x5a68('0x0'));var logger=require(_0x5a68('0x1'))(_0x5a68('0x2'));var rpc={'chatInteraction':require(_0x5a68('0x3')),'openchannelInteraction':require(_0x5a68('0x4')),'smsInteraction':require(_0x5a68('0x5')),'mailInteraction':require(_0x5a68('0x6')),'faxInteraction':require(_0x5a68('0x7')),'whatsappInteraction':require(_0x5a68('0x8'))};exports['consequence']=function(_0x4dbbd6,_0x261ec0,_0x3f6a9d,_0x97b767){return function(_0xb81191){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x4dbbd6,_0x261ec0[0x0]);var _0x577683={'closed':0x1,'closedAt':moment()[_0x5a68('0x9')](_0x5a68('0xa')),'closeReason':_0x5a68('0xb'),'disposition':_0x261ec0[0x0]};if(rpc[_0x97b767[_0x5a68('0xc')]+_0x5a68('0xd')]){rpc[_0x97b767[_0x5a68('0xc')]+_0x5a68('0xd')][_0x5a68('0xe')](_0x97b767[_0x5a68('0xf')]['id'],_0x577683)[_0x5a68('0x10')](function(_0x5a3bd1){logger[_0x5a68('0x11')](_0x5a68('0x12'),_0x4dbbd6,_0x97b767[_0x5a68('0xf')]['id']);})['catch'](function(_0x5ed805){logger[_0x5a68('0x13')]('[%s][CLOSE]\x20%s',_0x4dbbd6,JSON[_0x5a68('0x14')](_0x5ed805));})['finally'](function(){_0xb81191['stop']();});}}catch(_0x260940){logger['error']('[%s][CLOSE]\x20%s',_0x4dbbd6,JSON[_0x5a68('0x14')](_0x260940));_0xb81191[_0x5a68('0x15')]();}};};