User agent: use device name and version as user agent

This commit is contained in:
Gautier Pelloux-Prayer 2015-10-05 11:25:05 +02:00
parent 59ad155cb7
commit 924ea29282
3 changed files with 13 additions and 4 deletions

View file

@ -1293,10 +1293,10 @@ static LinphoneCoreVTable linphonec_vtable = {.show = NULL,
const char *lRootCa =
[[LinphoneManager bundleFile:@"rootca.pem"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
linphone_core_set_user_agent(theLinphoneCore,
[[[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
stringByAppendingString:@"Iphone"] UTF8String],
LINPHONE_IOS_VERSION);
NSString *device = [NSString
stringWithFormat:@"%@_%@_iOS%@", [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"],
[LinphoneUtils deviceName], UIDevice.currentDevice.systemVersion];
linphone_core_set_user_agent(theLinphoneCore, device.UTF8String, LINPHONE_IOS_VERSION);
_contactSipField = [self lpConfigStringForKey:@"contact_im_type_value" withDefault:@"SIP"];

View file

@ -46,6 +46,7 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
+ (void)buttonFixStatesForTabs:(UIButton*)button;
+ (void)buttonMultiViewAddAttributes:(NSMutableDictionary*)attributes button:(UIButton*)button;
+ (void)buttonMultiViewApplyAttributes:(NSDictionary*)attributes button:(UIButton*)button;
+ (NSString *)deviceName;
@end

View file

@ -20,6 +20,7 @@
#import "Utils.h"
#include "linphone/linphonecore.h"
#import <CommonCrypto/CommonDigest.h>
#import <sys/utsname.h>
@implementation LinphoneLogger
@ -298,6 +299,13 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
return nil;
}
+ (NSString *)deviceName {
struct utsname systemInfo;
uname(&systemInfo);
return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
}
@end
@implementation NSNumber (HumanReadableSize)