Merge remote-tracking branch 'origin/master' into dev_codec_downloader

This commit is contained in:
Erwan Croze 2016-07-18 15:01:29 +02:00
commit d0c6e9766c
54 changed files with 940 additions and 240 deletions

2
README
View file

@ -47,7 +47,7 @@ libglew1.6-dev libv4l-dev libxml2-dev
libsqlite3-dev libupnp4-dev libsrtp-dev
+ Install zrtp (optional), for unbreakable call encryption
$ git clone git://git.linphone.org:bzrtp
$ git clone git://git.linphone.org/bzrtp.git
$ cd bzrtp && ./autogen.sh && ./configure && make
$ sudo make install

View file

@ -877,6 +877,14 @@ bool_t sal_dns_srv_enabled(const Sal *sal) {
return (bool_t)belle_sip_stack_dns_srv_enabled(sal->stack);
}
void sal_enable_dns_search(Sal *sal, bool_t enable) {
belle_sip_stack_enable_dns_search(sal->stack, (unsigned char)enable);
}
bool_t sal_dns_search_enabled(const Sal *sal) {
return (bool_t)belle_sip_stack_dns_search_enabled(sal->stack);
}
void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file) {
belle_sip_stack_set_dns_user_hosts_file(sal->stack, hosts_file);
}

View file

@ -985,7 +985,7 @@ int sal_call_send_dtmf(SalOp *h, char dtmf){
if (h->dialog && (belle_sip_dialog_get_state(h->dialog) == BELLE_SIP_DIALOG_CONFIRMED || belle_sip_dialog_get_state(h->dialog) == BELLE_SIP_DIALOG_EARLY)){
belle_sip_request_t *req=belle_sip_dialog_create_queued_request(h->dialog,"INFO");
if (req){
int bodylen;
size_t bodylen;
char dtmf_body[128]={0};
snprintf(dtmf_body, sizeof(dtmf_body)-1, "Signal=%c\r\nDuration=250\r\n", dtmf);

View file

@ -115,7 +115,7 @@ static void linphone_carddav_vcards_pulled(LinphoneCardDavContext *cdc, bctbx_li
while (vCards) {
LinphoneCardDavResponse *vCard = (LinphoneCardDavResponse *)vCards->data;
if (vCard) {
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(cdc->friend_list->lc->vcard_context, vCard->vcard);
LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(cdc->friend_list->lc->vcard_context, vCard->vcard);
LinphoneFriend *lf = NULL;
bctbx_list_t *local_friend = NULL;

View file

@ -590,7 +590,7 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag
b64_decode((char *)keyb64, strlen((char *)keyb64), keyBuffer, keyLength);
linphone_content_set_key(
msg->file_transfer_information, (char *)keyBuffer,
keyLength); /* duplicate key value into the linphone content private structure */
strlen((char *)keyBuffer)); /* duplicate key value into the linphone content private structure */
xmlFree(keyb64);
free(keyBuffer);
}

View file

@ -441,18 +441,38 @@ static void linphone_chat_process_response_from_get_file(void *data, const belle
int code = belle_http_response_get_status_code(event->response);
if (code == 200) {
LinphoneCore *lc = msg->chat_room->lc;
/* if the file was encrypted, finish the decryption and free context */
if (linphone_content_get_key(msg->file_transfer_information) != NULL) {
lime_decryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information), NULL, 0,
NULL, NULL);
}
/* file downloaded succesfully, call again the callback with size at zero */
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
LinphoneBuffer *lb = linphone_buffer_new();
linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information,
lb);
linphone_buffer_unref(lb);
if (msg->file_transfer_filepath == NULL) {
/* if the file was encrypted, finish the decryption and free context */
if (linphone_content_get_key(msg->file_transfer_information) != NULL) {
lime_decryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information), NULL, 0, NULL, NULL);
}
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
LinphoneBuffer *lb = linphone_buffer_new();
linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)(msg, msg->file_transfer_information, lb);
linphone_buffer_unref(lb);
} else {
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, NULL, 0);
}
} else {
if (linphone_content_get_key(msg->file_transfer_information) != NULL) {
bctbx_vfs_t *vfs = bctbx_vfs_get_default();
bctbx_vfs_file_t *decrypted_file;
bctbx_vfs_file_t *encrypted_file = bctbx_file_open(vfs, msg->file_transfer_filepath, "r");
int64_t encrypted_file_size = bctbx_file_size(encrypted_file);
char *encrypted_content = bctbx_malloc(encrypted_file_size);
char *decrypted_content = bctbx_malloc(encrypted_file_size);
bctbx_file_read(encrypted_file, encrypted_content, encrypted_file_size, 0);
bctbx_file_close(encrypted_file);
lime_decryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information),
(unsigned char *)linphone_content_get_key(msg->file_transfer_information),
encrypted_file_size, decrypted_content, encrypted_content);
lime_decryptFile(linphone_content_get_cryptoContext_address(msg->file_transfer_information), NULL, 0, NULL, NULL);
decrypted_file = bctbx_file_open(vfs, msg->file_transfer_filepath, "w");
bctbx_file_write(decrypted_file, decrypted_content, encrypted_file_size, 0);
bctbx_file_close(decrypted_file);
bctbx_free(encrypted_content);
bctbx_free(decrypted_content);
}
linphone_core_notify_file_transfer_recv(lc, msg, msg->file_transfer_information, NULL, 0);
}
linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);

View file

@ -112,7 +112,7 @@ public:
bool microphoneIsMuted() const {return m_isMuted;}
float getInputVolume() const;
virtual int getSize() const {return m_participants.size() + (isIn()?1:0);}
virtual int getSize() const {return (int)m_participants.size() + (isIn()?1:0);}
const std::list<Participant *> &getParticipants() const {return m_participants;}
virtual int startRecording(const char *path) = 0;

View file

