This discussion is archived
3 Replies Latest reply: Mar 8, 2010 5:23 PM by 807581 RSS

Send sms from gsm modem to j2me port(Port addressed message from gsm modem)

807581 Newbie
Currently Being Moderated
HI,
I am currently developing an application in which I need to send an sms from gsm modem to j2me port.I searched a lot of stuff and also with some guidance I found that I have to use PDU mode for sending port addressed messages. There is no clear picture for configuring a port number in the PDU mode.I checked first 100 results of google for stuff. Still nothing.Can anyone give a simple idea of how to send a port addressed sms from gsm modem.
  • 1. Send sms from gsm modem to j2me port(Port addressed message from gsm modem)
    807581 Newbie
    Currently Being Moderated
    I also tried using smsj API for sending port addressed sms but there is no tutorials for it.Some how found a program and tried running it sent out an international sms instead of a local sms. If any have tutorial of smsj api please help.........
  • 2. Send sms from gsm modem to j2me port(Port addressed message from gsm modem)
    807581 Newbie
    Currently Being Moderated
    Want to know where to add port no in UDH header check out this book

    John.Wiley.and.Sons.Mobile.Messaging.Technologies.and.Services.SMS.EMS.and.MMS.2ed.Mar.2005

    This book will help you.
  • 3. Send sms from gsm modem to j2me port(Port addressed message from gsm modem)
    807581 Newbie
    Currently Being Moderated
    Guys, If you are looking to send sms with port number from GSM modem use SMSLib API

    [http://smslib.org/]

    This API will help you send an sms to j2me port from GSM Modem it's perfectly working.

    Download and Install Java comm API and RxTxComm API as said by SMSLib.org

    Download and extract SMSLib.zip. Include the SMSLib.jar and SMSServrer.jar found in the zip file.

    Dont download Apache ant.

    The jar file is at smslib/dist/lib

    Include those jar files and also the following jar files

    log4j-1.2.15.jar
    slf4j-simple-1.5.11.jar
    slf4j-api-1.5.11.jar

    Only with all the jar files mentioned the sample program given in the site will work.

    The program to send SMS from GSM modem to J2me port is

    import org.smslib.IOutboundMessageNotification;
    import org.smslib.OutboundMessage;
    import org.smslib.Service;
    import org.smslib.modem.SerialModemGateway;
    class OutboundNotification implements IOutboundMessageNotification
    {
    public void process(String gatewayId, OutboundMessage msg)
    {
    System.out.println("Outbound handler called from Gateway: " + gatewayId);
    System.out.println(msg);
    }
    }
    public class SendMessage
    {
    public static void main(String args[]) throws Exception
    {
    Service srv;
    OutboundMessage msg;
    OutboundNotification outboundNotification = new OutboundNotification();
    srv = new Service();
    SerialModemGateway gateway = new SerialModemGateway("modem.com1", "COM51", 9600, "Nokia", "6310i");
    gateway.setInbound(true);
    gateway.setOutbound(true);          
    srv.setOutboundMessageNotification(outboundNotification);
    srv.addGateway(gateway);          
    srv.startService();          

    // Send a message synchronously.
    msg = new OutboundMessage("+919876543210", "user");
    msg.setSrcPort(0);
    msg.setDstPort(5000);          
    srv.sendMessage(msg);
    System.out.println(msg);
    System.out.println(msg.getPduUserDataHeader());
    srv.stopService();          
    }
    }