From 01c990cb10406b35728bf33eb0753d3ea2ab9907 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 30 Oct 2012 13:48:06 +0100 Subject: [PATCH 01/52] Remove function static variables --- coreapi/linphonecore.c | 15 ++++++++------- coreapi/private.h | 3 +++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 503a71c03..b25523df1 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1192,6 +1192,9 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta sal_set_user_pointer(lc->sal,lc); sal_set_callbacks(lc->sal,&linphone_sal_callbacks); + lc->network_last_check = 0; + lc->network_last_status = FALSE; + sip_setup_register_all(); sound_config_read(lc); net_config_read(lc); @@ -1803,24 +1806,22 @@ void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val){ static void monitor_network_state(LinphoneCore *lc, time_t curtime){ - static time_t last_check=0; - static bool_t last_status=FALSE; char result[LINPHONE_IPADDR_SIZE]; - bool_t new_status=last_status; + bool_t new_status=lc->network_last_status; /* only do the network up checking every five seconds */ - if (last_check==0 || (curtime-last_check)>=5){ + if (lc->network_last_check==0 || (curtime-lc->network_last_check)>=5){ linphone_core_get_local_ip_for(lc->sip_conf.ipv6_enabled ? AF_INET6 : AF_INET,NULL,result); if (strcmp(result,"::1")!=0 && strcmp(result,"127.0.0.1")!=0){ new_status=TRUE; }else new_status=FALSE; - last_check=curtime; - if (new_status!=last_status) { + lc->network_last_check=curtime; + if (new_status!=lc->network_last_status) { if (new_status){ ms_message("New local ip address is %s",result); } set_network_reachable(lc,new_status, curtime); - last_status=new_status; + lc->network_last_status=new_status; } } } diff --git a/coreapi/private.h b/coreapi/private.h index 07fd1c689..e9165a501 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -556,6 +556,9 @@ struct _LinphoneCore bool_t network_reachable; bool_t use_preview_window; + time_t network_last_check; + bool_t network_last_status; + bool_t ringstream_autorelease; bool_t pad[3]; int device_rotation; From 31848a31cc9f6ab17a7b6b59bb3b216626973cc8 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 30 Oct 2012 21:47:12 +0100 Subject: [PATCH 02/52] Fix typo in warning message. --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b25523df1..cc636a42a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4051,7 +4051,7 @@ int linphone_core_set_video_device(LinphoneCore *lc, const char *id){ if (id!=NULL){ lc->video_conf.device=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),id); if (lc->video_conf.device==NULL){ - ms_warning("Could not found video device %s",id); + ms_warning("Could not find video device %s",id); } } if (lc->video_conf.device==NULL) From e54f0596b8b17d0ff5b725e5ebb70b5e61f7f101 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 31 Oct 2012 10:52:43 +0100 Subject: [PATCH 03/52] Add in call timeout --- coreapi/linphonecore.c | 32 +++++++++++++++++++++++++++++++- coreapi/linphonecore.h | 4 ++++ coreapi/linphonecore_jni.cc | 4 ++++ coreapi/private.h | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b25523df1..353eaa1b6 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -591,6 +591,9 @@ static void sip_config_read(LinphoneCore *lc) tmp=lp_config_get_int(lc->config,"sip","inc_timeout",30); linphone_core_set_inc_timeout(lc,tmp); + tmp=lp_config_get_int(lc->config,"sip","in_call_timeout",0); + linphone_core_set_in_call_timeout(lc,tmp); + /* get proxies config */ for(i=0;; i++){ LinphoneProxyConfig *cfg=linphone_proxy_config_new_from_config_file(lc->config,i); @@ -1979,6 +1982,7 @@ void linphone_core_iterate(LinphoneCore *lc){ calls= lc->calls; while(calls!= NULL){ call = (LinphoneCall *)calls->data; + elapsed = curtime-call->start_time; /* get immediately a reference to next one in case the one we are going to examine is destroy and removed during linphone_core_start_invite() */ @@ -1995,7 +1999,6 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_core_start_invite(lc,call); } if (call->state==LinphoneCallIncomingReceived){ - elapsed=curtime-call->start_time; ms_message("incoming call ringing for %i seconds",elapsed); if (elapsed>lc->sip_conf.inc_timeout){ ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout); @@ -2004,6 +2007,12 @@ void linphone_core_iterate(LinphoneCore *lc){ linphone_core_terminate_call(lc,call); } } + if (lc->sip_conf.in_call_timeout > 0 && elapsed>lc->sip_conf.in_call_timeout) { + ms_message("in call timeout (%i)",lc->sip_conf.in_call_timeout); + call->log->status=LinphoneCallMissed; + call->reason=LinphoneReasonNotAnswered; + linphone_core_terminate_call(lc,call); + } } if (linphone_core_video_preview_enabled(lc)){ @@ -3208,6 +3217,26 @@ int linphone_core_get_inc_timeout(LinphoneCore *lc){ return lc->sip_conf.inc_timeout; } +/** + * Set the in call timeout in seconds. + * + * @ingroup call_control + * After this timeout period, the call is automatically hangup. +**/ +void linphone_core_set_in_call_timeout(LinphoneCore *lc, int seconds){ + lc->sip_conf.in_call_timeout=seconds; +} + +/** + * Returns the in call timeout + * + * @ingroup call_control + * See linphone_core_set_in_call_timeout() for details. +**/ +int linphone_core_get_in_call_timeout(LinphoneCore *lc){ + return lc->sip_conf.in_call_timeout; +} + void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away, const char *contact, LinphoneOnlineStatus presence_mode) @@ -4604,6 +4633,7 @@ void sip_config_uninit(LinphoneCore *lc) lp_config_set_int(lc->config,"sip","guess_hostname",config->guess_hostname); lp_config_set_string(lc->config,"sip","contact",config->contact); lp_config_set_int(lc->config,"sip","inc_timeout",config->inc_timeout); + lp_config_set_int(lc->config,"sip","in_call_timeout",config->in_call_timeout); lp_config_set_int(lc->config,"sip","use_info",config->use_info); lp_config_set_int(lc->config,"sip","use_rfc2833",config->use_rfc2833); lp_config_set_int(lc->config,"sip","use_ipv6",config->ipv6_enabled); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d0ecc11a3..99ae480fc 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1164,6 +1164,10 @@ void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds); int linphone_core_get_inc_timeout(LinphoneCore *lc); +void linphone_core_set_in_call_timeout(LinphoneCore *lc, int seconds); + +int linphone_core_get_in_call_timeout(LinphoneCore *lc); + void linphone_core_set_stun_server(LinphoneCore *lc, const char *server); const char * linphone_core_get_stun_server(const LinphoneCore *lc); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 5ebf57892..85bd10259 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2137,6 +2137,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setIncomingTimeout(JNIEn linphone_core_set_inc_timeout((LinphoneCore *)lc, timeout); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setInCallTimeout(JNIEnv *env, jobject thiz, jlong lc, jint timeout) { + linphone_core_set_in_call_timeout((LinphoneCore *)lc, timeout); +} + extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* env,jobject thiz,jlong ptr) { jstring jvalue =env->NewStringUTF(linphone_core_get_version()); return jvalue; diff --git a/coreapi/private.h b/coreapi/private.h index e9165a501..e6ed960bc 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -382,6 +382,7 @@ typedef struct sip_config MSList *proxies; MSList *deleted_proxies; int inc_timeout; /*timeout after an un-answered incoming call is rejected*/ + int in_call_timeout; /*timeout after a call is hangup */ unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/ LCSipTransports transports; bool_t use_info; From b8dd0174013ef5327bbac5d9f230d23a7d0c23d3 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 31 Oct 2012 11:19:39 +0100 Subject: [PATCH 04/52] Wrong call state on in call timeout --- coreapi/linphonecore.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 570482596..6330e1642 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2009,8 +2009,6 @@ void linphone_core_iterate(LinphoneCore *lc){ } if (lc->sip_conf.in_call_timeout > 0 && elapsed>lc->sip_conf.in_call_timeout) { ms_message("in call timeout (%i)",lc->sip_conf.in_call_timeout); - call->log->status=LinphoneCallMissed; - call->reason=LinphoneReasonNotAnswered; linphone_core_terminate_call(lc,call); } } From 1c1de407a7a4d5b67f3ae788e7a15b905e164f40 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 31 Oct 2012 11:13:02 +0100 Subject: [PATCH 05/52] Small fixes for BB. --- java/common/org/linphone/core/LinphoneCallLog.java | 2 +- java/common/org/linphone/core/LinphoneChatMessage.java | 4 +--- java/common/org/linphone/core/LinphoneCore.java | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/java/common/org/linphone/core/LinphoneCallLog.java b/java/common/org/linphone/core/LinphoneCallLog.java index 1abdb7bed..8d0e4073a 100644 --- a/java/common/org/linphone/core/LinphoneCallLog.java +++ b/java/common/org/linphone/core/LinphoneCallLog.java @@ -38,7 +38,7 @@ public interface LinphoneCallLog { /** * Call success. */ - public final static CallStatus Sucess = new CallStatus(0,"Sucess"); + public final static CallStatus Success = new CallStatus(0,"Sucess"); /** * Call aborted. */ diff --git a/java/common/org/linphone/core/LinphoneChatMessage.java b/java/common/org/linphone/core/LinphoneChatMessage.java index db75f9116..74f0961ac 100644 --- a/java/common/org/linphone/core/LinphoneChatMessage.java +++ b/java/common/org/linphone/core/LinphoneChatMessage.java @@ -7,8 +7,7 @@ public interface LinphoneChatMessage { interface StateListener{ void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state); } - static class State { - @SuppressWarnings("rawtypes") + public static class State { static private Vector values = new Vector(); private final int mValue; public final int value() {return mValue;} @@ -31,7 +30,6 @@ public interface LinphoneChatMessage { */ public final static State NotDelivered = new State(3,"NotDelivered"); - @SuppressWarnings("unchecked") private State(int value,String stringValue) { mValue = value; values.addElement(this); diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 562ae86cd..5916316b8 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -189,21 +189,21 @@ public interface LinphoneCore { * Media (RTP) encryption enum-like. * */ - static public class MediaEncryption { + static public final class MediaEncryption { static private Vector values = new Vector(); /** * None */ - static public MediaEncryption None = new MediaEncryption(0,"None"); + static public final MediaEncryption None = new MediaEncryption(0,"None"); /** * SRTP */ - static public MediaEncryption SRTP = new MediaEncryption(1,"SRTP"); + static public final MediaEncryption SRTP = new MediaEncryption(1,"SRTP"); /** * ZRTP */ - static public MediaEncryption ZRTP = new MediaEncryption(2,"ZRTP"); + static public final MediaEncryption ZRTP = new MediaEncryption(2,"ZRTP"); protected final int mValue; private final String mStringValue; From 0d18c3124db2e9b224f83c2faf98d78914e31030 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 2 Nov 2012 17:13:30 +0100 Subject: [PATCH 06/52] Fix Android compilation. --- coreapi/linphonecore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6330e1642..d980e818e 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -40,9 +40,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef HAVE_CONFIG_H #include "config.h" +#include "liblinphone_gitversion.h" +#else +#ifndef LIBLINPHONE_GIT_VERSION +#define LIBLINPHONE_GIT_VERSION "unknown" +#endif #endif -#include "liblinphone_gitversion.h" /*#define UNSTANDART_GSM_11K 1*/ From 5dd560b730e4393925a0179055c15825b7b74f5a Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 5 Nov 2012 15:29:05 +0100 Subject: [PATCH 07/52] Added java interface + implem for incall timeout --- java/common/org/linphone/core/LinphoneCore.java | 6 ++++++ java/impl/org/linphone/core/LinphoneCoreImpl.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 5916316b8..49b15c369 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -843,4 +843,10 @@ public interface LinphoneCore { * automatically declined. **/ void setIncomingTimeout(int timeout); + + /** + * Set the call timeout in seconds. + * Once this time is elapsed (ringing included), the call is automatically hung up. + **/ + void setInCallTimeout(int timeout); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 6059915ea..072934204 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -115,6 +115,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setAudioPortRange(long nativePtr, int minPort, int maxPort); private native void setVideoPortRange(long nativePtr, int minPort, int maxPort); private native void setIncomingTimeout(long nativePtr, int timeout); + private native void setInCallTimeout(long nativePtr, int timeout); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -782,4 +783,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void setIncomingTimeout(int timeout) { setIncomingTimeout(nativePtr, timeout); } + + public void setInCallTimeout(int timeout) + { + setInCallTimeout(nativePtr, timeout); + } } From 8bccb20574b2d070e58ef83b59c837beda492b67 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 5 Nov 2012 17:48:49 +0100 Subject: [PATCH 08/52] fix storage of inc timeout --- coreapi/linphonecore.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index c07380502..c39dfcbd9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3186,6 +3186,9 @@ int linphone_core_send_publish(LinphoneCore *lc, **/ void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds){ lc->sip_conf.inc_timeout=seconds; + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"sip","inc_timeout",seconds); + } } /** From 00bd86e388f1fd6d7c5095a9b88324207703f57f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 6 Nov 2012 05:32:43 +0100 Subject: [PATCH 09/52] implement checking of duplicated messages. --- coreapi/callbacks.c | 30 ++++++++++++++++++++++++------ coreapi/linphonecore.c | 3 +++ coreapi/private.h | 1 + coreapi/sal.h | 11 ++++++++--- coreapi/sal_eXosip2.c | 30 ++++++++++++++++++------------ 5 files changed, 54 insertions(+), 21 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index a4a4232c4..f99c9b224 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -779,14 +779,33 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ } } -static void text_received(Sal *sal, const char *from, const char *msg){ - LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal); - linphone_core_message_received(lc,from,msg,NULL); +static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){ + MSList *elem=lc->last_recv_msg_ids; + int i; + bool_t is_duplicate=FALSE; + for(i=0;elem!=NULL;elem=elem->next,i++){ + if (strcmp((const char*)elem->data,msg_id)==0){ + is_duplicate=TRUE; + } + } + if (!is_duplicate){ + lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id)); + } + if (i>=10){ + ms_free(elem->data); + ms_list_remove_link(lc->last_recv_msg_ids,elem); + } + return is_duplicate; } -void message_external_body_received(Sal *sal, const char *from, const char *url) { + + +static void text_received(Sal *sal, const SalMessage *msg){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal); - linphone_core_message_received(lc,from,NULL,url); + if (is_duplicate_msg(lc,msg->message_id)==FALSE){ + linphone_core_message_received(lc,msg->from,msg->text,msg->url); + } } + static void notify(SalOp *op, const char *from, const char *msg){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op)); LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer (op); @@ -902,7 +921,6 @@ SalCallbacks linphone_sal_callbacks={ dtmf_received, refer_received, text_received, - message_external_body_received, text_delivery_update, notify, notify_presence, diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d980e818e..8de92f23b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4823,6 +4823,9 @@ static void linphone_core_uninit(LinphoneCore *lc) ms_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_destroy); lc->call_logs=ms_list_free(lc->call_logs); + + ms_list_for_each(lc->last_recv_msg_ids,ms_free); + lc->last_recv_msg_ids=ms_list_free(lc->last_recv_msg_ids); linphone_core_free_payload_types(lc); ortp_exit(); diff --git a/coreapi/private.h b/coreapi/private.h index e6ed960bc..12909190f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -566,6 +566,7 @@ struct _LinphoneCore int max_calls; LinphoneTunnel *tunnel; char* device_id; + MSList *last_recv_msg_ids; }; LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc); diff --git a/coreapi/sal.h b/coreapi/sal.h index 54a075ed6..e5eb1c190 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -188,6 +188,13 @@ typedef struct SalMediaDescription{ bool_t ice_completed; } SalMediaDescription; +typedef struct SalMessage{ + const char *from; + const char *text; + const char *url; + const char *message_id; +}SalMessage; + #define SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES 5 SalMediaDescription *sal_media_description_new(); @@ -280,8 +287,7 @@ typedef void (*SalOnRegisterFailure)(SalOp *op, SalError error, SalReason reason typedef void (*SalOnVfuRequest)(SalOp *op); typedef void (*SalOnDtmfReceived)(SalOp *op, char dtmf); typedef void (*SalOnRefer)(Sal *sal, SalOp *op, const char *referto); -typedef void (*SalOnTextReceived)(Sal *sal, const char *from, const char *msg); -typedef void (*SalOnMessageExternalBodyReceived)(Sal *sal, const char *from, const char *url); +typedef void (*SalOnTextReceived)(Sal *sal, const SalMessage *msg); typedef void (*SalOnTextDeliveryUpdate)(SalOp *op, SalTextDeliveryStatus status); typedef void (*SalOnNotify)(SalOp *op, const char *from, const char *event); typedef void (*SalOnNotifyRefer)(SalOp *op, SalReferStatus state); @@ -307,7 +313,6 @@ typedef struct SalCallbacks{ SalOnDtmfReceived dtmf_received; SalOnRefer refer_received; SalOnTextReceived text_received; - SalOnMessageExternalBodyReceived message_external_body; SalOnTextDeliveryUpdate text_delivery_update; SalOnNotify notify; SalOnNotifyPresence notify_presence; diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index b83cc4f24..2f6d4ae80 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -343,8 +343,6 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs){ ctx->callbacks.text_received=(SalOnTextReceived)unimplemented_stub; if (ctx->callbacks.ping_reply==NULL) ctx->callbacks.ping_reply=(SalOnPingReply)unimplemented_stub; - if (ctx->callbacks.message_external_body==NULL) - ctx->callbacks.message_external_body=(SalOnMessageExternalBodyReceived)unimplemented_stub; } int sal_unlisten_ports(Sal *ctx){ @@ -1728,11 +1726,13 @@ static bool_t comes_from_local_if(osip_message_t *msg){ static void text_received(Sal *sal, eXosip_event_t *ev){ osip_body_t *body=NULL; - char *from=NULL,*msg; + char *from=NULL,*msg=NULL; osip_content_type_t* content_type; osip_uri_param_t* external_body_url; char unquoted_external_body_url [256]; int external_body_size=0; + SalMessage salmsg; + char message_id[256]={0}; content_type= osip_message_get_content_type(ev->request); if (!content_type) { @@ -1744,13 +1744,12 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ && strcmp(content_type->type, "text")==0 && content_type->subtype && strcmp(content_type->subtype, "plain")==0 ) { - osip_message_get_body(ev->request,0,&body); - if (body==NULL){ - ms_error("Could not get text message from SIP body"); - return; - } - msg=body->body; - sal->callbacks.text_received(sal,from,msg); + osip_message_get_body(ev->request,0,&body); + if (body==NULL){ + ms_error("Could not get text message from SIP body"); + return; + } + msg=body->body; } if (content_type->type && strcmp(content_type->type, "message")==0 && content_type->subtype @@ -1762,11 +1761,18 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ ,&external_body_url->gvalue[1] ,external_body_size=MIN(strlen(external_body_url->gvalue)-1,sizeof(unquoted_external_body_url))); unquoted_external_body_url[external_body_size-1]='\0'; - sal->callbacks.message_external_body(sal,from,unquoted_external_body_url); - } else { ms_warning("Unsupported content type [%s/%s]",content_type->type,content_type->subtype); + osip_free(from); + return; } + snprintf(message_id,sizeof(message_id)-1,"%s%s",ev->request->call_id->number,ev->request->cseq->number); + + salmsg.from=from; + salmsg.text=msg; + salmsg.url=external_body_size>0 ? unquoted_external_body_url : NULL; + salmsg.message_id=message_id; + sal->callbacks.text_received(sal,&salmsg); osip_free(from); } From 871acb0039a7c7a3d7849e83134ae37a1861d856 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 6 Nov 2012 10:52:46 +0100 Subject: [PATCH 10/52] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 832672303..f743c8b4a 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 83267230336a64dc4a005b29bf8baccf6a5fd2c2 +Subproject commit f743c8b4ab7ec010a96aa53f2e179cea69bfb4e6 From b986d67c4f795fae27965383b6ff31d9f5b41815 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 6 Nov 2012 14:44:16 +0100 Subject: [PATCH 11/52] Add mic gain db getter/setter Save playback/mic at config uninit --- coreapi/linphonecall.c | 8 ++++---- coreapi/linphonecore.c | 40 ++++++++++++++++++++++++++++++++++++---- coreapi/linphonecore.h | 4 +++- coreapi/private.h | 1 + 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 70395841a..6f8c06ef2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "private.h" #include #include - +#include #include "mediastreamer2/mediastream.h" #include "mediastreamer2/msvolume.h" @@ -1189,7 +1189,7 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){ } void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted){ - float mic_gain=lp_config_get_float(lc->config,"sound","mic_gain",1); + float mic_gain=lc->sound_conf.soft_mic_lev; float thres = 0; float recv_gain; float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05); @@ -1197,7 +1197,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0); if (!muted) - audio_stream_set_mic_gain(st,mic_gain); + linphone_core_set_mic_gain_db (lc, mic_gain); else audio_stream_set_mic_gain(st,0); @@ -1231,7 +1231,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute } if (st->volrecv){ /* parameters for a limited noise-gate effect, using echo limiter threshold */ - float floorgain = 1/mic_gain; + float floorgain = 1/pow(10,(mic_gain)/10); int spk_agc=lp_config_get_int(lc->config,"sound","speaker_agc_enabled",0); ms_filter_call_method(st->volrecv, MS_VOLUME_ENABLE_AGC, &spk_agc); ms_filter_call_method(st->volrecv,MS_VOLUME_SET_NOISE_GATE_THRESHOLD,&ng_thres); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 8de92f23b..1af9b08ca 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "lpconfig.h" #include "private.h" +#include #include #include #include "mediastreamer2/mediastream.h" @@ -425,7 +426,6 @@ static void sound_config_read(LinphoneCore *lc) int tmp; const char *tmpbuf; const char *devid; - float gain=0; #ifdef __linux /*alsadev let the user use custom alsa device within linphone*/ devid=lp_config_get_string(lc->config,"sound","alsadev",NULL); @@ -497,8 +497,8 @@ static void sound_config_read(LinphoneCore *lc) linphone_core_enable_agc(lc, lp_config_get_int(lc->config,"sound","agc",0)); - gain=lp_config_get_float(lc->config,"sound","playback_gain_db",0); - linphone_core_set_playback_gain_db (lc,gain); + linphone_core_set_playback_gain_db (lc,lp_config_get_float(lc->config,"sound","playback_gain_db",0)); + linphone_core_set_mic_gain_db (lc,lp_config_get_float(lc->config,"sound","mic_gain_db",0)); linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL)); @@ -3307,6 +3307,36 @@ void linphone_core_set_ring_level(LinphoneCore *lc, int level){ if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level); } +/** + * Allow to control microphone level: gain in db + * + * @ingroup media_parameters +**/ +void linphone_core_set_mic_gain_db (LinphoneCore *lc, float gaindb){ + float gain=gaindb; + LinphoneCall *call=linphone_core_get_current_call (lc); + AudioStream *st; + + lc->sound_conf.soft_mic_lev=gaindb; + + if (call==NULL || (st=call->audiostream)==NULL){ + ms_message("linphone_core_set_mic_gain_db(): no active call."); + return; + } + if (st->volrecv){ + ms_filter_call_method(st->volsend,MS_VOLUME_SET_DB_GAIN,&gain); + }else ms_warning("Could not apply gain: gain control wasn't activated."); +} + +/** + * Get microphone gain in db. + * + * @ingroup media_parameters +**/ +float linphone_core_get_mic_gain_db(LinphoneCore *lc) { + return lc->sound_conf.soft_mic_lev; +} + /** * Allow to control play level before entering sound card: gain in db * @@ -3718,7 +3748,7 @@ void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){ } if (st!=NULL){ audio_stream_set_mic_gain(st, - (val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1)); + (val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10)); if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){ audio_stream_mute_rtp(st,val); } @@ -4704,6 +4734,8 @@ static void sound_config_uninit(LinphoneCore *lc) ms_free(config->cards); lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring); + lp_config_set_float(lc->config,"sound","playback_gain_db",config->soft_play_lev); + lp_config_set_float(lc->config,"sound","mic_gain_db",config->soft_mic_lev); if (config->local_ring) ms_free(config->local_ring); if (config->remote_ring) ms_free(config->remote_ring); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 99ae480fc..306f6b70b 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1196,9 +1196,11 @@ int linphone_core_get_rec_level(LinphoneCore *lc); void linphone_core_set_ring_level(LinphoneCore *lc, int level); void linphone_core_set_play_level(LinphoneCore *lc, int level); +void linphone_core_set_mic_gain_db(LinphoneCore *lc, float level); +float linphone_core_get_mic_gain_db(LinphoneCore *lc); void linphone_core_set_playback_gain_db(LinphoneCore *lc, float level); - float linphone_core_get_playback_gain_db(LinphoneCore *lc); + void linphone_core_set_rec_level(LinphoneCore *lc, int level); const char * linphone_core_get_ringer_device(LinphoneCore *lc); const char * linphone_core_get_playback_device(LinphoneCore *lc); diff --git a/coreapi/private.h b/coreapi/private.h index 12909190f..60587dbcd 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -437,6 +437,7 @@ typedef struct sound_config const char **cards; int latency; /* latency in samples of the current used sound device */ float soft_play_lev; /*playback gain in db.*/ + float soft_mic_lev; /*mic gain in db.*/ char rec_lev; char play_lev; char ring_lev; From 313505bcaea68c9468d89007e933b29dac226284 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 6 Nov 2012 15:09:47 +0100 Subject: [PATCH 12/52] Save in config the values when set playback/mic gains --- coreapi/linphonecore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1af9b08ca..0f5f7a7db 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3319,6 +3319,10 @@ void linphone_core_set_mic_gain_db (LinphoneCore *lc, float gaindb){ lc->sound_conf.soft_mic_lev=gaindb; + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"sound","mic_gain_db",lc->sound_conf.soft_mic_lev); + } + if (call==NULL || (st=call->audiostream)==NULL){ ms_message("linphone_core_set_mic_gain_db(): no active call."); return; @@ -3348,6 +3352,9 @@ void linphone_core_set_playback_gain_db (LinphoneCore *lc, float gaindb){ AudioStream *st; lc->sound_conf.soft_play_lev=gaindb; + if (linphone_core_ready(lc)){ + lp_config_set_int(lc->config,"sound","playback_gain_db",lc->sound_conf.soft_play_lev); + } if (call==NULL || (st=call->audiostream)==NULL){ ms_message("linphone_core_set_playback_gain_db(): no active call."); From 42b4cb544661f129d2959ca9faf492b9b90cf197 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Tue, 6 Nov 2012 15:15:41 +0100 Subject: [PATCH 13/52] Fix previous commit --- coreapi/linphonecore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0f5f7a7db..9200aadf8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3320,7 +3320,7 @@ void linphone_core_set_mic_gain_db (LinphoneCore *lc, float gaindb){ lc->sound_conf.soft_mic_lev=gaindb; if (linphone_core_ready(lc)){ - lp_config_set_int(lc->config,"sound","mic_gain_db",lc->sound_conf.soft_mic_lev); + lp_config_set_float(lc->config,"sound","mic_gain_db",lc->sound_conf.soft_mic_lev); } if (call==NULL || (st=call->audiostream)==NULL){ @@ -3353,7 +3353,7 @@ void linphone_core_set_playback_gain_db (LinphoneCore *lc, float gaindb){ lc->sound_conf.soft_play_lev=gaindb; if (linphone_core_ready(lc)){ - lp_config_set_int(lc->config,"sound","playback_gain_db",lc->sound_conf.soft_play_lev); + lp_config_set_float(lc->config,"sound","playback_gain_db",lc->sound_conf.soft_play_lev); } if (call==NULL || (st=call->audiostream)==NULL){ From 7b502e170b23b4dcbdb170554a15de92ac188ff3 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 7 Nov 2012 10:13:48 +0100 Subject: [PATCH 14/52] Fix findPayloadType() without channels parameter. --- java/impl/org/linphone/core/LinphoneCoreImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 072934204..138dc41f3 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -745,7 +745,7 @@ class LinphoneCoreImpl implements LinphoneCore { @Override public PayloadType findPayloadType(String mime, int clockRate) { - return null; + return findPayloadType(mime, clockRate, 1); } private native void removeFriend(long ptr, long lf); From 10f0be4a29ca9f568b6a1da994cd3caa1ed83e21 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 7 Nov 2012 17:44:37 +0100 Subject: [PATCH 15/52] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f743c8b4a..32e01d97d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f743c8b4ab7ec010a96aa53f2e179cea69bfb4e6 +Subproject commit 32e01d97d819cba4e16bd603f1dab33ef2a3a281 From b35e4774658ab2fe666c4b7ec2f93d8ebe59d91a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 8 Nov 2012 23:38:24 +0100 Subject: [PATCH 16/52] fix big bug in receiving of text message --- coreapi/sal_eXosip2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 2f6d4ae80..460463794 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1750,7 +1750,7 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ return; } msg=body->body; - } if (content_type->type + }else if (content_type->type && strcmp(content_type->type, "message")==0 && content_type->subtype && strcmp(content_type->subtype, "external-body")==0 ) { @@ -1796,7 +1796,7 @@ static void other_request(Sal *sal, eXosip_event_t *ev){ }else ms_warning("Ignored REFER not coming from this local loopback interface."); }else if (strncmp(ev->request->sip_method, "UPDATE", 6) == 0){ inc_update(sal,ev); - }else { + }else { char *tmp=NULL; size_t msglen=0; osip_message_to_str(ev->request,&tmp,&msglen); From 3ac2d110e563a3902697445839f4061939f29191 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 9 Nov 2012 09:34:09 +0100 Subject: [PATCH 17/52] Microphone gain & U/D bandwidth in JNI --- coreapi/linphonecore_jni.cc | 21 +++++++++++++++++++ .../org/linphone/core/LinphoneCore.java | 6 ++++++ .../org/linphone/core/LinphoneCoreImpl.java | 15 +++++++++++++ 3 files changed, 42 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 85bd10259..a66a07b61 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -703,6 +703,27 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReacha return (jboolean)linphone_core_is_network_reachable((LinphoneCore*)lc); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jint bandwidth) { + linphone_core_set_upload_bandwidth((LinphoneCore*)lc,bandwidth); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jint bandwidth) { + linphone_core_set_download_bandwidth((LinphoneCore*)lc,bandwidth); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jfloat gain) { + linphone_core_set_microphone_gain_db((LinphoneCore*)lc,gain); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env ,jobject thiz ,jlong lc diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 49b15c369..51b6d029a 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -849,4 +849,10 @@ public interface LinphoneCore { * Once this time is elapsed (ringing included), the call is automatically hung up. **/ void setInCallTimeout(int timeout); + + void setUploadBandwidth(int bandwidth); + + void setDownloadBandwidth(int bandwidth); + + void setMicrophoneGain(float gain); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 138dc41f3..0a28af7d8 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -788,4 +788,19 @@ class LinphoneCoreImpl implements LinphoneCore { { setInCallTimeout(nativePtr, timeout); } + + private native void setUploadBandwidth(long ptr, int bandwidth); + public void setUploadBandwidth(int bandwidth) { + setUploadBandwidth(nativePtr, bandwidth); + } + + private native void setDownloadBandwidth(long ptr, int bandwidth); + public void setDownloadBandwidth(int bandwidth) { + setUploadBandwidth(nativePtr, bandwidth); + } + + private native void setMicrophoneGain(long ptr, float gain); + public void setMicrophoneGain(float gain) { + setUploadBandwidth(nativePtr, gain); + } } From c33f8fa5858cfb060f9a84f0b25ebef7e8853871 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 9 Nov 2012 09:37:25 +0100 Subject: [PATCH 18/52] Fix previous commit --- coreapi/linphonecore_jni.cc | 14 -------------- java/common/org/linphone/core/LinphoneCore.java | 4 ---- java/impl/org/linphone/core/LinphoneCoreImpl.java | 12 +----------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index a66a07b61..e469a8fca 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -703,20 +703,6 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReacha return (jboolean)linphone_core_is_network_reachable((LinphoneCore*)lc); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv* env - ,jobject thiz - ,jlong lc - ,jint bandwidth) { - linphone_core_set_upload_bandwidth((LinphoneCore*)lc,bandwidth); -} - -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNIEnv* env - ,jobject thiz - ,jlong lc - ,jint bandwidth) { - linphone_core_set_download_bandwidth((LinphoneCore*)lc,bandwidth); -} - extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv* env ,jobject thiz ,jlong lc diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 51b6d029a..fb49d3cb1 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -850,9 +850,5 @@ public interface LinphoneCore { **/ void setInCallTimeout(int timeout); - void setUploadBandwidth(int bandwidth); - - void setDownloadBandwidth(int bandwidth); - void setMicrophoneGain(float gain); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 0a28af7d8..320939da0 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -789,18 +789,8 @@ class LinphoneCoreImpl implements LinphoneCore { setInCallTimeout(nativePtr, timeout); } - private native void setUploadBandwidth(long ptr, int bandwidth); - public void setUploadBandwidth(int bandwidth) { - setUploadBandwidth(nativePtr, bandwidth); - } - - private native void setDownloadBandwidth(long ptr, int bandwidth); - public void setDownloadBandwidth(int bandwidth) { - setUploadBandwidth(nativePtr, bandwidth); - } - private native void setMicrophoneGain(long ptr, float gain); public void setMicrophoneGain(float gain) { - setUploadBandwidth(nativePtr, gain); + setMicrophoneGain(nativePtr, gain); } } From 2123621e5648cf37dce82b5bf812c167cb2b16e7 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 9 Nov 2012 09:40:32 +0100 Subject: [PATCH 19/52] Fix microphone gain db --- coreapi/linphonecore_jni.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e469a8fca..c3893e496 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -707,7 +707,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv ,jobject thiz ,jlong lc ,jfloat gain) { - linphone_core_set_microphone_gain_db((LinphoneCore*)lc,gain); + linphone_core_set_mic_gain_db((LinphoneCore*)lc,gain); } extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env From 72f307c5563bc1d8c1033d8ad0f560d4d1f87874 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 9 Nov 2012 10:49:15 +0100 Subject: [PATCH 20/52] Fix compilation if git is not installed. --- coreapi/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 0c10c05da..a984799b9 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -117,6 +117,9 @@ make_gitversion_h: else \ $(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \ fi + if test ! -f $(srcdir)/$(GITVERSION_FILE) ; then \ + cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ + fi if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \ cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ fi From bcfc9a02e033ccc01b600b28ac3517edb3643e36 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 12 Nov 2012 12:22:20 +0100 Subject: [PATCH 21/52] update ms2 --- coreapi/sal_eXosip2.c | 1 + mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 460463794..0363ddb2b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -1747,6 +1747,7 @@ static void text_received(Sal *sal, eXosip_event_t *ev){ osip_message_get_body(ev->request,0,&body); if (body==NULL){ ms_error("Could not get text message from SIP body"); + osip_free(from); return; } msg=body->body; diff --git a/mediastreamer2 b/mediastreamer2 index 32e01d97d..7541f5483 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 32e01d97d819cba4e16bd603f1dab33ef2a3a281 +Subproject commit 7541f5483ac6a427b04fb0f250a2a8149136e620 From 7b95eead97161c6016dc868a6a0a3f68dc39083d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 12 Nov 2012 21:26:29 +0100 Subject: [PATCH 22/52] sip dscp wasn't taken into account immediately. --- coreapi/linphonecore.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 381a60258..f3d0a0030 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -566,6 +566,8 @@ static void sip_config_read(LinphoneCore *lc) sal_set_root_ca(lc->sal, lp_config_get_string(lc->config,"sip","root_ca", ROOT_CA_FILE)); #endif linphone_core_verify_server_certificates(lc,lp_config_get_int(lc->config,"sip","verify_server_certs",TRUE)); + /*setting the dscp must be done before starting the transports, otherwise it is not taken into effect*/ + sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc)); /*start listening on ports*/ linphone_core_set_sip_transports(lc,&tr); @@ -634,7 +636,6 @@ static void sip_config_read(LinphoneCore *lc) sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period); sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0)); sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1)); - sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc)); sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0)); } @@ -5316,8 +5317,10 @@ const char* linphone_core_get_device_identifier(const LinphoneCore *lc) { **/ void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp){ sal_set_dscp(lc->sal,dscp); - if (linphone_core_ready(lc)) + if (linphone_core_ready(lc)){ lp_config_set_int_hex(lc->config,"sip","dscp",dscp); + apply_transports(lc); + } } /** From b2baba7e4d3c8866c1ebd098f1c2214df6d75c47 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 13 Nov 2012 17:13:59 +0100 Subject: [PATCH 23/52] Update ms2 submodule for WebRTC echo canceller. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7541f5483..e0cf802a9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7541f5483ac6a427b04fb0f250a2a8149136e620 +Subproject commit e0cf802a93c744350dfd12b15d48ccadf033291b From 8712757602d7fc6d80a1d0d61d9af70473782b00 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 14 Nov 2012 11:44:14 +0100 Subject: [PATCH 24/52] Update submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index e0cf802a9..709b5f4d6 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e0cf802a93c744350dfd12b15d48ccadf033291b +Subproject commit 709b5f4d68b714619e0ef50cacbb4a63c5717d21 diff --git a/oRTP b/oRTP index ddc4f7d04..88ace8adf 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit ddc4f7d041967305483761fc9c643d3bb290a5f1 +Subproject commit 88ace8adfecde4d03ea9030d625f6949f4f5fab4 From 486492c448b36feccd15e59b3cc1c2bab7b03682 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 14 Nov 2012 14:02:30 +0100 Subject: [PATCH 25/52] update ms2 and ortp --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index e0cf802a9..9e76d92b8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e0cf802a93c744350dfd12b15d48ccadf033291b +Subproject commit 9e76d92b88d1359cbea328ef1350bd6c010eab7f diff --git a/oRTP b/oRTP index ddc4f7d04..88ace8adf 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit ddc4f7d041967305483761fc9c643d3bb290a5f1 +Subproject commit 88ace8adfecde4d03ea9030d625f6949f4f5fab4 From 6b32d7d6c6af200b9ae01640b9412e45722790d9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 15 Nov 2012 11:30:31 +0100 Subject: [PATCH 26/52] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 709b5f4d6..70aaa23d9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 709b5f4d68b714619e0ef50cacbb4a63c5717d21 +Subproject commit 70aaa23d9cc52a97438301d8b8fb28312c6a50c9 From eeb4b52d1e8b12c0b1096775be41774dc6bd61b6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 16 Nov 2012 14:20:59 +0100 Subject: [PATCH 27/52] JNI glue for linphone_core_set_primary_contact --- coreapi/linphonecore_jni.cc | 16 ++++++++++++++++ java/common/org/linphone/core/LinphoneCore.java | 5 +++++ .../impl/org/linphone/core/LinphoneCoreImpl.java | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index c3893e496..55041b17a 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -542,6 +542,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env delete lcData; } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject thiz, jlong lc, jstring jdisplayname, jstring jusername) { + const char* displayname = env->GetStringUTFChars(jdisplayname, NULL); + const char* username = env->GetStringUTFChars(jusername, NULL); + + LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc); + if (parsed != NULL) { + linphone_address_set_display_name(parsed, displayname); + linphone_address_set_username(parsed, username); + char *contact = linphone_address_as_string(parsed); + linphone_core_set_primary_contact((LinphoneCore*)lc, contact); + } + + env->ReleaseStringUTFChars(jdisplayname, displayname); + env->ReleaseStringUTFChars(jusername, username); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) { linphone_core_clear_proxy_config((LinphoneCore*)lc); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index fb49d3cb1..450091843 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -851,4 +851,9 @@ public interface LinphoneCore { void setInCallTimeout(int timeout); void setMicrophoneGain(float gain); + + /** + * Set username and display name to use if no LinphoneProxyConfig configured + */ + void setPrimaryContact(String displayName, String username); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 320939da0..5e6864559 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -116,6 +116,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native void setVideoPortRange(long nativePtr, int minPort, int maxPort); private native void setIncomingTimeout(long nativePtr, int timeout); private native void setInCallTimeout(long nativePtr, int timeout); + private native void setPrimaryContact(long nativePtr, String displayName, String username); LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException { mListener=listener; @@ -793,4 +794,8 @@ class LinphoneCoreImpl implements LinphoneCore { public void setMicrophoneGain(float gain) { setMicrophoneGain(nativePtr, gain); } + + public void setPrimaryContact(String displayName, String username) { + setPrimaryContact(nativePtr, displayName, username); + } } From 08dadabca9cd60b062521cb0fcf47f67d4ceb23d Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 16 Nov 2012 15:26:08 +0100 Subject: [PATCH 28/52] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 70aaa23d9..5471aec78 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 70aaa23d9cc52a97438301d8b8fb28312c6a50c9 +Subproject commit 5471aec785f634aa363d6e9de530fc5614cf09d2 From 7c59efad878e252bdbabb4f3ed056a4fe3a59265 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 19 Nov 2012 14:04:08 +0100 Subject: [PATCH 29/52] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 5471aec78..1450b2cb8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5471aec785f634aa363d6e9de530fc5614cf09d2 +Subproject commit 1450b2cb8182f4c75f27aec893d7e365d3dc3d6b From fb9fa2aa00c65826f51532a0478a6a2704919ca7 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 19 Nov 2012 12:22:41 +0100 Subject: [PATCH 30/52] fix for lc->last_recv_msg_ids size limit --- coreapi/callbacks.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index f99c9b224..134c336ab 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -781,19 +781,21 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){ static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){ MSList *elem=lc->last_recv_msg_ids; + MSList *tail=NULL; int i; bool_t is_duplicate=FALSE; for(i=0;elem!=NULL;elem=elem->next,i++){ if (strcmp((const char*)elem->data,msg_id)==0){ is_duplicate=TRUE; } + tail=elem; } if (!is_duplicate){ lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id)); } if (i>=10){ - ms_free(elem->data); - ms_list_remove_link(lc->last_recv_msg_ids,elem); + ms_free(tail->data); + lc->last_recv_msg_ids=ms_list_remove_link(lc->last_recv_msg_ids,tail); } return is_duplicate; } From 2c5421f22e37952123d4cd06bf3b13da80a1e86f Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 19 Nov 2012 12:23:13 +0100 Subject: [PATCH 31/52] add more dial plan support --- coreapi/proxy.c | 233 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 226 insertions(+), 7 deletions(-) diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 718f7b0f5..864a23441 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -378,14 +378,233 @@ typedef struct dial_plan{ }dial_plan_t; /* TODO: fill with information for all countries over the world*/ -static dial_plan_t const dial_plans[]={ - {"France" ,"FR" , "33" , 9 , "00" }, - {"United States" ,"US" , "1" , 10 , "011" }, - {"Turkey" ,"TR" , "90" , 10 , "00" }, - {"Switzerland" ,"XK" , "41" , 9 , "00" }, - {NULL ,NULL,"" , 0 , NULL } -}; +static dial_plan_t const dial_plans[]={ + {"Afghanistan" ,"AF" , "93" , 9 , "00" }, + {"Albania" ,"AL" , "355" , 9 , "00" }, + {"Algeria" ,"DZ" , "213" , 9 , "00" }, + {"American Samoa" ,"AS" , "1" , 10 , "011" }, + {"Andorra" ,"AD" , "376" , 6 , "00" }, + {"Angola" ,"AO" , "244" , 9 , "00" }, + {"Anguilla" ,"AI" , "1" , 10 , "011" }, + {"Antigua and Barbuda" ,"AG" , "1" , 10 , "011" }, + {"Argentina" ,"AR" , "54" , 10 , "00" }, + {"Armenia" ,"AM" , "374" , 8 , "00" }, + {"Aruba" ,"AW" , "297" , 7 , "011" }, + {"Australia" ,"AU" , "61" , 9 , "0011"}, + {"Austria" ,"AT" , "43" , 10 , "00" }, + {"Azerbaijan" ,"AZ" , "994" , 9 , "00" }, + {"Bahamas" ,"BS" , "1" , 10 , "011" }, + {"Bahrain" ,"BH" , "973" , 8 , "00" }, + {"Bangladesh" ,"BD" , "880" , 10 , "00" }, + {"Barbados" ,"BB" , "1" , 10 , "011" }, + {"Belarus" ,"BY" , "375" , 9 , "00" }, + {"Belgium" ,"BE" , "32" , 9 , "00" }, + {"Belize" ,"BZ" , "501" , 7 , "00" }, + {"Benin" ,"BJ" , "229" , 8 , "00" }, + {"Bermuda" ,"BM" , "1" , 10 , "011" }, + {"Bhutan" ,"BT" , "975" , 8 , "00" }, + {"Bolivia" ,"BO" , "591" , 8 , "00" }, + {"Bosnia and Herzegovina" ,"BA" , "387" , 8 , "00" }, + {"Botswana" ,"BW" , "267" , 8 , "00" }, + {"Brazil" ,"BR" , "55" , 10 , "00" }, + {"Brunei Darussalam" ,"BN" , "673" , 7 , "00" }, + {"Bulgaria" ,"BG" , "359" , 9 , "00" }, + {"Burkina Faso" ,"BF" , "226" , 8 , "00" }, + {"Burundi" ,"BI" , "257" , 8 , "011" }, + {"Cambodia" ,"KH" , "855" , 9 , "00" }, + {"Cameroon" ,"CM" , "237" , 8 , "00" }, + {"Canada" ,"CA" , "1" , 10 , "011" }, + {"Cape Verde" ,"CV" , "238" , 7 , "00" }, + {"Cayman Islands" ,"KY" , "1" , 10 , "011" }, + {"Central African Republic" ,"CF" , "236" , 8 , "00" }, + {"Chad" ,"TD" , "235" , 8 , "00" }, + {"Chile" ,"CL" , "56" , 9 , "00" }, + {"China" ,"CN" , "86" , 11 , "00" }, + {"Colombia" ,"CO" , "57" , 10 , "00" }, + {"Comoros" ,"KM" , "269" , 7 , "00" }, + {"Congo" ,"CG" , "242" , 9 , "00" }, + {"Congo Democratic Republic" ,"CD" , "243" , 9 , "00" }, + {"Cook Islands" ,"CK" , "682" , 5 , "00" }, + {"Costa Rica" ,"CR" , "506" , 8 , "00" }, + {"C™te d'Ivoire" ,"AD" , "225" , 8 , "00" }, + {"Croatia" ,"HR" , "385" , 9 , "00" }, + {"Cuba" ,"CU" , "53" , 8 , "119" }, + {"Cyprus" ,"CY" , "357" , 8 , "00" }, + {"Czech Republic" ,"CZ" , "420" , 9 , "00" }, + {"Denmark" ,"DK" , "45" , 8 , "00" }, + {"Djibouti" ,"DJ" , "253" , 8 , "00" }, + {"Dominica" ,"DM" , "1" , 10 , "011" }, + {"Dominican Republic" ,"DO" , "1" , 10 , "011" }, + {"Ecuador" ,"EC" , "593" , 9 , "00" }, + {"Egypt" ,"EG" , "20" , 10 , "00" }, + {"El Salvador" ,"SV" , "503" , 8 , "00" }, + {"Equatorial Guinea" ,"GQ" , "240" , 9 , "00" }, + {"Eritrea" ,"ER" , "291" , 7 , "00" }, + {"Estonia" ,"EE" , "372" , 8 , "00" }, + {"Ethiopia" ,"ET" , "251" , 9 , "00" }, + {"Falkland Islands" ,"FK" , "500" , 5 , "00" }, + {"Faroe Islands" ,"FO" , "298" , 6 , "00" }, + {"Fiji" ,"FJ" , "679" , 7 , "00" }, + {"Finland" ,"FI" , "358" , 9 , "00" }, + {"France" ,"FR" , "33" , 9 , "00" }, + {"French Guiana" ,"GF" , "594" , 9 , "00" }, + {"French Polynesia" ,"PF" , "689" , 6 , "00" }, + {"Gabon" ,"GA" , "241" , 8 , "00" }, + {"Gambia" ,"GM" , "220" , 7 , "00" }, + {"Georgia" ,"GE" , "995" , 9 , "00" }, + {"Germany" ,"DE" , "49" , 11 , "00" }, + {"Ghana" ,"GH" , "233" , 9 , "00" }, + {"Gibraltar" ,"GI" , "350" , 8 , "00" }, + {"Greece" ,"GR" , "30" ,10 , "00" }, + {"Greenland" ,"GL" , "299" , 6 , "00" }, + {"Grenada" ,"GD" , "1" , 10 , "011" }, + {"Guadeloupe" ,"GP" , "590" , 9 , "00" }, + {"Guam" ,"GU" , "1" , 10 , "011" }, + {"Guatemala" ,"GT" , "502" , 8 , "00" }, + {"Guinea" ,"GN" , "224" , 8 , "00" }, + {"Guinea-Bissau" ,"GW" , "245" , 7 , "00" }, + {"Guyana" ,"GY" , "592" , 7 , "001" }, + {"Haiti" ,"HT" , "509" , 8 , "00" }, + {"Honduras" ,"HN" , "504" , 8 , "00" }, + {"Hong Kong" ,"HK" , "852" , 8 , "001" }, + {"Hungary" ,"HU" , "36" , 9 , "00" }, + {"Iceland" ,"IS" , "354" , 9 , "00" }, + {"India" ,"IN" , "91" , 10 , "00" }, + {"Indonesia" ,"ID" , "62" , 10 , "001" }, + {"Iran" ,"IR" , "98" , 10 , "00" }, + {"Iraq" ,"IQ" , "964" , 10 , "00" }, + {"Ireland" ,"IE" , "353" , 9 , "00" }, + {"Israel" ,"IL" , "972" , 9 , "00" }, + {"Italy" ,"IT" , "39" , 10 , "00" }, + {"Jamaica" ,"JM" , "1" , 10 , "011" }, + {"Japan" ,"JP" , "81" , 10 , "010" }, + {"Jordan" ,"JO" , "962" , 9 , "00" }, + {"Kazakhstan" ,"KZ" , "7" , 10 , "00" }, + {"Kenya" ,"KE" , "254" , 9 , "000" }, + {"Kiribati" ,"KI" , "686" , 5 , "00" }, + {"Korea, North" ,"KP" , "850" , 12 , "99" }, + {"Korea, South" ,"KR" , "82" , 12 , "001" }, + {"Kuwait" ,"KW" , "965" , 8 , "00" }, + {"Kyrgyzstan" ,"KG" , "996" , 9 , "00" }, + {"Laos" ,"LA" , "856" , 10 , "00" }, + {"Latvia" ,"LV" , "371" , 8 , "00" }, + {"Lebanon" ,"LB" , "961" , 7 , "00" }, + {"Lesotho" ,"LS" , "266" , 8 , "00" }, + {"Liberia" ,"LR" , "231" , 8 , "00" }, + {"Libya" ,"LY" , "218" , 8 , "00" }, + {"Liechtenstein" ,"LI" , "423" , 7 , "00" }, + {"Lithuania" ,"LT" , "370" , 8 , "00" }, + {"Luxembourg" ,"LU" , "352" , 9 , "00" }, + {"Macau" ,"MO" , "853" , 8 , "00" }, + {"Macedonia" ,"MK" , "389" , 8 , "00" }, + {"Madagascar" ,"MG" , "261" , 9 , "00" }, + {"Malawi" ,"MW" , "265" , 9 , "00" }, + {"Malaysia" ,"MY" , "60" , 9 , "00" }, + {"Maldives" ,"MV" , "960" , 7 , "00" }, + {"Mali" ,"ML" , "223" , 8 , "00" }, + {"Malta" ,"MT" , "356" , 8 , "00" }, + {"Marshall Islands" ,"MH" , "692" , 7 , "011" }, + {"Martinique" ,"MQ" , "596" , 9 , "00" }, + {"Mauritania" ,"MR" , "222" , 8 , "00" }, + {"Mauritius" ,"MU" , "230" , 7 , "00" }, + {"Mayotte Island" ,"YT" , "262" , 9 , "00" }, + {"Mexico" ,"MX" , "52" , 10 , "00" }, + {"Micronesia" ,"FM" , "691" , 7 , "011" }, + {"Moldova" ,"MD" , "373" , 8 , "00" }, + {"Monaco" ,"MC" , "377" , 8 , "00" }, + {"Mongolia" ,"MN" , "976" , 8 , "001" }, + {"Montenegro" ,"ME" , "382" , 8 , "00" }, + {"Montserrat" ,"MS" , "664" , 10 , "011" }, + {"Morocco" ,"MA" , "212" , 9 , "00" }, + {"Mozambique" ,"MZ" , "258" , 9 , "00" }, + {"Myanmar" ,"MM" , "95" , 8 , "00" }, + {"Namibia" ,"NA" , "264" , 9 , "00" }, + {"Nauru" ,"NR" , "674" , 7 , "00" }, + {"Nepal" ,"NP" , "43" , 10 , "00" }, + {"Netherlands" ,"NL" , "31" , 9 , "00" }, + {"New Caledonia" ,"NC" , "687" , 6 , "00" }, + {"New Zealand" ,"NZ" , "64" , 10 , "00" }, + {"Nicaragua" ,"NI" , "505" , 8 , "00" }, + {"Niger" ,"NE" , "227" , 8 , "00" }, + {"Nigeria" ,"NG" , "234" , 10 , "009" }, + {"Niue" ,"NU" , "683" , 4 , "00" }, + {"Norfolk Island" ,"NF" , "672" , 5 , "00" }, + {"Northern Mariana Islands" ,"MP" , "1" , 10 , "011" }, + {"Norway" ,"NO" , "47" , 8 , "00" }, + {"Oman" ,"OM" , "968" , 8 , "00" }, + {"Pakistan" ,"PK" , "92" , 10 , "00" }, + {"Palau" ,"PW" , "680" , 7 , "011" }, + {"Palestine" ,"PS" , "970" , 9 , "00" }, + {"Panama" ,"PA" , "507" , 8 , "00" }, + {"Papua New Guinea" ,"PG" , "675" , 8 , "00" }, + {"Paraguay" ,"PY" , "595" , 9 , "00" }, + {"Peru" ,"PE" , "51" , 9 , "00" }, + {"Philippines" ,"PH" , "63" , 10 , "00" }, + {"Poland" ,"PL" , "48" , 9 , "00" }, + {"Portugal" ,"PT" , "351" , 9 , "00" }, + {"Puerto Rico" ,"PR" , "1" , 10 , "011" }, + {"Qatar" ,"QA" , "974" , 8 , "00" }, + {"Rˇunion Island" ,"RE" , "262" , 9 , "011" }, + {"Romania" ,"RO" , "40" , 9 , "00" }, + {"Russian Federation" ,"RU" , "7" , 10 , "8" }, + {"Rwanda" ,"RW" , "250" , 9 , "00" }, + {"Saint Helena" ,"SH" , "290" , 4 , "00" }, + {"Saint Kitts and Nevis" ,"KN" , "1" , 10 , "011" }, + {"Saint Lucia" ,"LC" , "1" , 10 , "011" }, + {"Saint Pierre and Miquelon" ,"PM" , "508" , 6 , "00" }, + {"Saint Vincent and the Grenadines","VC" , "1" , 10 , "011" }, + {"Samoa" ,"WS" , "685" , 7 , "0" }, + {"San Marino" ,"SM" , "378" , 10 , "00" }, + {"S‹o Tomˇ and Pr’ncipe" ,"ST" , "239" , 7 , "00" }, + {"Saudi Arabia" ,"SA" , "966" , 9 , "00" }, + {"Senegal" ,"SN" , "221" , 9 , "00" }, + {"Serbia" ,"RS" , "381" , 9 , "00" }, + {"Seychelles" ,"SC" , "248" , 7 , "00" }, + {"Sierra Leone" ,"SL" , "232" , 8 , "00" }, + {"Singapore" ,"SG" , "65" , 8 , "001" }, + {"Slovakia" ,"SK" , "421" , 9 , "00" }, + {"Slovenia" ,"SI" , "386" , 8 , "00" }, + {"Solomon Islands" ,"SB" , "677" , 7 , "00" }, + {"Somalia" ,"SO" , "252" , 8 , "00" }, + {"South Africa" ,"ZA" , "27" , 9 , "00" }, + {"Spain" ,"ES" , "34" , 9 , "00" }, + {"Sri Lanka" ,"LK" , "94" , 9 , "00" }, + {"Sudan" ,"SD" , "249" , 9 , "00" }, + {"Suriname" ,"SR" , "597" , 7 , "00" }, + {"Swaziland" ,"SZ" , "268" , 8 , "00" }, + {"Sweden" ,"SE" , "1" , 9 , "00" }, + {"Switzerland" ,"XK" , "41" , 9 , "00" }, + {"Syria" ,"SY" , "963" , 9 , "00" }, + {"Taiwan" ,"TW" , "886" , 9 , "810" }, + {"Tajikistan" ,"TJ" , "992" , 9 , "002" }, + {"Tanzania" ,"TZ" , "255" , 9 , "000" }, + {"Thailand" ,"TH" , "66" , 9 , "001" }, + {"Togo" ,"TG" , "228" , 8 , "00" }, + {"Tokelau" ,"TK" , "690" , 4 , "00" }, + {"Tonga" ,"TO" , "676" , 5 , "00" }, + {"Trinidad and Tobago" ,"TT" , "1" , 10 , "011" }, + {"Tunisia" ,"TN" , "216" , 8 , "00" }, + {"Turkey" ,"TR" , "90" , 10 , "00" }, + {"Turkmenistan" ,"TM" , "993" , 8 , "00" }, + {"Turks and Caicos Islands" ,"TC" , "1" , 7 , "0" }, + {"Tuvalu" ,"TV" , "688" , 5 , "00" }, + {"Uganda" ,"UG" , "256" , 9 , "000" }, + {"Ukraine" ,"UA" , "380" , 9 , "00" }, + {"United Arab Emirates" ,"AE" , "971" , 9 , "00" }, + {"United Kingdom" ,"UK" , "44" , 10 , "00" }, + {"United States" ,"US" , "1" , 10 , "011" }, + {"Uruguay" ,"UY" , "598" , 8 , "00" }, + {"Uzbekistan" ,"UZ" , "998" , 9 , "8" }, + {"Vanuatu" ,"VU" , "678" , 7 , "00" }, + {"Venezuela" ,"VE" , "58" , 10 , "00" }, + {"Vietnam" ,"VN" , "84" , 9 , "00" }, + {"Wallis and Futuna" ,"WF" , "681" , 5 , "00" }, + {"Yemen" ,"YE" , "967" , 9 , "00" }, + {"Zambia" ,"ZM" , "260" , 9 , "00" }, + {"Zimbabwe" ,"ZW" , "263" , 9 , "00" }, + {NULL ,NULL , "" , 0 , NULL } +}; static dial_plan_t most_common_dialplan={ "generic" ,"", "", 10, "00"}; int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) { From 2d019536da933d707059084f64ce4e073246b7db Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 20 Nov 2012 16:35:16 +0100 Subject: [PATCH 32/52] Update ms2 submodule for native Android sound module. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1450b2cb8..079789162 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1450b2cb8182f4c75f27aec893d7e365d3dc3d6b +Subproject commit 0797891627ac48cec1fe35940183cd052fdf85c9 From 362d77908ae82c67eb61f5038ff048f9125984b5 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Wed, 21 Nov 2012 12:16:17 +0100 Subject: [PATCH 33/52] Call zoom video: check output nullity --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 6f8c06ef2..e0b0174ad 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2105,7 +2105,7 @@ bool_t linphone_call_is_in_conference(const LinphoneCall *call) { **/ void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) { VideoStream* vstream = call->videostream; - if (vstream) { + if (vstream && vstream->output) { float zoom[3]; if (zoom_factor < 1) From 06d8cec790d74bfbd374db9b10bfec83207a71ba Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 22 Nov 2012 11:36:29 +0100 Subject: [PATCH 34/52] Add checks to prevent crashes. The getReceiverInterarrivalJitter() function may be called before the used audio codec is known in case of early media, so test that the payload type is valid before using it. --- coreapi/linphonecore_jni.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 55041b17a..03d5c0df0 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1372,6 +1372,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr pt = linphone_call_params_get_used_audio_codec(params); else pt = linphone_call_params_get_used_video_codec(params); + if (!pt || (pt->clock_rate == 0)) + return (jfloat)0.0; return (jfloat)((float)report_block_get_interarrival_jitter(srb) / (float)pt->clock_rate); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) { @@ -1399,6 +1401,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverIntera pt = linphone_call_params_get_used_audio_codec(params); else pt = linphone_call_params_get_used_video_codec(params); + if (!pt || (pt->clock_rate == 0)) + return (jfloat)0.0; return (jfloat)((float)report_block_get_interarrival_jitter(rrb) / (float)pt->clock_rate); } extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getRoundTripDelay(JNIEnv *env, jobject thiz, jlong stats_ptr) { From cfa2e64b0b6ccc78c8df7716676bfa73ef4ff634 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 22 Nov 2012 17:39:36 +0100 Subject: [PATCH 35/52] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 079789162..fd650dfd9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0797891627ac48cec1fe35940183cd052fdf85c9 +Subproject commit fd650dfd92c307a35f1820e157dba5d1b185ede6 From d0745a39f291758c8b6d1fedeb4dc064196bfb8e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 22 Nov 2012 22:01:16 +0100 Subject: [PATCH 36/52] better srtp management - have the choice to keep same keys accross reINVITEs - don't restart the stream for minor changes like removal of a recv-only codec. --- coreapi/linphonecall.c | 70 +++++++++++++++++++----------------------- coreapi/linphonecore.c | 14 ++++----- coreapi/private.h | 5 +-- coreapi/sal.c | 10 ++++++ 4 files changed, 49 insertions(+), 50 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index e0b0174ad..d8fdd8803 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -208,22 +208,23 @@ static void update_media_description_from_stun(SalMediaDescription *md, const St } - -static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, LinphoneCall *call, unsigned int session_id, unsigned int session_ver){ +void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call){ MSList *l; PayloadType *pt; + SalMediaDescription *old_md=call->localdesc; int i; const char *me=linphone_core_get_identity(lc); LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); + bool_t keep_srtp_keys=lp_config_get_int(lc->config,"sip","keep_srtp_keys",0); if (call->ping_time>0) { linphone_core_adapt_to_network(lc,call->ping_time,&call->params); } - md->session_id=session_id; - md->session_ver=session_ver; + md->session_id=(old_md ? old_md->session_id : (rand() & 0xfff)); + md->session_ver=(old_md ? (old_md->session_ver+1) : (rand() & 0xfff)); md->nstreams=1; strncpy(md->addr,call->localip,sizeof(md->addr)); strncpy(md->username,username,sizeof(md->username)); @@ -248,8 +249,6 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event")); l=ms_list_append(l,pt); md->streams[0].payloads=l; - - if (call->params.has_video){ md->nstreams++; @@ -263,15 +262,22 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li for(i=0; instreams; i++) { if (md->streams[i].proto == SalProtoRtpSavp) { - md->streams[i].crypto[0].tag = 1; - md->streams[i].crypto[0].algo = AES_128_SHA1_80; - if (!generate_b64_crypto_key(30, md->streams[i].crypto[0].master_key)) - md->streams[i].crypto[0].algo = 0; - md->streams[i].crypto[1].tag = 2; - md->streams[i].crypto[1].algo = AES_128_SHA1_32; - if (!generate_b64_crypto_key(30, md->streams[i].crypto[1].master_key)) - md->streams[i].crypto[1].algo = 0; - md->streams[i].crypto[2].algo = 0; + if (keep_srtp_keys && old_md && old_md->streams[i].proto==SalProtoRtpSavp){ + int j; + for(j=0;jstreams[i].crypto[j],&old_md->streams[i].crypto[j],sizeof(SalSrtpCryptoAlgo)); + } + }else{ + md->streams[i].crypto[0].tag = 1; + md->streams[i].crypto[0].algo = AES_128_SHA1_80; + if (!generate_b64_crypto_key(30, md->streams[i].crypto[0].master_key)) + md->streams[i].crypto[0].algo = 0; + md->streams[i].crypto[1].tag = 2; + md->streams[i].crypto[1].algo = AES_128_SHA1_32; + if (!generate_b64_crypto_key(30, md->streams[i].crypto[1].master_key)) + md->streams[i].crypto[1].algo = 0; + md->streams[i].crypto[2].algo = 0; + } } } update_media_description_from_stun(md,&call->ac,&call->vc); @@ -280,22 +286,8 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li linphone_core_update_ice_state_in_call_stats(call); } linphone_address_destroy(addr); - return md; -} - -void update_local_media_description(LinphoneCore *lc, LinphoneCall *call){ - SalMediaDescription *md=call->localdesc; - if (md== NULL) { - call->localdesc = create_local_media_description(lc,call); - } else { - call->localdesc = _create_local_media_description(lc,call,md->session_id,md->session_ver+1); - sal_media_description_unref(md); - } -} - -SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call){ - unsigned int id=rand() & 0xfff; - return _create_local_media_description(lc,call,id,id); + call->localdesc=md; + if (old_md) sal_media_description_unref(old_md); } static int find_port_offset(LinphoneCore *lc, SalStreamType type){ @@ -1026,11 +1018,11 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u ms_warning("Case is MS_VIDEO_DECODER_DECODING_ERRORS"); linphone_call_send_vfu_request(call); break; - case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED: - ms_message("First video frame decoded successfully"); - if (call->nextVideoFrameDecoded._func != NULL) - call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data); - break; + case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED: + ms_message("First video frame decoded successfully"); + if (call->nextVideoFrameDecoded._func != NULL) + call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data); + break; default: ms_warning("Unhandled event %i", event_id); break; @@ -1039,10 +1031,10 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u #endif void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data) { - call->nextVideoFrameDecoded._func = cb; - call->nextVideoFrameDecoded._user_data = user_data; + call->nextVideoFrameDecoded._func = cb; + call->nextVideoFrameDecoded._user_data = user_data; #ifdef VIDEO_ENABLED - ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION); + ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION); #endif } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f3d0a0030..01667ebcb 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2290,7 +2290,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){ linphone_call_init_media_streams(call); if (lc->ringstream==NULL) audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard); - call->localdesc=create_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); if (!lc->sip_conf.sdp_200_ack){ call->media_pending=TRUE; sal_call_set_local_media_description(call->op,call->localdesc); @@ -2552,7 +2552,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE); const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc); - call->localdesc=create_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc); md=sal_call_get_final_media_description(call->op); if (md && sal_media_description_empty(md)){ @@ -2658,7 +2658,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho call->videostream->ice_check_list = NULL; } call->params = *params; - update_local_media_description(lc, call); + linphone_call_make_local_media_description(lc, call); if ((call->ice_session != NULL) && !has_video && call->params.has_video) { /* Defer call update until the ICE candidates gathering process has finished. */ ms_message("Defer call update to gather ICE candidates"); @@ -2769,7 +2769,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const } call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); call->camera_active=call->params.has_video; - update_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); if (call->ice_session != NULL) { linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op)); #ifdef VIDEO_ENABLED @@ -2885,7 +2885,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, call->params=*params; call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op)); call->camera_active=call->params.has_video; - update_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); sal_call_set_local_media_description(call->op,call->localdesc); } @@ -3075,7 +3075,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call) ms_warning("Cannot pause this call, it is not active."); return -1; } - update_local_media_description(lc,call); + linphone_call_make_local_media_description(lc,call); if (call->ice_session != NULL) linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); if (sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv)){ @@ -3154,7 +3154,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call) prevents the participants to hear it while the 200OK comes back.*/ if (call->audiostream) audio_stream_play(call->audiostream, NULL); - update_local_media_description(lc,the_call); + linphone_call_make_local_media_description(lc,the_call); if (call->ice_session != NULL) linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session); sal_call_set_local_media_description(call->op,call->localdesc); diff --git a/coreapi/private.h b/coreapi/private.h index 60587dbcd..5ebe8b5b7 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -582,10 +582,7 @@ int linphone_core_set_as_current_call(LinphoneCore *lc, LinphoneCall *call); int linphone_core_get_calls_nb(const LinphoneCore *lc); void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); - -SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call); -void update_local_media_description(LinphoneCore *lc, LinphoneCall *call); - +void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md); bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, PayloadType *pt, int bandwidth_limit); diff --git a/coreapi/sal.c b/coreapi/sal.c index 229ee577f..f46d9a556 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -162,6 +162,10 @@ static bool_t payload_type_equals(const PayloadType *p1, const PayloadType *p2){ return TRUE; } +static bool_t is_recv_only(PayloadType *p){ + return (p->flags & PAYLOAD_TYPE_FLAG_CAN_RECV) && ! (p->flags & PAYLOAD_TYPE_FLAG_CAN_SEND); +} + static bool_t payload_list_equals(const MSList *l1, const MSList *l2){ const MSList *e1,*e2; for(e1=l1,e2=l2;e1!=NULL && e2!=NULL; e1=e1->next,e2=e2->next){ @@ -170,6 +174,12 @@ static bool_t payload_list_equals(const MSList *l1, const MSList *l2){ if (!payload_type_equals(p1,p2)) return FALSE; } + if (e1!=NULL){ + /*skip possible recv-only payloads*/ + for(;e1!=NULL && is_recv_only((PayloadType*)e1->data);e1=e1->next){ + ms_message("Skipping recv-only payload type..."); + } + } if (e1!=NULL || e2!=NULL){ /*means one list is longer than the other*/ return FALSE; From 5a1372f8120bbea98faf7515e1259ae334683b4d Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 22 Nov 2012 22:02:41 +0100 Subject: [PATCH 37/52] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index fd650dfd9..55a86251d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fd650dfd92c307a35f1820e157dba5d1b185ede6 +Subproject commit 55a86251dd3dd6516f5ecef45a39371826f69c9a From 96dc7aac83db689dfcad04791a36df256aa83f21 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 22 Nov 2012 23:11:13 +0100 Subject: [PATCH 38/52] write documentation of audio conferencing module. --- coreapi/conference.c | 87 +++++++++++++++++++++++++++++++++++++++- coreapi/help/doxygen.dox | 21 ++++++++++ coreapi/linphonecall.c | 4 ++ coreapi/linphonecore.h | 34 ++++++++-------- 4 files changed, 127 insertions(+), 19 deletions(-) diff --git a/coreapi/conference.c b/coreapi/conference.c index 5ca465254..9f1538f42 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -28,6 +28,12 @@ #include "mediastreamer2/msvolume.h" +/** + * @addtogroup conferencing + * @{ +**/ + + static int convert_conference_to_call(LinphoneCore *lc); static void conference_check_init(LinphoneConference *ctx, int samplerate){ @@ -131,6 +137,11 @@ static void add_local_endpoint(LinphoneConference *conf,LinphoneCore *lc){ } +/** + * Returns the sound volume (mic input) of the local participant of the conference. + * @param lc the linphone core + * @returns the measured input volume expressed in dbm0. + **/ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){ LinphoneConference *conf=&lc->conf_ctx; AudioStream *st=conf->local_participant; @@ -143,6 +154,16 @@ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){ return LINPHONE_VOLUME_DB_LOWEST; } +/** + * Merge a call into a conference. + * @param lc the linphone core + * @param call an established call, either in LinphoneCallStreamsRunning or LinphoneCallPaused state. + * + * If this is the first call that enters the conference, the virtual conference will be created automatically. + * If the local user was actively part of the call (ie not in paused state), then the local user is automatically entered into the conference. + * + * @returns 0 if successful, -1 otherwise. +**/ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){ LinphoneCallParams params; LinphoneConference *conf=&lc->conf_ctx; @@ -229,7 +250,18 @@ static int convert_conference_to_call(LinphoneCore *lc){ return err; } - +/** + * Remove a call from the conference. + * @param lc the linphone core + * @param call a call that has been previously merged into the conference. + * + * After removing the remote participant belonging to the supplied call, the call becomes a normal call in paused state. + * If one single remote participant is left alone in the conference after the removal, then it is + * automatically removed from the conference and put into a simple call, like before entering the conference. + * The conference's resources are then automatically destroyed. + * + * @returns 0 if successful, -1 otherwise. + **/ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){ char * str=linphone_call_get_remote_address_as_string(call); ms_message("Removing call %s from the conference", str); @@ -249,10 +281,21 @@ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){ return err; } +/** + * Indicates whether the local participant is part of the conference. + * @param lc the linphone core + * @returns TRUE if the local participant is in the conference, FALSE otherwise. +**/ bool_t linphone_core_is_in_conference(const LinphoneCore *lc){ return lc->conf_ctx.local_participant!=NULL; } +/** + * Moves the local participant out of the conference. + * @param lc the linphone core + * When the local participant is out of the conference, the remote participants can continue to talk normally. + * @returns 0 if successful, -1 otherwise. +**/ int linphone_core_leave_conference(LinphoneCore *lc){ LinphoneConference *conf=&lc->conf_ctx; if (linphone_core_is_in_conference(lc)) @@ -260,7 +303,17 @@ int linphone_core_leave_conference(LinphoneCore *lc){ return 0; } - +/** + * Moves the local participant inside the conference. + * @param lc the linphone core + * + * Makes the local participant to join the conference. + * Typically, the local participant is by default always part of the conference when joining an active call into a conference. + * However, by calling linphone_core_leave_conference() and linphone_core_enter_conference() the application can decide to temporarily + * move out and in the local participant from the conference. + * + * @returns 0 if successful, -1 otherwise +**/ int linphone_core_enter_conference(LinphoneCore *lc){ if (linphone_core_sound_resources_locked(lc)) { return -1; @@ -273,6 +326,14 @@ int linphone_core_enter_conference(LinphoneCore *lc){ return 0; } +/** + * Add all calls into a conference. + * @param lc the linphone core + * + * Merge all established calls (either in LinphoneCallStreamsRunning or LinphoneCallPaused) into a conference. + * + * @returns 0 if successful, -1 otherwise +**/ int linphone_core_add_all_to_conference(LinphoneCore *lc) { MSList *calls=lc->calls; while (calls) { @@ -286,6 +347,14 @@ int linphone_core_add_all_to_conference(LinphoneCore *lc) { return 0; } +/** + * Terminates the conference and the calls associated with it. + * @param lc the linphone core + * + * All the calls that were merged to the conference are terminated, and the conference resources are destroyed. + * + * @returns 0 if successful, -1 otherwise +**/ int linphone_core_terminate_conference(LinphoneCore *lc) { MSList *calls=lc->calls; while (calls) { @@ -298,9 +367,23 @@ int linphone_core_terminate_conference(LinphoneCore *lc) { return 0; } +/** + * Returns the number of participants to the conference, including the local participant. + * @param lc the linphone core + * + * Typically, after merging two calls into the conference, there is total of 3 participants: + * the local participant (or local user), and two remote participants that were the destinations of the two previously establised calls. + * + * @returns the number of participants to the conference +**/ int linphone_core_get_conference_size(LinphoneCore *lc) { if (lc->conf_ctx.conf == NULL) { return 0; } return ms_audio_conference_get_size(lc->conf_ctx.conf); } + +/** + * @} +**/ + diff --git a/coreapi/help/doxygen.dox b/coreapi/help/doxygen.dox index 87229f276..8b2e6b7b9 100644 --- a/coreapi/help/doxygen.dox +++ b/coreapi/help/doxygen.dox @@ -195,6 +195,27 @@ void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddre * This api is useful for manipulating SIP addresses ('from' or 'to' headers). **/ +/** + * @defgroup conferencing Making an audio conference. + * This API allows to create a conference entirely managed by the client. No server capabilities are required. + * The way such conference is created is by doing the following:
+ * The application shall makes "normal" calls to several destinations (using linphone_core_invite() ), one after another. + * While initiating the second call, the first one is automatically paused. + * Then, once the second call is established, the application has the possibility to merge the two calls to form a conference where each participant + * (the local participant, the remote destination of the first call, the remote destination of the second call) can talk together. + * This must be done by adding the two calls to the conference using \link linphone_call_add_to_conference() \endlink + * + * Once merged into a conference the LinphoneCall objects representing the calls that were established remain unchanged, except that + * they are tagged as part of the conference (see \link linphone_call_is_in_conference() \endlink ). The calls in a conference are in the LinphoneCallStreamsRunning state. + * + * Only a single conference can be created: the purpose of this feature is to allow the local user to create, take part and manage the conference. + * This API is not designed to create a conference server application. + * + * Up to 10 calls can be merged into the conference, however depending on the CPU usage required for doing the encoding/decoding of the streams of each participants, + * the effective limit can be lower. + * +**/ + /** * @defgroup misc Miscenalleous: logs, version strings, config storage **/ diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d8fdd8803..aa5075ddf 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2081,6 +2081,10 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat } } +/** + * Returns true if the call is part of the conference. + * @ingroup conferencing +**/ bool_t linphone_call_is_in_conference(const LinphoneCall *call) { return call->params.in_conference; } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 306f6b70b..f3aa76253 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -663,13 +663,13 @@ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) */ void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); /** - *LinphoneChatMessageStatus used to notify if message has been succesfully delivered or not + *LinphoneChatMessageState is used to notify if messages have been succesfully delivered or not. */ typedef enum _LinphoneChatMessageStates { - LinphoneChatMessageStateIdle, /** initial state*/ - LinphoneChatMessageStateInProgress, /*delivery in progress**/ - LinphoneChatMessageStateDelivered, /** message succesffully delivered an acknoleged by remote end point*/ - LinphoneChatMessageStateNotDelivered /** message was not delivered*/ + LinphoneChatMessageStateIdle, /** Date: Fri, 23 Nov 2012 10:38:00 +0100 Subject: [PATCH 39/52] add function to extract ccc from e164 number --- coreapi/linphonecore_utils.h | 10 ++++++++-- coreapi/proxy.c | 26 ++++++++++++++++++++++++++ coreapi/test_numbers.c | 8 ++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index fadfc1a36..cc0a6f692 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -94,8 +94,14 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook *@return call country code or -1 if not found */ int linphone_dial_plan_lookup_ccc_from_iso(const char* iso); - - +/** + * @ingroup misc + *Function to get call country code from an e164 number, ex: +33952650121 will return 33 + *@param e164 phone number + *@return call country code or -1 if not found + */ +int linphone_dial_plan_lookup_ccc_from_e164(const char* e164); + #ifdef __cplusplus } #endif diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 864a23441..15f10b744 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -607,6 +607,32 @@ static dial_plan_t const dial_plans[]={ }; static dial_plan_t most_common_dialplan={ "generic" ,"", "", 10, "00"}; +int linphone_dial_plan_lookup_ccc_from_e164(const char* e164) { + dial_plan_t* dial_plan; + dial_plan_t* elected_dial_plan=NULL; + unsigned int found; + unsigned int i=0; + if (e164[1]=='1') { + /*USA case*/ + return 1; + } + do { + found=0; + i++; + for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) { + if (strncmp(dial_plan->ccc,&e164[1],i) == 0) { + elected_dial_plan=dial_plan; + found++; + } + } + } while (found>1 || found==0); + if (found==1) { + return atoi(elected_dial_plan->ccc); + } else { + return -1; /*not found */ + } + +} int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) { dial_plan_t* dial_plan; for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) { diff --git a/coreapi/test_numbers.c b/coreapi/test_numbers.c index 8cf4fb792..da1f22b6f 100644 --- a/coreapi/test_numbers.c +++ b/coreapi/test_numbers.c @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "linphonecore.h" +#include "linphonecore_utils.h" int main(int argc , char *argv[]){ LinphoneProxyConfig *cfg; @@ -35,6 +36,13 @@ int main(int argc , char *argv[]){ if (argc>3 && strcmp(argv[3],"--escape-plus")==0) linphone_proxy_config_set_dial_escape_plus(cfg,TRUE); linphone_proxy_config_normalize_number(cfg,argv[1],normalized_number,sizeof(normalized_number)); + printf("Normalized number is %s\n",normalized_number); + /*check extracted ccc*/ + if (linphone_dial_plan_lookup_ccc_from_e164(normalized_number) != atoi(linphone_proxy_config_get_dial_prefix(cfg))) { + printf("Error ccc [%i] not correctly parsed\n",linphone_dial_plan_lookup_ccc_from_e164(normalized_number)); + } else { + printf("Extracted ccc is [%i] \n",linphone_dial_plan_lookup_ccc_from_e164(normalized_number)); + } return 0; } From 17c6593abc5bff8e8de850cbf96184c296a34d4f Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 26 Nov 2012 10:51:50 +0100 Subject: [PATCH 40/52] Add getter for zrtp_secrets_file, static_picture and root_ca --- coreapi/linphonecore.c | 25 +++++++++++++++++++++++++ coreapi/linphonecore.h | 6 ++++-- coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 4 ++++ mediastreamer2 | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 01667ebcb..0db7894b9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3659,6 +3659,17 @@ void linphone_core_set_root_ca(LinphoneCore *lc,const char *path){ sal_set_root_ca(lc->sal, path); } +/** + * Gets the path to a file or folder containing trusted root CAs (PEM format) + * + * @param lc The LinphoneCore object + * + * @ingroup media_parameters +**/ +const char *linphone_core_get_root_ca(LinphoneCore *lc){ + return sal_get_root_ca(lc->sal); +} + /** * Specify whether the tls server certificate must be verified when connecting to a SIP/TLS server. **/ @@ -4189,6 +4200,16 @@ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path) { return 0; } +const char *linphone_core_get_static_picture(LinphoneCore *lc) { + const char *path=NULL; +#ifdef VIDEO_ENABLED + path=ms_static_image_get_default_image(); +#else + ms_warning("Video support not compiled."); +#endif + return path; +} + int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps) { #ifdef VIDEO_ENABLED VideoStream *vs = NULL; @@ -5185,6 +5206,10 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL; } +const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc){ + return lc->zrtp_secrets_cache; +} + const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri) { if (uri == NULL) return NULL; MSList *calls=lc->calls; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index f3aa76253..f0cf69532 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1214,6 +1214,7 @@ void linphone_core_set_ring(LinphoneCore *lc, const char *path); const char *linphone_core_get_ring(const LinphoneCore *lc); void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno); void linphone_core_set_root_ca(LinphoneCore *lc, const char *path); +const char *linphone_core_get_root_ca(LinphoneCore *lc); void linphone_core_set_ringback(LinphoneCore *lc, const char *path); const char * linphone_core_get_ringback(const LinphoneCore *lc); @@ -1282,8 +1283,9 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc); int linphone_core_set_video_device(LinphoneCore *lc, const char *id); const char *linphone_core_get_video_device(const LinphoneCore *lc); -/* Set static picture to be used when "Static picture" is the video device */ +/* Set and get static picture to be used when "Static picture" is the video device */ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path); +const char *linphone_core_get_static_picture(LinphoneCore *lc); /* Set and get frame rate for static picture */ int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps); @@ -1387,7 +1389,7 @@ void linphone_core_refresh_registers(LinphoneCore* lc); /* Path to the file storing secrets cache */ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file); - +const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc); const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri); diff --git a/coreapi/sal.h b/coreapi/sal.h index e5eb1c190..daa59217a 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -356,6 +356,7 @@ void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec); void sal_use_rport(Sal *ctx, bool_t use_rports); void sal_use_101(Sal *ctx, bool_t use_101); void sal_set_root_ca(Sal* ctx, const char* rootCa); +const char *sal_get_root_ca(Sal* ctx); void sal_verify_server_certificates(Sal *ctx, bool_t verify); int sal_iterate(Sal *sal); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 0363ddb2b..8dbf0173b 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -486,6 +486,10 @@ void sal_set_root_ca(Sal* ctx, const char* rootCa) { set_tls_options(ctx); } +const char *sal_get_root_ca(Sal* ctx) { + return ctx->rootCa; +} + void sal_verify_server_certificates(Sal *ctx, bool_t verify){ ctx->verify_server_certs=verify; #ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE diff --git a/mediastreamer2 b/mediastreamer2 index 55a86251d..07779d3e2 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 55a86251dd3dd6516f5ecef45a39371826f69c9a +Subproject commit 07779d3e25a58b7d252338cd0c327f1f7d9d5e6b From 0eb1172b2da375be499e93d2bb9ecf8779535ed1 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 26 Nov 2012 14:59:56 +0100 Subject: [PATCH 41/52] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 07779d3e2..7a58421b8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 07779d3e25a58b7d252338cd0c327f1f7d9d5e6b +Subproject commit 7a58421b895e6fbe17306e65467e716f6ba471f2 From 4315fafad9ebe1ccb0795a2c6c2997567e61c466 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 27 Nov 2012 13:39:46 +0100 Subject: [PATCH 42/52] Update oRTP and ms2 submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7a58421b8..e72a79873 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7a58421b895e6fbe17306e65467e716f6ba471f2 +Subproject commit e72a79873f6f04dd27829b49c60946cd86031c6c diff --git a/oRTP b/oRTP index 88ace8adf..0391dc349 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 88ace8adfecde4d03ea9030d625f6949f4f5fab4 +Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c From c6bd038a6d2dcb179f643eaae6bcb8daf34a0976 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 27 Nov 2012 14:44:07 +0100 Subject: [PATCH 43/52] implement manual low banwdwidth mode. It is also possible to check whether peer is under low bandwidth by looking into the linphone_call_get_remote_params() --- coreapi/linphonecall.c | 31 ++++++++++++++++++++++++++++--- coreapi/linphonecore.h | 9 ++------- coreapi/misc.c | 24 +++++++++++++++++------- coreapi/private.h | 3 ++- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index aa5075ddf..089e7b809 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -219,9 +219,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall * SalMediaDescription *md=sal_media_description_new(); bool_t keep_srtp_keys=lp_config_get_int(lc->config,"sip","keep_srtp_keys",0); - if (call->ping_time>0) { - linphone_core_adapt_to_network(lc,call->ping_time,&call->params); - } + linphone_core_adapt_to_network(lc,call->ping_time,&call->params); md->session_id=(old_md ? old_md->session_id : (rand() & 0xfff)); md->session_ver=(old_md ? (old_md->session_ver+1) : (rand() & 0xfff)); @@ -746,6 +744,11 @@ const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){ }else if (vsd){ cp->has_video=is_video_active(vsd); } + if (!cp->has_video){ + if (md->bandwidth>0 && md->bandwidth<=linphone_core_get_edge_bw(call->core)){ + cp->low_bandwidth=TRUE; + } + } return cp; } } @@ -925,9 +928,31 @@ const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallP return cp->video_codec; } +/** + * @ingroup call_control + * Use to know if this call has been configured in low bandwidth mode. + * This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file. + * An application that would have reliable way to know network capacity may not use activate_edge_workarounds=1 but instead manually configure + * low bandwidth mode with linphone_call_params_enable_low_bandwidth(). + *
When enabled, this param may transform a call request with video in audio only mode. + * @return TRUE if low bandwidth has been configured/detected + */ bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) { return cp->low_bandwidth; } + +/** + * @ingroup call_control + * Indicate low bandwith mode. + * Configuring a call to low bandwidth mode will result in the core to activate several settings for the call in order to ensure that bitrate usage + * is lowered to the minimum possible. Typically, ptime (packetization time) will be increased, audio codec's output bitrate will be targetted to 20kbit/s provided + * that it is achievable by the codec selected after SDP handshake. Video is automatically disabled. + * +**/ +void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled){ + cp->low_bandwidth=TRUE; +} + /** * Returns whether video is enabled. **/ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index f0cf69532..771ddff64 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -204,14 +204,9 @@ bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp); void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw); void linphone_call_params_destroy(LinphoneCallParams *cp); -/** - * @ingroup call_control - * Use to know if this call has been configured in low bandwidth mode. - * This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file - *
When enabled, this param may transform a call request with video in audio only mode. - * @return TRUE if low bandwidth has been configured/detected - */ bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp); +void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled); + /** * Enum describing failure reasons. * @ingroup initializing diff --git a/coreapi/misc.c b/coreapi/misc.c index b9176ebd4..d75722138 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -574,21 +574,31 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ return -1; } +int linphone_core_get_edge_bw(LinphoneCore *lc){ + int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",20); + return edge_bw; +} + +int linphone_core_get_edge_ptime(LinphoneCore *lc){ + int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100); + return edge_ptime; +} + void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params){ - if (lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){ + if (ping_time_ms>0 && lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){ ms_message("Stun server ping time is %i ms",ping_time_ms); int threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500); if (ping_time_ms>threshold){ - int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100); - int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",20); - /* we are in a 2G network*/ - params->up_bw=params->down_bw=edge_bw; - params->up_ptime=params->down_ptime=edge_ptime; - params->has_video=FALSE; + /* we might be in a 2G network*/ params->low_bandwidth=TRUE; }/*else use default settings */ } + if (params->low_bandwidth){ + params->up_bw=params->down_bw=linphone_core_get_edge_bw(lc); + params->up_ptime=params->down_ptime=linphone_core_get_edge_ptime(lc); + params->has_video=FALSE; + } } diff --git a/coreapi/private.h b/coreapi/private.h index 5ebe8b5b7..925a30360 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -639,7 +639,8 @@ void _linphone_core_codec_config_write(LinphoneCore *lc); #endif void call_logs_write_to_config_file(LinphoneCore *lc); - +int linphone_core_get_edge_bw(LinphoneCore *lc); +int linphone_core_get_edge_ptime(LinphoneCore *lc); #ifdef __cplusplus } From 5b46fa5d4235c2f440cfa34819112c4fd85a826e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 29 Nov 2012 10:01:28 +0100 Subject: [PATCH 44/52] fix readme for zrtpcpp --- README.macos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.macos b/README.macos index aecd2922f..1648a3135 100644 --- a/README.macos +++ b/README.macos @@ -28,7 +28,7 @@ You need: - Install zrtpcpp (optional), for unbreakable call encryption $ port install cmake $ git clone git://git.linphone.org/zrtpcpp.git - $ cd zrtpcpp && cmake -Denable_ccrtp=false . && make + $ cd zrtpcpp && cmake -Denable-ccrtp=false . && make $ sudo make install - Install gtk. It is recommended to use the quartz backend for better integration. From 019c6f1c5589f7e5440f5daccc72e761e69c23b5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 29 Nov 2012 16:40:14 +0100 Subject: [PATCH 45/52] Added SIPINFO/Rfc2833 JNI glue --- coreapi/linphonecore_jni.cc | 8 ++++++++ java/common/org/linphone/core/LinphoneCore.java | 10 ++++++++++ java/impl/org/linphone/core/LinphoneCoreImpl.java | 10 ++++++++++ 3 files changed, 28 insertions(+) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 03d5c0df0..46b04be9c 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1869,6 +1869,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEn linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw); } +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ + linphone_core_set_use_info_for_dtmf((LinphoneCore *)lc, (bool) use); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ + linphone_core_set_use_rfc2833_for_dtmf((LinphoneCore *)lc, (bool) use); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadPtime(JNIEnv *env, jobject thiz, jlong lc, jint ptime){ linphone_core_set_download_ptime((LinphoneCore *)lc, (int) ptime); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 450091843..c1da356bb 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -856,4 +856,14 @@ public interface LinphoneCore { * Set username and display name to use if no LinphoneProxyConfig configured */ void setPrimaryContact(String displayName, String username); + + /** + * Enable/Disable the use of SIP INFO for DTMFs + */ + void setUseSipInfoForDtmfs(boolean use); + + /** + * Enable/Disable the use of inband DTMFs + */ + void setUseRfc2833ForDtmfs(boolean use); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 5e6864559..c00c9a37c 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -798,4 +798,14 @@ class LinphoneCoreImpl implements LinphoneCore { public void setPrimaryContact(String displayName, String username) { setPrimaryContact(nativePtr, displayName, username); } + + private native void setUseSipInfoForDtmfs(long ptr, boolean use); + public void setUseSipInfoForDtmfs(boolean use) { + setUseSipInfoForDtmfs(nativePtr, use); + } + + private native void setUseRfc2833ForDtmfs(long ptr, boolean use); + public void setUseRfc2833ForDtmfs(boolean use) { + setUseRfc2833ForDtmfs(nativePtr, use); + } } From 07c4120600ac9e7060f619fa2b94a7b29cbe79da Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 29 Nov 2012 16:46:33 +0100 Subject: [PATCH 46/52] Fix typo mistake --- coreapi/linphonecore_jni.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 46b04be9c..1f924497b 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1869,11 +1869,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEn linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){ linphone_core_set_use_info_for_dtmf((LinphoneCore *)lc, (bool) use); } -extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jbool use){ +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){ linphone_core_set_use_rfc2833_for_dtmf((LinphoneCore *)lc, (bool) use); } From 8648c08a0d446ed690ec5298d0f07d3945810d3d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 29 Nov 2012 17:21:27 +0100 Subject: [PATCH 47/52] update ortp and ms2, and set rfc2833 the default --- coreapi/linphonecore.c | 2 +- mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0db7894b9..998fd9ec9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -527,7 +527,7 @@ static void sip_config_read(LinphoneCore *lc) sal_reuse_authorization(lc->sal, lp_config_get_int(lc->config,"sip","reuse_authorization",0)); sal_expire_old_registration_contacts(lc->sal,lp_config_get_int(lc->config,"sip","expire_old_registration_contacts",0)); - tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",0); + tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",1); linphone_core_set_use_rfc2833_for_dtmf(lc,tmp); ipv6=lp_config_get_int(lc->config,"sip","use_ipv6",-1); diff --git a/mediastreamer2 b/mediastreamer2 index e72a79873..e613ba002 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e72a79873f6f04dd27829b49c60946cd86031c6c +Subproject commit e613ba002020f8862bf141a676bcff8d868d7160 diff --git a/oRTP b/oRTP index 0391dc349..0d318ef47 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c +Subproject commit 0d318ef477b40f72b5838a836ddccc0e055c0719 From f5464e17d9b7562513408e6d718394242912dd6a Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 29 Nov 2012 17:23:30 +0100 Subject: [PATCH 48/52] Update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e72a79873..5ce886301 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e72a79873f6f04dd27829b49c60946cd86031c6c +Subproject commit 5ce886301c0408e4779513b4af5291c38e6aef7f From 43c255f7fbde840700d17a03c9dc69c026cca5bd Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 3 Dec 2012 14:48:05 +0100 Subject: [PATCH 49/52] fix low bandwidth mode --- coreapi/linphonecall.c | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 089e7b809..f08227905 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -950,7 +950,7 @@ bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) * **/ void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled){ - cp->low_bandwidth=TRUE; + cp->low_bandwidth=enabled; } /** diff --git a/mediastreamer2 b/mediastreamer2 index 5ce886301..aacb8b5f5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5ce886301c0408e4779513b4af5291c38e6aef7f +Subproject commit aacb8b5f50769d3c2d5928ef8511b8906b070217 From a847ea825becae54e60c5c2606b26b9a6ae14892 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 3 Dec 2012 15:01:02 +0100 Subject: [PATCH 50/52] Update ms2 --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index aacb8b5f5..74af68056 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit aacb8b5f50769d3c2d5928ef8511b8906b070217 +Subproject commit 74af680568ced0a5c1ee5593d8dc2e4970b1b6bf diff --git a/oRTP b/oRTP index 0d318ef47..0391dc349 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0d318ef477b40f72b5838a836ddccc0e055c0719 +Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c From 243016a976f22ba31059aced9b5c748edb133e55 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 3 Dec 2012 15:02:21 +0100 Subject: [PATCH 51/52] Update oRTP --- oRTP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oRTP b/oRTP index 0391dc349..0d318ef47 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 0391dc3493e0e834b6b0668767546e95fc3b490c +Subproject commit 0d318ef477b40f72b5838a836ddccc0e055c0719 From dd1fc47a32555491f01a438baa328201ea16bc5d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 4 Dec 2012 10:33:17 +0100 Subject: [PATCH 52/52] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 74af68056..243cc4d3d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 74af680568ced0a5c1ee5593d8dc2e4970b1b6bf +Subproject commit 243cc4d3da14b68bb7d2919c93475c122995dfc7