mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Merge branch 'dev_refactor_cpp' into dev_content_cpp
This commit is contained in:
commit
f4d4423fb1
30 changed files with 2355 additions and 190 deletions
|
|
@ -167,6 +167,7 @@ static LinphoneCore *_linphone_factory_create_core (
|
|||
LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path);
|
||||
LinphoneCore *lc = _linphone_core_new_with_config(cbs, config, user_data, system_context, automatically_start);
|
||||
lp_config_unref(config);
|
||||
bctbx_uninit_logger();
|
||||
return lc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ if (ENABLE_DOC OR ENABLE_CXX_WRAPPER OR ENABLE_CSHARP_WRAPPER OR ENABLE_JAVA_WRA
|
|||
set(XML_DIR "${CMAKE_CURRENT_BINARY_DIR}/xml")
|
||||
set(LINPHONE_DOXYGEN_XML_DIR ${XML_DIR} PARENT_SCOPE)
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html" "${XML_DIR}/index.xml"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f html/* xml/*
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f html/* xml/*
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
DEPENDS ${DOC_INPUT_FILES}
|
||||
|
|
|
|||
|
|
@ -4462,7 +4462,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_getPeerAddress(JNIE
|
|||
,jlong ptr) {
|
||||
return (jlong) linphone_chat_room_get_peer_address((LinphoneChatRoom*)ptr);
|
||||
}
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatMessage(JNIEnv* env
|
||||
extern "C" jobject Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatMessage(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jstring jmessage) {
|
||||
|
|
@ -4470,29 +4470,10 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatM
|
|||
LinphoneChatMessage *chatMessage = linphone_chat_room_create_message((LinphoneChatRoom *)ptr, message);
|
||||
ReleaseStringUTFChars(env, jmessage, message);
|
||||
|
||||
return (jlong) chatMessage;
|
||||
return getChatMessage(env, chatMessage);
|
||||
}
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createLinphoneChatMessage2(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr
|
||||
,jstring jmessage
|
||||
,jstring jurl
|
||||
,jint state
|
||||
,jlong time
|
||||
,jboolean read
|
||||
,jboolean incoming) {
|
||||
const char* message = GetStringUTFChars(env, jmessage);
|
||||
const char* url = GetStringUTFChars(env, jurl);
|
||||
|
||||
LinphoneChatMessage *chatMessage = linphone_chat_room_create_message_2(
|
||||
(LinphoneChatRoom *)ptr, message, url, (LinphoneChatMessageState)state,
|
||||
(time_t)time, read, incoming);
|
||||
|
||||
ReleaseStringUTFChars(env, jmessage, message);
|
||||
ReleaseStringUTFChars(env, jurl, url);
|
||||
|
||||
return (jlong) chatMessage;
|
||||
}
|
||||
extern "C" jint Java_org_linphone_core_LinphoneChatRoomImpl_getHistorySize (JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
|
|
@ -4527,7 +4508,7 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_markAsRead(JNIEnv*
|
|||
}
|
||||
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createFileTransferMessage(JNIEnv* env, jobject thiz, jlong ptr, jstring jname, jstring jtype, jstring jsubtype, jint data_size) {
|
||||
extern "C" jobject Java_org_linphone_core_LinphoneChatRoomImpl_createFileTransferMessage(JNIEnv* env, jobject thiz, jlong ptr, jstring jname, jstring jtype, jstring jsubtype, jint data_size) {
|
||||
LinphoneCore *lc = linphone_chat_room_get_core((LinphoneChatRoom*) ptr);
|
||||
LinphoneContent * content = linphone_core_create_content(lc);
|
||||
LinphoneChatMessage *message = NULL;
|
||||
|
|
@ -4548,7 +4529,7 @@ extern "C" jlong Java_org_linphone_core_LinphoneChatRoomImpl_createFileTransferM
|
|||
|
||||
linphone_content_unref(content);
|
||||
|
||||
return (jlong) message;
|
||||
return getChatMessage(env, message);
|
||||
}
|
||||
|
||||
extern "C" jboolean Java_org_linphone_core_LinphoneChatRoomImpl_islimeAvailable(JNIEnv *env, jobject thiz, jlong ptr) {
|
||||
|
|
@ -4726,6 +4707,22 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_reSend(JNIEnv* e
|
|||
linphone_chat_message_resend_2((LinphoneChatMessage*)ptr);
|
||||
}
|
||||
|
||||
static jobject getMessageListener(JNIEnv *env, LinphoneChatMessage *msg){
|
||||
jobject listener = (jobject) linphone_chat_message_get_message_state_changed_cb_user_data(msg);
|
||||
|
||||
if (listener == NULL) {
|
||||
ms_error("message_state_changed() notification without listener");
|
||||
return NULL;
|
||||
}
|
||||
listener = env->NewLocalRef(listener); //promote the weak ref into a local ref*/
|
||||
if (listener == NULL){
|
||||
ms_error("message_state_changed() listener is no longer valid");
|
||||
linphone_chat_message_set_message_state_changed_cb_user_data(msg, NULL);
|
||||
return NULL;
|
||||
}
|
||||
return listener;
|
||||
}
|
||||
|
||||
static void message_state_changed(LinphoneChatMessage* msg, LinphoneChatMessageState state) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
|
|
@ -4734,12 +4731,9 @@ static void message_state_changed(LinphoneChatMessage* msg, LinphoneChatMessageS
|
|||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) linphone_chat_message_get_message_state_changed_cb_user_data(msg);
|
||||
jobject listener = getMessageListener(env, msg);
|
||||
if (!listener) return;
|
||||
|
||||
if (listener == NULL) {
|
||||
ms_error("message_state_changed() notification without listener");
|
||||
return ;
|
||||
}
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageStateChanged","(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneChatMessage$State;)V");
|
||||
jobject jmessage = getChatMessage(env, msg);
|
||||
|
|
@ -4749,14 +4743,7 @@ static void message_state_changed(LinphoneChatMessage* msg, LinphoneChatMessageS
|
|||
LinphoneCore *lc = linphone_chat_room_get_core(room);
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(listener, method, jmessage, env->CallStaticObjectMethod(ljb->chatMessageStateClass, ljb->chatMessageStateFromIntId, (jint)state));
|
||||
|
||||
if (state == LinphoneChatMessageStateDisplayed) {
|
||||
env->DeleteGlobalRef(listener);
|
||||
linphone_chat_message_set_message_state_changed_cb_user_data(msg, NULL);
|
||||
}
|
||||
if (jmessage) {
|
||||
env->DeleteLocalRef(jmessage);
|
||||
}
|
||||
env->DeleteLocalRef(listener);
|
||||
}
|
||||
|
||||
static void file_transfer_progress_indication(LinphoneChatMessage *msg, const LinphoneContent* content, size_t offset, size_t total) {
|
||||
|
|
@ -4767,7 +4754,8 @@ static void file_transfer_progress_indication(LinphoneChatMessage *msg, const Li
|
|||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) linphone_chat_message_get_message_state_changed_cb_user_data(msg);
|
||||
jobject listener = getMessageListener(env, msg);
|
||||
if (!listener) return;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageFileTransferProgressChanged", "(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;II)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
|
@ -4790,7 +4778,8 @@ static void file_transfer_recv(LinphoneChatMessage *msg, const LinphoneContent*
|
|||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) linphone_chat_message_get_message_state_changed_cb_user_data(msg);
|
||||
jobject listener = getMessageListener(env, msg);
|
||||
if (!listener) return;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageFileTransferReceived", "(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;Lorg/linphone/core/LinphoneBuffer;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
|
@ -4819,7 +4808,8 @@ static LinphoneBuffer* file_transfer_send(LinphoneChatMessage *msg, const Linph
|
|||
return buffer;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) linphone_chat_message_get_message_state_changed_cb_user_data(msg);
|
||||
jobject listener = getMessageListener(env, msg);
|
||||
if (!listener) return NULL;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageFileTransferSent","(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneContent;IILorg/linphone/core/LinphoneBuffer;)V");
|
||||
env->DeleteLocalRef(clazz);
|
||||
|
|
@ -4840,12 +4830,15 @@ static LinphoneBuffer* file_transfer_send(LinphoneChatMessage *msg, const Linph
|
|||
return buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* When the listener is set, we must take a global reference to the listener and the message, so that
|
||||
* we are able to notify the state changes of the message, until it reaches its final state
|
||||
*/
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setListener(JNIEnv* env, jobject thiz, jlong ptr, jobject jlistener) {
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
LinphoneChatMessage *message = (LinphoneChatMessage *)ptr;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
|
||||
linphone_chat_message_set_message_state_changed_cb_user_data(message, listener);
|
||||
linphone_chat_message_set_message_state_changed_cb_user_data(message, env->NewWeakGlobalRef(jlistener));
|
||||
cbs = linphone_chat_message_get_callbacks(message);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, message_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
|
|
@ -4857,10 +4850,15 @@ extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_unref(JNIEnv* en
|
|||
,jobject thiz
|
||||
,jlong ptr) {
|
||||
jobject wref = (jobject)linphone_chat_message_get_user_data((LinphoneChatMessage*)ptr);
|
||||
jobject listener_wref = (jobject) linphone_chat_message_get_message_state_changed_cb_user_data((LinphoneChatMessage*)ptr);
|
||||
linphone_chat_message_set_user_data((LinphoneChatMessage*)ptr, NULL);
|
||||
if (wref){
|
||||
env->DeleteWeakGlobalRef(wref);
|
||||
}
|
||||
if (listener_wref){
|
||||
linphone_chat_message_set_message_state_changed_cb_user_data((LinphoneChatMessage*)ptr, NULL);
|
||||
env->DeleteWeakGlobalRef(listener_wref);
|
||||
}
|
||||
linphone_chat_message_unref((LinphoneChatMessage*)ptr);
|
||||
}
|
||||
|
||||
|
|
@ -4895,34 +4893,6 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv*
|
|||
ReleaseStringUTFChars(env, jmessage, message);
|
||||
}
|
||||
|
||||
static void chat_room_impl_callback(LinphoneChatMessage* msg, LinphoneChatMessageState state, void* ud) {
|
||||
JNIEnv *env = 0;
|
||||
jint result = jvm->AttachCurrentThread(&env,NULL);
|
||||
if (result != 0) {
|
||||
ms_error("cannot attach VM\n");
|
||||
return;
|
||||
}
|
||||
|
||||
jobject listener = (jobject) ud;
|
||||
jclass clazz = (jclass) env->GetObjectClass(listener);
|
||||
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageStateChanged","(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneChatMessage$State;)V");
|
||||
jobject jmessage=(jobject)linphone_chat_message_get_user_data(msg);
|
||||
|
||||
LinphoneChatRoom *room = linphone_chat_message_get_chat_room(msg);
|
||||
LinphoneCore *lc = linphone_chat_room_get_core(room);
|
||||
LinphoneJavaBindings *ljb = (LinphoneJavaBindings *)linphone_core_get_user_data(lc);
|
||||
env->CallVoidMethod(
|
||||
listener,
|
||||
method,
|
||||
jmessage,
|
||||
env->CallStaticObjectMethod(ljb->chatMessageStateClass,ljb->chatMessageStateFromIntId,(jint)state));
|
||||
|
||||
if (state == LinphoneChatMessageStateDisplayed ) {
|
||||
env->DeleteGlobalRef(listener);
|
||||
env->DeleteGlobalRef(jmessage);
|
||||
linphone_chat_message_set_user_data(msg,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" jobject Java_org_linphone_core_LinphoneChatRoomImpl_getCore(JNIEnv* env
|
||||
,jobject thiz
|
||||
|
|
@ -4933,36 +4903,13 @@ extern "C" jobject Java_org_linphone_core_LinphoneChatRoomImpl_getCore(JNIEnv*
|
|||
return core;
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage2(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong chatroom_ptr
|
||||
,jobject message
|
||||
,jlong messagePtr
|
||||
,jobject jlistener) {
|
||||
jobject listener = env->NewGlobalRef(jlistener);
|
||||
LinphoneChatMessage *msg = (LinphoneChatMessage *)messagePtr;
|
||||
message = env->NewGlobalRef(message);
|
||||
linphone_chat_message_ref(msg);
|
||||
linphone_chat_message_set_user_data(msg, message);
|
||||
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
cbs = linphone_chat_message_get_callbacks(msg);
|
||||
linphone_chat_message_cbs_set_user_data(cbs, (void *)listener);
|
||||
linphone_chat_message_cbs_set_msg_state_changed(cbs, message_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
|
||||
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_recv);
|
||||
linphone_chat_message_cbs_set_file_transfer_send(cbs, file_transfer_send);
|
||||
|
||||
linphone_chat_room_send_chat_message_2((LinphoneChatRoom*)chatroom_ptr, msg);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendChatMessage(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong chatroom_ptr
|
||||
,jobject message
|
||||
,jlong messagePtr) {
|
||||
message = env->NewGlobalRef(message);
|
||||
linphone_chat_message_set_user_data((LinphoneChatMessage*)messagePtr, message);
|
||||
|
||||
linphone_chat_room_send_chat_message_2((LinphoneChatRoom*)chatroom_ptr, (LinphoneChatMessage*)messagePtr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -338,6 +338,7 @@ LINPHONE_PUBLIC LinphoneConference *linphone_call_get_conference (const Linphone
|
|||
* Change the playback output device (currently only used for blackberry)
|
||||
* @param call
|
||||
* @param route the wanted audio route (earpiece, speaker, ...)
|
||||
* @donotwrap
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_call_set_audio_route (LinphoneCall *call, LinphoneAudioRoute route);
|
||||
|
||||
|
|
|
|||
|
|
@ -369,6 +369,8 @@ LINPHONE_PUBLIC const char* linphone_chat_message_get_text_content(const Linphon
|
|||
*/
|
||||
LINPHONE_PUBLIC bool_t linphone_chat_message_is_file_transfer_in_progress(LinphoneChatMessage *msg);
|
||||
|
||||
LINPHONE_PUBLIC bctbx_list_t *linphone_chat_message_get_participants_in_state (const LinphoneChatMessage *msg, const LinphoneChatMessageState state);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -227,6 +227,12 @@ LINPHONE_PUBLIC int linphone_chat_room_get_history_events_size(LinphoneChatRoom
|
|||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChatRoom *cr);
|
||||
|
||||
/**
|
||||
* Gets the chat message sent or received in this chat room that matches the message_id
|
||||
* @param[in] cr The #LinphoneChatRoom object corresponding to the conversation for which the message should be retrieved
|
||||
* @param[in] message_id The id of the message to find
|
||||
* @return the #LinphoneChatMessage
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneChatMessage * linphone_chat_room_find_message(LinphoneChatRoom *cr, const char *message_id);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -115,11 +115,6 @@ public interface LinphoneChatRoom {
|
|||
*/
|
||||
void deleteMessage(LinphoneChatMessage message);
|
||||
|
||||
/**
|
||||
* Create a LinphoneChatMessage
|
||||
* @return LinphoneChatMessage object
|
||||
*/
|
||||
LinphoneChatMessage createLinphoneChatMessage(String message, String url, State state, long timestamp, boolean isRead, boolean isIncoming);
|
||||
|
||||
/**
|
||||
* Returns a back pointer to the core managing the chat room.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.linphone.core.LinphoneCall;
|
|||
@SuppressWarnings("deprecation")
|
||||
class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
||||
protected final long nativePtr;
|
||||
private native long createLinphoneChatMessage(long ptr, String message);
|
||||
private native Object createLinphoneChatMessage(long ptr, String message);
|
||||
private native long getPeerAddress(long ptr);
|
||||
private native void sendMessage(long ptr, String message);
|
||||
private native void sendMessage2(long ptr, Object msg, long messagePtr, StateListener listener);
|
||||
|
|
@ -39,9 +39,6 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
private native boolean isRemoteComposing(long ptr);
|
||||
private native void markAsRead(long ptr);
|
||||
private native void deleteMessage(long room, long message);
|
||||
private native long createLinphoneChatMessage2(long ptr, String message,
|
||||
String url, int state, long timestamp, boolean isRead,
|
||||
boolean isIncoming);
|
||||
private native void sendChatMessage(long ptr, Object message, long messagePtr);
|
||||
private native void finalize(long nativePtr);
|
||||
private native boolean islimeAvailable(long nativePtr);
|
||||
|
|
@ -77,7 +74,7 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
@Override
|
||||
public LinphoneChatMessage createLinphoneChatMessage(String message) {
|
||||
synchronized(getCore()){
|
||||
return new LinphoneChatMessageImpl(createLinphoneChatMessage(nativePtr, message));
|
||||
return (LinphoneChatMessage)createLinphoneChatMessage(nativePtr, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,15 +141,6 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinphoneChatMessage createLinphoneChatMessage(String message,
|
||||
String url, State state, long timestamp, boolean isRead,
|
||||
boolean isIncoming) {
|
||||
synchronized(getCore()){
|
||||
return new LinphoneChatMessageImpl(createLinphoneChatMessage2(
|
||||
nativePtr, message, url, state.value(), timestamp / 1000, isRead, isIncoming));
|
||||
}
|
||||
}
|
||||
private native Object getCore(long nativePtr);
|
||||
@Override
|
||||
public synchronized LinphoneCore getCore() {
|
||||
|
|
@ -162,11 +150,11 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
|
|||
return (LinphoneChatMessage[]) typesPtr;
|
||||
}
|
||||
|
||||
private native long createFileTransferMessage(long ptr, String name, String type, String subtype, int size);
|
||||
private native Object createFileTransferMessage(long ptr, String name, String type, String subtype, int size);
|
||||
@Override
|
||||
public LinphoneChatMessage createFileTransferMessage(LinphoneContent content) {
|
||||
synchronized(getCore()) {
|
||||
return new LinphoneChatMessageImpl(createFileTransferMessage(nativePtr, content.getName(), content.getType(), content.getSubtype(), content.getRealSize()));
|
||||
return (LinphoneChatMessage)createFileTransferMessage(nativePtr, content.getName(), content.getType(), content.getSubtype(), content.getRealSize());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "chat/notification/imdn.h"
|
||||
#include "content/content-type.h"
|
||||
#include "content/content.h"
|
||||
#include "conference/participant.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -247,6 +248,10 @@ bool_t linphone_chat_message_is_file_transfer_in_progress(LinphoneChatMessage *m
|
|||
return L_GET_CPP_PTR_FROM_C_OBJECT(msg)->isFileTransferInProgress();
|
||||
}
|
||||
|
||||
bctbx_list_t *linphone_chat_message_get_participants_in_state (const LinphoneChatMessage *msg, const LinphoneChatMessageState state) {
|
||||
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_PRIVATE_FROM_C_OBJECT(msg)->getParticipantsInState((LinphonePrivate::ChatMessage::State) state));
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Old listener
|
||||
// =============================================================================
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public:
|
|||
void setDirection (ChatMessage::Direction dir);
|
||||
|
||||
void setParticipantState (const IdentityAddress &participantAddress, ChatMessage::State newState);
|
||||
std::list<std::shared_ptr<Participant>> getParticipantsInState (const ChatMessage::State state) const;
|
||||
void setState (ChatMessage::State newState, bool force = false);
|
||||
|
||||
void setTime (time_t time);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "chat/modifier/encryption-chat-message-modifier.h"
|
||||
#include "chat/modifier/file-transfer-chat-message-modifier.h"
|
||||
#include "chat/modifier/multipart-chat-message-modifier.h"
|
||||
#include "conference/participant.h"
|
||||
#include "content/file-content.h"
|
||||
#include "content/header/header-param.h"
|
||||
#include "content/content.h"
|
||||
|
|
@ -124,6 +125,29 @@ void ChatMessagePrivate::setParticipantState (const IdentityAddress &participant
|
|||
setState(ChatMessage::State::DeliveredToUser);
|
||||
}
|
||||
|
||||
list<shared_ptr<Participant>> ChatMessagePrivate::getParticipantsInState (const ChatMessage::State state) const {
|
||||
L_Q();
|
||||
|
||||
list<shared_ptr<Participant>> participantsInState;
|
||||
if (!(q->getChatRoom()->getCapabilities() & AbstractChatRoom::Capabilities::Conference) || !dbKey.isValid()) {
|
||||
return participantsInState;
|
||||
}
|
||||
|
||||
unique_ptr<MainDb> &mainDb = q->getChatRoom()->getCore()->getPrivate()->mainDb;
|
||||
shared_ptr<EventLog> eventLog = mainDb->getEventFromKey(dbKey);
|
||||
list<IdentityAddress> addressesInState = mainDb->getChatMessageParticipantsInState(eventLog, state);
|
||||
const list<shared_ptr<Participant>> &participants = q->getChatRoom()->getParticipants();
|
||||
for (IdentityAddress addr : addressesInState) {
|
||||
for (const auto &participant : participants) {
|
||||
if (participant->getAddress() == addr) {
|
||||
participantsInState.push_back(participant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return participantsInState;
|
||||
}
|
||||
|
||||
void ChatMessagePrivate::setState (ChatMessage::State newState, bool force) {
|
||||
L_Q();
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class AbstractChatRoom;
|
|||
class Content;
|
||||
class FileTransferContent;
|
||||
class ChatMessagePrivate;
|
||||
class Participant;
|
||||
|
||||
class LINPHONE_PUBLIC ChatMessage : public Object, public CoreAccessor {
|
||||
friend class BasicToClientGroupChatRoom;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ void CallSessionPrivate::setState (CallSession::State newState, const string &me
|
|||
case CallSession::State::Error:
|
||||
switch (linphone_error_info_get_reason(q->getErrorInfo())) {
|
||||
case LinphoneReasonDeclined:
|
||||
log->status = LinphoneCallDeclined;
|
||||
if (log->status != LinphoneCallMissed) // Do not re-change the status of a call if it's already set
|
||||
log->status = LinphoneCallDeclined;
|
||||
break;
|
||||
case LinphoneReasonNotAnswered:
|
||||
if (log->dir == LinphoneCallIncoming)
|
||||
|
|
@ -469,7 +470,7 @@ void CallSessionPrivate::updatedByRemote () {
|
|||
if (deferUpdate || deferUpdateInternal) {
|
||||
if (state == CallSession::State::UpdatedByRemote && !deferUpdateInternal){
|
||||
lInfo() << "CallSession [" << q << "]: UpdatedByRemoted was signaled but defered. LinphoneCore expects the application to call linphone_call_accept_update() later";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (state == CallSession::State::UpdatedByRemote)
|
||||
q->acceptUpdate(nullptr);
|
||||
|
|
|
|||
|
|
@ -1920,8 +1920,7 @@ int MediaSessionPrivate::getVideoBandwidth (const SalMediaDescription *md, const
|
|||
else if (md->bandwidth > 0) {
|
||||
/* Case where b=AS is given globally, not per stream */
|
||||
remoteBandwidth = PayloadTypeHandler::getRemainingBandwidthForVideo(md->bandwidth, audioBandwidth);
|
||||
} else
|
||||
remoteBandwidth = lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "net", "default_max_bandwidth", 1500);
|
||||
}
|
||||
return PayloadTypeHandler::getMinBandwidth(PayloadTypeHandler::getRemainingBandwidthForVideo(linphone_core_get_upload_bandwidth(q->getCore()->getCCore()), audioBandwidth), remoteBandwidth);
|
||||
}
|
||||
|
||||
|
|
@ -2697,7 +2696,7 @@ void MediaSessionPrivate::startAudioStream (CallSession::State targetState, bool
|
|||
io.output.soundcard = playcard;
|
||||
} else {
|
||||
io.output.type = MSResourceFile;
|
||||
io.output.file = recfile.c_str();
|
||||
io.output.file = recfile.empty() ? nullptr : recfile.c_str();
|
||||
}
|
||||
} else {
|
||||
io.input.type = io.output.type = MSResourceRtp;
|
||||
|
|
@ -2711,7 +2710,7 @@ void MediaSessionPrivate::startAudioStream (CallSession::State targetState, bool
|
|||
io.output.soundcard = playcard;
|
||||
} else {
|
||||
io.output.type = MSResourceFile;
|
||||
io.output.file = recfile.c_str();
|
||||
io.output.file = recfile.empty() ? nullptr : recfile.c_str();
|
||||
}
|
||||
if (captcard) {
|
||||
io.input.type = MSResourceSoundcard;
|
||||
|
|
|
|||
|
|
@ -1970,6 +1970,30 @@ list<ChatMessage::State> MainDb::getChatMessageParticipantStates (const shared_p
|
|||
};
|
||||
}
|
||||
|
||||
list<IdentityAddress> MainDb::getChatMessageParticipantsInState (const shared_ptr<EventLog> &eventLog, const ChatMessage::State state) const {
|
||||
return L_DB_TRANSACTION {
|
||||
L_D();
|
||||
|
||||
const EventLogPrivate *dEventLog = eventLog->getPrivate();
|
||||
MainDbKeyPrivate *dEventKey = static_cast<MainDbKey &>(dEventLog->dbKey).getPrivate();
|
||||
const long long &eventId = dEventKey->storageId;
|
||||
|
||||
int stateInt = static_cast<int>(state);
|
||||
list<IdentityAddress> participantsAddresses;
|
||||
|
||||
static const string query = "SELECT sip_address.value"
|
||||
" FROM sip_address, chat_message_participant"
|
||||
" WHERE event_id = :eventId AND state = :state"
|
||||
" AND sip_address.id = chat_message_participant.participant_sip_address_id";
|
||||
soci::rowset<soci::row> rows = (d->dbSession.getBackendSession()->prepare << query, soci::use(eventId), soci::use(stateInt));
|
||||
for (const auto &row : rows) {
|
||||
participantsAddresses.push_back(IdentityAddress(row.get<string>(0)));
|
||||
}
|
||||
|
||||
return participantsAddresses;
|
||||
};
|
||||
}
|
||||
|
||||
ChatMessage::State MainDb::getChatMessageParticipantState (
|
||||
const shared_ptr<EventLog> &eventLog,
|
||||
const IdentityAddress &participantAddress
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ public:
|
|||
std::list<std::shared_ptr<ChatMessage>> getUnreadChatMessages (const ChatRoomId &chatRoomId) const;
|
||||
|
||||
std::list<ChatMessage::State> getChatMessageParticipantStates (const std::shared_ptr<EventLog> &eventLog) const;
|
||||
std::list<IdentityAddress> getChatMessageParticipantsInState (const std::shared_ptr<EventLog> &eventLog, const ChatMessage::State state) const;
|
||||
ChatMessage::State getChatMessageParticipantState (
|
||||
const std::shared_ptr<EventLog> &eventLog,
|
||||
const IdentityAddress &participantAddress
|
||||
|
|
|
|||
|
|
@ -317,10 +317,12 @@ void IceAgent::updateLocalMediaDescriptionFromIce (SalMediaDescription *desc) {
|
|||
}
|
||||
if (firstCl)
|
||||
result = !!ice_check_list_selected_valid_local_candidate(firstCl, &rtpCandidate, nullptr);
|
||||
if (result)
|
||||
if (result) {
|
||||
strncpy(desc->addr, rtpCandidate->taddr.ip, sizeof(desc->addr));
|
||||
else
|
||||
} else {
|
||||
lWarning() << "If ICE has completed successfully, rtp_candidate should be set!";
|
||||
ice_dump_valid_list(firstCl);
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(desc->ice_pwd, ice_session_local_pwd(iceSession), sizeof(desc->ice_pwd));
|
||||
|
|
|
|||
|
|
@ -1037,7 +1037,7 @@ int SalCallOp::decline(SalReason reason, const char *redirection /*optional*/){
|
|||
}
|
||||
|
||||
belle_sip_header_reason_t *SalCallOp::make_reason_header( const SalErrorInfo *info){
|
||||
if (info != NULL){
|
||||
if (info && info->reason != SalReasonNone) {
|
||||
belle_sip_header_reason_t* reason = BELLE_SIP_HEADER_REASON(belle_sip_header_reason_new());
|
||||
belle_sip_header_reason_set_text(reason, info->status_string);
|
||||
belle_sip_header_reason_set_protocol(reason,info->protocol);
|
||||
|
|
@ -1123,25 +1123,25 @@ int SalCallOp::update(const char *subject, bool_t no_user_consent) {
|
|||
int SalCallOp::cancel_invite_with_info(const SalErrorInfo *info) {
|
||||
belle_sip_request_t* cancel;
|
||||
ms_message("Cancelling INVITE request from [%s] to [%s] ",get_from(), get_to());
|
||||
|
||||
if (this->pending_client_trans == NULL){
|
||||
|
||||
if (this->pending_client_trans == NULL) {
|
||||
ms_warning("There is no transaction to cancel.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
cancel = belle_sip_client_transaction_create_cancel(this->pending_client_trans);
|
||||
if (cancel){
|
||||
if (info != NULL){
|
||||
if (cancel) {
|
||||
if (info && info->reason != SalReasonNone) {
|
||||
belle_sip_header_reason_t* reason = make_reason_header(info);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(cancel),BELLE_SIP_HEADER(reason));
|
||||
}
|
||||
send_request(cancel);
|
||||
return 0;
|
||||
}else if (this->dialog){
|
||||
} else if (this->dialog) {
|
||||
belle_sip_dialog_state_t state = belle_sip_dialog_get_state(this->dialog);;
|
||||
/*case where the response received is invalid (could not establish a dialog), but the transaction is not cancellable
|
||||
* because already terminated*/
|
||||
switch(state){
|
||||
switch(state) {
|
||||
case BELLE_SIP_DIALOG_EARLY:
|
||||
case BELLE_SIP_DIALOG_NULL:
|
||||
/*force kill the dialog*/
|
||||
|
|
@ -1303,7 +1303,7 @@ int SalCallOp::terminate_with_error(const SalErrorInfo *info) {
|
|||
int ret = 0;
|
||||
|
||||
memset(&sei, 0, sizeof(sei));
|
||||
if (info == NULL && dialog_state != BELLE_SIP_DIALOG_CONFIRMED && this->dir == Dir::Incoming){
|
||||
if (info == NULL && dialog_state != BELLE_SIP_DIALOG_CONFIRMED && this->dir == Dir::Incoming) {
|
||||
/*the purpose of this line is to set a default SalErrorInfo for declining an incoming call (not yet established of course) */
|
||||
sal_error_info_set(&sei,SalReasonDeclined, "SIP", 0, NULL, NULL);
|
||||
p_sei = &sei;
|
||||
|
|
@ -1318,7 +1318,7 @@ int SalCallOp::terminate_with_error(const SalErrorInfo *info) {
|
|||
switch(dialog_state) {
|
||||
case BELLE_SIP_DIALOG_CONFIRMED: {
|
||||
belle_sip_request_t * req = belle_sip_dialog_create_request(this->dialog,"BYE");
|
||||
if (info != NULL){
|
||||
if (info && info->reason != SalReasonNone) {
|
||||
belle_sip_header_reason_t* reason = make_reason_header(info);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(reason));
|
||||
}
|
||||
|
|
@ -1334,7 +1334,7 @@ int SalCallOp::terminate_with_error(const SalErrorInfo *info) {
|
|||
} else if (this->pending_client_trans){
|
||||
if (belle_sip_transaction_get_state(BELLE_SIP_TRANSACTION(this->pending_client_trans)) == BELLE_SIP_TRANSACTION_PROCEEDING){
|
||||
cancelling_invite(p_sei);
|
||||
}else{
|
||||
} else {
|
||||
/* Case where the CANCEL cannot be sent because no provisional response was received so far.
|
||||
* The Op must be kept for the time of the transaction in case a response is received later.
|
||||
* The state is passed to Terminating to remember to terminate later.
|
||||
|
|
@ -1351,7 +1351,7 @@ int SalCallOp::terminate_with_error(const SalErrorInfo *info) {
|
|||
if (this->dir == Dir::Incoming) {
|
||||
decline_with_error_info(p_sei,NULL);
|
||||
this->state=State::Terminated;
|
||||
} else {
|
||||
} else {
|
||||
cancelling_invite(p_sei);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -218,11 +218,14 @@ void Sal::process_request_event_cb (void *ud, const belle_sip_request_event_t *e
|
|||
if (!op->call_id) {
|
||||
op->call_id=ms_strdup(belle_sip_header_call_id_get_call_id(BELLE_SIP_HEADER_CALL_ID(belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req), belle_sip_header_call_id_t))));
|
||||
}
|
||||
/*It is worth noting that proxies can (and
|
||||
will) remove this header field*/
|
||||
/*It is worth noting that proxies can (and will) remove this header field*/
|
||||
op->set_privacy_from_message((belle_sip_message_t*)req);
|
||||
|
||||
op->assign_recv_headers((belle_sip_message_t*)req);
|
||||
|
||||
if (strcmp("ACK",method) != 0){
|
||||
/*The ACK custom header is processed specifically later on*/
|
||||
op->assign_recv_headers((belle_sip_message_t*)req);
|
||||
}
|
||||
|
||||
if (op->callbacks && op->callbacks->process_request_event) {
|
||||
op->callbacks->process_request_event(op,event);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -821,11 +821,11 @@ static void multiple_answers_call_with_media_relay(void) {
|
|||
linphone_core_remove_supported_tag(pauline->lc,"gruu");
|
||||
linphone_core_remove_supported_tag(marie1->lc,"gruu");
|
||||
linphone_core_remove_supported_tag(marie2->lc,"gruu");
|
||||
|
||||
|
||||
linphone_core_manager_start(pauline, TRUE);
|
||||
linphone_core_manager_start(marie1, TRUE);
|
||||
linphone_core_manager_start(marie2, TRUE);
|
||||
|
||||
|
||||
LinphoneCall* call1, *call2;
|
||||
|
||||
bctbx_list_t* lcs = bctbx_list_append(NULL,pauline->lc);
|
||||
|
|
@ -1038,7 +1038,7 @@ static void terminate_call_with_error(void) {
|
|||
|
||||
linphone_call_ref(out_call);
|
||||
ei = linphone_error_info_new();
|
||||
linphone_error_info_set(ei, NULL, LinphoneReasonNone, 200, "Call refused for security reason", NULL);
|
||||
linphone_error_info_set(ei, NULL, LinphoneReasonUnknown, 200, "Call refused for security reason", NULL);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallOutgoingInit,1));
|
||||
BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, 1));
|
||||
|
|
@ -1093,7 +1093,7 @@ static void cancel_call_with_error(void) {
|
|||
|
||||
linphone_call_ref(out_call);
|
||||
ei = linphone_error_info_new();
|
||||
linphone_error_info_set(ei, NULL, LinphoneReasonNone, 600, "Call has been cancelled", NULL);
|
||||
linphone_error_info_set(ei, NULL, LinphoneReasonUnknown, 600, "Call has been cancelled", NULL);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallOutgoingInit,1));
|
||||
BC_ASSERT_TRUE(wait_for(caller_mgr->lc, callee_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, 1));
|
||||
|
|
@ -1163,6 +1163,8 @@ static void cancel_other_device_after_accept(void) {
|
|||
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallEnd,1));
|
||||
BC_ASSERT_TRUE(wait_for(caller_mgr->lc,callee_mgr_2->lc,&callee_mgr_2->stat.number_of_LinphoneCallReleased,1));
|
||||
|
||||
wait_for_until(caller_mgr->lc,callee_mgr_2->lc,NULL,0,500);
|
||||
|
||||
rei = linphone_call_get_error_info(call_callee_2);
|
||||
BC_ASSERT_PTR_NOT_NULL(rei);
|
||||
if (rei){
|
||||
|
|
@ -1353,9 +1355,10 @@ static void cancelled_ringing_call(void) {
|
|||
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallEnd,1, int, "%d");
|
||||
|
||||
call_history = linphone_core_get_call_history(marie->lc);
|
||||
BC_ASSERT_PTR_NOT_NULL(call_history);
|
||||
BC_ASSERT_EQUAL((int)bctbx_list_size(call_history),1, int,"%i");
|
||||
BC_ASSERT_EQUAL(linphone_call_log_get_status((LinphoneCallLog*)bctbx_list_get_data(call_history)), LinphoneCallMissed, LinphoneCallStatus, "%i");
|
||||
if (BC_ASSERT_PTR_NOT_NULL(call_history)) {
|
||||
BC_ASSERT_EQUAL((int)bctbx_list_size(call_history),1, int,"%i");
|
||||
BC_ASSERT_EQUAL(linphone_call_log_get_status((LinphoneCallLog*)bctbx_list_get_data(call_history)), LinphoneCallMissed, LinphoneCallStatus, "%i");
|
||||
}
|
||||
|
||||
linphone_call_unref(out_call);
|
||||
linphone_core_manager_destroy(marie);
|
||||
|
|
@ -1418,8 +1421,8 @@ static void call_declined_with_error(void) {
|
|||
LinphoneErrorInfo *ei = linphone_factory_create_error_info(factory);
|
||||
LinphoneErrorInfo *reason_ei = linphone_factory_create_error_info(factory);
|
||||
|
||||
linphone_error_info_set(ei, "SIP", LinphoneReasonUnknown, 603, "Decline", NULL); //ordre des arguments à vérifier
|
||||
linphone_error_info_set(reason_ei, "hardware", LinphoneReasonUnknown, 66, "J'ai plus de batterie", NULL);
|
||||
linphone_error_info_set(ei, "SIP", LinphoneReasonDeclined, 603, "Decline", NULL); //ordre des arguments à vérifier
|
||||
linphone_error_info_set(reason_ei, "hardware", LinphoneReasonDeclined, 66, "J'ai plus de batterie", NULL);
|
||||
|
||||
linphone_error_info_set_sub_error_info(ei, reason_ei);
|
||||
|
||||
|
|
@ -3150,22 +3153,25 @@ static void early_media_call_with_ringing_base(bool_t network_change){
|
|||
_linphone_call_add_local_desc_changed_flag(marie_call, SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED);
|
||||
}
|
||||
|
||||
linphone_call_accept(linphone_core_get_current_call(pauline->lc));
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000));
|
||||
connected_time=ms_get_cur_time_ms();
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000));
|
||||
|
||||
BC_ASSERT_PTR_EQUAL(marie_call, linphone_core_get_current_call(marie->lc));
|
||||
BC_ASSERT_FALSE(linphone_call_get_all_muted(marie_call));
|
||||
|
||||
liblinphone_tester_check_rtcp(marie, pauline);
|
||||
/*just to have a call duration !=0*/
|
||||
wait_for_list(lcs,&dummy,1,2000);
|
||||
|
||||
end_call(pauline, marie);
|
||||
ended_time=ms_get_cur_time_ms();
|
||||
BC_ASSERT_LOWER( labs((long)((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time))), 1000, long, "%ld");
|
||||
if (linphone_core_get_current_call(pauline->lc)
|
||||
&& linphone_call_get_state(linphone_core_get_current_call(pauline->lc)) == LinphoneCallIncomingEarlyMedia) {
|
||||
linphone_call_accept(linphone_core_get_current_call(pauline->lc));
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000));
|
||||
connected_time=ms_get_cur_time_ms();
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000));
|
||||
|
||||
BC_ASSERT_PTR_EQUAL(marie_call, linphone_core_get_current_call(marie->lc));
|
||||
BC_ASSERT_FALSE(linphone_call_get_all_muted(marie_call));
|
||||
|
||||
liblinphone_tester_check_rtcp(marie, pauline);
|
||||
/*just to have a call duration !=0*/
|
||||
wait_for_list(lcs,&dummy,1,2000);
|
||||
|
||||
end_call(pauline, marie);
|
||||
ended_time=ms_get_cur_time_ms();
|
||||
BC_ASSERT_LOWER( labs((long)((linphone_call_log_get_duration(marie_call_log)*1000) - (int64_t)(ended_time - connected_time))), 1000, long, "%ld");
|
||||
}
|
||||
bctbx_list_free(lcs);
|
||||
}
|
||||
|
||||
|
|
@ -5082,6 +5088,7 @@ static void recovered_call_on_network_switch_during_reinvite_1(void) {
|
|||
wait_for(marie->lc, pauline->lc, &marie->stat.number_of_NetworkReachableTrue, 2);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallPaused, 1));
|
||||
wait_for_until(marie->lc, pauline->lc, NULL, 1, 2000);
|
||||
linphone_call_terminate(incoming_call);
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
|
||||
|
|
@ -5904,7 +5911,7 @@ static void call_with_ice_without_stun2(void){
|
|||
static void call_with_ice_stun_not_responding(void){
|
||||
LinphoneCoreManager * marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
|
||||
|
||||
/*set dummy stun servers*/
|
||||
linphone_core_set_stun_server(marie->lc, "belledonne-communications.com:443");
|
||||
linphone_core_set_stun_server(pauline->lc, "belledonne-communications.com:443");
|
||||
|
|
|
|||
|
|
@ -2072,6 +2072,97 @@ static void video_call_with_high_bandwidth_available(void) {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void video_call_expected_fps_for_specified_bandwidth(int bandwidth, int fps, const char *resolution) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
|
||||
LinphoneVideoPolicy pol = {0};
|
||||
OrtpNetworkSimulatorParams simparams = { 0 };
|
||||
|
||||
if (ms_factory_get_cpu_count(linphone_core_get_ms_factory(marie->lc)) >= 2) {
|
||||
linphone_core_set_video_device(marie->lc, "Mire: Mire (synthetic moving picture)");
|
||||
linphone_core_enable_video_capture(marie->lc, TRUE);
|
||||
linphone_core_enable_video_display(marie->lc, TRUE);
|
||||
linphone_core_enable_video_capture(pauline->lc, TRUE);
|
||||
linphone_core_enable_video_display(pauline->lc, TRUE);
|
||||
|
||||
pol.automatically_accept = TRUE;
|
||||
pol.automatically_initiate = TRUE;
|
||||
linphone_core_set_video_policy(marie->lc, &pol);
|
||||
linphone_core_set_video_policy(pauline->lc, &pol);
|
||||
|
||||
linphone_core_set_preferred_video_size_by_name(marie->lc, resolution);
|
||||
simparams.mode = OrtpNetworkSimulatorOutbound;
|
||||
simparams.enabled = TRUE;
|
||||
simparams.max_bandwidth = (float)bandwidth;
|
||||
simparams.max_buffer_size = bandwidth;
|
||||
simparams.latency = 60;
|
||||
|
||||
linphone_core_set_network_simulator_params(marie->lc, &simparams);
|
||||
|
||||
if (BC_ASSERT_TRUE(call(marie, pauline))){
|
||||
LinphoneCall *call = linphone_core_get_current_call(marie->lc);
|
||||
|
||||
/*wait for the first TMMBR*/
|
||||
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.last_tmmbr_value_received, 1, 10000));
|
||||
|
||||
VideoStream *vstream = (VideoStream *)linphone_call_get_stream(call, LinphoneStreamTypeVideo);
|
||||
BC_ASSERT_EQUAL((int)vstream->configured_fps, fps, int, "%d");
|
||||
|
||||
end_call(marie, pauline);
|
||||
}
|
||||
} else {
|
||||
BC_PASS("Test requires at least a dual core");
|
||||
}
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
/*
|
||||
* This test simulates a video call with a lower bandwidth than the required_bitrate of the lowest given configuration.
|
||||
* The stream from pauline to marie is not under test.
|
||||
* It checks that after a few seconds marie, after receiving a TMMBR, has her fps set to the lowest given configuration.
|
||||
* This test requires at least a computer with 2 CPUs.
|
||||
*
|
||||
**/
|
||||
static void video_call_expected_fps_for_low_bandwidth(void) {
|
||||
#if defined(__ANDROID__) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
|
||||
video_call_expected_fps_for_specified_bandwidth(80000, 10, "qvga");
|
||||
#else
|
||||
video_call_expected_fps_for_specified_bandwidth(250000, 15, "vga");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This test simulates a video call with a regular bandwidth that is between a given configuration.
|
||||
* The stream from pauline to marie is not under test.
|
||||
* It checks that after a few seconds marie, after receiving a TMMBR, has her fps set to the expected given configuration.
|
||||
* This test requires at least a computer with 2 CPUs.
|
||||
*
|
||||
**/
|
||||
static void video_call_expected_fps_for_regular_bandwidth(void) {
|
||||
#if defined(__ANDROID__) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
|
||||
video_call_expected_fps_for_specified_bandwidth(500000, 12, "vga");
|
||||
#else
|
||||
video_call_expected_fps_for_specified_bandwidth(450000, 25, "vga");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This test simulates a video call with a higher bandwidth than the bitrate_limit of the highest given configuration.
|
||||
* The stream from pauline to marie is not under test.
|
||||
* It checks that after a few seconds marie, after receiving a TMMBR, has her fps set to the highest given configuration.
|
||||
* This test requires at least a computer with 2 CPUs.
|
||||
*
|
||||
**/
|
||||
static void video_call_expected_fps_for_high_bandwidth(void) {
|
||||
#if defined(__ANDROID__) || (TARGET_OS_IPHONE == 1) || defined(__arm__) || defined(_M_ARM)
|
||||
video_call_expected_fps_for_specified_bandwidth(400000, 12, "qcif");
|
||||
#else
|
||||
video_call_expected_fps_for_specified_bandwidth(5000000, 30, "vga");
|
||||
#endif
|
||||
}
|
||||
|
||||
test_t call_video_tests[] = {
|
||||
#ifdef VIDEO_ENABLED
|
||||
TEST_NO_TAG("Call paused resumed with video", call_paused_resumed_with_video),
|
||||
|
|
@ -2140,7 +2231,10 @@ test_t call_video_tests[] = {
|
|||
TEST_NO_TAG("Video call with no audio and no video codec", video_call_with_no_audio_and_no_video_codec),
|
||||
TEST_NO_TAG("Call with early media and no SDP in 200 Ok with video", call_with_early_media_and_no_sdp_in_200_with_video),
|
||||
TEST_NO_TAG("Video call with thin congestion", video_call_with_thin_congestion),
|
||||
TEST_NO_TAG("Video call with high bandwidth available", video_call_with_high_bandwidth_available)
|
||||
TEST_NO_TAG("Video call with high bandwidth available", video_call_with_high_bandwidth_available),
|
||||
TEST_NO_TAG("Video call expected FPS for low bandwidth", video_call_expected_fps_for_low_bandwidth),
|
||||
TEST_NO_TAG("Video call expected FPS for regular bandwidth", video_call_expected_fps_for_regular_bandwidth),
|
||||
TEST_NO_TAG("Video call expected FPS for high bandwidth", video_call_expected_fps_for_high_bandwidth)
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -2430,6 +2430,7 @@ static void group_chat_room_migrate_from_basic_to_client_fail (void) {
|
|||
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(paulineCr), 4, int, "%d");
|
||||
|
||||
// Activate groupchat on Pauline's side and wait for 5 seconds, the migration should now be done on next message sending
|
||||
lp_config_set_int(linphone_core_get_config(marie->lc),"misc","basic_to_client_group_chat_room_migration_timer",5);
|
||||
linphone_core_set_linphone_specs(pauline->lc, "groupchat");
|
||||
linphone_core_set_network_reachable(pauline->lc, FALSE);
|
||||
wait_for_list(coresList, &dummy, 1, 1000);
|
||||
|
|
@ -2508,13 +2509,13 @@ static void group_chat_donot_room_migrate_from_basic_chat_room (void) {
|
|||
linphone_chat_message_send(msg);
|
||||
linphone_chat_message_unref(msg);
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesBasic);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(marieCr), 2, int, "%d");
|
||||
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreationPending, initialPaulineStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreated, initialPaulineStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneChatRoomStateCreated, initialPaulineStats.number_of_LinphoneChatRoomStateCreated + 1, 3000));
|
||||
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(paulineCr) & LinphoneChatRoomCapabilitiesBasic);
|
||||
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(paulineCr), 1, int, "%d");
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 1000));
|
||||
|
|
|
|||
|
|
@ -105,6 +105,42 @@ static void simple_call_with_different_codec_mappings(void) {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void simple_call_with_fmtps(void){
|
||||
LinphoneCoreManager* marie;
|
||||
LinphoneCoreManager* pauline;
|
||||
LinphoneCall *pauline_call;
|
||||
|
||||
marie = linphone_core_manager_new( "marie_rc");
|
||||
pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
|
||||
disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1);
|
||||
disable_all_audio_codecs_except_one(pauline->lc,"pcmu",-1);
|
||||
|
||||
/*marie set a fantasy fmtp to PCMU*/
|
||||
linphone_payload_type_set_recv_fmtp(linphone_core_get_payload_type(marie->lc, "PCMU", 8000, -1), "parles-plus-fort=1");
|
||||
|
||||
BC_ASSERT_TRUE(call(marie,pauline));
|
||||
pauline_call=linphone_core_get_current_call(pauline->lc);
|
||||
BC_ASSERT_PTR_NOT_NULL(pauline_call);
|
||||
if (pauline_call){
|
||||
LinphonePayloadType *pt = linphone_call_params_get_used_audio_payload_type(linphone_call_get_current_params(pauline_call));
|
||||
BC_ASSERT_PTR_NOT_NULL(pt);
|
||||
if (pt){
|
||||
BC_ASSERT_STRING_EQUAL(linphone_payload_type_get_send_fmtp(pt),"parles-plus-fort=1");
|
||||
}
|
||||
pt = linphone_call_params_get_used_audio_payload_type(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)));
|
||||
BC_ASSERT_PTR_NOT_NULL(pt);
|
||||
if (pt){
|
||||
ms_message("send_fmtp=%s, recv_fmtp=%s", linphone_payload_type_get_send_fmtp(pt), linphone_payload_type_get_recv_fmtp(pt));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_payload_type_get_recv_fmtp(pt),"parles-plus-fort=1");
|
||||
}
|
||||
}
|
||||
|
||||
end_call(marie,pauline);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void call_failed_because_of_codecs(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
|
|
@ -492,6 +528,7 @@ static test_t offeranswer_tests[] = {
|
|||
TEST_NO_TAG("Start with no config", start_with_no_config),
|
||||
TEST_NO_TAG("Call failed because of codecs", call_failed_because_of_codecs),
|
||||
TEST_NO_TAG("Simple call with different codec mappings", simple_call_with_different_codec_mappings),
|
||||
TEST_NO_TAG("Simple call with fmtps", simple_call_with_fmtps),
|
||||
TEST_NO_TAG("AVP to AVP call", avp_to_avp_call),
|
||||
TEST_NO_TAG("AVP to AVPF call", avp_to_avpf_call),
|
||||
TEST_NO_TAG("AVP to SAVP call", avp_to_savp_call),
|
||||
|
|
|
|||
|
|
@ -791,7 +791,7 @@ static void presence_list_subscribe_network_changes(void) {
|
|||
linphone_core_set_presence_model(pauline->lc, presence);
|
||||
linphone_presence_model_unref(presence);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityAway, 1, 6000));
|
||||
BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityAway, 2, 6000));
|
||||
lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), pauline_identity);
|
||||
BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusAway, int, "%d");
|
||||
|
||||
|
|
@ -832,6 +832,28 @@ static void long_term_presence_base(const char* addr, bool_t exist, const char*
|
|||
linphone_friend_unref(friend2);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void long_term_presence_large_number_of_subs(void) {
|
||||
int i=0;
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
linphone_core_set_user_agent(pauline->lc, "bypass", NULL);
|
||||
LinphoneFriendList *friends = linphone_core_create_friend_list(pauline->lc);
|
||||
linphone_friend_list_set_rls_uri(friends, "sip:rls@sip.example.org");
|
||||
for (i = 0 ; i <1000; i++ ) {
|
||||
char user_id[256];
|
||||
snprintf(user_id, sizeof(user_id), "sip:user_%i@sip.example.org",i);
|
||||
LinphoneFriend* friend2 =linphone_core_create_friend_with_address(pauline->lc, user_id);
|
||||
linphone_friend_list_add_friend(friends,friend2);
|
||||
linphone_friend_unref(friend2);
|
||||
}
|
||||
linphone_core_add_friend_list(pauline->lc, friends);
|
||||
linphone_friend_list_unref(friends);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_NotifyPresenceReceived,i));
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void long_term_presence_existing_friend(void) {
|
||||
// this friend is not online, but is known from flexisip to be registered (see flexisip/userdb.conf),
|
||||
// so we expect to get a report that he is currently not online
|
||||
|
|
@ -1742,6 +1764,7 @@ test_t presence_server_tests[] = {
|
|||
TEST_ONE_TAG("Long term presence with +164 phone, without sip",long_term_presence_with_e164_phone_without_sip, "longterm"),
|
||||
TEST_ONE_TAG("Long term presence with phone, without sip",long_term_presence_with_phone_without_sip, "longterm"),
|
||||
TEST_ONE_TAG("Long term presence with cross references", long_term_presence_with_crossed_references,"longtern"),
|
||||
TEST_ONE_TAG("Long term presence with large number of subs", long_term_presence_large_number_of_subs,"longtern"),
|
||||
TEST_NO_TAG("Subscriber no longer reachable using server",subscriber_no_longer_reachable),
|
||||
TEST_NO_TAG("Subscribe with late publish", subscribe_with_late_publish),
|
||||
TEST_NO_TAG("Multiple publish aggregation", multiple_publish_aggregation),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[sip]
|
||||
sip_port=5092
|
||||
sip_tcp_port=5092
|
||||
sip_tls_port=5093
|
||||
sip_port=-1
|
||||
sip_tcp_port=-1
|
||||
sip_tls_port=-1
|
||||
default_proxy=0
|
||||
ping_with_options=0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[sip]
|
||||
sip_port=5092
|
||||
sip_tcp_port=5092
|
||||
sip_tls_port=5093
|
||||
sip_port=-1
|
||||
sip_tcp_port=-1
|
||||
sip_tls_port=-1
|
||||
default_proxy=0
|
||||
ping_with_options=0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[sip]
|
||||
sip_port=5092
|
||||
sip_tcp_port=5092
|
||||
sip_tls_port=5093
|
||||
sip_port=-1
|
||||
sip_tcp_port=-1
|
||||
sip_tls_port=-1
|
||||
default_proxy=0
|
||||
ping_with_options=0
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ subscribe=0
|
|||
|
||||
[misc]
|
||||
enable_basic_to_client_group_chat_room_migration=1
|
||||
basic_to_client_group_chat_room_migration_timer=10
|
||||
basic_to_client_group_chat_room_migration_timer=180
|
||||
|
||||
[rtp]
|
||||
audio_rtp_port=18070-28000
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[sip]
|
||||
sip_port=5072
|
||||
sip_tcp_port=5072
|
||||
sip_tls_port=5073
|
||||
sip_port=-1
|
||||
sip_tcp_port=-1
|
||||
sip_tls_port=-1
|
||||
default_proxy=0
|
||||
|
||||
[auth_info_0]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue