You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

iOS平台下Linphone通话中如何接收DTMF?

Linphone iOS: DTMF Reception & Callback Trigger Timing

Hey there! Let's break down how DTMF reception works in Linphone on iOS, especially when your linphone_iphone_notify_dtmf_received callback gets triggered.

When does dtmf_received actually fire?

  • This callback only triggers during an active call—meaning once you've successfully established a voice/video connection with the other party. When the remote side sends a DTMF signal (like pressing a number key, *, or # on their device), Linphone detects it and calls your handler.
  • Important notes: It won't trigger if the call is still ringing, dialing, or has ended. Also, Linphone supports both in-band and out-of-band DTMF, so it'll pick up standard signals sent via either method.

Double-check your setup to avoid misses

Since you've already set .dtmf_received = linphone_iphone_notify_dtmf_received in your LinphoneCoreVTable, confirm these details to make sure everything works:

  1. Ensure your LinphoneCore instance was initialized with this vtable—if you set the vtable after the call starts, you might miss incoming DTMF events.
  2. Verify your callback function has the correct signature (critical for it to be called properly):
    void linphone_iphone_notify_dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
        // The dtmf parameter maps to ASCII values: '1' = 49, '*' = 42, '#' = 35, etc.
        NSLog(@"Received DTMF key: %c", (char)dtmf);
    }
    
  3. If you're wrapping Linphone in Swift, make sure the C callback is properly bridged to your Swift code (no extra steps needed if you're working purely in Objective-C/C).

Quick debugging trick

To confirm the callback is working, add a log statement like the one above. Then:

  1. Connect your iOS device to Xcode and launch your app.
  2. Start an active call with another phone or Linphone instance.
  3. Have the remote side press DTMF keys—check your Xcode console for the log output.
  4. If nothing shows up, double-check the call is truly active, or that the remote device is sending valid DTMF signals (some devices require holding the key briefly to send).

Recap

  • Trigger timing: Only during active calls, when the remote party sends a DTMF signal
  • Key setup: Attach your callback to LinphoneCoreVTable before initializing LinphoneCore
  • Validation: Test with a live call and log output to confirm functionality

内容的提问来源于stack exchange,提问作者Krupaben Karathia

火山引擎 最新活动