From 820eaf86ed98aefbc303132bce2821674b840f3a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 22 Oct 2010 09:56:47 +0200 Subject: [PATCH 1/2] fix linphone_core_get_local_ip_for(): don't use getifaddrs() when a destination address is supplied --- coreapi/misc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/coreapi/misc.c b/coreapi/misc.c index ced4f3396..cc5aa5512 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -754,14 +754,10 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul } int linphone_core_get_local_ip_for(int type, const char *dest, char *result){ - if (dest==NULL) { - if (type==AF_INET) - dest="87.98.157.38"; /*a public IP address*/ - else dest="2a00:1450:8002::68"; - } strcpy(result,type==AF_INET ? "127.0.0.1" : "::1"); #ifdef HAVE_GETIFADDRS - { + if (dest==NULL) { + /*we use getifaddrs for lookup of default interface */ int found_ifs; found_ifs=get_local_ip_with_getifaddrs(type,result,LINPHONE_IPADDR_SIZE); @@ -774,5 +770,8 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){ } #endif /*else use connect to find the best local ip address */ + if (type==AF_INET) + dest="87.98.157.38"; /*a public IP address*/ + else dest="2a00:1450:8002::68"; return get_local_ip_for_with_connect(type,dest,result); } From 50b7001d1d28b2dc88e418cd9c93ad49e35714e0 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 22 Oct 2010 14:44:20 +0200 Subject: [PATCH 2/2] refer improvements --- coreapi/callbacks.c | 7 +++++-- coreapi/linphonecall.c | 1 - coreapi/linphonecore.c | 22 ++++++++-------------- coreapi/private.h | 2 +- coreapi/sal_eXosip2_presence.c | 1 + mediastreamer2 | 2 +- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 9f7cd2658..cc49391d9 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -343,7 +343,6 @@ static void call_updating(SalOp *op){ linphone_call_set_state (call,prevstate,"Connected (streams running)"); } } - if (lc->current_call==NULL) linphone_core_start_pending_refered_calls (lc); } static void call_terminated(SalOp *op, const char *from){ @@ -556,7 +555,11 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ lc->vtable.display_status(lc,msg); ms_free(msg); } - if (lc->current_call==NULL) linphone_core_start_pending_refered_calls (lc); + if (call->state!=LinphoneCallPaused){ + ms_message("Automatically pausing current call to accept transfer."); + linphone_core_pause_call(lc,call); + } + linphone_core_start_refered_call(lc,call); sal_call_accept_refer(op); }else if (lc->vtable.refer_received){ lc->vtable.refer_received(lc,referto); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 1cdc41ffe..4ec373fd7 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -224,7 +224,6 @@ static void linphone_call_set_terminated(LinphoneCall *call){ if (call == lc->current_call){ ms_message("Resetting the current call"); lc->current_call=NULL; - linphone_core_start_pending_refered_calls(lc); } if (linphone_core_del_call(lc,call) != 0){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 9abea19a0..438fdaa26 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1839,19 +1839,14 @@ const char * linphone_core_get_route(LinphoneCore *lc){ return route; } -void linphone_core_start_pending_refered_calls(LinphoneCore *lc){ - MSList *elem; - for(elem=lc->calls;elem!=NULL;elem=elem->next){ - LinphoneCall *call=(LinphoneCall*)elem->data; - if (call->refer_pending){ - LinphoneCallParams *cp=linphone_core_create_default_call_parameters(lc); - cp->referer=call; - ms_message("Starting new call to refered address %s",call->refer_to); - call->refer_pending=FALSE; - linphone_core_invite_with_params(lc,call->refer_to,cp); - linphone_call_params_destroy(cp); - break; - } +void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call){ + if (call->refer_pending){ + LinphoneCallParams *cp=linphone_core_create_default_call_parameters(lc); + cp->referer=call; + ms_message("Starting new call to refered address %s",call->refer_to); + call->refer_pending=FALSE; + linphone_core_invite_with_params(lc,call->refer_to,cp); + linphone_call_params_destroy(cp); } } @@ -2425,7 +2420,6 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call) lc->current_call=NULL; if (call->audiostream || call->videostream) linphone_call_stop_media_streams (call); - linphone_core_start_pending_refered_calls(lc); return 0; } diff --git a/coreapi/private.h b/coreapi/private.h index b41c772dd..029405edd 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -197,7 +197,7 @@ void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float void linphone_core_stop_waiting(LinphoneCore *lc); int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy); -void linphone_core_start_pending_refered_calls(LinphoneCore *lc); +void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call); extern SalCallbacks linphone_sal_callbacks; void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg,LinphoneError error); diff --git a/coreapi/sal_eXosip2_presence.c b/coreapi/sal_eXosip2_presence.c index 1e7409f19..675a45117 100644 --- a/coreapi/sal_eXosip2_presence.c +++ b/coreapi/sal_eXosip2_presence.c @@ -627,6 +627,7 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p ms_message("Failed to send publish request."); return -1; } + sal_add_other(sal_op_get_sal(op),op,pub); return 0; } diff --git a/mediastreamer2 b/mediastreamer2 index bf8706f50..dcf3eba1a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit bf8706f50f26e17b3ecc1501e70b712ec11d0dc3 +Subproject commit dcf3eba1afa5615cb01b52b1136d8aa0d224aca2