audio: fix ringbacktone by using liblinphone api

This commit is contained in:
Gautier Pelloux-Prayer 2016-01-07 16:04:56 +01:00
parent af8bbe8659
commit 0b779eaea9
2 changed files with 29 additions and 20 deletions

View file

@ -297,7 +297,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
}
- (void)hideControls:(BOOL)hidden sender:(id)sender {
if (videoHidden)
if (videoHidden && hidden)
return;
if (hideControlsTimer) {
@ -320,12 +320,12 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
[PhoneMainView.instance hideTabBar:hidden];
if (!hidden) {
// hide controls in 5 sec
hideControlsTimer = [NSTimer scheduledTimerWithTimeInterval:5.0
target:self
selector:@selector(timerHideControls:)
userInfo:nil
repeats:NO];
// hide controls in 5 sec
hideControlsTimer = [NSTimer scheduledTimerWithTimeInterval:5.0
target:self
selector:@selector(timerHideControls:)
userInfo:nil
repeats:NO];
}
}
}

View file

@ -1448,22 +1448,31 @@ static BOOL libStarted = FALSE;
libmsbcg729_init();
libmswebrtc_init();
// Set audio assets
NSString *ring = ([LinphoneManager bundleFile:[self lpConfigStringForKey:@"local_ring" inSection:@"sound"].lastPathComponent]
?: [LinphoneManager bundleFile:@"notes_of_the_optimistic.caf"])
.lastPathComponent;
NSString *ringback = ([LinphoneManager bundleFile:[self lpConfigStringForKey:@"ringback_tone" inSection:@"sound"].lastPathComponent]
?: [LinphoneManager bundleFile:@"ringback.wav"])
.lastPathComponent;
NSString *hold = ([LinphoneManager bundleFile:[self lpConfigStringForKey:@"hold_music" inSection:@"sound"].lastPathComponent]
?: [LinphoneManager bundleFile:@"hold.caf"])
.lastPathComponent;
[self lpConfigSetString:[LinphoneManager bundleFile:ring] forKey:@"local_ring" inSection:@"sound"];
[self lpConfigSetString:[LinphoneManager bundleFile:ringback] forKey:@"ringback_tone" inSection:@"sound"];
[self lpConfigSetString:[LinphoneManager bundleFile:hold] forKey:@"hold_music" inSection:@"sound"];
theLinphoneCore = linphone_core_new_with_config(&linphonec_vtable, configDb, (__bridge void *)(self));
LOGI(@"Create linphonecore %p", theLinphoneCore);
// Set audio assets
NSString *ring =
([LinphoneManager
bundleFile:[NSString stringWithUTF8String:linphone_core_get_ringback(theLinphoneCore)].lastPathComponent]
?: [LinphoneManager bundleFile:@"notes_of_the_optimistic.caf"])
.lastPathComponent;
NSString *ringback =
([LinphoneManager
bundleFile:[NSString stringWithUTF8String:linphone_core_get_remote_ringback_tone(theLinphoneCore)]
.lastPathComponent]
?: [LinphoneManager bundleFile:@"ringback.wav"])
.lastPathComponent;
NSString *hold =
([LinphoneManager
bundleFile:[NSString stringWithUTF8String:linphone_core_get_play_file(theLinphoneCore)].lastPathComponent]
?: [LinphoneManager bundleFile:@"hold.caf"])
.lastPathComponent;
linphone_core_set_ringback(theLinphoneCore, [LinphoneManager bundleFile:ring].UTF8String);
linphone_core_set_remote_ringback_tone(theLinphoneCore, [LinphoneManager bundleFile:ringback].UTF8String);
linphone_core_set_play_file(theLinphoneCore, [LinphoneManager bundleFile:hold].UTF8String);
/* set the CA file no matter what, since the remote provisioning could be hitting an HTTPS server */
const char *lRootCa = [[LinphoneManager bundleFile:@"rootca.pem"] UTF8String];
linphone_core_set_root_ca(theLinphoneCore, lRootCa);