Built motion from commit ffdca78c.|2.6.24
[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 _0x51f9=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','lodash','./utils'];(function(_0x304cb6,_0xe86195){var _0x57acb0=function(_0x22608a){while(--_0x22608a){_0x304cb6['push'](_0x304cb6['shift']());}};_0x57acb0(++_0xe86195);}(_0x51f9,0x132));var _0x951f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x51f9[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x951f('0x0'));var utils=require(_0x951f('0x1'));var logger=require('../../../../config/logger')(_0x951f('0x2'));var rpc={'chatMessage':require(_0x951f('0x3')),'openchannelMessage':require(_0x951f('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x951f('0x5')),'faxMessage':require(_0x951f('0x6')),'whatsappMessage':require(_0x951f('0x7'))};exports[_0x951f('0x8')]=function(_0x422f66,_0xd80e8a){return function(_0x2ca4e0){try{var _0x4aca31={'body':utils[_0x951f('0x9')](_0xd80e8a[0x0],this),'ContactId':this[_0x951f('0xa')]['id']};if(this[_0x951f('0xb')]===_0x951f('0xc')){_0x4aca31[_0x951f('0xd')]=this[_0x951f('0xe')]['id'];}else{_0x4aca31[_[_0x951f('0xf')](this[_0x951f('0xb')])+_0x951f('0x10')]=this[_0x951f('0xe')]['id'];}_0x4aca31[_[_0x951f('0xf')](this[_0x951f('0xb')])+_0x951f('0x11')]=this[_0x951f('0x12')]['id'];if(rpc[this[_0x951f('0xb')]+_0x951f('0x13')]){return rpc[this['channel']+'Message'][_0x951f('0x14')](_0x4aca31)[_0x951f('0x15')](function(_0xddb84c){logger['info'](_0x951f('0x16'),_0x422f66,_0x4aca31['body']);_0x2ca4e0[_0x951f('0x17')]();})[_0x951f('0x18')](function(_0x2fa0aa){logger[_0x951f('0x19')](_0x951f('0x16'),_0x422f66,JSON['stringify'](_0x2fa0aa));_0x2ca4e0[_0x951f('0x1a')]();});}}catch(_0xd4b9cd){logger[_0x951f('0x19')](_0x951f('0x16'),_0x422f66,JSON[_0x951f('0x1b')](_0xd4b9cd));_0x2ca4e0[_0x951f('0x1a')]();}};};