From cb9232b3ab413fae7bcc2b94abd70f18ca02b263 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 03 十二月 2024 11:20:32 +0800 Subject: [PATCH] 增加铃声;增加TCP/UDP连接选择 --- HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK.a | 0 HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneSDK.h | 11 ++ HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinPhoneSDK.h | 10 + Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/ApiDefinition.cs | 19 +++ HDLLinPhoneDemo/HDLLinPhoneDemo/ViewController.m | 8 + Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Properties/AssemblyInfo.cs | 2 HDLLinPhoneDemo/HDLLinPhoneDemo.xcodeproj/project.pbxproj | 8 HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneSDK.m | 24 +++- Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK.csproj | 2 HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneManager.m | 155 ++++++++++++++++++++++++++++++- Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a | 0 HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinphoneCallDelegate.h | 4 HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-1.a | 0 Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a | 0 HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-2.a | 0 HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneManager.h | 4 16 files changed, 222 insertions(+), 25 deletions(-) diff --git a/HDLLinPhoneDemo/HDLLinPhoneDemo.xcodeproj/project.pbxproj b/HDLLinPhoneDemo/HDLLinPhoneDemo.xcodeproj/project.pbxproj index 548c02c..521393e 100755 --- a/HDLLinPhoneDemo/HDLLinPhoneDemo.xcodeproj/project.pbxproj +++ b/HDLLinPhoneDemo/HDLLinPhoneDemo.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ AE9CC97426B8E67700FD514C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AE9CC97326B8E67700FD514C /* Assets.xcassets */; }; AE9CC97726B8E67700FD514C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE9CC97526B8E67700FD514C /* LaunchScreen.storyboard */; }; AE9CC97A26B8E67700FD514C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AE9CC97926B8E67700FD514C /* main.m */; }; - AE9CCFAE26BA596300FD514C /* libHDLLinPhoneSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AE9CCFAD26BA596300FD514C /* libHDLLinPhoneSDK.a */; }; AEB7CC5E26C272FD005DD19A /* belr.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEB7CC5026C272FC005DD19A /* belr.framework */; }; AEB7CC5F26C272FD005DD19A /* mediastreamer2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEB7CC5126C272FC005DD19A /* mediastreamer2.framework */; }; AEB7CC6026C272FD005DD19A /* msopenh264.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEB7CC5226C272FC005DD19A /* msopenh264.framework */; }; @@ -70,6 +69,7 @@ AEC00E37287586E30009221E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEC00E34287586E20009221E /* AudioToolbox.framework */; }; AEF6AC02282B862200C9FD36 /* bctoolbox-ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEF6AC01282B862200C9FD36 /* bctoolbox-ios.framework */; }; AEF6AC03282B863D00C9FD36 /* bctoolbox-ios.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = AEF6AC01282B862200C9FD36 /* bctoolbox-ios.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + DBD868FC2C9BCFC900D17591 /* libHDLLinPhoneSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DBD868FB2C9BCFC900D17591 /* libHDLLinPhoneSDK.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -118,7 +118,6 @@ AE9CC97626B8E67700FD514C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; AE9CC97826B8E67700FD514C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; AE9CC97926B8E67700FD514C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; - AE9CCFAD26BA596300FD514C /* libHDLLinPhoneSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libHDLLinPhoneSDK.a; sourceTree = "<group>"; }; AEB4A76726BBF5DE005641ED /* HDLLinPhoneSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDLLinPhoneSDK.h; sourceTree = "<group>"; }; AEB7CC5026C272FC005DD19A /* belr.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = belr.framework; sourceTree = "<group>"; }; AEB7CC5126C272FC005DD19A /* mediastreamer2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = mediastreamer2.framework; sourceTree = "<group>"; }; @@ -158,6 +157,7 @@ AEC00E33287586E20009221E /* CoreAudioTypes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudioTypes.framework; path = System/Library/Frameworks/CoreAudioTypes.framework; sourceTree = SDKROOT; }; AEC00E34287586E20009221E /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; AEF6AC01282B862200C9FD36 /* bctoolbox-ios.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = "bctoolbox-ios.framework"; sourceTree = "<group>"; }; + DBD868FB2C9BCFC900D17591 /* libHDLLinPhoneSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libHDLLinPhoneSDK.a; path = HDLLinPhoneDemo/libHDLLinPhoneSDK.a; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -170,10 +170,10 @@ AEB7CC6226C272FD005DD19A /* mswebrtc.framework in Frameworks */, AEB7CC6526C272FD005DD19A /* ortp.framework in Frameworks */, AEB7CC6726C272FD005DD19A /* mssilk.framework in Frameworks */, - AE9CCFAE26BA596300FD514C /* libHDLLinPhoneSDK.a in Frameworks */, AEB7CC6626C272FD005DD19A /* mscodec2.framework in Frameworks */, AEC00E192874058B0009221E /* limetester.framework in Frameworks */, AEB7CC6B26C272FD005DD19A /* linphone.framework in Frameworks */, + DBD868FC2C9BCFC900D17591 /* libHDLLinPhoneSDK.a in Frameworks */, AEF6AC02282B862200C9FD36 /* bctoolbox-ios.framework in Frameworks */, AEB7CC6026C272FD005DD19A /* msopenh264.framework in Frameworks */, AEB7CC6426C272FD005DD19A /* belle-sip.framework in Frameworks */, @@ -194,6 +194,7 @@ AE9CC95826B8E67200FD514C = { isa = PBXGroup; children = ( + DBD868FB2C9BCFC900D17591 /* libHDLLinPhoneSDK.a */, AE9CC96326B8E67200FD514C /* HDLLinPhoneDemo */, AE9CC96226B8E67200FD514C /* Products */, AEC00E31287586E20009221E /* Frameworks */, @@ -213,7 +214,6 @@ children = ( AE1EB201276731EB004F6C70 /* HDLLinPhoneDemo.entitlements */, AEB7CC4D26C272FC005DD19A /* linphone-sdk */, - AE9CCFAD26BA596300FD514C /* libHDLLinPhoneSDK.a */, AEBB4F9E2876858B0057BDE8 /* Resources */, AE9CD26626BA688600FD514C /* include */, AE9CC96426B8E67200FD514C /* AppDelegate.h */, diff --git a/HDLLinPhoneDemo/HDLLinPhoneDemo/ViewController.m b/HDLLinPhoneDemo/HDLLinPhoneDemo/ViewController.m index d0c3fd2..5051540 100755 --- a/HDLLinPhoneDemo/HDLLinPhoneDemo/ViewController.m +++ b/HDLLinPhoneDemo/HDLLinPhoneDemo/ViewController.m @@ -69,9 +69,11 @@ // [HDLLinPhoneSDK.instance login:@"7777" password:@"85521566" domain:@"116.62.26.215:35060"]; // [HDLLinPhoneSDK.instance login:@"7777" password:@"85521566" domain:@"47.96.88.250:35060"]; // [HDLLinPhoneSDK.instance login:@"1523530877409157121" password:@"Yrxha0sq8YwmzuN7kRpGD7pdx" domain:@"116.62.26.215:35060"]; - [HDLLinPhoneSDK.instance login:@"1677890543690887170" password:@"xFNxyrTIM8gLAOGDw3OiuzV5F" domain:@"47.96.88.250:25060"]; - - +// [HDLLinPhoneSDK.instance login:@"1833380707801464833" password:@"KD5L2GOIZ5Mxqv78ModXvPBRX" domain:@"47.96.88.250:25060" ]; + [HDLLinPhoneSDK.instance login:@"1833380707801464833" password:@"KD5L2GOIZ5Mxqv78ModXvPBRX" domain:@"47.96.88.250:25060" ]; +// [HDLLinPhoneSDK.instance udpLogin:@"1833380707801464833" password:@"KD5L2GOIZ5Mxqv78ModXvPBRX" domain:@"47.96.88.250:25060" ]; + + // [HDLLinPhoneSDK.instance login:@"5555" password:@"85521566" domain:@"116.62.26.215:35060"]; HDLLinPhoneSDK.instance.hdlLinphoneCallDelegate=self; diff --git a/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinPhoneSDK.h b/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinPhoneSDK.h index 391205c..24e45a9 100644 --- a/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinPhoneSDK.h +++ b/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinPhoneSDK.h @@ -33,7 +33,12 @@ * @param pwd 瀵嗙爜 * @param domain 鍩熷悕 */ --(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain; +-(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain ; + +-(void)tcpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain ; + +-(void)udpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain ; + /** * 鍒濆鍖杔inphone @@ -73,6 +78,9 @@ */ -(void)gotoHDLSRLinphoneIntercomVC:(NSString*)titleName userName:(NSString*)username; +-(void)hideIntercomeVC; + + /** * 娉ㄩ攢鐧诲綍 * diff --git a/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinphoneCallDelegate.h b/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinphoneCallDelegate.h old mode 100755 new mode 100644 index aa05a96..41640cc --- a/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinphoneCallDelegate.h +++ b/HDLLinPhoneDemo/HDLLinPhoneDemo/include/HDLLinPhoneSDK/HDLLinphoneCallDelegate.h @@ -20,6 +20,9 @@ //鎷掓帴鏉ョ數鍥炶皟 -(void)onRejectCallAction; +//鍏ㄩ儴鎷掓帴鏉ョ數鍥炶皟 +-(void)onRejectAllCallAction; + //寮�閿佸洖璋� -(void)onUnlockAction; @@ -38,3 +41,4 @@ @end NS_ASSUME_NONNULL_END + diff --git a/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-1.a b/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-1.a new file mode 100644 index 0000000..bc6bb81 --- /dev/null +++ b/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-1.a Binary files differ diff --git a/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-2.a b/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-2.a new file mode 100644 index 0000000..a044784 --- /dev/null +++ b/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK-2.a Binary files differ diff --git a/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK.a b/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK.a index bc6bb81..935df33 100644 --- a/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK.a +++ b/HDLLinPhoneDemo/HDLLinPhoneDemo/libHDLLinPhoneSDK.a Binary files differ diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.h" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.h" index e739361..afd3d15 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.h" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.h" @@ -33,7 +33,11 @@ * @param pwd 瀵嗙爜 * @param domain 鍩熷悕 */ --(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain connectType:(NSString*)connectType; +-(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain ; + +-(void)tcpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain ; + +-(void)udpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain ; /** @@ -76,6 +80,11 @@ -(void)hideIntercomeVC; +/** + 鍙戦�乻ip message + */ +-(void)sendMessage:(NSString*)message sipAccount:(NSString*)sipAccount domain:(NSString*)domain; + /** * 娉ㄩ攢鐧诲綍 diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m" index 54e503e..e6f7446 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneSDK.m" @@ -42,12 +42,16 @@ // [NSNotificationCenter.defaultCenter remo]; } -//-(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain{ -// [HDLLinphoneManager.instance login:username password:pwd domain:domain]; -//} +-(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain{ + [HDLLinphoneManager.instance login:username password:pwd domain:domain]; +} --(void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain connectType:(NSString*)connectType{ - [HDLLinphoneManager.instance login:username password:pwd domain:domain connectType:connectType]; +-(void)tcpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain { + [HDLLinphoneManager.instance tcpLogin:username password:pwd domain:domain ]; +} + +-(void)udpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain { + [HDLLinphoneManager.instance udpLogin:username password:pwd domain:domain ]; } - (void)registrationUpdate:(NSNotification *)notif { @@ -236,6 +240,16 @@ }]; } } +/** + 鍙戦�乻ip message + */ +-(void)sendMessage:(NSString*)message sipAccount:(NSString*)sipAccount domain:(NSString*)domain{ + LinphoneAddress *tmpAddr = linphone_address_new([NSString stringWithFormat:@"sip:%@@%@",sipAccount,domain].UTF8String); + LinphoneChatRoom *chatRomm=linphone_core_get_chat_room([HDLLinphoneManager getLc], tmpAddr); + [[HDLLinphoneManager instance] send:message toChatRoom:chatRomm]; +} + + -(void)toLinphoneIntercomVC:(NSString*)titleName deviceType:(HDLLPType)deviceType userName:(NSString *)userName{ HDLLinphoneIntercomVC *vc=[[HDLLinphoneIntercomVC alloc]init]; diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.h" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.h" index 61a9089..b5181a7 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.h" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.h" @@ -209,7 +209,9 @@ - (void)loadAvatar; - (void)migrationPerAccount; -- (void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain connectType:(NSString*)connectType; +- (void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain; +- (void)udpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain; +- (void)tcpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain; -(void)initalLinPhonal; diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m" index f4a77b3..5e45b98 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneManager.m" @@ -170,6 +170,24 @@ {"CODEC2", 8000, "codec2_preference"}, {NULL, 0, Nil}}; +-(void)disableVP8{ + const MSList *codecs = linphone_core_get_video_codecs(LC); + PayloadType *pt; + const MSList *elem; + + for (elem = codecs; elem != NULL; elem = elem->next) { + pt = (PayloadType *)elem->data; + NSString *pref = [HDLLinphoneManager getPreferenceForCodec:pt->mime_type withRate:pt->clock_rate]; +// NSLog(@"缂栫爜pref锛�%@",pref); + if([pref isEqualToString:@"vp8_preference"]){ + linphone_core_enable_payload_type(LC, pt, FALSE); + }else{ + linphone_core_enable_payload_type(LC, pt, TRUE); + } + } + +} + + (NSString *)getPreferenceForCodec:(const char *)name withRate:(int)rate { int i; for (i = 0; hdl_codec_pref_table[i].name != NULL; ++i) { @@ -549,6 +567,8 @@ [self loadAssistantConfig:@"assistant_external_sip.rc"]; + [self disableVP8]; + } - (void)loadAssistantConfig:(NSString *)rcFilename { @@ -569,6 +589,7 @@ // linphone_core_enable_video_capture([HDLLinphoneManager getLc], false); // linphone_core_enable_video_preview([HDLLinphoneManager getLc], FALSE); + } @@ -689,7 +710,7 @@ // linphone_core_enable_mic(LC, false); } -- (void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain connectType:(NSString*)connectType{ +- (void)login:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain { // NSString *domain = [self findTextField:ViewElement_Domain].text; // NSString *username = username; NSString *displayName = @""; @@ -711,15 +732,139 @@ linphone_proxy_config_set_identity_address(config, addr); // set transport -// NSString *type = @"UDP"; + NSString *type = @"UDP"; // NSString *type = @"TCP"; - linphone_proxy_config_set_route( + linphone_proxy_config_set_routes( config, - [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, connectType.lowercaseString.UTF8String] + [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] .UTF8String); linphone_proxy_config_set_server_addr( config, - [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, connectType.lowercaseString.UTF8String] + [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] + .UTF8String); + + linphone_proxy_config_enable_publish(config, FALSE); + linphone_proxy_config_enable_register(config, TRUE); + + LinphoneAuthInfo *info = + linphone_auth_info_new(linphone_address_get_username(addr), // username + NULL, // user id + pwd.UTF8String, // passwd + NULL, // ha1 + linphone_address_get_domain(addr), // realm - assumed to be domain + linphone_address_get_domain(addr) // domain + ); + linphone_core_add_auth_info(LC, info); + linphone_address_unref(addr); + linphone_address_unref(tmpAddr); + + if (config) { + [[HDLLinphoneManager instance] configurePushTokenForProxyConfig:config]; + if (linphone_core_add_proxy_config(LC, config) != -1) { + linphone_core_set_default_proxy_config(LC, config); + // reload address book to prepend proxy config domain to contacts' phone number + // todo: STOP doing that! +// [[LinphoneManager.instance fastAddressBook] fetchContactsInBackGroundThread]; +// [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + NSLog(@"鐧诲綍鎴愬姛浜嗭紵"); + } else { +// [self displayAssistantConfigurationError]; + } + } else { +// [self displayAssistantConfigurationError]; + } +} + +- (void)tcpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain { + NSString *displayName = @""; + LinphoneProxyConfig *config = linphone_core_create_proxy_config(LC); + LinphoneAddress *addr = linphone_address_new(NULL); + LinphoneAddress *tmpAddr = linphone_address_new([NSString stringWithFormat:@"sip:%@",domain].UTF8String); + if (tmpAddr == nil) { + return; + } + + linphone_address_set_username(addr, username.UTF8String); + linphone_address_set_port(addr, linphone_address_get_port(tmpAddr)); + linphone_address_set_domain(addr, linphone_address_get_domain(tmpAddr)); + if (displayName && ![displayName isEqualToString:@""]) { + linphone_address_set_display_name(addr, displayName.UTF8String); + } + linphone_proxy_config_set_identity_address(config, addr); + + NSString *type = @"TCP"; +// linphone_proxy_config_set_routes( +// config, +// [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] +// .UTF8String); + + // 鍒涘缓涓�涓矾鐢卞垪琛� + bctbx_list_t *routes = NULL; + + // 娣诲姞璺敱鍒板垪琛ㄤ腑 + routes = bctbx_list_append(routes, (void *)tmpAddr); + + + // 璁剧疆璺敱 + linphone_proxy_config_set_routes(config, routes); + + + linphone_proxy_config_set_server_addr( + config, + [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] + .UTF8String); + + linphone_proxy_config_enable_publish(config, FALSE); + linphone_proxy_config_enable_register(config, TRUE); + + LinphoneAuthInfo *info = + linphone_auth_info_new(linphone_address_get_username(addr), // username + NULL, // user id + pwd.UTF8String, // passwd + NULL, // ha1 + linphone_address_get_domain(addr), // realm - assumed to be domain + linphone_address_get_domain(addr) // domain + ); + linphone_core_add_auth_info(LC, info); + linphone_address_unref(addr); + linphone_address_unref(tmpAddr); + + if (config) { + [[HDLLinphoneManager instance] configurePushTokenForProxyConfig:config]; + if (linphone_core_add_proxy_config(LC, config) != -1) { + linphone_core_set_default_proxy_config(LC, config); + NSLog(@"鐧诲綍鎴愬姛浜嗭紵"); + } else { + } + } else { + } +} + +- (void)udpLogin:(NSString*)username password:(NSString*)pwd domain:(NSString*) domain { + NSString *displayName = @""; + LinphoneProxyConfig *config = linphone_core_create_proxy_config(LC); + LinphoneAddress *addr = linphone_address_new(NULL); + LinphoneAddress *tmpAddr = linphone_address_new([NSString stringWithFormat:@"sip:%@",domain].UTF8String); + if (tmpAddr == nil) { + return; + } + + linphone_address_set_username(addr, username.UTF8String); + linphone_address_set_port(addr, linphone_address_get_port(tmpAddr)); + linphone_address_set_domain(addr, linphone_address_get_domain(tmpAddr)); + if (displayName && ![displayName isEqualToString:@""]) { + linphone_address_set_display_name(addr, displayName.UTF8String); + } + linphone_proxy_config_set_identity_address(config, addr); + + NSString *type = @"UDP"; +// linphone_proxy_config_set_routes( +// config, +// [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] +// .UTF8String); + linphone_proxy_config_set_server_addr( + config, + [NSString stringWithFormat:@"%s;transport=%s", domain.UTF8String, type.lowercaseString.UTF8String] .UTF8String); linphone_proxy_config_enable_publish(config, FALSE); diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/ApiDefinition.cs b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/ApiDefinition.cs index 5ba2cd0..b398706 100644 --- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/ApiDefinition.cs +++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/ApiDefinition.cs @@ -84,9 +84,18 @@ [Export("instance")] HDLLinPhoneSDK Instance(); - // -(void)login:(NSString *)username password:(NSString *)pwd domain:(NSString *)domain connectType:(NSString *)connectType; - [Export("login:password:domain:connectType:")] - void Login(string username, string pwd, string domain, string connectType); + + // -(void)login:(NSString *)username password:(NSString *)pwd domain:(NSString *)domain; + [Export("login:password:domain:")] + void Login(string username, string pwd, string domain); + + // -(void)tcpLogin:(NSString *)username password:(NSString *)pwd domain:(NSString *)domain; + [Export("tcpLogin:password:domain:")] + void TcpLogin(string username, string pwd, string domain); + + // -(void)udpLogin:(NSString *)username password:(NSString *)pwd domain:(NSString *)domain; + [Export("udpLogin:password:domain:")] + void UdpLogin(string username, string pwd, string domain); // -(void)initalLinPhone; [Export("initalLinPhone")] @@ -112,6 +121,10 @@ [Export("hideIntercomeVC")] void HideIntercomeVC(); + // -(void)sendMessage:(NSString *)message sipAccount:(NSString *)sipAccount domain:(NSString *)domain; + [Export("sendMessage:sipAccount:domain:")] + void SendMessage(string message, string sipAccount, string domain); + // -(void)logoutAllLinphoneUser; [Export("logoutAllLinphoneUser")] void LogoutAllLinphoneUser(); diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Properties/AssemblyInfo.cs b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Properties/AssemblyInfo.cs index 0f8eb9d..1fbedef 100644 --- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Properties/AssemblyInfo.cs +++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Properties/AssemblyInfo.cs @@ -25,7 +25,7 @@ // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.24.08.07")] +[assembly: AssemblyVersion("24.11.14.2")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK.csproj b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK.csproj index b7d3bf2..f31ff25 100644 --- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK.csproj +++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK.csproj @@ -97,7 +97,7 @@ <Kind>Framework</Kind> <SmartLink>False</SmartLink> </NativeReference> - <NativeReference Include="libHDLLinPhoneSDK.a"> + <NativeReference Include="..\libHDLLinPhoneSDK.a"> <Kind>Static</Kind> <SmartLink>False</SmartLink> </NativeReference> diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a index f54dae7..c184c1f 100644 --- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a +++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a Binary files differ diff --git a/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a b/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a new file mode 100644 index 0000000..f737d43 --- /dev/null +++ b/Shared.IOS.HDLLinphoneSDK/libHDLLinPhoneSDK.a Binary files differ -- Gitblit v1.8.0