Package org.smpp.pdu

Examples of org.smpp.pdu.SubmitMultiSMResp$UnsuccessSMEsList


            LOGGER.debug("Sending message using sendMulti");
        }                         
        try {
            String theMessage = message.getMessage();
            SubmitMultiSM request = new SubmitMultiSM();
            SubmitMultiSMResp response = null;
            // set values
            request.setServiceType(null);
            request.setSourceAddr((String) null);

            int numberOfDestinations = message.getDestinationCount();

            for (int i = 0; i < numberOfDestinations; i++) {
                String dest = message.getDestination(i);
                final Address address;
                if(dest.startsWith("+")) {
                    address =
                            new Address((byte) 0x01, (byte) 0x0, dest.substring(1));
                } else {
                    address = new Address(dest);
                }
                request.addDestAddress(new DestinationAddress(address));
            }
            request.setServiceType(SMSCSvcType);
            request.setSourceAddr(SMSCSvcAddr);
            request.setReplaceIfPresentFlag((byte) 0x00);
            request.setShortMessage(theMessage);
            request.setEsmClass((byte) 0x00);
            request.setProtocolId((byte) 0x00);
            request.setPriorityFlag((byte) 0x00);
            request.setRegisteredDelivery((byte) 0x00);
            request.setDataCoding((byte) 0x00);
            request.setSmDefaultMsgId((byte) 0x00);
            // send the request
            request.assignSequenceNumber(false);
            if(LOGGER.isDebugEnabled()) {
                LOGGER.debug("Submit request " + request.debugString());
            }

            // Get a session from the pool and attempt to send the message.
            boolean submitted = false;
            while (!submitted) {
                Session SMSSession = (Session) sessionPool.borrowObject();
                try {
                    response = SMSSession.submitMulti(request);
                    submitted = true;
                    sessionPool.returnObject(SMSSession);
                } catch (Exception e) {
                    LOGGER.warn("message-submit-failure-retrying", e.getMessage());
                    sessionPool.invalidateObject(SMSSession);
                }
            }

            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Submit response " + response.debugString());
            }
            if (response.getCommandStatus() != Data.ESME_ROK) {
                throw new MessageException(
                    localizer.format("message-submit-failure"));
            }
        } catch (MessageException e) {
            // don't wrap MessageExceptions
View Full Code Here

TOP

Related Classes of org.smpp.pdu.SubmitMultiSMResp$UnsuccessSMEsList

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.