bar top left
bar top right
left curve
right curve
Bienvenido, Invitado

Change call recording names and sort into folders
(1 viendo) (1) Invitado
Abajo
Publicar respuesta
Publicar nuevo tema
Página: 1234
TEMA: Change call recording names and sort into folders
#56260
Change call recording names and sort into folders hace 1 Año, 6 Meses Karma: 1
This post is to address one problem we have been having with elastix for a while now.

We get clients who do lots of call recording and they are constantly complaining that they cant find the recordings..Here is my solution to that problem...

After reading www.elastix.org/en/component/kunena/3-he...rd-name-problem.html I have come up with the following "dummy proof" procedure for this

1) make a symlink log into the console as root

ln -s /var/spool/asterisk/monitor /var/www/html/rec

2) make a script to do the sorting of the file names

nano /root/sortcalls.sh

#============PASTE THE BELOW CODE INTO THAT FILE===============
#!/bin/bash

TODAY=`date +'%Y-%m-%d'`

mkdir /var/spool/asterisk/monitor/$TODAY
mv /var/spool/asterisk/monitor/$TODAY* /var/spool/asterisk/monitor/$TODAY



#=============END OF THE FILE===================

3) make the file executable

chmod +x /root/sortcalls.sh

4) install the file into the crontab

crontab -e

*/5 * * * * /root/sortcalls.sh

5) log into the elastix admin page and goto "PBX -> PBX CONFIG -> General Settings

set the "Recording Location:" to "/var/spool/asterisk/monitor/"
set the "Run after record:" to ...

** the below is all one line... **

mv ^{MIXMON_DIR}/^{CALLFILENAME}.^{MIXMON_FORMAT} ^{MIXMON_DIR}/`/usr/bin/mysql -u root -peLaStIx.2oo7 -N -B -D asteriskcdrdb -e "SELECT calldate,'From:',src,'To:',dst,'' FROM cdr WHERE uniqueid = ^{UNIQUEID}"|sed -s s'/\s/_/ g'`.^{MIXMON_FORMAT}

** the above is all one line make sure it pastes in that way.... **

6) apply the settings and try recording some calls the calls in serverip/rec should look like

Index of /monitor
[ICO] Name Last modified Size Description
[DIR] Parent Directory -
[DIR] 2010-07-23/ 23-Jul-2010 14:47 -
[DIR] 2010-07-25/ 25-Jul-2010 13:00 -

and the recordings should be sorted into the folder name with the current date

7) if you need more help contact me www.ztelco.com and I would be happy to help...
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
jhansen858
Fresh Boarder
Mensajes: 11
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Reply Quote
 
#56288
Re:Change call recording names and sort into folders hace 1 Año, 6 Meses Karma: 155
Welcome here jhansen858:

I think you might find the thread that ends with

www.elastix.org/component/kunena/3-help/...3.html?lang=en#56095

will help you improve the "dummy proof" level of your solution, your cron job will as written, run as root and will thus create the directories with that ownership, perhaps a problem, also the job will break around midnight if there any new calls, your mkdir should really be mkdir -p or you will get an error after 00:10 each time it is called, I suggest that doing everything at the end of the call is a more elegant solution. Getting the date of the monitor file to set the directory something like
RECORDEDON=`date -r $FILENAME +'%Y-%m-%d'`
will allow you to rename all your existing recordings retro-actively if you extract the UNIQUEID from the file name , (perhaps something like sed "s/.*\-\([.0-9]*\)\.[a-zA-Z]*$/\1/" )

You should consider using hardlinks (ln) not mv because if you change the original file's name some common interfaces will not work as expected.

