简体   繁体   English

Asterisk 没有使用 AGI 执行 python 文件

[英]Asterisk is not executing python file using AGI

Log of asterisk after call is as follows:调用后的星号日志如下:

<SIP/AC_221-00000007>AGI Tx >> agi_channel: SIP/AC_221-00000007
<SIP/AC_221-00000007>AGI Tx >> agi_language: en
<SIP/AC_221-00000007>AGI Tx >> agi_type: SIP
<SIP/AC_221-00000007>AGI Tx >> agi_uniqueid: 1607606631.7
<SIP/AC_221-00000007>AGI Tx >> agi_version: 11.25.1
<SIP/AC_221-00000007>AGI Tx >> agi_callerid: 8097119191
<SIP/AC_221-00000007>AGI Tx >> agi_calleridname: unknown
<SIP/AC_221-00000007>AGI Tx >> agi_callingpres: 0
<SIP/AC_221-00000007>AGI Tx >> agi_callingani2: 0
<SIP/AC_221-00000007>AGI Tx >> agi_callington: 0
<SIP/AC_221-00000007>AGI Tx >> agi_callingtns: 0
<SIP/AC_221-00000007>AGI Tx >> agi_dnid: 2804
<SIP/AC_221-00000007>AGI Tx >> agi_rdnis: unknown
<SIP/AC_221-00000007>AGI Tx >> agi_context: OUTBOUND
<SIP/AC_221-00000007>AGI Tx >> agi_extension: 2804
<SIP/AC_221-00000007>AGI Tx >> agi_priority: 2
<SIP/AC_221-00000007>AGI Tx >> agi_enhanced: 1.0
<SIP/AC_221-00000007>AGI Tx >> agi_accountcode: 
<SIP/AC_221-00000007>AGI Tx >> agi_threadid: 140019575056128
<SIP/AC_221-00000007>AGI Tx >>  

I can also share the Dial plan and file which we are executing我还可以分享我们正在执行的拨号计划和文件

exten => 2804,1,Answer()
exten => 2804,2,EAGI(/var/lib/asterisk/agi-bin/test.py)

Also I am sharing the code in my python file我也在我的 python 文件中共享代码

#!/usr/bin/env python3
from asterisk.agi import *

agi = AGI()
agi.say_number("12345")
agi.verbose("python agi started ahead")

print("Hey")

Library installed Pyst2 for asterisk库为星号安装了 Pyst2

First of all you are dooing EAGI, which is NOT AGI.首先,你在做 EAGI,这不是 AGI。

Then you need probably check by tag other issues with AGI/python, for example this can be helpfull.然后您可能需要通过标记检查 AGI/python 的其他问题,例如这可能会有所帮助。 How to use Asterisk AGI with python3? 如何在 python3 中使用 Asterisk AGI? (more at https://stackoverflow.com/questions/tagged/agi+python ) (更多在https://stackoverflow.com/questions/tagged/agi+python

AGI script in most cases run in very special environment under asterisk user, so you need double check you have library path.在大多数情况下,AGI 脚本在星号用户下非常特殊的环境中运行,因此您需要仔细检查您是否有库路径。

For check for errors, stop asterisk, after that run it in console via要检查错误,请停止星号,然后通过控制台在控制台中运行它

asterisk -vvvgc
agi set debug on

Now if you call it will show STDERROR from your script in console.现在,如果您调用它,它将在控制台中从您的脚本中显示 STDERROR。 By default it show on /dev/tty9默认情况下它显示在 /dev/tty9

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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