Search code examples
c#at-commandussdgsmcomm

Communicating with GSM modem with AT Command


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?


Solution

  • 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.