1

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?

BWA
  • 5,672
  • 7
  • 34
  • 45
Shofiqul Alam
  • 585
  • 1
  • 7
  • 29

2 Answers2

2

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.

vasek
  • 2,759
  • 1
  • 26
  • 30
  • actually i was sending exactly this, but still no luck. Here is how im sending and receiving : _serialPort.WriteLine("AT+CUSD=1,\"*121#\",15"); Thread.Sleep(1000) result = _serialPort.ReadLine(); am i need to do anything extra to get USSD response ? – Shofiqul Alam Aug 10 '17 at 08:53
  • @ShofiqulAlam Have you checked [this](https://stackoverflow.com/questions/42700301/atcusd-not-working-on-modem-huawei-e3131a)? – vasek Aug 10 '17 at 09:01
  • No,The link has solved my problem. can you post it as answer so that i can accept? – Shofiqul Alam Aug 10 '17 at 12:08
  • @ShofiqulAlam i've edited my answer. Please don't forget to also upvote original answers so that you help the others! – vasek Aug 14 '17 at 09:12
0

Send USSD command like this:

sp.Write("AT+CUSD=1,\"*710#\",15\r");
Taha teber
  • 20
  • 7