DTMF fixes

This commit is contained in:
Pierre-Eric Pelloux-Prayer 2011-11-07 15:40:18 +01:00
parent 649e245a3a
commit 58e9256f79
4 changed files with 33 additions and 22 deletions

View file

@ -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);

View file

@ -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

View file

@ -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];

View file

@ -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 {