How do I extract the message ID from MO?
I want to link the message ID returned from submitMultipleMessagesAtOnce to the MO received but it doesn't seem that the same Message ID can be retrieved for MO as is for DLR?
How do I then marry the MO to the DLR?
public void onAcceptDeliverSm(DeliverSm deliverSm)
throws ProcessRequestException {
if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {
// this message is delivery receipt
try {
DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
// lets cover the id to hex string format
long id = Long.parseLong(delReceipt.getId()) & 0xffffffff;
String messageId = Long.toString(id, 16).toUpperCase();
/*
* you can update the status of your submitted message on the
* database based on messageId
*/
LOGGER.info("Receiving delivery receipt for message '{}' from {} to {}: {}",
messageId, deliverSm.getSourceAddr(), deliverSm.getDestAddress(), delReceipt);
} catch (InvalidDeliveryReceiptException e) {
LOGGER.error("Failed getting delivery receipt", e);
}
} else {
// this message is regular short message
/*
* HOW DO I GET THE MESSAGE ID HERE AS ABOVE FOR DLR
*/
LOGGER.info("Receiving message : {}", new String(deliverSm.getShortMessage()));
}
}
User contributions licensed under CC BY-SA 3.0