Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMSC randomly send deliver_sm through TX or RX #157

Open
coolbeevip opened this issue Aug 30, 2021 · 5 comments
Open

SMSC randomly send deliver_sm through TX or RX #157

coolbeevip opened this issue Aug 30, 2021 · 5 comments

Comments

@coolbeevip
Copy link
Contributor

I have SMSC devices that only support SMPP 3.3 protocol, But it will randomly send deliver_sm through TX or RX.

I want to be compatible with it. I found the following method

responseHandler.sendNegativeResponse(pduHeader.getCommandId(),

I modify the method like :

  public void processDeliverSm(Command pduHeader, byte[] pdu,
    ResponseHandler responseHandler) throws IOException {
    boolean enableReceiveDeliverSm = Boolean.getBoolean("enableReceiveDeliverSm");
    if (bindTxDeliverSmEnabled) {
      processDeliverSm0(pduHeader, pdu, responseHandler);
    } else {
      responseHandler.sendNegativeResponse(pduHeader.getCommandId(),
        SMPPConstant.STAT_ESME_RINVBNDSTS, pduHeader
          .getSequenceNumber());
    }
  }

Is that correct?

@pmoerenhout
Copy link
Member

That looks OK to me.

@coolbeevip
Copy link
Contributor Author

Thank you, I have verified and solved this issue. Do you accept PR or I should just go ahead and fork it?

@pmoerenhout
Copy link
Member

I will refactor it, so it will fully support SMPP 3.3. You can fork it for now.

@coolbeevip
Copy link
Contributor Author

coolbeevip commented Oct 26, 2021

I noticed that PR[1] tried to solve this problem, But it looks not finished yet.

[1] e6a9bd9#diff-14b8e22a1fe560a9de6245326de2fcfcef51d6a01b3e8520b02bf071bb79796fR150-R156

@coolbeevip coolbeevip reopened this Oct 26, 2021
@coolbeevip
Copy link
Contributor Author

coolbeevip commented Oct 26, 2021

Personally, I think to define setInterfaceVersion() method in SMPPSessionState

public interface SMPPSessionState extends GenericSMPPSessionState {

    // add interface
    void setInterfaceVersion(final InterfaceVersion interfaceVersion);

And, Set interface version in the changeState() method

public class SMPPSessionContext extends AbstractSessionContext {

    @Override
    protected void changeState(SessionState newState) {
        if (!stateProcessor.getSessionState().equals(newState)) {
            final SessionState oldState = stateProcessor.getSessionState();
            ...
            } else if (newState == SessionState.BOUND_TX) {
                stateProcessor = SMPPSessionState.BOUND_TX;

                // set interface version
                stateProcessor.setInterfaceVersion(this.getInterfaceVersion());

            } else if (newState == SessionState.BOUND_TRX) {
           ...
        }
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants