Commit 0242451d authored by jehan's avatar jehan
Browse files

Merge remote-tracking branch 'public/master' into belle-sip

Conflicts:
	coreapi/linphonecore.c
	coreapi/proxy.c
	mediastreamer2
parents b7c0c351 e546e97a
......@@ -824,6 +824,7 @@ printf "* %-30s %s\n" "Account assistant" $build_wizard
printf "* %-30s %s\n" "Console interface" $console_ui
printf "* %-30s %s\n" "Tools" $build_tools
printf "* %-30s %s\n" "zRTP encryption (GPLv3)" $zrtp
printf "* %-30s %s\n" "uPnP support" $build_upnp
if test "$enable_tunnel" = "true" ; then
printf "* Tunnel support\t\t\ttrue\n"
......
......@@ -1100,7 +1100,7 @@ void linphone_call_params_add_custom_header(LinphoneCallParams *params, const ch
params->custom_headers=sal_custom_header_append(params->custom_headers,header_name,header_value);
}
const char *linphone_call_params_get_custom_header(LinphoneCallParams *params, const char *header_name){
const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name){
return sal_custom_header_find(params->custom_headers,header_name);
}
......
......@@ -1307,9 +1307,6 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
lc->tunnel=linphone_core_tunnel_new(lc);
if (lc->tunnel) linphone_tunnel_configure(lc->tunnel);
#endif
#ifdef BUILD_UPNP
lc->upnp = linphone_upnp_context_new(lc);
#endif //BUILD_UPNP
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Ready"));
lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon;
......@@ -4265,6 +4262,17 @@ void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy
ms_warning("UPNP is not available, reset firewall policy to no firewall");
pol = LinphonePolicyNoFirewall;
}
#else //BUILD_UPNP
if(pol == LinphonePolicyUseUpnp) {
if(lc->upnp == NULL) {
lc->upnp = linphone_upnp_context_new(lc);
}
} else {
if(lc->upnp != NULL) {
linphone_upnp_context_destroy(lc->upnp);
lc->upnp = NULL;
}
}
#endif //BUILD_UPNP
lc->net_conf.firewall_policy=pol;
if (lc->sip_conf.contact) update_primary_contact(lc);
......@@ -5259,9 +5267,11 @@ static void linphone_core_uninit(LinphoneCore *lc)
sip_setup_unregister_all();
#ifdef BUILD_UPNP
if (lc->upnp) linphone_upnp_context_destroy(lc->upnp);
lc->upnp = NULL;
#endif //BUILD_UPNP
if(lc->upnp != NULL) {
linphone_upnp_context_destroy(lc->upnp);
lc->upnp = NULL;
}
#endif //BUILD_UPNP
if (lp_config_needs_commit(lc->config)) lp_config_sync(lc->config);
lp_config_destroy(lc->config);
......@@ -5272,6 +5282,17 @@ static void linphone_core_uninit(LinphoneCore *lc)
ms_list_for_each(lc->last_recv_msg_ids,ms_free);
lc->last_recv_msg_ids=ms_list_free(lc->last_recv_msg_ids);
// Free struct variable
if(lc->zrtp_secrets_cache != NULL) {
ms_free(lc->zrtp_secrets_cache);
}
if(lc->play_file!=NULL){
ms_free(lc->play_file);
}
if(lc->rec_file!=NULL){
ms_free(lc->rec_file);
}
linphone_core_free_payload_types(lc);
ortp_exit();
......@@ -5574,7 +5595,7 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook
for(elem=lc->hooks;elem!=NULL;elem=elem->next){
Hook *h=(Hook*)elem->data;
if (h->fun==hook && h->data==hook_data){
ms_list_remove_link(lc->hooks,elem);
lc->hooks = ms_list_remove_link(lc->hooks,elem);
ms_free(h);
return;
}
......
......@@ -37,14 +37,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern "C" {
#endif
struct _MSSndCard;
struct _LinphoneCore;
/**
* Linphone core main object created by function linphone_core_new() .
* @ingroup initializing
*/
typedef struct _LinphoneCore LinphoneCore;
struct SalOp;
struct _LpConfig;
......@@ -201,7 +199,7 @@ void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t en
void linphone_call_params_set_record_file(LinphoneCallParams *cp, const char *path);
const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp);
void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value);
const char *linphone_call_params_get_custom_header(LinphoneCallParams *params, const char *header_name);
const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name);
/**
* Enum describing failure reasons.
* @ingroup initializing
......
......@@ -263,15 +263,30 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){
if (proxy==NULL) return NULL;
host=linphone_address_get_domain (proxy);
if (host!=NULL){
char localip[LINPHONE_IPADDR_SIZE];
int localport = -1;
char localip_tmp[LINPHONE_IPADDR_SIZE] = {'\0'};
const char *localip = NULL;
char *tmp;
LCSipTransports tr;
LinphoneAddress *contact;
linphone_core_get_local_ip(obj->lc,host,localip);
contact=linphone_address_new(obj->reg_identity);
linphone_address_set_domain (contact,localip);
linphone_address_set_port_int(contact,linphone_core_get_sip_port(obj->lc));
#ifdef BUILD_UPNP
if (obj->lc->upnp != NULL && linphone_core_get_firewall_policy(obj->lc)==LinphonePolicyUseUpnp &&
linphone_upnp_context_get_state(obj->lc->upnp) == LinphoneUpnpStateOk) {
localip = linphone_upnp_context_get_external_ipaddress(obj->lc->upnp);
localport = linphone_upnp_context_get_external_port(obj->lc->upnp);
}
#endif //BUILD_UPNP
if(localip == NULL) {
localip = localip_tmp;
linphone_core_get_local_ip(obj->lc,host,localip_tmp);
}
if(localport == -1) {
localport = linphone_core_get_sip_port(obj->lc);
}
linphone_address_set_port_int(contact,localport);
linphone_address_set_domain(contact,localip);
linphone_address_set_display_name(contact,NULL);
linphone_core_get_sip_transports(obj->lc,&tr);
......@@ -1086,11 +1101,19 @@ void linphone_proxy_config_update(LinphoneProxyConfig *cfg){
if (cfg->type && cfg->ssctx==NULL){
linphone_proxy_config_activate_sip_setup(cfg);
}
if ((!lc->sip_conf.register_only_when_network_is_up || lc->network_reachable) &&
(linphone_core_get_firewall_policy(lc)!=LinphonePolicyUseUpnp
|| !lc->sip_conf.register_only_when_upnp_is_ok
|| linphone_core_get_upnp_state(lc) == LinphoneUpnpStateOk))
linphone_proxy_config_register(cfg);
switch(linphone_core_get_firewall_policy(lc)) {
case LinphonePolicyUseUpnp:
#ifdef BUILD_UPNP
if(!lc->sip_conf.register_only_when_upnp_is_ok ||
(lc->upnp != NULL && !linphone_upnp_context_is_ready_for_register(lc->upnp))) {
break;
}
#endif //BUILD_UPNP
default:
if ((!lc->sip_conf.register_only_when_network_is_up || lc->network_reachable)) {
linphone_proxy_config_register(cfg);
}
}
if (cfg->publish && cfg->publish_op==NULL){
linphone_proxy_config_send_publish(cfg,lc->presence_mode);
}
......
This diff is collapsed.
......@@ -40,6 +40,8 @@ UpnpContext *linphone_upnp_context_new(LinphoneCore *lc);
void linphone_upnp_context_destroy(UpnpContext *ctx);
LinphoneUpnpState linphone_upnp_context_get_state(UpnpContext *ctx);
const char *linphone_upnp_context_get_external_ipaddress(UpnpContext *ctx);
int linphone_upnp_context_get_external_port(UpnpContext *ctx);
bool_t linphone_upnp_context_is_ready_for_register(UpnpContext *ctx);
void linphone_core_update_upnp_state_in_call_stats(LinphoneCall *call);
#endif //LINPHONE_UPNP_H
......@@ -1083,6 +1083,10 @@ void linphone_gtk_show_parameters(void){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"use_upnp")),TRUE);
break;
}
if(!linphone_core_upnp_available(lc)) {
gtk_widget_hide(linphone_gtk_get_widget(pb,"use_upnp"));
}
mtu=linphone_core_get_mtu(lc);
if (mtu<=0){
gtk_widget_set_sensitive(linphone_gtk_get_widget(pb,"mtu"),FALSE);
......
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