Question

I have installed asterisk version 1.4.44 and using Python for agi scripts. I have context "9999" than I trying to call while executing this I am getting below errors. is there any dependency to be installed to get this working?

-- Launched AGI Script /var/lib/asterisk/agi-bin/incident/SetCommonVariables.py
Traceback (most recent call last):
File "/var/lib/asterisk/agi-bin/incident/SetCommonVariables.py", line 5, in <module>
from asterisk import agitb
ImportError: No module named asterisk
-- AGI Script incident/SetCommonVariables.py completed, returning 0
-- Executing [s@IncidentInitiation:4] Goto("SIP/9999-00000000", "CheckAuthorization|1") in new stack
-- Goto (IncidentInitiation,CheckAuthorization,1)
-- Executing [CheckAuthorization@IncidentInitiation:1] AGI("SIP/9999-00000000", "incident/CheckAuthorization.py") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/incident/CheckAuthorization.py
Traceback (most recent call last):
File "/var/lib/asterisk/agi-bin/incident/CheckAuthorization.py", line 7, in <module>
from asterisk import agitb

Edit 1 :
Asterisk 1.4.44
CentOS 6.5(Final)
Python version (2.4,2.6.6,2.7)

Edit 2 :

i have already "from asterisk import agitb" in above issues file here code snipes of file File "/var/lib/asterisk/agi-bin/incident/SetCommonVariables.py

#!/usr/bin/python
from IncidentConstants import *
import sys            # system stuff

from asterisk import agitb
agitb.enable(display = False, logdir = '/var/log/asterisk')

# Global variables
from asterisk.agi import *  # our agi stuff
agi = AGI()
agitb.enable(agi, False, '/var/log/asterisk')

in every file i have above content

Was it helpful?

Solution

My guess is that CGI uses the system python. Not the python that has the Asterisk module.

Check that the failing CGI script does not have

#!/usr/bin/python

And if does, change this to use the proper Python.

For each python you have try doing:

from asterisk import agitb

Then you will find which one has asterisk

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top