iOS audio from receiver (not from speaker)
# support
s
Hey! I'm working with [client-sdk-ios](https://github.com/VapiAI/client-sdk-ios/), but I can't get audio to come from the receiver (earpiece); it always defaults to the speaker. Bluetooth headphones work. Is anyone having the same problem? Or is there something special with VAPI SDK that I don't get? šŸ˜… private func configureAudioSession() { do { let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory(.playAndRecord, mode: .voiceChat, options: [.allowBluetooth, .allowBluetoothA2DP]) try audioSession.setActive(true, options: .notifyOthersOnDeactivation) try audioSession.overrideOutputAudioPort(.none) } catch { print("Failed to configure audio session: \(error)") } }
v
message has been deleted
@startupartist Hello! It looks like you're on the right track with configuring the audio session for your iOS app. However, if you want the audio to come from the receiver (earpiece) instead of the speaker, you should change the
overrideOutputAudioPort
parameter from
.none
to
.speaker
. This might seem counterintuitive, but
.speaker
in this context refers to the default audio route, which is the receiver for a
.playAndRecord
category with
.voiceChat
mode. Here's how you can modify your
configureAudioSession
function:
Copy code
swift
private func configureAudioSession() {
    do {
        let audioSession = AVAudioSession.sharedInstance()
        try audioSession.setCategory(.playAndRecord,
                                     mode: .voiceChat,
                                     options: [.allowBluetooth, .allowBluetoothA2DP])
        try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
        try audioSession.overrideOutputAudioPort(.speaker) // Change this line
    } catch {
        print("Failed to configure audio session: \(error)")
    }
}
Give this a try, and it should direct the audio output to the receiver when no other audio route like Bluetooth headphones is active. If you continue to experience issues or have any more questions, feel free to ask!
You can continue this conversation by mentioning me in the message.
s
It didn't solve the issue
s
Hey @startupartist would you mind sharing the steps to reproduce it and what you have tried until now to resolve it. This would really help me figure out what went wrong!
s
@Shubham Bajaj So I've installed the Vapi iOS SDK and tried several ways to get the audio output to come from the receiver (instead of the speakers). When I start a Vapi call, the audio comes from my iPhone speakers, not from the receiver (like a normal call), no matter what settings I have tested! I also tried the CallKit setup with the Vapi package, but even there the speakers seemed to be forced as the audio output. So I was wondering if there was a way to make the audio output come from the receiver. Should it be possible or are others having the same problem? Thanks for helping me with this šŸ™
s
@startupartist it will take me sometime to reproduce this and try to find the fix. Meanwhile can you report the same issue over the Github issues?
e
hey guys im facing this same issue, was this ever resolved?
@Shubham Bajaj @startupartist
s
@Ethan Tan Create the issue on GitHub, and it will be resolved by the team. If you don't hear a response from them within 2 days, let me know.
e
thanks @Shubham Bajaj
hi @Shubham Bajaj Ive not received a response on Github, could you please assist? Thank you: https://github.com/VapiAI/client-sdk-web/issues/93
@Shubham Bajaj any update on this please?
s
Just ping the sdk-team again, waiting for their response.
e
thank you
hey @Shubham Bajaj , haven't seen any update from the team. Could I get some assistance please?
s
Hey Ethan, our team is occupied with other tasks and feature requests. The code is open sourced, can you open an PR happy to review and merge.
e
hey @Shubham Bajaj I had a look at the code with an LLM, but I got somewhat lost. It would be great if an engineer could pick this up, it would be a big improvement in user experience!
s
Hi, checking if this is resolved/solved for you?
e
Hey @Shubham Bajaj thanks for following up - no it hasn't been, no one has picked it up. Any possibility of getting some help?
s
I will check with my team about this. Until then, I'll still recommend you to work on it by yourself.
e
Thank you Shubham, unfortunately I'm stuck with it, as I'm not an engineer
Hi Shubham, is there any intention to fix this? It's a bad user experience for users when the audio doesnt go through their airpods/earphones
s
Hey startupartist, I wanted to let you know that we're managing a high volume of support requests at the moment, so our response time might be a bit slower than usual. I truly appreciate your understanding and will get back to you as soon as possible!Ā  Thanks again for your patience!
Hey startupartist, I sincerely apologize for the delay in our responses this week. We experimented with some process adjustments that didn’t work as intended, and unfortunately, this caused some disruptions. That’s entirely my responsibility. Just a quick note—our team is unavailable on weekends. However, if something urgent or critical comes up, feel free to reach out to me directly, and I’ll assist you. The support issues will be resolved in the coming weeks, and starting Monday, you can expect more consistent and improved support. Thank you so much for your patience and for continuing to stick with us!
2 Views