Click here to Skip to main content
15,906,625 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello , i developed an SMS program, with that i can send sms and read sms on pc via my phone thats connected with SUB cable. For these i use AT commands, i werent using any library. Now my question is how can my program autodetect that the phone recieved an sms and send an answer on that number. Autoreplay. Help please. :omg:

I just need some introductions. :D
Posted
Updated 7-Mar-23 20:09pm
Comments
michaelschmitt 19-Aug-10 9:27am    
I'm not getting you 100%. Do you want your phone to intercept incoming sms (and an application running on that phone should react to it?), or do you mean the application on your pc should react to it? To solve
the first part, you could use the MessageInterceptor (only wm .net cf). To solve the second part, maybe you could poll your phone for new sms within a certain time interval? There may be other solutions out there, i would google with bing for "remote control phone" or stuff like that

I'd need a little more information the type of phone and such. If the phone has a public API, maybe you could write something that could subscribe to the phone's incoming event. When you get a message, you fire a command down the USB port to a thread that is listening on the other end.

However, one possibility would be not to use the phone as the receiver at all. I know that some telcos allow you to log in and view your sent and received messages. Maybe your telco has an some kind of service that allows you to view received messages? You could subscribe to that service on your computer and whenever you get an incoming message, fire those AT commands to send out a response via your phone.
 
Share this answer
 
Comments
Nish Nishant 21-Aug-10 9:49am    
Reason for my vote of 5
Proposed answer
AT+CNMI: New Message indication to TE


Command Possible response(s) +CNMI=[<mode>[,<mt>[,<bm>[,<ds>[,<bfr>]]]]] +CNMI?+CNMI: <mode>,<mt>,<bm>,<ds>,<bfr> +CNMI=?+CSCB: (list of supported <mode>s,<mt>s,<bm>s,<ds>s,<bfr>s)


<mode>: 0: buffer in TA;

1: discard indication and reject new SMs when TE-TA link is reserved; otherwise forward

directly;

2: buffer new Sms when TE-TA link is reserved and flush them to TE after reservation;

otherwise forward directly to the TE;

3: forward directly to TE;

<mt>: 0: no SMS-DELIVER are routed to TE;

1: +CMTI: <mem>,<index> routed to TE;

2: for all SMS_DELIVERs except class 2: +CMT: .... routed to TE;

class 2 is indicated as in <mt>=1;

3: Class 3: as in <mt>=2;

other classes: As in <mt>=1;

<bm>: same as <mt>, but for CBMs;

<ds>: 0: No SMS-STATUS-REPORT are routed to TE;

1: SMS-STATUS-REPORTs are routed to TE, using +CDS: ...

<bfr>: 0: TA buffer is flushed to TE (if <mode>=1..3);

1: TA buffer is cleared (if <mode>=1..3);


AT+CNMI=1,1,0,0,0 ; Enable de reception of SM's

+CMTI: "ME",3 ; a SM is received and stored in ME, index 3 (send from modem!)

AT+CPMS="ME" ; Make sure memory is OK

OK

AT+CMGR=3 ; Read message

+CMGR: "REC UNREAD",,,

Hello world
 
Share this answer
 
v3
Hmm so here is what i want! For exemple:

An sms voting system, like when there are this talen shows on tv, there are 2guys and u send an sms on the number 1234 with the text VOTE ADAM. And then you get an sms back with You Voted for Adam, thank you. So i want that my application detects when my phone gets a new sms, and answer on that sms. My english isnt the best i hope you got it now. I think i need and endless cycle that is cheking the port on that my phone is connected... im not sure.
 
Share this answer
 
Without getting too much into the technical details (as i sure dont know them in this case..):

In your earlier post you wrote that you can already read and send sms from your pc via your phone. So why not implement a polling algorithm which checks your phone for new sms from time to time and replies
to that sms. You should already have all the necessary utils.
 
Share this answer
 
AT+CNMI=?

then i get this answer:

+CNMI: (2),(0-3),(0-3),(0-2),(0,1)

i dont rly understand your answer what do i do with this now?
i understand that u always have to chek if something happened on the phone , ill do that with a timer, for example i count the messages in every 4 seconds. But i dont know what do i have to chek when new message where received... :(
 
Share this answer
 
Comments
Du Sijun 22-Aug-10 12:43pm    
+CNMI: (2),(0-3),(0-3),(0-2),(0,1)
this shows what your modem can do

You can try following command

AT+CNMI=2,1,0,0,0 ok how about this

then send a SMS to your phone you will get some feedback like:

+CMTI: "ME",3

you need to check for this line
T0mii 22-Aug-10 12:53pm    
AT+CNMI=1,1,0,0,0 and what does this mean?
T0mii 22-Aug-10 12:55pm    
just cause i get an error when i write this into hyper terminal AT+CNMI=1,1,0,0,0
Du Sijun 22-Aug-10 13:00pm    
then

AT+CNMI=2,1,0,0,0
T0mii 22-Aug-10 13:01pm    
uhmm now just to be clear what im doing right now, im using hyper terminal, i wrote this AT+CNMI=2,1,0,0,0 , enter then i got OK
then i sent an sms, to the phone, but nothing happened.
how do i reset, AT+CNMI to orginal setup, cause i cant count the newly sent sms!!! omg now i have a problem.. aaaa. i )(^%$ up what i did till now.....:mad: :doh:
 
Share this answer
 
Comments
T0mii 22-Aug-10 15:33pm    
nvm, working =]
hello every one!!
just make sure at the end of your setup, you put this lines of code
void setup(){
Serial.begin(9600);
myserial.begin(9600);
myserial.println("AT");
  delay(1000);
  myserial.println("AT+CMGF=1");//pass the module to text mode
  delay(1000);
  myserial.println("AT+CNMI=2,2,0,0,0");//to pass it to +CMT: "+237699xxxxx1","","22/02/23,11:59:15+20"
  delay(1000);
//send and sms and receive it in it long format as above. 
 
Share this answer
 
Comments
CHill60 8-Mar-23 3:21am    
Why?
(Plus I doubt the OP is still interested 13 years later)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900