0f1f0aa382653405b0165dab52d7c0631209e2b3
[motion2.git] / server / services / routing / server / applications / message.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 _0x3ebb=['[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','create','then','info'];(function(_0x352faa,_0x108b4a){var _0x1b1be4=function(_0x44622b){while(--_0x44622b){_0x352faa['push'](_0x352faa['shift']());}};_0x1b1be4(++_0x108b4a);}(_0x3ebb,0xcd));var _0xb3eb=function(_0x549dac,_0x52e0b2){_0x549dac=_0x549dac-0x0;var _0x43785f=_0x3ebb[_0x549dac];return _0x43785f;};'use strict';var _=require(_0xb3eb('0x0'));var utils=require(_0xb3eb('0x1'));var logger=require(_0xb3eb('0x2'))('routing');var rpc={'chatMessage':require(_0xb3eb('0x3')),'openchannelMessage':require(_0xb3eb('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb3eb('0x5')),'faxMessage':require(_0xb3eb('0x6')),'whatsappMessage':require(_0xb3eb('0x7'))};exports[_0xb3eb('0x8')]=function(_0x512baf,_0x53c060){return function(_0x1a7853){try{var _0x319efb={'body':utils[_0xb3eb('0x9')](_0x53c060[0x0],this),'ContactId':this['contact']['id']};if(this[_0xb3eb('0xa')]===_0xb3eb('0xb')){_0x319efb[_0xb3eb('0xc')]=this[_0xb3eb('0xd')]['id'];}else{_0x319efb[_[_0xb3eb('0xe')](this['channel'])+'AccountId']=this[_0xb3eb('0xd')]['id'];}_0x319efb[_['upperFirst'](this[_0xb3eb('0xa')])+_0xb3eb('0xf')]=this['interaction']['id'];if(rpc[this['channel']+_0xb3eb('0x10')]){return rpc[this[_0xb3eb('0xa')]+_0xb3eb('0x10')][_0xb3eb('0x11')](_0x319efb)[_0xb3eb('0x12')](function(_0x36ca8d){logger[_0xb3eb('0x13')](_0xb3eb('0x14'),_0x512baf,_0x319efb['body']);_0x1a7853[_0xb3eb('0x15')]();})['catch'](function(_0x41d6be){logger[_0xb3eb('0x16')](_0xb3eb('0x14'),_0x512baf,JSON[_0xb3eb('0x17')](_0x41d6be));_0x1a7853[_0xb3eb('0x18')]();});}}catch(_0x462c7e){logger[_0xb3eb('0x16')](_0xb3eb('0x14'),_0x512baf,JSON[_0xb3eb('0x17')](_0x462c7e));_0x1a7853['stop']();}};};