How could I stop re-routing off audio output when in call?

Discussion in 'iOS Development' started by CQoute, Jun 14, 2012.

  1. CQoute New Member

    Member Since:
    Jun 14, 2012
    Message Count:
    4
    Device:
    iPhone 3GS (White)
    This issue happens for both Voice Control and Phone calls where the usb output will get cut off and no longer a valid route, then when the phone call is finished the audio will revert back to usb (Car Head Unit). I have tried tackling this for a while now and I only wish to achieve this so I can answer a call while docked in my car or make a voice command and hear the result via car speakers. Other wise i cant hear anything as my phones loud speakers are kinda dying...

    I have hooked MobilePhone.app -> AudioDeviceController and through some logging, even though the usb connection is in, _pickableRoutes will never return a usb connection (Only reciever or speaker). I also find from a log for a VoiceControl (Can't remember which class, i think SBVoiceControlAlertDisplay) but I logged a method which displayed that it used a PhoneCall class during its audio routing methods. Has anyone had experience with this? Could anyone point me to the right area to explore? I have been at this for way too long leading me too ask for help!
  2. An Outright Nihilist Well-Known Member

    Member Since:
    May 22, 2012
    Message Count:
    1,337
    Device:
    5G iPod touch
    Oh..., I think I get what you are saying, but correct me if I am wrong. You want you iPhone to boost the sound through the car speakers, but they do not right? Time to get new speakers compatible with your iDevice. This happens occationally. Since iOS 5, which I presume you have, had its upgrade, the Phone.app had pretty much a total makeover. Yet, Music.app did not get much except letting you delete songs. So, while your car speakers can interact with the Music.app, it cannot do so with the Phone.app, due to the new coding/framework and its new algorithms. If your car has a sort of system and it is update-able, like some cars out there (Audi I think), go update it to the newest version. Or else, crudely, I'd say;"Get a new car!", but I am not crude.
  3. CQoute New Member

    Member Since:
    Jun 14, 2012
    Message Count:
    4
    Device:
    iPhone 3GS (White)
    No, This has been a problem ever since i had my car (even before ios 5, just google this problem and you will find its an apple software restriction), where the output audio source would remove the usb audio route during a call or voice command.. Every other sound will play through the usb (including, system sounds, app sounds etc.) but not PhoneCalls or VoiceCommands. This is not a head unit problem either as the switch is made from the iphone which the head unit has no control over. Also in regards to get a new car... honestly i think a new stereo unit would be much more cheaper :/. Also just note and clarify that even during the MobilePhone.app, I can still get sounds output through car speakers (dial tones etc.) until I make a call or receive a call
  4. An Outright Nihilist Well-Known Member

    Member Since:
    May 22, 2012
    Message Count:
    1,337
    Device:
    5G iPod touch
    OK, then this is software. So, as I have said, you should have a problem with the stereo, not the iPhone, because it is made to support as much as it can, but not everything is supported. Either that or the manufacturer of the product conforms to the iPhone. There is this antiquated way to allow all things to go through. Get SBSettings if you are jailbroken. Once done, go into the app and scroll down to the system options section and enter. Go ahead and press the "Fix User Dir Permissions" button and take a look at what they tell you. Agree and it would respring soon after, if on iOS 5. It would allow nearly all stuff to be open to whatever you do. If it does not work, I have an even older method, which includes going to the launch daemon guarding this process and manually churn through code to fix this. Not recommended and anyway, I did it on iOS 3 and do not know whether it still works.
  5. CQoute New Member

    Member Since:
    Jun 14, 2012
    Message Count:
    4
    Device:
    iPhone 3GS (White)
    Its jailbroken thats how i hooked those classes / frameworks and apps mentioned above. Lets nail this down to the core and cover the basis. You say I SHOULD have a problem with the stereo, Yet all sounds are routed fine through the dock -> usb input off the car stereo -> car speakers (I have also tested on about 3 other home dock stereos aswell which all fails). This itself shows that the stereo will act as a speaker / output device for any sounds the iPhone makes. With the usb connected to the car stereo, the iphone will then have 3 available routes (coming from the AVFoundation framework itself (I think its this framework but i could be wrong, i have ben left right and center so the classes i mention may be wrong as i have forgotten as such, but i know for a fact what i say is what i have seen).... soo...
    1. Receiver (handset ear speaker)
    2. Speaker (loud speaker)
    3. USB (car stereo, once this is unplugged this route no longer appears)
    these are classed as valid audio routes, So anything on the end off the route is just a speaker, really just like a sound card that streams any audio sent too it through to the speakers. Keep in mind that any car that allows audio through there stereos during voice control or phone calls are actually bluetooth connections which is actually a valid route during calls and voice control. Its only the dock / usb connection that will get shut off once a phone call is made or opening the voice control.. Lets put it this way, if the car stereo still plays audio from every application (including gps navigations etc) and every system sound. But not when you open the voice command app (via holding home) or phonecalls, has to say that these culprit apps are actually switching audio routes.

    To help my claim these class methods (from class-dump) look suspicious,
    Within SpringBoard.app
    SBVoiceControlAlertDisplay.h
    - (void)_invalidateRouting;
    - (void)_configureRoutingIfNecessary;
    - (void)_animateToAwayInCallController; (Why is a VoiceControlAlert refering to incall? just like how a incoming phone call cuts off audio though usb)..

    Within MobilePhone.app
    AudioDeviceController.h

    - (id)_pickableRoutes (the returned value never showed usb as available);
    - (void)_pickRoute:(id)fp8;
    - (BOOL)_routeIsSpeaker:(id)fp8;
    - (BOOL)_routeIsHandset:(id)fp8;
    - (BOOL)_routeIsReceiver:(id)fp8;


    You will also notice there is no method in this app class referencing a USB route eg. _routeIsUSB...
  6. An Outright Nihilist Well-Known Member

    Member Since:
    May 22, 2012
    Message Count:
    1,337
    Device:
    5G iPod touch
    Ok, this is definitively a system problem. As I have said, I'f the developer wants something to work, either he fixes his product to meet Apple's standards, or get Apple to conform to him. Which ever the case, if you go to the Apple website and look into iOS 6 section and then to Siri, you would note that Apple is trying to get car makers to integrate thier system into the car itself. This means that Apple has not done this in the past and newer cars/stereo sets would definitely fix your current problem. Wait for iOS 6 and then see what happens. As of now, I vannot help you. This is an incompatibility between hardware and software. Most likely Apple caused this problem in the first place.
  7. CQoute New Member

    Member Since:
    Jun 14, 2012
    Message Count:
    4
    Device:
    iPhone 3GS (White)
    I know your trying too help and i don't want too sound offensive in anyway or get into a debate about this, but your answers or solutions etc does not make sense to the evidence i have provided. Why you keep bringing up about the car / stereo manufacturers etc is beyond me when the results and evidence I have posted clearly rules that out as a considering factor. Also i'm not even talking about siri, its actually the 3gs voice control, this is 100% software controlled on the iPhone, Its a fact because, the VoiceCommands app is not reliant on any hardware what so ever (apart from input / mic) but so are 100 off other applications that still allow audio through usb. But at the end off your statement, you are correct about apple did cause this problem via Software control hence why i am Hooking with mobilesubstrate to bypass this issue. *****AUDIO WOKS FINE THROUGH USB TO THE CAR STEREO****** just when a phone call comes in it cuts of usb then reverts too the ear peice then when the phone call is finished it switches back to usb and continues playing the song where it was left off.

    https://discussions.apple.com/thread/2504094?start=0&tstart=0

    Check that thread, it even mentions from someone that prior to iOS4 it would work through usb but then apple stopped it, Making it 100% an iphone software issue. Now my goal is too find the right class and function call that deals with this but im having a hard time locating it and need help from experienced "mobilesubstrate developers" to point me in the right direction.. I really do appreciate your help though, Its just getting kind of frustrating to keep explaining the same thing over and over...