Merge remote-tracking branch 'public/master' into dev_lime

This commit is contained in:
Guillaume BIENKOWSKI 2015-02-27 11:31:21 +01:00
commit e93b6c0443
8 changed files with 147 additions and 25 deletions

View file

@ -852,6 +852,9 @@ if test x$enable_msg_storage != xfalse; then
fi
if test "$found_sqlite" = "yes"; then
SQLITE3_CFLAGS+="-DMSG_STORAGE_ENABLED"
if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
SQLITE3_LIBS+=" -liconv"
fi
enable_msg_storage=true
else
if test x$enable_msg_storage = xtrue; then

View file

@ -1639,6 +1639,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTy
return jCodecs;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
int codecsCount = env->GetArrayLength(jCodecs);
jlong *codecs = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++) {
PayloadType *pt = (PayloadType *)codecs[i];
ms_list_append(pts, pt);
}
linphone_core_set_video_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
}
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env
,jobject thiz
,jlong lc) {
@ -1657,6 +1669,18 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy
return jCodecs;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
int codecsCount = env->GetArrayLength(jCodecs);
jlong *codecs = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++) {
PayloadType *pt = (PayloadType *)codecs[i];
pts = ms_list_append(pts, pt);
}
linphone_core_set_audio_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_enablePayloadType(JNIEnv* env
,jobject thiz
,jlong lc
@ -5861,4 +5885,10 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMultica
return linphone_core_video_multicast_enabled((LinphoneCore*)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableDnsSrv(JNIEnv *env, jobject thiz, jlong lc, jboolean yesno) {
linphone_core_enable_dns_srv((LinphoneCore *)lc, yesno);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_dnsSrvEnabled(JNIEnv *env, jobject thiz, jlong lc) {
return linphone_core_dns_srv_enabled((LinphoneCore *)lc);
}

View file

@ -25,6 +25,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PRIu64 "I64u"
#endif
#ifndef WIN32
#ifndef ANDROID
# include <langinfo.h>
# include <iconv.h>
# include <string.h>
#endif
#else
#include <Windows.h>
#endif
#define MAX_PATH_SIZE 1024
#include "sqlite3.h"
static ORTP_INLINE LinphoneChatMessage* get_transient_message(LinphoneChatRoom* cr, unsigned int storage_id){
@ -579,6 +591,34 @@ void linphone_core_message_storage_set_debug(LinphoneCore *lc, bool_t debug){
}
}
static int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
#ifdef ANDROID
return sqlite3_open(db_file, db);
#elif defined(WIN32)
int ret;
wchar_t db_file_utf16[MAX_PATH_SIZE];
ret = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, db_file, MAX_PATH_SIZE, db_file_utf16, MAX_PATH_SIZE);
if(ret == 0) db_file_utf16[0] = '\0';
return sqlite3_open16(db_file_utf16, db);
#else
char db_file_locale[MAX_PATH_SIZE] = {'\0'};
char db_file_utf8[MAX_PATH_SIZE] = "";
char *inbuf=db_file_locale, *outbuf=db_file_utf8;
size_t inbyteleft = MAX_PATH_SIZE, outbyteleft = MAX_PATH_SIZE;
iconv_t cb;
strncpy(db_file_locale, db_file, MAX_PATH_SIZE-1);
cb = iconv_open("UTF-8", nl_langinfo(CODESET));
if(cb != (iconv_t)-1) {
int ret;
ret = iconv(cb, &inbuf, &inbyteleft, &outbuf, &outbyteleft);
if(ret == -1) db_file_utf8[0] = '\0';
iconv_close(cb);
}
return sqlite3_open(db_file_utf8, db);
#endif
}
void linphone_core_message_storage_init(LinphoneCore *lc){
int ret;
const char *errmsg;
@ -586,7 +626,7 @@ void linphone_core_message_storage_init(LinphoneCore *lc){
linphone_core_message_storage_close(lc);
ret=sqlite3_open(lc->chat_db_file,&db);
ret=_linphone_sqlite3_open(lc->chat_db_file,&db);
if(ret != SQLITE_OK) {
errmsg=sqlite3_errmsg(db);
ms_error("Error in the opening: %s.\n", errmsg);

View file

@ -1127,11 +1127,21 @@ public interface LinphoneCore {
* @return
*/
PayloadType[] getAudioCodecs();
/**
* Set the list of audio codecs.
* @param codecs List of PayloadType objects
*/
void setAudioCodecs(PayloadType[] codecs);
/**
* Returns the currently supported video codecs, as PayloadType elements
* @return
*/
PayloadType[] getVideoCodecs();
/**
* Set the list of video codecs.
* @param codecs List of PayloadType objects
*/
void setVideoCodecs(PayloadType[] codecs);
/**
* enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
*/
@ -2000,7 +2010,17 @@ public interface LinphoneCore {
* @return true if subsequent calls will propose multicast ip set by {@link linphone_core_set_video_multicast_addr}
**/
public boolean videoMulticastEnabled();
/**
* Enable or disable DNS SRV resolution.
* @param yesno true to enable DNS SRV resolution, false to disable it.
*/
public void enableDnsSrv(boolean yesno);
/**
* Tells whether DNS SRV resolution is enabled.
* @return true if DNS SRV resolution is enabled, false if disabled.
*/
public boolean dnsSrvEnabled();
}

View file

@ -114,12 +114,14 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setRing(long nativePtr, String path);
private native String getRing(long nativePtr);
private native void setRootCA(long nativePtr, String path);
private native void setRingback(long nativePtr, String path);
private native void setRingback(long nativePtr, String path);
private native long[] listVideoPayloadTypes(long nativePtr);
private native void setVideoCodecs(long nativePtr, long[] codecs);
private native LinphoneProxyConfig[] getProxyConfigList(long nativePtr);
private native long[] getAuthInfosList(long nativePtr);
private native long findAuthInfos(long nativePtr, String username, String realm, String domain);
private native long[] listAudioPayloadTypes(long nativePtr);
private native void setAudioCodecs(long nativePtr, long[] codecs);
private native void enableKeepAlive(long nativePtr,boolean enable);
private native boolean isKeepAliveEnabled(long nativePtr);
private native int startEchoCalibration(long nativePtr,Object data);
@ -560,6 +562,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return codecs;
}
public synchronized void setVideoCodecs(PayloadType[] codecs) {
long[] typesPtr = new long[codecs.length];
for (int i=0; i < codecs.length; i++) {
typesPtr[i] = ((PayloadTypeImpl)codecs[i]).nativePtr;
}
setVideoCodecs(nativePtr, typesPtr);
}
public synchronized PayloadType[] getAudioCodecs() {
long[] typesPtr = listAudioPayloadTypes(nativePtr);
if (typesPtr == null) return null;
@ -572,6 +581,13 @@ class LinphoneCoreImpl implements LinphoneCore {
return codecs;
}
public synchronized void setAudioCodecs(PayloadType[] codecs) {
long[] typesPtr = new long[codecs.length];
for (int i=0; i < codecs.length; i++) {
typesPtr[i] = ((PayloadTypeImpl)codecs[i]).nativePtr;
}
setAudioCodecs(nativePtr, typesPtr);
}
public synchronized boolean isNetworkReachable() {
return isNetworkStateReachable(nativePtr);
}
@ -1446,4 +1462,15 @@ class LinphoneCoreImpl implements LinphoneCore {
public boolean videoMulticastEnabled() {
return videoMulticastEnabled(nativePtr);
}
private native void enableDnsSrv(long ptr, boolean yesno);
@Override
public void enableDnsSrv(boolean yesno) {
enableDnsSrv(nativePtr, yesno);
}
private native boolean dnsSrvEnabled(long ptr);
@Override
public boolean dnsSrvEnabled() {
return dnsSrvEnabled(nativePtr);
}
}

View file

@ -21,7 +21,7 @@ package org.linphone.core;
class PayloadTypeImpl implements PayloadType {
protected final long nativePtr;
public final long nativePtr;
private native String toString(long ptr);
private native String getMime(long ptr);

@ -1 +1 @@
Subproject commit ebbd1094ef448322c5145fc662d441882735a86f
Subproject commit e35a1e71bdc64bc914b866b1a66815d5e47f8a01

View file

@ -2966,31 +2966,33 @@ static void call_redirect(void){
static void call_established_with_rejected_reinvite_with_error(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
bool_t call_ok=TRUE;
CU_ASSERT_TRUE(call(pauline,marie));
CU_ASSERT_TRUE((call_ok=call(pauline,marie)));
if (call_ok){
linphone_core_enable_payload_type(pauline->lc,linphone_core_find_payload_type(pauline->lc,"PCMA",8000,1),TRUE); /*add PCMA*/
linphone_core_enable_payload_type(pauline->lc,linphone_core_find_payload_type(pauline->lc,"PCMA",8000,1),TRUE); /*add PCMA*/
sal_enable_unconditional_answer(marie->lc->sal,TRUE);
linphone_core_update_call( pauline->lc
,linphone_core_get_current_call(pauline->lc)
,linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)));
sal_enable_unconditional_answer(marie->lc->sal,TRUE);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
linphone_core_update_call( pauline->lc
,linphone_core_get_current_call(pauline->lc)
,linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)));
CU_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(pauline->lc)),LinphoneReasonTemporarilyUnavailable); /*might be change later*/
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallStreamsRunning,1);
check_call_state(pauline,LinphoneCallStreamsRunning);
check_call_state(marie,LinphoneCallStreamsRunning);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_EQUAL(linphone_call_get_reason(linphone_core_get_current_call(pauline->lc)),LinphoneReasonTemporarilyUnavailable); /*might be change later*/
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallStreamsRunning,1);
check_call_state(pauline,LinphoneCallStreamsRunning);
check_call_state(marie,LinphoneCallStreamsRunning);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);