简体   繁体   中英

Asterisk AGI file returns ImportError

I have inherited a cluster of CentOS Asterisk servers, one of which runs a check that I've been tasked with replicating on the other servers.

Part of this check involves an AGI that runs without problem on the first server - but on the other servers, spits out ImportError: No module named asterisk.agi

The line in the AGI that seems to cause the issue is from asterisk.agi import *

The only differences I can see between the working server and the non-working is the Python version. Typing python in the working server returns

Python 2.4.3 (#1, Jan  9 2013, 06:49:54)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2

..however, in the non-working servers returns

Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

I've googled and can't find where I'm going wrong. I'm wary of breaking other dependencies, as there are a number of AGI scripts running on these servers.

Does anyone have any pointers or advice?

You are missing python modules. Install them with distribution package manager (if available) or use pip install <module name> . You have to check which module is used by your script. Check lib directories with python modules.

https://docs.python.org/2.7/installing/

您需要将Python版本从Python 2.6.6降级到Python 2.4.3。

I solved this.

I needed to install Pyst which included the relevant libraries (asterisk.agi, etc).

Simples! Thanks for all the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM