下面是我的 python agi 脚本。我正在尝试将值从拨号计划传递到 agi 脚本并尝试通过脚本打印该值。一切正常,但值没有传递给脚本。请让我知道它是否有任何问题。
#!/usr/bin/python
from asterisk.agi import *
agi = AGI()
agi.verbose("python agi started")
phone_exten = agi.get_variable('PHONE_EXTEN')
agi.verbose("phone number",phone_exten)
agi.set_variable('EXT_CALLERID', '1')
代购代码:
[TEST]
exten => _X.,1,Goto(s,1)
exten => s,1,set(PHONE_EXTEN=0904)
exten => s,2,AGI(first.py,${PHONE_EXTEN})
exten => s,3,NoOp(${EXT_CALLERID})
exten => s,4,Hangup()
输出
Connected to Asterisk 14.6.0 currently running on ip-172-31-18-90 (pid = 2539)
Core debug is still 10.
[Feb 20 12:54:39] == Using SIP RTP CoS mark 5
[Feb 20 12:54:39] -- Executing [0904@TEST:1] Goto("SIP/0904-00000004", "s,1") in new stack
[Feb 20 12:54:39] -- Goto (TEST,s,1)
[Feb 20 12:54:39] -- Executing [s@TEST:1] Set("SIP/0904-00000004", "PHONE_EXTEN=0904") in new stack
[Feb 20 12:54:39] -- Executing [s@TEST:2] AGI("SIP/0904-00000004", "first.py,0904") in new stack
[Feb 20 12:54:39] -- Launched AGI Script /var/lib/asterisk/agi-bin/first.py
[Feb 20 12:54:39] first.py,0904: python agi started
[Feb 20 12:54:39] -- <SIP/0904-00000004>AGI Script first.py completed, returning 0
[Feb 20 12:54:39] -- Executing [s@TEST:3] NoOp("SIP/0904-00000004", "1") in new stack
[Feb 20 12:54:39] -- Executing [s@TEST:4] Hangup("SIP/0904-00000004", "") in new stack
[Feb 20 12:54:39] == Spawn extension (TEST, s, 4) exited non-zero on 'SIP/0904-00000004'