USSD – How to send USSD short codes with AT command?


Unstructured Supplementary Service Data (USSD) is service offered by network providers to get information about subscriber account, mobile-money services, menu-based information services etc. Subscriber sends a short code(ex. #225#, *43#)  from the device to request for specific service on the network. As an example, in T-Mobile network in U.S, you can send #225# from your phone to check account balance and last payment. The short codes different in each network.

AT+CUSD command is used to send USSD codes to network. The short code and encoding format are passed as command parameters. Network response is usually received within few seconds.

AT Command Tester tool provides an east interface to test USSD messages. User can enter the USSD code and look at the AT command request and response on the command window. The network response is parsed and displayed as well.

Try this script included in AT Command Tester Tool.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Script-send_ussd.at

//Send USSD

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

//List of supported responses

AT+CUSD=?

 

//WAIT for 1 sec

WAIT=1

 

//Status of result code presentation

// 0 – result code presentation is disabled, 1- result code presentation is enabled ,

AT+CUSD?

 

//WAIT for 1 sec

WAIT=1

 

//Disable USSD result code presentation

AT+CUSD=0

 

//WAIT for 1 sec

WAIT=1

 

//Enable USSD result code presentation

AT+CUSD=1

 

//WAIT for 1 sec

WAIT=1

 

//Cancel session

AT+CUSD=2

 

//WAIT for 1 sec

WAIT=1

 

//Set the character set to GSM

AT+CSCS=”GSM”

 

//WAIT for 1 sec

WAIT=1

 

//Send short code

//Check the list of short code supported by your network

//15 is encoding scheme as per GSM 3.38

//If you send supported short code, you should see response from network

//for example, below short on T-Mobile (US) should provide response account balance on prepaid accounts

AT+CUSD=1,”#999#”,15

 

//WAIT for 1 sec

WAIT=5

 

//If you send unsupport code, you will see cancel reponse session +CUSD :2

AT+CUSD=1,”unsupported code”,15

Response to above output script in AT Command Tester Tool.

AT+CUSD=?

+CUSD: (0-2)

 

OK

AT+CUSD?

+CUSD: 1

 

OK

AT+CUSD=0

OK

 

AT+CUSD=1

OK

 

AT+CUSD=2

OK

 

AT+CSCS=”GSM”

OK

 

AT+CUSD=1,”#999#”,15

OK

 

+CUSD: 0, “Your T-Mobile Prepaid account balance is 1.00 USD. To add more minutes, dial *233 or redeem a refill card.”, 15

 

AT+CUSD=1,”unsupported code”,15

OK

 

+CUSD: 2

Keywords: Module USSD, M2M USSD, GPRS USSD, 3G USSD, USSD through AT commands,