How to get balance on USSD commands?

I'm tired of looking for how to send the USSD command to Google. I want to check if the balance can work with the operator.

All the samples I've seen use the following commands:

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

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

my modem has its own application for Windows, when I disconnected the modem with my application, I check it with the modem application and on the USSD tab I can find the result of my commands that I sent by the application itself.

then this command works fine, but I confuse what happens when I send my command, it returns me β€œOK” and does not return the operator’s response, and how can my modem application read this answer ????????

I am testing these commands, but I can’t get the result, and my modem just returns something like this: "Only AT + CUSD = 1, \" * 140 * 1 # \ "\ r \ n \ OK \ r \ n" .

 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 that the result of the read command may have a difference command, or I should install some configuration on my modem.

I am very interested that my modem does not return an error to me and always returns OK.

+4
source share
3 answers

enter image description here

I found that my modem uses more than one port, and I have to connect to the first port to send my command and listen to another port to get the result of the USSD command

0
source

Before sending the USSD command, you need to set the message format AT + CMGF = 0. This is the 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:

  • Set message format to PDU (AT + CMGF = 0)
  • Run the USSD command (AT + CUSD = 1, * 544 * 2 * 3 #, 15) - message example
  • Read the answer from the port.

I assume that you already know how to form your AT commands and read the response from the port.

+6
source

I just use this "AT + CUSD = 1, * * 120 # ', 15" in my country the code is USSD * 120 #, but remember, if you use it with the code, you should add the crlf character to the end hope this help

0
source

Source: https://habr.com/ru/post/1499586/


All Articles