From 58e9256f79412fefd5a56f3546f5ee28656ea9ae Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 7 Nov 2011 15:40:18 +0100 Subject: [PATCH] DTMF fixes --- Classes/IncallViewController.m | 10 +++++----- Classes/LinphoneUI/UIDigitButton.h | 7 ++++++- Classes/LinphoneUI/UIDigitButton.m | 8 +++++--- Classes/PhoneViewController.m | 30 +++++++++++++++++------------- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 96b339ef2..4b2163559 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -115,7 +115,7 @@ int callCount(LinphoneCore* lc) { [mergeCalls setHidden:YES]; - selectedCall = nil; + //selectedCall = nil; } -(void) addCallPressed { @@ -157,7 +157,6 @@ int callCount(LinphoneCore* lc) { if (durationRefreasher != nil) { [durationRefreasher invalidate]; durationRefreasher=nil; - selectedCall = nil; } } @@ -188,7 +187,8 @@ int callCount(LinphoneCore* lc) { -(void) displayInCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { dismissed = false; - selectedCall = call; + if (call) + selectedCall = call; [self updateUIFromLinphoneState: nil]; } -(void) displayDialerFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { @@ -299,8 +299,8 @@ int callCount(LinphoneCore* lc) { - (void) updateCell:(UITableViewCell*)cell at:(NSIndexPath*) path withCall:(LinphoneCall*) call conferenceActive:(bool)confActive{ if (call == NULL) { - ms_error("UpdateCell called with null call"); - [cell.textLabel setText:@"BUG IN APP - call is null"]; + ms_warning("UpdateCell called with null call"); + [cell.textLabel setText:@""]; return; } const LinphoneAddress* addr = linphone_call_get_remote_address(call); diff --git a/Classes/LinphoneUI/UIDigitButton.h b/Classes/LinphoneUI/UIDigitButton.h index 08b3a813b..70f7aee18 100644 --- a/Classes/LinphoneUI/UIDigitButton.h +++ b/Classes/LinphoneUI/UIDigitButton.h @@ -23,9 +23,14 @@ @private char mDigit; UITextField* mAddress; + + bool_t sendDtmfDuringCall; } -(void) initWithNumber:(char)digit ; --(void) initWithNumber:(char)digit addressField:(UITextField*) address; +-(void) initWithNumber:(char)digit addressField:(UITextField*) address dtmf:(bool_t)send; + + +@property bool_t sendDtmfDuringCall; @end diff --git a/Classes/LinphoneUI/UIDigitButton.m b/Classes/LinphoneUI/UIDigitButton.m index a4660f11a..2a0cad86c 100644 --- a/Classes/LinphoneUI/UIDigitButton.m +++ b/Classes/LinphoneUI/UIDigitButton.m @@ -23,11 +23,12 @@ @implementation UIDigitButton +@synthesize sendDtmfDuringCall; -(void) touchDown:(id) sender { - if (mAddress && !linphone_core_in_call([LinphoneManager getLc])) { + if (mAddress && (!sendDtmfDuringCall || !linphone_core_in_call([LinphoneManager getLc]))) { NSString* newAddress = [NSString stringWithFormat:@"%@%c",mAddress.text,mDigit]; [mAddress setText:newAddress]; linphone_core_play_dtmf([LinphoneManager getLc], mDigit, -1); @@ -60,9 +61,10 @@ } -(void) initWithNumber:(char)digit { - [self initWithNumber:digit addressField:nil]; + [self initWithNumber:digit addressField:nil dtmf:true]; } --(void) initWithNumber:(char)digit addressField:(UITextField*) address{ +-(void) initWithNumber:(char)digit addressField:(UITextField*) address dtmf:(bool_t)sendDtmf{ + sendDtmfDuringCall = sendDtmf; mDigit=digit ; mAddress=address?[address retain]:nil; [self addTarget:self action:@selector(touchDown:) forControlEvents:UIControlEventTouchDown]; diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 8ca16ba45..0e09d9a7c 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -91,18 +91,18 @@ [super viewDidLoad]; mDisplayName = [UILabel alloc]; - [zero initWithNumber:'0' addressField:address ]; - [one initWithNumber:'1' addressField:address ]; - [two initWithNumber:'2' addressField:address ]; - [three initWithNumber:'3' addressField:address ]; - [four initWithNumber:'4' addressField:address ]; - [five initWithNumber:'5' addressField:address ]; - [six initWithNumber:'6' addressField:address ]; - [seven initWithNumber:'7' addressField:address ]; - [eight initWithNumber:'8' addressField:address ]; - [nine initWithNumber:'9' addressField:address ]; - [star initWithNumber:'*' addressField:address ]; - [hash initWithNumber:'#' addressField:address ]; + [zero initWithNumber:'0' addressField:address dtmf:false]; + [one initWithNumber:'1' addressField:address dtmf:false]; + [two initWithNumber:'2' addressField:address dtmf:false]; + [three initWithNumber:'3' addressField:address dtmf:false]; + [four initWithNumber:'4' addressField:address dtmf:false]; + [five initWithNumber:'5' addressField:address dtmf:false]; + [six initWithNumber:'6' addressField:address dtmf:false]; + [seven initWithNumber:'7' addressField:address dtmf:false]; + [eight initWithNumber:'8' addressField:address dtmf:false]; + [nine initWithNumber:'9' addressField:address dtmf:false]; + [star initWithNumber:'*' addressField:address dtmf:false]; + [hash initWithNumber:'#' addressField:address dtmf:false]; [__call initWithAddress:address withDisplayName:mDisplayName]; [mute initWithOnImage:[UIImage imageNamed:@"mic_muted.png"] offImage:[UIImage imageNamed:@"mic_active.png"] ]; [speaker initWithOnImage:[UIImage imageNamed:@"Speaker-32-on.png"] offImage:[UIImage imageNamed:@"Speaker-32-off.png"] ]; @@ -201,7 +201,7 @@ } else { [peerLabel setText:username?username:@""]; } - [incallView setHidden:false]; + [incallView setHidden:NO]; } -(void) displayCall:(LinphoneCall*) call InProgressFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { [self displayInCall: call ViewforUser:username @@ -209,6 +209,8 @@ //[__call setEnabled:false]; [callDuration setText:NSLocalizedString(@"Calling...",nil)]; if ([speaker isOn]) [speaker toggle] ; //preset to off + + [incallView setHidden:NO]; } -(void) displayInCall:(LinphoneCall*) call FromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName { @@ -220,6 +222,8 @@ withDisplayName:displayName]; if ([speaker isOn]) [speaker toggle] ; //preset to off; } + + [incallView setHidden:NO]; } //status reporting -(void) displayStatus:(NSString*) message {