Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AT+CUSD command: Response encoding

I am sending AT+CUSD command (to dial a ussd code) to a gsm modem. It is working fine. The response is also correct on the handset. But the response is in I think hex format or some encoding unknown to me:

GSM MODEM HARDWARE:

Nokia C6-01

Connected to laptop using USB cable. Usb mode: Nokia Suite

Commands for initializing the encoding:

AT+CSCS=?

+CSCS: ("UCS2","GSM","PCCP437","PCDN","IRA","8859-1","HEX","UTF-8")

AT+CSCS="IRA"

AT+CSCS?

+CSCS: "IRA"

Also tried:

AT+CSCS="GSM"
AT+CSCS="UTF-8"

Actual Ussd Command:

AT+CUSD=1,"*123#",15

Actual Response:

+CUSD: 1,"c47258e1ad7e7f477bb2c6781e0ec72785e691d36136481593cd54f6777d8c2ecb23e1313d6dfd3d36f7764fc26974720fa1b242f8fd161f9b9cc",1

OK

Expected Response:

AT+CUSD=1,"*123#",15

+CUSD: 1,"Dear Customer.... some response in english",1
like image 379
Syed Aqeel Ashiq Avatar asked Sep 16 '25 06:09

Syed Aqeel Ashiq


1 Answers

Looks like an modem decoding issue. Should be fixed by making use of the standard IRA encoding of most modems.

Try using:

AT+CSCS="IRA"

And then try out the USSD command to get a response again.

As a side note you can output available encoding capabilities of your modem via:

AT+CSCS=?

USSD's are encoded either as 7-Bit GSM or UC2. To decode using 7-Bit take a look at 3GPP ETSI 03.38. To decode UC2 this is basically UTF-16 so 2 bytes defines a character.

Trying with 7-Bit:

C4    1 1000100     100 0100     D
72    01 110010     110 0101     e
58    010 11000     110 0001     a
E1    1110 0001     000 1010     <LF>
AD    10101 101     101 1110     ü
7E    011111 10     101 0101     U
7F    0111111 1     101 1111     §
47    0 1000111     011 1111     ?
7B    01 111011     100 0111     G

Dea<LF>üU§?G

Starts off good with 7-Bit but after 3 characters its just junk.

Trying with UC2 just produces junk.

Conclusion: Perhaps an specific issue with the modem being used (still would be useful to know which manufacturer model it is). Or how you are connected to the modem (considering the USSD string is not a valid hex string as it's of uneven length).

like image 94
Matt Aldridge Avatar answered Sep 18 '25 10:09

Matt Aldridge