Python-Asterisk ARI Call Control

Job ID: 40346015

Budget: ₹12,500 – ₹37,500 INR

My current Python application already takes care of business logic, but I now need it to talk directly with Asterisk through the ARI websocket so it can steer the live call flow itself. The immediate requirements are simple and focused:

I want the script to:
• Answer an outbound or bridged call as soon as it arrives in the ARI app
• Play a short audio prompt (a .wav I will supply)
• Hang up cleanly when the dialogue is finished or when I signal it in code

Event-wise, the code must listen for any outgoing-call events I raise inside Asterisk, acknowledge them, and then run the flow above.

Please keep the implementation in plain Python 3.10 and feel free to rely on either ari-py, Starlette websockets, or a lightweight alternative you trust, as long as the final package installs with pip and the core logic is clear.

Deliverables
• A self-contained Python module (or small package) that exposes start_call() / end_call() functions and internally connects to ARI
• A short README explaining environment variables (host, port, ARI key/secret) and how to test with a basic Asterisk dialplan entry
• A demo CLI or simple Flask endpoint that proves the flow end-to-end

Acceptance criteria
• When I originate a call in Asterisk using “ARI_APP”, the Python side answers, plays the prompt, and hangs up without warnings in the console
• No blocking; the websocket keeps the event loop responsive for multiple simultaneous calls
• Code passes flake8 and runs on Linux

Hand the project over via Git or a zip—whichever is easiest. Once I drop the files into my container and tweak the credentials, the call flow should work exactly as described.