如何从MO中提取消息ID?
我想将submitMultipleMessagesAtOnce返回的消息ID链接到收到的MO,但似乎MO不能像DLR一样检索到相同的消息ID?
然后如何将MO与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()));
}
}