public SmppMessage createSmppMessage(DeliverSm deliverSm) throws Exception {
SmppMessage smppMessage = new SmppMessage(deliverSm, configuration);
if (deliverSm.isSmscDeliveryReceipt()) {
smppMessage.setHeader(SmppConstants.MESSAGE_TYPE, SmppMessageType.DeliveryReceipt.toString());
DeliveryReceipt smscDeliveryReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
smppMessage.setBody(smscDeliveryReceipt.getText());
smppMessage.setHeader(SmppConstants.ID, smscDeliveryReceipt.getId());
smppMessage.setHeader(SmppConstants.DELIVERED, smscDeliveryReceipt.getDelivered());
smppMessage.setHeader(SmppConstants.DONE_DATE, smscDeliveryReceipt.getDoneDate());
if (!"000".equals(smscDeliveryReceipt.getError())) {
smppMessage.setHeader(SmppConstants.ERROR, smscDeliveryReceipt.getError());
}
smppMessage.setHeader(SmppConstants.SUBMIT_DATE, smscDeliveryReceipt.getSubmitDate());
smppMessage.setHeader(SmppConstants.SUBMITTED, smscDeliveryReceipt.getSubmitted());
smppMessage.setHeader(SmppConstants.FINAL_STATUS, smscDeliveryReceipt.getFinalStatus());
if (deliverSm.getOptionalParametes() != null && deliverSm.getOptionalParametes().length > 0) {
List<OptionalParameter> oplist = Arrays.asList(deliverSm.getOptionalParametes());
Map<String, Object> optParams = new HashMap<String, Object>();
for (OptionalParameter optPara : oplist) {