Call Control
ATA Answer Command
ATD Dial Command
ATH Hang Up Call
ATL Monitor Speaker Loudness
ATM Monitor Speaker Mode
ATO Go On-Line
ATP Set Pulse Dial as Default
ATT Set Tone Dial as Default
AT+CSTA Select Type of Address
AT+CRC Cellular Result Codes
Data Card Control Commands
ATI Identification
ATS Select an S-register
ATZ Recall Stored Profile
AT&F Restore Factory Settings
AT&V View Active Configuration
AT&W Store Parameters in Given Profile
AT&Y Select Set as s Powerup Option
AT+CLCK Facility Lock Command
AT+COLP Connected Line Identification Presentation
AT+GCAP Request Complete Capabilities List
AT+GMI Request Manufacturer Identification
AT+GMM Request Model Identification
AT+GMR Request Revision Identification
AT+GSN Request Product Serial Number Identification
Phone Control Commands
AT+CBC Battery Charge
AT+CGMI Request Manufacturer Identification
AT+CGMM Request Model Identification
AT+CGMR Request Revision Identification
AT+CGSN Request Product Serial Number Identification
AT+CMEE Report Mobile Equipment Error
AT+CPAS Phone Activity Status
AT+CPBF Find Phone Book Entries
AT+CPBR Read Phone Book Entry
AT+CPBS Select Phone Book Memory Storage
AT+CPBW Write Phone Book Entry
AT+CSCS Select TE Character Set
AT+CSQ Signal Quality
Computer Data Card Interface Commands
ATE Command Echo
ATQ Result Code Suppression
ATV Define Response Format
ATX Response Range Selection
AT&C Define DCD Usage
AT&D Define DTR Usage
AT&K Select Flow Control
AT&Q Define Communications Mode Option
AT&S Define DSR Option
AT+ICF DTE-DCE Character Framing
AT+IFC DTE-DCE Local Flow Control
AT+IPR Fixed DTE Rate
ServiceAT+CLIP Calling Line Identification Presentation
AT+CR Service Reporting Control
AT+DR Data Compression Reporting
AT+ILRR DTE-DCE Local Rate Reporting
Network Communication Parameter Commands
ATB Communications Standard Option
AT+CBST Select Bearer Service Type
AT+CEER Extended Error Report
AT+CRLP Radio Link Protocol
AT+DS Data Compression
Miscellaneous Commands
A/ Re-Execute Command Line
AT? Command Help
AT*C Start SMS Interpreter
AT*T Enter SMS Block Mode Protocol
AT*V Activate V.25bis Mode
AT*NOKIATEST Test Command
AT+CESP Enter SMS Block Mode Protocol
SMS Commands SMS Text Mode
AT+CSMS Select Message Service
AT+CPMS Preferred Message Storage
AT+CMGF Message Format
AT+CSCA Service Centre Address
AT+CSMP Set Text Mode Parameters
AT+CSDH Show Text Mode Parameters
AT+CSCB Select Cell Broadcast Message Types
AT+CSAS Save Settings
AT+CRES Restore Settings
AT+CNMI New Message Indications to TE
AT+CMGL List Messages
AT+CMGR Read Message
AT+CMGS Send Message
AT+CMSS Send Message from Storage
AT+CMGW Write Message to Memory
AT+CMGD Delete Message
SMS PDU Mode
AT+CMGL List Messages
AT+CMGR Read Message
AT+CMGS Send Message
AT+CMGW Write Message to Memory
USSD Basics
USSD stands for Unstrcutured Supplementary Services Data.
It is a way of sending short commands from the mobile phone to the GSM network.
It uses, like SMS, the signalling channel of the GSM connection.
Unlike SMS, it does not use a store and forward architecture, but a session oriented connection.
USSD text messages can be up to 182 bytes in length. Messages received on the mobile phone are not stored.
USSD is defined within the GSM standard in the documents:
GSM 02.90 (USSD Stage 1)
GSM 03.90 (USSD Stage 2)
USSD applications
USSD is most used to make it easy for the (prepaid) mobile user to query his prepaid balance using his mobile phone.
It can also be used in mobile payments systems and information services such as weather forecasts and traffic information.
Automating USSD using a GSM phone or modem
To automate USSD, for instance to check your prepaid balance before submitting an SMS message, can be done using an AT command.
All GSM phones and modems that support USSD also support the following command:
AT+CUSD
The following sample demonstrates how to check your prepaid balance:
AT+CUSD=1,"*101#"
+CUSD: 2,"Your current balance is $ 22.10", 0
In this example we are sending the "*101#" USSD command to the network.
Within seconds the network responds with a response text and an error code.
In this case we have an amount of USD22.10 left on our account.
The result code in this example is : '0'.
The following resultcodes exist:
0 No further user action required
1 Further user action required
2 USSD terminated by network
4 Operation not supported
The last parameter of the response indicates the DCS (data coding scheme) used in the return text.
Querying USSD commands from the ActiveXperts SMS and Pager toolkit
The SMS and Pager Toolkit can be used to send USSD data and retrieve the results.
Currently only GSM is supported to send and receive USSD data.
The sample code below demonstrates how to query an USSD command from Visual Basic using a connected GSM phone or modem.
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const MAX_PATH = 260
Public objGsmOut As ASmsCtrl.GsmOut
Private Function SetDefaultLogFile()
Dim Buffer As String
Buffer = Space(MAX_PATH)
If GetTempPath(MAX_PATH, Buffer) <> 0 Then
TextLogfile.Text = Left$(Buffer, InStr(Buffer, vbNullChar) - 1) & "UssdLog.txt"
Else
TextLogfile.Text = "C:\UssdLog.txt"
End If
End Function
Private Sub CommandSend_Click()
Dim strResponse As String
Dim strCommand As String
Dim strFields
MousePointer = vbHourglass
strCommand = "AT+CUSD=1," & Chr(34) & TextCommand & Chr(34) & ",15"
objGsmOut.LogFile = TextLogfile.Text ' Set logfile
objGsmOut.Device = ComboDevice.Text ' Set Device
If ComboDeviceSpeed.ListIndex = 0 Then
objGsmOut.DeviceSpeed = 0 ' use default speed
Else
objGsmOut.DeviceSpeed = ComboDeviceSpeed.List(comboSpeed.ListIndex)
End If
strResponse = objGsmOut.SendCommand(strCommand, 10000) ' Send USSD Command
If (InStr(strResponse, "OK") > 0) Then ' Response should be OK
strResponse = objGsmOut.SendCommand("", 10000) ' Wait for response
If (InStr(strResponse, "+CUSD:") > 0) Then ' If USSD response is received, display text between ""
strFields = Split(strResponse, Chr(34))
strResponse = strFields(1)
End If
End If
If (objGsmOut.LastError <> 0) Then
TextResponse.Text = "N/A"
TextResult.Text = "ERROR #" & objGsmOut.LastError & " (" & objGsmOut.GetErrorDescription(objGsmOut.LastError) & ")"
Else
TextResponse.Text = strResponse
TextResult.Text = "SUCCESS"
End If
TextResponse.Text = strResponse
MousePointer = vbDefault
End Sub
Private Sub CommandView_Click()
If FileExists(TextLogfile.Text) = True Then
Shell "notepad " + TextLogfile.Text, vbNormalFocus
End If
End Sub
Private Sub Form_Load()
Dim i, lDeviceCount
Set objGsmOut = CreateObject("ActiveXperts.GsmOut")
lDeviceCount = objGsmOut.GetDeviceCount() ' Get number of devices
For i = 0 To lDeviceCount - 1
ComboDevice.AddItem (objGsmOut.GetDevice(i)) ' Add devices to list box
Next
With ComboDevice
.AddItem ("COM1") ' Add serial devices
.AddItem ("COM2")
.AddItem ("COM3")
.AddItem ("COM4")
.AddItem ("COM5")
.AddItem ("COM6")
.AddItem ("COM7")
.AddItem ("COM8")
.ListIndex = 0
End With
With ComboDeviceSpeed
.AddItem ("Default") ' Setup devicespeed combo
.AddItem ("1200")
.AddItem ("2400")
.AddItem ("9600")
.AddItem ("19200")
.AddItem ("38400")
.AddItem ("57600")
.AddItem ("115200")
.ListIndex = 0
End With
SetDefaultLogFile
End Sub
Public Function FileExists(sFileName As String) As Boolean
FileExists = CBool(Len(Dir$(sFileName))) And CBool(Len(sFileName))
End Function