简体   繁体   English

Asterisk 不会通过 AGI 记录对话

[英]Asterisk does not record the conversation via AGI

from asterisk.agi import *

agi = AGI()
agi.verbose("python agi started")
agi.record_file('/tmp/qwerty', timeout=10, format='gsm', escape_digits='0')
agi.hangup()

I'm trying to write a conversation to a file.我正在尝试将对话写入文件。 An empty file is created (of zero size, but no write occurs).创建一个空文件(大小为零,但不发生写入)。 Immediately after lifting the answer, the connection is broken.拿起答案后,连接立即中断。

My extension:我的扩展:

[test_forcall]
exten => 111111,1,Answer()
exten => 111111,2,AGI(asteriskAgi)

Agi debug:敏捷调试:

 -- SIP/200-0000000c answered
    -- Executing [111111@test_forcall:1] Answer("SIP/200-0000000c", "") in new stack
    -- Executing [111111@test_forcall:2] AGI("SIP/200-0000000c", "asteriskAgi") in new stack
    -- Launched AGI Script /usr/share/asterisk/agi-bin/asteriskAgi
<SIP/200-0000000c>AGI Tx >> agi_request: asteriskAgi
<SIP/200-0000000c>AGI Tx >> agi_channel: SIP/200-0000000c
<SIP/200-0000000c>AGI Tx >> agi_language: en
<SIP/200-0000000c>AGI Tx >> agi_type: SIP
<SIP/200-0000000c>AGI Tx >> agi_uniqueid: 1510050624.24
<SIP/200-0000000c>AGI Tx >> agi_version: 13.13.1~dfsg-4ubuntu1
<SIP/200-0000000c>AGI Tx >> agi_callerid: 200
<SIP/200-0000000c>AGI Tx >> agi_calleridname: RobotGalina
<SIP/200-0000000c>AGI Tx >> agi_callingpres: 0
<SIP/200-0000000c>AGI Tx >> agi_callingani2: 0
<SIP/200-0000000c>AGI Tx >> agi_callington: 0
<SIP/200-0000000c>AGI Tx >> agi_callingtns: 0
<SIP/200-0000000c>AGI Tx >> agi_dnid: unknown
<SIP/200-0000000c>AGI Tx >> agi_rdnis: unknown
<SIP/200-0000000c>AGI Tx >> agi_context: test_forcall
<SIP/200-0000000c>AGI Tx >> agi_extension: 111111
<SIP/200-0000000c>AGI Tx >> agi_priority: 2
<SIP/200-0000000c>AGI Tx >> agi_enhanced: 0.0
<SIP/200-0000000c>AGI Tx >> agi_accountcode: 
<SIP/200-0000000c>AGI Tx >> agi_threadid: 139782415746816
<SIP/200-0000000c>AGI Tx >> 
       > 0x7f21cc003790 -- Probation passed - setting RTP source address to 127.0.0.1:8000
<SIP/200-0000000c>AGI Tx >> 200 result=1
<SIP/200-0000000c>AGI Rx << RECORD FILE "111" "gsm" "#" 10
<SIP/200-0000000c>AGI Tx >> 200 result=0 (timeout) endpos=0

The realization on Golang behaves similarly Golang 上的实现行为类似

It worked!它奏效了! When I set the timeout to -1, but still I do not understand why it does not work when the timeout is > 1当我将超时设置为 -1 时,但我仍然不明白为什么当超时 > 1 时它不起作用

agi.record_file('/tmp/qwerty', timeout=-1, format='gsm', escape_digits='0'

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

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