View Single Post
Posts: 168 | Thanked: 265 times | Joined on Oct 2009 @ London, UK
#50
Originally Posted by iKneaDough View Post
Happy Holidays, everyone!

Here is my Holiday gift: A method for recording calls from the device!

note: it will require command line tinkering.

I got the idea and most of the information thanks to the blog link which dalonso posted here.

First you will need to get the pulseaudio-utils package either from here , or you can enable the tools repository and run
Code:
apt-get install pulseaudio-utils
there is a link to a single-click install file to add the tools repo here .

The pulseaudio-utils package provides two apps which I use in the scripts: 'parec' to record raw audio streams, and 'pacat' to play back raw audio streams.

The streams involved are: 'sink.hw0.monitor' for incoming sounds and 'source.hw0' for outgoing sounds when using the phone handset, and 'sink.hw1.monitor' for incoming and 'source.hw0' for outgoing when using a bluetooth headset.

In my home directory I created a few simple scripts for recording

for recording while using the handset, I have a script 'simpleRec.sh':
Code:
NOW=`date +%F-%H-%M-%S` 
echo $NOW > simpleDateTime
parec -d "sink.hw0.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
parec -d "source.hw0" > MyDocs/tmp/$NOW.pulse.out.raw
for recording while using bluetooth, I have a script 'simpleBtRec.sh':
Code:
NOW=`date +%F-%H-%M-%S` 
echo $NOW > simpleDateTime
parec -d "sink.hw1.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
parec -d "source.hw1" > MyDocs/tmp/$NOW.pulse.out.raw
To play back the most recent recorded call 'simpleLastPlay.sh' :
Code:
LAST=`cat simpleDateTime`
pacat MyDocs/tmp/$LAST.pulse.in.raw &
pacat -v MyDocs/tmp/$LAST.pulse.out.raw
To play back an older call using a unique date or time 'simplePlay.sh' :
Code:
pacat MyDocs/tmp/*$1*pulse.in.raw &
pacat -v MyDocs/tmp/*$1*pulse.out.raw
for example if you know you recorded a call on Dec 1 at 12:00 am, you could run ' ./simplePlay.sh 12-01-00-00 ' or any part of the date or time that you can remember, as long as it is unique.

To stop recording or playback just press ctrl+c.

Another script I made to stop any recording or playback if you can't get back to its original terminal window 'simpleStop.sh' :
Code:
killall parec
killall pacat

Final note: Please use it only where it is legal to do so, and please do not use it for any nefarious purpose. Enjoy!
For recording, you can do:

gst-launch adder name=a ! wavenc ! filesink location=blah.wav pulsesrc device=sink.hw0.monitor ! queue ! a. pulsesrc device=source.hw0 ! queue ! a
 

The Following 5 Users Say Thank You to zaheerm For This Useful Post: