I am sending sms using my nokia phone as modem . It was working 2 days ago when i tried it but now i get Sending failed due to gateway failure . It still works fine when i run it as a java application but doesn't work when run on jboss .I don't know what could have changed. The Exception i get is
GTW: modem.com3: Opening: COM4 @9600
GTW: modem.com3: GSM: Registered to home network.
GTW: modem.com3: MEM: Storage Locations Found:
GTW: modem.com3: Retrying the detection of CNMI, modem busy?
GTW: modem.com3: Retrying the detection of CNMI, modem busy?
GTW: modem.com3: Retrying the detection of CNMI, modem busy?
GTW: modem.com3: CNMI detection failed, proceeding with defaults.
GTW: modem.com3: Callback indications were *not* set succesfully!
GTW: modem.com3: Signal level/bit error rate: +CSQ: 20,99
OK
GTW: modem.com3: Error: unknown: Retrying...
sendMessage(): Gateway modem.com3 does not respond, marking for restart.
===============================================================================
<< OutboundMessage >>
-------------------------------------------------------------------------------
Gateway Id: *
Message Id: 1
Message UUID: 5918a253-6eb0-44b8-a4ee-2aa6129f8ce3
Encoding: 7-bit
Date: Mon Apr 04 12:41:03 PKT 2016
SMSC Ref No:
Recipient: 03115234389
Dispatch Date: null
Message Status: FAILED
Failure Cause: GATEWAY_FAILURE
Validity Period (Hours): -1
Status Report: false
Source / Destination Ports: -1 / -1
Flash SMS: false
Text: "Hey"
PDU data: <cannot extract="" udh="" present="">
Scheduled Delivery: null
What I have tried:
private void sendSMS(String mobile1, String subject, String body) {
OutboundNotification outboundNotification = new OutboundNotification();
System.out.println("Example: Send message from a serial gsm modem.");
System.out.println(Library.getLibraryDescription());
System.out.println("Version: " + Library.getLibraryVersion());
SerialModemGateway gateway = new SerialModemGateway("modem.com3", "COM4", 9600, "", "");
gateway.setInbound(true);
gateway.setOutbound(true);
Service.getInstance().setOutboundMessageNotification(outboundNotification);
try {
Service.getInstance().addGateway(gateway);
Service.getInstance().startService();
System.out.println();
System.out.println("Modem Information:");
System.out.println(" Manufacturer: " + gateway.getManufacturer());
System.out.println(" Model: " + gateway.getModel());
System.out.println(" Serial No: " + gateway.getSerialNo());
System.out.println(" SIM IMSI: " + gateway.getImsi());
System.out.println(" Signal Level: " + gateway.getSignalLevel() + " dBm");
System.out.println(" Battery Level: " + gateway.getBatteryLevel() + "%");
System.out.println();
OutboundMessage msg = new OutboundMessage(mobile1, body);
Service.getInstance().sendMessage(msg);
System.out.println(msg);
System.out.println("Now Sleeping - Hit <enter> to terminate.");
System.in.read();
Service.getInstance().stopService();
Service.getInstance().removeGateway(gateway);
} catch (Exception e) {
e.printStackTrace();
try {
Service.getInstance().stopService();
Service.getInstance().removeGateway(gateway);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
public class OutboundNotification implements IOutboundMessageNotification
{
public void process(AGateway gateway, OutboundMessage msg)
{
System.out.println("Outbound handler called from Gateway: " + gateway.getGatewayId());
System.out.println(msg);
}
}