mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-27 16:09:20 +00:00
- fix crash with incoming calls on ios5.1
- play a sound during incoming calls in foreground.
This commit is contained in:
parent
c36e794c2e
commit
63272b2303
4 changed files with 51 additions and 6 deletions
|
|
@ -72,16 +72,19 @@
|
|||
linphone_core_set_device_rotation([LinphoneManager getLc], 0);
|
||||
linphone_core_set_video_device([LinphoneManager getLc], "DummyImage: Dummy (no) picture");
|
||||
|
||||
linphone_core_set_ring([LinphoneManager getLc], NULL );
|
||||
|
||||
linphone_core_set_ring([LinphoneManager getLc], NULL ); //so that we don't attempt to play ring by the core
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
|
||||
[buschJaegerMainView activateVideoView:FALSE];
|
||||
[[LinphoneManager instance] enterBackgroundMode];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
[[LinphoneManager instance] becomeActive];
|
||||
[buschJaegerMainView activateVideoView:TRUE];
|
||||
}
|
||||
|
||||
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#import "LinphoneManager.h"
|
||||
#import "UILightButton.h"
|
||||
|
||||
#define BJ_RING_FILE "01"
|
||||
|
||||
@interface BuschJaegerMainView : UIViewController<LinphoneUICallDelegate, UIActionSheetCustomDelegate, LinphoneUIRegistrationDelegate> {
|
||||
@private
|
||||
UIView* videoView;
|
||||
|
|
@ -52,5 +54,6 @@
|
|||
|
||||
- (IBAction)takeCall:(id)sender;
|
||||
- (IBAction)startCall:(id)sender;
|
||||
-(void) activateVideoView:(BOOL) value;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#import "BuschJaegerMainView.h"
|
||||
#include "linphonecore.h"
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
@implementation BuschJaegerMainView
|
||||
|
||||
|
|
@ -105,7 +106,6 @@
|
|||
[LinphoneManager set:endOrRejectCall hidden:YES withName:"END_BTN" andReason:__FUNCTION__];
|
||||
[LinphoneManager set:videoView hidden:YES withName:"VIDEO_VIEW" andReason:__FUNCTION__];
|
||||
|
||||
linphone_core_set_native_video_window_id([LinphoneManager getLc],(unsigned long)videoView);
|
||||
|
||||
if (!chatRoom) {
|
||||
NSString* s = [NSString stringWithFormat:@"sip:100000001@%@", [[NSUserDefaults standardUserDefaults] stringForKey:@"adapter_ip_preference"]];
|
||||
|
|
@ -115,6 +115,19 @@
|
|||
lights->chatRoom = chatRoom;
|
||||
openDoor->chatRoom = chatRoom;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) activateVideoView:(BOOL)value{
|
||||
if (value){
|
||||
linphone_core_set_native_video_window_id([LinphoneManager getLc],(unsigned long)videoView);
|
||||
}else{
|
||||
linphone_core_set_native_video_window_id([LinphoneManager getLc],0);
|
||||
linphone_core_set_native_preview_window_id([LinphoneManager getLc],0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void) viewDidDisappear:(BOOL)animated{
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -160,15 +173,38 @@
|
|||
notif.repeatInterval = 0;
|
||||
notif.alertBody = NSLocalizedString(@" Ding Dong !",nil);
|
||||
notif.alertAction = @"See the answer";
|
||||
notif.soundName = @"01.wav";
|
||||
notif.soundName = @BJ_RING_FILE ".wav";
|
||||
NSData *callData = [NSData dataWithBytes:&call length:sizeof(call)];
|
||||
notif.userInfo = [NSDictionary dictionaryWithObject:callData forKey:@"call"];
|
||||
|
||||
[[UIApplication sharedApplication] presentLocalNotificationNow:notif];
|
||||
}
|
||||
}else{
|
||||
NSBundle* myBundle = [NSBundle mainBundle];
|
||||
|
||||
NSString* path = [myBundle pathForResource:@BJ_RING_FILE ofType:@"wav"];
|
||||
if (path) {
|
||||
const char* soundfile = [path cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
ms_message("Using '%s' as ring file", soundfile);
|
||||
SystemSoundID sid;
|
||||
NSURL *pathURL = [NSURL fileURLWithPath : path];
|
||||
NSError *setCategoryError = nil;
|
||||
[[AVAudioSession sharedInstance]
|
||||
setCategory: AVAudioSessionCategoryAmbient
|
||||
error: &setCategoryError];
|
||||
//redirect audio to speaker
|
||||
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
|
||||
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute
|
||||
, sizeof (audioRouteOverride)
|
||||
, &audioRouteOverride);
|
||||
|
||||
AudioServicesCreateSystemSoundID((CFURLRef) pathURL, &sid);
|
||||
AudioServicesPlaySystemSound(sid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//linphone_call_enable_camera(call, FALSE);
|
||||
linphone_call_enable_camera(call, FALSE);
|
||||
}
|
||||
|
||||
- (void) displayVideoCall:(LinphoneCall *)call FromUI:(UIViewController *)viewCtrl forUser:(NSString *)username withDisplayName:(NSString *)displayName {
|
||||
|
|
@ -178,6 +214,7 @@
|
|||
[LinphoneManager set:decline hidden:YES withName:"DECLINE_BTN" andReason:__FUNCTION__];
|
||||
[LinphoneManager set:endOrRejectCall hidden:NO withName:"END_BTN" andReason:__FUNCTION__];
|
||||
[LinphoneManager set:videoView hidden:NO withName:"VIDEO_VIEW" andReason:__FUNCTION__];
|
||||
|
||||
}
|
||||
|
||||
- (void) displayStatus:(NSString *)message {
|
||||
|
|
@ -229,7 +266,7 @@
|
|||
ms_error("Failed to start a new call");
|
||||
return;
|
||||
}
|
||||
//linphone_call_enable_camera(lc, false);
|
||||
linphone_call_enable_camera(lc, false);
|
||||
linphone_call_params_destroy(lcallParams);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1699,6 +1699,7 @@
|
|||
armv6,
|
||||
);
|
||||
CODE_SIGN_ENTITLEMENTS = untitled.plist;
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution: jehan monnier";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
|
|
@ -1733,6 +1734,7 @@
|
|||
ORDER_FILE = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = linphone;
|
||||
PROVISIONING_PROFILE = "0FCDB3A2-9170-48DC-B1EE-58DF9948B0C7";
|
||||
SDKROOT = iphoneos;
|
||||
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue