Hi all,
asterisk verison: Asterisk 20.9.1
Problems with recording audio using mixMonitor: the recorded files are the same size, and passing two parameters will cause t to have no sound, or r to have no sound
The execution plan is as follows:
s,n,MixMonitor(abcd.wav,r(abcd_in.wav)t(abcd_out.wav))
Three files of the same size, there is no implementation of recording the received and played out results, what is wrong with my configuration
Or the following configuration is also problematic
s,n,MixMonitor(abcd.wav,r(abcd_in.wav))
s,n,MixMonitor(abcd.wav,t(abcd_out.wav))
That is (generally) okay for wav files because they grow in size linearly with time.
Specifically, it holds true for MixMonitor() because all the “meta” stuff is the same - same encoding, same metadata, etc. The only thing that is different is the content. But for wav files, even recording silence is recording something. So, a file 10 seconds long full of “nothing” is the same size as 10 seconds of conversation.
Did you analyze all the way through to the end of file using something like Audacity ? Were you able to confirm there was actually somebody talking/singing/etc. on the call ?
But the abcd.wav file does have sound ? So something like this works:
same => n,MixMonitor(abcd.wav,r(abcd_in.wav)t(abcd_out.wav))
The desired result should be:
1: abcd.wav result should record the voices of both parties to the call;
2: abcd_in.wav results should be the voice of the called party (including the silence duration);
3: abcd_out.wav results should be only the sound emitted by the call including the silence duration);
But it didn’t turn out the way I wanted
I am now using same => n,MixMonitor(,r(${aaa}.wav))
can record only the audio of the other party,
exten = s,n,MixMonitor(abcd.wav)
Able to record both voices
Agreed. Should have added to the general answer: wav files will be the same size over a given length of time as long as audio is being received and written to the file, even if the sounds are so quiet that they might sound silent.
And perhaps a better wav size-to-length analogy would be that of a magnetic cassette tape recorder - one hour of ambient nearly-silent nothingness would be the same physical length of tape as one hour of a rock and roll concert.
But for MixMonitor specifically, things can be a little different, depending on the options used, for example the ‘n’ option:
n - When the r or t option is used, MixMonitor will insert silence into the specified files to maintain synchronization between them. Use this option to disable that behavior.
There’s been some back-and-forth on this option – it started as ‘S’ in 2019 with Asterisk 18 and was not on by default:
But then it changed to active silence injection when ‘S’ was deprecated in favor of ‘n’ a year or so later:
Anyhow, that probably doesn’t help OP much. Something does seem buggy, though, as this should work (but didn’t test it yet):
OP you might want to try an earlier version of Asterisk 20, post some (privacy scrubbed) logs, trace the call and analyze packets in Wireshark, check the wav files in Audacity, etc.
My guess would be that it only back fills missing frames when the next real frame arrives, a I think it relies on the frame arrival to schedule processing.