1

I'm trying to figure out how I can switch a current call to output audio via the loudspeaker (as if the person was to press "speaker" on the phone app. Ideally, I want to accept the call on loudspeaker; but one step at a time!

I have searched through various headers, both private and non-private frameworks but I can't find the appropriate method to call in order to switch to loudspeaker.

Originally, I expected it would be present in CTCall.h but nothing useful (in this respect) is in there..

Does anyone know where the appropriate method is found?

Many thanks :)

cud_programmer
  • 1,244
  • 1
  • 20
  • 37

1 Answers1

2

Several ideas:

1) Look at system wide event generation. You can click programmatically on required button ("speaker" or "Answer" button). Here are couple of questions regarding this:

Simulating System Wide Touch Events on iOS

Simulating System Wide Touch Events in iOS without jailbreaking the device

How to send a touch event to iPhone OS?

You may be interested to google more on GSEvent which is the key for even simulation.

2) Go to Simulator folder (/Application/XCode/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk

and do something like this

grep -R "Speaker" ./

The idea is to search speaker in binaries (vs header files). Most of private API's aren't documented in header files (that's part of the reason why they are private).

I believe couple of interesting hits are:

  • TelephoneUI private framework
  • AudioToolbox framework (BTW. It even has in .h files following thing: kAudioSessionOverrrideAudioRoute_Speaker)
  • AVFoundation framewokr
  • IOKit* framework (it has kIOAudioOutputPortSubTypeExternalSpeaker in .h files)

and so on.

Next step would be to disassemble them. Most of these frameworks has A LOT of interesting API's which aren't defined in .h files. It's useful to browser through them to check whether you will find anything interesting on this subject.

If you don't want to bother with disassembling, you can get extracted headers from here: https://github.com/nst/iOS-Runtime-Headers/tree/master/PrivateFrameworks

Community
  • 1
  • 1
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184