Liblinphone  3.12.0
Functions

Functions

void linphone_core_start_dtmf_stream (LinphoneCore *lc)
 
void linphone_core_stop_dtmf_stream (LinphoneCore *lc)
 

Detailed Description


Multitasking
Liblinphone for IOS natively supports multitasking assuming application follows multitasking guides provided by Apple. First step is to declare application as multitasked. It means adding background mode for both audio and voip to Info.plist file.

<key>UIBackgroundModes</key>
<array>
<string>voip</string>
<string>audio</string>
</array>


Networking

Sound cards
Since IOS 5.0, liblinphone supports 2 sound cards. AU: Audio Unit Receiver based on IO units for voice calls plus AQ: Audio Queue Device dedicated to rings. Here under the recommended settings (I.E default one)

linphone_core_set_playback_device(lc, "AU: Audio Unit Receiver");
linphone_core_set_ringer_device(lc, "AQ: Audio Queue Device");
linphone_core_set_capture_device(lc, "AU: Audio Unit Receiver");

GSM call interaction
To ensure gentle interaction with GSM calls, it is recommended to register an AudioSession delegate. This allows the application to be notified when its audio session is interrupted/resumed (presumably by a GSM call).

// declare a class handling the AVAudioSessionDelegate protocol
@interface MyClass : NSObject <AVAudioSessionDelegate> { [...] }
// implement 2 methods : here's an example implementation
-(void) beginInterruption {
ms_message("Sound interruption detected!");
if (c) {
linphone_core_pause_call(theLinphoneCore, c);
}
}
-(void) endInterruption {
ms_message("Sound interruption ended!");
const MSList* c = linphone_core_get_calls(theLinphoneCore);
if (c) {
ms_message("Auto resuming call");
linphone_core_resume_call(theLinphoneCore, (LinphoneCall*) c->data);
}
}
See also
http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVAudioSessionDelegate_ProtocolReference/Reference/Reference.html


Declare an instance of your class as AudioSession's delegate :

[audioSession setDelegate:myClassInstance];
See also
http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html

Video
Since 3.5 video support has been added to liblinphone for IOS. It requires the application to provide liblinphone with pointers to IOS's views hosting video display and video previous.
These 2 UIView objects must be passed to the core using functions linphone_core_set_native_video_window_id() and linphone_core_set_native_preview_window_id(). here under speudo code:

UIView* display = [[UIView alloc] init];
UIView* preview = [[UIView alloc] init];
linphone_core_set_native_video_window_id(lc,(unsigned long)display);
linphone_core_set_native_preview_window_id(lc,(unsigned long)preview);


Screen rotations are also handled by liblinphone. 2 positions are currently supported, namely UIInterfaceOrientationPortrait and UIInterfaceOrientationLandscapeRight. Applications may invoke linphone_core_set_device_rotation() followed by linphone_core_update_call() to notify liblinphone of an orientation change. Here under a speudo code to handle orientation changes

-(void) configureOrientation:(UIInterfaceOrientation) oritentation {
int oldLinphoneOrientation = linphone_core_get_device_rotation(lc);
if (oritentation == UIInterfaceOrientationPortrait ) {
linphone_core_set_native_video_window_id(lc,(unsigned long)display-portrait);
linphone_core_set_native_preview_window_id(lc,(unsigned long)preview-portrait);
} else if (oritentation == UIInterfaceOrientationLandscapeRight ) {
linphone_core_set_native_video_window_id(lc,(unsigned long)display-landscape);
linphone_core_set_native_preview_window_id(lc,(unsigned long)preview-landscape);
}
if ((oldLinphoneOrientation != linphone_core_get_device_rotation(lc))
//Orientation has changed, must call update call
}
}

DTMF feebacks
Liblinphone provides functions to play dtmf to the local user. Usually this is used to play a sound when the user presses a digit, inside or outside of any call. On IOS, libLinphone relies on AudioUnits for interfacing with the audio system. Unfortunately the Audio Unit initialization is a quite long operation that may trigger a bad user experience if performed each time a DTMF is played, the sound being delayed half a second after the press. To solve this issue and thus insure real-time precision, liblinphone introduces 2 functions for preloading and unloading the underlying audio graph responsible for playing DTMFs.
For an application using function linphone_core_play_dtmf(), it is recommanded to call linphone_core_start_dtmf_stream() when entering in foreground and linphone_core_stop_dtmf_stream() upon entering background mode.

