Asterisk 15 api dtmf

HI all, is there anyone knows how to use asterisk rest api to receive dtmf?
Thanks a lot for helping!

ARI provides DTMF in the form of events[1][2].


Thanks for your reply.

However, I want to call those functions dynamically, I did that by using ari-py in flask framework, but it seems that the on_event function can’t be triggered.

Can you please give some tips on fixing that?
thanks a lot

def play_back():

def call(chan_id):

client = ari.connect('host', 'name', 'password')

channel = [c for c in client.channels.list()

        if == chan_id][0]

playback ="sound:pls-hold-while-try") 
playback.on_event("PlaybackFinished", lambda *args:call_back())


e.g. when I run this script separately, the call back function never triggered.

What exactly are you trying to do? For example you can’t arbitrarily play things on channels, they have to be in your ARI application.

I want to dynamically use the functions like promt/get dtmf apart from ARI applications.

So my idea was to start the call within the hard coded ARI application, then call the python ARI scripts separately. But I found that the event control is not working in the separated python script.

My issue is: is there any way to play the functions and listen to the events separatey.

I don’t have an example of a way to do it, but it ultimately depends on how you organize things. Only one thing can be connected to the websocket for a single application name. If you have multiple connected as different application names you can subscribe[1] as you’d like if the channel is not in the application. You can also execute actions on the channels provided they are in an ARI application.

Before going down that complicated route though I would highly suggest sticking to a single thing and becoming extremely familiar with how ARI over all works.


Great thank you jcolp,
Will try that

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.