Merge remote-tracking branch 'public/master' into 3.0.x

This commit is contained in:
Gautier Pelloux-Prayer 2015-10-16 15:31:02 +02:00
commit 696dad4628
9 changed files with 41 additions and 86 deletions

View file

@ -116,8 +116,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)loadAssistantConfig:(NSString *)rcFilename {
NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]];
linphone_core_set_provisioning_uri([LinphoneManager getLc],
[fullPath cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_core_set_provisioning_uri([LinphoneManager getLc], fullPath.UTF8String);
[[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" forSection:@"misc"];
// For some reason, video preview hangs for 15seconds when resetting linphone core from here...

View file

@ -10,7 +10,6 @@
<outlet property="avatarImage" destination="fZy-K5-yQp" id="hOl-IQ-c9B"/>
<outlet property="callView" destination="9" id="TKY-dp-lKv"/>
<outlet property="conferenceCallsTable" destination="sif-q0-7oE" id="Fjr-dB-s4q"/>
<outlet property="conferencePauseButton" destination="sJD-Z5-eEX" id="iKj-A8-re0"/>
<outlet property="conferenceView" destination="0Ju-u5-N7A" id="H5K-Nv-IKI"/>
<outlet property="durationLabel" destination="Oy8-QO-Jwb" id="mUT-TX-gLp"/>
<outlet property="eightButton" destination="DRh-kc-UVM" id="BPp-sh-qBg"/>
@ -88,17 +87,6 @@
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="24" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="sJD-Z5-eEX" userLabel="pauseButton" customClass="UIPauseButton">
<rect key="frame" x="323" y="0.0" width="52" height="52"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Pause"/>
<state key="normal" image="pause_big_default.png">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled" image="pause_big_disabled.png"/>
<state key="selected" image="pause_big_over_selected.png"/>
<state key="highlighted" image="pause_big_over_selected.png"/>
</button>
<tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="grouped" allowsSelection="NO" rowHeight="50" sectionHeaderHeight="1" sectionFooterHeight="1" id="vgc-Mn-pga" userLabel="conferenceCallsTableView">
<rect key="frame" x="0.0" y="52" width="375" height="451"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -156,7 +144,7 @@
</accessibility>
</view>
<view contentMode="scaleAspectFit" id="127" userLabel="preview">
<rect key="frame" x="254" y="354.99999934763446" width="113" height="140"/>
<rect key="frame" x="254.00000029960563" y="355" width="113" height="140"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>

View file

@ -83,6 +83,7 @@ static UICompositeViewDescription *compositeDescription = nil;
} else if ([LinphoneManager.instance lpConfigBoolForKey:@"auto_answer"]) {
LinphoneCallState state = linphone_call_get_state(call);
if (state == LinphoneCallIncomingReceived) {
LOGI(@"Auto answering call");
[self onAcceptClick:nil];
}
}

View file

@ -83,7 +83,6 @@
@property(nonatomic, strong) IBOutlet UIDigitButton *starButton;
@property(nonatomic, strong) IBOutlet UIDigitButton *zeroButton;
@property(nonatomic, strong) IBOutlet UIDigitButton *sharpButton;
@property(weak, nonatomic) IBOutlet UILabel *addressLabel;
@property(weak, nonatomic) IBOutlet UIRoundedImageView *avatarImage;
@property(weak, nonatomic) IBOutlet UILabel *nameLabel;
@property(weak, nonatomic) IBOutlet UILabel *durationLabel;
@ -91,7 +90,6 @@
@property(weak, nonatomic) IBOutlet UIView *noActiveCallView;
@property(weak, nonatomic) IBOutlet UIView *conferenceView;
@property(strong, nonatomic) IBOutlet CallPausedTableView *conferenceCallsTable;
@property(weak, nonatomic) IBOutlet UIPauseButton *conferencePauseButton;
- (IBAction)onRoutesClick:(id)sender;
- (IBAction)onRoutesBluetoothClick:(id)sender;

View file

@ -233,7 +233,6 @@ static UICompositeViewDescription *compositeDescription = nil;
[_speakerButton update];
[_microButton update];
[_pauseButton update];
[_conferencePauseButton update];
[_videoButton update];
[_hangupButton update];
@ -464,7 +463,6 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
char *uri = linphone_address_as_string_uri_only(addr);
_addressLabel.text = [NSString stringWithUTF8String:uri];
ms_free(uri);
_avatarImage.image =
[FastAddressBook getContactImage:[FastAddressBook getContactWithAddress:addr] thumbnail:NO];

View file

@ -122,8 +122,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
}
- (void)addCurrentContactContactField:(NSString *)address {
LinphoneAddress *linphoneAddress = linphone_core_interpret_url(
[LinphoneManager getLc], [address cStringUsingEncoding:[NSString defaultCStringEncoding]]);
LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String);
NSString *username = [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)];
if (([username rangeOfString:@"@"].length > 0) &&

View file

@ -440,7 +440,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
proxyAddress = [NSString stringWithFormat:@"sip:%@", proxyAddress];
}
char *proxy = ms_strdup([proxyAddress cStringUsingEncoding:[NSString defaultCStringEncoding]]);
char *proxy = ms_strdup(proxyAddress.UTF8String);
LinphoneAddress *proxy_addr = linphone_address_new(proxy);
if (proxy_addr) {
@ -466,15 +466,14 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
char normalizedUserName[256];
LinphoneAddress *linphoneAddress = linphone_address_new("sip:user@domain.com");
linphone_proxy_config_normalize_number(proxyCfg,
[username cStringUsingEncoding:[NSString defaultCStringEncoding]],
normalizedUserName, sizeof(normalizedUserName));
linphone_proxy_config_normalize_number(proxyCfg, username.UTF8String, normalizedUserName,
sizeof(normalizedUserName));
linphone_address_set_username(linphoneAddress, normalizedUserName);
linphone_address_set_domain(linphoneAddress, [domain cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_address_set_domain(linphoneAddress, [domain UTF8String]);
const char *identity = linphone_address_as_string_uri_only(linphoneAddress);
const char *password = [accountPassword cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *ha1 = [accountHa1 cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *password = [accountPassword UTF8String];
const char *ha1 = [accountHa1 UTF8String];
if (linphone_proxy_config_set_identity(proxyCfg, identity) == -1) {
error = NSLocalizedString(@"Invalid username or domain", nil);
@ -492,8 +491,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
}
if ([prefix length] > 0) {
linphone_proxy_config_set_dial_prefix(proxyCfg,
[prefix cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_proxy_config_set_dial_prefix(proxyCfg, [prefix UTF8String]);
}
if ([self objectForKey:@"substitute_+_by_00_preference"]) {
@ -508,7 +506,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
linphone_proxy_config_enable_avpf(proxyCfg, use_avpf);
linphone_proxy_config_set_expires(proxyCfg, expire);
LinphoneAuthInfo *proxyAi = linphone_proxy_config_find_auth_info(proxyCfg);
LinphoneAuthInfo *proxyAi = (LinphoneAuthInfo *)linphone_proxy_config_find_auth_info(proxyCfg);
// setup auth info
if (proxyAi) {
linphone_auth_info_set_username(proxyAi, username.UTF8String);
@ -771,8 +769,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
} else if ([lTunnelPrefMode isEqualToString:@"auto"]) {
mode = tunnel_auto;
} else {
LOGE(@"Unexpected tunnel mode [%s]",
[lTunnelPrefMode cStringUsingEncoding:[NSString defaultCStringEncoding]]);
LOGE(@"Unexpected tunnel mode [%s]", [lTunnelPrefMode UTF8String]);
}
}
@ -806,9 +803,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
NSString *username = [self stringForKey:@"primary_username_preference"];
LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc);
if (parsed != NULL) {
linphone_address_set_display_name(parsed,
[displayname cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_address_set_username(parsed, [username cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_address_set_display_name(parsed, [displayname UTF8String]);
linphone_address_set_username(parsed, [username UTF8String]);
char *contact = linphone_address_as_string(parsed);
linphone_core_set_primary_contact(lc, contact);
ms_free(contact);

View file

@ -494,8 +494,7 @@ exit_dbmigration:
NSString *chatDBFileName = [LinphoneManager documentFile:kLinphoneInternalChatDBFilename];
if ([self migrateChatDBIfNeeded:theLinphoneCore]) {
// if a migration was performed, we should reinitialize the chat database
linphone_core_set_chat_database_path(theLinphoneCore,
[chatDBFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_core_set_chat_database_path(theLinphoneCore, [chatDBFileName UTF8String]);
}
/* AVPF migration */
@ -771,6 +770,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char
@"state" : [NSNumber numberWithInt:state],
@"message" : [NSString stringWithUTF8String:message]
};
LOGI(@"Call %p changed to state %s: %s", call, linphone_call_state_to_string(state), message);
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self userInfo:dict];
}
@ -929,6 +929,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
ms_free(c_address);
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
// Create a new notification
UILocalNotification *notif = [[UILocalNotification alloc] init];
if (notif) {
@ -1296,8 +1297,7 @@ static LinphoneCoreVTable linphonec_vtable = {.show = NULL,
// get default config from bundle
NSString *zrtpSecretsFileName = [LinphoneManager documentFile:@"zrtp_secrets"];
NSString *chatDBFileName = [LinphoneManager documentFile:kLinphoneInternalChatDBFilename];
const char *lRootCa =
[[LinphoneManager bundleFile:@"rootca.pem"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *lRootCa = [[LinphoneManager bundleFile:@"rootca.pem"] UTF8String];
NSString *device = [NSString
stringWithFormat:@"%@_%@_iOS%@", [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"],
@ -1312,29 +1312,24 @@ static LinphoneCoreVTable linphonec_vtable = {.show = NULL,
linphone_core_set_root_ca(theLinphoneCore, lRootCa);
// Set audio assets
const char *lRing =
[[LinphoneManager bundleFile:@"ring.wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *lRing = [[LinphoneManager bundleFile:@"ring.wav"] UTF8String];
linphone_core_set_ring(theLinphoneCore, lRing);
const char *lRingBack =
[[LinphoneManager bundleFile:@"ringback.wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *lRingBack = [[LinphoneManager bundleFile:@"ringback.wav"] UTF8String];
linphone_core_set_ringback(theLinphoneCore, lRingBack);
// const char *lPlay =
// [[LinphoneManager bundleFile:@"hold.wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
// linphone_core_set_play_file(theLinphoneCore, lPlay);
const char *lPlay = [[LinphoneManager bundleFile:@"hold.wav"] UTF8String];
linphone_core_set_play_file(theLinphoneCore, lPlay);
linphone_core_set_zrtp_secrets_file(theLinphoneCore, [zrtpSecretsFileName UTF8String]);
linphone_core_set_chat_database_path(theLinphoneCore, [chatDBFileName UTF8String]);
linphone_core_set_call_logs_database_path(theLinphoneCore, [chatDBFileName UTF8String]);
linphone_core_set_zrtp_secrets_file(theLinphoneCore,
[zrtpSecretsFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_core_set_chat_database_path(theLinphoneCore,
[chatDBFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_core_set_call_logs_database_path(theLinphoneCore,
[chatDBFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
[self migrationLinphoneSettings];
[self setupNetworkReachabilityCallback];
NSString *path = [LinphoneManager bundleFile:@"nowebcamCIF.jpg"];
if (path) {
const char *imagePath = [path cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *imagePath = [path UTF8String];
LOGI(@"Using '%s' as source image for no webcam", imagePath);
linphone_core_set_static_picture(theLinphoneCore, imagePath);
}
@ -1362,8 +1357,7 @@ static LinphoneCoreVTable linphonec_vtable = {.show = NULL,
linphone_core_enable_video(theLinphoneCore, FALSE, FALSE);
}
LOGI(@"Linphone [%s] started on [%s]", linphone_core_get_version(),
[[UIDevice currentDevice].model cStringUsingEncoding:[NSString defaultCStringEncoding]]);
LOGI(@"Linphone [%s] started on [%s]", linphone_core_get_version(), [[UIDevice currentDevice].model UTF8String]);
// Post event
NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSValue valueWithPointer:theLinphoneCore] forKey:@"core"];
@ -1441,22 +1435,18 @@ static BOOL libStarted = FALSE;
libmswebrtc_init();
// Set audio assets
const char *lRing =
[[LinphoneManager bundleFile:@"ring.wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *lRing = [[LinphoneManager bundleFile:@"ring.wav"] UTF8String];
lp_config_set_string(configDb, "sound", "local_ring", lRing);
const char *lRingBack =
[[LinphoneManager bundleFile:@"ringback.wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *lRingBack = [[LinphoneManager bundleFile:@"ringback.wav"] UTF8String];
lp_config_set_string(configDb, "sound", "ringback_tone", lRingBack);
// const char *lPlay =
// [[LinphoneManager bundleFile:@"hold.wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
// lp_config_set_string(configDb, "sound", "hold_music", lPlay);
const char *lPlay = [[LinphoneManager bundleFile:@"hold.wav"] UTF8String];
lp_config_set_string(configDb, "sound", "hold_music", lPlay);
theLinphoneCore =
linphone_core_new_with_config(&linphonec_vtable, configDb, (__bridge void *)(self) /* user_data */);
/* set the CA file no matter what, since the remote provisioning could be hitting an HTTPS server */
const char *lRootCa =
[[LinphoneManager bundleFile:@"rootca.pem"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char *lRootCa = [[LinphoneManager bundleFile:@"rootca.pem"] UTF8String];
linphone_core_set_root_ca(theLinphoneCore, lRootCa);
linphone_core_set_user_certificates_path(theLinphoneCore, [[LinphoneManager cacheDirectory] UTF8String]);
@ -1768,8 +1758,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
factory = factoryIpad;
}
NSString *confiFileName = [LinphoneManager documentFile:@"linphonerc"];
configDb = lp_config_new_with_factory([confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]],
[factory cStringUsingEncoding:[NSString defaultCStringEncoding]]);
configDb = lp_config_new_with_factory([confiFileName UTF8String], [factory UTF8String]);
}
#pragma mark - Audio route Functions
@ -1803,7 +1792,7 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
OSStatus lStatus = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &lNewRouteSize, &lNewRoute);
if (!lStatus && lNewRouteSize > 0) {
NSString *route = (__bridge NSString *)lNewRoute;
LOGI(@"Current audio route is [%s]", [route cStringUsingEncoding:[NSString defaultCStringEncoding]]);
LOGI(@"Current audio route is [%s]", [route UTF8String]);
speakerEnabled = [route isEqualToString:@"Speaker"] || [route isEqualToString:@"SpeakerAndMicrophone"];
if (!LinphoneManager.runningOnIpad && [route isEqualToString:@"HeadsetBT"] && !speakerEnabled) {
@ -1907,18 +1896,7 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
// Continue by checking that the provided address is a valid SIP address, abort otherwise.
if ([address length] == 0) {
// no address provided... nothing to do
} else if (![address canBeConvertedToEncoding:[NSString defaultCStringEncoding]]) {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
message:NSLocalizedString(
@"Some invalid characters where found in the given SIP address. Please correct it.",
nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
} else if ((addr = linphone_core_interpret_url(
theLinphoneCore, [address cStringUsingEncoding:[NSString defaultCStringEncoding]])) == NULL) {
} else if ((addr = linphone_core_interpret_url(theLinphoneCore, address.UTF8String)) == NULL) {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a "
@ -1937,14 +1915,13 @@ static void audioRouteChangeListenerCallback(void *inUserData, // 1
LOGI(@"Enabling low bandwidth mode");
linphone_call_params_enable_low_bandwidth(lcallParams, YES);
}
if (displayName != nil) {
linphone_address_set_display_name(addr,
[displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_address_set_display_name(addr, displayName.UTF8String);
}
if ([[LinphoneManager instance] lpConfigBoolForKey:@"override_domain_with_default_one"]) {
linphone_address_set_domain(
addr, [[[LinphoneManager instance] lpConfigStringForKey:@"domain" forSection:@"assistant"]
cStringUsingEncoding:[NSString defaultCStringEncoding]]);
addr, [[[LinphoneManager instance] lpConfigStringForKey:@"domain" forSection:@"assistant"] UTF8String]);
}
if (transfer) {

View file

@ -33,8 +33,7 @@
va_list args;
va_start(args, format);
NSString *str = [[NSString alloc] initWithFormat:format arguments:args];
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(CFStringGetSystemEncoding());
const char *utf8str = [str cStringUsingEncoding:enc];
const char *utf8str = [str cStringUsingEncoding:NSString.defaultCStringEncoding];
int filesize = 20;
const char *filename = strchr(file, '/') ? strrchr(file, '/') + 1 : file;
if (severity <= ORTP_DEBUG) {