mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 03:28:07 +00:00
implement uri headers
This commit is contained in:
parent
2bb4f7f662
commit
c7d6cf0e55
9 changed files with 61 additions and 20 deletions
|
|
@ -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 <sip:anonymous@anonymous.invalid>",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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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*/
|
||||
|
|
|
|||
20
tester/certificates/cn/cacert.pem
Normal file
20
tester/certificates/cn/cacert.pem
Normal file
|
|
@ -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-----
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue