in modules/sms/src/main/java/org/apache/axis2/transport/sms/gsm/GSMImplManager.java [202:245]
public void sendSMS(SMSMessage sm) {
if (service == null && !serviceRepo.gatewayInUse(gsmTransportOutDetails.getGatewayId())) {
//Operating in the Out Only mode
service = new Service();
gateway = new SerialModemGateway(gsmTransportOutDetails.getGatewayId(), gsmTransportOutDetails.getComPort(),
gsmTransportOutDetails.getBaudRate(), gsmTransportOutDetails.getManufacturer(),
gsmTransportOutDetails.getModel());
// Set the modem protocol to PDU (alternative is TEXT). PDU is the default, anyway...
gateway.setProtocol(AGateway.Protocols.PDU);
// Do we want the Gateway to be used for Outbound messages?
gateway.setOutbound(true);
// Let SMSLib know which is the SIM PIN.
gateway.setSimPin("0000");
try {
// Add the Gateway to the Service object.
this.service.addGateway(gateway);
// Similarly, you may define as many Gateway objects, representing
// various GSM modems, add them in the Service object and control all of them.
// Start! (i.e. connect to all defined Gateways)
this.service.startService();
} catch (Exception e) {
log.error(e);
}
} else if(serviceRepo.gatewayInUse(gsmTransportOutDetails.getGatewayId())) {
service = serviceRepo.getService(gsmTransportOutDetails.getGatewayId());
}
OutboundMessage msg = new OutboundMessage(sm.getReceiver(), sm.getContent());
try {
// a blocking call.This will be blocked untill the message is sent.
// normal rate is about 6msgs per minute
service.sendMessage(msg);
} catch (Exception e) {
log.error(e);
}
}