diff --git a/build/android/common.mk b/build/android/common.mk index c85318ee4..4fa833b59 100644 --- a/build/android/common.mk +++ b/build/android/common.mk @@ -50,13 +50,17 @@ ifndef MY_LOG_DOMAIN MY_LOG_DOMAIN = \"Linphone\" endif +ifndef LINPHONE_VERSION +LINPHONE_VERSION = "Devel" +endif + LOCAL_CFLAGS += \ -D_BYTE_ORDER=_LITTLE_ENDIAN \ -DORTP_INET6 \ -DINET6 \ -DOSIP_MT \ -DENABLE_TRACE \ - -DLINPHONE_VERSION=\"3.4.0\" \ + -DLINPHONE_VERSION=\"$(LINPHONE_VERSION)\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ -DLOG_DOMAIN=$(MY_LOG_DOMAIN) diff --git a/console/linphonec.c b/console/linphonec.c index 7d5c0cdd2..6220a0599 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -346,7 +346,7 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L linphonec_out("Resuming call %i with %s.\n", id, from); break; case LinphoneCallStreamsRunning: - linphonec_out("Media streams established with %s for call %i.\n", from,id); + linphonec_out("Media streams established with %s for call %i (%s).\n", from,id,( linphone_call_params_video_enabled( linphone_call_get_current_params(call)) ? "video":"audio")); break; case LinphoneCallPausing: linphonec_out("Pausing call %i with %s.\n", id, from); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 74ef5487f..5029e34f8 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -518,9 +518,10 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const call->state=cstate; } if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){ - switch(call->reason){ + switch(call->reason){ case LinphoneReasonDeclined: call->log->status=LinphoneCallDeclined; + break; case LinphoneReasonNotAnswered: call->log->status=LinphoneCallMissed; break; @@ -964,6 +965,8 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ audio_stream_enable_noise_gate(audiostream,enabled); } + audio_stream_set_features(audiostream,linphone_core_get_audio_features(lc)); + if (lc->rtptf){ RtpTransport *artp=lc->rtptf->audio_rtp_func(lc->rtptf->audio_rtp_func_data, call->audio_port); RtpTransport *artcp=lc->rtptf->audio_rtcp_func(lc->rtptf->audio_rtcp_func_data, call->audio_port+1); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4e9198dc2..35e158f74 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -485,6 +485,9 @@ static void sound_config_read(LinphoneCore *lc) linphone_core_set_playback_gain_db (lc,gain); linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL)); + + /*just parse requested stream feature once at start to print out eventual errors*/ + linphone_core_get_audio_features(lc); } static void sip_config_read(LinphoneCore *lc) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 10f6108c9..87686d6ff 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -474,6 +474,8 @@ const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj); int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj); bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj); void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj); +const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj); +void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params); struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj); bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg); @@ -718,11 +720,11 @@ typedef struct _LinphoneVTable{ BuddyInfoUpdated buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/ NotifyReceivedCb notify_recv; /**< Other notifications*/ CallStatsUpdated call_stats_updated; /**CallVoidMethod(lcData->listener,lcData->displayStatusId,lcData->core,env->NewStringUTF(message)); + env->CallVoidMethod(lcData->listener,lcData->displayStatusId,lcData->core,message ? env->NewStringUTF(message) : NULL); } static void displayMessageCb(LinphoneCore *lc, const char *message) { @@ -598,6 +598,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable linphone_core_set_network_reachable((LinphoneCore*)lc,isReachable); } +extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReachable( JNIEnv* env + ,jobject thiz + ,jlong lc) { + return linphone_core_is_network_reachabled((LinphoneCore*)lc); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env ,jobject thiz ,jlong lc @@ -1763,3 +1769,8 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoPolicy(JNIEnv *e extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setCpuCountNative(JNIEnv *env, jobject thiz, jint count) { ms_set_cpu_count(count); } + +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/misc.c b/coreapi/misc.c index 34c58f57f..5d56c9b51 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "private.h" +#include "lpconfig.h" #include "mediastreamer2/mediastream.h" #include #include @@ -793,6 +794,37 @@ LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer){ return cfg->magic==linphone_proxy_config_magic ? cfg : NULL; } +unsigned int linphone_core_get_audio_features(LinphoneCore *lc){ + unsigned int ret=0; + const char *features=lp_config_get_string(lc->config,"sound","features",NULL); + if (features){ + char tmp[256]={0}; + char name[256]; + char *p,*n; + strncpy(tmp,features,sizeof(tmp)-1); + for(p=tmp;*p!='\0';p++){ + if (*p==' ') continue; + n=strchr(p,'|'); + if (n) *n='\0'; + sscanf(p,"%s",name); + ms_message("Found audio feature %s",name); + if (strcasecmp(name,"PLC")==0) ret|=AUDIO_STREAM_FEATURE_PLC; + else if (strcasecmp(name,"EC")==0) ret|=AUDIO_STREAM_FEATURE_EC; + else if (strcasecmp(name,"EQUALIZER")==0) ret|=AUDIO_STREAM_FEATURE_EQUALIZER; + else if (strcasecmp(name,"VOL_SND")==0) ret|=AUDIO_STREAM_FEATURE_VOL_SND; + else if (strcasecmp(name,"VOL_RCV")==0) ret|=AUDIO_STREAM_FEATURE_VOL_RCV; + else if (strcasecmp(name,"DTMF")==0) ret|=AUDIO_STREAM_FEATURE_DTMF; + else if (strcasecmp(name,"DTMF_ECHO")==0) ret|=AUDIO_STREAM_FEATURE_DTMF_ECHO; + else if (strcasecmp(name,"ALL")==0) ret|=AUDIO_STREAM_FEATURE_ALL; + else if (strcasecmp(name,"NONE")==0) ret=0; + else ms_error("Unsupported audio feature %s requested in config file.",name); + if (!n) break; + p=n; + } + }else ret=AUDIO_STREAM_FEATURE_ALL; + return ret; +} + #ifdef HAVE_GETIFADDRS @@ -916,7 +948,6 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){ - void _linphone_core_configure_resolver(){ /*bionic declares _res but does not define nor export it !!*/ #ifdef ANDROID diff --git a/coreapi/private.h b/coreapi/private.h index 5c253b765..a68615e36 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -284,6 +284,7 @@ struct _LinphoneProxyConfig char *reg_identity; char *reg_route; char *realm; + char *contact_params; int expires; int reg_time; SalOp *op; @@ -580,6 +581,7 @@ void linphone_call_remove_from_conf(LinphoneCall *call); void linphone_core_conference_check_uninit(LinphoneCore *lc); bool_t linphone_core_sound_resources_available(LinphoneCore *lc); void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall); +unsigned int linphone_core_get_audio_features(LinphoneCore *lc); void __linphone_core_invalidate_registers(LinphoneCore* lc); void _linphone_core_codec_config_write(LinphoneCore *lc); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 1676e0918..8e066ea33 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -256,9 +256,10 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){ if (proxy==NULL) return NULL; host=linphone_address_get_domain (proxy); if (host!=NULL){ - LinphoneAddress *contact; char localip[LINPHONE_IPADDR_SIZE]; + char *tmp; LCSipTransports tr; + LinphoneAddress *contact; linphone_core_get_local_ip(obj->lc,host,localip); contact=linphone_address_new(obj->reg_identity); @@ -274,8 +275,12 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){ sal_address_set_param(contact,"transport","tls"); } } - ret=linphone_address_as_string(contact); + tmp=linphone_address_as_string_uri_only(contact); + if (obj->contact_params) + ret=ms_strdup_printf("<%s;%s>",tmp,obj->contact_params); + else ret=ms_strdup_printf("<%s>",tmp); linphone_address_destroy(contact); + ms_free(tmp); } linphone_address_destroy (proxy); return ret; @@ -511,6 +516,31 @@ bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj){ return obj->reg_sendregister; } +/** + * Set optional contact parameters that will be added to the contact information sent in the registration. + * @param obj the proxy config object + * @param contact_params a string contaning the additional parameters in text form, like "myparam=something;myparam2=something_else" + * + * The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or apple push id. + * As an example, the contact address in the SIP register sent will look like . +**/ +void linphone_proxy_config_set_contact_parameters(LinphoneProxyConfig *obj, const char *contact_params){ + if (obj->contact_params) { + ms_free(obj->contact_params); + obj->contact_params=NULL; + } + if (contact_params){ + obj->contact_params=ms_strdup(contact_params); + } +} + +/** + * Returns previously set contact parameters. +**/ +const char *linphone_proxy_config_get_contact_parameters(const LinphoneProxyConfig *obj){ + return obj->contact_params; +} + struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj){ return obj->lc; } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 6f0ce2c65..e06342178 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -784,4 +784,8 @@ public interface LinphoneCore { */ public void refreshRegisters(); + /** + * return the version code of linphone core + */ + public String getVersion(); } diff --git a/mediastreamer2 b/mediastreamer2 index 3ad17dab4..b72c14600 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3ad17dab4138c1a4fa1536388caced23a5610e6a +Subproject commit b72c14600003707dce7abd0c1003bd51a0d033c1