| | |
| | | {"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) { |
| | |
| | | |
| | | [self loadAssistantConfig:@"assistant_external_sip.rc"]; |
| | | |
| | | [self disableVP8]; |
| | | |
| | | } |
| | | |
| | | - (void)loadAssistantConfig:(NSString *)rcFilename { |
| | |
| | | // linphone_core_enable_video_capture([HDLLinphoneManager getLc], false); |
| | | // linphone_core_enable_video_preview([HDLLinphoneManager getLc], FALSE); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | // 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 = @""; |
| | |
| | | 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); |