Communicating with GSM modem with AT Command

1.7k Views Asked by At

I am trying to communicate with GSM modem through serial port in c#.

So far i have been able to connect with it,send AT command to it and send SMS.

for SMS sending,i am sending the following AT command

AT+CMGF=1 /* set text mode */

AT+CMGS=8801911xxxxxx 

"hellp msg "+ (char)26

its working as expected.

But for sending USSD message,

im trying

AT+CMGF=0 /* PDU mode */
AT+CUSD=1,*121# , 15

But its returning no response.

I have tried with GSMCOMM library,it has no response as well.

I have tried to convert the text to PDU, still no luck.

So how can i send USSD message in C# in a serial port to a modem and get the response back?

2

There are 2 best solutions below

4
vasek On BEST ANSWER

You should send USSD command like this:

AT+CUSD=1,"*121#",15

Also please note AT+CMGF affects only SMS sending, not USSD.

You might also want to check this answer.

0
Taha teber On

Send USSD command like this:

sp.Write("AT+CUSD=1,\"*710#\",15\r");