diff --git a/Classes/LinphoneUI/UIDigitButton.m b/Classes/LinphoneUI/UIDigitButton.m index a3b5eded9..7470307db 100644 --- a/Classes/LinphoneUI/UIDigitButton.m +++ b/Classes/LinphoneUI/UIDigitButton.m @@ -38,8 +38,8 @@ } else { linphone_core_send_dtmf([LinphoneManager getLc],mDigit); } - } + -(void) touchUp:(id) sender { linphone_core_stop_dtmf([LinphoneManager getLc]); if (mDigit == '0') { diff --git a/Classes/PhoneViewController.h b/Classes/PhoneViewController.h index 84e77b4c0..f9c2e7583 100644 --- a/Classes/PhoneViewController.h +++ b/Classes/PhoneViewController.h @@ -64,6 +64,7 @@ IncallViewController *myIncallViewController; UIActionSheet *mIncomingCallActionSheet; FirstLoginViewController* myFirstLoginViewController; + NSTimer *dtmf_warmup; } @property (nonatomic, retain) IBOutlet UITextField* address; diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index aaf2d6fbc..a72c4533a 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -79,6 +79,16 @@ return self; } */ + + +- (void)dtmfWarmup{ + @try { + linphone_core_play_dtmf([LinphoneManager getLc], ' ', 50); + } @catch (NSException *e) { + //nop + } +} + - (void)viewDidAppear:(BOOL)animated { [[UIApplication sharedApplication] setIdleTimerDisabled:true]; [mute reset]; @@ -88,10 +98,27 @@ [[LinphoneManager instance] setRegistrationDelegate:myFirstLoginViewController]; [self presentModalViewController:myFirstLoginViewController animated:true]; }; - + /* + BIG HACK !! + The audio unit takes a lot of time to start, especially on iphone 3G + To prevent a one second delay while playing the first digit, we need to activate + the linphonecore graph responsible to play the dtmfs + */ + //[self dtmfWarmup]; + NSDate *soon=[NSDate dateWithTimeIntervalSince1970:(time(NULL)+1)]; + dtmf_warmup = [[NSTimer alloc] initWithFireDate:soon + interval:4 + target:self + selector:@selector(dtmfWarmup) + userInfo:nil + repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:dtmf_warmup + forMode:NSDefaultRunLoopMode]; } + - (void)viewDidDisappear:(BOOL)animated { [[UIApplication sharedApplication] setIdleTimerDisabled:false]; + [dtmf_warmup invalidate]; } diff --git a/submodules/linphone b/submodules/linphone index f89550038..6cd830fda 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit f89550038a73df8d7ded83252401fea09afd65ba +Subproject commit 6cd830fda4252457082f5b5be6909b573e11fd91