Package ie.omk.smpp

Examples of ie.omk.smpp.Address


    // 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


  }

  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);
    }
View Full Code Here

        SMPPIO.writeCString(serviceType, out);
        if (source != null) {
            source.writeTo(out);
        } else {
            // Write ton=0(null), npi=0(null), address=\0(nul)
            new Address(GSMConstants.GSM_TON_UNKNOWN,
                    GSMConstants.GSM_NPI_UNKNOWN, "").writeTo(out);
        }

        int numDests = table.size();
        SMPPIO.writeInt(numDests, 1, out);
View Full Code Here

            // First the service type
            serviceType = SMPPIO.readCString(body, offset);
            offset += serviceType.length() + 1;

            source = new Address();
            source.readFrom(body, offset);
            offset += source.getLength();

            // Read in the number of destination structures to follow:
            numDests = SMPPIO.bytesToInt(body, offset++, 1);
View Full Code Here

    public void encodeBody(OutputStream out) throws java.io.IOException {
        if (source != null) {
            source.writeTo(out);
        } else {
            new Address().writeTo(out);
        }

        if (destination != null) {
            destination.writeTo(out);
        } else {
            new Address().writeTo(out);
        }
    }
View Full Code Here

        }
    }

    public void readBodyFrom(byte[] body, int offset)
            throws SMPPProtocolException {
        source = new Address();
        source.readFrom(body, offset);
        offset += source.getLength();

        destination = new Address();
        destination.readFrom(body, offset);
    }
View Full Code Here

        SMPPIO.writeCString(getMessageId(), out);
        if (source != null) {
            source.writeTo(out);
        } else {
            // Write ton=0(null), npi=0(null), address=\0(nul)
            new Address(GSMConstants.GSM_TON_UNKNOWN,
                    GSMConstants.GSM_NPI_UNKNOWN, "").writeTo(out);
        }
    }
View Full Code Here

    public void readBodyFrom(byte[] body, int offset)
            throws SMPPProtocolException {
        messageId = SMPPIO.readCString(body, offset);
        offset += messageId.length() + 1;

        source = new Address();
        source.readFrom(body, offset);
    }
View Full Code Here

        SMPPIO.writeCString(getMessageId(), out);
        if (source != null) {
            source.writeTo(out);
        } else {
            // Write ton=0(null), npi=0(null), address=\0(nul)
            new Address(GSMConstants.GSM_TON_UNKNOWN,
                    GSMConstants.GSM_NPI_UNKNOWN, "").writeTo(out);
        }

        String dt = (deliveryTime == null) ? null : deliveryTime.toString();
        String et = (expiryTime == null) ? null : expiryTime.toString();
View Full Code Here

            String valid;

            messageId = SMPPIO.readCString(body, offset);
            offset += messageId.length() + 1;

            source = new Address();
            source.readFrom(body, offset);
            offset += source.getLength();

            delivery = SMPPIO.readCString(body, offset);
            offset += delivery.length() + 1;
View Full Code Here

TOP

Related Classes of ie.omk.smpp.Address

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.