Hi is there a way for AGI record_file to save file if user hangup in the middle of recording or I must use record with k option?
Seems to work for me. Here’s the AGI debug to compare:
<PJSIP/anonymous-00000002>AGI Rx << record file /tmp/response wav #*1234567890 1800000 BEEP -- <PJSIP/anonymous-00000002> Playing 'beep.slin' (language 'en') > 0x7f67bc017a60 -- Strict RTP learning complete - Locking on source address 192.168.0.31:14430 <PJSIP/anonymous-00000002>AGI Tx >> 200 result=-1 (hangup) endpos=135200 -- <PJSIP/anonymous-00000002>AGI Script voice completed, returning 4
If this doesn’t help, please reply with more details:
- OS flavor and version
- Asterisk version
- The console log (with verbose > 2 and
agi set debug on)
Hi below is how am using record_file.
I know with dialplan Record Application it has k for option to Keep recorded file upon hangup but AGI record_file don’t seem to have such. So you are able to use record_file to save recorded file even if user hangup in the middle of recording?
Am using Asterisk 16 on Ubuntu 18.04
debug log below when user hangup in the middle of recording and it fail to save recorded file:
<SIP/john-00000004>AGI Rx << RECORD FILE /var/lib/asterisk/agi-bin/filename wav "" 45000 BEEP s=3 -- <SIP/john-00000004> Playing 'beep.gsm' (language 'en') [Jun 17 11:25:21] WARNING: db.c:332 ast_db_put: Couldn't execute statment: SQL logic error <SIP/john-00000004>AGI Tx >> 200 result=-1 (hangup) endpos=47680 -- <SIP/john-00000004>AGI Script /var/lib/asterisk/agi-bin/record_script.php completed, returning 4
I believe all AGI does is invoke the internal asterisk function record, so the ‘k’ is needed
There are no options in the AGI ‘record file’ command
[Syntax] record file <filename> <format> <escape_digits> <timeout> [<offset samples>] [<BEEP>] [<s=silence>]
I execute your ‘record file’ command and I get a WAV file that plays nearly to the point of hangup – meaning I say: “one two three four” and hangup as I say the ‘r’ in four and my recording contains “one two three.”
<SIP/john-00000004>AGI Rx << RECORD FILE /var/lib/asterisk/agi-bin/filename wav "" 45000 BEEP s=3 <SIP/poly-77a1-0000000c>AGI Rx << RECORD FILE /var/lib/asterisk/agi-bin/filename wav "" 45000 BEEP s=3
(BTW, recording to a ‘bin’ directory is valid, but seems weird. I wouldn’t clutter up a somewhat stable directory with somewhat temporary files.)
This is on:
Raspbian GNU/Linux 9
If i press any of the escape digit or wait for the silence/timeout period it will actually save the file but if i hangup in the middle of the call it does not save it.
After the record_file, the script needs to run the playback below with a thank you message. But i don’t think this is the cause
I’m outta time (and ideas), but here’s what I was testing with:
<?php require('phpagi-2.20/phpagi.php'); $agi = new AGI(); // record file then hangup // $agi->evaluate('record file /var/lib/asterisk/agi-bin/evaluate wav "" 45000 BEEP s=3'); // works // $agi->exec('record /var/lib/asterisk/agi-bin/exec.wav 3 45 k'); // didn't work // $agi->record_file('/var/lib/asterisk/agi-bin/record_file', 'wav', '', 45000, true, 3); // works
I suspect ‘exec’ probably works and I just did something wrong.
FWIW, I tend to use (my C library):
agi_evaluate("exec monitor wav...
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.