多个短信未发送,没有响应,

时间:2018-12-07 14:47:02

标签: java sendmessage

代码包含SubmitMultiSM发送多个短信,我陷入了困境 发送多个目的地。我正在使用收发器发送短信。     //请求     SubmitMultiSM请求=新的SubmitMultiSM();

try {
    request.setSourceAddr(createAddress("ABCDEF"));
    request.setServiceType("CMT");
    request.addDestAddress(new 
DestinationAddress(createAddress(("918478919874"))));
    request.addDestAddress(new 
DestinationAddress(createAddress((recipientPhoneNumber))));
    request.setShortMessage(messageText);
    request.setEsmClass((byte) 0);
    request.setProtocolId((byte) 0);
    request.setPriorityFlag((byte) 0);
    request.setRegisteredDelivery((byte) 1);
    request.setDataCoding((byte) 0);
    request.setSmDefaultMsgId((byte) 0);
    request.setCommandId(Data.SUBMIT_MULTI);

} catch (WrongLengthOfStringException | TooManyValuesException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
//Session
Session session=null;
try {
    session = getSession(smscHost, smscPort, smscUsername, smscPassword);
    System.out.println(session.getState()+","+session.getType());
} catch (Exception e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}
SubmitMultiSMResp response = null;
try {
    System.out.println(request.debugString());
    System.out.println("command Id:"+request.getCommandId());
    System.out.println("getCommandLength:"+request.getCommandLength());
    System.out.println("getEsmClass:"+request.getEsmClass());
    System.out.println("getDataCoding:"+request.getDataCoding());
    System.out.println("getCommandStatus:"+request.getCommandStatus());
    System.out.println("getSequenceNumber:"+request.getSequenceNumber());
    System.out.println("SM_LENGTH:"+request.getSmLength());
    response = session.submitMulti(request);
    System.out.println(""+response.isGNack()+response.getCommandStatus());
} catch (TimeoutException | PDUException | WrongSessionStateException | 
IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

String messageid = response.getMessageId();     }

0 个答案:

没有答案