javasmppopensmpp

sending short messages using open smpp 3.4


I have build an application to sending short messages using smpp 3.4 and that work well, but in some phones i got this message:

Can not display this message

this is my function source code :

public String sendMsg(JsonObject paramsIN) {
    String smsMessage = paramsIN.getString("body");
    String smsDestination = paramsIN.getString("to");
    String smsSource = paramsIN.getString("from");
    String smscNAME = paramsIN.getString("smsc");

    SubmitSM request = new SubmitSM();
    SubmitSMResp response;
    Session session;
    try {
        request.setSourceAddr(smsSource);
        request.setDestAddr(smsDestination);
        request.setShortMessage(smsMessage, "UTF-8");
        request.setRegisteredDelivery((byte) 3);
        request.setDataCoding((byte) 4); // 4
        request.assignSequenceNumber(true);
        response = ((Session) sd.get(smscNAME)).submit(request);
        logger.info("Submit response " + response.debugString());
        String messageId = response.getMessageId();       

        BigInteger bigInt = new BigInteger(messageId, 16);  

        return bigInt+"";
    } catch (WrongLengthOfStringException e) {
        logger.error(e);
        return null;
    } catch (PDUException e) {
        logger.error(e);
        return null;
    } catch (TimeoutException e) {
        logger.error(e);
        return null;
    } catch (WrongSessionStateException e) {
        logger.error(e);
        return null;
    } catch (IOException e) {
        logger.error(e);
        return null;
    }
}

please someone can help me, thanks


Solution

  • Set data coding to 0 (network default) and encode the body with whatever charset your provider supports. Use the GSM default charset if you have to guess (jcharset includes an encoder). If you really need an extended charset use UTF-16BE and set data coding to 8.