[Asterisk-Users] help - recording both sides of a conversation
Joelson S. Apon
joelsa at ph.cylynx.com
Wed Jan 21 08:19:50 MST 2004
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: asterisk-users-admin at lists.digium.com
[mailto:asterisk-users-admin at lists.digium.com]On Behalf Of Jimmy Riley
Sent: Tuesday, January 20, 2004 2:20 PM
To: 'asterisk-users at lists.digium.com'
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 -vvvvgc
[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:joelsa at ph.cylynx.com]
Sent: January 20, 2004 12:55 PM
To: asterisk-users at lists.digium.com
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: asterisk-users-admin at lists.digium.com
[mailto:asterisk-users-admin at lists.digium.com]On Behalf Of zoa
Sent: Tuesday, January 06, 2004 1:05 PM
To: asterisk-users at lists.digium.com
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 2>&1`;
> > $outfile_output = `sox $outfile -e stat 2>&1`;
> >
> > $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" <iain at iainstevenson.com>
> > To: <asterisk-users at lists.digium.com>
> > 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
> > > <pmahler at signate.com> 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:pmahler at signate.com
> > > > phone: 650.207.9855
> > > > fax: 877.408.0105
> > > >
> > > > -----Original Message-----
> > > > From: asterisk-users-admin at lists.digium.com
> > > > [mailto:asterisk-users-admin at lists.digium.com] On Behalf Of Philipp
von
> > > > Klitzing
> > > > Sent: Sunday, January 04, 2004 9:23 AM
> > > > To: asterisk-users at lists.digium.com
> > > > 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 the caller Id information initially coming in?
> > > >
> > > > I have strong doubts that this can be done at all. One way would be
to
> > > > set your ${MSN2ndPBX} to ${CALLERIDNUM}, but that would require that
> > > > capi.conf has that CALLERIDNUM listed as one of the valid outgoing
> MSNs.
> > > > Since you won't know in advance who'll call that'll be a problem -
also
> > I
> > > > don't think you can reconfigure capi.conf in the midst of processing
a
> > > > call...
> > > >
> > > > Besides: I suppose your ISDN PBX (which brand exactly?) supports
CLIP
> > (or
> > > > comes with an internal S0 bus) and you have an analog CLIP phone (or
> > ISDN
> > > > phone) connected?
> > > >
> > > > Workaround: See my last posting and other very recent discussions
> > > > concerning a simple tool that shows the current caller ID and name
on
> > > > your PC using either Flash, HTML or Java. Or use astman/ gastman.
> > > > As of now I am storing the caller data through AGI in mySQL and
display
> > > > that on a web page that the user needs to re-load manually when
> desired.
> > > >
> > > > Cheers, Philipp
> > > >
> > > >
> > > > _______________________________________________
> > > > Asterisk-Users mailing list
> > > > Asterisk-Users at lists.digium.com
> > > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > > >
> > > > _______________________________________________
> > > > Asterisk-Users mailing list
> > > > Asterisk-Users at lists.digium.com
> > > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Asterisk-Users mailing list
> > > Asterisk-Users at lists.digium.com
> > > http://lists.digium.com/mailman/listinfo/asterisk-users
> > >
> >
> > _______________________________________________
> > Asterisk-Users mailing list
> > Asterisk-Users at lists.digium.com
> > http://lists.digium.com/mailman/listinfo/asterisk-users
> >
>_______________________________________________
>Asterisk-Users mailing list
>Asterisk-Users at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-users
_______________________________________________
Asterisk-Users mailing list
Asterisk-Users at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
_______________________________________________
Asterisk-Users mailing list
Asterisk-Users at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
_______________________________________________
Asterisk-Users mailing list
Asterisk-Users at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list