Commit fd285ca7 authored by smorlat's avatar smorlat

fix 2 crashes, one when rport is null , other when using no proxy at all.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@640 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent e97abcd6
......@@ -1275,7 +1275,7 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const c
return found_cfg;
}
static void fix_contact(osip_message_t *msg, const char *localip, LinphoneProxyConfig *dest_proxy){
static void fix_contact(LinphoneCore *lc, osip_message_t *msg, const char *localip, LinphoneProxyConfig *dest_proxy){
osip_contact_t *ctt=NULL;
const char *ip=NULL;
int port=5060;
......@@ -1288,7 +1288,7 @@ static void fix_contact(osip_message_t *msg, const char *localip, LinphoneProxyC
linphone_proxy_config_get_contact(dest_proxy,&ip,&port);
}else{
ip=localip;
port=linphone_core_get_sip_port(dest_proxy->lc);
port=linphone_core_get_sip_port(lc);
}
if (ip!=NULL){
osip_free(ctt->url->host);
......@@ -1366,7 +1366,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
/*try to be best-effort in giving real local or routable contact address,
except when the user choosed to override the ipaddress */
if (linphone_core_get_firewall_policy(lc)!=LINPHONE_POLICY_USE_NAT_ADDRESS)
fix_contact(invite,lc->call->localip,dest_proxy);
fix_contact(lc,invite,lc->call->localip,dest_proxy);
barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url);
lc->vtable.display_status(lc,barmsg);
......@@ -1748,7 +1748,7 @@ int linphone_core_accept_call(LinphoneCore *lc, const char *url)
/*try to be best-effort in giving real local or routable contact address,
except when the user choosed to override the ipaddress */
if (linphone_core_get_firewall_policy(lc)!=LINPHONE_POLICY_USE_NAT_ADDRESS)
fix_contact(msg,call->localip,NULL);
fix_contact(lc,msg,call->localip,NULL);
/*if a sdp answer is computed, send it, else send an offer */
sdpmesg=call->sdpctx->answerstr;
if (sdpmesg==NULL){
......
......@@ -76,8 +76,9 @@ static void update_contact(LinphoneProxyConfig *cfg, const char *ip, const char
ms_free(cfg->contact_addr);
}
cfg->contact_addr=ms_strdup(ip);
cfg->contact_port=atoi(port);
if (cfg->contact_port==0) cfg->contact_port=5060;
if (port!=NULL)
cfg->contact_port=atoi(port);
else cfg->contact_port=5060;
}
bool_t linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer){
......
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