diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c index 942143593..35d647f76 100644 --- a/linphone/coreapi/linphonecore.c +++ b/linphone/coreapi/linphonecore.c @@ -1187,9 +1187,6 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) gstate_new_state(lc, GSTATE_CALL_ERROR, NULL); return -1; } - barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url); - lc->vtable.display_status(lc,barmsg); - ms_free(barmsg); if (proxy!=NULL) { from=linphone_proxy_config_get_identity(proxy); @@ -1211,6 +1208,9 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) osip_from_parse(parsed_url2,from); lc->call=linphone_call_new_outgoing(lc,parsed_url2,real_parsed_url); + barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url); + lc->vtable.display_status(lc,barmsg); + ms_free(barmsg); if (!lc->sip_conf.sdp_200_ack){ ctx=lc->call->sdpctx; lc->call->profile=lc->local_profile; diff --git a/linphone/coreapi/misc.c b/linphone/coreapi/misc.c index b08d67960..0c7a570b7 100644 --- a/linphone/coreapi/misc.c +++ b/linphone/coreapi/misc.c @@ -538,8 +538,8 @@ static int recvStunResponse(ortp_socket_t sock, char *ipaddr, int *port){ if (len>0){ struct in_addr ia; stunParseMessage(buf,len, &resp,FALSE ); - *port = resp.changedAddress.ipv4.port; - ia.s_addr=htonl(resp.changedAddress.ipv4.addr); + *port = resp.mappedAddress.ipv4.port; + ia.s_addr=htonl(resp.mappedAddress.ipv4.addr); strncpy(ipaddr,inet_ntoa(ia),LINPHONE_IPADDR_SIZE); } return len; @@ -560,6 +560,7 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ bool_t got_audio,got_video; struct timeval init,cur; if (parse_stun_server_addr(server,&ss,&ss_len)<0){ + ms_error("Fail to parser stun server address: %s",server); return; } if (lc->vtable.display_status!=NULL) @@ -599,12 +600,18 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ ms_message("STUN test result: local video port maps to %s:%i", call->video_params.natd_addr, call->video_params.natd_port); - got_video=TRUE; + got_video=TRUE; } gettimeofday(&cur,NULL); elapsed=((cur.tv_sec-init.tv_sec)*1000.0) + ((cur.tv_usec-init.tv_usec)/1000.0); if (elapsed>2000) break; }while(!(got_audio && (got_video||sock2<0) ) ); + if (!got_audio){ + ms_error("No stun server response for audio port."); + } + if (!got_video && sock2>=0){ + ms_error("No stun server response for video port."); + } close_socket(sock1); if (sock2>=0) close_socket(sock2); }