3
votes

I am trying to send at commands to get balance on huawei e3131a modem but i always receive "Ok" as answer no matter the configuration i use (GSM, IRA, UCS2). I also tried to change the operator code (#123#) to many formats like Hex PDU Simple String but no way to get the balance. Here is the command i sent : AT+CUSD=1,"#123#",15. Thanks in advance for the help.

NB: I am using Putty to send commands.

2

2 Answers

5
votes

I finally found the method to send USSD At commands.

Some 3G Modem doesn't support plain text or even hexadecimal form. So to send commands I have to set the modem to IRA form by doing:

AT+CSCS="IRA"

After I convert the command that permits me to get balance (for me : #123#) to gsm7bit form.

Finally sending the command by doing:

AT+CUSD=1,"A3986C3602",15

It will return OK the first time and 5 seconds after, it returns the response in gsm7bit form. It exactly returns:

+CUSD: 1,"4379999CA683CEECB738CCD68162351CCDC81ABFDB707AB92E07C9CB6374587E2E8362351CCD080A83C66FF7FCDD6E97E5A0B03DECA683D86510CCF682E55E3258ECE6A286E1653D080682BFEB7210BB0C2297E9E1345B470ED3CB207219640FB3D3E434BD0C2AD341EDB79B1E76D341E432688C0EC7EB65D0F8DD86D3CB75B92B5A4FD3E965B92E06",15

And to get it in plain text just copy and convert to string.

Thanks to all !!

0
votes

As per the documentation the AT+CUSD command will return OK immediately if all the parameters are correct. If the first parameter is set to 1, an unsolicited response (+CUSD:...) will be returned when the network responds to the USSD request.

So you must wait for +CUSD response after you have received an OK.