Python agi script not returning anything to asterisk console

Hi, I’ve configured an extension in asterisk through which I’m calling a python agi script. The script seems to execute just fine but it is not returning anything on my asterisk cli. I’ve written a verbose message in my agi script which should be printed in asterisk cli but it is not. So please help me with that.

extensions.conf


[testing]
exten=> 100,1,Answer()
;same=> n,set(AGISIGHUP=no)
same=> n,AGI(/var/lib/asterisk/agi-bin/agi_test.py)
same=> n,Hangup()

agi_test.py


#!/usr/bin/python3.6
import sys
from asterisk.agi import *

agi = AGI()
agi.verbose("python agi started")

These are the asterisk console logs

Seems like your AGI script never sends anything to Asterisk.

I don’t know enough about your AGI library, as I had some problems that resultet in me writing my own instead…

It MIGHT be that the agi.verbose(), just prints output to the screen, and that does not always show up in the asterisk console, when using the remote console ( asterisk -r ). If you instead start Asterisk in the forground like asterisk -c, you will see any output from your python script, NOT sent to Asterisk.

Before starting asterisk this way, you will, of cause, need to shutdown the background version though whatever mean is appropriate in your setup. (Most likely systemctl stop asterisk will do the trick.)

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