Actually if you are using Mbuni as you say, then you need not even
worry about processing the MM7 requests yourself as Mbuni will handle
that for you and, like Kannel hand you the parts of the message you
are interested in, via HTTP. More on that here http://mbuni.org/
userguide.shtml#mms_service
On May 16, 2006, at 08:34, Deon van der Merwe wrote:
> Hi,
>
> On 5/16/06, kartikay malhotra <[EMAIL PROTECTED]> wrote:
>> Hi!
>>
>> I intend to use Mbuni as a gateway connected to an operator MMC.
>> Once I
>> receive MMS at my gateway, I would want to send it to a HTTP Server
>> (preferably intact). There I would want to dump it in a database.
>>
>> I can handle the server and DB part. Wat I do not know:
>>
>> 1. Format of incoming MMS; I mean protocol. (HTTP over TCP/IP)?
>> 2. How to handle that MMS?
>
> I think that here I can help a little... the message sent to you by
> mbuni MMSC is formatter as MM7/HTTP/TCPIP. To receive these messages,
> I use the openwave SDK. My receiver class looks somethinh like this:
>
> class MessageReceiver
> extends com.openwave.mms.mm7.MessageListenerAdapter {
>
> protected com.openwave.mms.mm7.RelayConnection
> mReceiveConnection = null;
>
> public MessageReceiver() {
> try {
> mReceiveConnection =
> com.openwave.mms.mm7.RelayConnection.createReceiver(mReceivePort,
> false);
> mReceiveConnection.setMessageListener(this);
> } catch (java.lang.Exception vException) {
> mLogger.error(vException.getMessage(), vException);
> }
> }
>
> public com.openwave.mms.mm7.Response processDeliverRequest(
> com.openwave.mms.mm7.DeliverRequest deliverRequest) {
> try {
> mLogger.debug("TransactionID: " +
> deliverRequest.getTransactionID());
> mLogger.debug("Sender: " + deliverRequest.getSender());
> java.util.Vector vRecipients = deliverRequest.getRecipients();
> for (int i = 0; i < vRecipients.size(); ++i) {
> mLogger.debug("recipient: " +
> ((com.openwave.mms.mm7.Recipient) vRecipients.get(i)).getAddress());
> }
> mLogger.debug("Subject: " + deliverRequest.getSubject());
> javax.mail.internet.MimeBodyPart part =
> deliverRequest.getRawContent();
> mLogger.debug("ContentType: " + part.getContentType());
> mLogger.debug("Filename: " + part.getFileName());
>
> java.lang.StringBuffer vContentBuffer = new
> java.lang.StringBuffer();
> try {
> java.io.InputStream vContentInput = part.getInputStream();
> while (true) {
> int vByte = vContentInput.read();
> if (vByte == -1) {
> break;
> } else {
> vContentBuffer.append((char) vByte);
> }
> }
> } catch (java.io.IOException vException) {
> mLogger.error(vException.getMessage(), vException);
> }
>
> int vSequence = (int) mReceiveSequence.next();
> java.lang.String vContent = vContentBuffer.toString();
> java.lang.String vFilename = saveFile(part.getFileName(),
> vSequence, vContent);
> } catch (javax.mail.MessagingException vException) {
> mLogger.error(vException.getMessage(), vException);
> } catch (com.openwave.mms.mm7.APIException vException) {
> mLogger.error(vException.getLocalizedMessage() + " (" +
> vException.getErrorCode() + ")");
> mLogger.error(vException.getMessage(), vException);
> } catch (java.lang.Exception vException) {
> mLogger.error(vException.getMessage(), vException);
> }
>
> // create a response object and send it back to the Openwave
> MMSC relay
> com.openwave.mms.mm7.DeliverResponse response = new
> com.openwave.mms.mm7.DeliverResponse();
> response.setStatusCode(com.openwave.mms.mm7.ErrorCode.SUCCESS);
> response.setStatusText("got it!");
> return response;
> }
>
> protected java.lang.String saveFile(
> java.lang.String aFilename,
> int aSequence,
> java.lang.String aContent) {
> java.lang.String vFilename = mFileCacheDirectory + aSequence +
> "-" + aFilename;
> mLogger.debug("filename for " + aFilename + " = " + vFilename);
> try {
> java.io.FileWriter vWriter = new java.io.FileWriter
> (vFilename);
> vWriter.write(aContent);
> vWriter.flush();
> vWriter.close();
> } catch (java.lang.Exception vException) {
> mLogger.error(vException.getMessage(), vException);
> }
> return vFilename;
> }
> }
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://mbuni.org/mailman/listinfo/users_mbuni.org
_______________________________________________
Users mailing list
[email protected]
http://mbuni.org/mailman/listinfo/users_mbuni.org