e8191db82036d30ca04e1f1cce9a7ad07341be48
[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 _0xea1c=['info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','finally','stop','stringify','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xcea1('0x0'));var rpc={'chatInteraction':require(_0xcea1('0x1')),'openchannelInteraction':require(_0xcea1('0x2')),'smsInteraction':require(_0xcea1('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xcea1('0x4')),'whatsappInteraction':require(_0xcea1('0x5'))};exports[_0xcea1('0x6')]=function(_0xaad3f2,_0x45782f,_0x1ff8bf,_0x29732f){return function(_0xec7a9f){try{logger[_0xcea1('0x7')](_0xcea1('0x8'),_0xaad3f2,_0x45782f[0x0]);var _0x295e4c={'closed':0x1,'closedAt':moment()['format'](_0xcea1('0x9')),'closeReason':_0xcea1('0xa'),'disposition':_0x45782f[0x0]};if(rpc[_0x29732f[_0xcea1('0xb')]+'Interaction']){rpc[_0x29732f[_0xcea1('0xb')]+_0xcea1('0xc')][_0xcea1('0xd')](_0x29732f[_0xcea1('0xe')]['id'],_0x295e4c)[_0xcea1('0xf')](function(_0x328c15){logger[_0xcea1('0x7')](_0xcea1('0x10'),_0xaad3f2,_0x29732f[_0xcea1('0xe')]['id']);})[_0xcea1('0x11')](function(_0x831dfc){logger['error'](_0xcea1('0x12'),_0xaad3f2,JSON['stringify'](_0x831dfc));})[_0xcea1('0x13')](function(){_0xec7a9f[_0xcea1('0x14')]();});}}catch(_0x3ab65e){logger['error']('[%s][CLOSE]\x20%s',_0xaad3f2,JSON[_0xcea1('0x15')](_0x3ab65e));_0xec7a9f[_0xcea1('0x14')]();}};};