Built motion from commit (unavailable).|2.5.3
[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 _0xf012=['then','info','[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create'];(function(_0x1bf1f7,_0x5f2286){var _0x3e55fd=function(_0x43fae5){while(--_0x43fae5){_0x1bf1f7['push'](_0x1bf1f7['shift']());}};_0x3e55fd(++_0x5f2286);}(_0xf012,0x98));var _0x2f01=function(_0x35ea44,_0x314ac5){_0x35ea44=_0x35ea44-0x0;var _0x432f30=_0xf012[_0x35ea44];return _0x432f30;};'use strict';var _=require(_0x2f01('0x0'));var utils=require('./utils');var logger=require(_0x2f01('0x1'))('routing');var rpc={'chatMessage':require(_0x2f01('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2f01('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x2f01('0x4')]=function(_0x31be05,_0x21a4a1){return function(_0x52b5c2){try{var _0x29ea36={'body':utils[_0x2f01('0x5')](_0x21a4a1[0x0],this),'ContactId':this[_0x2f01('0x6')]['id']};if(this[_0x2f01('0x7')]===_0x2f01('0x8')){_0x29ea36[_0x2f01('0x9')]=this[_0x2f01('0xa')]['id'];}else{_0x29ea36[_[_0x2f01('0xb')](this[_0x2f01('0x7')])+'AccountId']=this[_0x2f01('0xa')]['id'];}_0x29ea36[_[_0x2f01('0xb')](this[_0x2f01('0x7')])+_0x2f01('0xc')]=this[_0x2f01('0xd')]['id'];if(rpc[this['channel']+_0x2f01('0xe')]){return rpc[this[_0x2f01('0x7')]+_0x2f01('0xe')][_0x2f01('0xf')](_0x29ea36)[_0x2f01('0x10')](function(_0x47edc5){logger[_0x2f01('0x11')](_0x2f01('0x12'),_0x31be05,_0x29ea36['body']);_0x52b5c2[_0x2f01('0x13')]();})[_0x2f01('0x14')](function(_0xde1c95){logger[_0x2f01('0x15')](_0x2f01('0x12'),_0x31be05,JSON['stringify'](_0xde1c95));_0x52b5c2[_0x2f01('0x16')]();});}}catch(_0x215f3d){logger[_0x2f01('0x15')]('[%s][MESSAGE]\x20%s',_0x31be05,JSON[_0x2f01('0x17')](_0x215f3d));_0x52b5c2[_0x2f01('0x16')]();}};};