Built motion from commit (unavailable).|2.5.15
[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 _0xe2ba=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','./utils','../../../../config/logger'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xe2ba,0xde));var _0xae2b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe2ba[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var utils=require(_0xae2b('0x0'));var logger=require(_0xae2b('0x1'))(_0xae2b('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xae2b('0x3')),'mailMessage':require(_0xae2b('0x4')),'smsMessage':require(_0xae2b('0x5')),'faxMessage':require(_0xae2b('0x6')),'whatsappMessage':require(_0xae2b('0x7'))};exports[_0xae2b('0x8')]=function(_0x2c0199,_0x2b4c3d){return function(_0x5132f8){try{var _0x43dcc1={'body':utils[_0xae2b('0x9')](_0x2b4c3d[0x0],this),'ContactId':this[_0xae2b('0xa')]['id']};if(this[_0xae2b('0xb')]==='chat'){_0x43dcc1[_0xae2b('0xc')]=this[_0xae2b('0xd')]['id'];}else{_0x43dcc1[_[_0xae2b('0xe')](this['channel'])+_0xae2b('0xf')]=this[_0xae2b('0xd')]['id'];}_0x43dcc1[_[_0xae2b('0xe')](this['channel'])+_0xae2b('0x10')]=this[_0xae2b('0x11')]['id'];if(rpc[this[_0xae2b('0xb')]+_0xae2b('0x12')]){return rpc[this[_0xae2b('0xb')]+_0xae2b('0x12')]['create'](_0x43dcc1)[_0xae2b('0x13')](function(_0x46a062){logger[_0xae2b('0x14')](_0xae2b('0x15'),_0x2c0199,_0x43dcc1[_0xae2b('0x16')]);_0x5132f8[_0xae2b('0x17')]();})[_0xae2b('0x18')](function(_0x4427d4){logger['error'](_0xae2b('0x15'),_0x2c0199,JSON[_0xae2b('0x19')](_0x4427d4));_0x5132f8[_0xae2b('0x1a')]();});}}catch(_0x4de061){logger[_0xae2b('0x1b')](_0xae2b('0x15'),_0x2c0199,JSON[_0xae2b('0x19')](_0x4de061));_0x5132f8[_0xae2b('0x1a')]();}};};