1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x88c3=['upperFirst','InteractionId','interaction','Message','create','then','next','catch','error','[%s][MESSAGE]\x20%s','stop','lodash','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account'];(function(_0x35045d,_0x36fcf8){var _0x14f135=function(_0x4bc90e){while(--_0x4bc90e){_0x35045d['push'](_0x35045d['shift']());}};_0x14f135(++_0x36fcf8);}(_0x88c3,0x1ee));var _0x388c=function(_0x5b5c84,_0x5101af){_0x5b5c84=_0x5b5c84-0x0;var _0x37064b=_0x88c3[_0x5b5c84];return _0x37064b;};'use strict';var _=require(_0x388c('0x0'));var utils=require('./utils');var logger=require(_0x388c('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x388c('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x388c('0x3')),'whatsappMessage':require(_0x388c('0x4'))};exports[_0x388c('0x5')]=function(_0x33c1dc,_0x28ed4d){return function(_0x23199c){try{var _0x5a1c0d={'body':utils[_0x388c('0x6')](_0x28ed4d[0x0],this),'ContactId':this[_0x388c('0x7')]['id']};if(this[_0x388c('0x8')]===_0x388c('0x9')){_0x5a1c0d[_0x388c('0xa')]=this[_0x388c('0xb')]['id'];}else{_0x5a1c0d[_[_0x388c('0xc')](this[_0x388c('0x8')])+'AccountId']=this[_0x388c('0xb')]['id'];}_0x5a1c0d[_['upperFirst'](this['channel'])+_0x388c('0xd')]=this[_0x388c('0xe')]['id'];if(rpc[this[_0x388c('0x8')]+_0x388c('0xf')]){return rpc[this[_0x388c('0x8')]+_0x388c('0xf')][_0x388c('0x10')](_0x5a1c0d)[_0x388c('0x11')](function(_0x262ed1){logger['info']('[%s][MESSAGE]\x20%s',_0x33c1dc,_0x5a1c0d['body']);_0x23199c[_0x388c('0x12')]();})[_0x388c('0x13')](function(_0x50e78e){logger[_0x388c('0x14')](_0x388c('0x15'),_0x33c1dc,JSON['stringify'](_0x50e78e));_0x23199c['stop']();});}}catch(_0x76001f){logger[_0x388c('0x14')](_0x388c('0x15'),_0x33c1dc,JSON['stringify'](_0x76001f));_0x23199c[_0x388c('0x16')]();}};};