gpt4 book ai didi

python - AGI-BIN :ImportError: No module named asterisk

转载 作者:太空宇宙 更新时间:2023-11-04 03:50:06 24 4
gpt4 key购买 nike

我已经安装了 asterisk 版本 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 :
Asterisk 1.4.44
CentOS 6.5(最终版)
Python版本(2.4,2.6.6,2.7)

编辑 2:

我已经在上面的问题文件中“从 Asterisk 导入 agitb”,这里是文件的代码片段文件“/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')

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

最佳答案

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

检查失败的CGI脚本没有

#!/usr/bin/python

如果是,请将其更改为使用正确的 Python。

对于你尝试过的每条 python :

from asterisk import agitb

然后你会发现哪个有 Asterisk

关于python - AGI-BIN :ImportError: No module named asterisk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21719171/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com