Built motion from commit (unavailable).|2.4.4
[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 _0x2179=['moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x3a9df7,_0x323bd7){var _0xfa5fb=function(_0x354774){while(--_0x354774){_0x3a9df7['push'](_0x3a9df7['shift']());}};_0xfa5fb(++_0x323bd7);}(_0x2179,0xc0));var _0x9217=function(_0xd4470d,_0x47318d){_0xd4470d=_0xd4470d-0x0;var _0x5544c5=_0x2179[_0xd4470d];return _0x5544c5;};'use strict';var moment=require(_0x9217('0x0'));var logger=require(_0x9217('0x1'))(_0x9217('0x2'));var rpc={'chatInteraction':require(_0x9217('0x3')),'openchannelInteraction':require(_0x9217('0x4')),'smsInteraction':require(_0x9217('0x5')),'mailInteraction':require(_0x9217('0x6')),'faxInteraction':require(_0x9217('0x7'))};exports[_0x9217('0x8')]=function(_0x2e397c,_0x3a5922,_0x757f88,_0x471e4c){return function(_0x17a107){try{logger[_0x9217('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x2e397c,_0x3a5922[0x0]);var _0x1a0b98={'closed':0x1,'closedAt':moment()[_0x9217('0xa')](_0x9217('0xb')),'closeReason':_0x9217('0xc'),'disposition':_0x3a5922[0x0]};if(rpc[_0x471e4c[_0x9217('0xd')]+'Interaction']){rpc[_0x471e4c['channel']+_0x9217('0xe')]['update'](_0x471e4c[_0x9217('0xf')]['id'],_0x1a0b98)[_0x9217('0x10')](function(_0x43a75c){logger['info'](_0x9217('0x11'),_0x2e397c,_0x471e4c[_0x9217('0xf')]['id']);})[_0x9217('0x12')](function(_0x23b7aa){logger[_0x9217('0x13')](_0x9217('0x14'),_0x2e397c,JSON[_0x9217('0x15')](_0x23b7aa));})[_0x9217('0x16')](function(){_0x17a107['stop']();});}}catch(_0x146596){logger['error'](_0x9217('0x14'),_0x2e397c,JSON[_0x9217('0x15')](_0x146596));_0x17a107[_0x9217('0x17')]();}};};