Reputation: 1
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
Upvotes: 0
Views: 1120
Reputation: 1
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
agi.record_file('/tmp/qwerty', timeout=-1, format='gsm', escape_digits='0'
Upvotes: 0