Transfer the 'call Recording' files to another PC

Hi,

I need a help that i want thransfer all my recoding files to my another server after call disconnected. Is there any possible ways…

i am using

asterisk 1.4.30
Dahdi linux complete
centos 5
digium 4 port card

EX:

server 1 : 192.168.1.24
server 2 : 192.168.1.89

Using mix monitor

i want to transfer recording files from server1 to server 2 after call disconnected.
Is there any dialplan to perform automatically…??

Thanks & Regards

criz

I haven’t actually done this, but it should be doable using the asterisk cmd System with a ftp script.
This is something off the top of my head, maybe it will help get you going in a workable solution.

dialplan

exten => 333,1,Gosub(recordcall,s,1(${EXTEN}))

[recordcall]
exten => s,1,Record(/tmp/${ARG1}.wav)
exten => s,n,Dial(SIP/${ARG1},20)
exten => h,1,system(/usr/script/ftpit ${ARG1}.WAV)

ftp script. argument is the filename to move.

#!/bin/sh
ftp -ivn <<EOL
open FTPSERVER
user username password
lcd /var/spool/asterisk/myrecordings
put $1
bye
quit
EOL

[quote=“mazzic”]I haven’t actually done this, but it should be doable using the asterisk cmd System with a ftp script.
This is something off the top of my head, maybe it will help get you going in a workable solution.

dialplan

exten => 333,1,Gosub(recordcall,s,1(${EXTEN}))

[recordcall]
exten => s,1,Record(/tmp/${ARG1}.wav)
exten => s,n,Dial(SIP/${ARG1},20)
exten => h,1,system(/usr/script/ftpit ${ARG1}.WAV)

ftp script. argument is the filename to move.

[code]
#!/bin/sh
ftp -ivn <<EOL
open FTPSERVER
user username password
lcd /var/spool/asterisk/myrecordings
put $1
bye
quit
EOL

[/code][/quote]

Hi,

Thanks for the replay and the dialplan.

where i have to mention the IP that i have to transfer?
and how can i run these script automatically?
I want to put a specific time to transfer the file.
my recording files are in /var/spool/asterisk/monitor folder.

Regards

Criz

Hi

If the two servers are on the same lan and looking at teh addresses they are.

Then firstly you need to “trust” them by sharing the ssh keys, This way they can talk to each other without the need for passwords.
details are here cyber-cottage.co.uk/site/index.p … &Itemid=63

now you need to write a script that rsyncs the files between servers. , This can be called by a hangup. but if it was a long call this may not have been mixed fully when the script is called.

So you can cron this to be done for example hourly.

at its most simple, making sure the directories are correct , these shown here are not the standard

#!/bin/sh rsync -prvlogu /var/www/html/recordings/calls asterisk2:/var/www/html/recordings/

This can be expanded to create a structure to store recording by the day ,

so this script can be run as well.

[code]
#!/bin/sh
find /var/www/html/recordings/calls/live -cnewer /var/spool/asterisk/monitor/checkfile |grep X.wav > /var/spool/asterisk/monitor/typefile
for user in $(cut -c 37- /var/spool/asterisk/monitor/typefile);
do
echo $user >> /var/spool/asterisk/monitor/checkfile1
echo ${user:0:8} >> /var/spool/asterisk/monitor/checkfile2
if [ ! -d /var/www/html/recordings/calls/${user:1:8} ]; then
mkdir /var/www/html/recordings/calls/${user:1:8}
chmod 755 /var/www/html/recordings/calls/${user:1:8}
cd /var/www/html/recordings/calls/${user:1:8}
/bin/ln -s …/index.php index.php
/bin/ln -s …/index.css index.css
/bin/ln -s …/.icons .icons
fi
cp -p /var/www/html/recordings/calls/live/$user /var/www/html/recordings/calls/${user:1:8}/$user
touch /var/spool/asterisk/monitor/checkfile

rm -rf /var/www/html/recordings/*/*out.wav

rm -rf /var/www/html/recordings/*/*in.wav

rm -rf /var/spool/asterisk/monitor/*X.wav

done[/code]

enjoy
Ian