DTMF Detection with Python script

9 thoughts on “DTMF Detection with Python script

  1. Hello,

    We want to use DTMF decoder in Python with GL865. When GL865 on calling state, Python application is not running.


    How can i use DTMF decoder with Python script ?


    1. Probably this is not possible to do. This is because DTMF routine requres a lot of module CPU work and Python is a task with low priority.

      However you could try to carry out some tests issuing the commands via MDM.send:





      and then try to read the  URC message with SER.read method. But. I repeat, I don’t know if Python will be able to read this message in real time with your equipment

    1. GL865-DUAL/QUAD support DTMF tone decoding under Python control even with CPUMODE=0.

      It was tested!

      But it is better to set CPUMODE=1 or even more. 

      Also is better to send at least 2-tone command – for instance 55 instead of 5. If DTMF tones are sent from GSM handset in noisy environment (from car with loud music) it is possible that noise to generate false tone. Observed a lot of times. Of course without changing of DTMF decoder settings and old firmware. May be with some setting changes and newest firmware this false tone could be rejected, but i have not time or that.  

      All this is observed during tests of my dog tracking and training device. DTMF tones was used to activate sound an vibration signals that are dog control commands.

        1. So Nikolay was answering with more info to Emre. Thanks Nikolay!

          You are wlecome!

          The forum is to help each other.

          BTW, please ask Telit people to edit AT-commands that have to be separated to AT-commands for SELINT=2 (all new modules) and SELINT=0,1 (for older). It is boring to scroll more than 500 pages with lot of unuseful info.

  2. Hi Nikolay , i did using DTMF decoding as you said, still i am not able to receive the DTMF codes all the time. Some times it works well.


    What could be the reason? i am using the CPUMODE 3 now. and waiting in the loop to receive the codes.


    Onething i noted, the DTMF code for ‘9’ receives all the time without fail.


    Can you help me


    1. Hi Vijay,


      I am using Python script and sequence of command is:

      AT#DTMF=1 to enable DTMF decoder

      ATA to answer to call (Device is responding to external call)

      and after that device enters /DTMF waiting loop to receive #DTMFEV: <tone>


      You can try it manually by using RSterm or other terminal program.

      Make a voice call to modem, enable DTMF decoder and open line.

      Press button on your phone and check what device is receiving.


      In case of hard noise (tested with music) around calling phone microphone is possible detection of false tones, so I am using double tones 11, 22, etc.