I thought I would post this in case it might be of any use to anyone. Not anything special but it does work. Keep in mind you need sox and wmix. Here is some relevant exerpts of my extensions.conf using John Todds macro. [globals] CALLFILENAME=foo FOO=foo CALLERIDNUM=foo [default] exten => 287,1,Macro(dial,SIP/agent20002|20) exten => 287,2,Voicemail(u287) exten => h,1,Macro(hangup) [macro-dial] exten => s,1,AGI(set-timestamp.agi) exten => s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten => s,3,Monitor(wav,${CALLFILENAME}) exten => s,4,Dial(${ARG1},${ARG2},${ARG3}) [macro-hangup] exten => s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten => s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten => s,3,System(/usr/local/bin/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) exten => s,6,NoOp Here is mix_monitor_files.pl. sox and wmix must be in the path of your perl script #!/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 $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 $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"); } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20030825/9ae669d6/attachment.htm
Note that h will not be called if you park the call and pick it backup. bkw On Mon, 25 Aug 2003, David Harris wrote:> I thought I would post this in case it might be of any use to anyone. > Not anything special but it does work. Keep in mind you need sox and > wmix. > > Here is some relevant exerpts of my extensions.conf using John Todds > macro. > > [globals] > CALLFILENAME=foo > FOO=foo > CALLERIDNUM=foo > > [default] > > exten => 287,1,Macro(dial,SIP/agent20002|20) > exten => 287,2,Voicemail(u287) > exten => h,1,Macro(hangup) > > [macro-dial] > > exten => s,1,AGI(set-timestamp.agi) > exten => > s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) > exten => s,3,Monitor(wav,${CALLFILENAME}) > exten => s,4,Dial(${ARG1},${ARG2},${ARG3}) > > [macro-hangup] > > exten => s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) > exten => s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) > exten => s,3,System(/usr/local/bin/mix_monitor_files.pl ${MONITORDIR} > ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) > exten => s,6,NoOp > > > Here is mix_monitor_files.pl. sox and wmix must be in the path of your > perl script > > #!/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 $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 $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"); > } >
ok now lets modify that mix script to pick up on who started the monitored call and look them up in the voicemail.conf and email it to em Dave>>> brian@bkw.org 8/25/2003 2:14:16 PM >>>Note that h will not be called if you park the call and pick it backup. bkw On Mon, 25 Aug 2003, David Harris wrote:> I thought I would post this in case it might be of any use to anyone. > Not anything special but it does work. Keep in mind you need sox and > wmix. > > Here is some relevant exerpts of my extensions.conf using John Todds > macro. > > [globals] > CALLFILENAME=foo > FOO=foo > CALLERIDNUM=foo > > [default] > > exten => 287,1,Macro(dial,SIP/agent20002|20) > exten => 287,2,Voicemail(u287) > exten => h,1,Macro(hangup) > > [macro-dial] > > exten => s,1,AGI(set-timestamp.agi) > exten => > s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) > exten => s,3,Monitor(wav,${CALLFILENAME}) > exten => s,4,Dial(${ARG1},${ARG2},${ARG3}) > > [macro-hangup] > > exten => s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) > exten => s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) > exten => s,3,System(/usr/local/bin/mix_monitor_files.pl ${MONITORDIR} > ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) > exten => s,6,NoOp > > > Here is mix_monitor_files.pl. sox and wmix must be in the path of your > perl script > > #!/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 $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 $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"); > } >_______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users
and we could GSM compress them to be email friendly I think sox does gsm compress Dave again>>> Dave.Packham@utah.edu 8/25/2003 2:30:25 PM >>>ok now lets modify that mix script to pick up on who started the monitored call and look them up in the voicemail.conf and email it to em Dave>>> brian@bkw.org 8/25/2003 2:14:16 PM >>>Note that h will not be called if you park the call and pick it backup. bkw On Mon, 25 Aug 2003, David Harris wrote:> I thought I would post this in case it might be of any use to anyone. > Not anything special but it does work. Keep in mind you need sox and > wmix. > > Here is some relevant exerpts of my extensions.conf using John Todds > macro. > > [globals] > CALLFILENAME=foo > FOO=foo > CALLERIDNUM=foo > > [default] > > exten => 287,1,Macro(dial,SIP/agent20002|20) > exten => 287,2,Voicemail(u287) > exten => h,1,Macro(hangup) > > [macro-dial] > > exten => s,1,AGI(set-timestamp.agi) > exten => > s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) > exten => s,3,Monitor(wav,${CALLFILENAME}) > exten => s,4,Dial(${ARG1},${ARG2},${ARG3}) > > [macro-hangup] > > exten => s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) > exten => s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) > exten => s,3,System(/usr/local/bin/mix_monitor_files.pl ${MONITORDIR} > ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) > exten => s,6,NoOp > > > Here is mix_monitor_files.pl. sox and wmix must be in the path of your > perl script > > #!/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 $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 $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"); > } >_______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users
My mux script does the gsm compression using sox On Mon, 25 Aug 2003, Dave Packham wrote:> and we could GSM compress them to be email friendly I think sox does gsm compress > > Dave again > > >>> Dave.Packham@utah.edu 8/25/2003 2:30:25 PM >>> > ok now lets modify that mix script to pick up on who started the monitored call and look them up in the voicemail.conf and email it to em > > Dave > > >>> brian@bkw.org 8/25/2003 2:14:16 PM >>> > Note that h will not be called if you park the call and pick it backup. > > bkw > > On Mon, 25 Aug 2003, David Harris wrote: > > > I thought I would post this in case it might be of any use to anyone. > > Not anything special but it does work. Keep in mind you need sox and > > wmix. > > > > Here is some relevant exerpts of my extensions.conf using John Todds > > macro. > > > > [globals] > > CALLFILENAME=foo > > FOO=foo > > CALLERIDNUM=foo > > > > [default] > > > > exten => 287,1,Macro(dial,SIP/agent20002|20) > > exten => 287,2,Voicemail(u287) > > exten => h,1,Macro(hangup) > > > > [macro-dial] > > > > exten => s,1,AGI(set-timestamp.agi) > > exten => > > s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) > > exten => s,3,Monitor(wav,${CALLFILENAME}) > > exten => s,4,Dial(${ARG1},${ARG2},${ARG3}) > > > > [macro-hangup] > > > > exten => s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) > > exten => s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) > > exten => s,3,System(/usr/local/bin/mix_monitor_files.pl ${MONITORDIR} > > ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) > > exten => s,6,NoOp > > > > > > Here is mix_monitor_files.pl. sox and wmix must be in the path of your > > perl script > > > > #!/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 $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 $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"); > > } > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users >
If I understand the script, your technique first calculates how much longer OUT is than IN, then trims that amount off the beginning of OUT, then mixes the files. We're using the older technique of mixing OUT and IN in reverse (starting from the end). Do you feel this new technique is markedly better than the old technique? The reason I ask is that everyone assumes the start times of OUT and IN are always different and the end times are always the same. However, I have gotten such mixed sync results from the reverse technique that it leads me to believe the end times are not always the same. If that is true then the new technique couldn't be much better than the old one. Thoughts? -----Original Message----- From: asterisk-users-admin@lists.digium.com [mailto:asterisk-users-admin@lists.digium.com]On Behalf Of David Harris Sent: Monday, August 25, 2003 10:21 AM To: asterisk-users@lists.digium.com Subject: [Asterisk-Users] Syncronize Monitored Calls I thought I would post this in case it might be of any use to anyone. Not anything special but it does work. Keep in mind you need sox and wmix. Here is some relevant exerpts of my extensions.conf using John Todds macro. [globals] CALLFILENAME=foo FOO=foo CALLERIDNUM=foo [default] exten => 287,1,Macro(dial,SIP/agent20002|20) exten => 287,2,Voicemail(u287) exten => h,1,Macro(hangup) [macro-dial] exten => s,1,AGI(set-timestamp.agi) exten => s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) exten => s,3,Monitor(wav,${CALLFILENAME}) exten => s,4,Dial(${ARG1},${ARG2},${ARG3}) [macro-hangup] exten => s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) exten => s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) exten => s,3,System(/usr/local/bin/mix_monitor_files.pl ${MONITORDIR} ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) exten => s,6,NoOp Here is mix_monitor_files.pl. sox and wmix must be in the path of your perl script #!/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 $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 $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"); } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20030825/787ea4e2/attachment.htm
ok im sorta confused. when I save a * email'ed voicemail and I check the properties on th file It says BitRate 13kbps Channnels 1 mono Audio Sample Rate 8 kHz Audio Format GSM 6.10 when I look at the sox'd files from you script I see BitRate 128kbps Audio Sample Size 16bit Channnels 1 mono Audio Sample Rate 8 kHz Audio Format PCM I dont really think that the monitor files are getting GSM'd correctly. Ill RTFM on sox and see what I can find Dave>>> brian@bkw.org 8/25/2003 3:41:07 PM >>>My mux script does the gsm compression using sox On Mon, 25 Aug 2003, Dave Packham wrote:> and we could GSM compress them to be email friendly I think sox does gsm compress > > Dave again > > >>> Dave.Packham@utah.edu 8/25/2003 2:30:25 PM >>> > ok now lets modify that mix script to pick up on who started the monitored call and look them up in the voicemail.conf and email it to em > > Dave > > >>> brian@bkw.org 8/25/2003 2:14:16 PM >>> > Note that h will not be called if you park the call and pick it backup. > > bkw > > On Mon, 25 Aug 2003, David Harris wrote: > > > I thought I would post this in case it might be of any use to anyone. > > Not anything special but it does work. Keep in mind you need sox and > > wmix. > > > > Here is some relevant exerpts of my extensions.conf using John Todds > > macro. > > > > [globals] > > CALLFILENAME=foo > > FOO=foo > > CALLERIDNUM=foo > > > > [default] > > > > exten => 287,1,Macro(dial,SIP/agent20002|20) > > exten => 287,2,Voicemail(u287) > > exten => h,1,Macro(hangup) > > > > [macro-dial] > > > > exten => s,1,AGI(set-timestamp.agi) > > exten => > > s,2,SetVar(CALLFILENAME=${timestamp}-${CALLERIDNUM}-${MACRO_EXTEN}) > > exten => s,3,Monitor(wav,${CALLFILENAME}) > > exten => s,4,Dial(${ARG1},${ARG2},${ARG3}) > > > > [macro-hangup] > > > > exten => s,1,SetVar(MONITORDIR=/var/spool/asterisk/monitor) > > exten => s,2,GotoIf($[${CALLFILENAME} = ${FOO}]?6:3) > > exten => s,3,System(/usr/local/bin/mix_monitor_files.pl ${MONITORDIR} > > ${CALLFILENAME}-in.wav ${CALLFILENAME}-out.wav ${CALLFILENAME}.wav) > > exten => s,6,NoOp > > > > > > Here is mix_monitor_files.pl. sox and wmix must be in the path of your > > perl script > > > > #!/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 $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 $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"); > > } > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users >_______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users