@Override public PduResponse firePduRequestReceived(PduRequest request) { PduResponse response; try { if (request instanceof DeliverSm) { String sourceAddress = ((DeliverSm) request).getSourceAddress().getAddress(); String message = CharsetUtil.decode(((DeliverSm) request).getShortMessage(), smppClient.mapDataCodingToCharset(((DeliverSm) request).getDataCoding())); LOGGER.info("SMS Message Received: " + message.trim() + ", Source Address: " + sourceAddress); boolean isDeliveryReceipt; if (smppClient.getDetectDlrByOpts()) { isDeliveryReceipt = request.getOptionalParameters() != null; } else { isDeliveryReceipt = SmppUtil.isMessageTypeAnyDeliveryReceipt(((DeliverSm) request).getEsmClass()); } if (!isDeliveryReceipt) { TextMessageEventHandler.handleTextMessage(sourceAddress, message); } } response = request.createResponse(); } catch (Exception error) { LOGGER.warn("SMS receiving error", error); response = request.createResponse(); response.setResultMessage(error.getMessage()); response.setCommandStatus(SmppConstants.STATUS_UNKNOWNERR); } return response; }
return; if (!pdu.isResponse()) { return; switch (pdu.getCommandId()) { case SmppConstants.CMD_ID_SUBMIT_SM_RESP: this.counters.getRxSubmitSM().incrementResponseAndGet(); this.counters.getRxSubmitSM().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxSubmitSM().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break; case SmppConstants.CMD_ID_DELIVER_SM_RESP: this.counters.getRxDeliverSM().incrementResponseAndGet(); this.counters.getRxDeliverSM().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxDeliverSM().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break; case SmppConstants.CMD_ID_DATA_SM_RESP: this.counters.getRxDataSM().incrementResponseAndGet(); this.counters.getRxDataSM().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxDataSM().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break; case SmppConstants.CMD_ID_ENQUIRE_LINK_RESP: this.counters.getRxEnquireLink().incrementResponseAndGet(); this.counters.getRxEnquireLink().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxEnquireLink().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break;
static public String buildErrorMessage(PduResponse responsePdu) { return "Unexpected response PDU [" + responsePdu.getClass().getName() + "] [error: 0x" + HexUtil.toHexString(responsePdu.getCommandStatus()) + " \"" + responsePdu.getResultMessage() + "\"]"; } }
if (response.getResultMessage() == null) { response.setResultMessage(context.lookupResultMessage(pdu.getCommandStatus()));
public void sendResponsePdu(PduResponse pdu) throws RecoverablePduException, UnrecoverablePduException, SmppChannelException, InterruptedException { if (!pdu.hasSequenceNumberAssigned()) { pdu.setSequenceNumber(this.sequenceNumber.next());
@Override public void fireUnexpectedPduResponseReceived(PduResponse pduResponse) { testingForm.addMessage("UnexpectedPduResponseReceived: " + pduResponse.getName(), pduResponse.toString()); }
response.setResultMessage(context.lookupResultMessage(commandStatus));
private void countSendResponsePduResponseTime(PduResponse pdu, long responseTime) { if (this.counters == null) { return; } if (!pdu.isResponse()) { return; } switch (pdu.getCommandId()) { case SmppConstants.CMD_ID_SUBMIT_SM_RESP: this.counters.getRxSubmitSM().addRequestResponseTimeAndGet(responseTime); break; case SmppConstants.CMD_ID_DELIVER_SM_RESP: this.counters.getRxDeliverSM().addRequestResponseTimeAndGet(responseTime); break; case SmppConstants.CMD_ID_DATA_SM_RESP: this.counters.getRxDataSM().addRequestResponseTimeAndGet(responseTime); break; case SmppConstants.CMD_ID_ENQUIRE_LINK_RESP: this.counters.getRxEnquireLink().addRequestResponseTimeAndGet(responseTime); break; } }
resp.setCommandStatus(1); testingForm.addMessage("PduResponseSent: " + resp.getName(), resp.toString());
String statusMessage = response.getResultMessage(); if (statusMessage != null) { buffer.append(" result: \"");
@Override public void fireExpectedPduResponseReceived(PduAsyncResponse pduAsyncResponse) { if (pduAsyncResponse.getResponse().getCommandStatus() != SmppConstants.STATUS_OK) { // TODO // error, resend the request again? //pduAsyncResponse.getRequest().setReferenceObject(value) } }
switch (pduResponse.getCommandId()) { case SmppConstants.CMD_ID_DELIVER_SM_RESP: smppServerResourceAdaptor.fireEvent(EventsType.DELIVER_SM_RESP,
this.esme.getSourceNpi(), this.esme.getSourceAddressRange())); response.setCommandStatus(SmppConstants.STATUS_INVSRCADR); return response; this.esme.getSourceNpi(), this.esme.getSourceAddressRange())); response.setCommandStatus(SmppConstants.STATUS_INVSRCADR); return response; this.esme.getSourceNpi(), this.esme.getSourceAddressRange())); response.setCommandStatus(SmppConstants.STATUS_INVSRCADR); return response; this.esme.getSourceNpi(), this.esme.getSourceAddressRange())); response.setCommandStatus(SmppConstants.STATUS_INVSRCADR); return response; response.setCommandStatus(SmppConstants.STATUS_SYSERR);
if (pdu.isResponse()) { switch (pdu.getCommandId()) { case SmppConstants.CMD_ID_SUBMIT_SM_RESP: this.counters.getRxSubmitSM().incrementResponseAndGet(); this.counters.getRxSubmitSM().addRequestResponseTimeAndGet(responseTime); this.counters.getRxSubmitSM().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxSubmitSM().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break; case SmppConstants.CMD_ID_DELIVER_SM_RESP: this.counters.getRxDeliverSM().addRequestResponseTimeAndGet(responseTime); this.counters.getRxDeliverSM().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxDeliverSM().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break; case SmppConstants.CMD_ID_DATA_SM_RESP: this.counters.getRxDataSM().addRequestResponseTimeAndGet(responseTime); this.counters.getRxDataSM().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxDataSM().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break; case SmppConstants.CMD_ID_ENQUIRE_LINK_RESP: this.counters.getRxEnquireLink().addRequestResponseTimeAndGet(responseTime); this.counters.getRxEnquireLink().addRequestEstimatedProcessingTimeAndGet(estimatedProcessingTime); this.counters.getRxEnquireLink().getResponseCommandStatusCounter().incrementAndGet(pdu.getCommandStatus()); break;
static public String buildErrorMessage(PduResponse responsePdu) { return "Unexpected response PDU [" + responsePdu.getClass().getName() + "] [error: 0x" + HexUtil.toHexString(responsePdu.getCommandStatus()) + " \"" + responsePdu.getResultMessage() + "\"]"; } }
if (response.getResultMessage() == null) { response.setResultMessage(context.lookupResultMessage(pdu.getCommandStatus()));
public void sendResponsePdu(PduResponse pdu) throws RecoverablePduException, UnrecoverablePduException, SmppChannelException, InterruptedException { if (!pdu.hasSequenceNumberAssigned()) { pdu.setSequenceNumber(this.sequenceNumber.next());
@Override public String toString() { StringBuilder buf = new StringBuilder(100); buf.append("smpp_async_resp: seqNum [0x"); buf.append(HexUtil.toHexString(this.future.getKey())); buf.append("] windowSize ["); buf.append(getWindowSize()); buf.append("] windowWaitTime ["); buf.append(getWindowWaitTime()); buf.append(" ms] responseTime ["); buf.append(getResponseTime()); buf.append(" ms] estProcessingTime ["); buf.append(getEstimatedProcessingTime()); buf.append(" ms] reqType ["); buf.append(getRequest().getName()); buf.append("] respType ["); buf.append(getResponse().getName()); buf.append("]"); return buf.toString(); }
response.setResultMessage(context.lookupResultMessage(commandStatus));
String statusMessage = response.getResultMessage(); if (statusMessage != null) { buffer.append(" result: \"");