From 3ec148068f6a071dc5f7f038d518f9cbcf553af9 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 22 Jan 2010 11:50:14 +0100 Subject: [PATCH] enhanced gui --- Classes/CallHistoryTableViewController.h | 27 + Classes/CallHistoryTableViewController.m | 198 +++ Classes/CallHistoryTableViewController.xib | 289 +++++ Classes/ContactPickerDelegate.h | 33 + Classes/ContactPickerDelegate.m | 51 + Classes/FavoriteTableViewController.h | 36 + Classes/FavoriteTableViewController.m | 242 ++++ Classes/FavoriteTableViewController.xib | 382 ++++++ Classes/GenericTabViewController.h | 36 + Classes/GenericTabViewController.m | 49 + Classes/IncallViewController.h | 102 ++ Classes/IncallViewController.m | 243 ++++ Classes/IncallViewController.xib | 1315 ++++++++++++++++++++ Classes/PhoneViewController.h | 33 +- Classes/PhoneViewController.m | 369 ++---- Classes/PhoneViewController.xib | 998 ++++++++------- Classes/linphoneAppDelegate.h | 61 +- Classes/linphoneAppDelegate.m | 326 ++++- PhoneMainView.xib | 298 ++++- in_call.png | Bin 0 -> 3267 bytes linphone.xcodeproj/project.pbxproj | 79 +- out_call.png | Bin 0 -> 3260 bytes 22 files changed, 4394 insertions(+), 773 deletions(-) create mode 100644 Classes/CallHistoryTableViewController.h create mode 100644 Classes/CallHistoryTableViewController.m create mode 100644 Classes/CallHistoryTableViewController.xib create mode 100644 Classes/ContactPickerDelegate.h create mode 100644 Classes/ContactPickerDelegate.m create mode 100644 Classes/FavoriteTableViewController.h create mode 100644 Classes/FavoriteTableViewController.m create mode 100644 Classes/FavoriteTableViewController.xib create mode 100644 Classes/GenericTabViewController.h create mode 100644 Classes/GenericTabViewController.m create mode 100644 Classes/IncallViewController.h create mode 100644 Classes/IncallViewController.m create mode 100644 Classes/IncallViewController.xib create mode 100644 in_call.png create mode 100644 out_call.png diff --git a/Classes/CallHistoryTableViewController.h b/Classes/CallHistoryTableViewController.h new file mode 100644 index 000000000..db06fa58e --- /dev/null +++ b/Classes/CallHistoryTableViewController.h @@ -0,0 +1,27 @@ +/* CallHistoryTableViewController.h + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#import +#import "GenericTabViewController.h" + + +@interface CallHistoryTableViewController : GenericTabViewController { + +} + +@end diff --git a/Classes/CallHistoryTableViewController.m b/Classes/CallHistoryTableViewController.m new file mode 100644 index 000000000..d3737b7c8 --- /dev/null +++ b/Classes/CallHistoryTableViewController.m @@ -0,0 +1,198 @@ +/* CallHistoryTableViewController.m + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "CallHistoryTableViewController.h" + + +@implementation CallHistoryTableViewController + + + +/* +- (id)initWithStyle:(UITableViewStyle)style { + // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. + if (self = [super initWithStyle:style]) { + } + return self; +} +*/ + +/* +- (void)viewDidLoad { + [super viewDidLoad]; + + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} +*/ + +/* +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; +} +*/ +/* +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + +} +*/ +/* +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; +} +*/ +/* +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; +} +*/ + +/* +// Override to allow orientations other than the default portrait orientation. +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + // Return YES for supported orientations + return (interfaceOrientation == UIInterfaceOrientationPortrait); +} +*/ + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + + + +#pragma mark Table view methods + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + + +// Customize the number of rows in the table view. +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + const MSList * logs = linphone_core_get_call_logs(myLinphoneCore); + return ms_list_size(logs); +} + + +// Customize the appearance of table view cells. +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + + } + + // Set up the cell... + LinphoneCallLog* callLogs = ms_list_nth_data(linphone_core_get_call_logs(myLinphoneCore), indexPath.row) ; + const char* username = linphone_address_get_username(callLogs->to)!=0?linphone_address_get_username(callLogs->to):""; + + [cell.textLabel setText:[[NSString alloc] initWithCString:username encoding:[NSString defaultCStringEncoding]]]; + + + NSString *path; + + if (callLogs->dir == LinphoneCallIncoming) { + path = [[NSBundle mainBundle] pathForResource:@"in_call" ofType:@"png"]; + + } else { + path = [[NSBundle mainBundle] pathForResource:@"out_call" ofType:@"png"]; + + } + UIImage *image = [UIImage imageWithContentsOfFile:path]; + cell.imageView.image = image; + cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; + return cell; +} + + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + // Navigation logic may go here. Create and push another view controller. + // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; + // [self.navigationController pushViewController:anotherViewController]; + // [anotherViewController release]; + [tableView deselectRowAtIndexPath:indexPath animated:NO]; + + LinphoneCallLog* callLogs = ms_list_nth_data(linphone_core_get_call_logs(myLinphoneCore), indexPath.row) ; + const char* username = linphone_address_get_username(callLogs->to)!=0?linphone_address_get_username(callLogs->to):""; + [self.phoneControllerDelegate setPhoneNumber:[[NSString alloc] initWithCString:username encoding:[NSString defaultCStringEncoding]]]; + [self.linphoneDelegate selectDialerTab]; +} + + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + + +- (void)dealloc { + [super dealloc]; +} + + +@end + diff --git a/Classes/CallHistoryTableViewController.xib b/Classes/CallHistoryTableViewController.xib new file mode 100644 index 000000000..f68b21c32 --- /dev/null +++ b/Classes/CallHistoryTableViewController.xib @@ -0,0 +1,289 @@ + + + + 784 + 9L31a + 680 + 949.54 + 353.00 + + YES + + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + + + IBFirstResponder + + + + 292 + {320, 460} + + + 3 + MQA + + NO + YES + NO + + NO + 1 + 0 + YES + 4.400000e+01 + 4.400000e+01 + 2.200000e+01 + + + + 292 + + YES + + + 292 + {314, 44} + + NO + YES + NO + Rencent Calls + + 1 + MCAwIDAAA + + + 1 + 1.000000e+01 + 1 + + + + 292 + {{238, 0}, {72, 37}} + + NO + NO + 0 + 0 + + Helvetica-Bold + 1.500000e+01 + 16 + + 1 + Clear + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + + {320, 44} + + + 1 + MC40OTgwMzkyMiAwLjQ5ODAzOTIyIDAuNDk4MDM5MjIAA + + NO + + + + + YES + + + view + + + + 5 + + + + dataSource + + + + 6 + + + + delegate + + + + 7 + + + + header + + + + 11 + + + + + YES + + 0 + + YES + + + + + + -1 + + + RmlsZSdzIE93bmVyA + + + -2 + + + + + 4 + + + + + 8 + + + YES + + + + + Header + + + 9 + + + + + 10 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.IBPluginDependency + 4.IBEditorWindowLastContentRect + 4.IBPluginDependency + 8.IBEditorWindowLastContentRect + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + CallHistoryTableViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{393, 486}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{520, 620}, {320, 44}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 11 + + + + YES + + CallHistoryTableViewController + GenericTabViewController + + IBProjectSource + Classes/CallHistoryTableViewController.h + + + + GenericTabViewController + UITableViewController + + YES + + YES + header + linphoneDelegate + phoneControllerDelegate + + + YES + UIView + id + id + + + + IBProjectSource + Classes/GenericTabViewController.h + + + + + 0 + ../linphone.xcodeproj + 3 + 3.1 + + diff --git a/Classes/ContactPickerDelegate.h b/Classes/ContactPickerDelegate.h new file mode 100644 index 000000000..63708a46b --- /dev/null +++ b/Classes/ContactPickerDelegate.h @@ -0,0 +1,33 @@ +/* ContactPickerDelegate.h + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#import +#import +#import "PhoneViewController.h" +#import "linphoneAppDelegate.h" + + +@interface ContactPickerDelegate : NSObject { + id phoneControllerDelegate; + id linphoneDelegate; +} + +@property (nonatomic, retain) id phoneControllerDelegate; +@property (nonatomic, retain) id linphoneDelegate; + +@end diff --git a/Classes/ContactPickerDelegate.m b/Classes/ContactPickerDelegate.m new file mode 100644 index 000000000..b66a5db09 --- /dev/null +++ b/Classes/ContactPickerDelegate.m @@ -0,0 +1,51 @@ +/* ContactPickerDelegate.m + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#import "ContactPickerDelegate.h" + + +@implementation ContactPickerDelegate +@synthesize phoneControllerDelegate; +@synthesize linphoneDelegate; + + +- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker + shouldContinueAfterSelectingPerson:(ABRecordRef)person { + return true; + +} + +- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker + shouldContinueAfterSelectingPerson:(ABRecordRef)person + property:(ABPropertyID)property + identifier:(ABMultiValueIdentifier)identifier { + + CFTypeRef multiValue = ABRecordCopyValue(person, property); + CFIndex valueIdx = ABMultiValueGetIndexForIdentifier(multiValue,identifier); + NSString *phoneNumber = (NSString *)ABMultiValueCopyValueAtIndex(multiValue, valueIdx); + [phoneControllerDelegate setPhoneNumber:phoneNumber]; + + [linphoneDelegate selectDialerTab]; + return false; +} + +- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker { + [linphoneDelegate selectDialerTab]; +} + +@end diff --git a/Classes/FavoriteTableViewController.h b/Classes/FavoriteTableViewController.h new file mode 100644 index 000000000..768d6b662 --- /dev/null +++ b/Classes/FavoriteTableViewController.h @@ -0,0 +1,36 @@ +/* FavoriteTableViewController.h + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#import +#import "GenericTabViewController.h" + +@interface FavoriteTableViewController : GenericTabViewController { + UIButton* add; + UIButton* edit; + + +} +- (IBAction)doAddFavorite:(id)sender; +- (IBAction)doEditFavorite:(id)sender; + +@property (nonatomic, retain) IBOutlet UIButton* add; +@property (nonatomic, retain) IBOutlet UIButton* edit; +@end + diff --git a/Classes/FavoriteTableViewController.m b/Classes/FavoriteTableViewController.m new file mode 100644 index 000000000..0cb53a688 --- /dev/null +++ b/Classes/FavoriteTableViewController.m @@ -0,0 +1,242 @@ +/* FavoriteTableViewController.h + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "FavoriteTableViewController.h" + + + +@implementation FavoriteTableViewController +@synthesize add; +@synthesize edit; +/* +- (id)initWithStyle:(UITableViewStyle)style { + // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. + if (self = [super initWithStyle:style]) { + } + return self; +} +*/ + +/* +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} +*/ + +/* +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; +} +*/ +/* +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; +} +*/ +/* +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; +} +*/ +/* +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; +} +*/ + +/* +// Override to allow orientations other than the default portrait orientation. +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + // Return YES for supported orientations + return (interfaceOrientation == UIInterfaceOrientationPortrait); +} +*/ + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + + +- (IBAction)doAddFavorite:(id)sender { + ABPeoplePickerNavigationController* peoplePickerController = [[[ABPeoplePickerNavigationController alloc] init] autorelease]; + [peoplePickerController setPeoplePickerDelegate:self]; + + [self presentModalViewController: peoplePickerController animated:true]; +} +- (IBAction)doEditFavorite:(id)sender { + if ([ self tableView:self.tableView numberOfRowsInSection:0] <= 0) { + return; + } + if (self.tableView.editing) { + [self.tableView setEditing:false animated:true]; + [self.edit setTitle:@"Edit" forState: UIControlStateNormal]; + } else { + [self.tableView setEditing:true animated:true]; + [self.edit setTitle:@"Ok" forState: UIControlStateNormal]; + } +} +#pragma mark Table view methods + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + + +// Customize the number of rows in the table view. +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + const MSList * friends =linphone_core_get_friend_list(myLinphoneCore); + return ms_list_size(friends); +} + + +// Customize the appearance of table view cells. +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *CellIdentifier = @"Cell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + } + LinphoneFriend* friend = ms_list_nth_data(linphone_core_get_friend_list(myLinphoneCore), indexPath.row); + const char* name = linphone_address_get_username(linphone_friend_get_uri(friend)); + + [cell.textLabel setText:[[NSString alloc] initWithCString:name encoding:[NSString defaultCStringEncoding]]]; + cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; + + return cell; +} +/* +- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { + if (isEditing) { + } else { + [super tableView:tableView accessoryButtonTappedForRowWithIndexPath:indexPath]; + } + +} +*/ +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + // Navigation logic may go here. Create and push another view controller. + // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; + // [self.navigationController pushViewController:anotherViewController]; + // [anotherViewController release]; + LinphoneFriend* friend = ms_list_nth_data(linphone_core_get_friend_list(myLinphoneCore), indexPath.row); + const char* name = linphone_address_get_username(linphone_friend_get_uri(friend)); + [phoneControllerDelegate setPhoneNumber:[[NSString alloc] initWithCString:name encoding:[NSString defaultCStringEncoding]]]; + [linphoneDelegate selectDialerTab]; + + +} + + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + + + +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + + if (editingStyle == UITableViewCellEditingStyleDelete) { + LinphoneFriend* friend = ms_list_nth_data(linphone_core_get_friend_list(myLinphoneCore), indexPath.row); + linphone_core_remove_friend(myLinphoneCore, friend); + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; + if ([ self tableView:self.tableView numberOfRowsInSection:0] <= 0) { + [self.tableView setEditing:false animated:true]; + [self.edit setTitle:@"Edit" forState: UIControlStateNormal]; + } + } + else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} + + + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + + +- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker + shouldContinueAfterSelectingPerson:(ABRecordRef)person { + return true; + +} + +- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker + shouldContinueAfterSelectingPerson:(ABRecordRef)person + property:(ABPropertyID)property + identifier:(ABMultiValueIdentifier)identifier { + + CFTypeRef multiValue = ABRecordCopyValue(person, property); + CFIndex valueIdx = ABMultiValueGetIndexForIdentifier(multiValue,identifier); + NSString *phone = (NSString *)ABMultiValueCopyValueAtIndex(multiValue, valueIdx); + NSString *phoneUri = [NSString stringWithFormat:@"sip:%s@dummy.net",[phone cStringUsingEncoding:[NSString defaultCStringEncoding]]]; + NSString* compositeName = ABRecordCopyCompositeName(person); + + LinphoneFriend * newFriend = linphone_friend_new_with_addr([phoneUri cStringUsingEncoding:[NSString defaultCStringEncoding]]); + + linphone_friend_set_name(newFriend,[compositeName cStringUsingEncoding:[NSString defaultCStringEncoding]]); + linphone_friend_send_subscribe(newFriend, false); + //linphone_friend_set_sip_addr(newFriend, const char *uri); + linphone_core_add_friend(myLinphoneCore, newFriend); + [self dismissModalViewControllerAnimated:true]; + return false; +} + +- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker { + [self dismissModalViewControllerAnimated:true]; +} + +- (void)dealloc { + [super dealloc]; +} + + +@end + diff --git a/Classes/FavoriteTableViewController.xib b/Classes/FavoriteTableViewController.xib new file mode 100644 index 000000000..d24219858 --- /dev/null +++ b/Classes/FavoriteTableViewController.xib @@ -0,0 +1,382 @@ + + + + 784 + 9L31a + 680 + 949.54 + 353.00 + + YES + + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + + + IBFirstResponder + + + + 292 + {320, 460} + + + 3 + MQA + + NO + YES + NO + + NO + 1 + 0 + YES + 4.400000e+01 + 2.200000e+01 + 2.200000e+01 + + + + 292 + + YES + + + 292 + {320, 44} + + NO + YES + NO + Favorites + + 1 + MCAwIDAAA + + + + 3 + MCAwLjAwOTk5OTk5OTgAA + + 1 + 1.000000e+01 + 1 + + + + 292 + {{264, 3}, {44, 37}} + + NO + NO + 0 + 0 + + Helvetica-Bold + 1.500000e+01 + 16 + + 1 + + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + + + 292 + {{6, 3}, {61, 37}} + + NO + NO + 0 + 0 + + 1 + Edit + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + {320, 44} + + + 3 + MC42OTcwODAzMSAwLjk5MDAwMDAxAA + + NO + + + + + YES + + + view + + + + 5 + + + + dataSource + + + + 6 + + + + delegate + + + + 7 + + + + header + + + + 12 + + + + add + + + + 13 + + + + doAddFavorite: + + + 7 + + 14 + + + + edit + + + + 15 + + + + doEditFavorite: + + + 7 + + 16 + + + + + YES + + 0 + + YES + + + + + + -1 + + + RmlsZSdzIE93bmVyA + + + -2 + + + + + 4 + + + + + 8 + + + YES + + + + + + header + + + 9 + + + + + 10 + + + add + + + 11 + + + edit + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.IBPluginDependency + 11.IBPluginDependency + 4.IBEditorWindowLastContentRect + 4.IBPluginDependency + 8.IBEditorWindowLastContentRect + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + FavoriteTableViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{441, 269}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{312, 742}, {320, 44}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 16 + + + + YES + + FavoriteTableViewController + GenericTabViewController + + YES + + YES + doAddFavorite: + doEditFavorite: + + + YES + id + id + + + + YES + + YES + add + edit + + + YES + UIButton + UIButton + + + + IBProjectSource + Classes/FavoriteTableViewController.h + + + + GenericTabViewController + UITableViewController + + YES + + YES + header + linphoneDelegate + phoneControllerDelegate + + + YES + UIView + id + id + + + + IBProjectSource + Classes/GenericTabViewController.h + + + + + 0 + ../linphone.xcodeproj + 3 + 3.1 + + diff --git a/Classes/GenericTabViewController.h b/Classes/GenericTabViewController.h new file mode 100644 index 000000000..1ce13680a --- /dev/null +++ b/Classes/GenericTabViewController.h @@ -0,0 +1,36 @@ +/* GenericTabViewController.h + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import +#include "linphonecore.h" +#import "PhoneViewController.h" +#import "linphoneAppDelegate.h" + +@interface GenericTabViewController : UITableViewController { + LinphoneCore* myLinphoneCore; + id phoneControllerDelegate; + id linphoneDelegate; + IBOutlet UIView* header; +} +-(void) setLinphoneCore:(LinphoneCore*) lc; +@property (nonatomic, retain) id phoneControllerDelegate; +@property (nonatomic, retain) id linphoneDelegate; +@property (nonatomic, retain) IBOutlet UIView* header; +@end + diff --git a/Classes/GenericTabViewController.m b/Classes/GenericTabViewController.m new file mode 100644 index 000000000..3aed6191f --- /dev/null +++ b/Classes/GenericTabViewController.m @@ -0,0 +1,49 @@ +/* GenericTabViewController.c + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#import "GenericTabViewController.h" + + +@implementation GenericTabViewController +@synthesize phoneControllerDelegate; +@synthesize linphoneDelegate; +@synthesize header; + + +- (void)viewDidLoad { + [super viewDidLoad]; + self.tableView.tableHeaderView=header; +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + [self.tableView reloadData]; +} + +-(void) setLinphoneCore:(LinphoneCore*) lc { + myLinphoneCore = lc; +} + +- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { + + [self tableView:tableView didSelectRowAtIndexPath:indexPath]; +} + +@end + diff --git a/Classes/IncallViewController.h b/Classes/IncallViewController.h new file mode 100644 index 000000000..9a5771276 --- /dev/null +++ b/Classes/IncallViewController.h @@ -0,0 +1,102 @@ +/* IncallViewController.h + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#import +#import "linphonecore.h" +#import "PhoneViewController.h" +#import + + +@interface IncallViewController : UIViewController { + LinphoneCore* myLinphoneCore; + id phoneviewDelegate; + NSTimer *durationRefreasher; + + + UIView* controlSubView; + UIView* padSubView; + + UILabel* peerName; + UILabel* peerNumber; + UILabel* callDuration; + UILabel* status; + UIButton* end; + UIButton* dialer; + UIButton* mute; + UIButton* speaker; + UIButton* contacts; + + //key pad + UIButton* one; + UIButton* two; + UIButton* three; + UIButton* four; + UIButton* five; + UIButton* six; + UIButton* seven; + UIButton* eight; + UIButton* nine; + UIButton* star; + UIButton* zero; + UIButton* hash; + + UIButton* close; + + bool isMuted; + bool isSpeaker; + + ABPeoplePickerNavigationController* myPeoplePickerController; +} + +-(void) setLinphoneCore:(LinphoneCore*) lc; +-(void) startCall; + +-(void)displayStatus:(NSString*) message; + +- (IBAction)doAction:(id)sender; + +@property (nonatomic, retain) IBOutlet UIView* controlSubView; +@property (nonatomic, retain) IBOutlet UIView* padSubView; + +@property (nonatomic, retain) IBOutlet UILabel* peerName; +@property (nonatomic, retain) IBOutlet UILabel* peerNumber; +@property (nonatomic, retain) IBOutlet UILabel* callDuration; +@property (nonatomic, retain) IBOutlet UILabel* status; +@property (nonatomic, retain) IBOutlet UIButton* end; +@property (nonatomic, retain) IBOutlet UIButton* dialer; +@property (nonatomic, retain) IBOutlet UIButton* mute; +@property (nonatomic, retain) IBOutlet UIButton* speaker; +@property (nonatomic, retain) IBOutlet UIButton* contacts; + + +@property (nonatomic, retain) IBOutlet UIButton* one; +@property (nonatomic, retain) IBOutlet UIButton* two; +@property (nonatomic, retain) IBOutlet UIButton* three; +@property (nonatomic, retain) IBOutlet UIButton* four; +@property (nonatomic, retain) IBOutlet UIButton* five; +@property (nonatomic, retain) IBOutlet UIButton* six; +@property (nonatomic, retain) IBOutlet UIButton* seven; +@property (nonatomic, retain) IBOutlet UIButton* eight; +@property (nonatomic, retain) IBOutlet UIButton* nine; +@property (nonatomic, retain) IBOutlet UIButton* star; +@property (nonatomic, retain) IBOutlet UIButton* zero; +@property (nonatomic, retain) IBOutlet UIButton* hash; +@property (nonatomic, retain) IBOutlet UIButton* close; + +@property (nonatomic, retain) id phoneviewDelegate; +@end diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m new file mode 100644 index 000000000..73493fca2 --- /dev/null +++ b/Classes/IncallViewController.m @@ -0,0 +1,243 @@ +/* IncallViewController.h + * + * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#import "IncallViewController.h" +#import +#import "linphonecore.h" + + + +@implementation IncallViewController +@synthesize phoneviewDelegate; + +@synthesize controlSubView; +@synthesize padSubView; + +@synthesize peerName; +@synthesize peerNumber; +@synthesize callDuration; +@synthesize status; +@synthesize end; +@synthesize close; +@synthesize mute; +@synthesize dialer; +@synthesize speaker; +@synthesize contacts; + +@synthesize one; +@synthesize two; +@synthesize three; +@synthesize four; +@synthesize five; +@synthesize six; +@synthesize seven; +@synthesize eight; +@synthesize nine; +@synthesize star; +@synthesize zero; +@synthesize hash; + + +/* +// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { + // Custom initialization + + } + return self; +} +*/ + + +// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. +- (void)viewDidLoad { + [super viewDidLoad]; + isMuted = false; + isSpeaker = false; + +} + + +/* + // Override to allow orientations other than the default portrait orientation. + - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + // Return YES for supported orientations + return (interfaceOrientation == UIInterfaceOrientationPortrait); + } + */ + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; + if (durationRefreasher != nil) { + [ durationRefreasher invalidate]; + } + +} + +-(void) setLinphoneCore:(LinphoneCore*) lc { + myLinphoneCore = lc; +} + +-(void)displayStatus:(NSString*) message { + [status setText:message]; +} + +-(void) startCall { + const LinphoneAddress* address = linphone_core_get_remote_uri(myLinphoneCore); + const char* displayName = linphone_address_get_display_name(address)?linphone_address_get_display_name(address):""; + [peerName setText:[NSString stringWithCString:displayName length:strlen(displayName)]]; + + const char* username = linphone_address_get_username(address)!=0?linphone_address_get_username(address):""; + [peerNumber setText:[NSString stringWithCString:username length:strlen(username)]]; + // start scheduler + durationRefreasher = [NSTimer scheduledTimerWithTimeInterval:1 + target:self + selector:@selector(updateCallDuration) + userInfo:nil + repeats:YES]; + +} + +-(void)updateCallDuration { + int lDuration = linphone_core_get_current_call_duration(myLinphoneCore); + if (lDuration < 60) { + [callDuration setText:[NSString stringWithFormat: @"%i s", lDuration]]; + } else { + [callDuration setText:[NSString stringWithFormat: @"%i:%i", lDuration/60,lDuration - 60 *(lDuration/60)]]; + } +} + +- (IBAction)doAction:(id)sender { + + if (linphone_core_in_call(myLinphoneCore)) { + //incall behavior + if (sender == one) { + linphone_core_send_dtmf(myLinphoneCore,'1'); + } else if (sender == two) { + linphone_core_send_dtmf(myLinphoneCore,'2'); + } else if (sender == three) { + linphone_core_send_dtmf(myLinphoneCore,'3'); + } else if (sender == four) { + linphone_core_send_dtmf(myLinphoneCore,'4'); + } else if (sender == five) { + linphone_core_send_dtmf(myLinphoneCore,'5'); + } else if (sender == six) { + linphone_core_send_dtmf(myLinphoneCore,'6'); + } else if (sender == seven) { + linphone_core_send_dtmf(myLinphoneCore,'7'); + } else if (sender == eight) { + linphone_core_send_dtmf(myLinphoneCore,'8'); + } else if (sender == nine) { + linphone_core_send_dtmf(myLinphoneCore,'9'); + } else if (sender == star) { + linphone_core_send_dtmf(myLinphoneCore,'*'); + } else if (sender == zero) { + linphone_core_send_dtmf(myLinphoneCore,'0'); + } else if (sender == hash) { + linphone_core_send_dtmf(myLinphoneCore,'#'); + } + } + + + if (sender == end) { + linphone_core_terminate_call(myLinphoneCore,NULL); + } else if (sender == dialer) { + [controlSubView setHidden:true]; + [padSubView setHidden:false]; + + } else if (sender == contacts) { + // start people picker + myPeoplePickerController = [[[ABPeoplePickerNavigationController alloc] init] autorelease]; + [myPeoplePickerController setPeoplePickerDelegate:self]; + + [self presentModalViewController: myPeoplePickerController animated:true]; + } else if (sender == close) { + [controlSubView setHidden:false]; + [padSubView setHidden:true]; + } else if (sender == mute) { + isMuted = isMuted?false:true; + linphone_core_mute_mic(myLinphoneCore,isMuted); + // swithc buttun state + UIImage * tmpImage = [mute backgroundImageForState: UIControlStateNormal]; + [mute setBackgroundImage:[mute backgroundImageForState: UIControlStateHighlighted] forState:UIControlStateNormal]; + [mute setBackgroundImage:tmpImage forState:UIControlStateHighlighted]; + + } else if (sender == speaker) { + isSpeaker = isSpeaker?false:true; + if (isSpeaker) { + //redirect audio to speaker + UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; + AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute + , sizeof (audioRouteOverride) + , &audioRouteOverride); + } else { + //Cancel audio route redirection + UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_None; + AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute + , sizeof (audioRouteOverride) + , &audioRouteOverride); + } + // switch button state + UIImage * tmpImage = [speaker backgroundImageForState: UIControlStateNormal]; + [speaker setBackgroundImage:[speaker backgroundImageForState: UIControlStateHighlighted] forState:UIControlStateNormal]; + [speaker setBackgroundImage:tmpImage forState:UIControlStateHighlighted]; + + }else { + NSLog(@"unknown event from incall view"); + } + +} + +// handle people picker behavior + +- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker + shouldContinueAfterSelectingPerson:(ABRecordRef)person { + return true; + +} + +- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker + shouldContinueAfterSelectingPerson:(ABRecordRef)person + property:(ABPropertyID)property + identifier:(ABMultiValueIdentifier)identifier { + + return false; +} + +- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker { + [self dismissModalViewControllerAnimated:true]; +} + + + + +- (void)dealloc { + [super dealloc]; +} + + +@end diff --git a/Classes/IncallViewController.xib b/Classes/IncallViewController.xib new file mode 100644 index 000000000..ea7013b59 --- /dev/null +++ b/Classes/IncallViewController.xib @@ -0,0 +1,1315 @@ + + + + 784 + 9L31a + 680 + 949.54 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + + + IBFirstResponder + + + + + 274 + + YES + + + 292 + {{150, 220}, {20, 20}} + + NO + NO + NO + NO + 2 + + + + 292 + {320, 55} + + NO + YES + NO + Caller + + 1 + MCAwIDAAA + + + 1 + 1.700000e+01 + 1 + + + + 292 + {{31, 63}, {61, 21}} + + NO + YES + NO + Number + + + 1 + 1.000000e+01 + + + + 292 + {{239, 63}, {65, 21}} + + NO + YES + NO + Duration + + + 1 + 1.000000e+01 + + + + 292 + {{31, 347}, {258, 21}} + + NO + YES + NO + status + + + 1 + 1.000000e+01 + + + + 292 + + YES + + + 292 + {{0, 61}, {82, 52}} + + NO + NO + 0 + 0 + + Helvetica-Bold + 1.500000e+01 + 16 + + + 3 + MQA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + NSImage + mic_active.png + + + NSImage + mic_muted.png + + + + + + + 292 + {{6, 261}, {258, 52}} + + NO + NO + 0 + 0 + + 1 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + red.png + + + + + 292 + {{92, 121}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + Contacts + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{93, 61}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + Dialer + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{181, 61}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + Spk + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + {{25, 110}, {270, 317}} + + + 3 + MSAwAA + + 2 + + + NO + NO + + + + -2147483356 + + YES + + + 292 + {{30, 258}, {80, 65}} + + NO + NO + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + + 292 + {{170, 266}, {72, 37}} + + NO + NO + 0 + 0 + + 1 + close + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{90, 184}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 0 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{0, 9}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 1 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{90, 9}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 2 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{180, 9}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 3 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{0, 69}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 4 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{90, 69}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 5 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{180, 69}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 6 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{0, 124}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 7 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{90, 124}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 8 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{180, 124}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + 9 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{0, 184}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + * + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{180, 184}, {82, 52}} + + NO + NO + 0 + 0 + + 1 + # + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + {{25, 110}, {270, 317}} + + + 3 + MSAwAA + + + NO + NO + + + {320, 460} + + + 1 + MCAwLjUwMTk2MDgxIDEAA + + NO + + + + + + + YES + + + doAction: + + + 7 + + 20 + + + + view + + + + 23 + + + + doAction: + + + 7 + + 42 + + + + controlSubView + + + + 44 + + + + padSubView + + + + 45 + + + + doAction: + + + 7 + + 47 + + + + dialer + + + + 49 + + + + doAction: + + + 7 + + 50 + + + + close + + + + 51 + + + + end + + + + 53 + + + + one + + + + 54 + + + + zero + + + + 55 + + + + star + + + + 56 + + + + hash + + + + 57 + + + + nine + + + + 58 + + + + two + + + + 59 + + + + three + + + + 60 + + + + doAction: + + + 1 + + 61 + + + + doAction: + + + 1 + + 62 + + + + doAction: + + + 1 + + 63 + + + + doAction: + + + 1 + + 64 + + + + doAction: + + + 1 + + 65 + + + + doAction: + + + 1 + + 66 + + + + four + + + + 67 + + + + doAction: + + + 1 + + 68 + + + + five + + + + 69 + + + + doAction: + + + 1 + + 70 + + + + six + + + + 71 + + + + doAction: + + + 1 + + 72 + + + + seven + + + + 73 + + + + doAction: + + + 1 + + 74 + + + + eight + + + + 75 + + + + doAction: + + + 1 + + 76 + + + + doAction: + + + 1 + + 77 + + + + mute + + + + 80 + + + + doAction: + + + 7 + + 81 + + + + speaker + + + + 82 + + + + doAction: + + + 7 + + 83 + + + + contacts + + + + 84 + + + + doAction: + + + 7 + + 85 + + + + peerName + + + + 89 + + + + peerNumber + + + + 90 + + + + callDuration + + + + 91 + + + + status + + + + 94 + + + + + YES + + 0 + + YES + + + + + + -1 + + + RmlsZSdzIE93bmVyA + + + -2 + + + + + 2 + + + YES + + + + + + 9 + + + YES + + + + + + + + + + + + 10 + + + peerName + + + 11 + + + peerNumber + + + 12 + + + duration + + + 26 + + + YES + + + + + + + + controls + + + 13 + + + speaker + + + 17 + + + dialer + + + 18 + + + end + + + 16 + + + mute + + + 15 + + + contacts + + + 27 + + + YES + + + + + + + + + + + + + + + + + pad + + + 28 + + + end + + + 29 + + + close + + + 30 + + + 1 + + + 31 + + + start + + + 32 + + + 9 + + + 33 + + + 8 + + + 34 + + + 7 + + + 35 + + + 4 + + + 36 + + + 5 + + + 37 + + + 6 + + + 38 + + + 3 + + + 39 + + + 2 + + + 40 + + + hash + + + 41 + + + 0 + + + 92 + + + + + 93 + + + status + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 26.IBPluginDependency + 27.IBPluginDependency + 28.IBPluginDependency + 29.IBPluginDependency + 30.IBPluginDependency + 31.IBPluginDependency + 32.IBPluginDependency + 33.IBPluginDependency + 34.IBPluginDependency + 35.IBPluginDependency + 36.IBPluginDependency + 37.IBPluginDependency + 38.IBPluginDependency + 39.IBPluginDependency + 40.IBPluginDependency + 41.IBPluginDependency + 9.IBPluginDependency + 92.IBPluginDependency + 93.IBPluginDependency + + + YES + IncallViewController + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{528, 218}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 94 + + + + YES + + IncallViewController + UIViewController + + doAction: + id + + + YES + + YES + callDuration + close + contacts + controlSubView + dialer + eight + end + five + four + hash + mute + nine + one + padSubView + peerName + peerNumber + phoneviewDelegate + seven + six + speaker + star + status + three + two + zero + + + YES + UILabel + UIButton + UIButton + UIView + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIView + UILabel + UILabel + id + UIButton + UIButton + UIButton + UIButton + UILabel + UIButton + UIButton + UIButton + + + + IBProjectSource + Classes/IncallViewController.h + + + + + 0 + ../linphone.xcodeproj + 3 + 3.1 + + diff --git a/Classes/PhoneViewController.h b/Classes/PhoneViewController.h index df951dd74..0748788ea 100644 --- a/Classes/PhoneViewController.h +++ b/Classes/PhoneViewController.h @@ -20,15 +20,21 @@ #import #import "linphonecore.h" +@protocol PhoneViewControllerDelegate +-(void)setPhoneNumber:(NSString*)number; +-(void)dismissIncallView; +-(void)displayStatus:(NSString*) message; +@end +@class IncallViewController; -@interface PhoneViewController : UIViewController { +@interface PhoneViewController : UIViewController { @private //UI definition UITextField* address; UIButton* call; - UIButton* cancel; + UILabel* status; //key pad @@ -45,16 +51,16 @@ UIButton* zero; UIButton* hash; + UIButton* back; /* * lib linphone main context */ LinphoneCore* mCore; - int traceLevel; + IncallViewController *myIncallViewController; } @property (nonatomic, retain) IBOutlet UITextField* address; @property (nonatomic, retain) IBOutlet UIButton* call; -@property (nonatomic, retain) IBOutlet UIButton* cancel; @property (nonatomic, retain) IBOutlet UILabel* status; @property (nonatomic, retain) IBOutlet UIButton* one; @@ -70,19 +76,21 @@ @property (nonatomic, retain) IBOutlet UIButton* zero; @property (nonatomic, retain) IBOutlet UIButton* hash; -/********************************** - * liblinphone initialization method - **********************************/ --(void) startlibLinphone; +@property (nonatomic, retain) IBOutlet UIButton* back; + + /* - * liblinphone scheduling method; + * Handle call state change from linphone */ --(void) iterate; +-(void) callStateChange:(LinphoneGeneralState*) state; + +-(void) setLinphoneCore:(LinphoneCore*) lc; /******************** * UI method handlers ********************/ +-(void)doKeyZeroLongPress; //method to handle cal/hangup events - (IBAction)doAction:(id)sender; @@ -90,6 +98,9 @@ // method to handle keypad event - (IBAction)doKeyPad:(id)sender; +- (IBAction)doKeyPadUp:(id)sender; + +-(void) dismissAlertDialog:(UIAlertView*)alertView; + --(PayloadType*) findPayload:(NSString*)type withRate:(int)rate from:(const MSList*)list; @end diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 639685e7f..1caf46a56 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -23,58 +23,11 @@ #import -//generic log handler for debug version -void linphone_iphone_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){ - NSString* format = [[NSString alloc] initWithCString:fmt encoding:[NSString defaultCStringEncoding]]; - NSLogv(format,args); - [format release]; -} - -//Error/warning log handler -void linphone_iphone_log(struct _LinphoneCore * lc, const char * message) { - NSLog([NSString stringWithCString:message length:strlen(message)]); -} -//status -void linphone_iphone_display_status(struct _LinphoneCore * lc, const char * message) { - PhoneViewController* lPhone = linphone_core_get_user_data(lc); - [lPhone.status setText:[NSString stringWithCString:message length:strlen(message)]]; -} - -void linphone_iphone_show(struct _LinphoneCore * lc) { - //nop -} -void linphone_iphone_call_received(LinphoneCore *lc, const char *from){ - //redirect audio to speaker - UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; - - AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute - , sizeof (audioRouteOverride) - , &audioRouteOverride); -}; - -LinphoneCoreVTable linphonec_vtable = { -.show =(ShowInterfaceCb) linphone_iphone_show, -.inv_recv = linphone_iphone_call_received, -.bye_recv = NULL, -.notify_recv = NULL, -.new_unknown_subscriber = NULL, -.auth_info_requested = NULL, -.display_status = linphone_iphone_display_status, -.display_message=linphone_iphone_log, -.display_warning=linphone_iphone_log, -.display_url=NULL, -.display_question=(DisplayQuestionCb)NULL, -.text_received=NULL, -.general_state=NULL, -.dtmf_received=NULL -}; - @implementation PhoneViewController @synthesize address ; @synthesize call; -@synthesize cancel; @synthesize status; @synthesize one; @@ -90,6 +43,15 @@ LinphoneCoreVTable linphonec_vtable = { @synthesize zero; @synthesize hash; +@synthesize back; + +-(void)setPhoneNumber:(NSString*)number { + [address setText:number]; +} + +-(void)dismissIncallView { + [self dismissModalViewControllerAnimated:true]; +} //implements call/cancel button behavior -(IBAction) doAction:(id)sender { @@ -108,44 +70,15 @@ LinphoneCoreVTable linphonec_vtable = { AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute , sizeof (audioRouteOverride) , &audioRouteOverride); - } else if (sender == cancel) { - linphone_core_terminate_call(mCore,NULL); + + } } //implements keypad behavior -(IBAction) doKeyPad:(id)sender { - if (linphone_core_in_call(mCore)) { - //incall behavior - if (sender == one) { - linphone_core_send_dtmf(mCore,'1'); - } else if (sender == two) { - linphone_core_send_dtmf(mCore,'2'); - } else if (sender == three) { - linphone_core_send_dtmf(mCore,'3'); - } else if (sender == four) { - linphone_core_send_dtmf(mCore,'4'); - } else if (sender == five) { - linphone_core_send_dtmf(mCore,'5'); - } else if (sender == six) { - linphone_core_send_dtmf(mCore,'6'); - } else if (sender == seven) { - linphone_core_send_dtmf(mCore,'7'); - } else if (sender == eight) { - linphone_core_send_dtmf(mCore,'8'); - } else if (sender == nine) { - linphone_core_send_dtmf(mCore,'9'); - } else if (sender == star) { - linphone_core_send_dtmf(mCore,'*'); - } else if (sender == zero) { - linphone_core_send_dtmf(mCore,'0'); - } else if (sender == hash) { - linphone_core_send_dtmf(mCore,'#'); - } else { - NSLog(@"unknown event from dial pad"); - } - } else { + if (!linphone_core_in_call(mCore)) { //outcall behavior //remove sip: if first digits if ([address.text isEqualToString:@"sip:"]) { @@ -174,15 +107,52 @@ LinphoneCoreVTable linphonec_vtable = { newAddress = [address.text stringByAppendingString:@"*"]; } else if (sender == zero) { newAddress = [address.text stringByAppendingString:@"0"]; + //start timer for + + [self performSelector:@selector(doKeyZeroLongPress) withObject:nil afterDelay:0.5]; } else if (sender == hash) { newAddress = [address.text stringByAppendingString:@"#"]; + } else if (sender == back) { + if ([address.text length] >0) { + newAddress = [address.text substringToIndex: [address.text length]-1]; + } } else { - NSLog(@"unknown event from diad pad"); + NSLog(@"unknown event from diad pad"); + return; + } + if (newAddress != nil) { + [address setText:newAddress]; } - [address setText:newAddress]; } } +//implements keypad up +-(IBAction) doKeyPadUp:(id)sender { + if (sender == zero) { + //cancel timer for + + [NSObject cancelPreviousPerformRequestsWithTarget:self + selector:@selector(doKeyZeroLongPress) + object:nil]; + } else { + NSLog(@"unknown up event from dial pad"); + } +} + +-(void)doKeyZeroLongPress { + NSString* newAddress = [[address.text substringToIndex: [address.text length]-1] stringByAppendingString:@"+"]; + [address setText:newAddress]; + +} + +-(void) setLinphoneCore:(LinphoneCore*) lc { + mCore = lc; + [myIncallViewController setLinphoneCore:mCore]; +} +-(void)displayStatus:(NSString*) message { + [status setText:message]; + if (myIncallViewController != nil) { + [myIncallViewController displayStatus:message]; + } +} /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. @@ -194,12 +164,20 @@ LinphoneCoreVTable linphonec_vtable = { } */ -/* + // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; + if (myIncallViewController == nil) { + myIncallViewController = [[IncallViewController alloc] initWithNibName:@"IncallViewController" bundle:[NSBundle mainBundle]]; + [myIncallViewController setPhoneviewDelegate:self]; + + } + + + } -*/ + /* // Override to allow orientations other than the default portrait orientation. @@ -230,186 +208,77 @@ LinphoneCoreVTable linphonec_vtable = { } -/************* - *lib linphone init method - */ --(void)startlibLinphone { - - //init audio session - NSError *setError = nil; - [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error: &setError]; //must be call before linphone_core_init - - //get default config from bundle - NSBundle* myBundle = [NSBundle mainBundle]; - NSString* defaultConfigFile = [myBundle pathForResource:@"linphonerc"ofType:nil] ; -#if TARGET_IPHONE_SIMULATOR - NSDictionary *dictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSFileImmutable]; - [[NSFileManager defaultManager] setAttributes:dictionary ofItemAtPath:defaultConfigFile error:nil]; -#endif - //log management - traceLevel = 9; - if (traceLevel > 0) { - //redirect all traces to the iphone log framework - linphone_core_enable_logs_with_cb(linphone_iphone_log_handler); - } - else { - linphone_core_disable_logs(); - } - - //register audio queue sound card - ms_au_register_card(); - - /* - * Initialize linphone core - */ - - mCore = linphone_core_new (&linphonec_vtable, [defaultConfigFile cStringUsingEncoding:[NSString defaultCStringEncoding]],self); - - // Set audio assets - const char* lRing = [[myBundle pathForResource:@"oldphone-mono"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; - linphone_core_set_ring(mCore, lRing ); - const char* lRingBack = [[myBundle pathForResource:@"ringback"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; - linphone_core_set_ringback(mCore, lRingBack); - - - //configure sip account - //get data from Settings bundle - NSString* accountNameUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"account_preference"]; - const char* identity = [accountNameUri cStringUsingEncoding:[NSString defaultCStringEncoding]]; - - NSString* accountPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"password_preference"]; - const char* password = [accountPassword cStringUsingEncoding:[NSString defaultCStringEncoding]]; - - NSString* proxyUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"proxy_preference"]; - const char* proxy = [proxyUri cStringUsingEncoding:[NSString defaultCStringEncoding]]; - - NSString* routeUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"route_preference"]; - const char* route = [routeUri cStringUsingEncoding:[NSString defaultCStringEncoding]]; - - if (([accountNameUri length] + [proxyUri length]) >8 ) { - //possible valid config detected - LinphoneProxyConfig* proxyCfg; - //clear auth info list - linphone_core_clear_all_auth_info(mCore); - //get default proxy - linphone_core_get_default_proxy(mCore,&proxyCfg); - boolean_t addProxy=false; - if (proxyCfg == NULL) { - //create new proxy - proxyCfg = linphone_proxy_config_new(); - addProxy = true; - } else { - linphone_proxy_config_edit(proxyCfg); - } - - // add username password - osip_from_t *from; - LinphoneAuthInfo *info; - osip_from_init(&from); - if (osip_from_parse(from,identity)==0){ - info=linphone_auth_info_new(from->url->username,NULL,password,NULL,NULL); - linphone_core_add_auth_info(mCore,info); - } - osip_from_free(from); - - // configure proxy entries - linphone_proxy_config_set_identity(proxyCfg,identity); - linphone_proxy_config_set_server_addr(proxyCfg,proxy); - if ([routeUri length] > 4) { - linphone_proxy_config_set_route(proxyCfg,route); - } - linphone_proxy_config_enable_register(proxyCfg,TRUE); - if (addProxy) { - linphone_core_add_proxy_config(mCore,proxyCfg); - //set to default proxy - linphone_core_set_default_proxy(mCore,proxyCfg); - } else { - linphone_proxy_config_done(proxyCfg); - } - - } - - //Configure Codecs - - PayloadType *pt; - //get codecs from linphonerc - const MSList *audioCodecs=linphone_core_get_audio_codecs(mCore); - - //read from setting bundle - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"speex_32k_preference"]) { - if(pt = [self findPayload:@"speex"withRate:32000 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"speex_16k_preference"]) { - if(pt = [self findPayload:@"speex"withRate:16000 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"speex_8k_preference"]) { - if(pt = [self findPayload:@"speex"withRate:8000 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"gsm_22k_preference"]) { - if(pt = [self findPayload:@"GSM"withRate:22050 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"gsm_11k_preference"]) { - if(pt = [self findPayload:@"GSM"withRate:11025 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"gsm_8k_preference"]) { - if(pt = [self findPayload:@"GSM"withRate:8000 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"pcmu_preference"]) { - if(pt = [self findPayload:@"PCMU"withRate:8000 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"pcma_preference"]) { - if(pt = [self findPayload:@"PCMA"withRate:8000 from:audioCodecs]) { - payload_type_set_enable(pt,TRUE); - } - } - - - // start scheduler - [NSTimer scheduledTimerWithTimeInterval:0.1 - target:self - selector:@selector(iterate) - userInfo:nil - repeats:YES]; +-(void) dismissAlertDialog:(UIAlertView*) alertView{ + [alertView dismissWithClickedButtonIndex:0 animated:TRUE]; } -//scheduling loop --(void) iterate { - linphone_core_iterate(mCore); -} - - (void)dealloc { [address dealloc]; [call dealloc]; - [cancel dealloc]; [status dealloc]; [super dealloc]; } --(PayloadType*) findPayload:(NSString*)type withRate:(int)rate from:(const MSList*)list { - const MSList *elem; - for(elem=list;elem!=NULL;elem=elem->next){ - PayloadType *pt=(PayloadType*)elem->data; - if ([type isEqualToString:[NSString stringWithCString:payload_type_get_mime(pt) length:strlen(payload_type_get_mime(pt))]] && rate==pt->clock_rate) { - return pt; +-(void) callStateChange:(LinphoneGeneralState*) state { + // /* states for GSTATE_GROUP_POWER */ + // GSTATE_POWER_OFF = 0, /* initial state */ + // GSTATE_POWER_STARTUP, + // GSTATE_POWER_ON, + // GSTATE_POWER_SHUTDOWN, + // /* states for GSTATE_GROUP_REG */ + // GSTATE_REG_NONE = 10, /* initial state */ + // GSTATE_REG_OK, + // GSTATE_REG_FAILED, + // /* states for GSTATE_GROUP_CALL */ + // GSTATE_CALL_IDLE = 20, /* initial state */ + // GSTATE_CALL_OUT_INVITE, + // GSTATE_CALL_OUT_CONNECTED, + // GSTATE_CALL_IN_INVITE, + // GSTATE_CALL_IN_CONNECTED, + // GSTATE_CALL_END, + // GSTATE_CALL_ERROR, + // GSTATE_INVALID + switch (state->new_state) { + case GSTATE_CALL_IN_INVITE: + case GSTATE_CALL_OUT_INVITE: { + //[myIncallViewController startCall]; + [self presentModalViewController: myIncallViewController animated:true]; + break; } + + case GSTATE_CALL_ERROR: { + NSString* lTitle= state->message!=nil?[NSString stringWithCString:state->message length:strlen(state->message)]: @"Error"; + NSString* lMessage=lTitle; + + + UIAlertView* error = [[UIAlertView alloc] initWithTitle:lTitle + message:lMessage + delegate:nil + cancelButtonTitle:nil + otherButtonTitles:nil]; + [error show]; + [self performSelector:@selector(dismissAlertDialog:) withObject:error afterDelay:1]; + [self performSelector:@selector(dismissIncallView) withObject:nil afterDelay:1]; + + } + break; + case GSTATE_CALL_IN_CONNECTED: + case GSTATE_CALL_OUT_CONNECTED: { + [myIncallViewController startCall]; + break; + } + + case GSTATE_CALL_END: { + //end off call, just dismiss Incall view + [self dismissIncallView]; + break; + } + default: + break; } - return nil; } + @end diff --git a/Classes/PhoneViewController.xib b/Classes/PhoneViewController.xib index f564b719f..13a9d9866 100644 --- a/Classes/PhoneViewController.xib +++ b/Classes/PhoneViewController.xib @@ -8,7 +8,7 @@ 353.00 YES - + YES @@ -31,352 +31,369 @@ IBFirstResponder - - - 292 - - YES - - - 292 - {{21, 20}, {280, 31}} - - NO - NO - 0 - sip: - 3 - - 3 - MAA - - 2 + + + + 292 + + YES + + + 292 + + YES + + + 292 + {{0, 20}, {227, 31}} + + NO + NO + 0 + + 3 + sip: + + 3 + MAA + + 2 + + + YES + 1.700000e+01 + + 3 + + + + 292 + {{231, 20}, {51, 32}} + + NO + NO + 0 + 0 + + Helvetica-Bold + 1.500000e+01 + 16 + + 1 + PC0gA + + 3 + MQA + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 3 + MC41AA + + + + {{18, -6}, {282, 63}} + + + 3 + MSAwAA + + + NO + NO + + + + 292 + {{21, 312}, {72, 59}} + + NO + NO + 0 + 0 + + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + NSImage + green.png - YES - YES - 1.700000e+01 - - 3 - - - - 292 - {{21, 364}, {72, 59}} - - NO - NO - 0 - 0 - - Helvetica-Bold - 1.500000e+01 - 16 + + + 292 + {{0, 379}, {312, 21}} + + NO + YES + NO + status + + 1 + MCAwIDAAA + + + 1 + 1.000000e+01 - - 3 - MQA + + + 292 + {{217, 65}, {83, 51}} + + NO + NO + 0 + 0 + + 1 + 3 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + 292 + {{21, 124}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + 4 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + - - 3 - MC41AA + + + 292 + {{120, 124}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + 5 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + - - NSImage - green.png + + + 292 + {{217, 124}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + 6 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{21, 184}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + 7 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{217, 184}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + 9 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{120, 65}, {83, 51}} + + NO + NO + 0 + 0 + + 1 + 2 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{21, 65}, {83, 51}} + + NO + NO + 0 + 0 + + 1 + 1 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{21, 244}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + * + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{120, 246}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + 0+ + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{217, 244}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + # + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + + + + + 292 + {{120, 306}, {175, 65}} + + NO + NO + NO + + NSImage + linphone.png + + + + + 292 + {{118, 186}, {83, 52}} + + NO + NO + 0 + 0 + + 1 + 8 + + + 1 + MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA + + - - - 292 - {{226, 364}, {74, 59}} - - NO - NO - 0 - 0 - - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - NSImage - red.png - - - - - 292 - {{0, 431}, {312, 21}} - - NO - YES - NO - status - - 1 - MCAwIDAAA - - - 1 - 1.000000e+01 - - - - 292 - {{217, 117}, {83, 51}} - - NO - NO - 0 - 0 - - 1 - 3 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{21, 176}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - 4 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{120, 176}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - 5 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{217, 176}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - 6 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{21, 236}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - 7 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{120, 236}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - 8 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{217, 236}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - 9 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{120, 117}, {83, 51}} - - NO - NO - 0 - 0 - - 1 - 2 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{21, 117}, {83, 51}} - - NO - NO - 0 - 0 - - 1 - 1 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{21, 296}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - * - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{120, 298}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - 0 - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{217, 296}, {83, 52}} - - NO - NO - 0 - 0 - - 1 - # - - - 1 - MC4xOTYwNzg0MyAwLjMwOTgwMzkzIDAuNTIxNTY4NjYAA - - - - - - 292 - {{101, 358}, {117, 65}} - - NO - NO - NO - - NSImage - linphone.png - + {320, 460} + + + 1 + MCAwLjUwMTk2MDgxIDEAA + 5 - {320, 460} - - - 1 - MC4yMDMyNDkxNiAwLjQ2MDg0NzkxIDEAA - - 5 + @@ -398,14 +415,6 @@ 13 - - - cancel - - - - 14 - status @@ -431,15 +440,6 @@ 19 - - - doAction: - - - 7 - - 20 - view @@ -544,113 +544,139 @@ 54 + + + back + + + + 83 + doKeyPad: - 7 + 1 - 67 + 84 doKeyPad: - 7 + 1 - 68 + 85 doKeyPad: - 7 + 1 - 69 + 86 doKeyPad: - 7 + 1 - 70 + 87 doKeyPad: - 7 + 1 - 71 + 88 doKeyPad: - 7 + 1 - 72 + 89 doKeyPad: - 7 + 1 - 73 + 90 doKeyPad: - 7 + 1 - 74 + 91 doKeyPad: - 7 + 1 - 75 + 92 doKeyPad: - 7 + 1 - 76 + 93 doKeyPad: - 7 + 1 - 77 + 94 doKeyPad: + 1 + + 95 + + + + doKeyPadUp: + + 7 - 78 + 98 + + + + doKeyPad: + + + 1 + + 106 @@ -676,103 +702,41 @@ - 1 - + 80 + YES - - - - - - - - - - - - - - - - - + - 7 - - + 1 + + + YES + + + + + + + + + + + + + + + + + + - 4 - - - - - 6 - - - - - 5 - - - - - 29 - - - - - 30 - - - - - 31 - - - - - 33 - - - - - 34 - - - - - 35 - - - - - 36 - - - - - 37 - - - - - 38 - - - - - 39 - - - - - 40 - + 42 + @@ -781,8 +745,92 @@ - 42 - + 40 + + + + + 39 + + + + + 38 + + + + + 37 + + + + + 36 + + + + + 34 + + + + + 33 + + + + + 31 + + + + + 30 + + + + + 29 + + + + + 7 + + + + + 5 + + + Call + + + 104 + + + YES + + + + + AddressView + + + 4 + + + Address + + + 81 + + + back + + + 35 + @@ -795,6 +843,7 @@ -2.CustomClassName 1.IBEditorWindowLastContentRect 1.IBPluginDependency + 104.IBPluginDependency 29.IBPluginDependency 30.IBPluginDependency 31.IBPluginDependency @@ -810,8 +859,10 @@ 41.IBPluginDependency 42.IBPluginDependency 5.IBPluginDependency - 6.IBPluginDependency 7.IBPluginDependency + 80.IBEditorWindowLastContentRect + 80.IBPluginDependency + 81.IBPluginDependency YES @@ -836,6 +887,9 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{353, 469}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -858,7 +912,7 @@ - 79 + 106 @@ -872,11 +926,13 @@ YES doAction: doKeyPad: + doKeyPadUp: YES id id + id @@ -884,8 +940,8 @@ YES address + back call - cancel eight five four diff --git a/Classes/linphoneAppDelegate.h b/Classes/linphoneAppDelegate.h index 8d13d6c24..cf18657e5 100644 --- a/Classes/linphoneAppDelegate.h +++ b/Classes/linphoneAppDelegate.h @@ -17,21 +17,60 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #import - -@class linphone; +#import +#include"linphonecore.h" -@class PhoneViewController; +@protocol LinphoneTabManagerDelegate + +-(void)selectDialerTab; + +@end + +@class ContactPickerDelegate; +@class IncallViewController; +@class PhoneViewController; +@class CallHistoryTableViewController; +@class FavoriteTableViewController; + +@interface linphoneAppDelegate : NSObject { + UIWindow *window; + IBOutlet UITabBarController* myTabBarController; + IBOutlet ABPeoplePickerNavigationController* myPeoplePickerController; + IBOutlet PhoneViewController* myPhoneViewController; + CallHistoryTableViewController* myCallHistoryTableViewController; + FavoriteTableViewController* myFavoriteTableViewController; + + ContactPickerDelegate* myContactPickerDelegate; + + int traceLevel; + LinphoneCore* myLinphoneCore; + + +} +/********************************** + * liblinphone initialization method + **********************************/ +-(void) startlibLinphone; + +/* + * liblinphone scheduling method; + */ +-(void) iterate; + +-(void) newIncomingCall:(NSString*) from; + + +-(PayloadType*) findPayload:(NSString*)type withRate:(int)rate from:(const MSList*)list; + + +@property (nonatomic, retain) IBOutlet UIWindow *window; +@property (nonatomic, retain) IBOutlet UITabBarController* myTabBarController; +@property (nonatomic, retain) ABPeoplePickerNavigationController* myPeoplePickerController; +@property (nonatomic, retain) IBOutlet PhoneViewController* myPhoneViewController; -@interface linphoneAppDelegate : NSObject { - UIWindow *window; - PhoneViewController *myViewController; - -} - -@property (nonatomic, retain) IBOutlet UIWindow *window; -@property (nonatomic, retain) IBOutlet PhoneViewController *myViewController; @end diff --git a/Classes/linphoneAppDelegate.m b/Classes/linphoneAppDelegate.m index 833c7ec47..c40247754 100644 --- a/Classes/linphoneAppDelegate.m +++ b/Classes/linphoneAppDelegate.m @@ -19,42 +19,332 @@ #import "PhoneViewController.h" #import "linphoneAppDelegate.h" +#import "ContactPickerDelegate.h" +#import "IncallViewController.h" +#import "AddressBook/ABPerson.h" +#import +#import +#import "osip2/osip.h" +#import "FavoriteTableViewController.h" +extern void ms_au_register_card(); +//generic log handler for debug version +void linphone_iphone_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){ + NSString* format = [[NSString alloc] initWithCString:fmt encoding:[NSString defaultCStringEncoding]]; + NSLogv(format,args); + [format release]; +} + +//Error/warning log handler +void linphone_iphone_log(struct _LinphoneCore * lc, const char * message) { + NSLog([NSString stringWithCString:message length:strlen(message)]); +} +//status +void linphone_iphone_display_status(struct _LinphoneCore * lc, const char * message) { + PhoneViewController* lPhone = ((linphoneAppDelegate*) linphone_core_get_user_data(lc)).myPhoneViewController; + [lPhone displayStatus:[NSString stringWithCString:message length:strlen(message)]]; +} + +void linphone_iphone_show(struct _LinphoneCore * lc) { + //nop +} +void linphone_iphone_call_received(LinphoneCore *lc, const char *from){ + [((linphoneAppDelegate*) linphone_core_get_user_data(lc)) newIncomingCall:[[NSString alloc] initWithCString:from encoding:[NSString defaultCStringEncoding]]]; + + +}; +void linphone_iphone_general_state(LinphoneCore *lc, LinphoneGeneralState *gstate) { + PhoneViewController* lPhone = ((linphoneAppDelegate*) linphone_core_get_user_data(lc)).myPhoneViewController; + [lPhone callStateChange:gstate]; +} + +LinphoneCoreVTable linphonec_vtable = { +.show =(ShowInterfaceCb) linphone_iphone_show, +.inv_recv = linphone_iphone_call_received, +.bye_recv = NULL, +.notify_recv = NULL, +.new_unknown_subscriber = NULL, +.auth_info_requested = NULL, +.display_status = linphone_iphone_display_status, +.display_message=linphone_iphone_log, +.display_warning=linphone_iphone_log, +.display_url=NULL, +.display_question=(DisplayQuestionCb)NULL, +.text_received=NULL, +.general_state=(GeneralStateChange)linphone_iphone_general_state, +.dtmf_received=NULL +}; + @implementation linphoneAppDelegate @synthesize window; -@synthesize myViewController; +@synthesize myTabBarController; +@synthesize myPeoplePickerController; +@synthesize myPhoneViewController; + + - (void)applicationDidFinishLaunching:(UIApplication *)application { - PhoneViewController *aViewController = [[PhoneViewController alloc] - initWithNibName:@"PhoneViewController" bundle:[NSBundle mainBundle]]; + //as defined in PhoneMainView.xib +#define DIALER_TAB_INDEX 2 +#define CONTACTS_TAB_INDEX 3 +#define HISTORY_TAB_INDEX 1 +#define FAVORITE_TAB_INDEX 0 +#define MORE_TAB_INDEX 4 - [self setMyViewController:aViewController]; - [aViewController release]; - - //offset the status bar - CGRect rect = myViewController.view.frame; - rect = CGRectOffset(rect, 0.0, 20.0); - myViewController.view.frame = rect; - [window addSubview:[myViewController view]]; + myPhoneViewController = (PhoneViewController*) [myTabBarController.viewControllers objectAtIndex: DIALER_TAB_INDEX]; + + myCallHistoryTableViewController = (CallHistoryTableViewController*)[myTabBarController.viewControllers objectAtIndex: HISTORY_TAB_INDEX]; + [myCallHistoryTableViewController setPhoneControllerDelegate:myPhoneViewController]; + [myCallHistoryTableViewController setLinphoneDelegate:self]; + + myFavoriteTableViewController = (FavoriteTableViewController*)[myTabBarController.viewControllers objectAtIndex: FAVORITE_TAB_INDEX]; + [myFavoriteTableViewController setPhoneControllerDelegate:myPhoneViewController]; + [myFavoriteTableViewController setLinphoneDelegate:self]; - //init lib linphone - [aViewController startlibLinphone] ; + //people picker delegates + myContactPickerDelegate = [[ContactPickerDelegate alloc] init]; + myContactPickerDelegate.phoneControllerDelegate=myPhoneViewController; + myContactPickerDelegate.linphoneDelegate=self; + //people picker + myPeoplePickerController = [[[ABPeoplePickerNavigationController alloc] init] autorelease]; + [myPeoplePickerController setDisplayedProperties:[NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonPhoneProperty]]]; + [myPeoplePickerController setPeoplePickerDelegate:myContactPickerDelegate]; + //copy tab bar item + myPeoplePickerController.tabBarItem = [(UIViewController*)[myTabBarController.viewControllers objectAtIndex:CONTACTS_TAB_INDEX] tabBarItem]; + //insert contact controller + NSMutableArray* newArray = [NSMutableArray arrayWithArray:self.myTabBarController.viewControllers]; + [newArray replaceObjectAtIndex:CONTACTS_TAB_INDEX withObject:myPeoplePickerController]; + + [myTabBarController setSelectedIndex:DIALER_TAB_INDEX]; + [myTabBarController setViewControllers:newArray animated:NO]; + + [window addSubview:myTabBarController.view]; + + [window makeKeyAndVisible]; + + [self startlibLinphone]; + + [myCallHistoryTableViewController setLinphoneCore: myLinphoneCore]; + [myFavoriteTableViewController setLinphoneCore: myLinphoneCore]; + [myPhoneViewController setLinphoneCore: myLinphoneCore]; + + +} +-(void)selectDialerTab { + [myTabBarController setSelectedIndex:DIALER_TAB_INDEX]; +} - [window makeKeyAndVisible]; +- (void)applicationWillTerminate:(UIApplication *)application { + linphone_core_destroy(myLinphoneCore); +} +- (void)dealloc { + [window release]; + [myPeoplePickerController release]; + [super dealloc]; +} + +/************* + *lib linphone init method + */ +-(void)startlibLinphone { + + //init audio session + NSError *setError = nil; + [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error: &setError]; //must be call before linphone_core_init + + //get default config from bundle + NSBundle* myBundle = [NSBundle mainBundle]; + NSString* defaultConfigFile = [myBundle pathForResource:@"linphonerc"ofType:nil] ; +#if TARGET_IPHONE_SIMULATOR + NSDictionary *dictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSFileImmutable]; + [[NSFileManager defaultManager] setAttributes:dictionary ofItemAtPath:defaultConfigFile error:nil]; +#endif + //log management + traceLevel = 9; + if (traceLevel > 0) { + //redirect all traces to the iphone log framework + linphone_core_enable_logs_with_cb(linphone_iphone_log_handler); + } + else { + linphone_core_disable_logs(); + } + + //register audio queue sound card + ms_au_register_card(); + + /* + * Initialize linphone core + */ + + myLinphoneCore = linphone_core_new (&linphonec_vtable, [defaultConfigFile cStringUsingEncoding:[NSString defaultCStringEncoding]],self); + + // Set audio assets + const char* lRing = [[myBundle pathForResource:@"oldphone-mono"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; + linphone_core_set_ring(myLinphoneCore, lRing ); + const char* lRingBack = [[myBundle pathForResource:@"ringback"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; + linphone_core_set_ringback(myLinphoneCore, lRingBack); + + + //configure sip account + //get data from Settings bundle + NSString* accountNameUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"account_preference"]; + const char* identity = [accountNameUri cStringUsingEncoding:[NSString defaultCStringEncoding]]; + + NSString* accountPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"password_preference"]; + const char* password = [accountPassword cStringUsingEncoding:[NSString defaultCStringEncoding]]; + + NSString* proxyUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"proxy_preference"]; + const char* proxy = [proxyUri cStringUsingEncoding:[NSString defaultCStringEncoding]]; + + NSString* routeUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"route_preference"]; + const char* route = [routeUri cStringUsingEncoding:[NSString defaultCStringEncoding]]; + + if (([accountNameUri length] + [proxyUri length]) >8 ) { + //possible valid config detected + LinphoneProxyConfig* proxyCfg; + //clear auth info list + linphone_core_clear_all_auth_info(myLinphoneCore); + //get default proxy + linphone_core_get_default_proxy(myLinphoneCore,&proxyCfg); + boolean_t addProxy=false; + if (proxyCfg == NULL) { + //create new proxy + proxyCfg = linphone_proxy_config_new(); + addProxy = true; + } else { + linphone_proxy_config_edit(proxyCfg); + } + + // add username password + osip_from_t *from; + LinphoneAuthInfo *info; + osip_from_init(&from); + if (osip_from_parse(from,identity)==0){ + info=linphone_auth_info_new(from->url->username,NULL,password,NULL,NULL); + linphone_core_add_auth_info(myLinphoneCore,info); + } + osip_from_free(from); + + // configure proxy entries + linphone_proxy_config_set_identity(proxyCfg,identity); + linphone_proxy_config_set_server_addr(proxyCfg,proxy); + if ([routeUri length] > 4) { + linphone_proxy_config_set_route(proxyCfg,route); + } + linphone_proxy_config_enable_register(proxyCfg,TRUE); + if (addProxy) { + linphone_core_add_proxy_config(myLinphoneCore,proxyCfg); + //set to default proxy + linphone_core_set_default_proxy(myLinphoneCore,proxyCfg); + } else { + linphone_proxy_config_done(proxyCfg); + } + + } + + //Configure Codecs + + PayloadType *pt; + //get codecs from linphonerc + const MSList *audioCodecs=linphone_core_get_audio_codecs(myLinphoneCore); + + //read from setting bundle + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"speex_32k_preference"]) { + if(pt = [self findPayload:@"speex"withRate:32000 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"speex_16k_preference"]) { + if(pt = [self findPayload:@"speex"withRate:16000 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"speex_8k_preference"]) { + if(pt = [self findPayload:@"speex"withRate:8000 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"gsm_22k_preference"]) { + if(pt = [self findPayload:@"GSM"withRate:22050 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"gsm_11k_preference"]) { + if(pt = [self findPayload:@"GSM"withRate:11025 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"gsm_8k_preference"]) { + if(pt = [self findPayload:@"GSM"withRate:8000 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"pcmu_preference"]) { + if(pt = [self findPayload:@"PCMU"withRate:8000 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"pcma_preference"]) { + if(pt = [self findPayload:@"PCMA"withRate:8000 from:audioCodecs]) { + payload_type_set_enable(pt,TRUE); + } + } + + + // start scheduler + [NSTimer scheduledTimerWithTimeInterval:0.1 + target:self + selector:@selector(iterate) + userInfo:nil + repeats:YES]; } +-(void) newIncomingCall:(NSString*) from { + //redirect audio to speaker + UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; + + AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute + , sizeof (audioRouteOverride) + , &audioRouteOverride); + + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:[NSString stringWithFormat:@" %@ is calling you",from] + delegate:self cancelButtonTitle:@"Decline" destructiveButtonTitle:@"Answer" otherButtonTitles:nil]; + actionSheet.actionSheetStyle = UIActionSheetStyleDefault; + [actionSheet showFromTabBar:myTabBarController.tabBar]; + [actionSheet release]; + +} -- (void)dealloc { - [window release]; - [myViewController release]; - [super dealloc]; +- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { + if (buttonIndex == 0 ) { + linphone_core_accept_call(myLinphoneCore,NULL); + } else { + linphone_core_terminate_call (myLinphoneCore,NULL); + } +} +//scheduling loop +-(void) iterate { + linphone_core_iterate(myLinphoneCore); +} + + +-(PayloadType*) findPayload:(NSString*)type withRate:(int)rate from:(const MSList*)list { + const MSList *elem; + for(elem=list;elem!=NULL;elem=elem->next){ + PayloadType *pt=(PayloadType*)elem->data; + if ([type isEqualToString:[NSString stringWithCString:payload_type_get_mime(pt) length:strlen(payload_type_get_mime(pt))]] && rate==pt->clock_rate) { + return pt; + } + } + return nil; + } diff --git a/PhoneMainView.xib b/PhoneMainView.xib index 557698096..a9588c6ae 100644 --- a/PhoneMainView.xib +++ b/PhoneMainView.xib @@ -8,6 +8,7 @@ 353.00 YES + YES @@ -44,6 +45,71 @@ NO + + + + + + Dialer + + NSImage + linphone2.png + + + + + PhoneViewController + + + + YES + + + Favorites + + + + FavoriteTableViewController + + + + History + + history + + + + CallHistoryTableViewController + + + + + + + 5 + + + + + + + 0 + + + + + + + + 266 + {{129, 330}, {163, 49}} + + 3 + MCAwAA + + NO + + @@ -64,6 +130,14 @@ 7 + + + myTabBarController + + + + 14 + @@ -98,6 +172,99 @@ + + 8 + + + YES + + + + + + + + + + + 9 + + + + + 11 + + + YES + + + + Contacts + + + 12 + + + + + 38 + + + YES + + + + dialer + + + 39 + + + + + 41 + + + YES + + + + history + + + 42 + + + + + 43 + + + YES + + + + more + + + 44 + + + + + 46 + + + YES + + + + + + 47 + + + @@ -106,17 +273,32 @@ YES -1.CustomClassName -2.CustomClassName + 11.IBPluginDependency + 12.IBPluginDependency 2.IBAttributePlaceholdersKey 2.IBEditorWindowLastContentRect 2.IBPluginDependency 2.UIWindow.visibleAtLaunch + 38.CustomClassName + 38.IBEditorWindowLastContentRect + 38.IBPluginDependency 4.CustomClassName 4.IBPluginDependency + 41.CustomClassName + 41.IBPluginDependency + 43.IBPluginDependency + 46.CustomClassName + 46.IBPluginDependency + 8.IBEditorWindowLastContentRect + 8.IBPluginDependency + 9.IBPluginDependency YES UIApplication UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin YES @@ -129,8 +311,19 @@ {{190, 156}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin + PhoneViewController + {{343, 544}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin linphoneAppDelegate com.apple.InterfaceBuilder.IBCocoaTouchPlugin + CallHistoryTableViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + FavoriteTableViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{11, 205}, {320, 480}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -153,33 +346,126 @@ - 7 + 47 YES + + CallHistoryTableViewController + GenericTabViewController + + IBProjectSource + Classes/CallHistoryTableViewController.h + + + + FavoriteTableViewController + GenericTabViewController + + YES + + YES + doAddFavorite: + doEditFavorite: + + + YES + id + id + + + + add + UIButton + + + IBProjectSource + Classes/FavoriteTableViewController.h + + + + GenericTabViewController + UITableViewController + + YES + + YES + header + linphoneDelegate + phoneControllerDelegate + + + YES + UIView + id + id + + + + IBProjectSource + Classes/GenericTabViewController.h + + PhoneViewController UIViewController - doAction: - id + YES + + YES + doAction: + doKeyPad: + doKeyPadUp: + + + YES + id + id + id + YES YES address + back call cancel + eight + five + four + hash + nine + one + seven + six + star status + three + two + zero YES UITextField UIButton UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton + UIButton UILabel + UIButton + UIButton + UIButton @@ -194,12 +480,16 @@ YES YES - myViewController + myPeoplePickerController + myPhoneViewController + myTabBarController window YES + ABPeoplePickerNavigationController PhoneViewController + UITabBarController UIWindow diff --git a/in_call.png b/in_call.png new file mode 100644 index 0000000000000000000000000000000000000000..d48369e6a2eefabff23f95082f4e51f3451d305a GIT binary patch literal 3267 zcmV;!3_SCRP)003hM1^@s6)3N=r00004b3#c}2nYxW zdB~=;6f9H1JnV#+*kj9m5NZhy*U25WEp*%zo z1Bs7_3A#`dX%iDMabaR&LgE57(So>8*a!>7g-VP(!ovva0E06y%;3N}^Xu%g}Qm>p^~Xj6TP zhLV>Zx8Y2Kf~B(`R|r@3qPJFPM@V}@8)Q`hvaSO;AO+Vfo&QqqUH3Hwqnp)W{HX%j z)FdB7i8(%n)hzQ)R%nX0%+cxOfUIgj)-@pKtiX!Zf@Td6!o|llN9Bz-CUrnoRUlKk zf~g0~Bt4=zme%Ei?1Sh!`;uK);24i`5{;9TdXzeNjW$g{x?Wv|fwZqKf`iA?rKVUP zWKSiInQqN;K^ovwRE?$#G{}S6`U+xONcn;n2(VY;4svh&q|}4 z6ymePLFQuKKC=?!uoTz~^$;OG?cjEC8QRIx>zuvl(+kHIj#@Co0U7s@xtFQ{ z*}55nZcJd+Y9Y_E^PD{Y@jAL=wU)tI1QedzQpW+Bn?U?7NWq^C?Gsg_Ng1Q<%0xhFFLe;3n{SSObd$}o zNo8WH%`g?h)FjCqaiZGYjRBBh+W?rMrBQ;iAB32e1FUJ#mP0ah^a1)4-< zA|SPrI#fAkJ;)q$Mxe^XRBKj|!RIHA5OT(CXp^LU;us&F9Aq{}e?^H}YIA98r+XNRN-Y-Y<( zsLj3FsZ4~GC-5SxumR1xVC`spenY@sp{x}w#}UI*>o;Tlb;&XY3dUa3hLV*7!>mT)J((w_HZ7lqb9^?eX0At4m(4X~VuheVRV^ zs&nIt1+WENI}3cD06+mk-P;ZEzNWNUnF#3KyTDI7!23hYrhvs>`H10f@6LZFSDCno z4s+o={zeD*`M9$v;Ia)xHwP+j(AHVX5<#peuXqm7{Noe_1zrcuM|5{w@p8ILX{}jV zUb+MLj@zn$%g#bqm)h-r{{k#+E9UzZ{-egHnC+nGSpKbMj5)91^Q`Mru!<(8Uq)9W zhU8<{fhY9_eHo}bqd2)GPaRf(i*dfEMFS^yz~!qYU@Cj^cb#xCpu(r%u-)8CkuJlx zQJJ_{b$Ab*0+=)+mmqH|&3*m#DxmJo@JTDBQJiSt>%d>!o@=x4!fxn0A>Q^MgMEtU zn1(XP(!bg0n9~)Wuk!PKKUt3N0e{l#yg^R_>VDwn44<;B9L32t@Fn0;cf@Kp1I)ef z3Lzx_A@Rh5lfkk8lR(Ii&3T*~BLSaZOCR{FUgww=fqESHVulOg)Zn8ySttFfr>ESJ zr@C-xxA5VD5Z>*}4u`qx-V5m>i1nIm&LfS_>0!Oj%ZOj>^9*o(hDSl(f<+W3?*i8V z2i&%kJK*qwBZCD(GjsIksxU{ZyKIjBHOV*T?`(2V2I?U2*(gp{-3D=WCyJA|fvbQc zZrdAkaAdv|!WGyRLN-SkWQ1u-;obE^X-@56XV03?^KZ4uKDH#$Uj?p;;^d^%Sh*Ay z#mVcymB9bpw&T0twOzyc6kqc6*HGr@iR&`blX?(sv)<1(Ps>1^0IrPUE$0toj<2X5kIO)v1+Iq!$`i(XuWx4Y6^_a9*-b2Lw75dA$9?o_6qly1Ut)#s7UhIB7Cfg7SYd2$#WhF-pp z;^a}_%V38P4ZN@jr@ICtKWr4@eUW^hG<@3frt0%hXG2Ok`@l_6oIE%r1f%VBh~nhW zz&CL2YhS_hi?BK?WXkrng8@$4m5GEt56*1L2?Bg8ij(_Bk$>ckAyJ(C4*0Ii?}MJeiQ;%0c<2fR3_e4ng?b#5seRSjpF3DBMDB!T{Kag+yVT^q2zZ=#&ctUuB zSD0f7qHK;}0w$Z|n$kQlv&lIbsN14A`B?+8n{PRa;^a2qc9*}=fqfTgHaZ44qGL9k z`v~SJJx&@5#X5Z+n%(4#{EqaUQJi=;c~}~2e^wMHKLCE?^3Qc(-)_y8GC`gH zTf8j;bwBX+ywuW^#s({jlRoe@;BRi*>MT6Bm;zSqm`%xtGe_6IY2b++Tb$^KgXWh1wJK)f~;N^=y%_|doyFFf=5rH}gT$7cYf>6*6xKW(EL%Op4qTBYyPWbP< zP;IC%M?c;0&GGr}HZRSJRnAvQD+pq#r6~p92Oq`BTcnkW*W9+_JK@MKZD~riCPAG! z9`5!z*cCPE1aL(ZC-L~w*c2QrfGAFm0auV-xJ5_j;Mh)wX=v9l=6H0r&;G8cQKw0Z zcQ1vJ#HLoj0?2AZSCa~0(cyW`>pL9nG7`^%9PQFTJga$jrwG&<@VO{X_J@+erPja# z$ZAB_lGcnYI<%m9vpa-2QU-vxW;D;t^?XO4mRfF%;^d$0Nz*b|09mc*22z0v(!ha5 zP11Fk*@0V`NMstn>Zn^r{F(}nlm$UT5+ZWd*=IW$w1v2#mQZ5Uwcjy0}CLE zleC!2-zs{nSrf{$>aEF7{dPq*!e# zcxs`~Ir$3j7^l?IlqL=qKoloG27c-C*E_H`1L&EBK5O#T-Gfl6odmV|a^?W~9_cox zn@#503_NjBUrG-k-Q_cOsii43{>N$|Xk~e62KWPMYB7i&BYiLqQbA}!=M^k~mF1H`qsk zPqa}%XhP>D8cGz!$tmD7q$@_pfnNikniik{{tqB_!FOJaD;od+002ovPDHLkV1mV_ BFv9=< literal 0 HcmV?d00001 diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index f28af75ee..705ad8849 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -22,6 +22,13 @@ 220FAD3910765B400068D98F /* libspeexdsp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 220FAD3010765B400068D98F /* libspeexdsp.a */; }; 220FAE4B10767A6A0068D98F /* PhoneMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 220FAE4A10767A6A0068D98F /* PhoneMainView.xib */; }; 2237D4091084D7A9001383EE /* oldphone-mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = 2237D4081084D7A9001383EE /* oldphone-mono.wav */; }; + 2242D91610D66BF300E9963F /* in_call.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91410D66BF300E9963F /* in_call.png */; }; + 2242D91710D66BF300E9963F /* out_call.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91510D66BF300E9963F /* out_call.png */; }; + 2242D91A10D66C2100E9963F /* mic_active.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91810D66C2100E9963F /* mic_active.png */; }; + 2242D91B10D66C2100E9963F /* mic_muted.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91910D66C2100E9963F /* mic_muted.png */; }; + 2242D9C310D68DFD00E9963F /* FavoriteTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2242D9C110D68DFD00E9963F /* FavoriteTableViewController.m */; }; + 2242D9C410D68DFD00E9963F /* FavoriteTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2242D9C210D68DFD00E9963F /* FavoriteTableViewController.xib */; }; + 2242D9C910D691F900E9963F /* GenericTabViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2242D9C810D691F900E9963F /* GenericTabViewController.m */; }; 2245667810768B7300F10948 /* linphone2.png in Resources */ = {isa = PBXBuildFile; fileRef = 2245667710768B7300F10948 /* linphone2.png */; }; 2245667A10768B9000F10948 /* linphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 2245667910768B9000F10948 /* linphone.png */; }; 2245671D107699F700F10948 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 2245671C107699F700F10948 /* Settings.bundle */; }; @@ -31,6 +38,13 @@ 2274401A106F31BD006EC466 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22744019106F31BD006EC466 /* CoreAudio.framework */; }; 2274402F106F335E006EC466 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2274402E106F335E006EC466 /* AudioToolbox.framework */; }; 2274550810700509006EC466 /* linphonerc in Resources */ = {isa = PBXBuildFile; fileRef = 2274550710700509006EC466 /* linphonerc */; }; + 227BCDC210D4004600FBFD76 /* CallHistoryTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 227BCDC010D4004600FBFD76 /* CallHistoryTableViewController.m */; }; + 227BCDC310D4004600FBFD76 /* CallHistoryTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 227BCDC110D4004600FBFD76 /* CallHistoryTableViewController.xib */; }; + 22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */; }; + 22B5EFE510CE5E5800777D97 /* ContactPickerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */; }; + 22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22B5F03410CE6B2F00777D97 /* AddressBook.framework */; }; + 22B5F1E110CFA3C700777D97 /* IncallViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22B5F1E010CFA3C700777D97 /* IncallViewController.xib */; }; + 22B5F1EA10CFD55A00777D97 /* IncallViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22B5F1E810CFD55A00777D97 /* IncallViewController.m */; }; 22F2508E107141E100AC9B3F /* PhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22F2508C107141E100AC9B3F /* PhoneViewController.m */; }; 22F2508F107141E100AC9B3F /* PhoneViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 22F2508D107141E100AC9B3F /* PhoneViewController.xib */; }; 22F254811073D99800AC9B3F /* ringback.wav in Resources */ = {isa = PBXBuildFile; fileRef = 22F254801073D99800AC9B3F /* ringback.wav */; }; @@ -174,6 +188,15 @@ 220FAD3010765B400068D98F /* libspeexdsp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libspeexdsp.a; path = "../../liblinphone-sdk/armv6-apple-darwin/lib/libspeexdsp.a"; sourceTree = SOURCE_ROOT; }; 220FAE4A10767A6A0068D98F /* PhoneMainView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PhoneMainView.xib; sourceTree = ""; }; 2237D4081084D7A9001383EE /* oldphone-mono.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "oldphone-mono.wav"; sourceTree = ""; }; + 2242D91410D66BF300E9963F /* in_call.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = in_call.png; sourceTree = ""; }; + 2242D91510D66BF300E9963F /* out_call.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = out_call.png; sourceTree = ""; }; + 2242D91810D66C2100E9963F /* mic_active.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mic_active.png; path = ../../pixmaps/mic_active.png; sourceTree = SOURCE_ROOT; }; + 2242D91910D66C2100E9963F /* mic_muted.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mic_muted.png; path = ../../pixmaps/mic_muted.png; sourceTree = SOURCE_ROOT; }; + 2242D9C010D68DFD00E9963F /* FavoriteTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FavoriteTableViewController.h; sourceTree = ""; }; + 2242D9C110D68DFD00E9963F /* FavoriteTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FavoriteTableViewController.m; sourceTree = ""; }; + 2242D9C210D68DFD00E9963F /* FavoriteTableViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FavoriteTableViewController.xib; sourceTree = ""; }; + 2242D9C710D691F900E9963F /* GenericTabViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericTabViewController.h; sourceTree = ""; }; + 2242D9C810D691F900E9963F /* GenericTabViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GenericTabViewController.m; sourceTree = ""; }; 2245667710768B7300F10948 /* linphone2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone2.png; path = ../../pixmaps/linphone2.png; sourceTree = SOURCE_ROOT; }; 2245667910768B9000F10948 /* linphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone.png; path = ../../pixmaps/linphone.png; sourceTree = SOURCE_ROOT; }; 2245671C107699F700F10948 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; @@ -185,9 +208,19 @@ 22744043106F33FC006EC466 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 22744056106F9BC9006EC466 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 2274550710700509006EC466 /* linphonerc */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = linphonerc; sourceTree = ""; }; + 227BCDBF10D4004600FBFD76 /* CallHistoryTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallHistoryTableViewController.h; sourceTree = ""; }; + 227BCDC010D4004600FBFD76 /* CallHistoryTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CallHistoryTableViewController.m; sourceTree = ""; }; + 227BCDC110D4004600FBFD76 /* CallHistoryTableViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CallHistoryTableViewController.xib; sourceTree = ""; }; + 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; + 22B5EFE310CE5E5800777D97 /* ContactPickerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactPickerDelegate.h; sourceTree = ""; }; + 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactPickerDelegate.m; sourceTree = ""; }; + 22B5F03410CE6B2F00777D97 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; + 22B5F1E010CFA3C700777D97 /* IncallViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IncallViewController.xib; sourceTree = ""; }; + 22B5F1E710CFD55A00777D97 /* IncallViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IncallViewController.h; sourceTree = ""; }; + 22B5F1E810CFD55A00777D97 /* IncallViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IncallViewController.m; sourceTree = ""; }; 22F2508B107141E100AC9B3F /* PhoneViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneViewController.h; sourceTree = ""; }; 22F2508C107141E100AC9B3F /* PhoneViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhoneViewController.m; sourceTree = ""; }; - 22F2508D107141E100AC9B3F /* PhoneViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = PhoneViewController.xib; path = Classes/PhoneViewController.xib; sourceTree = ""; }; + 22F2508D107141E100AC9B3F /* PhoneViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PhoneViewController.xib; sourceTree = ""; }; 22F254801073D99800AC9B3F /* ringback.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = ringback.wav; path = ../../share/ringback.wav; sourceTree = SOURCE_ROOT; }; 22F255131073EEE600AC9B3F /* green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = green.png; path = ../../pixmaps/green.png; sourceTree = SOURCE_ROOT; }; 22F255141073EEE600AC9B3F /* red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = red.png; path = ../../pixmaps/red.png; sourceTree = SOURCE_ROOT; }; @@ -219,6 +252,8 @@ 220FAD3910765B400068D98F /* libspeexdsp.a in Frameworks */, 224567C2107B968500F10948 /* AVFoundation.framework in Frameworks */, 2273785E10A3703300526073 /* libmsiounit.a in Frameworks */, + 22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */, + 22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -232,6 +267,20 @@ 1D3623250D0F684500981E51 /* linphoneAppDelegate.m */, 22F2508B107141E100AC9B3F /* PhoneViewController.h */, 22F2508C107141E100AC9B3F /* PhoneViewController.m */, + 22F2508D107141E100AC9B3F /* PhoneViewController.xib */, + 22B5EFE310CE5E5800777D97 /* ContactPickerDelegate.h */, + 22B5EFE410CE5E5800777D97 /* ContactPickerDelegate.m */, + 22B5F1E710CFD55A00777D97 /* IncallViewController.h */, + 22B5F1E810CFD55A00777D97 /* IncallViewController.m */, + 22B5F1E010CFA3C700777D97 /* IncallViewController.xib */, + 227BCDBF10D4004600FBFD76 /* CallHistoryTableViewController.h */, + 227BCDC010D4004600FBFD76 /* CallHistoryTableViewController.m */, + 227BCDC110D4004600FBFD76 /* CallHistoryTableViewController.xib */, + 2242D9C010D68DFD00E9963F /* FavoriteTableViewController.h */, + 2242D9C110D68DFD00E9963F /* FavoriteTableViewController.m */, + 2242D9C210D68DFD00E9963F /* FavoriteTableViewController.xib */, + 2242D9C710D691F900E9963F /* GenericTabViewController.h */, + 2242D9C810D691F900E9963F /* GenericTabViewController.m */, ); path = Classes; sourceTree = ""; @@ -477,6 +526,8 @@ 2245671C107699F700F10948 /* Settings.bundle */, 224567C1107B968500F10948 /* AVFoundation.framework */, 22F51EF5107FA66500F98953 /* untitled.plist */, + 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */, + 22B5F03410CE6B2F00777D97 /* AddressBook.framework */, ); name = CustomTemplate; sourceTree = ""; @@ -493,13 +544,16 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 2242D91810D66C2100E9963F /* mic_active.png */, + 2242D91910D66C2100E9963F /* mic_muted.png */, + 2242D91410D66BF300E9963F /* in_call.png */, + 2242D91510D66BF300E9963F /* out_call.png */, 2245667910768B9000F10948 /* linphone.png */, 2245667710768B7300F10948 /* linphone2.png */, 22F255131073EEE600AC9B3F /* green.png */, 22F255141073EEE600AC9B3F /* red.png */, 22F254801073D99800AC9B3F /* ringback.wav */, 22F2546F1073D95B00AC9B3F /* rings */, - 22F2508D107141E100AC9B3F /* PhoneViewController.xib */, 8D1107310486CEB800E47090 /* linphone-Info.plist */, 2274550710700509006EC466 /* linphonerc */, 220FAE4A10767A6A0068D98F /* PhoneMainView.xib */, @@ -571,6 +625,13 @@ 22F51EF6107FA66500F98953 /* untitled.plist in Resources */, 2237D4091084D7A9001383EE /* oldphone-mono.wav in Resources */, 2273798810A48EF000526073 /* oldphone.wav in Resources */, + 22B5F1E110CFA3C700777D97 /* IncallViewController.xib in Resources */, + 227BCDC310D4004600FBFD76 /* CallHistoryTableViewController.xib in Resources */, + 2242D91610D66BF300E9963F /* in_call.png in Resources */, + 2242D91710D66BF300E9963F /* out_call.png in Resources */, + 2242D91A10D66C2100E9963F /* mic_active.png in Resources */, + 2242D91B10D66C2100E9963F /* mic_muted.png in Resources */, + 2242D9C410D68DFD00E9963F /* FavoriteTableViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -584,6 +645,11 @@ 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 1D3623260D0F684500981E51 /* linphoneAppDelegate.m in Sources */, 22F2508E107141E100AC9B3F /* PhoneViewController.m in Sources */, + 22B5EFE510CE5E5800777D97 /* ContactPickerDelegate.m in Sources */, + 22B5F1EA10CFD55A00777D97 /* IncallViewController.m in Sources */, + 227BCDC210D4004600FBFD76 /* CallHistoryTableViewController.m in Sources */, + 2242D9C310D68DFD00E9963F /* FavoriteTableViewController.m in Sources */, + 2242D9C910D691F900E9963F /* GenericTabViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -606,10 +672,9 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", - "\"$(SRCROOT)/../../liblinphone-sdk/armv6-apple-darwin/lib/mediastreamer/plugins\"", ); "LIBRARY_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/armv6-apple-darwin/lib\"/**"; - "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/i386-apple-darwin/lib\""; + "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/i386-apple-darwin/lib\"/**"; PRODUCT_NAME = linphone; SDKROOT = iphoneos3.0; STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic; @@ -629,10 +694,9 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", - "\"$(SRCROOT)/../../liblinphone-sdk/armv6-apple-darwin/lib/mediastreamer/plugins\"", ); "LIBRARY_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/armv6-apple-darwin/lib\"/**"; - "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/i386-apple-darwin/lib\""; + "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/i386-apple-darwin/lib\"/**"; PRODUCT_NAME = linphone; }; name = Release; @@ -671,10 +735,9 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", - "\"$(SRCROOT)/../../liblinphone-sdk/armv6-apple-darwin/lib/mediastreamer/plugins\"", ); "LIBRARY_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/armv6-apple-darwin/lib\"/**"; - "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/i386-apple-darwin/lib\""; + "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=*]" = "\"$(SRCROOT)/../../liblinphone-sdk/i386-apple-darwin/lib\"/**"; PRODUCT_NAME = linphone; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SDKROOT = iphoneos3.0; diff --git a/out_call.png b/out_call.png new file mode 100644 index 0000000000000000000000000000000000000000..7fef2b4ae619f9febba445900f1f7fbd8f3f6461 GIT binary patch literal 3260 zcmV;t3`6sYP)003hM1^@s6)3N=r00004b3#c}2nYxW zdcLCc$Z&G^vxONg++z zIv;HWYJyry)2bgJN+qOrg+$>2frNzAC!i8i{Q?!DNR*Z$wY1Qden`CV1`i1O1VRWI z1c>6QQj6_4zQe3-!duyVUA>LXm0N{tg81NQ4Pyo}wYknAP zT6Lu?vgTm4GjiL4c~ zo&p{)2S>(W=7MBsGn~E;Hf^@f{h}WR-)vezo2)umei%FfJZ6q>9D$j8Bm;vWrDVe} zoW3763|W`?h93rBYFbxQRuwEi489C}-5ej>2s8Jz*f5;sd{V;DD4e zei(cj_`W&b*AK_d=bedc;6TtLtgNr6QTWRj}`) zRuy&vZ~0-c#kFlt!ScgkoT$~Z%RIO1zzWwKy<`PJi&&Y-avTbtBM~7e(Z-q*S2=GfYNF?XPz4w zZ*l#ZC4^@L?pQLcq%t5aj4RK*Qoz>1>H9sd*lJbv0`R?VY=!QbHH)RyvT1XR!?!Kb zmy%y`qtYD@RM*Rm7vx^a;JWpaGY@(UUt!ht5kCyR-HovwgB7=09yP}Yha`t@Ut-;W zjS-YH1>N;Bv6n)&*tcPmZVb+{UML_8?EX;;fF!4pH@fO2FnkF&tqw|^bbf5onB;csD;g4 zWB~|efxA}jg?;xN8Hd{*@K|SmCiIja1`oDtds|=?w^}6AGmC86yi!@Jl)7VExtBC< zfXPG{n}AdI3HthTrU>ANei(eR9s6s8rLnox% zdi!p{$qT~v#Hb(msUHTX>S9m}thiV75|&oW-j6LXx^*Qp7!`L)& zG=Im{f)jUn5ubD!1YYsOz+Pn12-8fQV>+ziwrJgVmxNq zOq8$C*4cX$Za8B#*(d5$Omzg79|n^|9fVw~WpeKl6ML2l+@-)BYlC13+?wkp-%{R& zE@I;JErRP#SnJ4%7_ckb0xNE{yosgNvVCfa9s3qb+@%9|G`=I}ja0y%$`m8YY3o~DxbFH0xaDq-$!n~D-3YuK zzYq)UP`Wno}`cmR~aOz%_y8efeI*OrC36(rU38!wmO?5+O`YODef?2cG&W%c>^$&H z@|shE+AMItd8H6Ay7eOe{l`H3a5HD(o4N^tEWllztsBKq>=ZQ z10L>r8Q`CPSx@T{`M?V3uBUvm#vd&1(q`^OG-vTc`19|a00r>42RM1L_0mPb;{QBj z)9xboQeqO?B~lwG+wtCi7g~9@>Qw&j0bd1{oh@0DDJm`0V4saBwzspHsNd^O-UXiQ zpP!w3%MXKXL@&a&!?Mo+pHK%9MbpqN%wV4#OJ!0%*r(Ge4BVn%Gf7895n#^|<&t$} z0eEA6c5bmBApQ-8m)ckWKMamxfEB5!97&<@fFA z))(rHQ2Ef1IYRnP_Q`86~3z(uDmoiaUn3%d?0;v8yF2uPTD#Wq}Zct&3)^F&OL6Ol5F65tyA-&itdU1)bCmUk)UI|Vj@?iyURaSr$cj9w%pFBV97`$# z#}VE=vtm{h2JR}R2n>Ldp9*lY-j3>;UCsl1ayN@zEIqkOxtBX>AcK#U6nPiR0<_MQ z{07iPDWv3Ht`jZCyP?7rncVd@Ku7>pyr5gV@*V8d8a>3#)UT0i9!By@RpVDqZPcsWFJ5_d~R^Toxg=*(smrwsBbFZG?4YfQ6G}sUZ zQ&4WcHTTM-^W4jwIFDKR%}4=3+X*A7oqLh3TQ~RWZDvvAE>-Rrj~BFwJ1>RYN^{LW z41<*_xYIUqbbSF63);{wr5R?~4DPf|T$Otzz}eRC<>sIIB-kuFDvRa@ak1D9K0)uYFof9m^LwU{DGQV1t) zXt&bXZ&;+ti;|4n+&R-DH*M(NW)_(NiWe2Lr!0;E-L|27`hi7;mV-7iU6ewX#oNj# z4=jX*DXL+ezO5`un3&7$+)8r~EEG+hzA;lf_cA|pFO9#gY`$RDTq%@{XYA{3X2mh9 zeRpZE6sr4+n?21e&B-d7TD~p{@>;|l7yO_IHB7v7Xo!l{4 u^RsjB0FMKI?R1S*mUn=M=4a