Write a phone call recorder on iOS 8 step by step

What’re you referring to by “other apps”?

i am talking about opengsm app, which you can find in this cydia repo http://cydia.myrepospace.com/opengsm. and even thought they are saying that it works on 4s as well in their site, but when I tested their app it was making call records as well on this phone as well.

I’ll take a look at this tweak, and you can also reverse engineering it by referring to the book

Hey @snakeninny thanks for the great work.

I have installed your .deb and it works perfectly! It saves the m4a in the DCIM folder.

However, when I follow your instructions very closely I get no errors. I can make, package and install… again, no errors. But when I begin a call it does not save any audio. Because I don’t get any errors during compilation, and because it installs perfectly I’m not sure why my version isn’t saving audio.

I have not made any changes to any steps or any code.

Is it possible to upload your theos project so I can attempt to build it on my machine? Also, I have upload my project for you to look at in case I made a mistake. http://arraymo.de/example.zip

Thanks!

iOSRECallRecorder.zip (5.9 KB)

So again your code builds fine and make package install works great however it still doesn’t record calls.

See this log:

 Wes-MacBook-Pro:ios wes$ make package install
 Making all for tweak iOSRECallRecorder...
 Preprocessing Tweak.xm...
 Compiling Tweak.xm...
 Linking tweak iOSRECallRecorder...
 Stripping iOSRECallRecorder...
 Signing iOSRECallRecorder...
 Making stage for tweak iOSRECallRecorder...
 dpkg-deb: building package `com.naken.iosrecallrecorder' in `./com.naken.iosrecallrecorder_1.0- 1_iphoneos-arm.deb'.
 install.exec "cat > /tmp/_theos_install.deb; dpkg -i /tmp/_theos_install.deb && rm  /tmp/_theos_install.deb" < "./com.naken.iosrecallrecorder_1.0-1_iphoneos-arm.deb"
 root@192.168.1.73's password: 
 tar: ./control: time stamp 2015-06-30 09:45:13 is 3.034484 s in the future
 tar: .: time stamp 2015-06-30 09:45:13 is 3.022323 s in the future
 Selecting previously deselected package com.naken.iosrecallrecorder.
 (Reading database ... 1190 files and directories currently installed.)
 Unpacking com.naken.iosrecallrecorder (from /tmp/_theos_install.deb) ...
 Setting up com.naken.iosrecallrecorder (1.0-1) ...
 install.exec "killall -9 mediaserverd"
 root@192.168.1.73's password: 
 Wes-MacBook-Pro:ios wes$ 

Im starting to think the reason your .deb file works is because you have used a different version of theos. When your code is compiled with the latest branch there are no errors and it installs on the device perfectly however it does not record calls.

Is there any light you can shed on this problem?
Thanks for your time.

I’m currently running the latest Theos from DHowett

Ah, me too. Any other information you can give me, or any pointers on how to get diagnostic information so I can see why it builds and installs perfectly but doesn’t run like your deb does?

I’ve no idea what was wrong. Maybe you should take a look at the syslog and see if there’s anything helpful

Thank you @snakeninny that was really great advice. I’ve almost got to the bottom of it.

When I build your code and install I can see this in the syslog:

Jun 30 14:04:38 Wes mediaserverd[3056]: MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/iOSRECallRecorder.dylib
Jun 30 14:04:38 Wes mediaserverd[3056]: MS:Error: dlopen(/Library/MobileSubstrate/DynamicLibraries/iOSRECallRecorder.dylib, 9): no suitable image found.  Did find:
		/Library/MobileSubstrate/DynamicLibraries/iOSRECallRecorder.dylib: mmap() error 22 at address=0x1000F8000, size=0x00008000 segment=__TEXT in Segment::map() mapping /Library/MobileSubstrate/DynamicLibraries/iOSRECallRecorder.dylib

However when I install you pre-build .deb I get this

Jun 30 13:52:21 Wes mediaserverd[2792]: MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/iOSRECallRecorder.dylib

So the problem lies somewhere during the compilation phase. However Theos does’t give me any errors. The code is identical to yours and I’m using the latest Theos. I am trying to install on iPhone6 iOS8. Your package works so I’m just unsure if I am missing a command.

Thanks again!

What’s your iOS version? And can you upload your compiled iOSRECallRecorder.dylib?

Sure, iOS 8.3 and here is the file http://arraymo.de/iOSRECallRecorder.dylib

I’m starting to think “no suitable image found” could be an issue with Theos not building for arm64. But arm64 is in the ARCHS so I am lost.

This error message is the key. This thread talks about a similar error, but remains unsolved too.

Hi,

I been trying to compile the project, even using the one you uploaded but I get the following error when trying to run make package:

Tweak.xm:257:2: error: no matching function for call to ‘MSHookFunction’
MSHookFunction(AudioUnitProcess, AudioUnitProcess_hook, &AudioUnitProcess_orig);
^~~~~~~~~~~~~~
/Users/xxxxx/Documents/4675bd08aef3fa027f7ff2db2093a81947eccdd9/theos/include/substrate.h:11:6: note: candidate function not viable: no known conversion from ‘OSStatus (AudioUnit,
AudioUnitRenderActionFlags *, const AudioTimeStamp *, UInt32, AudioBufferList *)’ to ‘void *’ for 1st argument
void MSHookFunction(void *symbol, void *replace, void **result);

please let me know what I am doing wrong or what I’m missing, thanks a lot!

I’m running on mac os mavericks and the device iOS version is 8.1, thanks.

Try converting

MSHookFunction(AudioUnitProcess, AudioUnitProcess_hook, &AudioUnitProcess_orig);

to

MSHookFunction((void *)AudioUnitProcess, (void *)AudioUnitProcess_hook, (void **)&AudioUnitProcess_orig);

and recompile

Does it works on latest ios? (with jailbreak?) someone has test it?

I built the project, successfully, and I used it on iOS 8.1 with an iPhone 5s. It was able to record correctly. I tested the logic on my iPad 2 on iOS 8.4 but didn’t test calling because I can’t call. Logged various aspects and it seemed like it would work on 8.4 too.

One issue I have noticed is that audio can become very choppy while you are recording. Anyone else experiencing the same? Don’t know what the cause is - my 5s should surely be powerful enough to process audio and write to a file at the same time. I can attach one of the resulting .caf files if matters.

1 个赞

thanks very much! but it not success on 8.3, i used iphone 5s and install success , but when calling it not record, result alway 28byte :frowning: . How fix ? thanks you

1 个赞

I don’t have an 8.3 device, but according to @fewjative, the code seems to be alright on 8.4 too, maybe you can have a talk with him