Hi, I'm working with a ZTE MF622 modem. When I send the sms it returns me
"Message Status: FAILED" I do not understand why. Can anybody help me?
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prueba2;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.smslib.SMSLibException;
/**
*
* @author FLAVIO
*/
public class App {
public static void main(String...args){
SendMessage app = new SendMessage();
try {
app.sendSms();
} catch (SMSLibException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null,
ex);
} catch (IOException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null,
ex);
} catch (InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null,
ex);
}
}
}
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prueba2;
import org.smslib.AGateway;
import org.smslib.IOutboundMessageNotification;
import org.smslib.OutboundMessage;
/**
*
* @author FLAVIO
*/
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);
}
}
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package prueba2;
import java.io.IOException;
import org.smslib.GatewayException;
import org.smslib.Library;
import org.smslib.OutboundMessage;
import org.smslib.SMSLibException;
import org.smslib.Service;
import org.smslib.TimeoutException;
import org.smslib.modem.SerialModemGateway;
/**
*
* @author FLAVIO
*/
public class SendMessage {
public void sendSms() throws GatewayException, SMSLibException,
TimeoutException, IOException, InterruptedException{
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.com4",
"COM4", 115200, "Claro", "ZTE");
SerialModemGateway gateway = new SerialModemGateway("ZTE
MF622","COM4", 115200, "ZTE INCORPORATED", "MF622");
gateway.getATHandler().setStorageLocations("SMMTME");
gateway.setInbound(true);
gateway.setOutbound(true);
Service.getInstance().setOutboundMessageNotification(outboundNotification);
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(" ID: " + gateway.getGatewayId());
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("2615976782", "Hello from
SMSLib!");
gateway.getModemDriver().write("AT+CFUN=1");
Service.getInstance().sendMessage(msg);
System.out.println(msg);
System.out.println("Now Sleeping - Hit <enter> to terminate.");
System.in.read();
Service.getInstance().stopService();
}
}
Thanks!
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/smslib/566e3b7e-0d37-4443-ab77-c758b9e5b6b8%40googlegroups.com.