9605497ace7cc520369e4edab1b178f3dca818f9
[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 _0x36b2=['info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','interaction','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x36b2,0x6b));var _0x236b=function(_0x29a318,_0x37bd6d){_0x29a318=_0x29a318-0x0;var _0x10ca4e=_0x36b2[_0x29a318];return _0x10ca4e;};'use strict';var moment=require(_0x236b('0x0'));var logger=require(_0x236b('0x1'))(_0x236b('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x236b('0x3')),'smsInteraction':require(_0x236b('0x4')),'mailInteraction':require(_0x236b('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x236b('0x6'))};exports[_0x236b('0x7')]=function(_0x5817da,_0x27c6b4,_0x27c095,_0x37867a){return function(_0x9e1345){try{logger[_0x236b('0x8')](_0x236b('0x9'),_0x5817da,_0x27c6b4[0x0]);var _0x52b043={'closed':0x1,'closedAt':moment()[_0x236b('0xa')](_0x236b('0xb')),'closeReason':_0x236b('0xc'),'disposition':_0x27c6b4[0x0]};if(rpc[_0x37867a[_0x236b('0xd')]+'Interaction']){rpc[_0x37867a[_0x236b('0xd')]+_0x236b('0xe')][_0x236b('0xf')](_0x37867a['interaction']['id'],_0x52b043)[_0x236b('0x10')](function(_0x1e3d20){logger[_0x236b('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5817da,_0x37867a[_0x236b('0x11')]['id']);})['catch'](function(_0x52393a){logger[_0x236b('0x12')]('[%s][CLOSE]\x20%s',_0x5817da,JSON[_0x236b('0x13')](_0x52393a));})[_0x236b('0x14')](function(){_0x9e1345[_0x236b('0x15')]();});}}catch(_0x2410a5){logger[_0x236b('0x12')](_0x236b('0x16'),_0x5817da,JSON[_0x236b('0x13')](_0x2410a5));_0x9e1345['stop']();}};};