I'm currently working on a project which is based on RPi and Asterisk.

What I Want

In my project, I need to get incoming call details like caller ID into python and perform some functions connected to database.

What I Have Tried

I've installed Python and Asterisk and configured both in my RPi. But I don't know how to read incoming caller ID from python since there is no gateway of communication between asterisk and python.


Can someone tell me a way of accomplish my task? I know there is a gateway call AGI to do that. But I cannot find how can I get that configured with Raspberry Pi. Please help.

1 Answer 1


I found the solution to my own problem and thought to share it. However it's better to use Python package to make the communication between Asterisk and Python. Since we have configured both in our Raspberry Pi, all I had to do was use Python Package called pyst.

To install that package, just run this code in RPi terminal.

sudo apt-get install python-pyst

Then it will install. But will ask your permission in few times to complete the installation. After that you are good to go. As an example, You can go to the Python IDE and start writing your script starting,

import asterisk
  • 1
    Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Jan 16, 2020 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.