[Asterisk-Users] 2wav2mp3, monitor, mixmonitor, mpg123, queues

Darlon darlon.ferreira at betha.com.br
Fri Feb 10 04:04:40 MST 2006


Answer for the question number 1:

Use it:
exten=XXXX,1,Macro(ramais-gravados,SIP/${EXTEN})

[macro-ramais-gravados]
exten=s,1,SetVar(CALLFILENAME=i${CALLERIDNUM}-${TIMESTAMP})
exten=s,2,Monitor(wav,${CALLFILENAME},m)
exten=s,3,Dial(${ARG1},20,Ttr) 
exten=s,4,Hangup

This script was changed
2wav2mp3 
#!/bin/sh
# create stereo mp3 out of two mono wav-files
# source files will be deleted
#
# 2005 05 23 dietmar zlabinger http://www.zlabinger.at/asterisk
#
# usage: 2wav2mp3 <wave1> <wave2> <mp3>
# designed for Asterisk Monitor(file,format,option) where option is "e" and
# the variable 
# MONITOR_EXEC/usr/bin/2wav2mp3


# location of SOX and SOXMIX
# (set according to your system settings, eg. /usr/bin)
SOX=/usr/bin/sox
SOXMIX=/usr/bin/soxmix
#lame is only required when sox does not support liblame
LAME=/usr/bin/lame


# command line variables
LEFT="$1"
RIGHT="$2"
OUT="$3"

#test if input files exist
test ! -r $LEFT && exit
test ! -r $RIGHT && exit

# convert mono to stereo, adjust balance to -1/1
# left channel
$SOX -c 1 $LEFT $LEFT-tmp.wav pan -1
# right channel
$SOX -c 1 $RIGHT $RIGHT-tmp.wav pan 1

# combine and compress
# this requires sox to be built with mp3-support.
# To see if there  is  support  for  Mp3  run sox -h and 
# look for it under the list of supported file formats as "mp3".
# $SOXMIX -v 1 $LEFT-tmp.wav -v 1 $RIGHT-tmp.wav -v 1 $OUT.mp3

# in case and old version of sox is used, the lame-encoding
# can be done afterwards
$SOXMIX -v 0.5 $LEFT-tmp.wav $RIGHT-tmp.wav $OUT

echo $OUT > final.dat
FINAL=`cat final.dat | sed 's/wav/mp3/g'`

$LAME --silent -V7 -B24 --tt $OUT --add-id3v2 $OUT $FINAL

#remove temporary files
test -w $LEFT-tmp.wav && rm $LEFT-tmp.wav
test -w $RIGHT-tmp.wav && rm $RIGHT-tmp.wav
test -w $OUT && rm $OUT

#remove input files if successfull
#test -r $OUT.mp3 && rm $LEFT $RIGHT
test -r $FINAL && rm $LEFT $RIGHT
rm -f final.dat




Darlon Ferreira Bortolini
Rede/Desenvolvimento
Betha Sistemas
Fone (48) 3431-0750/Ramal 1000

----- Original Message ----- 

  From: g.delduca at webster.it 
  To: asterisk-users at lists.digium.com 
  Sent: Friday, February 10, 2006 7:13 AM
  Subject: [Asterisk-Users] 2wav2mp3, monitor, mixmonitor, mpg123, queues


  Hello!
  I'm using Asterisk for our office telephony, but we have some problems
  that still we can't resolve about it. Here they are:

  1) merge in/out call recording files

  I also tried to use a script I found on the internet, called 2wav2mp3
  In extensions.conf I added the following lines

  ; script to be executed when monitoring has been finished
  MONITOR_EXEC=/usr/local/bin/2wav2mp3

  exten => 102,1,SetVar(CALLFILENAME=${TIMESTAMP}-${EXTEN}-${CALLERID})
  exten => 102,2,Monitor(wav,${CALLFILENAME},m)
  ;exten => 102,2,MixMonitor(${CALLFILENAME}.gsm)
  ;exten => 102,2,MixMonitor(test.wav,W(-3))
  exten => 102,3,Ringing
  exten => 102,4,Dial(Sip/giuseppedd,20,rtwW)

  ...but I always get two separate files.

  As you can see I also tried the MixMonitor application but the resulting 
  files
  contain one channel that is clearly audible and the other seems to be noise.

  2) an alternative to mpg123 becouse it generates a lot of errors like this:

  Feb  3 19:50:08 WARNING[9568]: res_musiconhold.c:488 monmp3thread: 
  Unable to spawn mp3player
  Feb  3 19:58:28 NOTICE[9568]: res_musiconhold.c:507 monmp3thread: 
  Request to schedule in the past?!?!
  Feb  3 19:58:28 WARNING[9568]: res_musiconhold.c:421 spawn_mp3: Found no 
  files in '/usr/share/asterisk/mohagents'


  3) how to play different files to an agent before he picks up a call 
  depending on which queue the call comes from

  [qlu500]
  musiconhold = qlu500
  announce = vm-from-phonenumber  ; <<<---- here is the problem
  context = qlu500out
  wrapuptime=15
  announce-frequency = 60
  ...


  Comments or suggestions are greatly appreciated.

  Thanks a lot.

  Giuseppe

  _______________________________________________
  --Bandwidth and Colocation provided by Easynews.com --

  Asterisk-Users mailing list
  To UNSUBSCRIBE or update options visit:
     http://lists.digium.com/mailman/listinfo/asterisk-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060210/d54597fc/attachment.htm


More information about the asterisk-users mailing list