Reputation: 612
How can I receive SMS through a GSM modem so that I can use this SMS for further processing and send back a reply SMS. I do not have particular idea on how to achieve this....... I prefer using java language for this project and I am using Linux OS.
Upvotes: 5
Views: 25788
Reputation: 52185
You might want to give a look at SMSLib:
SMSLib is a programmer's library for sending and receiving SMS messages via a GSM modem or mobile phone. SMSLib also supports a few bulk SMS operators.
Upvotes: 5
Reputation: 369
U can use many methods ...
For recieving SMS best and simple solution will be SMSenabler it will save your SMS instantly to file or database and u can retrieve it Free version supports upto 12 characters and if you want to send sms then you can use [enter link description here][Ozeki] Ozeki sms server gateway
Upvotes: 0
Reputation: 31
hi i'm using RXTX library the code goes here!.. and its works fine for me , i searched a lot of things to get correct method finaly got the key to sms!.. :D
String mValue = "AT\r";// strating to communicate with port starts here!
mOutputToPort.write(mValue.getBytes());
mOutputToPort.flush();
Thread.sleep(500);
mInputFromPort.read(mBytesIn);
value = new String(mBytesIn);
System.out.println("Response from Serial Device: "+value);
mValue = "AT+cmgf=1\r";
mOutputToPort.write(mValue.getBytes());
mOutputToPort.flush();
mValue="at+cmgs=\" Mobile number\"\r";
System.out.print(mValue);
mOutputToPort.write(mValue.getBytes());
mOutputToPort.flush();
mValue="at+cmgs="\032";//calling ctrl+z
System.out.print(mValue);
mOutputToPort.write(mValue.getBytes());
mOutputToPort.flush();
mOutputToPort.close();
mInputFromPort.close();
Upvotes: 3
Reputation: 24666
You shoud take a look at your modem manual. Some devices support telnet connection and you can sent AT commands via command line.
If this is your case you have to learn about (sometimes specific for each device), and code an application that uses telnet to communicate with your modem. Apache Commons Net project can be useful.
Some AT commands guides:
Alternatively you can try to use one of the libraries suggested by others.
Upvotes: 0
Reputation: 10717
To send an SMS using a 3G modem, you need to use the appropriate AT
commands. First you need to set the modem to text mode:
AT+CMGF=1
Then you send your message:
AT+CMGS=<number><CR>
<message><CTRL-Z>
Where <CR>
is a carriage return (ASCII 13), and <message>
is the message you want to send, <CTRL-Z>
is ASCII 26, and <number>
is the number you want to send your message to.
To read received messages, you do this:
AT+CMGL=<stat><CR>
Where <stat>
is one of: "ALL"
, "REC UNREAD"
, "REC READ"
(with the quotes), meaning all messages, unread messages, and read messages respectively.
To do this in Java you'll need to use the Java communications API. Here's a short example: http://java.sun.com/products/javacomm/reference/docs/API_users_guide_3.html
Upvotes: 3
Reputation: 21564
Take a look at the Java SMSLib API.
From the web site : "SMSLib is a programmer's library for sending and receiving SMS messages via a GSM modem or mobile phone. SMSLib also supports a few bulk SMS operators."
Upvotes: 1