}
-bool_t linphone_core_is_in_main_thread(LinphoneCore *lc){
- return TRUE;
-}
-
-static char *guess_route_if_any(LinphoneCore *lc, osip_to_t *parsed_url){
- const MSList *elem=linphone_core_get_proxy_config_list(lc);
- for(;elem!=NULL;elem=elem->next){
- LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
- char prx[256];
- if (cfg->ssctx && sip_setup_context_get_proxy(cfg->ssctx,parsed_url->url->host,prx,sizeof(prx))==0){
- ms_message("We have a proxy for domain %s",parsed_url->url->host);
- if (strcmp(parsed_url->url->host,prx)!=0){
- char *route=NULL;
- osip_route_t *rt;
- osip_route_init(&rt);
- if (osip_route_parse(rt,prx)==0){
- char *rtstr;
- osip_uri_uparam_add(rt->url,osip_strdup("lr"),NULL);
- osip_route_to_str(rt,&rtstr);
- route=ms_strdup(rtstr);
- osip_free(rtstr);
- }
- osip_route_free(rt);
- ms_message("Adding a route: %s",route);
- return route;
- }
- }
- }
- return NULL;
-}
-
bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, LinphoneAddress **real_parsed_url, char **route){
enum_lookup_res_t *enumres=NULL;
- osip_to_t *parsed_url=NULL;
+ LinphoneAddress *parsed_url=NULL;
char *enum_domain=NULL;
- LinphoneProxyConfig *proxy;
+ LinphoneProxyConfig *proxy=lc->default_proxy;;
char *tmpurl;
const char *tmproute;
+ LinphoneAddress *uri;
+
if (real_parsed_url!=NULL) *real_parsed_url=NULL;
*route=NULL;
tmproute=linphone_core_get_route(lc);
linphone_address_set_username(uri,normalized_username);
if (real_parsed_url!=NULL) *real_parsed_url=uri;
-#if 0
- /*if the prompted uri was auto-suffixed with proxy domain,
- then automatically set a route so that the request goes
- through the proxy*/
- if (tmproute==NULL){
- osip_route_t *rt=NULL;
- char *rtstr=NULL;
- osip_route_init(&rt);
- if (osip_route_parse(rt,linphone_proxy_config_get_addr(proxy))==0){
- osip_uri_uparam_add(rt->url,osip_strdup("lr"),NULL);
- osip_route_to_str(rt,&rtstr);
- *route=ms_strdup(rtstr);
- osip_free(rtstr);
- }
- ms_message("setting automatically a route to %s",*route);
- }
- else *route=ms_strdup(tmproute);
-#else
- if (tmproute==NULL) *route=guess_route_if_any(lc,*real_parsed_url);
if (tmproute) *route=ms_strdup(tmproute);
-#endif
return TRUE;
- }
+ }else return FALSE;
}
parsed_url=linphone_address_new(url);
if (parsed_url!=NULL){
lp_config_set_int(lc->config,"sip","use_rfc2833",config->use_rfc2833);
lp_config_set_int(lc->config,"sip","use_ipv6",config->ipv6_enabled);
lp_config_set_int(lc->config,"sip","register_only_when_network_is_up",config->register_only_when_network_is_up);
++
++ lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
++
for(elem=config->proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)(elem->data);
linphone_proxy_config_write_to_config_file(lc->config,cfg,i);
/* save all config */
net_config_uninit(lc);
sip_config_uninit(lc);
-- lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
rtp_config_uninit(lc);
sound_config_uninit(lc);
video_config_uninit(lc);