@ -39,12 +39,15 @@ extern "C" {
/**
* LinphoneConference class
* The _LinphoneConference struct does not exists, it's the Conference C++ class that is used behind
*/
typedef struct _LinphoneConference LinphoneConference;
/**
* Parameters for initialization of conferences
* The _LinphoneConferenceParams struct does not exists, it's the ConferenceParams C++ class that is used behind
*/
typedef struct _LinphoneCorferenceParams LinphoneConferenceParams;
typedef struct _LinphoneConferenceParams LinphoneConferenceParams;

View file

@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static char *create_enum_domain(const char *number){
size_t len=strlen(number);
long len=(long)strlen(number);
char *domain=ms_malloc((len*2)+10);
long i,j;

View file

@ -1256,7 +1256,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
LinphoneVcard *vcard = NULL;
unsigned int storage_id = (unsigned int)atoi(argv[0]);
vcard = linphone_vcard_new_from_vcard4_buffer(context, argv[6]);
vcard = linphone_vcard_context_get_vcard_from_buffer(context, argv[6]);
if (vcard) {
linphone_vcard_set_etag(vcard, argv[7]);
linphone_vcard_set_url(vcard, argv[8]);

View file

@ -781,7 +781,7 @@ int linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *lis
return -1;
}
vcards = linphone_vcard_list_from_vcard4_file(list->lc->vcard_context, vcard_file);
vcards = linphone_vcard_context_get_vcard_list_from_file(list->lc->vcard_context, vcard_file);
vcards_iterator = vcards;
if (!vcards) {
ms_error("Failed to parse the file %s", vcard_file);
@ -820,7 +820,7 @@ int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *l
return -1;
}
vcards = linphone_vcard_list_from_vcard4_buffer(list->lc->vcard_context, vcard_buffer);
vcards = linphone_vcard_context_get_vcard_list_from_buffer(list->lc->vcard_context, vcard_buffer);
vcards_iterator = vcards;
if (!vcards) {
ms_error("Failed to parse the buffer");

View file

@ -588,7 +588,7 @@ int lime_createMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_t
lime_strToUint8(selfZid, selfZidHex, 24);
/* encrypted message length is plaintext + 16 for tag */
encryptedMessageLength = strlen((char *)message) + 16;
encryptedMessageLength = (uint32_t)strlen((char *)message) + 16;
/* retrieve keys associated to the peer URI */
associatedKeys.peerURI = (uint8_t *)malloc(strlen((char *)peerURI)+1);
@ -626,7 +626,7 @@ int lime_createMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_t
limeKey_t *currentKey = associatedKeys.peerKeys[i];
/* encrypted message include a 16 bytes tag */
uint8_t *encryptedMessage = (uint8_t *)malloc(encryptedMessageLength);
lime_encryptMessage(currentKey, message, strlen((char *)message), selfZid, encryptedMessage);
lime_encryptMessage(currentKey, message, (uint32_t)strlen((char *)message), selfZid, encryptedMessage);
/* add a "msg" node the the output message, doc node is :
* <msg>
* <pzid>peerZID</pzid>
@ -795,7 +795,7 @@ int lime_decryptMultipartMessage(xmlDocPtr cacheBuffer, uint8_t *message, uint8_
/* decrypt the message */
*output = (uint8_t *)malloc(encryptedMessageLength - 16 +1); /* plain message is same length than encrypted one with 16 bytes less for the tag + 1 to add the null termination char */
retval = lime_decryptMessage(&associatedKey, encryptedMessage, encryptedMessageLength, selfZid, *output);
retval = lime_decryptMessage(&associatedKey, encryptedMessage, (uint32_t)encryptedMessageLength, selfZid, *output);
free(encryptedMessage);

View file

@ -603,7 +603,7 @@ static int compress_file(FILE *input_file, COMPRESS_FILE_PTR output_file) {
total_bytes += fwrite(buffer, 1, bytes, output_file);
#endif
}
return total_bytes;
return (int)total_bytes;
}
static int prepare_log_collection_file_to_upload(const char *filename) {
@ -790,6 +790,8 @@ static void net_config_read (LinphoneCore *lc)
}
tmp = lp_config_get_int(lc->config, "net", "dns_srv_enabled", 1);
linphone_core_enable_dns_srv(lc, tmp);
tmp = lp_config_get_int(lc->config, "net", "dns_search_enabled", 1);
linphone_core_enable_dns_search(lc, tmp);
/* This is to filter out unsupported firewall policies */
if (nat_policy_ref == NULL)
@ -799,7 +801,7 @@ static void net_config_read (LinphoneCore *lc)
static void build_sound_devices_table(LinphoneCore *lc){
const char **devices;
const char **old;
int ndev;
size_t ndev;
int i;
const bctbx_list_t *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_card_manager(lc->factory));
ndev=bctbx_list_size(elem);
@ -1369,7 +1371,7 @@ static void codecs_config_read(LinphoneCore *lc){
static void build_video_devices_table(LinphoneCore *lc){
const bctbx_list_t *elem;
int i;
int ndev;
size_t ndev;
const char **devices;
if (lc->video_conf.cams)
ms_free((void *)lc->video_conf.cams);
@ -1523,6 +1525,16 @@ bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc) {
return sal_dns_srv_enabled(lc->sal);
}
void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable) {
sal_enable_dns_search(lc->sal, enable);
if (linphone_core_ready(lc))
lp_config_set_int(lc->config, "net", "dns_search_enabled", enable ? 1 : 0);
}
bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc) {
return sal_dns_search_enabled(lc->sal);
}
int linphone_core_get_download_bandwidth(const LinphoneCore *lc){
return lc->net_conf.download_bw;
}
@ -5390,7 +5402,7 @@ void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *cl) {
void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
bctbx_list_t *logs_to_migrate = NULL;
LpConfig *lpc = NULL;
int original_logs_count, migrated_logs_count;
size_t original_logs_count, migrated_logs_count;
int i;
#ifndef SQLITE_STORAGE_ENABLED
@ -5423,7 +5435,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
logs_to_migrate = lc->call_logs;
lc->call_logs = NULL;
// We can't use bctbx_list_for_each because logs_to_migrate are listed in the wrong order (latest first), and we want to store the logs latest last
for (i = bctbx_list_size(logs_to_migrate) - 1; i >= 0; i--) {
for (i = (int)bctbx_list_size(logs_to_migrate) - 1; i >= 0; i--) {
LinphoneCallLog *log = (LinphoneCallLog *) bctbx_list_nth_data(logs_to_migrate, i);
linphone_core_store_call_log(lc, log);
}
@ -5431,17 +5443,17 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
original_logs_count = bctbx_list_size(logs_to_migrate);
migrated_logs_count = bctbx_list_size(lc->call_logs);
if (original_logs_count == migrated_logs_count) {
int i = 0;
size_t i = 0;
ms_debug("call logs migration successful: %u logs migrated", (unsigned int)bctbx_list_size(lc->call_logs));
lp_config_set_int(lpc, "misc", "call_logs_migration_done", 1);
for (; i < original_logs_count; i++) {
char logsection[32];
snprintf(logsection, sizeof(logsection), "call_log_%i", i);
snprintf(logsection, sizeof(logsection), "call_log_%u", (unsigned int)i);
lp_config_clean_section(lpc, logsection);
}
} else {
ms_error("not as many logs saved in db has logs read from rc (%i in rc against %i in db)!", original_logs_count, migrated_logs_count);
ms_error("not as many logs saved in db has logs read from rc ("FORMAT_SIZE_T" in rc against "FORMAT_SIZE_T" in db)!", original_logs_count, migrated_logs_count);
}
bctbx_list_free_with_data(logs_to_migrate, (void (*)(void*))linphone_call_log_unref);
@ -6895,7 +6907,7 @@ void linphone_core_destroy(LinphoneCore *lc){
* @ingroup call_control
**/
int linphone_core_get_calls_nb(const LinphoneCore *lc){
return bctbx_list_size(lc->calls);;
return (int)bctbx_list_size(lc->calls);
}
/**

View file

@ -2754,6 +2754,22 @@ LINPHONE_PUBLIC void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enabl
*/
LINPHONE_PUBLIC bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc);
/**
* Enable or disable DNS search (use of local domain if the fully qualified name did return results).
* @param[in] lc #LinphoneCore object.
* @param[in] enable TRUE to enable DNS search, FALSE to disable it.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable);
/**
* Tells whether DNS search (use of local domain if the fully qualified name did return results) is enabled.
* @param[in] lc #LinphoneCore object.
* @return TRUE if DNS search is enabled, FALSE if disabled.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc);
/**
* Forces liblinphone to use the supplied list of dns servers, instead of system's ones.
* @param[in] lc #LinphoneCore object.

View file

@ -282,16 +282,19 @@ public:
chatRoomClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneChatRoomImpl"));
chatRoomCtrId = env->GetMethodID(chatRoomClass,"<init>", "(J)V");
friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl"));;
friendClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendImpl"));
friendCtrId = env->GetMethodID(friendClass,"<init>", "(J)V");
friendListClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendListImpl"));;
friendListClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendListImpl"));
friendListCtrId = env->GetMethodID(friendListClass,"<init>", "(J)V");
friendListCreatedId = env->GetMethodID(listenerClass, "friendListCreated", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriendList;)V");
friendListRemovedId = env->GetMethodID(listenerClass, "friendListRemoved", "(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriendList;)V");
friendListSyncStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneFriendList$State"));
friendListSyncStateFromIntId = env->GetStaticMethodID(friendListSyncStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneFriendList$State;");
natPolicyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneNatPolicyImpl"));
natPolicyCtrId = env->GetMethodID(natPolicyClass, "<init>", "(J)V");
addressClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneAddressImpl"));
addressCtrId = env->GetMethodID(addressClass,"<init>", "(J)V");
@ -412,6 +415,9 @@ public:
jclass friendListSyncStateClass;
jmethodID friendListSyncStateFromIntId;
jclass natPolicyClass;
jmethodID natPolicyCtrId;
jclass addressClass;
jmethodID addressCtrId;
@ -599,6 +605,29 @@ jobject getFriendList(JNIEnv *env, LinphoneFriendList *lfriendList){
return jobj;
}
jobject getNatPolicy(JNIEnv *env, LinphoneNatPolicy *lNatPolicy) {
jobject jobj = 0;
if (lNatPolicy != NULL) {
LinphoneCore *lc = lNatPolicy->lc;
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
void *up = linphone_nat_policy_get_user_data(lNatPolicy);
if (up == NULL) {
jobj = env->NewObject(ljb->natPolicyClass, ljb->natPolicyCtrId, (jlong)lNatPolicy);
linphone_nat_policy_set_user_data(lNatPolicy, (void *)env->NewWeakGlobalRef(jobj));
linphone_nat_policy_ref(lNatPolicy);
} else {
jobj = env->NewLocalRef((jobject)up);
if (jobj == NULL) {
jobj = env->NewObject(ljb->natPolicyClass, ljb->natPolicyCtrId, (jlong)lNatPolicy);
linphone_nat_policy_set_user_data(lNatPolicy, (void *)env->NewWeakGlobalRef(jobj));
}
}
}
return jobj;
}
jobject getEvent(JNIEnv *env, LinphoneEvent *lev){
if (lev==NULL) return NULL;
jobject jev=(jobject)linphone_event_get_user_data(lev);
@ -1431,7 +1460,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addListener(JNIEnv* env,
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeListener(JNIEnv* env, jobject thiz, jlong lc, jobject jlistener) {
MSList* iterator;
bctbx_list_t* iterator;
LinphoneCore *core = (LinphoneCore*)lc;
//jobject listener = env->NewGlobalRef(jlistener);
for (iterator = core->vtable_refs; iterator != NULL; ) {
@ -1563,12 +1592,12 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getDefaultProxyConfig
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigList(JNIEnv* env, jobject thiz, jlong lc) {
const MSList* proxies = linphone_core_get_proxy_config_list((LinphoneCore*)lc);
int proxyCount = ms_list_size(proxies);
const bctbx_list_t* proxies = linphone_core_get_proxy_config_list((LinphoneCore*)lc);
size_t proxyCount = bctbx_list_size(proxies);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data((LinphoneCore *)lc);
jobjectArray jProxies = env->NewObjectArray(proxyCount,ljb->proxyClass,NULL);
for (int i = 0; i < proxyCount; i++ ) {
for (size_t i = 0; i < proxyCount; i++ ) {
LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)proxies->data;
jobject jproxy = getProxy(env,proxy,thiz);
if(jproxy != NULL){
@ -1598,12 +1627,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeAuthInfo(JNIEnv* e
}
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getAuthInfosList(JNIEnv* env, jobject thiz,jlong lc) {
const MSList* authInfos = linphone_core_get_auth_info_list((LinphoneCore*)lc);
int listCount = ms_list_size(authInfos);
const bctbx_list_t* authInfos = linphone_core_get_auth_info_list((LinphoneCore*)lc);
size_t listCount = bctbx_list_size(authInfos);
jlongArray jAuthInfos = env->NewLongArray(listCount);
jlong *jInternalArray = env->GetLongArrayElements(jAuthInfos, NULL);
for (int i = 0; i < listCount; i++ ) {
for (size_t i = 0; i < listCount; i++ ) {
jInternalArray[i] = (unsigned long) (authInfos->data);
authInfos = authInfos->next;
}
@ -1750,12 +1779,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCallLog( JNIEnv* en
,jobject thiz
,jlong lc
,jint position) {
return (jlong)ms_list_nth_data(linphone_core_get_call_logs((LinphoneCore*)lc),position);
return (jlong)bctbx_list_nth_data(linphone_core_get_call_logs((LinphoneCore*)lc),position);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getNumberOfCallLogs( JNIEnv* env
,jobject thiz
,jlong lc) {
return (jint)ms_list_size(linphone_core_get_call_logs((LinphoneCore*)lc));
return (jint)bctbx_list_size(linphone_core_get_call_logs((LinphoneCore*)lc));
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getLastOutgoingCallLog( JNIEnv* env
,jobject thiz
@ -1901,12 +1930,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findPayloadType(JNIEnv*
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTypes(JNIEnv* env
,jobject thiz
,jlong lc) {
const MSList* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc);
int codecsCount = ms_list_size(codecs);
const bctbx_list_t* codecs = linphone_core_get_video_codecs((LinphoneCore*)lc);
size_t codecsCount = bctbx_list_size(codecs);
jlongArray jCodecs = env->NewLongArray(codecsCount);
jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++ ) {
for (size_t i = 0; i < codecsCount; i++ ) {
jInternalArray[i] = (unsigned long) (codecs->data);
codecs = codecs->next;
}
@ -1917,12 +1946,12 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listVideoPayloadTy
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
bctbx_list_t *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);
bctbx_list_append(pts, pt);
}
linphone_core_set_video_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
@ -1931,12 +1960,12 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoCodecs(JN
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTypes(JNIEnv* env
,jobject thiz
,jlong lc) {
const MSList* codecs = linphone_core_get_audio_codecs((LinphoneCore*)lc);
int codecsCount = ms_list_size(codecs);
const bctbx_list_t* codecs = linphone_core_get_audio_codecs((LinphoneCore*)lc);
size_t codecsCount = bctbx_list_size(codecs);
jlongArray jCodecs = env->NewLongArray(codecsCount);
jlong *jInternalArray = env->GetLongArrayElements(jCodecs, NULL);
for (int i = 0; i < codecsCount; i++ ) {
for (size_t i = 0; i < codecsCount; i++ ) {
jInternalArray[i] = (unsigned long) (codecs->data);
codecs = codecs->next;
}
@ -1947,12 +1976,12 @@ extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_listAudioPayloadTy
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioCodecs(JNIEnv *env, jobject thiz, jlong lc, jlongArray jCodecs) {
MSList *pts = NULL;
bctbx_list_t *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);
pts = bctbx_list_append(pts, pt);
}
linphone_core_set_audio_codecs((LinphoneCore *)lc, pts);
env->ReleaseLongArrayElements(jCodecs, codecs, 0);
@ -2137,12 +2166,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeFriendList(JNIEnv*
extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JNIEnv* env
,jobject thiz
,jlong lc) {
const MSList* friends = linphone_core_get_friend_list((LinphoneCore*)lc);
int friendsSize = ms_list_size(friends);
const bctbx_list_t* friends = linphone_core_get_friend_list((LinphoneCore*)lc);
size_t friendsSize = bctbx_list_size(friends);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data((LinphoneCore *)lc);
jobjectArray jFriends = env->NewObjectArray(friendsSize,ljb->friendClass,NULL);
for (int i = 0; i < friendsSize; i++) {
for (size_t i = 0; i < friendsSize; i++) {
LinphoneFriend* lfriend = (LinphoneFriend*)friends->data;
jobject jfriend = getFriend(env,lfriend);
if(jfriend != NULL){
@ -2158,12 +2187,12 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendList(JN
extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getFriendLists(JNIEnv* env
,jobject thiz
,jlong lc) {
const MSList* friends = linphone_core_get_friends_lists((LinphoneCore*)lc);
int friendsSize = ms_list_size(friends);
const bctbx_list_t* friends = linphone_core_get_friends_lists((LinphoneCore*)lc);
size_t friendsSize = bctbx_list_size(friends);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data((LinphoneCore *)lc);
jobjectArray jFriends = env->NewObjectArray(friendsSize,ljb->friendListClass,NULL);
for (int i = 0; i < friendsSize; i++) {
for (size_t i = 0; i < friendsSize; i++) {
LinphoneFriendList* lfriend = (LinphoneFriendList*)friends->data;
jobject jfriend = getFriendList(env,lfriend);
if(jfriend != NULL){
@ -2446,6 +2475,27 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMediaEncryptionMandat
linphone_core_set_media_encryption_mandatory((LinphoneCore*)lc, yesno);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isLimeEncryptionAvailable (JNIEnv* env
,jobject thiz
,jlong lc
) {
return (jboolean) linphone_core_lime_available((LinphoneCore*)lc);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getLimeEncryption(JNIEnv* env
,jobject thiz
,jlong lc
) {
return (jint)linphone_core_lime_enabled((LinphoneCore*)lc);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setLimeEncryption(JNIEnv* env
,jobject thiz
,jlong lc
,jint menc) {
linphone_core_enable_lime((LinphoneCore*)lc,(LinphoneLimeState)menc);
}
/*
* Class: org_linphone_core_LinphoneCoreImpl
* Method: disableChat
@ -3117,12 +3167,12 @@ extern "C" jlong Java_org_linphone_core_LinphoneCallImpl_getCallLog( JNIEnv* en
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getCallLogs(JNIEnv* env
,jobject thiz
,jlong lc) {
const MSList *logs = linphone_core_get_call_logs((LinphoneCore *) lc);
int logsCount = ms_list_size(logs);
const bctbx_list_t *logs = linphone_core_get_call_logs((LinphoneCore *) lc);
size_t logsCount = bctbx_list_size(logs);
jlongArray jLogs = env->NewLongArray(logsCount);
jlong *jInternalArray = env->GetLongArrayElements(jLogs, NULL);
for (int i = 0; i < logsCount; i++) {
for (size_t i = 0; i < logsCount; i++) {
jInternalArray[i] = (unsigned long) (logs->data);
logs = logs->next;
}
@ -3496,13 +3546,13 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_addLocalFriend(JNI
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneFriendListImpl_getFriendList(JNIEnv* env, jobject thiz, jlong list) {
const MSList* friends = linphone_friend_list_get_friends((LinphoneFriendList *)list);
int friendsSize = ms_list_size(friends);
const bctbx_list_t* friends = linphone_friend_list_get_friends((LinphoneFriendList *)list);
size_t friendsSize = bctbx_list_size(friends);
LinphoneCore *lc = linphone_friend_list_get_core((LinphoneFriendList *)list);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
jobjectArray jFriends = env->NewObjectArray(friendsSize,ljb->friendClass,NULL);
for (int i = 0; i < friendsSize; i++) {
for (size_t i = 0; i < friendsSize; i++) {
LinphoneFriend* lfriend = (LinphoneFriend*)friends->data;
jobject jfriend = getFriend(env,lfriend);
if(jfriend != NULL){
@ -3526,16 +3576,16 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_updateSubscription
extern "C" jlongArray Java_org_linphone_core_LinphoneFriendImpl_getAddresses(JNIEnv* env
,jobject thiz
,jlong ptr) {
MSList *addresses = linphone_friend_get_addresses((LinphoneFriend*)ptr);
MSList *list = addresses;
int size = ms_list_size(addresses);
bctbx_list_t *addresses = linphone_friend_get_addresses((LinphoneFriend*)ptr);
bctbx_list_t *list = addresses;
size_t size = bctbx_list_size(addresses);
jlongArray jaddresses = env->NewLongArray(size);
jlong *jInternalArray = env->GetLongArrayElements(jaddresses, NULL);
for (int i = 0; i < size; i++) {
for (size_t i = 0; i < size; i++) {
jInternalArray[i] = (unsigned long) (addresses->data);
addresses = ms_list_next(addresses);
addresses = bctbx_list_next(addresses);
}
ms_list_free(list);
bctbx_list_free(list);
env->ReleaseLongArrayElements(jaddresses, jInternalArray, 0);
return jaddresses;
}
@ -3557,16 +3607,16 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_removeAddress(JNIEnv*
extern "C" jobjectArray Java_org_linphone_core_LinphoneFriendImpl_getPhoneNumbers(JNIEnv* env
,jobject thiz
,jlong ptr) {
MSList *phone_numbers = linphone_friend_get_phone_numbers((LinphoneFriend*)ptr);
MSList *list = phone_numbers;
int size = ms_list_size(phone_numbers);
bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers((LinphoneFriend*)ptr);
bctbx_list_t *list = phone_numbers;
size_t size = bctbx_list_size(phone_numbers);
jobjectArray jphonenumbers = env->NewObjectArray(size, env->FindClass("java/lang/String"), env->NewStringUTF(""));
for (int i = 0; i < size; i++) {
for (size_t i = 0; i < size; i++) {
const char *phone = (const char *)phone_numbers->data;
env->SetObjectArrayElement(jphonenumbers, i, env->NewStringUTF(phone));
phone_numbers = ms_list_next(phone_numbers);
phone_numbers = bctbx_list_next(phone_numbers);
}
ms_list_free(list);
bctbx_list_free(list);
return jphonenumbers;
}
@ -3761,15 +3811,15 @@ extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getFriendByAddress(JN
}
}
extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject thiz, jlong ptr, MSList* history) {
extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject thiz, jlong ptr, bctbx_list_t* history) {
LinphoneChatRoom *room = (LinphoneChatRoom *)ptr;
LinphoneCore *lc = linphone_chat_room_get_core(room);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
MSList *list = history;
int historySize = ms_list_size(history);
bctbx_list_t *list = history;
size_t historySize = bctbx_list_size(history);
jobjectArray jHistory = env->NewObjectArray(historySize, ljb->chatMessageClass, NULL);
for (int i = 0; i < historySize; i++) {
for (size_t i = 0; i < historySize; i++) {
LinphoneChatMessage *msg = (LinphoneChatMessage *)history->data;
jobject jmsg = getChatMessage(env, msg);
if (jmsg != NULL) {
@ -3781,7 +3831,7 @@ extern "C" jobjectArray _LinphoneChatRoomImpl_getHistory(JNIEnv* env, jobject th
}
/*getChatMessage() acquired a ref that is "transfered" to the java object. We must drop
* the reference given by linphone_chat_room_get_history_range()*/
ms_list_free_with_data(list, (void (*)(void*))linphone_chat_message_unref);
bctbx_list_free_with_data(list, (void (*)(void*))linphone_chat_message_unref);
return jHistory;
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistoryRange(JNIEnv* env
@ -3789,14 +3839,14 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistoryRa
,jlong ptr
,jint start
,jint end) {
MSList* history = linphone_chat_room_get_history_range((LinphoneChatRoom*)ptr, start, end);
bctbx_list_t* history = linphone_chat_room_get_history_range((LinphoneChatRoom*)ptr, start, end);
return _LinphoneChatRoomImpl_getHistory(env, thiz, ptr, history);
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneChatRoomImpl_getHistory(JNIEnv* env
,jobject thiz
,jlong ptr
,jint limit) {
MSList* history = linphone_chat_room_get_history((LinphoneChatRoom*)ptr, limit);
bctbx_list_t* history = linphone_chat_room_get_history((LinphoneChatRoom*)ptr, limit);
return _LinphoneChatRoomImpl_getHistory(env, thiz, ptr, history);
}
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIEnv* env
@ -4191,12 +4241,12 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getChatRooms(JNI
,jobject thiz
,jlong ptr) {
LinphoneCore *lc = (LinphoneCore*)ptr;
const MSList* chats = linphone_core_get_chat_rooms(lc);
const bctbx_list_t* chats = linphone_core_get_chat_rooms(lc);
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
int chatsSize = ms_list_size(chats);
size_t chatsSize = bctbx_list_size(chats);
jobjectArray jChats = env->NewObjectArray(chatsSize, ljb->chatRoomClass, NULL);
for (int i = 0; i < chatsSize; i++) {
for (size_t i = 0; i < chatsSize; i++) {
LinphoneChatRoom *room = (LinphoneChatRoom *)chats->data;
jobject jroom = getChatRoom(env, room);
if (jroom != NULL) {
@ -4340,6 +4390,21 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getFirewallPolicy(JNIEnv
return (jint)linphone_core_get_firewall_policy((LinphoneCore*)lc);
}
JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_createNatPolicy(JNIEnv *env, jobject thiz, jlong lc) {
LinphoneNatPolicy *nat_policy = linphone_core_create_nat_policy((LinphoneCore *)lc);
return (nat_policy != NULL) ? getNatPolicy(env, nat_policy) : NULL;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setNatPolicy(JNIEnv *env, jobject thiz, jlong lc, jlong jpolicy) {
linphone_core_set_nat_policy((LinphoneCore *)lc, (LinphoneNatPolicy *)jpolicy);
}
JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneCoreImpl_getNatPolicy(JNIEnv *env, jobject thiz, jlong lc) {
LinphoneNatPolicy *nat_policy = linphone_core_get_nat_policy((LinphoneCore *)lc);
return (nat_policy != NULL) ? getNatPolicy(env, nat_policy) : NULL;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setStunServer(JNIEnv *env, jobject thiz, jlong lc, jstring jserver){
const char* server = GetStringUTFChars(env, jserver);
linphone_core_set_stun_server((LinphoneCore*)lc,server);
@ -4901,11 +4966,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateAllCalls(JNIEnv
linphone_core_terminate_all_calls((LinphoneCore *) pCore);
}
extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,jobject thiz,jlong pCore,jint position) {
LinphoneCall* lCall = (LinphoneCall*) ms_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position);
LinphoneCall* lCall = (LinphoneCall*) bctbx_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position);
return getCall(env,lCall);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,jobject thiz,jlong pCore) {
return (jint)ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore));
return (jint)bctbx_list_size(linphone_core_get_calls((LinphoneCore *) pCore));
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) {
@ -5088,11 +5153,11 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_tunnelGetServers
jobjectArray tunnelConfigArray = NULL;
if(tunnel != NULL) {
const MSList *servers = linphone_tunnel_get_servers(tunnel);
const MSList *it;
const bctbx_list_t *servers = linphone_tunnel_get_servers(tunnel);
const bctbx_list_t *it;
int i;
tunnelConfigArray = env->NewObjectArray(ms_list_size(servers), tunnelConfigClass, NULL);
tunnelConfigArray = env->NewObjectArray(bctbx_list_size(servers), tunnelConfigClass, NULL);
for(it = servers, i=0; it != NULL; it = it->next, i++) {
LinphoneTunnelConfig *conf = (LinphoneTunnelConfig *)it->data;
jobject elt = getTunnelConfig(env, conf);
@ -7029,7 +7094,7 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMultica
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setDnsServers(JNIEnv *env, jobject thiz, jlong lc, jobjectArray servers){
MSList *l = NULL;
bctbx_list_t *l = NULL;
if (servers != NULL){
int count = env->GetArrayLength(servers);
@ -7038,13 +7103,13 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setDnsServers(JNI
jstring server = (jstring) env->GetObjectArrayElement(servers, i);
const char *str = GetStringUTFChars(env, server);
if (str){
l = ms_list_append(l, ms_strdup(str));
l = bctbx_list_append(l, ms_strdup(str));
ReleaseStringUTFChars(env, server, str);
}
}
}
linphone_core_set_dns_servers((LinphoneCore*)lc, l);
ms_list_free_with_data(l, ms_free);
bctbx_list_free_with_data(l, ms_free);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableDnsSrv(JNIEnv *env, jobject thiz, jlong lc, jboolean yesno) {
@ -7365,20 +7430,20 @@ extern "C" jboolean Java_org_linphone_core_LinphoneConferenceParamsImpl_isVideoR
extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) {
MSList *participants, *it;
bctbx_list_t *participants, *it;
jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl");
jmethodID addr_constructor = env->GetMethodID(addr_class, "<init>", "(J)V");
jobjectArray jaddr_list;
int i;
participants = linphone_conference_get_participants((LinphoneConference *)pconference);
jaddr_list = env->NewObjectArray(ms_list_size(participants), addr_class, NULL);
for(it=participants, i=0; it; it=ms_list_next(it), i++) {
jaddr_list = env->NewObjectArray(bctbx_list_size(participants), addr_class, NULL);
for(it=participants, i=0; it; it=bctbx_list_next(it), i++) {
LinphoneAddress *addr = (LinphoneAddress *)it->data;
jobject jaddr = env->NewObject(addr_class, addr_constructor, (jlong)addr);
env->SetObjectArrayElement(jaddr_list, i, jaddr);
}
ms_list_free(participants);
bctbx_list_free(participants);
return jaddr_list;
}
@ -7417,3 +7482,81 @@ JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_reloadMsPlugins(J
linphone_core_reload_ms_plugins((LinphoneCore*)pcore, path);
ReleaseStringUTFChars(env, jpath, path);
}
JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_getCore(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneCore *lc = ((LinphoneNatPolicy *)jNatPolicy)->lc;
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
return ljb->getCore();
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_clear(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
linphone_nat_policy_clear(nat_policy);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_stunEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
return (linphone_nat_policy_stun_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableStun(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
linphone_nat_policy_enable_stun(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_turnEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
return (linphone_nat_policy_turn_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableTurn(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
linphone_nat_policy_enable_turn(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_iceEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
return (linphone_nat_policy_ice_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableIce(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
linphone_nat_policy_enable_ice(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_upnpEnabled(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
return (linphone_nat_policy_upnp_enabled(nat_policy) == FALSE) ? JNI_FALSE : JNI_TRUE;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_enableUpnp(JNIEnv *env, jobject thiz, jlong jNatPolicy, jboolean jEnable) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
linphone_nat_policy_enable_upnp(nat_policy, (jEnable == JNI_FALSE) ? FALSE : TRUE);
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_getStunServer(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
const char *stun_server = linphone_nat_policy_get_stun_server(nat_policy);
return (stun_server != NULL) ? env->NewStringUTF(stun_server) : NULL;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_setStunServer(JNIEnv *env, jobject thiz, jlong jNatPolicy, jstring jStunServer) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
const char *stun_server = GetStringUTFChars(env, jStunServer);
linphone_nat_policy_set_stun_server(nat_policy, stun_server);
ReleaseStringUTFChars(env, jStunServer, stun_server);
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_getStunServerUsername(JNIEnv *env, jobject thiz, jlong jNatPolicy) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
const char *stun_server = linphone_nat_policy_get_stun_server_username(nat_policy);
return (stun_server != NULL) ? env->NewStringUTF(stun_server) : NULL;
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneNatPolicyImpl_setStunServerUsername(JNIEnv *env, jobject thiz, jlong jNatPolicy, jstring jStunServerUsername) {
LinphoneNatPolicy *nat_policy = (LinphoneNatPolicy *)jNatPolicy;
const char *stun_server_username = GetStringUTFChars(env, jStunServerUsername);
linphone_nat_policy_set_stun_server_username(nat_policy, stun_server_username);
ReleaseStringUTFChars(env, jStunServerUsername, stun_server_username);
}

View file

@ -1020,7 +1020,7 @@ int lp_config_read_relative_file(const LpConfig *lpconfig, const char *filename,
}
if(bctbx_file_read(pFile, data, 1, max_length) < 0){
if(bctbx_file_read(pFile, data, 1, (off_t)max_length) < 0){
ms_error("%s could not be loaded.", realfilepath);
goto err;
@ -1043,7 +1043,7 @@ err:
const char** lp_config_get_sections_names(LpConfig *lpconfig) {
const char **sections_names;
const bctbx_list_t *sections = lpconfig->sections;
int ndev;
size_t ndev;
int i;
ndev = bctbx_list_size(sections);

View file

@ -138,8 +138,8 @@ static ORTP_INLINE LinphoneChatMessage* get_transient_message(LinphoneChatRoom*
* | 4 | encoding
* | 5 | size
* | 6 | data (currently not stored)
* | 7 | size
* | 8 | size
* | 7 | key size
* | 8 | key
*/
// Callback for sql request when getting linphone content
static int callback_content(void *data, int argc, char **argv, char **colName) {

View file

@ -319,7 +319,7 @@ static ortp_socket_t create_socket(int local_port){
static int send_stun_request(int sock, const struct sockaddr *server, socklen_t addrlen, int id, bool_t change_addr){
char *buf = NULL;
int len;
size_t len;
int err = 0;
MSStunMessage *req = ms_stun_binding_request_create();
UInt96 tr_id = ms_stun_message_get_tr_id(req);
@ -332,7 +332,7 @@ static int send_stun_request(int sock, const struct sockaddr *server, socklen_t
ms_error("Fail to encode stun message.");
err = -1;
} else {
err = sendto(sock, buf, len, 0, server, addrlen);
err = bctbx_sendto(sock, buf, len, 0, server, addrlen);
if (err < 0) {
ms_error("sendto failed: %s",strerror(errno));
err = -1;
@ -905,7 +905,7 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
IceSessionState session_state = ice_session_state(session);
int nb_candidates;
int i;
size_t j;
int j;
bool_t result;
if (session_state == IS_Completed) {
@ -955,7 +955,7 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
stream->ice_mismatch = ice_check_list_is_mismatch(cl);
if ((ice_check_list_state(cl) == ICL_Running) || (ice_check_list_state(cl) == ICL_Completed)) {
memset(stream->ice_candidates, 0, sizeof(stream->ice_candidates));
for (j = 0; j < MIN(bctbx_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) {
for (j = 0; j < MIN((int)bctbx_list_size(cl->local_candidates), SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES); j++) {
SalIceCandidate *sal_candidate = &stream->ice_candidates[nb_candidates];
IceCandidate *ice_candidate = bctbx_list_nth_data(cl->local_candidates, j);
const char *default_addr = NULL;
@ -1748,8 +1748,9 @@ void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id, const char *aud
}
const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc){
const char *config=lp_config_get_string(lc->config,"sip","srtp_crypto_suites","AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_CM_256_HMAC_SHA1_80, AES_CM_256_HMAC_SHA1_32");
const char *config= lp_config_get_string(lc->config, "sip", "srtp_crypto_suites", "AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_256_CM_HMAC_SHA1_80, AES_256_CM_HMAC_SHA1_32");
char *tmp=ms_strdup(config);
char *sep;
char *pos;
char *nextpos;

View file

@ -156,7 +156,7 @@ LINPHONE_PUBLIC void linphone_nat_policy_set_stun_server(LinphoneNatPolicy *poli
LINPHONE_PUBLIC const char * linphone_nat_policy_get_stun_server_username(const LinphoneNatPolicy *policy);
/**
* Seth the username used to authenticate with the STUN/TURN server.
* Set the username used to authenticate with the STUN/TURN server.
* The authentication will search for a LinphoneAuthInfo with this username.
* If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo.
* @param[in] policy LinphoneNatPolicy object

View file

@ -360,7 +360,7 @@ int linphone_presence_model_set_contact(LinphonePresenceModel *model, const char
}
static void presence_model_count_activities(const LinphonePresencePerson *person, unsigned int *nb) {
*nb += bctbx_list_size(person->activities);
*nb += (unsigned int)bctbx_list_size(person->activities);
}
struct _get_activity_st {
@ -371,7 +371,7 @@ struct _get_activity_st {
static void presence_model_get_activity(const LinphonePresencePerson *person, struct _get_activity_st *st) {
if (st->current_idx != (unsigned)-1) {
unsigned int size = bctbx_list_size(person->activities);
unsigned int size = (unsigned int)bctbx_list_size(person->activities);
if (st->requested_idx < (st->current_idx + size)) {
st->activity = (LinphonePresenceActivity *)bctbx_list_nth_data(person->activities, st->requested_idx - st->current_idx);
st->current_idx = (unsigned)-1;
@ -471,10 +471,8 @@ struct _find_note_st {
};
static LinphonePresenceNote * find_presence_note_in_list(bctbx_list_t *list, const char *lang) {
int nb;
int i;
nb = bctbx_list_size(list);
int nb = (int)bctbx_list_size(list);
for (i = 0; i < nb; i++) {
LinphonePresenceNote *note = (LinphonePresenceNote *)bctbx_list_nth_data(list, i);
if (lang == NULL) {
@ -632,7 +630,7 @@ LinphonePresenceModel * linphone_presence_model_new(void) {
}
unsigned int linphone_presence_model_get_nb_services(const LinphonePresenceModel *model) {
return bctbx_list_size(model->services);
return (unsigned int)bctbx_list_size(model->services);
}
LinphonePresenceService * linphone_presence_model_get_nth_service(const LinphonePresenceModel *model, unsigned int idx) {
@ -658,7 +656,7 @@ int linphone_presence_model_clear_services(LinphonePresenceModel *model) {
}
unsigned int linphone_presence_model_get_nb_persons(const LinphonePresenceModel *model) {
return bctbx_list_size(model->persons);
return (unsigned int)bctbx_list_size(model->persons);
}
LinphonePresencePerson * linphone_presence_model_get_nth_person(const LinphonePresenceModel *model, unsigned int idx) {
@ -762,7 +760,7 @@ int linphone_presence_service_set_contact(LinphonePresenceService *service, cons
}
unsigned int linphone_presence_service_get_nb_notes(const LinphonePresenceService *service) {
return bctbx_list_size(service->notes);
return (unsigned int)bctbx_list_size(service->notes);
}
LinphonePresenceNote * linphone_presence_service_get_nth_note(const LinphonePresenceService *service, unsigned int idx) {
@ -815,7 +813,7 @@ int linphone_presence_person_set_id(LinphonePresencePerson *person, const char *
unsigned int linphone_presence_person_get_nb_activities(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
return bctbx_list_size(person->activities);
return (unsigned int)bctbx_list_size(person->activities);
}
LinphonePresenceActivity * linphone_presence_person_get_nth_activity(const LinphonePresencePerson *person, unsigned int idx) {
@ -841,7 +839,7 @@ int linphone_presence_person_clear_activities(LinphonePresencePerson *person) {
unsigned int linphone_presence_person_get_nb_notes(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
return bctbx_list_size(person->notes);
return (unsigned int)bctbx_list_size(person->notes);
}
LinphonePresenceNote * linphone_presence_person_get_nth_note(const LinphonePresencePerson *person, unsigned int idx) {
@ -866,7 +864,7 @@ int linphone_presence_person_clear_notes(LinphonePresencePerson *person) {
unsigned int linphone_presence_person_get_nb_activities_notes(const LinphonePresencePerson *person) {
if (person == NULL) return 0;
return bctbx_list_size(person->activities_notes);
return (unsigned int)bctbx_list_size(person->activities_notes);
}
LinphonePresenceNote * linphone_presence_person_get_nth_activities_note(const LinphonePresencePerson *person, unsigned int idx) {

View file

@ -1555,11 +1555,6 @@ char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ;
void linphone_call_check_ice_session(LinphoneCall *call, IceRole role, bool_t is_reinvite);
LinphoneVcardContext* linphone_vcard_context_new(void);
void linphone_vcard_context_destroy(LinphoneVcardContext *context);
void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context);
void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data);
#ifdef __cplusplus
}
#endif

View file

@ -853,12 +853,13 @@ const char* sal_privacy_to_string(SalPrivacy privacy) {
}
}
static void remove_trailing_spaces(char *line){
int i;
for(i=strlen(line)-1;i>=0;--i){
if (isspace(line[i])) line[i]='\0';
else break;
static void remove_trailing_spaces(char *line) {
size_t size = size = strlen(line);
char *end = line + size - 1;
while (end >= line && isspace(*end)) {
end--;
}
*(end + 1) = '\0';
}
static int line_get_value(const char *input, const char *key, char *value, size_t value_size, size_t *read){

View file

@ -53,7 +53,7 @@ void linphone_vcard_context_destroy(LinphoneVcardContext *context) {
}
}
void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context) {
void* linphone_vcard_context_get_user_data(const LinphoneVcardContext *context) {
return context ? context->user_data : NULL;
}
@ -82,11 +82,13 @@ void linphone_vcard_free(LinphoneVcard *vCard) {
ms_free(vCard);
}
bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *filename) {
bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *filename) {
bctbx_list_t *result = NULL;
if (context && filename) {
belcard::BelCardParser *parser = context->parser;
shared_ptr<belcard::BelCardList> belCards = parser->parseFile(filename);
if (!context->parser) {
context->parser = new belcard::BelCardParser();
}
shared_ptr<belcard::BelCardList> belCards = context->parser->parseFile(filename);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
shared_ptr<belcard::BelCard> belCard = (*it);
@ -98,11 +100,13 @@ bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context
return result;
}
bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
bctbx_list_t* linphone_vcard_context_get_vcard_list_from_buffer(LinphoneVcardContext *context, const char *buffer) {
bctbx_list_t *result = NULL;
if (context && buffer) {
belcard::BelCardParser *parser = context->parser;
shared_ptr<belcard::BelCardList> belCards = parser->parse(buffer);
if (!context->parser) {
context->parser = new belcard::BelCardParser();
}
shared_ptr<belcard::BelCardList> belCards = context->parser->parse(buffer);
if (belCards) {
for (auto it = belCards->getCards().begin(); it != belCards->getCards().end(); ++it) {
shared_ptr<belcard::BelCard> belCard = (*it);
@ -114,11 +118,13 @@ bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *conte
return result;
}
LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
LinphoneVcard* linphone_vcard_context_get_vcard_from_buffer(LinphoneVcardContext *context, const char *buffer) {
LinphoneVcard *vCard = NULL;
if (context && buffer) {
belcard::BelCardParser *parser = context->parser;
shared_ptr<belcard::BelCard> belCard = parser->parseOne(buffer);
if (!context->parser) {
context->parser = new belcard::BelCardParser();
}
shared_ptr<belcard::BelCard> belCard = context->parser->parseOne(buffer);
if (belCard) {
vCard = linphone_vcard_new_from_belcard(belCard);
} else {

View file

@ -37,10 +37,36 @@ extern "C"
*/
/**
* Linphone vCard context object.
* The LinphoneVcardContext object.
*/
typedef struct _LinphoneVcardContext LinphoneVcardContext;
/**
* Creates a vCard context to reuse the same BelCardParser object
* @return a new LinphoneVcardContext object
*/
LINPHONE_PUBLIC LinphoneVcardContext* linphone_vcard_context_new(void);
/**
* Destroys the vCard context
* @param[in] context a LinphoneVcardContext object
*/
LINPHONE_PUBLIC void linphone_vcard_context_destroy(LinphoneVcardContext *context);
/**
* Gets the user data set in the LinphoneVcardContext
* @param[in] context a LinphoneVcardContext object
* @return the user data pointer
*/
LINPHONE_PUBLIC void* linphone_vcard_context_get_user_data(const LinphoneVcardContext *context);
/**
* Sets the user data in the LinphoneVcardContext
* @param[in] context a LinphoneVcardContext object
* @param[in] data the user data pointer
*/
LINPHONE_PUBLIC void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *data);
/**
* The LinphoneVcard object.
*/
@ -48,6 +74,7 @@ typedef struct _LinphoneVcard LinphoneVcard;
/**
* Creates a LinphoneVcard object that has a pointer to an empty vCard
* @return a new LinphoneVcard object
*/
LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new(void);
@ -59,24 +86,27 @@ LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
/**
* Uses belcard to parse the content of a file and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none.
* @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time)
* @param[in] file the path to the file to parse
* @return \mslist{LinphoneVcard}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *file);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *file);
/**
* Uses belcard to parse the content of a buffer and returns all the vcards it contains as LinphoneVcards, or NULL if it contains none.
* @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time)
* @param[in] buffer the buffer to parse
* @return \mslist{LinphoneVcard}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer);
LINPHONE_PUBLIC bctbx_list_t* linphone_vcard_context_get_vcard_list_from_buffer(LinphoneVcardContext *context, const char *buffer);
/**
* Uses belcard to parse the content of a buffer and returns one vCard if possible, or NULL otherwise.
* @param[in] context the vCard context to use (speed up the process by not creating a Belcard parser each time)
* @param[in] buffer the buffer to parse
* @return a LinphoneVcard if one could be parsed, or NULL otherwise
*/
LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer);
LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_context_get_vcard_from_buffer(LinphoneVcardContext *context, const char *buffer);
/**
* Returns the vCard4 representation of the LinphoneVcard.

View file

@ -35,7 +35,7 @@ void linphone_vcard_context_destroy(LinphoneVcardContext *context) {
}
}
void* linphone_vcard_context_get_user_data(LinphoneVcardContext *context) {
void* linphone_vcard_context_get_user_data(const LinphoneVcardContext *context) {
return context ? context->user_data : NULL;
}
@ -55,15 +55,15 @@ void linphone_vcard_free(LinphoneVcard *vCard) {
}
MSList* linphone_vcard_list_from_vcard4_file(LinphoneVcardContext *context, const char *filename) {
MSList* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *filename) {
return NULL;
}
MSList* linphone_vcard_list_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
MSList* linphone_vcard_context_get_vcard_list_from_buffer(LinphoneVcardContext *context, const char *buffer) {
return NULL;
}
LinphoneVcard* linphone_vcard_new_from_vcard4_buffer(LinphoneVcardContext *context, const char *buffer) {
LinphoneVcard* linphone_vcard_context_get_vcard_from_buffer(LinphoneVcardContext *context, const char *buffer) {
return NULL;
}

View file

@ -611,7 +611,7 @@ static int get_friend_weight(const LinphoneFriend *lf){
}
static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *lf2){
int w1,w2;
int w1,w2,ret;
w1=get_friend_weight(lf1);
w2=get_friend_weight(lf2);
if (w1==w2){
@ -619,13 +619,19 @@ static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *
const LinphoneAddress *addr1,*addr2;
addr1=linphone_friend_get_address(lf1);
addr2=linphone_friend_get_address(lf2);
u1=linphone_address_get_username(addr1);
u2=linphone_address_get_username(addr2);
if (u1 && u2) return strcasecmp(u1,u2);
if (u1) return 1;
else return -1;
u1=linphone_address_get_display_name(addr1) ? linphone_address_get_display_name(addr1) : linphone_address_get_username(addr1);
u2=linphone_address_get_display_name(addr2) ? linphone_address_get_display_name(addr2) : linphone_address_get_username(addr2);
if (u1 && u2) {
ret = strcasecmp(u1,u2);
} else if (u1) {
ret = 1;
} else {
ret = -1;
}
} else {
ret = w2-w1;
}
return w2-w1;
return ret;
}
static bctbx_list_t *sort_friend_list(const bctbx_list_t *friends){

View file

@ -364,6 +364,7 @@ LINPHONE_PUBLIC void linphone_gtk_reload_sound_devices(void);
LINPHONE_PUBLIC void linphone_gtk_reload_video_devices(void);
LINPHONE_PUBLIC bool_t linphone_gtk_is_friend(LinphoneCore *lc, const char *contact);
LINPHONE_PUBLIC gboolean linphone_gtk_auto_answer_enabled(void);
LINPHONE_PUBLIC void linphone_gtk_auto_answer_delay_changed(GtkSpinButton *spinbutton, gpointer user_data);
LINPHONE_PUBLIC void linphone_gtk_update_status_bar_icons(void);
LINPHONE_PUBLIC void linphone_gtk_enable_auto_answer(GtkToggleButton *checkbox, gpointer user_data);

View file

@ -121,7 +121,7 @@ static void _resize_video_window(GtkWidget *video_window, MSVideoSize vsize){
}
}
static gint resize_video_window(LinphoneCall *call){
static gboolean resize_video_window(LinphoneCall *call){
const LinphoneCallParams *params=linphone_call_get_current_params(call);
if (params){
MSVideoSize vsize=linphone_call_params_get_received_video_size(params);
@ -232,6 +232,18 @@ static gboolean video_window_moved(GtkWidget *widget, GdkEvent *event, gpointer
return FALSE;
}
static gint do_gtk_widget_destroy(GtkWidget *w){
gtk_widget_destroy(w);
return FALSE;
}
static void schedule_video_controls_disapearance(GtkWidget *w){
gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout"));
if (timeout != 0) g_source_remove(timeout);
timeout=g_timeout_add(3000,(GSourceFunc)do_gtk_widget_destroy,w);
g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout));
}
static GtkWidget *show_video_controls(GtkWidget *video_window){
GtkWidget *w;
w=(GtkWidget*)g_object_get_data(G_OBJECT(video_window),"controls");
@ -240,7 +252,6 @@ static GtkWidget *show_video_controls(GtkWidget *video_window){
const char *stock_button=isfullscreen ? GTK_STOCK_LEAVE_FULLSCREEN : GTK_STOCK_FULLSCREEN;
gint response_id=isfullscreen ? GTK_RESPONSE_NO : GTK_RESPONSE_YES ;
GtkWidget *image = gtk_image_new_from_icon_name(linphone_gtk_get_ui_config("stop_call_icon_name","linphone-stop-call"), GTK_ICON_SIZE_BUTTON);
gint timeout;
GtkWidget *button;
w=gtk_dialog_new_with_buttons("",GTK_WINDOW(video_window),GTK_DIALOG_DESTROY_WITH_PARENT,stock_button,response_id,NULL);
gtk_window_set_opacity(GTK_WINDOW(w),0.5);
@ -255,18 +266,14 @@ static GtkWidget *show_video_controls(GtkWidget *video_window){
gtk_widget_show(button);
gtk_dialog_add_action_widget(GTK_DIALOG(w),button,GTK_RESPONSE_APPLY);
g_signal_connect(w,"response",(GCallback)on_controls_response,video_window);
timeout=g_timeout_add(3000,(GSourceFunc)gtk_widget_destroy,w);
g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout));
schedule_video_controls_disapearance(w);
g_signal_connect(w,"destroy",(GCallback)on_controls_destroy,NULL);
g_object_set_data(G_OBJECT(w),"video_window",video_window);
g_object_set_data(G_OBJECT(video_window),"controls",w);
set_video_controls_position(video_window);
gtk_widget_show(w);
}else{
gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout"));
g_source_remove(timeout);
timeout=g_timeout_add(3000,(GSourceFunc)gtk_widget_destroy,w);
g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout));
schedule_video_controls_disapearance(w);
}
return w;
}

View file

@ -870,6 +870,8 @@ LINPHONE_PUBLIC int sal_get_transport_timeout(const Sal* sal);
void sal_set_dns_servers(Sal *sal, const MSList *servers);
LINPHONE_PUBLIC void sal_enable_dns_srv(Sal *sal, bool_t enable);
LINPHONE_PUBLIC bool_t sal_dns_srv_enabled(const Sal *sal);
LINPHONE_PUBLIC void sal_enable_dns_search(Sal *sal, bool_t enable);
LINPHONE_PUBLIC bool_t sal_dns_search_enabled(const Sal *sal);
LINPHONE_PUBLIC void sal_set_dns_user_hosts_file(Sal *sal, const char *hosts_file);
LINPHONE_PUBLIC const char *sal_get_dns_user_hosts_file(const Sal *sal);
unsigned int sal_get_random(void);

View file

@ -24,28 +24,35 @@ if(ANDROID)
find_package(Java REQUIRED COMPONENTS Development)
set(JNI_CLASSES
"org.linphone.core.ErrorInfoImpl"
"org.linphone.core.LinphoneAddressImpl"
"org.linphone.core.LinphoneAuthInfoImpl"
"org.linphone.core.LinphoneBufferImpl"
"org.linphone.core.LinphoneCallImpl"
"org.linphone.core.LinphoneCallLogImpl"
"org.linphone.core.LinphoneCallParamsImpl"
"org.linphone.core.LinphoneCallStatsImpl"
"org.linphone.core.LinphoneChatMessageImpl"
"org.linphone.core.LinphoneChatRoomImpl"
"org.linphone.core.LinphoneConferenceImpl"
"org.linphone.core.LinphoneConferenceParamsImpl"
"org.linphone.core.LinphoneContentImpl"
"org.linphone.core.LinphoneCoreFactoryImpl"
"org.linphone.core.LinphoneCoreImpl"
"org.linphone.core.LinphoneFriendImpl"
"org.linphone.core.LinphoneProxyConfigImpl"
"org.linphone.core.PayloadTypeImpl"
"org.linphone.core.LpConfigImpl"
"org.linphone.core.LinphoneInfoMessageImpl"
"org.linphone.core.LinphoneEventImpl"
"org.linphone.core.LinphoneFriendImpl"
"org.linphone.core.LinphoneFriendListImpl"
"org.linphone.core.LinphoneInfoMessageImpl"
"org.linphone.core.LinphoneNatPolicyImpl"
"org.linphone.core.LinphonePlayerImpl"
"org.linphone.core.LinphoneProxyConfigImpl"
"org.linphone.core.LpConfigImpl"
"org.linphone.core.PayloadTypeImpl"
"org.linphone.core.PresenceActivityImpl"
"org.linphone.core.PresenceModelImpl"
"org.linphone.core.PresenceNoteImpl"
"org.linphone.core.PresencePersonImpl"
"org.linphone.core.PresenceServiceImpl"
"org.linphone.core.ErrorInfoImpl"
"org.linphone.core.TunnelConfigImpl"
)

View file

@ -1,3 +1,22 @@
/*
LinphoneContent.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
/**

View file

@ -170,7 +170,7 @@ public interface LinphoneCore {
}
/**
* Describes firewall policy.
*
* @deprecated
*/
static public class FirewallPolicy {
@ -561,6 +561,42 @@ public interface LinphoneCore {
return mStringValue;
}
}
static public final class LinphoneLimeState {
static private Vector<LinphoneLimeState> values = new Vector<LinphoneLimeState>();
/**
* Disabled
*/
static public final LinphoneLimeState Disabled = new LinphoneLimeState(0, "None");
/**
* Mandatory
*/
static public final LinphoneLimeState Mandatory = new LinphoneLimeState(1,"Mandatory");
/**
* Preferred
*/
static public final LinphoneLimeState Preferred = new LinphoneLimeState(2,"Preferred");
protected final int mValue;
private final String mStringValue;
private LinphoneLimeState(int value, String stringValue) {
mValue = value;
values.addElement(this);
mStringValue = stringValue;
}
public static LinphoneLimeState fromInt(int value) {
for (int i=0; i<values.size();i++) {
LinphoneLimeState menc = (LinphoneLimeState) values.elementAt(i);
if (menc.mValue == value) return menc;
}
throw new RuntimeException("LinphoneLimeState not found ["+value+"]");
}
public String toString() {
return mStringValue;
}
}
/**
* Set the context of creation of the LinphoneCore.
@ -1116,6 +1152,7 @@ public interface LinphoneCore {
*
**/
void enableVideo(boolean vcap_enabled, boolean display_enabled);
/**
* Returns TRUE if video is enabled, FALSE otherwise.
*
@ -1127,6 +1164,7 @@ public interface LinphoneCore {
* @param stun_server Stun server address and port, such as stun.linphone.org or stun.linphone.org:3478
*/
void setStunServer(String stun_server);
/**
* Get STUN server
* @return stun server address if previously set.
@ -1136,24 +1174,49 @@ public interface LinphoneCore {
/**
* Sets policy regarding workarounding NATs
* @param pol one of the FirewallPolicy members.
* @deprecated
**/
void setFirewallPolicy(FirewallPolicy pol);
/**
* @return previously set firewall policy.
* @deprecated
*/
FirewallPolicy getFirewallPolicy();
/**
* Create a new LinphoneNatPolicy object with every policies being disabled.
* @return A new LinphoneNatPolicy object.
*/
LinphoneNatPolicy createNatPolicy();
/**
* Set the policy to use to pass through NATs/firewalls.
* It may be overridden by a NAT policy for a specific proxy config.
* @param policy LinphoneNatPolicy object
*/
void setNatPolicy(LinphoneNatPolicy policy);
/**
* Get The policy that is used to pass through NATs/firewalls.
* It may be overridden by a NAT policy for a specific proxy config.
* @return LinphoneNatPolicy object in use.
*/
LinphoneNatPolicy getNatPolicy();
/**
* Initiates an outgoing call given a destination LinphoneAddress
*
* @param addr the destination of the call {@link #LinphoneAddress }.
* @param params call parameters {@link #LinphoneCallParams }
*
*<br>The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. .
*<br>The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}.
*
* @return a {@link #LinphoneCall LinphoneCall} object
* @throws LinphoneCoreException in case of failure
**/
LinphoneCall inviteAddressWithParams(LinphoneAddress destination, LinphoneCallParams params) throws LinphoneCoreException ;
LinphoneCall inviteAddressWithParams(LinphoneAddress destination, LinphoneCallParams params) throws LinphoneCoreException;
/**
* Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore.
*
@ -2313,4 +2376,10 @@ public interface LinphoneCore {
* @param path The path from where plugins are to be loaded.
**/
public void reloadMsPlugins(String path);
public boolean isLimeEncryptionAvailable();
public void setLimeEncryption(LinphoneLimeState lime);
public LinphoneLimeState getLimeEncryption();
}

View file

@ -0,0 +1,113 @@
/*
LinphoneNatPolicy.java
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
/**
* Policy to use to pass through NATs/firewalls.
*
*/
public interface LinphoneNatPolicy {
/**
* Clear a NAT policy (deactivate all protocols and unset the STUN server).
*/
void clear();
/**
* Tell whether STUN is enabled.
* @return Boolean value telling whether STUN is enabled.
*/
boolean stunEnabled();
/**
* Enable STUN.
* If TURN is also enabled, TURN will be used instead of STUN.
* @param enable Boolean value telling whether to enable STUN.
*/
void enableStun(boolean enable);
/**
* Tell whether TURN is enabled.
* @return Boolean value telling whether TURN is enabled.
*/
boolean turnEnabled();
/**
* Enable TURN.
* If STUN is also enabled, it is ignored and TURN is used.
* @param enable Boolean value telling whether to enable TURN.
*/
void enableTurn(boolean enable);
/**
* Tell whether ICE is enabled.
* @return Boolean value telling whether ICE is enabled.
*/
boolean iceEnabled();
/**
* Enable ICE.
* ICE can be enabled without STUN/TURN, in which case only the local candidates will be used.
* @param enable Boolean value telling whether to enable ICE.
*/
void enableIce(boolean enable);
/**
* Tell whether uPnP is enabled.
* @return Boolean value telling whether uPnP is enabled.
*/
boolean upnpEnabled();
/**
* Enable uPnP.
* This has the effect to disable every other policies (ICE, STUN and TURN).
* @param enable Boolean value telling whether to enable uPnP.
*/
void enableUpnp(boolean enable);
/**
* Get the STUN/TURN server to use with this NAT policy.
* Used when STUN or TURN are enabled.
* @return The STUN server used by this NAT policy.
*/
String getStunServer();
/**
* Set the STUN/TURN server to use with this NAT policy.
* Used when STUN or TURN are enabled.
* @param stun_server The STUN server to use with this NAT policy.
*/
void setStunServer(String stun_server);
/**
* Get the username used to authenticate with the STUN/TURN server.
* The authentication will search for a LinphoneAuthInfo with this username.
* If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo.
* @return The username used to authenticate with the STUN/TURN server.
*/
String getStunServerUsername();
/**
* Set the username used to authenticate with the STUN/TURN server.
* The authentication will search for a LinphoneAuthInfo with this username.
* If it is not set the username of the currently used LinphoneProxyConfig is used to search for a LinphoneAuthInfo.
* @param username The username used to authenticate with the STUN/TURN server.
*/
void setStunServerUsername(String username);
}

View file

@ -1,3 +1,22 @@
/*
LinphoneContentImpl.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
public class LinphoneContentImpl implements LinphoneContent {

View file

@ -111,6 +111,9 @@ class LinphoneCoreImpl implements LinphoneCore {
private native boolean isVideoSupported(long nativePtr);
private native void setFirewallPolicy(long nativePtr, int enum_value);
private native int getFirewallPolicy(long nativePtr);
private native Object createNatPolicy(long nativePtr);
private native void setNatPolicy(long nativePtr, long policyPtr);
private native Object getNatPolicy(long nativePtr);
private native void setStunServer(long nativePtr, String stun_server);
private native String getStunServer(long nativePtr);
private native int updateCall(long ptrLc, long ptrCall, long ptrParams);
@ -528,12 +531,21 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized FirewallPolicy getFirewallPolicy() {
return FirewallPolicy.fromInt(getFirewallPolicy(nativePtr));
}
public synchronized String getStunServer() {
return getStunServer(nativePtr);
}
public synchronized void setFirewallPolicy(FirewallPolicy pol) {
setFirewallPolicy(nativePtr,pol.value());
}
public synchronized LinphoneNatPolicy createNatPolicy() {
return (LinphoneNatPolicy)createNatPolicy(nativePtr);
}
public synchronized void setNatPolicy(LinphoneNatPolicy policy) {
setNatPolicy(nativePtr, ((LinphoneNatPolicyImpl)policy).mNativePtr);
}
public synchronized LinphoneNatPolicy getNatPolicy() {
return (LinphoneNatPolicy)getNatPolicy(nativePtr);
}
public synchronized String getStunServer() {
return getStunServer(nativePtr);
}
public synchronized void setStunServer(String stunServer) {
setStunServer(nativePtr, stunServer);
}
@ -1670,4 +1682,19 @@ class LinphoneCoreImpl implements LinphoneCore {
public void reloadMsPlugins(String path) {
reloadMsPlugins(nativePtr, path);
}
private native boolean isLimeEncryptionAvailable(long nativePtr);
public synchronized boolean isLimeEncryptionAvailable() {
return isLimeEncryptionAvailable(nativePtr);
}
private native void setLimeEncryption(long nativePtr, int value);
public synchronized void setLimeEncryption(LinphoneLimeState lime) {
setLimeEncryption(nativePtr, lime.mValue);
}
private native int getLimeEncryption(long nativePtr);
public synchronized LinphoneLimeState getLimeEncryption() {
return LinphoneLimeState.fromInt(getLimeEncryption(nativePtr));
}
}

View file

@ -0,0 +1,125 @@
/*
LinphoneNatPolicyImpl.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
public class LinphoneNatPolicyImpl implements LinphoneNatPolicy {
protected final long mNativePtr;
private native Object getCore(long nativePtr);
private native void clear(long nativePtr);
private native boolean stunEnabled(long nativePtr);
private native void enableStun(long nativePtr, boolean enable);
private native boolean turnEnabled(long nativePtr);
private native void enableTurn(long nativePtr, boolean enable);
private native boolean iceEnabled(long nativePtr);
private native void enableIce(long nativePtr, boolean enable);
private native boolean upnpEnabled(long nativePtr);
private native void enableUpnp(long nativePtr, boolean enable);
private native String getStunServer(long nativePtr);
private native void setStunServer(long nativePtr, String stun_server);
private native String getStunServerUsername(long nativePtr);
private native void setStunServerUsername(long nativePtr, String username);
protected LinphoneNatPolicyImpl(long nativePtr) {
mNativePtr = nativePtr;
}
private synchronized LinphoneCore getCore() {
return (LinphoneCore)getCore(mNativePtr);
}
public void clear() {
synchronized(getCore()) {
clear(mNativePtr);
}
}
public boolean stunEnabled() {
synchronized(getCore()) {
return stunEnabled(mNativePtr);
}
}
public void enableStun(boolean enable) {
synchronized(getCore()) {
enableStun(mNativePtr, enable);
}
}
public boolean turnEnabled() {
synchronized(getCore()) {
return turnEnabled(mNativePtr);
}
}
public void enableTurn(boolean enable) {
synchronized(getCore()) {
enableTurn(mNativePtr, enable);
}
}
public boolean iceEnabled() {
synchronized(getCore()) {
return iceEnabled(mNativePtr);
}
}
public void enableIce(boolean enable) {
synchronized(getCore()) {
enableIce(mNativePtr, enable);
}
}
public boolean upnpEnabled() {
synchronized(getCore()) {
return upnpEnabled(mNativePtr);
}
}
public void enableUpnp(boolean enable) {
synchronized(getCore()) {
enableUpnp(mNativePtr, enable);
}
}
public String getStunServer() {
synchronized(getCore()) {
return getStunServer(mNativePtr);
}
}
public void setStunServer(String stun_server) {
synchronized(getCore()) {
setStunServer(mNativePtr, stun_server);
}
}
public String getStunServerUsername() {
synchronized(getCore()) {
return getStunServerUsername(mNativePtr);
}
}
public void setStunServerUsername(String username) {
synchronized(getCore()) {
setStunServerUsername(mNativePtr, username);
}
}
}

@ -1 +1 @@
Subproject commit ea379434c6c725a734b418449b799d5ef8a030c2
Subproject commit bddafa836a00c848442670af6fd50c934a1e669f

2
oRTP

@ -1 +1 @@
Subproject commit 96f89c62589f9fb84c78be2a092dc94a016ec775
Subproject commit e7ae3587d3b7638a59c0929b332a50b78d84aa1c

View file

@ -129,6 +129,7 @@ set(VCARD_FILES
set(OTHER_FILES
tester_hosts
local_tester_hosts
messages.db
)

View file

@ -342,7 +342,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
BC_ASSERT_PTR_NOT_NULL(conference = linphone_core_get_conference(marie->lc));
if(conference) {
bctbx_list_t *participants = linphone_conference_get_participants(conference);
BC_ASSERT_EQUAL(bctbx_list_size(participants), 2, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(participants), 2, unsigned int, "%u");
bctbx_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy);
}
@ -716,7 +716,7 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,3,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,5,10000));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc));
BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_calls(marie->lc)), 2, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_calls(marie->lc)), 2, unsigned int, "%u");
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc));
} else {
@ -811,7 +811,7 @@ static void eject_from_4_participants_conference(void) {
BC_ASSERT_PTR_NULL(linphone_core_get_current_call(marie->lc));
BC_ASSERT_TRUE(linphone_core_is_in_conference(marie->lc));
BC_ASSERT_EQUAL(linphone_core_get_conference_size(marie->lc),3, int, "%d");
BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_calls(marie->lc)), 3, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_calls(marie->lc)), 3, unsigned int, "%u");
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(michelle->lc));

View file

@ -4359,7 +4359,7 @@ static void call_logs_migrate(void) {
BC_ASSERT_TRUE(linphone_core_get_call_history_size(laure->lc) == 10);
for (; i < bctbx_list_size(laure->lc->call_logs); i++) {
LinphoneCallLog *log = bctbx_list_nth_data(laure->lc->call_logs, i);
LinphoneCallLog *log = bctbx_list_nth_data(laure->lc->call_logs, (int)i);
LinphoneCallStatus state = linphone_call_log_get_status(log);
LinphoneCallDir direction = linphone_call_log_get_dir(log);

View file

@ -23,6 +23,7 @@
#include "private.h"
#if HAVE_SIPP
void check_rtcp(LinphoneCall *call) {
MSTimeSpec ts;
@ -45,7 +46,6 @@ void check_rtcp(LinphoneCall *call) {
}
FILE *sip_start(const char *senario, const char* dest_username, const char *passwd, LinphoneAddress* dest_addres) {
#if HAVE_SIPP
char *dest;
char *command;
FILE *file;
@ -65,14 +65,10 @@ FILE *sip_start(const char *senario, const char* dest_username, const char *pass
ms_free(command);
ms_free(dest);
return file;
#else
return NULL;
#endif
}
static FILE *sip_start_recv(const char *senario) {
#if HAVE_SIPP
char *command;
FILE *file;
@ -83,9 +79,6 @@ static FILE *sip_start_recv(const char *senario) {
file = popen(command, "r");
ms_free(command);
return file;
#else
return NULL;
#endif
}
static void dest_server_server_resolved(void *data, const char *name, struct addrinfo *ai_list) {
@ -359,6 +352,7 @@ static test_t tests[] = {
TEST_NO_TAG("Call with multiple video mline in sdp", call_with_multiple_video_mline_in_sdp),
TEST_NO_TAG("Call invite 200ok without contact header", call_invite_200ok_without_contact_header)
};
#endif
test_suite_t complex_sip_call_test_suite = {
"Complex SIP Case",
@ -366,6 +360,11 @@ test_suite_t complex_sip_call_test_suite = {
NULL,
liblinphone_tester_before_each,
liblinphone_tester_after_each,
#if HAVE_SIPP
sizeof(tests) / sizeof(tests[0]),
tests
#else
0,
NULL
#endif
};

View file

@ -962,7 +962,7 @@ static void dos_module_trigger(void) {
linphone_core_manager_destroy(pauline);
}
#if HAVE_SIPP
static void test_subscribe_notify_with_sipp_publisher(void) {
char *scen;
FILE * sipp_out;
@ -1004,7 +1004,8 @@ static void test_subscribe_notify_with_sipp_publisher(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
//does not work because sipp seams not able to manage 2 call id in case file
//does not work because sipp seams not able to manage 2 call id in case file
#if 0
static void test_subscribe_notify_with_sipp_publisher_double_publish(void) {
char *scen;
@ -1046,6 +1047,7 @@ static void test_subscribe_notify_with_sipp_publisher_double_publish(void) {
linphone_core_manager_destroy(pauline);
}
#endif
#endif
static void test_publish_unpublish(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
@ -1142,6 +1144,7 @@ static void test_list_subscribe (void) {
linphone_core_manager_destroy(laure);
}
#if HAVE_SIPP
static void test_subscribe_on_wrong_dialog(void) {
char *scen;
FILE * sipp_out;
@ -1162,6 +1165,7 @@ static void test_subscribe_on_wrong_dialog(void) {
linphone_core_manager_destroy(marie);
}
#endif
test_t flexisip_tests[] = {
@ -1183,15 +1187,19 @@ test_t flexisip_tests[] = {
TEST_NO_TAG("Call ipv6 to ipv6", call_with_ipv6),
TEST_NO_TAG("Call ipv6 to ipv4", call_ipv6_to_ipv4),
TEST_NO_TAG("Call ipv4 to ipv6", call_ipv4_to_ipv6),
#if HAVE_SIPP
TEST_ONE_TAG("Subscribe Notify with sipp publisher", test_subscribe_notify_with_sipp_publisher, "LeaksMemory"),
/*TEST_ONE_TAG("Subscribe Notify with sipp double publish", test_subscribe_notify_with_sipp_publisher_double_publish, "LeaksMemory"),*/
#endif
TEST_NO_TAG("Publish/unpublish", test_publish_unpublish),
TEST_ONE_TAG("List subscribe", test_list_subscribe,"LeaksMemory"),
TEST_NO_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client),
TEST_ONE_TAG("File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client, "LeaksMemory"),
TEST_ONE_TAG("File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client, "LeaksMemory"),
TEST_NO_TAG("DoS module trigger by sending a lot of chat messages", dos_module_trigger),
#if HAVE_SIPP
TEST_NO_TAG("Subscribe on wrong dialog", test_subscribe_on_wrong_dialog)
#endif
};
test_suite_t flexisip_test_suite = {"Flexisip", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,

View file

@ -229,6 +229,7 @@ int main (int argc, char *argv[])
#endif
liblinphone_tester_init(NULL);
linphone_core_set_log_level(ORTP_FATAL);
for(i = 1; i < argc; ++i) {
if (strcmp(argv[i], "--verbose") == 0) {

View file

@ -362,7 +362,7 @@ static void text_message_with_send_error(void) {
linphone_chat_room_send_chat_message(chat_room,msg);
/* check transient msg list: the msg should be in it, and should be the only one */
BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(chat_room->transient_messages), 1, unsigned int, "%u");
BC_ASSERT_PTR_EQUAL(bctbx_list_nth_data(chat_room->transient_messages,0), msg);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
@ -370,7 +370,7 @@ static void text_message_with_send_error(void) {
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0, int, "%d");
/* the msg should have been discarded from transient list after an error */
BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(chat_room->transient_messages), 0, unsigned int, "%u");
sal_set_send_error(marie->lc->sal, 0);
@ -396,7 +396,7 @@ static void text_message_with_external_body(void) {
linphone_chat_room_send_chat_message(chat_room,msg);
/* check transient msg list: the msg should be in it, and should be the only one */
BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(chat_room->transient_messages), 1, unsigned int, "%u");
BC_ASSERT_PTR_EQUAL(bctbx_list_nth_data(chat_room->transient_messages,0), msg);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
@ -405,7 +405,7 @@ static void text_message_with_external_body(void) {
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d");
BC_ASSERT_EQUAL(bctbx_list_size(chat_room->transient_messages), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(chat_room->transient_messages), 0, unsigned int, "%u");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -615,7 +615,7 @@ static void file_transfer_2_messages_simultaneously(void) {
cbs = linphone_chat_message_get_callbacks(msg2);
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 0, unsigned int, "%u");
if (bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)) == 0) {
linphone_chat_room_send_chat_message(pauline_room,msg);
linphone_chat_room_send_chat_message(pauline_room,msg2);
@ -623,7 +623,7 @@ static void file_transfer_2_messages_simultaneously(void) {
msg = linphone_chat_message_clone(marie->stat.last_received_chat_message);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,2));
msg2 = marie->stat.last_received_chat_message;
BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)), 1, unsigned int, "%u");
if (bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)) != 1) {
char * buf = ms_strdup_printf("Found %d rooms instead of 1: ", bctbx_list_size(linphone_core_get_chat_rooms(marie->lc)));
const bctbx_list_t *it = linphone_core_get_chat_rooms(marie->lc);
@ -1028,12 +1028,12 @@ static void lime_unit(void) {
ms_message("session index %d\n", associatedKey.sessionIndex);
/* encrypt/decrypt a msg */
lime_encryptMessage(associatedKeys.peerKeys[0], (uint8_t *)PLAIN_TEXT_TEST_MESSAGE, strlen(PLAIN_TEXT_TEST_MESSAGE), senderZID, encryptedMessage);
lime_encryptMessage(associatedKeys.peerKeys[0], (uint8_t *)PLAIN_TEXT_TEST_MESSAGE, (uint32_t)strlen(PLAIN_TEXT_TEST_MESSAGE), senderZID, encryptedMessage);
printHex("Ciphered", encryptedMessage, strlen((char *)encryptedMessage));
/* invert sender and receiverZID to decrypt/authenticate */
memcpy(receiverZID, associatedKeys.peerKeys[0]->peerZID, 12);
memcpy(associatedKeys.peerKeys[0]->peerZID, senderZID, 12);
retval = lime_decryptMessage(associatedKeys.peerKeys[0], encryptedMessage, strlen(PLAIN_TEXT_TEST_MESSAGE)+16, receiverZID, plainMessage);
retval = lime_decryptMessage(associatedKeys.peerKeys[0], encryptedMessage, (uint32_t)strlen(PLAIN_TEXT_TEST_MESSAGE)+16, receiverZID, plainMessage);
BC_ASSERT_EQUAL(retval, 0, int, "%d");
BC_ASSERT_STRING_EQUAL((char *)plainMessage, (char *)PLAIN_TEXT_TEST_MESSAGE);
ms_message("Decrypt and auth returned %d\nPlain text is %s\n", retval, plainMessage);
@ -1190,9 +1190,9 @@ int check_no_strange_time(void* data,int argc, char** argv,char** cNames) {
return 0;
}
void history_message_count_helper(LinphoneChatRoom* chatroom, int x, int y, int expected ){
void history_message_count_helper(LinphoneChatRoom* chatroom, int x, int y, unsigned int expected ){
bctbx_list_t* messages = linphone_chat_room_get_history_range(chatroom, x, y);
BC_ASSERT_EQUAL(bctbx_list_size(messages), expected, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), expected, unsigned int, "%u");
bctbx_list_free_with_data(messages, (void (*)(void *))linphone_chat_message_unref);
}
@ -1288,16 +1288,16 @@ static void history_count(void) {
BC_ASSERT_PTR_NOT_NULL(chatroom);
if (chatroom){
messages=linphone_chat_room_get_history(chatroom,10);
BC_ASSERT_EQUAL(bctbx_list_size(messages), 10, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), 10, unsigned int, "%u");
bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,1);
BC_ASSERT_EQUAL(bctbx_list_size(messages), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), 1, unsigned int, "%u");
bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,0);
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d");
BC_ASSERT_EQUAL(bctbx_list_size(messages), 1270, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), 1270, unsigned int, "%u");
/*check the second most recent msg*/
BC_ASSERT_PTR_NOT_NULL(messages);
@ -1312,23 +1312,23 @@ static void history_count(void) {
/*test offset+limit: retrieve the 42th latest msg only and check its content*/
messages=linphone_chat_room_get_history_range(chatroom, 42, 42);
BC_ASSERT_EQUAL(bctbx_list_size(messages), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), 1, unsigned int, "%u");
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities.");
bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test offset without limit*/
messages = linphone_chat_room_get_history_range(chatroom, 1265, -1);
BC_ASSERT_EQUAL(bctbx_list_size(messages), 1270-1265, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), 1270-1265, unsigned int, "%u");
bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test limit without offset*/
messages = linphone_chat_room_get_history_range(chatroom, 0, 5);
BC_ASSERT_EQUAL(bctbx_list_size(messages), 6, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), 6, unsigned int, "%u");
bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test invalid start*/
messages = linphone_chat_room_get_history_range(chatroom, 1265, 1260);
BC_ASSERT_EQUAL(bctbx_list_size(messages), 1270-1265, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(messages), 1270-1265, unsigned int, "%u");
bctbx_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
}
@ -1476,7 +1476,7 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
for (i = 0; i < strlen(message); i++) {
BC_ASSERT_FALSE(linphone_chat_message_put_char(rtt_message, message[i]));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, (int)i+1, 1000));
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message[i], char, "%c");
}
linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message);
@ -1488,11 +1488,11 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
LinphoneChatMessage *marie_msg = NULL;
LinphoneChatMessage *pauline_msg = NULL;
if (do_not_store_rtt_messages_in_sql_storage) {
BC_ASSERT_EQUAL(bctbx_list_size(marie_messages), 0, int , "%i");
BC_ASSERT_EQUAL(bctbx_list_size(pauline_messages), 0, int , "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(marie_messages), 0, unsigned int , "%u");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(pauline_messages), 0, unsigned int , "%u");
} else {
BC_ASSERT_EQUAL(bctbx_list_size(marie_messages), 1, int , "%i");
BC_ASSERT_EQUAL(bctbx_list_size(pauline_messages), 1, int , "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(marie_messages), 1, unsigned int , "%u");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(pauline_messages), 1, unsigned int , "%u");
if (!marie_messages || !pauline_messages) {
goto end;
}
@ -1569,11 +1569,11 @@ static void real_time_text_conversation(void) {
for (i = 0; i < strlen(message1_1); i++) {
linphone_chat_message_put_char(pauline_rtt_message, message1_1[i]);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, (int)i+1, 1000));
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message1_1[i], char, "%c");
linphone_chat_message_put_char(marie_rtt_message, message1_2[i]);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, (int)i+1, 1000));
BC_ASSERT_EQUAL(linphone_chat_room_get_char(pauline_chat_room), message1_2[i], char, "%c");
}
@ -1605,11 +1605,11 @@ static void real_time_text_conversation(void) {
for (i = 0; i < strlen(message2_1); i++) {
linphone_chat_message_put_char(pauline_rtt_message, message2_1[i]);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, (int)i+1, 1000));
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message2_1[i], char, "%c");
linphone_chat_message_put_char(marie_rtt_message, message2_2[i]);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneIsComposingActiveReceived, (int)i+1, 1000));
BC_ASSERT_EQUAL(linphone_chat_room_get_char(pauline_chat_room), message2_2[i], char, "%c");
}
@ -1680,7 +1680,7 @@ static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_
for (i = 0; i < strlen(message); i++) {
linphone_chat_message_put_char(rtt_message, message[i]);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, (int)i+1, 1000));
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message[i], char, "%c");
}
@ -1689,7 +1689,7 @@ static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_
} else if (end_with_lf) {
linphone_chat_message_put_char(rtt_message, lf);
}
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, strlen(message), 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, (int)strlen(message), 1000));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
linphone_chat_message_unref(rtt_message);
}
@ -1794,7 +1794,7 @@ static void real_time_text_copy_paste(void) {
linphone_chat_message_put_char(rtt_message, message[i-1]);
if (i % 4 == 0) {
int j;
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, (int)i, 1000));
for (j = 4; j > 0; j--) {
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message[i-j], char, "%c");
}

View file

@ -685,7 +685,7 @@ static void long_term_presence_list(void) {
LinphoneFriend *f1, *f2;
LinphoneFriendList* friends;
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
enable_publish(pauline, TRUE);
enable_publish(pauline, FALSE);
enable_deflate_content_encoding(pauline, FALSE);
friends = linphone_core_create_friend_list(pauline->lc);

View file

@ -529,7 +529,7 @@ static void simple_subscribe_with_friend_from_rc(void) {
LinphoneCoreManager *marie = presence_linphone_core_manager_new_with_rc_name("marie", "pauline_as_friend_rc");
LinphoneFriend *pauline_as_friend;
BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_friend_list(marie->lc)), 1, int , "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_friend_list(marie->lc)), 1, unsigned int , "%u");
if (bctbx_list_size(linphone_core_get_friend_list(marie->lc))>0) {
pauline_as_friend = (LinphoneFriend*)linphone_core_get_friend_list(marie->lc)->data;

View file

@ -406,7 +406,7 @@ static void quality_reporting_interval_report_video_and_rtt(void) {
for (i = 0; i < strlen(message); i++) {
linphone_chat_message_put_char(rtt_message, message[i]);
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, (int)i+1, 1000));
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message[i], char, "%c");
}
linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message);

View file

@ -15,6 +15,7 @@ realm=sip.example.org
[proxy_0]
realm=sip.example.org
reg_proxy=sip2.linphone.org;transport=tls
reg_route=sip2.linphone.org;transport=tls
reg_identity=sip:pauline@sip.example.org

View file

@ -15,6 +15,7 @@ realm=sip.example.org
[proxy_0]
realm=sip.example.org
reg_proxy=sip2.linphone.org;transport=tcp
reg_route=sip2.linphone.org;transport=tcp
reg_identity=sip:pauline@sip.example.org

View file

@ -505,7 +505,7 @@ static LinphoneCoreManager* configure_lcm(void) {
if (transport_supported(LinphoneTransportTls)) {
LinphoneCoreManager *lcm=linphone_core_manager_new2( "multi_account_rc", FALSE);
stats *counters=&lcm->stat;
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,bctbx_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,(int)bctbx_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d");
return lcm;
}
@ -567,7 +567,7 @@ static void transport_change(void){
register_ok=counters->number_of_LinphoneRegistrationOk;
number_of_udp_proxy=get_number_of_udp_proxy(lc);
total_number_of_proxies=bctbx_list_size(linphone_core_get_proxy_config_list(lc));
total_number_of_proxies=(int)bctbx_list_size(linphone_core_get_proxy_config_list(lc));
linphone_core_get_sip_transports(lc,&sip_tr_orig);
sip_tr.udp_port=sip_tr_orig.udp_port;
@ -739,7 +739,7 @@ static void io_recv_error_late_recovery(void){
lc=lcm->lc;
sal_set_refresher_retry_after(lc->sal,1000);
counters=&lcm->stat;
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,bctbx_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,(int)bctbx_list_size(linphone_core_get_proxy_config_list(lcm->lc))));
counters = get_stats(lc);
@ -791,7 +791,7 @@ static void io_recv_error_without_active_register(void){
/*nothing should happen because no active registration*/
wait_for_until(lc,lc, &dummy, 1, 3000);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress, bctbx_list_size(linphone_core_get_proxy_config_list(lc)), int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress, (int)bctbx_list_size(linphone_core_get_proxy_config_list(lc)), int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d");

View file

@ -358,7 +358,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
/*BC_ASSERT_EQUAL(bctbx_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/
if (check_for_proxies){ /**/
proxy_count=bctbx_list_size(linphone_core_get_proxy_config_list(mgr->lc));
proxy_count=(int)bctbx_list_size(linphone_core_get_proxy_config_list(mgr->lc));
}else{
proxy_count=0;
/*this is to prevent registration to go on*/
@ -390,19 +390,26 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies
/*now that stun server resolution is done, we can start registering*/
linphone_core_set_network_reachable(mgr->lc, TRUE);
}
}
LinphoneCoreManager* linphone_core_manager_new( const char* rc_file) {
int old_log_level = ortp_get_log_level_mask(NULL);
LinphoneCoreManager *manager = ms_new0(LinphoneCoreManager, 1);
linphone_core_set_log_level(ORTP_ERROR);
linphone_core_manager_init(manager, rc_file);
linphone_core_manager_start(manager, TRUE);
linphone_core_set_log_level(old_log_level);
return manager;
}
LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_for_proxies) {
int old_log_level = ortp_get_log_level_mask(NULL);
LinphoneCoreManager *manager = ms_new0(LinphoneCoreManager, 1);
linphone_core_set_log_level(ORTP_ERROR);
linphone_core_manager_init(manager, rc_file);
linphone_core_manager_start(manager, check_for_proxies);
linphone_core_set_log_level(old_log_level);
return manager;
}
@ -414,6 +421,8 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
}
void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
int old_log_level = ortp_get_log_level_mask(NULL);
linphone_core_set_log_level(ORTP_ERROR);
if (mgr->stat.last_received_chat_message) {
linphone_chat_message_unref(mgr->stat.last_received_chat_message);
}
@ -423,7 +432,7 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
char *chatdb = ms_strdup(linphone_core_get_chat_database_path(mgr->lc));
if (!liblinphone_tester_keep_record_files && record_file){
if ((bc_get_number_of_failures()-mgr->number_of_bcunit_error_at_creation)>0) {
ms_message ("Test has failed, keeping recorded file [%s]",record_file);
ms_error("Test has failed, keeping recorded file [%s]",record_file);
} else {
unlink(record_file);
}
@ -439,6 +448,7 @@ void linphone_core_manager_uninit(LinphoneCoreManager *mgr) {
}
manager_count--;
linphone_core_set_log_level(old_log_level);
}
void linphone_core_manager_wait_for_stun_resolution(LinphoneCoreManager *mgr) {

View file

@ -138,7 +138,7 @@ static void linphone_vcard_update_existing_friends_test(void) {
static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nIMPP;TYPE=home:sip:sylvain@sip.linphone.org\r\nTEL;TYPE=work:0952636505\r\nEND:VCARD\r\n");
LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nIMPP;TYPE=home:sip:sylvain@sip.linphone.org\r\nTEL;TYPE=work:0952636505\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
bctbx_list_t *sip_addresses = linphone_friend_get_addresses(lf);
bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers(lf);
@ -150,7 +150,7 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_unref(lf);
lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n");
lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n");
lf = linphone_friend_new_from_vcard(lvc);
sip_addresses = linphone_friend_get_addresses(lf);
phone_numbers = linphone_friend_get_phone_numbers(lf);
@ -473,7 +473,7 @@ static void carddav_sync_2(void) {
static void carddav_sync_3(void) {
LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nFN:Sylvain Berfini\r\nIMPP;TYPE=work:sip:sylvain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nFN:Sylvain Berfini\r\nIMPP;TYPE=work:sip:sylvain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
char *friends_db = bc_tester_file("friends.db");
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
@ -514,7 +514,7 @@ static void carddav_sync_3(void) {
static void carddav_sync_4(void) {
LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneCardDavContext *c = NULL;
@ -575,7 +575,7 @@ static void carddav_sync_status_changed(LinphoneFriendList *list, LinphoneFriend
static void carddav_integration(void) {
LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE);
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneVcard *lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc);
LinphoneVcard *lvc2 = NULL;
LinphoneFriend *lf2 = NULL;
@ -608,12 +608,12 @@ static void carddav_integration(void) {
linphone_friend_unref(lf);
lf = NULL;
lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
lf = linphone_friend_new_from_vcard(lvc);
BC_ASSERT_EQUAL(linphone_friend_list_add_local_friend(lfl, lf), LinphoneFriendListOK, int, "%d");
linphone_friend_unref(lf);
lvc2 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
lvc2 = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sberfini@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
linphone_vcard_set_url(lvc2, "/card.php/addressbooks/tester/default/me.vcf");
lf2 = linphone_friend_new_from_vcard(lvc2);
linphone_friend_set_ref_key(lf2, refkey);
@ -691,7 +691,7 @@ static void carddav_clean(void) { // This is to ensure the content of the test
}
bctbx_list_free(friends);
lvc = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sylvain@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:sylvain@sip.linphone.org\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n");
linphone_vcard_set_url(lvc, "http://dav.linphone.org/card.php/addressbooks/tester/default/me.vcf");
lf = linphone_friend_new_from_vcard(lvc);
linphone_friend_list_add_friend(lfl, lf);
@ -739,9 +739,9 @@ static void carddav_server_to_client_and_client_to_sever_sync(void) {
LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc);
LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(lfl);
LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1);
LinphoneVcard *lvc1 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc1 = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Margaux Clerc\r\nIMPP;TYPE=work:sip:margaux@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf1 = linphone_friend_new_from_vcard(lvc1);
LinphoneVcard *lvc2 = linphone_vcard_new_from_vcard4_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneVcard *lvc2 = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Ghislain Mary\r\nIMPP;TYPE=work:sip:ghislain@sip.linphone.org\r\nEND:VCARD\r\n");
LinphoneFriend *lf2 = linphone_friend_new_from_vcard(lvc2);
bctbx_list_t *friends = NULL, *friends_iterator = NULL;

51
tools/lpconfig_items.py Normal file
View file

@ -0,0 +1,51 @@
#!/usr/bin/python
from collections import defaultdict
items = defaultdict(list)
def get_files_in_coreapi_directory():
from os import walk
files = []
for (dirpath, dirnames, filenames) in walk('../coreapi'):
files.extend(filenames)
break
return files
def parse_file(filename):
with open('../coreapi/' + filename, 'r') as infile:
for line in infile:
if 'lp_config_get_' in line:
parse_lpconfig_line(line)
def parse_lpconfig_line(line):
token = line[line.find('lp_config_get_') + len('lp_config_get_'):]
split = token.split('(', 1)
item_type = split[0]
if '_' in item_type:
return
params_split = split[1].split(',', 3)
item_section = params_split[1]
if item_section[0] != '"':
return
item_section = item_section.split('"')[1]
item_name = params_split[2]
if item_name[0] != '"':
return
item_name = item_name.split('"')[1]
item_default_value = params_split[3].split(')')[0]
if item_type == 'string' and item_default_value[0] != '"':
item_default_value = '<unknown_string>'
item = [item_type, item_name, item_default_value]
items[item_section].append(item)
for files in get_files_in_coreapi_directory():
parse_file(files)
for section, items in items.iteritems():
print '[' + section + ']'
for item in items:
print item[1] + '=' + item[2]
print ''