how to get balance by USSD commands?

25.3k views Asked by At

I have tired to search how to send USSD command on Google. I want to check may balance from operator.

All of the samples I have seen use commands like this:

 "AT+CUSD=1,\"*140*1#\"\r\n";

It seems to be correct. I am using something like this that I think works. I have a D-Link GSM modem, and when I send this command using it, it makes some noise on my speaker, which I believe tells me something happened.

my modem have it's own windows application when i disconnected modem by my own application,i check it by modem's application and in USSD tab i can found the result of my commands that i sent by myself application.

then that command works fine but i 'm confuse what is happens when i sent my command it return me "OK" and do not return operator answer and how my modem's application can read that answer????????

i test these commands but can not get result and my modem just return somethings like this: "AT+CUSD=1,\"*140*1#\"\r\n\OK\r\n" only.

1) "AT+CUSD=1,\"*140*1#\",15\r\n"

2) "AT+CUSD=1,\"*140*1#\",1\r\n"

3) "AT+CUSD=1,\"*140*1#\",15\r"

4) "AT+CUSD=1,\"*140*1#\",1\r"

5) "AT+CUSD=1,\"*140*1#\""

i think reading command's result maybe has difference command or i should set some config on my modem .

it is very interesting for me that my modem do not return error to me and always return OK.

4

There are 4 answers

5
motevalizadeh On BEST ANSWER

enter image description here

I found that my modem use more than one port and i should connect at the first port to send my command and listen to another port to get the USSD command's result

0
Hakeem On

i just use this "AT+CUSD=1,'*120#',15" in my country the USSD code is *120# but remember if you are using it withing a code you must add crlf character to the end hope this help

0
zatokaa On

Try This using Hyperterm Serial Monitor Application ( https://www.hilgraeve.com/hyperterminal-trial/ )

First Convert Modem to PDU Mode :

AT+CMGF=0

Second USSD Code Send :

AT+CUSD=1,"#132#",15 

( Use your Country Carrier Codes )

Finally Read Output from Terminal :)

0
Onsongo Moseti On

You need to set the Message format to AT+CMGF=0, before sending your USSD Command. This is PDU Mode (http://www.smartposition.nl/resources/sms_pdu.html). I was stumped using AT+CMGF=1, which is Text mode, before I decided to try AT+CMGF=0.

Worked like Magic.

So:

  1. Set Message Format to PDU (AT+CMGF=0)
  2. Execute Your USSD Command (AT+CUSD=1,*544*2*3#,15) - example message
  3. Read response from the Port.

I am assuming that you know already how to form your AT Commands and Read the response from the Port.