Built motion from commit (unavailable).|2.5.21
[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 _0x7d36=['info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','account','upperFirst','InteractionId','Message','then'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x7d36,0x1a0));var _0x67d3=function(_0x1e7905,_0x5b2595){_0x1e7905=_0x1e7905-0x0;var _0x3389c1=_0x7d36[_0x1e7905];return _0x3389c1;};'use strict';var _=require(_0x67d3('0x0'));var utils=require(_0x67d3('0x1'));var logger=require(_0x67d3('0x2'))(_0x67d3('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x67d3('0x4')),'mailMessage':require(_0x67d3('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x67d3('0x6')),'whatsappMessage':require(_0x67d3('0x7'))};exports[_0x67d3('0x8')]=function(_0x5190ea,_0x11f551){return function(_0x2547cc){try{var _0x77495c={'body':utils['getMustacheRender'](_0x11f551[0x0],this),'ContactId':this[_0x67d3('0x9')]['id']};if(this[_0x67d3('0xa')]==='chat'){_0x77495c['ChatWebsiteId']=this[_0x67d3('0xb')]['id'];}else{_0x77495c[_[_0x67d3('0xc')](this[_0x67d3('0xa')])+'AccountId']=this[_0x67d3('0xb')]['id'];}_0x77495c[_[_0x67d3('0xc')](this['channel'])+_0x67d3('0xd')]=this['interaction']['id'];if(rpc[this['channel']+_0x67d3('0xe')]){return rpc[this[_0x67d3('0xa')]+_0x67d3('0xe')]['create'](_0x77495c)[_0x67d3('0xf')](function(_0x4109fb){logger[_0x67d3('0x10')](_0x67d3('0x11'),_0x5190ea,_0x77495c[_0x67d3('0x12')]);_0x2547cc[_0x67d3('0x13')]();})[_0x67d3('0x14')](function(_0x3bc01c){logger[_0x67d3('0x15')](_0x67d3('0x11'),_0x5190ea,JSON[_0x67d3('0x16')](_0x3bc01c));_0x2547cc[_0x67d3('0x17')]();});}}catch(_0x54c540){logger[_0x67d3('0x15')](_0x67d3('0x11'),_0x5190ea,JSON[_0x67d3('0x16')](_0x54c540));_0x2547cc[_0x67d3('0x17')]();}};};