* @throws MessageException if there was a problem binding to the SMSC
*/
protected void bind(Session session) throws MessageException {
BindRequest request = new BindTransmitter();
BindResponse response;
LOGGER.info("logica-smpp-version-is",
new Byte(request.getInterfaceVersion()));
// Send the request.
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("Bind request " + request.debugString());
}
try {
request.setSystemId(SMSCUser);
request.setPassword(SMSCPassword);
request.setSystemType(null);
request.setInterfaceVersion((byte) 0x34);
if("async".equals(SMSCBindType)){
response = session.bind(request, new SMSCResponseListener());
} else {
response = session.bind(request);
}
if (response != null) {
if (response.getCommandStatus() == Data.ESME_ROK) {
LOGGER.debug("Successfully bound to SMSC.");
} else {
LOGGER.error("Unexpected response to bind. " +
"Response is " + response.debugString());
}
} else {
LOGGER.debug("BindResponse was null when SMSCBindType was " +
SMSCBindType);
}