forked from mirrors/linphone-iphone
Define sound interruption handler in objc. Used to pause sip call.
This commit is contained in:
parent
9b32774f31
commit
44d5e1db8c
2 changed files with 19 additions and 1 deletions
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AVFoundation/AVAudioSession.h>
|
||||
#import <SystemConfiguration/SCNetworkReachability.h>
|
||||
#include "linphonecore.h"
|
||||
#import "LogView.h"
|
||||
|
|
@ -28,7 +29,7 @@ typedef enum _Connectivity {
|
|||
,none
|
||||
} Connectivity;
|
||||
@class FastAddressBook;
|
||||
@interface LinphoneManager : NSObject {
|
||||
@interface LinphoneManager : NSObject <AVAudioSessionDelegate> {
|
||||
@private
|
||||
SCNetworkReachabilityContext proxyReachabilityContext;
|
||||
SCNetworkReachabilityRef proxyReachability;
|
||||
|
|
|
|||
|
|
@ -726,6 +726,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
//init audio session
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
BOOL bAudioInputAvailable= [audioSession inputIsAvailable];
|
||||
[audioSession setDelegate:self];
|
||||
|
||||
if(!bAudioInputAvailable){
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"No microphone",nil)
|
||||
|
|
@ -780,4 +781,20 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
mLogView = view;
|
||||
}
|
||||
|
||||
-(void) beginInterruption {
|
||||
LinphoneCall* c = linphone_core_get_current_call(theLinphoneCore);
|
||||
ms_message("Sound interruption detected!");
|
||||
if (c) {
|
||||
linphone_core_pause_call(theLinphoneCore, c);
|
||||
}
|
||||
}
|
||||
|
||||
-(void) endInterruption {
|
||||
const MSList* c = linphone_core_get_calls(theLinphoneCore);
|
||||
ms_message("Sound interruption ended!");
|
||||
if (c) {
|
||||
linphone_core_resume_call(theLinphoneCore, (LinphoneCall*) c->data);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue