RE: [Asterisk-Users] help - recording both sides of a conversation
Hi John.. Thanks for the help..I was able to figure it out,, :-) I change the script into this form and it now works changing ( into , exten = s,3,System,/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav Thanks again.. Regards Joel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of John Baker Sent: Tuesday, January 20, 2004 8:44 PM To: [EMAIL PROTECTED] Subject: Re: [Asterisk-Users] help - recording both sides of a conversation Joelson - No application 'System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} Ok, where is it? Or, are you missing a ')' maybe at the end of your System call? John Baker - Original Message - From: Joelson S. Apon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 12:55 PM Subject: RE: [Asterisk-Users] help - recording both sides of a conversation Hello Sirs.. I'm setting up a call-recording with my asterisk here and I do follow program which was post in this mailing list last Jan. 4 (program is also shown below), and I'm very much thankful for that.. However, I do have some errors, here is my output..Hope that someone could lighten me up for this..Thank you very much for the help.. Regards Joel *CLI -- Starting simple switch on 'Zap/49-1' -- Executing Answer(Zap/49-1, ) in new stack -- Executing Macro(Zap/49-1, record-enable) in new stack -- Executing AGI(Zap/49-1, set-timestamp.agi) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/set-timestamp.agi -- AGI Script set-timestamp.agi completed, returning 0 -- Executing Dial(Zap/49-1, Zap/51|15) in new stack -- Called 51 -- Zap/51-1 is ringing -- Zap/51-1 answered Zap/49-1 -- Attempting native bridge of Zap/49-1 and Zap/51-1 -- Hungup 'Zap/51-1' == Spawn extension (test3, 2103, 3) exited non-zero on 'Zap/49-1' -- Executing Macro(Zap/49-1, record-cleanup) in new stack -- Executing SetVar(Zap/49-1, MONITORDIR=/var/spool/asterisk/conversations/) in new stack -- Executing GotoIf(Zap/49-1, = ?6:3) in new stack -- Goto (macro-record-cleanup,s,3) Jan 20 13:43:37 WARNING[1256444864]: pbx.c:1173 pbx_extension_helper: No application 'System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav' for extension (macro-record-cleanup, s, 3) == Spawn extension (macro-record-cleanup, s, 3) exited non-zero on 'Zap/49-1' in macro 'record-cleanup' == Spawn extension (test3, h, 1) exited non-zero on 'Zap/49-1' -- Hungup 'Zap/49-1' -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of zoa Sent: Tuesday, January 06, 2004 1:05 PM To: [EMAIL PROTECTED] Subject: Re: [Asterisk-Users] help - recording both sides of a conversation You also don't need such a complicated perl script, just muxing them without cutting them is enough. (Timing was fixed) zoa. At 14:41 4/01/2004 -0600, you wrote: you nolonger need set-timestamp.agi as we have ${TIMESTAMP} in that format by default now. bkw On Sun, 4 Jan 2004, John Baker wrote: Iain - First off, all of this is heavily borrowed from others. For those who see their code embedded here, I thank you and give you full credit. Here's how I do it. It's a bit convoluted, but I didn't want to record everything. So, if a call comes in and I want to record it, I send it here: [ext-surrept] exten = _57XXX,1,Answer exten = _57XXX,2,Macro(record-enable) exten = _57XXX,3,BackGround(for-quality-purposes) exten = _57XXX,4,BackGround(this-call-may-be) exten = _57XXX,5,BackGround(recorded) exten = _57XXX,6,Dial(SIP/${EXTEN:1},120,tm) exten = _57XXX,7,Macro(rg-inbound,10,tr) exten = _57XXX,8,Goto(aa-nooneavail,s,1) By transferring a call to 5 + the extension I'm at, I enable the call recording, let the caller know he might be recorded and then send the call right back to myself. Here's the Macro: [macro-record-enable] exten = s,1,AGI(set-timestamp.agi) exten = s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten = s,3,Monitor(wav,${CALLFILENAME}) It starts the recording and calls set-timestamp.agi Here's the agi file: #!/bin/sh longtime=`date +%Y%m%d-%H%M%S` echo SET VARIABLE timestamp $longtime It sets a timestamp, which if you scour the asterisk list, you'll see that it is necessary for mixing the in and out audio later. I have one hangup extension set for my internal phones; it looks like this: exten = h,1,Macro(record-cleanup) And the record-cleanup macro looks like this: [macro-record-cleanup] exten = s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten = s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten = s,3,System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav
RE: [Asterisk-Users] help - recording both sides of a conversation
Hi Jimmy.. I tried also implementing your program and it works on my box. Thanks a lot for your help.. Regards Joel -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jimmy Riley Sent: Tuesday, January 20, 2004 2:20 PM To: '[EMAIL PROTECTED]' Subject: RE: [Asterisk-Users] help - recording both sides of a conversation This is what I'm doing it gets you both sides of the phone call...small size...and playable on windows through a share. My notes: On redhat 9 I have to run the following command for asterisk to start LD_ASSUME_KERNEL=2.4.1 asterisk -gc [macro-record-on] exten = s,1,SetVar(CALLFILENAME=${TIMESTAMP}-${ARG2}-${ARG1}) exten = s,2,Monitor(wav,${CALLFILENAME}) ;exten = s,3,ResetCDR(w) [macro-record-cleanup] exten = s,1,GotoIf($[${CALLFILENAME} = ${FOO}]?11:2) exten = s,2,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten = s,3,System(sox ${MONITORDIR}/${CALLFILENAME}-in.wav ${MONITORDIR}/${CALLFILENAME}-in-rev.wav reverse) exten = s,4,System(sox ${MONITORDIR}/${CALLFILENAME}-out.wav ${MONITORDIR}/${CALLFILENAME}-out-rev.wav reverse) exten = s,5,System(/bin/rm ${MONITORDIR}/${CALLFILENAME}-in.wav ${MONITORDIR}/${CALLFILENAME}-out.wav) exten = s,6,System(soxmix ${MONITORDIR}/${CALLFILENAME}-in-rev.wav ${MONITORDIR}/${CALLFILENAME}-out-rev.wav ${MONITORDIR}/${CALLFILENAME}-rev.wav) exten = s,7,System(/bin/rm ${MONITORDIR}/${CALLFILENAME}-in-rev.wav ${MONITORDIR}/${CALLFILENAME}-out-rev.wav) exten = s,8,System(sox ${MONITORDIR}/${CALLFILENAME}-rev.wav ${MONITORDIR}/${CALLFILENAME}.wav reverse) exten = s,9,System(/bin/rm ${MONITORDIR}/${CALLFILENAME}-rev.wav) exten = s,10,System(sox ${MONITORDIR}/${CALLFILENAME}.wav -g ${MONITORDIR}/${CALLFILENAME}-done.wav) exten = s,11,System(/bin/rm ${MONITORDIR}/${CALLFILENAME}.wav) exten = s,12,NoOp Jimmy Riley Network Administrator VeriCore 985-626-1701 X1103 -Original Message- From: Joelson S. Apon [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 12:55 PM To: [EMAIL PROTECTED] Subject: RE: [Asterisk-Users] help - recording both sides of a conversation Hello Sirs.. I'm setting up a call-recording with my asterisk here and I do follow program which was post in this mailing list last Jan. 4 (program is also shown below), and I'm very much thankful for that.. However, I do have some errors, here is my output..Hope that someone could lighten me up for this..Thank you very much for the help.. Regards Joel *CLI -- Starting simple switch on 'Zap/49-1' -- Executing Answer(Zap/49-1, ) in new stack -- Executing Macro(Zap/49-1, record-enable) in new stack -- Executing AGI(Zap/49-1, set-timestamp.agi) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/set-timestamp.agi -- AGI Script set-timestamp.agi completed, returning 0 -- Executing Dial(Zap/49-1, Zap/51|15) in new stack -- Called 51 -- Zap/51-1 is ringing -- Zap/51-1 answered Zap/49-1 -- Attempting native bridge of Zap/49-1 and Zap/51-1 -- Hungup 'Zap/51-1' == Spawn extension (test3, 2103, 3) exited non-zero on 'Zap/49-1' -- Executing Macro(Zap/49-1, record-cleanup) in new stack -- Executing SetVar(Zap/49-1, MONITORDIR=/var/spool/asterisk/conversations/) in new stack -- Executing GotoIf(Zap/49-1, = ?6:3) in new stack -- Goto (macro-record-cleanup,s,3) Jan 20 13:43:37 WARNING[1256444864]: pbx.c:1173 pbx_extension_helper: No application 'System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav' for extension (macro-record-cleanup, s, 3) == Spawn extension (macro-record-cleanup, s, 3) exited non-zero on 'Zap/49-1' in macro 'record-cleanup' == Spawn extension (test3, h, 1) exited non-zero on 'Zap/49-1' -- Hungup 'Zap/49-1' -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of zoa Sent: Tuesday, January 06, 2004 1:05 PM To: [EMAIL PROTECTED] Subject: Re: [Asterisk-Users] help - recording both sides of a conversation You also don't need such a complicated perl script, just muxing them without cutting them is enough. (Timing was fixed) zoa. At 14:41 4/01/2004 -0600, you wrote: you nolonger need set-timestamp.agi as we have ${TIMESTAMP} in that format by default now. bkw On Sun, 4 Jan 2004, John Baker wrote: Iain - First off, all of this is heavily borrowed from others. For those who see their code embedded here, I thank you and give you full credit. Here's how I do it. It's a bit convoluted, but I didn't want to record everything. So, if a call comes in and I want to record it, I send it here: [ext-surrept] exten = _57XXX,1,Answer exten = _57XXX,2,Macro(record-enable) exten = _57XXX,3,BackGround(for-quality-purposes) exten = _57XXX,4,BackGround(this-call-may-be) exten = _57XXX,5,BackGround(recorded) exten = _57XXX,6,Dial(SIP/${EXTEN:1},120,tm) exten = _57XXX,7,Macro(rg-inbound,10,tr) exten = _57XXX,8,Goto(aa-nooneavail,s,1) By transferring a call to 5
RE: [Asterisk-Users] help - recording both sides of a conversation
Hello Sirs.. I'm setting up a call-recording with my asterisk here and I do follow program which was post in this mailing list last Jan. 4 (program is also shown below), and I'm very much thankful for that.. However, I do have some errors, here is my output..Hope that someone could lighten me up for this..Thank you very much for the help.. Regards Joel *CLI -- Starting simple switch on 'Zap/49-1' -- Executing Answer(Zap/49-1, ) in new stack -- Executing Macro(Zap/49-1, record-enable) in new stack -- Executing AGI(Zap/49-1, set-timestamp.agi) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/set-timestamp.agi -- AGI Script set-timestamp.agi completed, returning 0 -- Executing Dial(Zap/49-1, Zap/51|15) in new stack -- Called 51 -- Zap/51-1 is ringing -- Zap/51-1 answered Zap/49-1 -- Attempting native bridge of Zap/49-1 and Zap/51-1 -- Hungup 'Zap/51-1' == Spawn extension (test3, 2103, 3) exited non-zero on 'Zap/49-1' -- Executing Macro(Zap/49-1, record-cleanup) in new stack -- Executing SetVar(Zap/49-1, MONITORDIR=/var/spool/asterisk/conversations/) in new stack -- Executing GotoIf(Zap/49-1, = ?6:3) in new stack -- Goto (macro-record-cleanup,s,3) Jan 20 13:43:37 WARNING[1256444864]: pbx.c:1173 pbx_extension_helper: No application 'System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav' for extension (macro-record-cleanup, s, 3) == Spawn extension (macro-record-cleanup, s, 3) exited non-zero on 'Zap/49-1' in macro 'record-cleanup' == Spawn extension (test3, h, 1) exited non-zero on 'Zap/49-1' -- Hungup 'Zap/49-1' -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of zoa Sent: Tuesday, January 06, 2004 1:05 PM To: [EMAIL PROTECTED] Subject: Re: [Asterisk-Users] help - recording both sides of a conversation You also don't need such a complicated perl script, just muxing them without cutting them is enough. (Timing was fixed) zoa. At 14:41 4/01/2004 -0600, you wrote: you nolonger need set-timestamp.agi as we have ${TIMESTAMP} in that format by default now. bkw On Sun, 4 Jan 2004, John Baker wrote: Iain - First off, all of this is heavily borrowed from others. For those who see their code embedded here, I thank you and give you full credit. Here's how I do it. It's a bit convoluted, but I didn't want to record everything. So, if a call comes in and I want to record it, I send it here: [ext-surrept] exten = _57XXX,1,Answer exten = _57XXX,2,Macro(record-enable) exten = _57XXX,3,BackGround(for-quality-purposes) exten = _57XXX,4,BackGround(this-call-may-be) exten = _57XXX,5,BackGround(recorded) exten = _57XXX,6,Dial(SIP/${EXTEN:1},120,tm) exten = _57XXX,7,Macro(rg-inbound,10,tr) exten = _57XXX,8,Goto(aa-nooneavail,s,1) By transferring a call to 5 + the extension I'm at, I enable the call recording, let the caller know he might be recorded and then send the call right back to myself. Here's the Macro: [macro-record-enable] exten = s,1,AGI(set-timestamp.agi) exten = s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten = s,3,Monitor(wav,${CALLFILENAME}) It starts the recording and calls set-timestamp.agi Here's the agi file: #!/bin/sh longtime=`date +%Y%m%d-%H%M%S` echo SET VARIABLE timestamp $longtime It sets a timestamp, which if you scour the asterisk list, you'll see that it is necessary for mixing the in and out audio later. I have one hangup extension set for my internal phones; it looks like this: exten = h,1,Macro(record-cleanup) And the record-cleanup macro looks like this: [macro-record-cleanup] exten = s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten = s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten = s,3,System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) exten = s,6,NoOp Don't forget to make the /var/spool/asterisk/monitor directory! Finally, mix_monitor_files.pl does the mixing job and combines the in and out files: #!/usr/bin/perl $monitordir = shift; $infile = shift; $outfile = shift; $finishfile = shift; chdir($monitordir); $infile_output = `sox $infile -e stat 21`; $outfile_output = `sox $outfile -e stat 21`; $infile_output =~ /Samples read:\s+(\d+)/; $infile_samples = $1; $outfile_output =~ /Samples read:\s+(\d+)/; $outfile_samples = $1; if($outfile_samples $infile_samples) { $diff_samples = $outfile_samples - $infile_samples; system(sox -v 3 $outfile temp${outfile} trim ${diff_samples}s); system(wmix $infile temp${outfile} $finishfile); system(rm -f $infile temp${outfile} $outfile); } elsif($infile_samples $outfile_samples) { $diff_samples = $infile_samples - $outfile_samples; system(sox -v 3 $infile
Re: [Asterisk-Users] help - recording both sides of a conversation
Joelson - No application 'System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} Ok, where is it? Or, are you missing a ')' maybe at the end of your System call? John Baker - Original Message - From: Joelson S. Apon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 12:55 PM Subject: RE: [Asterisk-Users] help - recording both sides of a conversation Hello Sirs.. I'm setting up a call-recording with my asterisk here and I do follow program which was post in this mailing list last Jan. 4 (program is also shown below), and I'm very much thankful for that.. However, I do have some errors, here is my output..Hope that someone could lighten me up for this..Thank you very much for the help.. Regards Joel *CLI -- Starting simple switch on 'Zap/49-1' -- Executing Answer(Zap/49-1, ) in new stack -- Executing Macro(Zap/49-1, record-enable) in new stack -- Executing AGI(Zap/49-1, set-timestamp.agi) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/set-timestamp.agi -- AGI Script set-timestamp.agi completed, returning 0 -- Executing Dial(Zap/49-1, Zap/51|15) in new stack -- Called 51 -- Zap/51-1 is ringing -- Zap/51-1 answered Zap/49-1 -- Attempting native bridge of Zap/49-1 and Zap/51-1 -- Hungup 'Zap/51-1' == Spawn extension (test3, 2103, 3) exited non-zero on 'Zap/49-1' -- Executing Macro(Zap/49-1, record-cleanup) in new stack -- Executing SetVar(Zap/49-1, MONITORDIR=/var/spool/asterisk/conversations/) in new stack -- Executing GotoIf(Zap/49-1, = ?6:3) in new stack -- Goto (macro-record-cleanup,s,3) Jan 20 13:43:37 WARNING[1256444864]: pbx.c:1173 pbx_extension_helper: No application 'System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav' for extension (macro-record-cleanup, s, 3) == Spawn extension (macro-record-cleanup, s, 3) exited non-zero on 'Zap/49-1' in macro 'record-cleanup' == Spawn extension (test3, h, 1) exited non-zero on 'Zap/49-1' -- Hungup 'Zap/49-1' -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of zoa Sent: Tuesday, January 06, 2004 1:05 PM To: [EMAIL PROTECTED] Subject: Re: [Asterisk-Users] help - recording both sides of a conversation You also don't need such a complicated perl script, just muxing them without cutting them is enough. (Timing was fixed) zoa. At 14:41 4/01/2004 -0600, you wrote: you nolonger need set-timestamp.agi as we have ${TIMESTAMP} in that format by default now. bkw On Sun, 4 Jan 2004, John Baker wrote: Iain - First off, all of this is heavily borrowed from others. For those who see their code embedded here, I thank you and give you full credit. Here's how I do it. It's a bit convoluted, but I didn't want to record everything. So, if a call comes in and I want to record it, I send it here: [ext-surrept] exten = _57XXX,1,Answer exten = _57XXX,2,Macro(record-enable) exten = _57XXX,3,BackGround(for-quality-purposes) exten = _57XXX,4,BackGround(this-call-may-be) exten = _57XXX,5,BackGround(recorded) exten = _57XXX,6,Dial(SIP/${EXTEN:1},120,tm) exten = _57XXX,7,Macro(rg-inbound,10,tr) exten = _57XXX,8,Goto(aa-nooneavail,s,1) By transferring a call to 5 + the extension I'm at, I enable the call recording, let the caller know he might be recorded and then send the call right back to myself. Here's the Macro: [macro-record-enable] exten = s,1,AGI(set-timestamp.agi) exten = s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten = s,3,Monitor(wav,${CALLFILENAME}) It starts the recording and calls set-timestamp.agi Here's the agi file: #!/bin/sh longtime=`date +%Y%m%d-%H%M%S` echo SET VARIABLE timestamp $longtime It sets a timestamp, which if you scour the asterisk list, you'll see that it is necessary for mixing the in and out audio later. I have one hangup extension set for my internal phones; it looks like this: exten = h,1,Macro(record-cleanup) And the record-cleanup macro looks like this: [macro-record-cleanup] exten = s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten = s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten = s,3,System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) exten = s,6,NoOp Don't forget to make the /var/spool/asterisk/monitor directory! Finally, mix_monitor_files.pl does the mixing job and combines the in and out files: #!/usr/bin/perl $monitordir = shift; $infile = shift; $outfile = shift; $finishfile = shift; chdir($monitordir); $infile_output = `sox $infile -e stat 21`; $outfile_output = `sox $outfile -e stat 21`; $infile_output =~ /Samples read:\s+(\d+)/; $infile_samples = $1
Re: [Asterisk-Users] help - recording both sides of a conversation
You also don't need such a complicated perl script, just muxing them without cutting them is enough. (Timing was fixed) zoa. At 14:41 4/01/2004 -0600, you wrote: you nolonger need set-timestamp.agi as we have ${TIMESTAMP} in that format by default now. bkw On Sun, 4 Jan 2004, John Baker wrote: Iain - First off, all of this is heavily borrowed from others. For those who see their code embedded here, I thank you and give you full credit. Here's how I do it. It's a bit convoluted, but I didn't want to record everything. So, if a call comes in and I want to record it, I send it here: [ext-surrept] exten = _57XXX,1,Answer exten = _57XXX,2,Macro(record-enable) exten = _57XXX,3,BackGround(for-quality-purposes) exten = _57XXX,4,BackGround(this-call-may-be) exten = _57XXX,5,BackGround(recorded) exten = _57XXX,6,Dial(SIP/${EXTEN:1},120,tm) exten = _57XXX,7,Macro(rg-inbound,10,tr) exten = _57XXX,8,Goto(aa-nooneavail,s,1) By transferring a call to 5 + the extension I'm at, I enable the call recording, let the caller know he might be recorded and then send the call right back to myself. Here's the Macro: [macro-record-enable] exten = s,1,AGI(set-timestamp.agi) exten = s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten = s,3,Monitor(wav,${CALLFILENAME}) It starts the recording and calls set-timestamp.agi Here's the agi file: #!/bin/sh longtime=`date +%Y%m%d-%H%M%S` echo SET VARIABLE timestamp $longtime It sets a timestamp, which if you scour the asterisk list, you'll see that it is necessary for mixing the in and out audio later. I have one hangup extension set for my internal phones; it looks like this: exten = h,1,Macro(record-cleanup) And the record-cleanup macro looks like this: [macro-record-cleanup] exten = s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten = s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten = s,3,System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) exten = s,6,NoOp Don't forget to make the /var/spool/asterisk/monitor directory! Finally, mix_monitor_files.pl does the mixing job and combines the in and out files: #!/usr/bin/perl $monitordir = shift; $infile = shift; $outfile = shift; $finishfile = shift; chdir($monitordir); $infile_output = `sox $infile -e stat 21`; $outfile_output = `sox $outfile -e stat 21`; $infile_output =~ /Samples read:\s+(\d+)/; $infile_samples = $1; $outfile_output =~ /Samples read:\s+(\d+)/; $outfile_samples = $1; if($outfile_samples $infile_samples) { $diff_samples = $outfile_samples - $infile_samples; system(sox -v 3 $outfile temp${outfile} trim ${diff_samples}s); system(wmix $infile temp${outfile} $finishfile); system(rm -f $infile temp${outfile} $outfile); } elsif($infile_samples $outfile_samples) { $diff_samples = $infile_samples - $outfile_samples; system(sox -v 3 $infile temp${infile} trim ${diff_samples}s); system(wmix temp${infile} $outfile $finishfile); system(rm -f temp${infile} $outfile $infile); } else { system(wmix $infile $outfile $finishfile); system(rm -f $infile $outfile); } You'll need wmix from http://tph.tuwien.ac.at/~oemer/wavetools.html and sox, which was already on my system and is pretty standard. The only problem I've found is that my in channel is a bit low, with respect to volume. It's probably a sox issue, but I haven't had time to mess with the settings yet. It's only an annoyance; you can definitely hear both sides of the conversation. John P.S. I record my outbound calls by prefixing my outbound calls with a 5, which similiarly call record-enable. In that case, the other party doesn't know they're being recorded. IANAL. Check your state laws first! In some states both parties must know about calls being recorded. In mine, TX, only the calling party must know, but it must be first person. For this reason, I do not let asterisk record everything, because my employees must themselves determine what they're going to record. - Original Message - From: Iain Stevenson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 04, 2004 12:51 PM Subject: Re: [Asterisk-Users] help - recording both sides of a conversation * always records both sides of the conversation - but stores them in separate files in /var/spool/asterisk/monitor/. You need to combine the in and out parts using soxmix. Iain --On Sunday, January 4, 2004 9:59 am -0800 Paul Mahler [EMAIL PROTECTED] wrote: Does some kind Asterisk soul have an example from extensions.conf that shows how to record both sides of a conversation? Thanks! Paul Mahler mail:[EMAIL PROTECTED] phone: 650.207.9855 fax: 877.408.0105 -Original Message- From: [EMAIL PROTECTED
Re: [Asterisk-Users] help - recording both sides of a conversation
Paul, you broke the thread! Please create your own top posting - or better, search the list archive! Philipp ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] help - recording both sides of a conversation
Iain - First off, all of this is heavily borrowed from others. For those who see their code embedded here, I thank you and give you full credit. Here's how I do it. It's a bit convoluted, but I didn't want to record everything. So, if a call comes in and I want to record it, I send it here: [ext-surrept] exten = _57XXX,1,Answer exten = _57XXX,2,Macro(record-enable) exten = _57XXX,3,BackGround(for-quality-purposes) exten = _57XXX,4,BackGround(this-call-may-be) exten = _57XXX,5,BackGround(recorded) exten = _57XXX,6,Dial(SIP/${EXTEN:1},120,tm) exten = _57XXX,7,Macro(rg-inbound,10,tr) exten = _57XXX,8,Goto(aa-nooneavail,s,1) By transferring a call to 5 + the extension I'm at, I enable the call recording, let the caller know he might be recorded and then send the call right back to myself. Here's the Macro: [macro-record-enable] exten = s,1,AGI(set-timestamp.agi) exten = s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten = s,3,Monitor(wav,${CALLFILENAME}) It starts the recording and calls set-timestamp.agi Here's the agi file: #!/bin/sh longtime=`date +%Y%m%d-%H%M%S` echo SET VARIABLE timestamp $longtime It sets a timestamp, which if you scour the asterisk list, you'll see that it is necessary for mixing the in and out audio later. I have one hangup extension set for my internal phones; it looks like this: exten = h,1,Macro(record-cleanup) And the record-cleanup macro looks like this: [macro-record-cleanup] exten = s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten = s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten = s,3,System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) exten = s,6,NoOp Don't forget to make the /var/spool/asterisk/monitor directory! Finally, mix_monitor_files.pl does the mixing job and combines the in and out files: #!/usr/bin/perl $monitordir = shift; $infile = shift; $outfile = shift; $finishfile = shift; chdir($monitordir); $infile_output = `sox $infile -e stat 21`; $outfile_output = `sox $outfile -e stat 21`; $infile_output =~ /Samples read:\s+(\d+)/; $infile_samples = $1; $outfile_output =~ /Samples read:\s+(\d+)/; $outfile_samples = $1; if($outfile_samples $infile_samples) { $diff_samples = $outfile_samples - $infile_samples; system(sox -v 3 $outfile temp${outfile} trim ${diff_samples}s); system(wmix $infile temp${outfile} $finishfile); system(rm -f $infile temp${outfile} $outfile); } elsif($infile_samples $outfile_samples) { $diff_samples = $infile_samples - $outfile_samples; system(sox -v 3 $infile temp${infile} trim ${diff_samples}s); system(wmix temp${infile} $outfile $finishfile); system(rm -f temp${infile} $outfile $infile); } else { system(wmix $infile $outfile $finishfile); system(rm -f $infile $outfile); } You'll need wmix from http://tph.tuwien.ac.at/~oemer/wavetools.html and sox, which was already on my system and is pretty standard. The only problem I've found is that my in channel is a bit low, with respect to volume. It's probably a sox issue, but I haven't had time to mess with the settings yet. It's only an annoyance; you can definitely hear both sides of the conversation. John P.S. I record my outbound calls by prefixing my outbound calls with a 5, which similiarly call record-enable. In that case, the other party doesn't know they're being recorded. IANAL. Check your state laws first! In some states both parties must know about calls being recorded. In mine, TX, only the calling party must know, but it must be first person. For this reason, I do not let asterisk record everything, because my employees must themselves determine what they're going to record. - Original Message - From: Iain Stevenson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 04, 2004 12:51 PM Subject: Re: [Asterisk-Users] help - recording both sides of a conversation * always records both sides of the conversation - but stores them in separate files in /var/spool/asterisk/monitor/. You need to combine the in and out parts using soxmix. Iain --On Sunday, January 4, 2004 9:59 am -0800 Paul Mahler [EMAIL PROTECTED] wrote: Does some kind Asterisk soul have an example from extensions.conf that shows how to record both sides of a conversation? Thanks! Paul Mahler mail:[EMAIL PROTECTED] phone: 650.207.9855 fax: 877.408.0105 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Philipp von Klitzing Sent: Sunday, January 04, 2004 9:23 AM To: [EMAIL PROTECTED] Subject: Re: [Asterisk-Users] CAPI, transfering thru a 2nd PBX - keep original CallerID Hi! I want to have Asterisk as my gateway to the outside world and use another PBX to connect my existing phones. exten = ${OUTSIDEMSN},1,Dial,CAPI/${MSN2NDPBX}:${EXTEN} How do I transfer
Re: [Asterisk-Users] help - recording both sides of a conversation
you nolonger need set-timestamp.agi as we have ${TIMESTAMP} in that format by default now. bkw On Sun, 4 Jan 2004, John Baker wrote: Iain - First off, all of this is heavily borrowed from others. For those who see their code embedded here, I thank you and give you full credit. Here's how I do it. It's a bit convoluted, but I didn't want to record everything. So, if a call comes in and I want to record it, I send it here: [ext-surrept] exten = _57XXX,1,Answer exten = _57XXX,2,Macro(record-enable) exten = _57XXX,3,BackGround(for-quality-purposes) exten = _57XXX,4,BackGround(this-call-may-be) exten = _57XXX,5,BackGround(recorded) exten = _57XXX,6,Dial(SIP/${EXTEN:1},120,tm) exten = _57XXX,7,Macro(rg-inbound,10,tr) exten = _57XXX,8,Goto(aa-nooneavail,s,1) By transferring a call to 5 + the extension I'm at, I enable the call recording, let the caller know he might be recorded and then send the call right back to myself. Here's the Macro: [macro-record-enable] exten = s,1,AGI(set-timestamp.agi) exten = s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten = s,3,Monitor(wav,${CALLFILENAME}) It starts the recording and calls set-timestamp.agi Here's the agi file: #!/bin/sh longtime=`date +%Y%m%d-%H%M%S` echo SET VARIABLE timestamp $longtime It sets a timestamp, which if you scour the asterisk list, you'll see that it is necessary for mixing the in and out audio later. I have one hangup extension set for my internal phones; it looks like this: exten = h,1,Macro(record-cleanup) And the record-cleanup macro looks like this: [macro-record-cleanup] exten = s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten = s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten = s,3,System(/usr/scripts/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) exten = s,6,NoOp Don't forget to make the /var/spool/asterisk/monitor directory! Finally, mix_monitor_files.pl does the mixing job and combines the in and out files: #!/usr/bin/perl $monitordir = shift; $infile = shift; $outfile = shift; $finishfile = shift; chdir($monitordir); $infile_output = `sox $infile -e stat 21`; $outfile_output = `sox $outfile -e stat 21`; $infile_output =~ /Samples read:\s+(\d+)/; $infile_samples = $1; $outfile_output =~ /Samples read:\s+(\d+)/; $outfile_samples = $1; if($outfile_samples $infile_samples) { $diff_samples = $outfile_samples - $infile_samples; system(sox -v 3 $outfile temp${outfile} trim ${diff_samples}s); system(wmix $infile temp${outfile} $finishfile); system(rm -f $infile temp${outfile} $outfile); } elsif($infile_samples $outfile_samples) { $diff_samples = $infile_samples - $outfile_samples; system(sox -v 3 $infile temp${infile} trim ${diff_samples}s); system(wmix temp${infile} $outfile $finishfile); system(rm -f temp${infile} $outfile $infile); } else { system(wmix $infile $outfile $finishfile); system(rm -f $infile $outfile); } You'll need wmix from http://tph.tuwien.ac.at/~oemer/wavetools.html and sox, which was already on my system and is pretty standard. The only problem I've found is that my in channel is a bit low, with respect to volume. It's probably a sox issue, but I haven't had time to mess with the settings yet. It's only an annoyance; you can definitely hear both sides of the conversation. John P.S. I record my outbound calls by prefixing my outbound calls with a 5, which similiarly call record-enable. In that case, the other party doesn't know they're being recorded. IANAL. Check your state laws first! In some states both parties must know about calls being recorded. In mine, TX, only the calling party must know, but it must be first person. For this reason, I do not let asterisk record everything, because my employees must themselves determine what they're going to record. - Original Message - From: Iain Stevenson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 04, 2004 12:51 PM Subject: Re: [Asterisk-Users] help - recording both sides of a conversation * always records both sides of the conversation - but stores them in separate files in /var/spool/asterisk/monitor/. You need to combine the in and out parts using soxmix. Iain --On Sunday, January 4, 2004 9:59 am -0800 Paul Mahler [EMAIL PROTECTED] wrote: Does some kind Asterisk soul have an example from extensions.conf that shows how to record both sides of a conversation? Thanks! Paul Mahler mail:[EMAIL PROTECTED] phone: 650.207.9855 fax: 877.408.0105 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Philipp von Klitzing Sent: Sunday, January 04, 2004 9:23 AM To: [EMAIL PROTECTED] Subject: Re: [Asterisk-Users] CAPI