diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index 3bf2e5ea6..f22530892 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -128,12 +128,12 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) { } else { from_header=belle_sip_header_from_create2("Anonymous ",belle_sip_random_token(token,sizeof(token))); } - to_header = belle_sip_header_to_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_to_address(op)),NULL); - req_uri = (belle_sip_uri_t*)belle_sip_object_clone((belle_sip_object_t*)belle_sip_header_address_get_uri((belle_sip_header_address_t*)to_header)); - - + /*make sure to preserve components like headers or port*/ + req_uri = (belle_sip_uri_t*)belle_sip_object_clone((belle_sip_object_t*)belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(sal_op_get_to_address(op)))); belle_sip_uri_set_secure(req_uri,sal_op_is_secure(op)); + to_header = belle_sip_header_to_create(BELLE_SIP_HEADER_ADDRESS(sal_op_get_to_address(op)),NULL); + req=belle_sip_request_create( req_uri, method, diff --git a/coreapi/bellesip_sal/sal_op_presence.c b/coreapi/bellesip_sal/sal_op_presence.c index c7f548e18..bdc58388b 100644 --- a/coreapi/bellesip_sal/sal_op_presence.c +++ b/coreapi/bellesip_sal/sal_op_presence.c @@ -201,7 +201,7 @@ static void handle_notify(SalOp *op, belle_sip_request_t *req){ } else { sub_state=SalSubscribeActive; } - resp = sal_op_create_response_from_request(op, req, 200); /*answer first because the op may be destroyed by notify_presence */ + resp = sal_op_create_response_from_request(op, req, 200); /*create first because the op may be destroyed by notify_presence */ op->base.root->callbacks.notify_presence(op, sub_state, presence_model, NULL); } else { diff --git a/tester/call_tester.c b/tester/call_tester.c index 48c54a6a5..38133ee11 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -166,12 +166,16 @@ bool_t call_with_params(LinphoneCoreManager* caller_mgr CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(callee_mgr->lc)); if (!linphone_core_get_current_call_remote_address(callee_mgr->lc)) return 0; - if (linphone_call_params_get_privacy(linphone_call_get_current_params(linphone_core_get_current_call(caller_mgr->lc))) == LinphonePrivacyNone) { - CU_ASSERT_TRUE(linphone_address_weak_equal(caller_mgr->identity,linphone_core_get_current_call_remote_address(callee_mgr->lc))); - } else { - CU_ASSERT_FALSE(linphone_address_weak_equal(caller_mgr->identity,linphone_core_get_current_call_remote_address(callee_mgr->lc))); + else { + LinphoneAddress* callee_from=linphone_address_clone(caller_mgr->identity); + linphone_address_set_port(callee_from,0); /*remove port because port is never present in from header*/ + if (linphone_call_params_get_privacy(linphone_call_get_current_params(linphone_core_get_current_call(caller_mgr->lc))) == LinphonePrivacyNone) { + CU_ASSERT_TRUE(linphone_address_weak_equal(callee_from,linphone_core_get_current_call_remote_address(callee_mgr->lc))); + } else { + CU_ASSERT_FALSE(linphone_address_weak_equal(callee_from,linphone_core_get_current_call_remote_address(callee_mgr->lc))); + } + linphone_address_destroy(callee_from); } - if (callee_params) linphone_core_accept_call_with_params(callee_mgr->lc,linphone_core_get_current_call(callee_mgr->lc),callee_params); else @@ -541,6 +545,13 @@ static void call_with_custom_headers(void) { LinphoneCallParams *params; const LinphoneCallParams *remote_params; const char *hvalue; + char* tmp=linphone_address_as_string_uri_only(marie->identity); + char tmp2[256]; + snprintf(tmp2,sizeof(tmp2),"%s?uriHeader=myUriHeader",tmp); + LinphoneAddress* marie_identity=linphone_address_new(tmp2); + ms_free(tmp); + linphone_address_destroy(marie->identity); + marie->identity=marie_identity; params=linphone_core_create_default_call_parameters(marie->lc); linphone_call_params_add_custom_header(params,"Weather","bad"); @@ -558,8 +569,11 @@ static void call_with_custom_headers(void) { remote_params=linphone_call_get_remote_params(c1); hvalue=linphone_call_params_get_custom_header(remote_params,"Weather"); CU_ASSERT_PTR_NOT_NULL(hvalue); - CU_ASSERT_TRUE(strcmp(hvalue,"bad")==0); - + CU_ASSERT_STRING_EQUAL(hvalue,"bad"); + hvalue=linphone_call_params_get_custom_header(remote_params,"uriHeader"); + CU_ASSERT_PTR_NOT_NULL(hvalue); + CU_ASSERT_STRING_EQUAL(hvalue,"myUriHeader"); + CU_ASSERT_PTR_NOT_NULL(linphone_call_get_remote_contact(c1)); /*just to sleep*/ diff --git a/tester/certificates/cacert.pem b/tester/certificates/altname/cacert.pem similarity index 100% rename from tester/certificates/cacert.pem rename to tester/certificates/altname/cacert.pem diff --git a/tester/certificates/cn/cacert.pem b/tester/certificates/cn/cacert.pem new file mode 100644 index 000000000..2fd957d39 --- /dev/null +++ b/tester/certificates/cn/cacert.pem @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDRjCCAq+gAwIBAgIJAJ3nFcA7qFrOMA0GCSqGSIb3DQEBBQUAMIG7MQswCQYD +VQQGEwJGUjETMBEGA1UECAwKU29tZS1TdGF0ZTERMA8GA1UEBwwIR3Jlbm9ibGUx +IjAgBgNVBAoMGUJlbGxlZG9ubmUgQ29tbXVuaWNhdGlvbnMxDDAKBgNVBAsMA0xB +QjEWMBQGA1UEAwwNSmVoYW4gTW9ubmllcjE6MDgGCSqGSIb3DQEJARYramVoYW4u +bW9ubmllckBiZWxsZWRvbm5lLWNvbW11bmljYXRpb25zLmNvbTAeFw0xMzA0MzAx +MzMwMThaFw0yMzA0MjgxMzMwMThaMIG7MQswCQYDVQQGEwJGUjETMBEGA1UECAwK +U29tZS1TdGF0ZTERMA8GA1UEBwwIR3Jlbm9ibGUxIjAgBgNVBAoMGUJlbGxlZG9u +bmUgQ29tbXVuaWNhdGlvbnMxDDAKBgNVBAsMA0xBQjEWMBQGA1UEAwwNSmVoYW4g +TW9ubmllcjE6MDgGCSqGSIb3DQEJARYramVoYW4ubW9ubmllckBiZWxsZWRvbm5l +LWNvbW11bmljYXRpb25zLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +z5F8mMh3SUr6NUd7tq2uW2Kdn22Zn3kNpLYb78AQK4IoQMOLGXbBdyoXvz1fublg +bxtLYsiGhICd7Ul9zLGc3edn85LbD3Skb7ERx6MakRnYep3FzagZJhn14QEaZCx6 +3Qs0Ir4rSP7hmlpYt8VO/zqqNR3tsA59O0D9c7bpQ7UCAwEAAaNQME4wHQYDVR0O +BBYEFAZfXccWr2L4LW5xA4ig1h0rBH+6MB8GA1UdIwQYMBaAFAZfXccWr2L4LW5x +A4ig1h0rBH+6MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAKvmt2m1o +axGKc0DjiJPypU/NsAf4Yu0nOnY8pHqJJCB0AWVoAPM7vGYPWpeH7LSdGZLuT9eK +FUWGJhPnkrnklmBdVB0l7qXYjR5uf766HDkoDxuLhNifow3IYvsS+L2Y6puRQb9w +HLMDE29mBDl0WyoX3h0yR0EiAO15V9A7I10= +-----END CERTIFICATE----- diff --git a/tester/flexisip.conf b/tester/flexisip.conf index 3ebbeb7be..b4d39a5c0 100755 --- a/tester/flexisip.conf +++ b/tester/flexisip.conf @@ -461,7 +461,7 @@ nortpproxy=nortpproxy # Set the RTP direction during early media state (duplex, forward) # Default value: duplex -early-media-rtp-dir=duplex +#early-media-rtp-dir=duplex # The minimal value of SDP port range # Default value: 1024 diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 7b34e7f45..e795ab254 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -108,7 +108,7 @@ static LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* sal_enable_test_features(lc->sal,TRUE); #ifndef ANDROID - snprintf(rootcapath, sizeof(rootcapath), "%s/certificates/cacert.pem", path); + snprintf(rootcapath, sizeof(rootcapath), "%s/certificates/cn/cacert.pem", path); #else snprintf(rootcapath, sizeof(rootcapath), "%s/cacert.pem", path); #endif diff --git a/tester/presence_tester.c b/tester/presence_tester.c index bb3033f92..3df002b8f 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -153,12 +153,17 @@ static bool_t subscribe_to_callee_presence(LinphoneCoreManager* caller_mgr,Linph linphone_core_add_friend(caller_mgr->lc,friend); - result=wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphonePresenceActivityOnline,initial_callee.number_of_LinphonePresenceActivityOnline+1); - result&=wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphonePresenceActivityOnline,initial_caller.number_of_LinphonePresenceActivityOnline+1); + result=wait_for(caller_mgr->lc,callee_mgr->lc,&caller_mgr->stat.number_of_LinphonePresenceActivityOnline,initial_caller.number_of_LinphonePresenceActivityOnline+1); + /*without proxy, callee cannot subscribe to caller + result&=wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphonePresenceActivityOnline,initial_callee.number_of_LinphonePresenceActivityOnline+1); + */ CU_ASSERT_EQUAL(callee_mgr->stat.number_of_NewSubscriptionRequest,initial_callee.number_of_NewSubscriptionRequest+1); + /*without proxy, callee cannot subscribe to caller CU_ASSERT_EQUAL(callee_mgr->stat.number_of_NotifyReceived,initial_callee.number_of_NotifyReceived+1); + */ CU_ASSERT_EQUAL(caller_mgr->stat.number_of_NotifyReceived,initial_caller.number_of_NotifyReceived+1); + ms_free(identity); return result; @@ -204,6 +209,7 @@ static void simple_subscribe(void) { linphone_core_manager_destroy(marie); + /*unsubscribe is not reported ?*/ CU_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/ linphone_core_manager_destroy(pauline); @@ -226,6 +232,7 @@ static void call_with_presence(void) { LinphoneVideoPolicy pol={0}; linphone_core_set_video_policy(marie->lc,&pol); CU_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline)); + CU_ASSERT_TRUE(subscribe_to_callee_presence(pauline,marie)); CU_ASSERT_TRUE(call(marie,pauline)); CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityOnThePhone,1); diff --git a/tester/register_tester.c b/tester/register_tester.c index 7ec8881e0..043b15c3c 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -530,14 +530,14 @@ static void tls_certificate_failure(){ mgr=linphone_core_manager_new2("pauline_rc",FALSE); lc=mgr->lc; - snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/agent.pem", liblinphone_tester_file_prefix); /*bad root ca*/ + snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/agent.pem", liblinphone_tester_file_prefix); /*bad root ca*/ linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_set_network_reachable(lc,TRUE); CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1)); linphone_core_set_root_ca(mgr->lc,NULL); /*no root ca*/ linphone_core_refresh_registers(mgr->lc); CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,2)); - snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cacert.pem", liblinphone_tester_file_prefix); /*goot root ca*/ + snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cacert.pem", liblinphone_tester_file_prefix); /*goot root ca*/ linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_refresh_registers(mgr->lc); CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1)); @@ -575,7 +575,7 @@ static void tls_alt_name_register(){ mgr=linphone_core_manager_new2("pauline_alt_rc",FALSE); lc=mgr->lc; - snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cacert.pem", liblinphone_tester_file_prefix); + snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cacert.pem", liblinphone_tester_file_prefix); linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_refresh_registers(mgr->lc); CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1)); @@ -590,7 +590,7 @@ static void tls_wildcard_register(){ mgr=linphone_core_manager_new2("pauline_wild_rc",FALSE); lc=mgr->lc; - snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cacert.pem", liblinphone_tester_file_prefix); + snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cacert.pem", liblinphone_tester_file_prefix); linphone_core_set_root_ca(mgr->lc,rootcapath); linphone_core_refresh_registers(mgr->lc); CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,2));