Skip to main content

Troubleshooting Guide - PitelVoIPFramework

This guide helps you resolve common issues when integrating and using PitelVoIPFramework.


๐Ÿ›  Installation & Build Issuesโ€‹

Issue: "Cannot find 'PitelVoIPFramework' in scope"โ€‹

Symptoms:

  • Build errors saying framework not found
  • Import statement shows error

Solution:

  1. Verify Framework Embedding:

    • Go to Target Settings โ†’ General โ†’ Frameworks, Libraries, and Embedded Content.
    • Ensure PitelVoIPFramework.framework is set to Embed & Sign.
  2. Check Import Statement:

    import PitelVoIPFramework  // โœ…
  3. Clean Build Folder: Product โ†’ Clean Build Folder (โ‡งโŒ˜K).

Issue: "Undefined symbols for architecture arm64"โ€‹

Symptoms:

  • Linker errors referencing _OBJC_CLASS_$_CPPWrapper or PJSIP symbols.

Solution:

  1. Check Architectures:

    • Build Settings โ†’ Architectures โ†’ arm64 (for real device).
    • Note: The framework (and PJSIP) often does not support the Simulator fully. Always test on a physical device.
  2. Link Binary With Libraries:

    • Check that the framework is correctly added to the "Link Binary With Libraries" phase.

๐Ÿš€ Initialization Issuesโ€‹

Issue: PJSIP Callbacks / Incoming Calls Not Workingโ€‹

Symptoms:

  • No incoming call screen.
  • Registration logic doesn't seem to trigger.

Solution: Ensure you are using the PitelVoIPDelegate inheritance pattern. This handles all C++ callbacks automatically.

// โœ… DO THIS:
import PitelVoIPFramework

class AppDelegate: PitelVoIPDelegate {
override func application(...) -> Bool {
_ = super.application(...) // โš ๏ธ Critical: Must call super
return true
}
}

Check Logs: Look for:

โœ… PitelVoIP SDK auto-configured by PitelVoIPDelegate
โœ… Default registration callback registered

Issue: "PitelVoIP not configured"โ€‹

Solution: Ensure your AppDelegate is connected to your SwiftUI App struct:

@main
struct YourApp: App {
// โœ… Use the adaptor
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

var body: some Scene { ... }
}

๐Ÿ”” VoIP Push Notificationsโ€‹

Issue: Not receiving VoIP push (App Terminated)โ€‹

Checklist:

  1. Real Device: Testing on Simulator will not work.
  2. Certificates: Ensure .p12 VoIP certificate is uploaded to Pitel Portal.
  3. Background Modes:
    • Voice over IP
    • Background fetch
    • Remote notifications

Debug Steps: Check console logs for the VoIP Token:

PushRegistry token: <64-character-hex-string>

If you don't see this, didRegisterForRemoteNotificationsWithDeviceToken is not being called or PKPushRegistry failed.

Issue: CallKit UI doesn't appearโ€‹

Solution:

  1. Check reportIncomingCall: The framework calls this automatically in PitelVoIPDelegate. Ensure you haven't overridden pushRegistry(_:didReceiveIncomingPushWith:) without calling super or handling it yourself.

  2. Check "Do Not Disturb" (Focus Mode): iOS often suppresses VoIP notifications if DND is on.


๐Ÿ” Registration & Login Issuesโ€‹

Issue: "NOT REGISTERED" status persistsโ€‹

Checklist:

  • Domain: Ensure sip.pitel.vn (or your domain) is reachable.
  • Port: Ensure correct port (e.g., "50061").
  • Network: Try switching between WiFi and 4G.

Code Check (Builder Pattern):

PitelVoIP.login(accountViewModel: viewModel) { builder in
builder
.setExtension("101")
.setDomain("sip.pitel.vn")
.setPort("50061") // Must be String
.setPassword("...")
}

Issue: Auto-login fails on App Resumeโ€‹

Symptoms:

  • App opens from background but stays offline.
  • Calls fail until manual re-login.

Solution: You likely forgot the Lifecycle Modifier.

Correct Implementation: In your root ContentView (or main WindowGroup):

WindowGroup {
ContentView()
.pitelVoIPLifecycle() // โœ… Adds auto-resume logic
}

Why? This modifier detects when the app moves to .active state and calls appDelegate.handleAppResume(), which triggers valid credential re-registration.


๐Ÿ”Š Audio Issuesโ€‹

Issue: No Audio / One-way Audioโ€‹

Solution:

  1. Microphone Permission: Check Info.plist for NSMicrophoneUsageDescription.
  2. Audio Session: The framework sets AVAudioSession to .playAndRecord. Ensure no other audio plugin (like music players) is deactivating it.
  3. Codecs: Ensure your SIP server supports PCMA/PCMU (G.711) or G.729. PitelVoIP prioritizes these.

๐Ÿ†˜ Getting Supportโ€‹

If you cannot resolve the issue:

  1. Collect Logs: Look for lines starting with [PitelVoIP].
  2. Check Version: Ensure you are on the latest release.
  3. Contact: support@pitel.vn or open an Issue on GitHub.