Custom SMS MMS Implementation

From Open-Xchange
Revision as of 15:57, 30 January 2012 by Dennis Sieben (talk | contribs)

Introduction

Open-Xchange comes with an already integrated SMS/MMS UI Plugin, which enables OX endusers to send out SMS/MMS from within their browser.

IMPORTANT: Due to the fact, that there are many telecommunication companies out there which provide SMS/MMS gateways, you need to implement the process of sending out SMS/MMS within the OX backend for yourself or you can order and pay for this implementation work, so our developers will do the work for you.(Includes building rm/deb packages).

Short summary of needed steps to make SMS/MMS messaging work:

1. Install needed packages (see below)


2. Implement the required OSGI interfaces (see below) and build a package/jar, which must be installed correctly on the OX server(s).


WARNING: If you do not implement the server side OSGI interfaces, you will not see any SMS/MMS functionality/window/button in the OX UI!!


SMS Button
SMS MMS New Window
SMS MMS attachment

Prerequisites

The bundles open-xchange-messaging-sms and open-xchange-messaging-sms-gui must be installed to use the SMS/MMS feature.

Install on OX AppSuite

Debian GNU/Linux 11.0

Add the following entry to /etc/apt/sources.list.d/open-xchange.list if not already present:

deb https://software.open-xchange.com/products/updates/DebianBullseye/ /
# if you have a valid maintenance subscription, please uncomment the 
# following and add the ldb account data to the url so that the most recent
# packages get installed
# deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/updates/updates/DebianBullseye/ /

and run

$ apt-get update
$ apt-get install open-xchange-messaging-sms open-xchange-messaging-sms-gui

Debian GNU/Linux 12.0

Add the following entry to /etc/apt/sources.list.d/open-xchange.list if not already present:

deb https://software.open-xchange.com/products/updates/DebianBookworm/ /
# if you have a valid maintenance subscription, please uncomment the 
# following and add the ldb account data to the url so that the most recent
# packages get installed
# deb https://[CUSTOMERID:PASSWORD]@software.open-xchange.com/products/updates/updates/DebianBookworm/ /

and run

$ apt-get update
$ apt-get install open-xchange-messaging-sms open-xchange-messaging-sms-gui


Implementation

The basic implementation must be done by a class implementing the interface com.openexchange.messaging.sms.service.MessagingNewService. This implementing class must be annouced to OSGi as a service implementation for this class. This can be done be the following:

context.registerService(MessagingNewService.class.getName(), new OwnImpl(), null);

In this example the new class OwnImpl must be written. Inside this class the interface enforces that an object of the type MessagingUserConfigurationInterface and an object of the type MessagingAccountTransport must be returned in the corresponding methods.

Please note that each of the returned objects is only valid for one session. So the returned MessagingUserConfigurationInterface can provide user specific settings based on the values in the session object. The settings which can be adjusted in the configuration should be explained by the JavaDoc links.

The more important part is the returned MessagingAccountTransport where the method com.openexchange.messaging.MessagingAccountTransport.transport(MessagingMessage, Collection<MessagingAddressHeader>) is responsible for sending the SMS / MMS. The corresponding MessagingMessage object therefore provides all the needed data for composing the messages. Collection<MessagingAddressHeader> is irrelevant in this case

Please pay attention to the way how the sender and the receiver are fetched from the message object as this might be uncommon. The correct way to do it is:

final MessagingHeader to = message.getFirstHeader(MessagingHeader.KnownHeader.TO.toString());
final MessagingHeader from = message.getFirstHeader(MessagingHeader.KnownHeader.FROM.toString());

The plain string is available through the getValue() method on the MessagingHeader

JavaDoc

A full JavaDoc of the described classes can be found here