as a suggestion (I cared to deconstruct your post, which wasn't too hard as I recognize most of it, seeing as I wrote it , I added a few "value added" suggestions of my own ) I offer a rough and ready "one size fits all" alternative, be careful almost no error checking:

Código:


#!/bin/sh
# the next two lines will make the directories, it preempts the need for your cron job,season to suit, it also puts the recordings where they belong temporally
DATE=`date -r $2$1 +'%Y/%m-%b/%d-%a'` 
mkdir -p $2$DATE
# the next line  extract and stores the UNIQUEID, it is only used once so for efficiency you can put it inline
UNIQUEID=`echo $1 |sed "s/.*\-\([.0-9]*\)\.[a-zA-Z]*$/\1/"` 
# the next line  extracts the format and is left here so any changes one made previously to the format will still be covered when run retrospecively. it also is only used once.
FILETYPE=`echo $1 |sed "s/.*\-[.0-9]*\(\.[a-zA-Z]*$\)/\1/"` 
# the next line does the grunt work
NEWFILE=`/usr/bin/mysql -u root -peLaStIx.2oo7 -N -B -D asteriskcdrdb -e "SELECT calldate,'From:',clid,'To:',dst,'' FROM cdr WHERE uniqueid = $UNIQUEID LIMIT 1"|sed -e 's/\s/_/g' -e "s/_$/$FILETYPE/" -e "s/["<>]//g"`
# the next line saves you duplicating effort and overwriting good shit
if [ ! -f $2$DATE/$NEWFILE ] ;then ln $2$1 $2$DATE/$NEWFILE ;fi
# there is no nextline until you add it or insert previous lines perhaps to
# use sox to  normalize levels if you use dahdi and haven't bothered to set it up right
# use sox to strip off the ringing tone , subtract calltime from answertime and start with that offset,and then the silence at either end, (watch out for the wink at the end of dahdi calls and remove the last 500 milliseconds)
# use lame to convert to mp3 to save space,and id2tag appropriately with extension datetime etc. 
# use mail and mutt to email to the users email or cellphone, parse /etc/asterisk/voicemail.conf to get the address
# the world is your oyster . . . 



You can call it either from the general settings page with

/var/lib/asterisk/bin/scriptname.sh ^${CALLFILENAME}.^{MIXMON_FORMAT} ^{MIXMON_DIR}

or from a cron script if that floats your boat, or from bash perhaps to process/reprocess all the existing files, something like:

for i in `ls /var/spool/asterisk/monitor/*.wav` ; do /path/to/script $i /var/spool/asterisk/monitor/;done

A couple of caveats here, it will create the directories with the ownership of the user so do a quick

chown -r asterisk:asterisk /var/spool/asterisk/monitor if run as root from bash

it rightly belongs in /var/lib/asterisk/bin.

regards

dicko

p.s.

I believe that unless you have changed the default http configuration , directory listings in Elastix will be disallowed, for very good reasons, you will need to add a wrapper index.<php|html|whatyouaddedtomakeacceptable> in the sym linked directory you use that will hopefully render the files visible/usable/downloadable, there are examples both here in these fora and out on the tubes that will help you there. Possibly grab a copy of "enCode eXplorer" from:

encode-explorer.siineiolekala.net/

and stick the index.php file (after editing it to suit) in /var/www/html/monitor and/or /var/www/html/monitor/2010 depending on what you care to soft link.
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
dicko
Ethically, I no longer support PaloSanto, Sorry.
Platinum Boarder
Mensajes: 4101
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Sexo: Hombre Localización: Not available Cumpleaños: 01/21
Última edición: 25/07/2010 15:14 por dicko.
There are other solutions!!
Reply Quote
 
#56360
Re:Change call recording names and sort into folders hace 1 Año, 6 Meses Karma: 1
Ahh some nice points to consider..

I would like to point out now that I have your ear... the difficulty in finding recordings is in my opinion the biggest shortcoming of the entire elastix distro... I have had every single client that we have installed it on complain about that one feature...

I think one way to fix this..(that I have tried to figure out how to add but couldn't figure it out yet) woud be to put a link to the recordings of the call next to the call on the CDR reports page(between status and duration would be great)... The end users can always seem to find the call in the cdr report but you try and find that same call under the monitor section they for some reason frequently cant find them.. This is the number 1 tech support call that we get when deploying the elastix distro for anyone...



I do thank you for the great distro I wish I knew more so I could add the link as I'm suggesting my self and not beg you guys to include it in your next update
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
jhansen858
Fresh Boarder
Mensajes: 11
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Última edición: 26/07/2010 12:41 por jhansen858.
Reply Quote
 
#56364
Re:Change call recording names and sort into folders hace 1 Año, 6 Meses Karma: 155
There is another, and some find better "user portal" called "The Asterisk Recordings Interface" It just does the calls handling (forward email content etc. ) VMX if enabledd for that extension and voicemails and monitor files though.

it might be at

<IP>/recordings

but it might not be installed, see other posts concerning getting it onto your elastix box,or just do a version upgrade of FreePBX and it usually magically appears
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
dicko
Ethically, I no longer support PaloSanto, Sorry.
Platinum Boarder
Mensajes: 4101
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Sexo: Hombre Localización: Not available Cumpleaños: 01/21
There are other solutions!!
Reply Quote
 
#57971
Re:Change call recording names and sort into folders hace 1 Año, 5 Meses Karma: 1
Please someone publish here a complete howto on this issue.
Thanks in advance !
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
doncipo
Fresh Boarder
Mensajes: 18
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Reply Quote
 
#68292
Re: Change call recording names and sort into folders hace 1 Año, 1 Mes Karma: 0
It seemes to work fins.
but in this 2 cases it doesn't.
1. when commiting calls between extensions. (thourgh trunk it works well).
2. when call monitor is "on demand"("always" works well).

thank you on advance.
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
azulay7
Fresh Boarder
Mensajes: 1
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Reply Quote
 
#71153
Re: Change call recording names and sort into folders hace 12 Meses Karma: 3
Aca esta..


Gelevera escribió:
la verdad que el que busca encuentra.
aca esta lo que necesitaba

Enlaces ocultos para usuarios no registrados. Inicie sesión o regístrese Aquí


En Elastix no viene por default.
que raro que a la hora de asignar donde grabar los de asterisk no se les haya ocurrido este problema de la ext3..
Podria agregarse a Elastix y también una opción para borrar las muy antiguas.




azulay7 escribió:
It seemes to work fins.
but in this 2 cases it doesn't.
1. when commiting calls between extensions. (thourgh trunk it works well).
2. when call monitor is "on demand"("always" works well).


las 2 extensiones tienen que tener habilitado

Record Incoming "allways"
Record Outgoing "allways"

o sinó

Enlaces ocultos para usuarios no registrados. Inicie sesión o regístrese Aquí
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
Gelevera
Junior Boarder
Mensajes: 64
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Última edición: 11/02/2011 14:13 por Gelevera.
STOP SOPA NOW!!
Reply Quote
 
#71397
Re: Change call recording names and sort into folders hace 11 Meses, 4 Semanas Karma: 3
hi! I need to save my recordings in sub-folders i try this

Fozzy wrote:


1. Create a script in /var/lib/asterisk/bin/ called archiver

nano /var/lib/asterisk/bin/archiver

2. in the archiver I have the following:


#!/bin/bash
ARCHDIR="`date +%Y`/`date +%m`/`date +%d`/"
mkdir -p /var/spool/asterisk/monitor/$ARCHDIR
mv /var/spool/asterisk/monitor/$1 /var/spool/asterisk/monitor/$ARCHDIR



3. chmod 777 /var/lib/asterisk/bin/archiver

4. chown -R asterisk:asterisk /var/lib/asterisk/bin/archiver

(If you don't then nothing will happen and you will sit scratching your head)



5. Now all we need to do is add the following line to FreePBX, General Settings,
"Run after recording":

/var/lib/asterisk/bin/archiver ^{CALLFILENAME}.^{MIXMON_FORMAT}

And there you go! You should then see your files moved to folders like this for example.

/var/spool/asterisk/monitor/2010/07/20/XXXX-00000.000.wav



and works great, but now i didn´t see my recordings in web interface 'monitoring'..

any clue?
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
Gelevera
Junior Boarder
Mensajes: 64
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
STOP SOPA NOW!!
Reply Quote
 
#71411
Re: Change call recording names and sort into folders hace 11 Meses, 4 Semanas Karma: 155
The Original ARI at

<ip>/recordings

is recursive and will work (five levels deep, I believe) , the Elastix one is not and won't (unfortunately it is also still quite broken, as azulay7 has discovered )

If you read the whole underlying thread you will see I suggested

ln /var/spool/asterisk/monitor/$1 /var/spool/asterisk/monitor/$ARCHDIR

They will both work then with duplicates in ARI

how about

mkdir -p /var/spool/asterisk/otherdirectory/$ARCHDIR
ln /var/spool/asterisk/monitor/$1 /var/spool/asterisk/otherdirectory/$ARCHDIR


?
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
dicko
Ethically, I no longer support PaloSanto, Sorry.
Platinum Boarder
Mensajes: 4101
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
Sexo: Hombre Localización: Not available Cumpleaños: 01/21
Última edición: 16/02/2011 11:21 por dicko.
There are other solutions!!
Reply Quote
 
#71517
Re: Change call recording names and sort into folders hace 11 Meses, 3 Semanas Karma: 3
dicko wrote:
The Original ARI at

<ip>/recordings

is recursive and will work (five levels deep, I believe) , the Elastix one is not and won't (unfortunately it is also still quite broken, as azulay7 has discovered



i found this

Código:



    global $arrConf;
    global $arrConfModule;

    $arrConfModule['module_name']       = 'monitoring2';
    $arrConfModule['templates_dir']     = 'themes';
    $arrConfModule['records_dir']       = '/var/spool/asterisk/monitor/';
    $arrConfModule['dsn_conn_database'] = ''; // A ser leído de /etc/amportal.conf
?>





in /var/www/html/modules/monitoring/configs/default.conf.php

I am interested in this line:

Código:


$arrConfModule['records_dir']       = '/var/spool/asterisk/monitor/';



How i can do to tell it to search recursively?
Introducir código aquí   
Por favor, aunque no se vea ningún BBcode ni botones de smiley, son usables igualmente
Gelevera
Junior Boarder
Mensajes: 64
graphgraph
Usuario Offline Presiona aquí para ver el perfil de este usuario
STOP SOPA NOW!!
Reply Quote
 
Arriba
Publicar respuesta
Publicar nuevo tema
Página: 1234
Moderadores: Bob, jgutierrez