1
votes

working on C# project and Huawei E1550 modem to send USSD codes using +CUSD command

after a lot of research and try and error i discovered that i should send the command encoded using "GSM 7bit"

i found online converter that do that : http://smstools3.kekekasvi.com/topic.php?id=288

so i search to find class/algorithm to implement it using c# and i find this : https://sites.google.com/site/freesmsuk/gsm7-encoding

the problem is if i encode one character only it encode it correctly "1" --> "31"

but when i encode string "*888#" the online converter generates "2A1C0E3702" while the class generates "2A38383823"

and the modem processed the online encoding not the class

what's the wrong with the algorithm? thanks in advance

1

1 Answers

1
votes

If I try to convert it, I get "2A1C0E3702"

Hex         2A          1C          0E          37          02      +++++++
Octets      00101010    00011100    00001110    00110111    00000010     
Septets      0101010     0111000     0111000     0111000     0100011    +++++++
Character    *           8           8           8           #   

This is the seven bit alphabet. The spacing is purely for readability.

SEVEN_BIT_ALPHABET_ARRAY = (
'@', '£', '$', '¥', 'è', 'é', 'ù', 'ì', 'ò', 'Ç', '\n', 'Ø', 'ø', '\r','Å', 'å',
'\u0394', '_', '\u03a6', '\u0393', '\u039b', '\u03a9', '\u03a0','\u03a8', '\u03a3', '\u0398', '\u039e',
'€', 'Æ', 'æ', 'ß', 'É', ' ', '!', '"', '#', '¤', '%', '&', '\'', '(', ')','*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7','8', '9',
':', ';', '<', '=', '>', '?', '¡',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'Ä',                                                                  'Ö',
                                                                 'Ñ',                               'Ü', '§', 
                         '¿',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'ä',                                                                  'ö',
                                                                 'ñ',                               'ü',
'à')

I used the calculator at http://rednaxela.net/pdu.php to convert these.

It looks like it might be a character encoding issue. Make sure the characters you're converting are ASCII, not unicode.

Finally, are you sure you need to PDU encode your USSD? Most modems will work with

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