Package ie.omk.smpp.message

Examples of ie.omk.smpp.message.SubmitSM


    // open connection and bind
    Connection connection = connect(4444);
    bind(connection, Connection.TRANSMITTER, "test", "test", null);

    SubmitSM submitSM = (SubmitSM) connection.newInstance(SMPPPacket.SUBMIT_SM);
    submitSM.setDestination(new Address(0, 0, "573001111111"));
    submitSM.setSource(new Address(0, 0, "3542"));
    submitSM.setMessageText("This is a test");

    SubmitSMResp response = (SubmitSMResp) connection.sendRequest(submitSM);
    Assert.assertNotNull(response);
    Assert.assertTrue(response.getMessageId() != null);
View Full Code Here


    String[] texts = getMessageTexts( message.getProperty("text", String.class) );
    for (int i=0; i < texts.length; i++) {
      log.trace("sending segment " + (i+1) + " of " + texts.length);

      SubmitSM request = buildSubmitSM(message);

      request.setMessage( getEncodedBytes(texts[i]) );
      request.setDataCoding( getDataCoding().getDataCoding() );
      request.setSequenceNum( sequenceNumber );

      if (texts.length > 1) {
        request.setOptionalParameter(Tag.SAR_TOTAL_SEGMENTS, texts.length);
        request.setOptionalParameter(Tag.SAR_SEGMENT_SEQNUM, i + 1);
        request.setOptionalParameter(Tag.SAR_MSG_REF_NUM, msgRefNum);
      }

      if (i == 0) {
        message.setProperty("sequenceNumber", request.getSequenceNum());
      }

      connection.sendRequest(request);

    }
View Full Code Here

    }
  }

  private SubmitSM buildSubmitSM(Message message) {
    SubmitSM request = new SubmitSM();

    Address sourceAr = new Address();
    if (notEmpty(configuration.getSourceNPI())) {
      sourceAr.setNPI(Byte.valueOf(configuration.getSourceNPI()));
    }
    if (notEmpty(configuration.getSourceTON())) {
      sourceAr.setTON(Byte.valueOf(configuration.getSourceTON()));
    }
    sourceAr.setAddress(message.getProperty("from").toString());
    request.setSource(sourceAr);

    Address destAr = new Address();
    if (notEmpty(configuration.getDestNPI())) {
      destAr.setNPI(Byte.valueOf(configuration.getDestNPI()));
    }
    if (notEmpty(configuration.getDestTON())) {
      destAr.setTON(Byte.valueOf(configuration.getDestTON()));
    }
    destAr.setAddress(message.getProperty("to", String.class));
    request.setDestination(destAr);

    if (configuration.isRequestDeliveryReceipts()) {
      request.setRegistered((byte) 0x01);
    }

    return request;
  }
View Full Code Here

        case SMPPPacket.UNBIND_RESP:
            response = new UnbindResp();
            break;

        case SMPPPacket.SUBMIT_SM:
            response = new SubmitSM();
            break;

        case SMPPPacket.SUBMIT_SM_RESP:
            response = new SubmitSMResp();
            break;
View Full Code Here

TOP

Related Classes of ie.omk.smpp.message.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.