How to get DTMF input in Python script?

Hello Everyone.

I use Python to make an outbound call using Asterisk.

And I was successful the first outbound call, but during that call interaction with my customer, I need to get DTMF input from the customer.

Asterisk Diaplan can get that DTMF input value using Read() application, but I don’t have any idea how to carry this DTMF value into Python script.

I have been trying to find a solution but haven’t found any solution.

Please help me.

Thanks in advance.

Asterisk provides many interfaces for doing things, you’d need to specify which one you’re using. For example, are you using AMI? If so you could use UserEvent in the dialplan to raise a custom event that your application could use.

Yes, I’m using AMI.