Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
星号python agi问题_Python_Asterisk_Agi - Fatal编程技术网

星号python agi问题

星号python agi问题,python,asterisk,agi,Python,Asterisk,Agi,我有基本的python agi代码,其中pyst lib为: extensions.conf [from-internal] exten => _.,1,answer() exten => _.,2,AGI(test.py) 我在/var/lib/asterisk/agi-bin中有test.py作为 #!/usr/bin/python import sys import os from agi import AGI def test_call(agi = None,text =

我有基本的python agi代码,其中pyst lib为:

extensions.conf

[from-internal]
exten => _.,1,answer()
exten => _.,2,AGI(test.py)
我在/var/lib/asterisk/agi-bin中有test.py作为

#!/usr/bin/python
import sys
import os
from agi import AGI
def test_call(agi = None,text = ""):
    agi.say_alpha(text, "#")
    agi.hangup()
if __name__ == "__main__":
    text = 'abcdefr'
    agi = AGI()
    test_call(agi,text)
我有一个文件agi.py,它是从pyst lib获取的

当我试着打电话给这个agi时,我发现了这个问题

Executing [123@from-internal:1] Answer("SIP/12345-00000016", "") in new stack
[Mar 14 00:01:29] NOTICE[2790]: res_rtp_asterisk.c:2358 ast_rtp_read: Unknown RTP codec 126 received from '169.254.38.82:20338'
    -- Executing [123@from-internal:2] AGI("SIP/12345-00000016", "test.py") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/test.py
 test.py: Failed to execute '/var/lib/asterisk/agi-bin/test.py': No such file or directory
    -- Auto fallthrough, channel 'SIP/12345-00000016' status is 'UNKNOWN'
    -- Executing [h@from-internal:1] Hangup("SIP/12345-00000016", "") in new stack
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/12345-00000016'
我看到我在/var/lib/asterisk/agi-bin中有这个文件,它具有777权限

请建议得到这个基本的脚本工作


提前感谢所有人

此类错误可能有两个原因:

  • 该位置没有文件/var/lib/asterisk/agi-bin/test.py,或者由于某种原因asterisk无法访问该文件-linux一般权限问题
  • 文件/var/lib/asterisk/agi-bin/test.py,但没有一些库(python给出相同的错误)。这个更像。尝试从asterisk用户处执行脚本手册,并查看其内容

  • 建议:使用FastAGI而不是AGI。

    我发现ubuntu服务器中缺少一些软件包。我已经将此脚本移动到elastix服务器,它可以正常工作。但是在ubuntu服务器中,我错过了哪些软件包?你确定文件在正确的位置吗?因为
    没有这样的文件或目录
    告诉您它找不到该文件。脚本是否可执行?嗨,谢谢你的回复。我已经通过安装python-devel包解决了我的问题。