ce5ff6dd90509fb7fadf6d62723b3f20b3198964
[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 _0x87b8=['finally','stop','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x5c6de3,_0x48e8c4){var _0x45e4d2=function(_0x358604){while(--_0x358604){_0x5c6de3['push'](_0x5c6de3['shift']());}};_0x45e4d2(++_0x48e8c4);}(_0x87b8,0x1a4));var _0x887b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x87b8[_0x3947c9];return _0x2e7871;};'use strict';var moment=require('moment');var logger=require(_0x887b('0x0'))(_0x887b('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x887b('0x2')),'smsInteraction':require(_0x887b('0x3')),'mailInteraction':require(_0x887b('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x887b('0x5'))};exports[_0x887b('0x6')]=function(_0xe340ae,_0x5918e0,_0x5231d1,_0x7e23dd){return function(_0x3c30ad){try{logger[_0x887b('0x7')](_0x887b('0x8'),_0xe340ae,_0x5918e0[0x0]);var _0x900023={'closed':0x1,'closedAt':moment()['format'](_0x887b('0x9')),'closeReason':_0x887b('0xa'),'disposition':_0x5918e0[0x0]};if(rpc[_0x7e23dd[_0x887b('0xb')]+_0x887b('0xc')]){rpc[_0x7e23dd[_0x887b('0xb')]+_0x887b('0xc')][_0x887b('0xd')](_0x7e23dd['interaction']['id'],_0x900023)[_0x887b('0xe')](function(_0x287bcd){logger['info'](_0x887b('0xf'),_0xe340ae,_0x7e23dd['interaction']['id']);})[_0x887b('0x10')](function(_0x4b022f){logger[_0x887b('0x11')](_0x887b('0x12'),_0xe340ae,JSON[_0x887b('0x13')](_0x4b022f));})[_0x887b('0x14')](function(){_0x3c30ad[_0x887b('0x15')]();});}}catch(_0x25a181){logger[_0x887b('0x11')]('[%s][CLOSE]\x20%s',_0xe340ae,JSON[_0x887b('0x13')](_0x25a181));_0x3c30ad[_0x887b('0x15')]();}};};