AGI-BIN:ImportError:没有名为asterisk的模块

时间:2014-02-12 05:08:15

标签: python asterisk agi

我安装了星号版本1.4.44并使用Python进行agi脚本。我有上下文“9999”而不是我试图在执行时调用我得到的错误。 是否有任何依赖安装才能使其正常工作?

-- 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

编辑1:
星号1.4.44
CentOS 6.5(最终)
Python版本(2.4,2.6.6,2.7)

编辑2:

我已经“从星号导入agitb”中的上述问题文件这里代码snipes的文件 文件“/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')

在每个文件中我都有上面的内容

1 个答案:

答案 0 :(得分:2)

我的猜测是CGI使用系统python。不是具有Asterisk模块的python。

检查失败的CGI脚本是否没有

#!/usr/bin/python

如果可以,请更改此选项以使用正确的Python。

对于你尝试过的每个python:

from asterisk import agitb

然后你会发现哪一个有星号