Is it possible to send SMS messages using GSM Modem? As I try to do this, I can't seem to send SMS. It always run failed. I am using GSM Comm library.
Here is my Connect to Modem code
if(ComPort.Text == "")
{
return;
}
comm = new GsmCommMain(ComPort.Text, 9600, 150);
bool retry;
do
{
retry = false;
try
{
comm.Open();
string message = "Success!";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload = function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterStartupScript(this.GetType(), "alert", sb.ToString());
retry = true;
}
catch (Exception)
{
string message = "Gsm not available";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload = function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterStartupScript(this.GetType(), "alert", sb.ToString());
return;
}
} while (retry);
}
And here is my Sending code
protected void Send_Click(object sender, EventArgs e)
{
try
{
SmsSubmitPdu pdu;
pdu = new SmsSubmitPdu(Message.Text, Number.Text);
comm.SendMessage(pdu);
}
catch
{
string message = "Sending failed!";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload = function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterStartupScript(this.GetType(), "alert", sb.ToString());
}
}
I don't know what the problem is. It can't send messages.