Click here to Skip to main content
15,790,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have written a C# application which is supposed to interact with a gsm modem using AT commands.
All other commands are working well for me except for USSD commands which are appearing to be returning a hexadecimal or encrypted string in the response.

The USSD command which i am executing is: AT+CUSD=1,"*125#",15 and its returning the same result in my code and on hyperterminal.

Have a look at the query and the result of the query which i took from the hyperterminal screen


+CUSD: 0,"004100630063002000420061006C00200030002E003000300030003000200055005300

can you please assist me in the best way possible, i am stuck.
Updated 28-May-22 11:28am
Richard MacCutchan 30-Oct-13 5:50am    
What results are you expecting? If you get the same values from hyperterm then your code is probably correct.
Member 10364520 30-Oct-13 5:52am    
I am expecting retrieve my balance and i must receive an answer like this: "your balance is 100$..."
Richard MacCutchan 30-Oct-13 5:56am    
You need to check with your service provider what the response format is.
aminvincent 27-Apr-15 6:00am    
may i get your project? because i need example for ussd command ,...thanks

I think message is in hex representation of unicode characters
Your message is

Acc Bal 0.0000 USD Exp:06/03/14.0TXTs Exp:-.0Bonus SMS Exp:-.0Free SMSs Exp:-.0.00USD Bonus airtime exp:-.New SIM 0.00USD,0SMS, 0.00MB, 0MMS Exp:-. 0TM SMSs

Simply conver string from hex into bytes and interpret it as unicode string.
Share this answer
CPallini 14-Jan-14 4:51am    
Before you send USSD with AT Command please set modem or Handphone to Text mode, with

AT+CMGF=1 this set the modem to (text mode)

AT+CMGF=0 this set the modem to (PDU mode)

I hope you understand
Share this answer
RashmitaS 1-Apr-15 6:43am    
I am trying to send USSD code for Balance Inquiry from Hyperterminal using Huawei GSM modem.

I am getting an error [+CME ERROR: 100] when I use the code AT+CUSD=1,"*901#",15

So I changed my code to AT+CUSD=1,"2a39303123",15

Now the response is

+CUSD: 2

But there is no expected Response like "Balance:Rs. 46.84.Ek ko dui offer! Matra Rs. 12* ma 18MB data.Yo dainik data pack kharid garna *17123# dial garnuhos"

which I receive when I send the same USSD code from Modem application. Kindly help.
Member 2281771 11-Aug-16 17:57pm    
I am still having the same issue. I get only +CUSD: 2 , but there is no data supplied.
Please advice how can i get the required data , like Balance:....
I'm wondering the same error! it only returns the first time AT + CUSD = 1, \ "* 101 # \", 15 OK, the remaining CUSD balance cannot be taken. please, show me the method!
Share this answer
CHill60 30-May-22 3:04am    
If you have a question then use the red "Ask a Question" link at the top of the page. Do not post questions or comments as solutions to others posts. Be sure to read the posting guidelines provided on that link - you will need to provide much more information than you have here
I managed to solve it last year, anyway, thanks for the response.
Share this answer
Ehsan Waris 5-Nov-14 14:09pm    
can you share you code please? I need some help in sending ussd codes through gsm... and i can't find any useful tutorial or hrlp.
Member 10888987 11-Feb-15 4:19am    
Can you tell me how did you solved this.
Member 11431150 28-Feb-15 19:15pm    
You can use the function split to split the data.
For Example in VB.Net :

Dim strData as string = "Mydata1,Mydata2,MyData3"
Dim mSplit() as string = strData.Split(",")

in line 2 mSplit is an array. The value of mSplit now is :

mSplit(0) = "Mydata1"
mSplit(1) = "Mydata2"
mSplit(2) = "Mydata3"
Try switch your chips to another provider, I have same problem before.
Share this answer
Richard MacCutchan 23-Dec-17 3:37am    
Answered FOUR years ago.

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