Commit e7e36bb3 authored by jehan's avatar jehan

add basic support for tel uri in incomming calls

parent 3f53d5f0
......@@ -39,10 +39,13 @@ SalAddress * sal_address_clone(const SalAddress *addr){
const char *sal_address_get_scheme(const SalAddress *addr){
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);
belle_generic_uri_t* generic_uri = belle_sip_header_address_get_absolute_uri(header_addr);
if (uri) {
if (belle_sip_uri_is_secure(uri)) return "sips";
else return "sip";
} else
} else if (generic_uri)
return belle_generic_uri_get_scheme(generic_uri);
else
return NULL;
}
......@@ -142,10 +145,21 @@ char *sal_address_as_string(const SalAddress *addr){
char *sal_address_as_string_uri_only(const SalAddress *addr){
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);
belle_sip_uri_t* sip_uri = belle_sip_header_address_get_uri(header_addr);
belle_generic_uri_t* absolute_uri = belle_sip_header_address_get_absolute_uri(header_addr);
char tmp[1024]={0};
size_t off=0;
belle_sip_object_marshal((belle_sip_object_t*)uri,tmp,sizeof(tmp),&off);
belle_sip_object_t* uri;
if (sip_uri) {
uri=(belle_sip_object_t*)sip_uri;
} else if (absolute_uri) {
uri=(belle_sip_object_t*)absolute_uri;
} else {
ms_error("Cannot generate string for addr [%p] with null uri",addr);
return NULL;
}
belle_sip_object_marshal(uri,tmp,sizeof(tmp),&off);
return ms_strdup(tmp);
}
......
......@@ -204,7 +204,7 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
belle_sip_request_t* req = belle_sip_request_event_get_request(event);
belle_sip_dialog_t* dialog=belle_sip_request_event_get_dialog(event);
belle_sip_header_address_t* origin_address;
belle_sip_header_address_t* address;
belle_sip_header_address_t* address=NULL;
belle_sip_header_from_t* from_header;
belle_sip_header_to_t* to;
belle_sip_response_t* resp;
......@@ -266,8 +266,14 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
}
if (!op->base.from_address) {
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(from_header))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from_header)));
if (belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from_header)))
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(from_header))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from_header)));
else if ((belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(from_header))))
address=belle_sip_header_address_create2(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(from_header))
,belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(from_header)));
else
ms_error("Cannot not find from uri from request [%p]",req);
sal_op_set_from_address(op,(SalAddress*)address);
belle_sip_object_unref(address);
}
......@@ -278,8 +284,15 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
if (!op->base.to_address) {
to=belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_to_t);
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(to))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(to)));
if (belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(to)))
address=belle_sip_header_address_create(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(to))
,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(to)));
else if ((belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(to))))
address=belle_sip_header_address_create2(belle_sip_header_address_get_displayname(BELLE_SIP_HEADER_ADDRESS(to))
,belle_sip_header_address_get_absolute_uri(BELLE_SIP_HEADER_ADDRESS(to)));
else
ms_error("Cannot not find to uri from request [%p]",req);
sal_op_set_to_address(op,(SalAddress*)address);
belle_sip_object_unref(address);
}
......
......@@ -2801,6 +2801,10 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L
LinphoneProxyConfig *found_noreg_cfg=NULL;
LinphoneProxyConfig *default_cfg=lc->default_proxy;
if (linphone_address_get_domain(uri) == NULL) {
ms_message("cannot seach for proxy for uri [%p] if no domain set. returning default",uri);
return default_cfg;
}
/*return default proxy if it is matching the destination uri*/
if (default_cfg){
const char *domain=linphone_proxy_config_get_domain(default_cfg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment