Setup Call Recording With Android App Tasker On Nexus One

I wanted to record calls on my Android phone (Nexus one). The easy way would have been to download an app but I like tinkering. And given that I recently bought Tasker, android’s very own swiss knife, I thought I should give it a run. After just an hour I was able to create my very own call recorder (some time went into trial and error with things as this was my first major task with tasker and also some things didn’t work with nexus one, which I will note below). I’ll outline the process to set it up here in as much detail as possible and will also provide the profiles. Please note that I made this setup for nexus one but it should work on pretty much any android phone and, in fact, it might work even better on your phone by making a few tweaks that I will outline as Nexus one doesn’t allow jacking into the call streams directly but your phone might.


So, let’s begin. My visioned scenario is like this:

1. When you start a call (incoming or outgoing), i.e., when both the parties have picked up the phone, a notification should appear in the status bar.

2. Clicking on this notification should start recording the call. It should also give way to another notification now.

3. This new notification should stop the call recording when clicked.

4. If you don’t stop the call recording, the recording should automatically stop when the call ends.

To achieve the steps mentioned above, you will have to create “4” profiles in tasker. The xml files for these profiles are provided in a zip at the end of this article that you can download and import into tasker directly. If you want to understand more about whats going on, here are the details of each profile so that you can understand and modify them according to your needs. These profiles are:

Profile 1. Call Started

Tasker description:

Profile: Call started
Event: Phone Offhook
Enter: 11
Execute, Abort New Task
A0: Variable Clear [ Name:%RECORDING ]
A1: Notify [ Title:Record Call Text: Icon: Number: Permanent: ]

Notes: None

Profile 2. Record Call

Tasker description:

Profile: Record call
Event: Notification Click
Enter: Record Call
Execute, Abort New Task
A0: Notify Cancel [ Title:Record Call Warn Not Exist: ]
A1: Variable Set [ Name:%RECORDING To:1 Do Maths: Append: ]
A2: In-Call Volume [ Level:5 Display: Sound: ]
A3: Speakerphone [ Set:On ]
A4: Flash [ Text:Started Recording Long: ]
A5: Notify [ Title:Stop Record Call Text: Icon: Number: Permanent: ]
A6: Record Audio [ File:shantz/call-%CNUM-%CDATE-%CTIME Source:Microphone MaxSize: ]

Notes: Note the steps A2, A3 and A6. Basically Nexus one has a limitation that you cannot record directly from the call streams. So, I’m doing the recording from the microphone and this works best if the phone is in speakerphone mode. So, I’m turning up the call volume and setting speakerphone mode in A2 and A3 respectively. You can try tweaking these 2 steps (having different call volumes and not engaging speakerphone mode and you might have passable results without doing these as well). Also, try using “Call”, “Incoming Call”, “Outgoing Call” etc as sources in step A6 instead of microphone to check if your phone supports direct call stream recording. If it does, then you will have excellent recording quality and you can also remove steps A2 and A3.

Profile 3. Stop Record Call

Tasker description:

Profile: Stop record call
Event: Notification Click
Enter: Stop Record Call
Execute, Abort New Task
A0: Record Audio Stop [ ]
A1: Notify Cancel [ Title:Record Call Warn Not Exist: ]
A2: Notify Cancel [ Title:Stop Record Call Warn Not Exist: ]
A3: Flash [ Text:Stopped Recording Long: ]
A4: Variable Clear [ Name:%RECORDING ]
A5: Speakerphone [ Set:Off ]

Notes: None

Profile 4. Call Complete

Tasker description:

Profile: Call complete
Event: Phone Idle
Enter: Stop Record Call
Execute, Abort New Task
A0: Record Audio Stop [ ]
A1: Notify Cancel [ Title:Record Call Warn Not Exist: ]
A2: Notify Cancel [ Title:Stop Record Call Warn Not Exist: ]
A3: Flash [ Text:Stopped Recording Long: ]
A4: Variable Clear [ Name:%RECORDING ]
A5: Speakerphone [ Set:Off ]

Notes: None

Download: Android Tasker Call Record Profiles

And we are done, you can download the profile xml files in the zip file linked here.

Let me know if you need any clarifications on the above steps. I would also love to get your suggestions to make this better or if you have any of your own tasker tips and tricks. I’ll be posting more of my tasker adventures soon :)

