我正在尝试使用 OPENSMPP 从 SMSC 接收消息。这是我的代码:
try{
PDU pdu = session.receive(30000);
if(pdu instanceof DeliverSM){
DeliverSM received = (DeliverSM) pdu;
if (received.getEsmClass() == 0) { // new message
logger.debug("RECEIVE NEW MESSAGE:" + received.debugString());
String MSG_SENDER = received.getSourceAddr().getAddress();
String SHORT_MSG = received.getShortMessage();
} else { // delivry Repport
logger.debug("RECEIVE NEW DELIVERED REPORT:" + received.debugString());
String MSG_ID = (new BigInteger(received.getReceiptedMessageId(), 16)) + "";
int MSG_STATUS = received.getMessageState();
}
}else{
logger.debug("----------------- FF pdu: " +pdu.debugString());
}
} catch (TimeoutException e) {
logger.error("------------------------- ["+SMSC_NAME+"] SMPP RECEIVED TimeoutException "+e.getMessage()+" ---------------- ", e );
} catch (ValueNotSetException e){
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED ValueNotSetException "+e.getMessage()+" ---------------- ", e );
} catch (WrongLengthOfStringException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED WrongLengthOfStringException "+e.getMessage()+" ---------------- ", e );
} catch (PDUException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED PDUException "+e.getMessage()+" ---------------- ", e );
} catch (IOException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED IOException "+e.getMessage()+" ---------------- ", e );
}catch (NotSynchronousException e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED NotSynchronousException "+e.getMessage()+" ---------------- ", e );
}catch (Exception e) {
logger.error("-------------------------["+SMSC_NAME+"] SMPP RECEIVED Exception "+e.getMessage()+" ---------------- ", e );
}
当我连接到 SMSC 时,该代码工作正常,但是当我将 SMSC 更改为另一个中心 SMSC 时,我收到此错误:
SMPP.org.pdu.ValueNotSetException
当我跟踪我得到消息 id 为空但这是我的 pdu 调试时:
(交付:(pdu:150 5 0 14)(地址:1 1 22544803532)(地址:2 1 98131)(sm:msg:id:256092548 sub:000 dlvrd:000 提交日期:1708171009 完成日期:1708171009 stat:DELIVRD错误:000 文本:)(选择:))
有人能帮助我吗。