Custom SMS MMS Implementation: Difference between revisions

From Open-Xchange
No edit summary
Line 1: Line 1:
== Introduction ==


== Prerequisites ==
== Prerequisites ==


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


{{InstallPlugin|pluginname=open-xchange-messaging-sms open-xchange-messaging-sms-gui|sopath=stable}}
{{InstallPlugin|pluginname=open-xchange-messaging-sms open-xchange-messaging-sms-gui|sopath=stable}}

Revision as of 12:36, 27 January 2012

Introduction

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/stable/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/stable/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/stable/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/stable/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 below.

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. The same applies for the 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