Main Navigation

You are here:

SMSSolutions.net > Tutorials > Sending DTMF using a GSM modem

What are DTMF tones ?

There are companies which have a telephone system which can be controlled by DTMF tones (for instance: pager systems). To use these services you need to have a phone which is capable to send DTMF tones.

DTMF stands for Dual Tone Multiple Frequency. When a key on the phone is pressed during a phone call this character is send using DTMF. The following characters can be send using DTMF: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,* and #.

The DTMF keypad is laid out in a 44 matrix, with each row representing a low frequency, and each column representing a high frequency (see table). Pressing a single key such as '1' will send a sinusoidal tone of the two frequencies 697 and 1209 hertz (Hz). The original keypads had levers inside, so each button activated two contacts. The multiple tones are the reason for calling the system multifrequency. These tones are then decoded by the switching center to determine which key was pressed.

  1209Hz 1336Hz 1477Hz 1633Hz
697Hz 1 2 3 A
770 4 5 6 B
852Hz 7 8 9 C
941Hz * 0 # D

How to send DTMF tones

Of course you can send DTMF phones using your fixed line phone or cellphone, but if you want to automate the sending of these tones over a phone connection, it becomes difficult because most modems can only send DTMF to dial a number, but when the connection is made, there is no way to send these tones. Some GSM modems do have this featuresuch as the WaveCom and the Multitech GSM modems.

Sending DTMF tones using a GSM modem

The following code sample demonstrates how to send a numeric text message to a pager using a GSM modem. The sample checks if there is a PIN code on the SIM card in the GSM modem and sets the code.

If the code is correct, the modem will dial the number in voice mode, waits till the connection has been established and sends the DTMF code. Finally, the connection is terminated.

The following AT Commands are used:

ATDxxxxxxxxxxxxxxx;

The ATD command is used to dial a number. The semi-colon at the end of this number indicates that this connection has to be setup as a voice call. When leaving this semi-colon, the connection is set up as a data call.

AT+VTD=xx

This command is optional, and is used to set the DTMF tone duration in 100mS steps.

AT+VTS=x

To send the actual DTMF code, you have to call this command for every digit sent. To send, for instance "*1234#", you have to send:

AT+VTD=*;+VTD=1;+VTD=2;+VTD=3;+VTD=4;+VTD=#

ATH0

Terminates the phone connection (hangup).