Package com.logica.smpp.pdu

Examples of com.logica.smpp.pdu.SubmitSM


   */
  public String send (Address senderAddress, Address recipientAddress,
                       String message, SmppPriorityType priority)
  {
    // create the request
    SubmitSM request = createSubmit (senderAddress, recipientAddress, message, priority);

    // submit the request
    myLog.debug ("send - submitting request: {}", request.debugString ());
    try {
      SubmitSMResp response = getSession ().submit (request);
      if (response != null) {
        myLog.debug ("send - response.getCommandStatus () = {}", response.getCommandStatus ());
        return response.getMessageId ();
View Full Code Here


   */
  public synchronized int send (Address senderAddress, Address recipientAddress,
                                   String message, SmppPriorityType priority)
  {
    // create the request
    SubmitSM request = createSubmit (senderAddress, recipientAddress, message, priority);

    // submit the request
    myLog.debug ("send - submitting request: {}", request.debugString ());
    try {
      getSession ().submit (request);
      return request.getSequenceNumber ();
    }
    catch (ValueNotSetException exc) {
      myLog.error ("send - value not set", exc);
      return -1;
    }
View Full Code Here

   *
   */
  protected SubmitSM createSubmit (Address senderAddress, Address recipientAddress,
                                   String message, SmppPriorityType priority)
  {
    SubmitSM request = new SubmitSM ();

    request.setSourceAddr (senderAddress);
    request.setDestAddr (recipientAddress);
    try {
      request.setShortMessage (message);
    }
    catch (WrongLengthOfStringException exc) {
      myLog.error ("send: failed setShortMessage: message = {}, length = " + message.length (),
                   message, exc);
      return null;
    }

    // SMPPv3.4#5.2.18: 0 = don't replace
    request.setReplaceIfPresentFlag ((byte)0);
    // SMPPv3.4#5.2.12: 0 = store & forward (default)
    request.setEsmClass ((byte)0);
    // SMPPv3.4#5.2.13: refer to GSM 03.40
    request.setProtocolId ((byte)0);
    // SMPPv3.4#5.2.14:
    request.setPriorityFlag (priority.getCode ());
    // SMPPv3.4#5.2.17:
    request.setRegisteredDelivery
      (SmppRegisteredDeliveryType.eAll.getCode ());
    // SMPPv3.4#5.2.19
    request.setDataCoding (SmppDataCodingType.eDefault.getCode ());
    // SMPPv3.4#5.2.20: 0, unless using message stored at SMSC
    request.setSmDefaultMsgId ((byte)0);

    request.assignSequenceNumber (true);

    return request;
  }
View Full Code Here

        }
        bb.appendByte(b);
      }
     
      if(isSubmit == true) {
        request = new SubmitSM();
        request.setData(bb);
      } else {
        request = new DeliverSM();
        request.setData(bb);
      }
View Full Code Here

   
    private boolean sendSubmitSM(BaseMTInfo info) {
      boolean ret = false;
      if(this.bind == true && this.session != null) {
        SubmitSMResp response = null;
        SubmitSM request = info.getRequest();
       
        try {
          logger.info("MT to send for src: " +
                request.getSourceAddr().getAddress() +
            " dstn: " + request.getDestAddr().getAddress() +
            " seqNum: " + request.getSequenceNumber());
          long start = System.currentTimeMillis();
        response = this.session.submit(request);
        if(response != null) {
          long stop = System.currentTimeMillis();
          info.setTransactionTime(stop - start);
          logger.info("MT response " + response.debugString() +
          " for src: " + request.getSourceAddr().getAddress() +
          " dstn: " + request.getDestAddr().getAddress() +
          " seqNum: " + request.getSequenceNumber());
          callMTListeners(info, response);
          ret = true;
        } else {
          if(synchronous == false) {
            logger.fatal("No response going out....");
            addMTToSend(info);
          } else {
            logger.fatal("No response...");
          }
        }
      } catch (ValueNotSetException e) {
        logger.fatal("no way to manage this exception " + e.getMessage());
      } catch (TimeoutException e) {
        logger.error(e.getMessage());
        if(synchronous == false) {
          logger.error(" re-adding in queue " +
              request.debugString());
          addMTToSend(info);
        }
      } catch (PDUException e) {
        logger.fatal("no way to manage this exception " + e.getMessage());
      } catch (WrongSessionStateException e) {
        logger.fatal("no way to manage this exception " + e.getMessage());
      } catch (IOException e) {
        logger.error(e.getMessage());
        if(synchronous == false) {
          logger.error(" re-adding in queue " +
            request.debugString());
          addMTToSend(info);
        }
      } catch (NullPointerException e) {
        logger.error(e.getMessage());
        if(synchronous == false) {
          logger.error(" re-adding in queue " +
            request.debugString());
          addMTToSend(info);
        }       
      }
      } else {
        logger.error("unbind session");
View Full Code Here

TOP

Related Classes of com.logica.smpp.pdu.SubmitSM

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.