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:
-
Verify Framework Embedding:
- Go to Target Settings โ General โ Frameworks, Libraries, and Embedded Content.
- Ensure
PitelVoIPFramework.frameworkis set to Embed & Sign.
-
Check Import Statement:
import PitelVoIPFramework // โ -
Clean Build Folder: Product โ Clean Build Folder (โงโK).
Issue: "Undefined symbols for architecture arm64"โ
Symptoms:
- Linker errors referencing
_OBJC_CLASS_$_CPPWrapperor PJSIP symbols.
Solution:
-
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.
-
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:
- Real Device: Testing on Simulator will not work.
- Certificates: Ensure
.p12VoIP certificate is uploaded to Pitel Portal. - 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:
-
Check
reportIncomingCall: The framework calls this automatically inPitelVoIPDelegate. Ensure you haven't overriddenpushRegistry(_:didReceiveIncomingPushWith:)without callingsuperor handling it yourself. -
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:
- Microphone Permission:
Check
Info.plistforNSMicrophoneUsageDescription. - Audio Session:
The framework sets
AVAudioSessionto.playAndRecord. Ensure no other audio plugin (like music players) is deactivating it. - Codecs: Ensure your SIP server supports PCMA/PCMU (G.711) or G.729. PitelVoIP prioritizes these.
๐ Getting Supportโ
If you cannot resolve the issue:
- Collect Logs: Look for lines starting with
[PitelVoIP]. - Check Version: Ensure you are on the latest release.
- Contact: support@pitel.vn or open an Issue on GitHub.