48 comments to Setup Call Recording With Android App Tasker On Nexus One

  • Gowri

    Are you in India? If so, how did you “buy” the app from Android market?

  • @Gowri: I didn’t buy it from the market. Tasker dev has another option to buy it directly from his site (linked in the post) by using paypal. I bought through that mechanism (It also has added advantage that non market version has encryption functionalities while market one doesn’t have due to US restrictions). However, if you do want to buy apps from the market, you can root your phone and install market enabler. It will allow you to fake your service provider and country and you will be able to see paid apps as well.

  • Oscar.

    Hi,

    I tryed your script on my Milestone, it just didn’t work. No audio source supported even if I use Microphone.

    Oscar.

  • @Oscar: Does it create a file with size 0?

  • Bluebell

    If you have Google Voice, then this feature already exists. You simply push “4″ on the dial pad once the call is connected to record. It plays a message indicating that the call is being recorded. I forget what you push to stop, but the point is that it already exists if you use Google Voice.

  • Mat

    Does this work on phones that haven’t been rooted? As I remember searching a while back and coming to the conclusion that this wasn’t possible.

  • Yes. It works on non-rooted phones.my phone is unrooted as well

  • al

    Doesn’t work because during a call I am not able to pull down the top bar and click on notifications. Don’t know Why this is or how to fix it.

  • @al: Press home button and then you will be able to pull down the notification bar (You might also need to unlock the phone after pressing home, if it was locked before the call came in)

  • Recorder does’nt record Telephony downlink instead record from the loudspeaker.

    Some I see a Toast msg “failed to initialise media recorder” Tested on Nexus-1 Froyo 2.2.1

  • Aymen

    @Shantanu Goel
    hi, do you know where i can find the source code for this application? I need this code in order to do finish’s study project :( :( :( i am too later and i can’t find a solution

    regards,
    aymen

  • @Aymen: The tasker app is closed source so you won’t be able to get its source code.

  • Pat

    Thanks for sharing. This looks like a wonderful app.

  • sugar0

    same as this ! Tried on desire rooted djdroid rom

  • sugar0

    this is what i got by enabling the log , http://i.imgur.com/XXIX5.png

  • @bram/sugar0: I’d suggest that you post the log and error in tasker’s official forums (http://groups.google.com/group/tasker?pli=1) so that Pent (Tasker dev) can take a look at it and provide a solution.

  • sugar0

    we are discussing in this thread on google groups http://goo.gl/ouqg . can you see my post at the end ??? i cant post!!!!

  • @sugar0: Yeah I can see your post. It’s taking a bit of time for the posts to appear. I don’t know if it is a google issue or maybe Pent had to moderate all posts since recently the tasker forum is becoming a target for spammers and we were having a lot of spam posts there..

  • sugar0

    Yes, in fact he told me that he moderate the first message because of spam.

  • I investigate that API on android records telephony call only on 1.6 and platform above this version records only through MIC..

    More details of API and Target to test are available here http://bramroid.wordpress.com/2010/08/13/recording-with-android-mediarecorder-api/

  • Bram, are you sure this is an Android limitation and not the phone hardware/firmware’s? I haven’t read anything about this so far..Probably someone who has tried donut as well as later releases on his phone can tell us. I have only a nexus one so can’t try donut builds.

  • sugar0

    but im assuming this profile you created is working for you, what version of android are you running ?

  • @shantanu, could you try the following test case and let me know what is the outcome.

    Step1. Issue a GSM call with headset connected.
    Step2. Start recording after call established.
    Step3. Try to mute the uplink and record downlink

  • sugar0

    eheh the solution was so dumb, if the folder doesen’t exist (shantz is the folder) it returns an error. But i have another problem, it seems not to recognize the variables in the filename: call-%CNUM-%CDATE-%CTIME.3gp i have this now

  • sugar0

    also putting a space between variables didn’t helped much : call – %CNUM – %CDATE – %CTIME.3gp

  • @bram: I’ll try the test, however it won’t work I know as Nexus one doesn’t support it. Infact all HTC phones I’ve owned so far including WM5/6 ones didn’t support tapping into the call stream directly.

    @sugar0: For me the profile works by recording from speaker as I mentioned in the post. Also, no idea about why it is not recognizing the variables. Are you using 1.0.10 tasker?

  • sugar0

    yes, latest version

  • ACB

    Excuse my ignorance, but I seem unable to import the xml archive I downloaded. I did the following:

    1. Extraced the zip contents into a folder on my SD card.
    2. Selected Tasks
    3. Pressed Menu and selected Import. A directory listing of the SD card comes up.
    4. A Dialog box with the path to the directory comes up and nothing happens.

    At the end I tap the Cancel button.

  • ACB

    Figured it out.

    For those newbies who have a similar problem these are the steps;

    1. Place the XML files in the sdcard/ Tasker/profiles folder.
    2. Hit menu and choose the Profile Data option.
    3. Select the Import One Profile option.

  • Brian

    When trying to import the 2nd xml I’m getting

    Error import Record_call.prf.xml ignoring import task with existing name, please delete first.

    On htc incredible android 2.2, anyone else getting this? I tried renaming some variables but not sure what needs to be done to make it work properly.

  • Brian, you might already have some task in your profiles with the same name as the tasks in my profile have..

  • I have an Desire with froyo and all I get are 0 sized files. This also seems to drain battery very fast and tasker is freezing (force-close).
    It appears like the recording never stops (hence the 0 sized files) and I don’t know why…
    Any clues?

    10x

  • I had faced the same issue initially. Make sure that you use “microphone” as the source for recording and nothing else.

  • Jerard

    I would like to know if it’s possible to have the recording start automatically. Maybe combine Profile 1 and 2. (?)

  • It worked. Sadly is useless if it only works with speakerphone on. Thanks!

  • Actually this is how I’ve set it up. You only need two profiles, one for REC start and one for REC stop. REC start when “phone offhook” and REC stop when “phone idle”. It’s really easy.

  • Jerard

    Dale…thanks for that input. It put me in the right direction. After tinkering for awhile it’s just the way I wanted it.

  • blackixo

    hi

    ive dropped the speakerphone and mic record setting and trying to make the direct recording to work like u said, but… i keep getting this message after i start recording “failed to init media recorder” can anyone help?

  • Joeviocoe

    Thanks for the great tasker setup! I made some serious revisions to your work.

    I wanted to make it completely legit, so I added a disclaimer when recording the distant end.

    I allowed the user to choose to record only their side (without a disclaimer) so they can take voice notes during the call.

    Also, I added a notification to playback the last recording.

    And, instead of using the notification bar (which I cannot get to while in a call, I use a gesture and popups.

    You can find it in the Tasker Wiki as “Record Phone Calls (legal)

    Let me know what you think? Thanks.
    -Joeviocoe

  • Joe, I saw your modifications on the tasker wiki a couple of days ago.. Pretty awesome work :)

  • It works and creates a 3g2 file when I run a test in tasker, but doesn’t create a file when i execute a phone call even though it says “Record Call”. I am guessing it is a security block on the droid X preventing it from recording.

  • ok, let me clarify this better; It does create the file when i press “record call” from the drop down screen, but the 3g2 file has no audio. However it create a 3g2 file with crystal clear audio when i run a test inside Tasker. My only conclusion is that Motorola has a security lock on recording calls, and the samsung don’t.

  • ActionWorks is another very simple to use application that can automate you phone completely.Its very nicely laid out.Try it.

    https://market.android.com/details?id=com.sigmacel.actionsworksfree&feature=more_from_developer

  • Tammy

    This is probably a lame question, but how do I retrieve the recordings?

  • marvin

    I agree with Mark. On my Motorola Photon 4G, after making sure I have created a folder called Recorded in my internal storage (where I have my phone set to store to…some people may use their addon SD card), I test the 2nd profile by pushing the play icon and it prompts me to record either with or without speakerphone, then it proceeds to make a recording called lastcall.3gp that has a tangible length and can be listened to by clicking it in the file explorer…yet when I actually make a call, although everything seems to go as planned, when I check lastcall.3gp it always has a length of 0s & size 0kb. Something in the phone’s root is telling it to disallow any kind of recording while a call is in progress and I bet there’s no Tasker command that can undo that.

  • romeo4all

    Whay no one make a video about making this to work i think that lot of people dont know to accomplished.

  • [...] the microphone an ugly hack, maybe I shouldn't post this… But heck, it's better than nothing… Setup Call Recording With Android App Tasker On Nexus One | Shantanu's Technophilic Musings Some automated scripts to enable speakerphone and record a conversation through the [...]

  • [...] 성공을 하긴 한 것 같더군요. 관심있는 분들께서는 Record Phone Calls, Setup Call Recording With Android App Tasker On Nexus One 를 참고하시면 [...]

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

SUBSCRIBE!





Tweet