Plugins
On iOS, plugins are built as static libraries so Liblinphone will not be able to load them at runtime dynamically. Instead, you should declare their prototypes:

extern void libmsamr_init(MSFactory *factory);
extern void libmsx264_init(MSFactory *factory);
extern void libmsopenh264_init(MSFactory *factory);
extern void libmssilk_init(MSFactory *factory);
extern void libmsbcg729_init(MSFactory *factory);
extern void libmswebrtc_init(MSFactory *factory);

Then you should register them after the instantiation of LinphoneCore:

theLinphoneCore = linphone_core_new_with_config(/* options ... */);
// Load plugins if available in the linphone SDK - otherwise these calls will do nothing
MSFactory *f = linphone_core_get_ms_factory(theLinphoneCore);
libmssilk_init(f);
libmsamr_init(f);
libmsx264_init(f);
libmsopenh264_init(f);
libmsbcg729_init(f);
libmswebrtc_init(f);
linphone_core_reload_ms_plugins(theLinphoneCore, NULL);

If the plugin has not been enabled at compilation time, a stubbed library will be generated with only libplugin_init method declared, doing nothing. You should see these trace in logs, if plugin is stubbed:

I/lib/Could not find encoder for SILK
I/lib/Could not find decoder for SILK

Function Documentation

◆ linphone_core_start_dtmf_stream()

void linphone_core_start_dtmf_stream ( LinphoneCore lc)

Special function to warm up dtmf feeback stream. linphone_core_stop_dtmf_stream must() be called before entering FG mode

◆ linphone_core_stop_dtmf_stream()

void linphone_core_stop_dtmf_stream ( LinphoneCore lc)

Special function to stop dtmf feed back function. Must be called before entering BG mode

linphone_core_resume_call
LINPHONE_DEPRECATED LinphoneStatus linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call)
Resumes a call.
linphone_core_set_device_rotation
void linphone_core_set_device_rotation(LinphoneCore *lc, int rotation)
Tells the core the device current orientation.
linphone_core_reload_ms_plugins
void linphone_core_reload_ms_plugins(LinphoneCore *lc, const char *path)
Reload mediastreamer2 plugins from specified directory.
linphone_core_update_call
LINPHONE_DEPRECATED LinphoneStatus linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params)
Updates a running call according to supplied call parameters or parameters changed in the LinphoneCor...
linphone_core_set_native_video_window_id
void linphone_core_set_native_video_window_id(LinphoneCore *lc, void *id)
linphone_core_set_playback_device
LinphoneStatus linphone_core_set_playback_device(LinphoneCore *lc, const char *devid)
Sets the sound device used for playback.
linphone_core_get_calls
const bctbx_list_t * linphone_core_get_calls(LinphoneCore *lc)
Gets the current list of calls.
linphone_core_set_ringer_device
LinphoneStatus linphone_core_set_ringer_device(LinphoneCore *lc, const char *devid)
Sets the sound device used for ringing.
linphone_core_set_network_reachable
void linphone_core_set_network_reachable(LinphoneCore *lc, bool_t value)
This method is called by the application to notify the linphone core library when network is reachabl...
linphone_core_set_capture_device
LinphoneStatus linphone_core_set_capture_device(LinphoneCore *lc, const char *devid)
Sets the sound device used for capture.
linphone_core_set_native_preview_window_id
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, void *id)
Set the native window id where the preview video (local camera) is to be displayed.
linphone_core_iterate
void linphone_core_iterate(LinphoneCore *lc)
Main loop function.
linphone_core_get_device_rotation
int linphone_core_get_device_rotation(LinphoneCore *lc)
Gets the current device orientation.
linphone_core_get_current_call
LinphoneCall * linphone_core_get_current_call(const LinphoneCore *lc)
Gets the current call.
LinphoneCall
struct _LinphoneCall LinphoneCall
The LinphoneCall object represents a call issued or received by the LinphoneCore.
Definition: types.h:262
linphone_core_refresh_registers
void linphone_core_refresh_registers(LinphoneCore *lc)
force registration refresh to be initiated upon next iterate
linphone_proxy_config_is_registered
LINPHONE_DEPRECATED bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *cfg)
linphone_core_pause_call
LINPHONE_DEPRECATED LinphoneStatus linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call)
Pauses the call.
linphone_core_new_with_config
LINPHONE_DEPRECATED LinphoneCore * linphone_core_new_with_config(const LinphoneCoreVTable *vtable, LpConfig *config, void *userdata)
Instantiates a LinphoneCore object with a given LpConfig.