UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    [How-To] Record Calls

    Scheduled Pinned Locked Moved Support
    73 Posts 12 Posters 17.5k Views 12 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • F Offline
        FP3plusRT
        last edited by

        Great.
        Works under OTA-24 on FairPhone 3+.
        Saves me from taking notes during a call.

        1 Reply Last reply Reply Quote 0
        • Br1B Br1 referenced this topic on
        • Br1B Offline
          Br1
          last edited by

          --------- UPDATE ---------

          I am glad you enjoyed 🙂 ... new version to install/uninstall with single command, see here for further information.

          The previous version must be uninstalled and the device rebooted, but first save the recorded calls or they will be deleted.

          New features :

          • install script asks you how many days you want to keep recorded calls, hit enter for default (30 days)
            if you later decide to change, repeat the installation (in this case reboot not required)

          • recorded calls are named with their recording start time

          three steps :

          1 - download (just click) callrecorder.1.02.tar.gz from here

          2 - open file manager, go to Downloads click callrecorder.1.02.tar.gz and select extract archive

          3 - open terminal and type :

          sudo /home/phablet/Downloads/callrecorder.1.02/callrec-install
          

          type 1 to install
          type 2 to uninstall
          type 3 to exit

          and reboot, that's all.

          Changelog :

          I added a new script that is run daily by crontab, keep-rec-sh :

          #!/bin/bash
          # 
          days=+30
          # delete recordings older than ... days
          find /home/phablet/MyRec/* -mtime $days -exec rm {} \; 2> /dev/null ;
          

          preview of the new version of callrec_install :

          #!/bin/bash
          
          CRSERV=/etc/init.d/callrecorder ;
          
          # Make sure only root can run this script
          if [ "$(id -u)" != "0" ]; then
             echo "    Must be run as root, you must prepend sudo !" 1>&2 ; exit 1
          fi
          
          echo -e '\n - Install/uninstall CallRecorder :\n' ;
          
          PS3='Please enter your choice : '
          options=("Install" "Uninstall" "Quit")
          select opt in "${options[@]}"
          do
          	case $opt in
          	"Install")
          
          			#   -------------------- already installed section ------------------------------
          
          			crontab -l | grep -q 'keep-rec-sh' ;
          
          			if [ $? = 0 ] ; then
          
                                                  echo -e '\n Recorded calls : auto erase them after' ;
          
                                                  read -p " how many days ? (hit enter for 30) : " days
          
          					# --------------- default days section --------------------------
          
          					#if pressed ENTER set default days
          					if [ ${#days} -eq 0 ];	then days=+30 ;
          
          					# remove + for echo message
          					myString="${days:1}" ; echo -e "\n  - Will be deleted after $myString days. \n" ;
          
          					# replaces the third line
          					sed -i "3s/.*/days=$days/" /home/phablet/.callrec/keep-rec-sh ;
          
          					exit 0
          
          					else	# -------- custom days section  -------------------------
          
          					echo -e "\n  - Will be deleted after $days days. \n" ;
          
          					days=+$days ;
          
          					# replaces the third line
          					sed -i "3s/.*/days=$days/" /home/phablet/.callrec/keep-rec-sh ;
          
          					exit 0
          
          					fi
          
          
          			fi
          
          			#   ----------- end already installed -------------------------------------------
          
          
          			# ------------- new install section ---------------------------------------------
          
          
          			# creates 3 directories
          			mkdir -p /home/phablet/.callrec ;
          			mkdir -p /home/phablet/MyRec ;
          			mkdir -p /home/phablet/.cr_Ram ;
          
          			cp /home/phablet/Downloads/callrecorder.1.02/* /home/phablet/.callrec/ ;
          
          			# change the working directory
          			cd /home/phablet/.callrec ;
          
          			# mount root in read/write mode
          			mount -o remount,rw / ;
          
          			# set daily check at 11 am
          			crontab -l > cron_bkp ; echo "0 11 * * * /home/phablet/.callrec/keep-rec-sh >/dev/null 2>&1" >> cron_bkp ;
          			crontab /home/phablet/.callrec/cron_bkp ; rm /home/phablet/.callrec/cron_bkp ;
          
          			# copy callrecorder service and enable autostart
          			cp callrecorder /etc/init.d/ ; update-rc.d callrecorder defaults ;
          
                                                  echo -e '\n Recorded calls : auto erase them after' ;
          
                                                  read -p " how many days ? (hit enter for 30) : " days
          
          						# --------------- default days section ------------------
          
          						#if pressed ENTER set default days
          						if [ ${#days} -eq 0 ];	then days=+30 ;
          
          						# remove + for echo message
          						myString="${days:1}" ; echo -e "\n  - Will be deleted after $myString days. \n" ;
          
          						# replaces the third line
          						sed -i "3s/.*/days=$days/" /home/phablet/.callrec/keep-rec-sh ;
          
          						else  # -------- custom days section --------------------
          
          						echo -e "\n  - Will be deleted after $days days. \n" ;
          
          						days=+$days ;
          
          						# replaces the third line
          						sed -i "3s/.*/days=$days/" /home/phablet/.callrec/keep-rec-sh ;
          
          						fi
          
          			# roll back root in read only mode
          			mount -o remount,ro / ;
          
          			echo -e '\n Installed, reboot your device !\n' ;
          
          			exit 0
          
          		;;
          
          	"Uninstall")
          
          			# check status
          			if [ ! -f "$CRSERV" ]; then
          
          			echo -e '\n CallRecorder is not installed !\n' ; exit 1
          
          			else
          
          			# mount root in read/write mode
          			mount -o remount,rw / ;
          
          			# stop callrecorder, disable autostart and remove service file
          			service callrecorder stop ; update-rc.d -f callrecorder remove ; rm /etc/init.d/callrecorder ;
          
          			# remove line from crontab
          			crontab -l | grep -v 'keep-rec-sh' | crontab - ;
          
          			# roll back root in read only mode
          			mount -o remount,ro / ;
          
          			# delete scripts and remove directories
          			rm -rf /home/phablet/.callrec/* ; rmdir /home/phablet/.callrec ;
          			rm -rf /home/phablet/.cr_Ram/* ;
          
          			echo -e '\n Uninstalled, reboot your device !\n'
          
          			exit 0
          
          			fi
          
          		;;
          
                  "Quit")
          			exit 0
          		;;
          			*) echo "invalid option $REPLY"
          		;;
              esac
          done
          
          

          and preview of new version of manager.sh :

          #!/bin/sh
          
          while true
          
          do
          
          FL1=/home/phablet/.cr_Ram/Rec_Call/fl1 ;
          FL2=/home/phablet/.cr_Ram/Rec_Call/fl2 ;
          FL3=/home/phablet/.cr_Ram/Rec_Call/fl3 ;
          RecDir=/home/phablet/MyRec ;
          HomDir=/home/phablet/.cr_Ram/Rec_Call ;
          
          # if fl1 exist ini.sh intercepted outgoing or incoming call
          if [ -f "$FL1" ]; then
          	#
          	setName=$(date +'%d-%m-%Y_%H:%M:%S') ;
          	# deletes temporary file and starts recording as phablet user (with .new extension)
          	rm -f $FL1 ; su phablet -s /usr/bin/arecord /home/phablet/MyRec/"$(date +%H_%M_%S)".wav.new &
          fi
          
          # if fl2 exist call has ended
          if [ -f "$FL2" ]; then
          	# deletes the temporary file and stop recording
          	rm -f $FL2 ; pkill -f arecord ; sleep 0.2 ;
          	# if fl3 exist call was answered
          	if [ -f "$FL3" ]; then
          		#
          		FLN=$(cat /home/phablet/.cr_Ram/Rec_Call/fln) ;
          		# delete .new extension and exec three scripts
          		rm -f $FL3 ; mv $RecDir/*.new $RecDir/$setName.wav ;  $HomDir/ini.sh & $HomDir/ter.sh & $HomDir/ris.sh &
          		else
          		# call was not answered
          		# delete recording and exec two scripts
          		rm $RecDir/*.new ; $HomDir/ini.sh & $HomDir/ter.sh &
          	fi
          
          fi
          
          sleep 1 ;
          
          done ;
          
          

          . small differences in other scripts (new paths)

          . now uninstall procedure does not delete recorded calls

          . the working directory is now hidden (.cr_Ram)

          . the previous version is available here

          ^

          • Google Pixel 3a XL
          • Xiaomi MI A2
          1 Reply Last reply Reply Quote 2
          • Br1B Offline
            Br1
            last edited by

            OTA-25 --- You can reinstall, no changes are necessary.

            ^

            • Google Pixel 3a XL
            • Xiaomi MI A2
            D 1 Reply Last reply Reply Quote 2
            • KenedaK Keneda referenced this topic on
            • D Offline
              domubpkm @Br1
              last edited by domubpkm

              @Br1 Given the recent boot problems in RC on which I was, I had to reflash the Volla in RC (using the installer without wipe) on which the first short version of the recorder was installed. The recorder was no longer installed, all the files of the recorder yes.
              I pass steps, but I installed the last version of the recorder: I have to check that it works but I have a doubt since these boot problems... I'll keep you up-to-date.

              1 Reply Last reply Reply Quote 0
              • D Offline
                domubpkm
                last edited by domubpkm

                @Br1 So on my Volla in RC, I uninstalled recorder 1.02. I reflashed in RC (without wipe) with the installer, and reinstalled the recorder. Everything seems to be in place, but i confirm no recordings are made. I tried multiple uninstalls and reinstalls and nothing changed. After my first reinstallation, I had the message 'no crontab for root' which never reappeared in my installations after.
                screenshot20230416_180738966.png

                Edit : I retested version 1.01 and no record created either.

                IanI 1 Reply Last reply Reply Quote 2
                • IanI Online
                  Ian @domubpkm
                  last edited by

                  @domubpkm No crontab? Have you seen

                  https://forums.ubports.com/topic/8868/cron-not-installed

                  D RayCulpR 2 Replies Last reply Reply Quote 1
                  • D Offline
                    domubpkm @Ian
                    last edited by domubpkm

                    @Ian All I know is that for me (and for others ?), the recorder hasn't worked since the last RC, whereas it worked very well before: I don't know why. 😉

                    Hello @lduboeuf . Do you think something has changed in the latest RCs that could prevent callrecorder from working? Even 1.01 doesn't record calls. Thanks.

                    1 Reply Last reply Reply Quote 0
                    • RayCulpR Offline
                      RayCulp @Ian
                      last edited by RayCulp

                      @Ian In the past with UT16, I used cron jobs to start Syncevolution on a schedule to sync my contacts (address books) with my CardDav server. However, after I updated to UT20 via OTA and performed a hard reset of the OS, the crontab command is no longer found:

                      048919fa-485f-4ade-96e5-ffca6947c95a-image.png

                      Also, when I search for "cron*", all it finds are the bash tab-completions:

                      11364f03-46a4-49ef-966c-d7ffc0178b3d-image.png

                      It is also my understanding that the scripts in the "/usr/share/bash-completion/completions" folder are provided by the packages that install the commands and utilities they complete. So this would indicate that cron/crontab was initially present but later removed.

                      Happily running Ubuntu Touch on:
                      Google Pixel 3a XL (20.04 Stable)

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        domubpkm
                        last edited by

                        RC 64 Volla
                        screenshot20230417_083503805.png

                        RayCulpR 1 Reply Last reply Reply Quote 0
                        • RayCulpR Offline
                          RayCulp @domubpkm
                          last edited by

                          @domubpkm Thank you, but I'm confused. Does this mean that cron is indeed available on UT 20.04?

                          In any case, I asked about cron in one of the Telegram groups just now, and the recommendation I received was to use systemd timers instead of cron jobs. I hope this helps! 🙂

                          Happily running Ubuntu Touch on:
                          Google Pixel 3a XL (20.04 Stable)

                          1 Reply Last reply Reply Quote 0
                          • Br1B Offline
                            Br1
                            last edited by

                            @domubpkm Between ota 25 (xenial) and the RC release there could be many differences ... I will try to adapt call-recorder to Focal OTA-2 Stable, but no promises.

                            ^

                            • Google Pixel 3a XL
                            • Xiaomi MI A2
                            D 2 Replies Last reply Reply Quote 3
                            • D Offline
                              domubpkm @Br1
                              last edited by domubpkm

                              @Br1 The callrecorder should work for OTA-25. If there is an OTA-26 that fixes boot issues (last 3 RCs), no. Is not it ?

                              Edit : I did : anyway, OTA-25 is no longer installable, the dev channel is installed instead (system parameters). So no more callrecorder.

                              Edit 2 april 18 : i installed dev 1111 (2023-04-18/2) and callrecorder v 1.01 works ! I stay here until a focal that suits me. 🙂

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                domubpkm @Br1
                                last edited by

                                @Br1 said in [How-To] Record Calls:

                                I will try to adapt call-recorder to Focal OTA-2 Stable, but no promises

                                I just hope your work is progressing as you wish, because all of your scripts are great and will enhance focal environment (as they do for xenial).

                                Br1B 1 Reply Last reply Reply Quote 0
                                • Br1B Offline
                                  Br1 @domubpkm
                                  last edited by

                                  @domubpkm said in [How-To] Record Calls:

                                  I just hope your work is progressing as you wish, because all of your scripts are great and will enhance focal environment (as they do for xenial).

                                  I installed it yesterday, seems to work fine ... a few days of testing 🙂

                                  ^

                                  • Google Pixel 3a XL
                                  • Xiaomi MI A2
                                  1 Reply Last reply Reply Quote 1
                                  • Br1B Offline
                                    Br1
                                    last edited by Br1

                                    ---- UPDATE OTA-2 Focal ----
                                    ---- Stable Channel ----

                                    Usual three steps :

                                    1 - download callrecorder-ota.2.tar.gz from here : www.spacelinux.it/UTouch/callrecorder-ota.2.tar.gz

                                    2 - open file manager, go to Downloads tap callrecorder-ota.2.tar.gz and tap extract archive

                                    3 - open terminal, type :

                                    sudo Downloads/callrecorder-ota.2/callrec-install
                                    

                                    and hit enter,

                                    type 1 + enter to install

                                    type 2 + enter to uninstall

                                    and reboot.


                                    As in previous versions, install script asks you how many days you want to keep recorded calls, hit enter for default (30 days) if you later decide to change, repeat the installation (in this case reboot not required).

                                    Focal required several changes, callrecorder now is a systemd service, to delete older calls there is a systemd user timer .

                                    preview of the new version of callrec-install :

                                    #!/bin/bash
                                    
                                    CRSERV=/usr/lib/systemd/system/callrecorder.service ;
                                    
                                    # Make sure only root can run this script
                                    if [ "$(id -u)" != "0" ]; then
                                       echo "    Must be run as root, you must prepend sudo !" 1>&2 ; exit 1
                                    fi
                                    
                                    echo -e '\n - Install/uninstall CallRecorder :\n' ;
                                    
                                    PS3='Please enter your choice : '
                                    options=("Install" "Uninstall" "Quit")
                                    select opt in "${options[@]}"
                                    do
                                    	case $opt in
                                    	"Install")
                                    
                                    			#   -------------------- already installed section ------------------------------
                                    
                                    			if [ -f "$CRSERV" ]; then
                                    
                                                                            echo -e '\n Recorded calls : auto erase them after' ;
                                    
                                                                            read -p " how many days ? (hit enter for 30) : " days
                                    
                                    					# --------------- default days section --------------------------
                                    
                                    					#if pressed ENTER set default days
                                    					if [ ${#days} -eq 0 ];	then days=+30 ;
                                    
                                    					# remove + for echo message
                                    					myString="${days:1}" ; echo -e "\n  - Will be deleted after $myString days. \n" ;
                                    
                                    					# replaces the third line
                                    					sed -i "3s/.*/days=$days/" /home/phablet/.callrec/rec-remove-sh ;
                                    
                                    					exit 0
                                    
                                    					else	# -------- custom days section  -------------------------
                                    
                                    					echo -e "\n  - Will be deleted after $days days. \n" ;
                                    
                                    					days=+$days ;
                                    
                                    					# replaces the third line
                                    					sed -i "3s/.*/days=$days/" /home/phablet/.callrec/rec-remove-sh ;
                                    
                                    					exit 0
                                    
                                    					fi
                                    
                                    
                                    			fi
                                    
                                    			#   ----------- end already installed -------------------------------------------
                                    
                                    
                                    			# ------------- new install section ---------------------------------------------
                                    
                                    
                                    			# creates 4 directories
                                    			mkdir -p /home/phablet/.callrec ;
                                    			mkdir -p /home/phablet/MyRec/{saved,} ;
                                    			mkdir -p /home/phablet/.cr_Ram ;
                                    
                                    			cp /home/phablet/Downloads/callrecorder-ota.2/* /home/phablet/.callrec/ ;
                                    
                                    			# change the working directory
                                    			cd /home/phablet/.callrec ;
                                    
                                    			# mount root in read/write mode
                                    			mount -o remount,rw / ;
                                    
                                    			# copy callrecorder service and enable autostart
                                                            cp callrecorder.service /usr/lib/systemd/system/ ; systemctl enable callrecorder > /dev/null 2>&1 ;
                                    
                                    			# roll back root in read only mode
                                    			mount -o remount,ro / ;
                                    
                                    			# copy rec-remove.service/timer and create simbolic link (as user)
                                    			su - phablet -c "cd /home/phablet/.callrec ; cp rec-remove.service rec-remove.timer /home/phablet/.config/systemd/user/ ; ln -s /home/phablet/.config/systemd/user/rec-remove.timer /home/phablet/.config/systemd/user/default.target.wants/rec-remove.timer" ; 
                                    
                                    
                                                                            echo -e '\n Recorded calls : auto erase them after' ;
                                    
                                                                            read -p " how many days ? (hit enter for 30) : " days
                                    
                                    						# --------------- default days section ------------------
                                    
                                    						#if pressed ENTER set default days
                                    						if [ ${#days} -eq 0 ];	then days=+30 ;
                                    
                                    						# remove + for echo message
                                    						myString="${days:1}" ; echo -e "\n  - Will be deleted after $myString days. \n" ;
                                    
                                    						# replaces the third line
                                    						sed -i "3s/.*/days=$days/" /home/phablet/.callrec/rec-remove-sh ;
                                    
                                    						else  # -------- custom days section --------------------
                                    
                                    						echo -e "\n  - Will be deleted after $days days. \n" ;
                                    
                                    						days=+$days ;
                                    
                                    						# replaces the third line
                                    						sed -i "3s/.*/days=$days/" /home/phablet/.callrec/rec-remove-sh ;
                                    
                                    						fi
                                    
                                    			echo -e '\n Installed, reboot your device !\n' ;
                                    
                                    			exit 0
                                    
                                    		;;
                                    
                                    	"Uninstall")
                                    
                                    			# check status
                                    			if [ ! -f "$CRSERV" ]; then
                                    
                                    			echo -e '\n CallRecorder is not installed !\n' ; exit 1
                                    
                                    			else
                                    
                                    			# mount root in read/write mode
                                    			mount -o remount,rw / ;
                                    
                                    			# stop callrecorder, disable autostart and remove files
                                    			systemctl disable --now callrecorder > /dev/null 2>&1 ;
                                    			rm $CRSERV ;
                                    
                                    			# roll back root in read only mode
                                    			mount -o remount,ro / ;
                                    
                                    			# remove all timer files
                                    			rm /home/phablet/.config/systemd/user/rec-remove* ;
                                    			rm /home/phablet/.config/systemd/user/default.target.wants/rec-remove.timer ;
                                    			rm /home/phablet/.local/share/systemd/timers/stamp-rec-remove.timer ;
                                    
                                    			# delete scripts and remove directories
                                    			rm -rf /home/phablet/.callrec/* ; rmdir /home/phablet/.callrec ;
                                    			rm -rf /home/phablet/.cr_Ram/* ;
                                    
                                    			echo -e '\n Uninstalled, reboot your device !\n'
                                    
                                    			exit 0
                                    
                                    			fi
                                    
                                    		;;
                                    
                                            "Quit")
                                    			exit 0
                                    		;;
                                    			*) echo "invalid option $REPLY"
                                    		;;
                                        esac
                                    done
                                    

                                    preview of callrecorder service :

                                    [Unit]
                                    Description=Call Recorder
                                    
                                    [Service]
                                    Type=simple
                                    ExecStart=/home/phablet/.callrec/prepare-sh
                                    RemainAfterExit=yes
                                    
                                    [Install]
                                    WantedBy=multi-user.target
                                    

                                    systemd user timer requires 2 files, rec-remove.timer :

                                    [Unit]
                                    Description=Run every day at 11:00
                                    
                                    [Timer]
                                    OnCalendar=*-*-* 11:00
                                    Persistent=true
                                    
                                    [Install]
                                    WantedBy=default.target
                                    

                                    and rec-remove.service :

                                    [Unit]
                                    Description=Remove older calls
                                    
                                    [Service]
                                    Type=simple
                                    ExecStart=/home/phablet/.callrec/rec-remove-sh
                                    
                                    [Install]
                                    WantedBy=default.target
                                    

                                    to run daily the script rec-remove-sh :

                                    #!/bin/bash
                                    #
                                    days=+30
                                    # delete recordings (except saved directory) older than ... days
                                    find /home/phablet/MyRec -type f -not -path '*/saved/*' -mtime $days -exec rm {} \; 2> /dev/null ;
                                    

                                    . small change, now you can save recorded calls in "saved" folder and will not be deleted

                                    . small differences in other scripts (new paths)

                                    . as for previous versions callrecorder must be uninstalled before proceeding to ota update.

                                    ^

                                    • Google Pixel 3a XL
                                    • Xiaomi MI A2
                                    A D 2 Replies Last reply Reply Quote 1
                                    • A Offline
                                      ATTESA @Br1
                                      last edited by

                                      @Br1 I don't know if it is just me, but the download link does not seem to work, I get a Not Found error.

                                      Br1B 1 Reply Last reply Reply Quote 0
                                      • Br1B Offline
                                        Br1 @ATTESA
                                        last edited by

                                        @ATTESA try direct link : www.spacelinux.it/UTouch/callrecorder-ota.2.tar.gz

                                        ^

                                        • Google Pixel 3a XL
                                        • Xiaomi MI A2
                                        1 Reply Last reply Reply Quote 0
                                        • D Offline
                                          dosolly @Br1
                                          last edited by

                                          @Br1 Hallo, thanx a lot for your work, but :
                                          :~/sudo Downloads/callrecorder-ota.2/callrec-install

                                          :~/sudo: callrec-install:command not found

                                          Br1B 1 Reply Last reply Reply Quote 0
                                          • Br1B Offline
                                            Br1 @dosolly
                                            last edited by

                                            @dosolly
                                            On a hunch I did it again and works ... you have extracted it ?

                                            in Downloads directory there should be "callrecorder-ota.2" subdirectory that also contains "callrec-install"

                                            ^

                                            • Google Pixel 3a XL
                                            • Xiaomi MI A2
                                            D 2 Replies Last reply Reply Quote 0
                                            • D Offline
                                              dosolly @Br1
                                              last edited by

                                              @Br1 Thanks for your help, at least the installation worked. Now I have to test it extensively.

                                              1 Reply Last reply Reply Quote 0
                                              • First post
                                                Last post