Built motion from commit e02f907f.|2.6.14
[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 _0xf8aa=['[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','info'];(function(_0x1d96e5,_0x38fff6){var _0x345df0=function(_0x5c6b08){while(--_0x5c6b08){_0x1d96e5['push'](_0x1d96e5['shift']());}};_0x345df0(++_0x38fff6);}(_0xf8aa,0x13b));var _0xaf8a=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf8aa[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xaf8a('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xaf8a('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaf8a('0x2')),'mailMessage':require(_0xaf8a('0x3')),'smsMessage':require(_0xaf8a('0x4')),'faxMessage':require(_0xaf8a('0x5')),'whatsappMessage':require(_0xaf8a('0x6'))};exports[_0xaf8a('0x7')]=function(_0x33862d,_0x13e8f2){return function(_0xc63b84){try{var _0x2ce005={'body':utils[_0xaf8a('0x8')](_0x13e8f2[0x0],this),'ContactId':this[_0xaf8a('0x9')]['id']};if(this[_0xaf8a('0xa')]===_0xaf8a('0xb')){_0x2ce005[_0xaf8a('0xc')]=this['account']['id'];}else{_0x2ce005[_[_0xaf8a('0xd')](this[_0xaf8a('0xa')])+_0xaf8a('0xe')]=this[_0xaf8a('0xf')]['id'];}_0x2ce005[_[_0xaf8a('0xd')](this[_0xaf8a('0xa')])+'InteractionId']=this[_0xaf8a('0x10')]['id'];if(rpc[this[_0xaf8a('0xa')]+_0xaf8a('0x11')]){return rpc[this[_0xaf8a('0xa')]+_0xaf8a('0x11')][_0xaf8a('0x12')](_0x2ce005)[_0xaf8a('0x13')](function(_0x1eddc9){logger[_0xaf8a('0x14')](_0xaf8a('0x15'),_0x33862d,_0x2ce005[_0xaf8a('0x16')]);_0xc63b84[_0xaf8a('0x17')]();})[_0xaf8a('0x18')](function(_0xea21e8){logger[_0xaf8a('0x19')](_0xaf8a('0x15'),_0x33862d,JSON[_0xaf8a('0x1a')](_0xea21e8));_0xc63b84[_0xaf8a('0x1b')]();});}}catch(_0x51f661){logger[_0xaf8a('0x19')](_0xaf8a('0x15'),_0x33862d,JSON[_0xaf8a('0x1a')](_0x51f661));_0xc63b84[_0xaf8a('0x1b')]();}};};