Tasker to auto record incoming or outgoing call

Tasker to auto record incoming or outgoing call


most of time, i was thinking of tasker can do the job like callrecorder? if yes, how to do?
well, after done some homework, i have figured out the method below to share with you guys. via this method, tasker is able to auto record incoming 
call and outgoing call, unwanted callee and unreached call will be excluded from recording.

before everything, you should create 1 folder named with english characters, eg. Voice, then create 3 separate folders inside this folder, named it as "Incoming", "Outgoing" and "Temp".

NB.

if you are currently using some kind of caller location app, please make sure if it would change the call logs combined phone number and location info with symbol like angle brackets? if yes, tasker would fail to create the new file for outgoing call recording.

Profile 1: (incoming call)  
Context 1: Event- Phone- Offhook 
Context 2: State: Incoming Call 

Task:  

Action 1: variable-Variable Set [ Name:%Oncall To:0]  
Action 2: media-Record Audio [ File: Voice/Incoming/%CNAME_%CDATE_%CTIME  Source: incoming Call/Mic, Code: arm narrowband, format: raw_arm  ]  
Action 3: alert-Notify [Title:Recording Call Icon:(any icon)]

PS. you may put action 2 and 3 together as a separate task, then make it as a pop up alert positive button right after action 1, asking if you wanna 
record.


Profile 2: (outgoing Temp)

Context: State: outgoing Call 


Task: 

Action 1: task-If, %CONUM !~ XXXXX       # XXXX stands for the phone number which you don't wish to record
Action 2: variable-Variable Set [ Name:%Oncall To:1]  
Action 3: media-Record Audio [ File: Voice/Temp/    Source:ouggoing Call/Mic Code: arm narrowband, format: raw_arm  ]    
Action 4: alert-Notify [Title:Recording Call Icon:(any icon)]

PS. you may put action 2 and 3 together as a separate task, then make it as a pop up alert positive button right after action 1, asking if you wanna 
record.


Profile 3: (stop recording) 

Context: Event-phone-Phone Idle 

Task: 

Action 1: media-Record Audio Stop
Action 2: alert-Notify Cancel, title: Recording Call
Action 3: task-If %Oncall ~ 1
Action 4: script-run shell, command:

sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db "select duration from calls where type <= 2 order by date desc limit 1;"   

use root checked, store result in %COUNT

# this step is very important, cause we may know, tasker even sl4a script could not detect if the callee has picked up the phone. if duration is 0, i guess you don't wish to waste storage to record the ringtone, right? this shell command would extract the value of duration for the last phone call 
you have made.

Action 5: File--Move [ From: Voice/Temp/.amr  To: Voice/Outgoing/%CONAME_%CODATE_%COTIME.amr  If,  %COUNT > 0 ]        

# Based on action 4 run result, tasker may detect and exclude the unreached outgoing phone call. so it would not waste storage space at all.

cause the recording would just start right from the moment while dialing.

Action 6: task-end if

Action 7: variable-variable clear, name: %Oncall

##  duration counting  via sqlit 3 command

if we look into the calllogs within android default call database, we will see some significant columns, which are very useful for us to get this job done.

type: (numberic)

3: incoming missed call,  2: outgoing call(reached or unreached)  1: incoming call(offhook)

duration: (seconds)

order by date desc limit 1: this is to identify and select the last one in record.

posted @   IAmAProgrammer  阅读(790)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
点击右上角即可分享
微信分享提示