Built motion from commit 67e5df37.|2.0.66
[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 _0x96c7=['Message','create','then','[%s][MESSAGE]\x20%s','next','catch','stringify','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','chat','ChatWebsiteId','account','channel','AccountId','upperFirst','interaction'];(function(_0x327ba1,_0x5984a8){var _0xa4c68e=function(_0xd173d4){while(--_0xd173d4){_0x327ba1['push'](_0x327ba1['shift']());}};_0xa4c68e(++_0x5984a8);}(_0x96c7,0x11c));var _0x796c=function(_0x21190b,_0x56ae1b){_0x21190b=_0x21190b-0x0;var _0x3737c9=_0x96c7[_0x21190b];return _0x3737c9;};'use strict';var _=require(_0x796c('0x0'));var utils=require(_0x796c('0x1'));var logger=require(_0x796c('0x2'))(_0x796c('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x796c('0x4')),'mailMessage':require(_0x796c('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x796c('0x6'))};exports[_0x796c('0x7')]=function(_0x3131b6,_0x3fcc54){return function(_0x25366e){try{var _0x10d1f3={'body':utils[_0x796c('0x8')](_0x3fcc54[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x796c('0x9')){_0x10d1f3[_0x796c('0xa')]=this[_0x796c('0xb')]['id'];}else{_0x10d1f3[_['upperFirst'](this[_0x796c('0xc')])+_0x796c('0xd')]=this[_0x796c('0xb')]['id'];}_0x10d1f3[_[_0x796c('0xe')](this[_0x796c('0xc')])+'InteractionId']=this[_0x796c('0xf')]['id'];if(rpc[this[_0x796c('0xc')]+_0x796c('0x10')]){return rpc[this[_0x796c('0xc')]+_0x796c('0x10')][_0x796c('0x11')](_0x10d1f3)[_0x796c('0x12')](function(_0x156042){logger['info'](_0x796c('0x13'),_0x3131b6,_0x10d1f3['body']);_0x25366e[_0x796c('0x14')]();})[_0x796c('0x15')](function(_0x5dd9e7){logger['error'](_0x796c('0x13'),_0x3131b6,JSON[_0x796c('0x16')](_0x5dd9e7));_0x25366e['stop']();});}}catch(_0x280e01){logger[_0x796c('0x17')](_0x796c('0x13'),_0x3131b6,JSON['stringify'](_0x280e01));_0x25366e[_0x796c('0x18')]();}};};