DeliverSm deliverSm = new DeliverSm();
boolean isDLR = message.getProperty("isDLR", Boolean.class) == null ? false : message.getProperty("isDLR", Boolean.class) == true;
if (isDLR) {
deliverSm.setEsmClass((byte) 0x04);
deliverSm.setSourceAddress(new Address().withAddress(message.getProperty("from", String.class)));
deliverSm.setDestAddress(new Address().withAddress(message.getProperty("to", String.class)));
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmm");
StringBuffer text = new StringBuffer();
text.append( "id:" + message.getProperty("messageId", String.class) + " " );
text.append( "sub:" + fixTo(message.getProperty("submitted", Integer.class), 3) + " " );
text.append( "dlvrd:" + fixTo(message.getProperty("delivered", Integer.class), 3) + " " );
String strSubmitDate = message.getProperty("submitDate", Date.class) == null ? "" : sdf.format(message.getProperty("submitDate", Date.class));
text.append( "submit date:" + strSubmitDate + " " );
String strDoneDate = message.getProperty("doneDate", Date.class) == null ? "" : sdf.format(message.getProperty("doneDate", Date.class));
text.append( "done date:" + strDoneDate + " " );
text.append( "stat:" + message.getProperty("finalStatus", String.class) + " " );
text.append( "err:0 ");
text.append( "text: " );
deliverSm.setShortMessage(CharsetUtil.encode(text.toString(), CharsetUtil.CHARSET_GSM));
} else {
deliverSm.setSourceAddress(new Address().withAddress(message.getProperty("from", String.class)));
deliverSm.setDestAddress(new Address().withAddress(message.getProperty("to", String.class)));
deliverSm.setShortMessage(CharsetUtil.encode(message.getProperty("text", String.class), CharsetUtil.CHARSET_GSM));
}
Collection<SmppSession> sessions = smppServer.getSessions();
for (SmppSession session : sessions) {