forked from mirrors/linphone-iphone
Merge branch 'master' into dev_vcard
Conflicts: coreapi/friendlist.c
This commit is contained in:
commit
3835ab26fb
14 changed files with 263 additions and 77 deletions
|
|
@ -148,6 +148,7 @@ static LinphoneAccountCreatorStatus validate_uri(const char* username, const cha
|
|||
|
||||
if (addr == NULL) {
|
||||
status = LinphoneAccountCreatorUsernameInvalid;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (domain && linphone_address_set_domain(addr, domain) != 0) {
|
||||
|
|
@ -157,7 +158,6 @@ static LinphoneAccountCreatorStatus validate_uri(const char* username, const cha
|
|||
if (display_name && linphone_address_set_display_name(addr, display_name) != 0) {
|
||||
status = LinphoneAccountCreatorDisplayNameInvalid;
|
||||
}
|
||||
|
||||
linphone_address_unref(addr);
|
||||
end:
|
||||
linphone_proxy_config_destroy(proxy);
|
||||
|
|
@ -184,13 +184,16 @@ static bool_t is_matching_regex(const char *entry, const char* regex) {
|
|||
}
|
||||
|
||||
LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccountCreator *creator, const char *username) {
|
||||
int min_length = lp_config_get_int(creator->core->config, "assistant", "username_min_length", 0);
|
||||
int fixed_length = lp_config_get_int(creator->core->config, "assistant", "username_length", 0);
|
||||
int min_length = lp_config_get_int(creator->core->config, "assistant", "username_min_length", -1);
|
||||
int fixed_length = lp_config_get_int(creator->core->config, "assistant", "username_length", -1);
|
||||
int max_length = lp_config_get_int(creator->core->config, "assistant", "username_max_length", -1);
|
||||
bool_t use_phone_number = lp_config_get_int(creator->core->config, "assistant", "use_phone_number", 0);
|
||||
const char* regex = lp_config_get_string(creator->core->config, "assistant", "username_regex", 0);
|
||||
LinphoneAccountCreatorStatus status;
|
||||
if (min_length > 0 && strlen(username) < min_length) {
|
||||
return LinphoneAccountCreatorUsernameTooShort;
|
||||
} else if (max_length > 0 && strlen(username) > max_length) {
|
||||
return LinphoneAccountCreatorUsernameTooLong;
|
||||
} else if (fixed_length > 0 && strlen(username) != fixed_length) {
|
||||
return LinphoneAccountCreatorUsernameInvalidSize;
|
||||
} else if (use_phone_number && !linphone_proxy_config_is_phone_number(NULL, username)) {
|
||||
|
|
@ -209,9 +212,12 @@ const char * linphone_account_creator_get_username(const LinphoneAccountCreator
|
|||
}
|
||||
|
||||
LinphoneAccountCreatorStatus linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password){
|
||||
int min_length = lp_config_get_int(creator->core->config, "assistant", "password_min_length", 0);
|
||||
int min_length = lp_config_get_int(creator->core->config, "assistant", "password_min_length", -1);
|
||||
int max_length = lp_config_get_int(creator->core->config, "assistant", "password_max_length", -1);
|
||||
if (min_length > 0 && strlen(password) < min_length) {
|
||||
return LinphoneAccountCreatorPasswordTooShort;
|
||||
} else if (max_length > 0 && strlen(password) > max_length) {
|
||||
return LinphoneAccountCreatorPasswordTooLong;
|
||||
}
|
||||
set_string(&creator->password, password, FALSE);
|
||||
return LinphoneAccountCreatorOK;
|
||||
|
|
|
|||
|
|
@ -51,8 +51,10 @@ typedef enum _LinphoneAccountCreatorStatus {
|
|||
LinphoneAccountCreatorEmailInvalid,
|
||||
LinphoneAccountCreatorUsernameInvalid,
|
||||
LinphoneAccountCreatorUsernameTooShort,
|
||||
LinphoneAccountCreatorUsernameTooLong,
|
||||
LinphoneAccountCreatorUsernameInvalidSize,
|
||||
LinphoneAccountCreatorPasswordTooShort,
|
||||
LinphoneAccountCreatorPasswordTooLong,
|
||||
LinphoneAccountCreatorDomainInvalid,
|
||||
LinphoneAccountCreatorRouteInvalid,
|
||||
LinphoneAccountCreatorDisplayNameInvalid,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public:
|
|||
bool microphoneIsMuted() const {return m_isMuted;}
|
||||
float getInputVolume() const;
|
||||
|
||||
virtual int getParticipantCount() const {return m_participants.size();}
|
||||
virtual int getSize() const {return m_participants.size() + (isIn()?1:0);}
|
||||
const std::list<Participant> &getParticipants() const {return m_participants;}
|
||||
|
||||
virtual int startRecording(const char *path) = 0;
|
||||
|
|
@ -98,7 +98,7 @@ public:
|
|||
virtual int enter();
|
||||
virtual int leave();
|
||||
virtual bool isIn() const {return m_localParticipantStream!=NULL;}
|
||||
virtual int getParticipantCount() const;
|
||||
virtual int getSize() const;
|
||||
|
||||
virtual int startRecording(const char *path);
|
||||
virtual int stopRecording();
|
||||
|
|
@ -380,7 +380,7 @@ int LocalConference::removeFromConference(LinphoneCall *call, bool_t active){
|
|||
}
|
||||
|
||||
int LocalConference::remoteParticipantsCount() {
|
||||
int count=getParticipantCount();
|
||||
int count=getSize();
|
||||
if (count==0) return 0;
|
||||
if (!m_localParticipantStream) return count;
|
||||
return count -1;
|
||||
|
|
@ -477,7 +477,7 @@ int LocalConference::leave() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int LocalConference::getParticipantCount() const {
|
||||
int LocalConference::getSize() const {
|
||||
if (m_conf == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -527,7 +527,7 @@ void LocalConference::onCallStreamStopping(LinphoneCall *call) {
|
|||
|
||||
void LocalConference::onCallTerminating(LinphoneCall *call) {
|
||||
int remote_count=remoteParticipantsCount();
|
||||
ms_message("conference_check_uninit(): size=%i", getParticipantCount());
|
||||
ms_message("conference_check_uninit(): size=%i", getSize());
|
||||
if (remote_count==1 && !m_terminated){
|
||||
convertConferenceToCall();
|
||||
}
|
||||
|
|
@ -585,7 +585,7 @@ int RemoteConference::addParticipant(LinphoneCall *call) {
|
|||
m_pendingCalls = ms_list_append(m_pendingCalls, linphone_call_ref(call));
|
||||
m_state = ConnectingToFocus;
|
||||
linphone_address_unref(addr);
|
||||
addParticipant(m_focusCall);
|
||||
call->conf_ref = (LinphoneConference *)this;
|
||||
return 0;
|
||||
} else return -1;
|
||||
|
||||
|
|
@ -840,8 +840,8 @@ float linphone_conference_get_input_volume(const LinphoneConference *obj) {
|
|||
return ((Conference *)obj)->getInputVolume();
|
||||
}
|
||||
|
||||
int linphone_conference_get_participant_count(const LinphoneConference *obj) {
|
||||
return ((Conference *)obj)->getParticipantCount();
|
||||
int linphone_conference_get_size(const LinphoneConference *obj) {
|
||||
return ((Conference *)obj)->getSize();
|
||||
}
|
||||
|
||||
MSList *linphone_conference_get_participants(const LinphoneConference *obj) {
|
||||
|
|
|
|||
|
|
@ -45,20 +45,20 @@ void linphone_conference_free(LinphoneConference *obj);
|
|||
|
||||
int linphone_conference_add_participant(LinphoneConference *obj, LinphoneCall *call);
|
||||
int linphone_conference_remove_participant_with_call(LinphoneConference *obj, LinphoneCall *call);
|
||||
int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri);
|
||||
LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri);
|
||||
int linphone_conference_terminate(LinphoneConference *obj);
|
||||
|
||||
int linphone_conference_enter(LinphoneConference *obj);
|
||||
int linphone_conference_leave(LinphoneConference *obj);
|
||||
bool_t linphone_conference_is_in(const LinphoneConference *obj);
|
||||
LINPHONE_PUBLIC bool_t linphone_conference_is_in(const LinphoneConference *obj);
|
||||
AudioStream *linphone_conference_get_audio_stream(const LinphoneConference *obj);
|
||||
|
||||
int linphone_conference_mute_microphone(LinphoneConference *obj, bool_t val);
|
||||
bool_t linphone_conference_microphone_is_muted(const LinphoneConference *obj);
|
||||
float linphone_conference_get_input_volume(const LinphoneConference *obj);
|
||||
|
||||
int linphone_conference_get_participant_count(const LinphoneConference *obj);
|
||||
MSList *linphone_conference_get_participants(const LinphoneConference *obj);
|
||||
LINPHONE_PUBLIC int linphone_conference_get_size(const LinphoneConference *obj);
|
||||
LINPHONE_PUBLIC MSList *linphone_conference_get_participants(const LinphoneConference *obj);
|
||||
|
||||
int linphone_conference_start_recording(LinphoneConference *obj, const char *path);
|
||||
int linphone_conference_stop_recording(LinphoneConference *obj);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
||||
#include <polarssl/md5.h>
|
||||
|
||||
|
||||
static char * create_resource_list_xml(const LinphoneFriendList *list) {
|
||||
|
|
@ -225,6 +226,7 @@ static LinphoneFriendList * linphone_friend_list_new(void) {
|
|||
static void linphone_friend_list_destroy(LinphoneFriendList *list) {
|
||||
if (list->display_name != NULL) ms_free(list->display_name);
|
||||
if (list->rls_uri != NULL) ms_free(list->rls_uri);
|
||||
if (list->content_digest != NULL) ms_free(list->content_digest);
|
||||
if (list->event != NULL) linphone_event_unref(list->event);
|
||||
list->friends = ms_list_free_with_data(list->friends, (void (*)(void *))linphone_friend_unref);
|
||||
}
|
||||
|
|
@ -303,7 +305,10 @@ void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_
|
|||
|
||||
LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *lf) {
|
||||
if (lf->uri == NULL || lf->in_list) {
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend");
|
||||
if (!lf->uri)
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend, no sip uri");
|
||||
if (lf->in_list)
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend, already in list");
|
||||
return LinphoneFriendListInvalidFriend;
|
||||
}
|
||||
if (ms_list_find(list->friends, lf) != NULL) {
|
||||
|
|
@ -393,27 +398,39 @@ void linphone_friend_list_close_subscriptions(LinphoneFriendList *list) {
|
|||
|
||||
void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered) {
|
||||
const MSList *elem;
|
||||
if (list->event != NULL) {
|
||||
linphone_event_refresh_subscribe(list->event);
|
||||
} else if (list->rls_uri != NULL) {
|
||||
if (list->rls_uri != NULL) {
|
||||
LinphoneAddress *address = linphone_address_new(list->rls_uri);
|
||||
char *xml_content = create_resource_list_xml(list);
|
||||
if ((address != NULL) && (xml_content != NULL) && (linphone_friend_list_has_subscribe_inactive(list) == TRUE)) {
|
||||
LinphoneContent *content;
|
||||
int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
|
||||
list->expected_notification_version = 0;
|
||||
list->event = linphone_core_create_subscribe(list->lc, address, "presence", expires);
|
||||
linphone_event_set_internal(list->event, TRUE);
|
||||
linphone_event_add_custom_header(list->event, "Require", "recipient-list-subscribe");
|
||||
linphone_event_add_custom_header(list->event, "Supported", "eventlist");
|
||||
linphone_event_add_custom_header(list->event, "Accept", "multipart/related, application/pidf+xml, application/rlmi+xml");
|
||||
linphone_event_add_custom_header(list->event, "Content-Disposition", "recipient-list");
|
||||
content = linphone_core_create_content(list->lc);
|
||||
linphone_content_set_type(content, "application");
|
||||
linphone_content_set_subtype(content, "resource-lists+xml");
|
||||
linphone_content_set_string_buffer(content, xml_content);
|
||||
linphone_event_send_subscribe(list->event, content);
|
||||
linphone_content_unref(content);
|
||||
unsigned char digest[16];
|
||||
md5((unsigned char *)xml_content, strlen(xml_content), digest);
|
||||
if ((list->event != NULL) && (list->content_digest != NULL) && (memcmp(list->content_digest, digest, sizeof(digest)) == 0)) {
|
||||
/* The content has not changed, only refresh the event. */
|
||||
linphone_event_refresh_subscribe(list->event);
|
||||
} else {
|
||||
LinphoneContent *content;
|
||||
int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
|
||||
list->expected_notification_version = 0;
|
||||
if (list->content_digest != NULL) ms_free(list->content_digest);
|
||||
list->content_digest = ms_malloc(sizeof(digest));
|
||||
memcpy(list->content_digest, digest, sizeof(digest));
|
||||
if (list->event != NULL) {
|
||||
linphone_event_terminate(list->event);
|
||||
linphone_event_unref(list->event);
|
||||
}
|
||||
list->event = linphone_core_create_subscribe(list->lc, address, "presence", expires);
|
||||
linphone_event_set_internal(list->event, TRUE);
|
||||
linphone_event_add_custom_header(list->event, "Require", "recipient-list-subscribe");
|
||||
linphone_event_add_custom_header(list->event, "Supported", "eventlist");
|
||||
linphone_event_add_custom_header(list->event, "Accept", "multipart/related, application/pidf+xml, application/rlmi+xml");
|
||||
linphone_event_add_custom_header(list->event, "Content-Disposition", "recipient-list");
|
||||
content = linphone_core_create_content(list->lc);
|
||||
linphone_content_set_type(content, "application");
|
||||
linphone_content_set_subtype(content, "resource-lists+xml");
|
||||
linphone_content_set_string_buffer(content, xml_content);
|
||||
linphone_event_send_subscribe(list->event, content);
|
||||
linphone_content_unref(content);
|
||||
}
|
||||
}
|
||||
if (address != NULL) linphone_address_unref(address);
|
||||
if (xml_content != NULL) ms_free(xml_content);
|
||||
|
|
|
|||
|
|
@ -708,6 +708,16 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
|
|||
md->custom_sdp_attributes = sal_custom_sdp_attribute_clone(params->custom_sdp_attributes);
|
||||
|
||||
/*set audio capabilities */
|
||||
|
||||
codec_hints.bandwidth_limit=params->audio_bw;
|
||||
codec_hints.max_codecs=-1;
|
||||
codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL;
|
||||
l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs);
|
||||
|
||||
// in case where no audio codec was found for this stream, the audio is disabled
|
||||
if (l == NULL) {
|
||||
params->has_audio = FALSE;
|
||||
}
|
||||
if (params->has_audio) {
|
||||
strncpy(md->streams[call->main_audio_stream_index].rtp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtp_addr));
|
||||
strncpy(md->streams[call->main_audio_stream_index].rtcp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtcp_addr));
|
||||
|
|
@ -722,10 +732,6 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
|
|||
md->streams[call->main_audio_stream_index].ptime=params->down_ptime;
|
||||
else
|
||||
md->streams[call->main_audio_stream_index].ptime=linphone_core_get_download_ptime(lc);
|
||||
codec_hints.bandwidth_limit=params->audio_bw;
|
||||
codec_hints.max_codecs=-1;
|
||||
codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL;
|
||||
l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs);
|
||||
md->streams[call->main_audio_stream_index].max_rate=get_max_codec_sample_rate(l);
|
||||
md->streams[call->main_audio_stream_index].payloads=l;
|
||||
if (call->audiostream && call->audiostream->ms.sessions.rtp_session) {
|
||||
|
|
|
|||
|
|
@ -7572,7 +7572,7 @@ bool_t linphone_core_is_in_conference(const LinphoneCore *lc) {
|
|||
}
|
||||
|
||||
int linphone_core_get_conference_size(LinphoneCore *lc) {
|
||||
if(lc->conf_ctx) return linphone_conference_get_participant_count(lc->conf_ctx);
|
||||
if(lc->conf_ctx) return linphone_conference_get_size(lc->conf_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3900,9 +3900,10 @@ LINPHONE_PUBLIC float linphone_core_get_conference_local_input_volume(LinphoneCo
|
|||
*/
|
||||
LINPHONE_PUBLIC int linphone_core_terminate_conference(LinphoneCore *lc);
|
||||
/**
|
||||
* Get the number of remote participant in the running conference
|
||||
* Get the number of participant in the running conference. The local
|
||||
* participant is included in the count only if it is in the conference.
|
||||
* @param lc #LinphoneCore
|
||||
* @return The number of remote participant
|
||||
* @return The number of participant
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_core_get_conference_size(LinphoneCore *lc);
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4710,8 +4710,8 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAudioDscp(JNIEnv* env
|
|||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAndroidPowerManager(JNIEnv *env, jclass cls, jobject pm) {
|
||||
#ifdef ANDROID
|
||||
if(pm != NULL) bellesip_wake_lock_init(env, pm);
|
||||
else bellesip_wake_lock_uninit(env);
|
||||
if(pm != NULL) belle_sip_wake_lock_init(env, pm);
|
||||
else belle_sip_wake_lock_uninit(env);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -696,6 +696,7 @@ struct _LinphoneFriendList {
|
|||
char *display_name;
|
||||
char *rls_uri;
|
||||
MSList *friends;
|
||||
unsigned char *content_digest;
|
||||
int expected_notification_version;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5264,7 +5264,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) {
|
|||
ms_message("Pauline sent %i RTP packets and received %i (through our modifier)", (int)data_pauline->packetSentCount, (int)data_pauline->packetReceivedCount);
|
||||
// There will be a few RTP packets sent on marie's side before the call is ended at pauline's request, so we need the threshold
|
||||
BC_ASSERT_TRUE(data_marie->packetSentCount - data_pauline->packetReceivedCount < 50);
|
||||
BC_ASSERT_TRUE(data_marie->packetReceivedCount == data_pauline->packetSentCount);
|
||||
BC_ASSERT_TRUE(data_pauline->packetSentCount - data_marie->packetReceivedCount < 50);
|
||||
// At this point, we know each packet that has been processed in the send callback of our RTP modifier also go through the recv callback of the remote.
|
||||
|
||||
// Now we want to ensure that all sent RTP packets actually go through our RTP transport modifier and thus no packet leave without being processed (by any operation we might want to do on it)
|
||||
|
|
|
|||
|
|
@ -723,7 +723,6 @@ static void call_with_ipv6(void) {
|
|||
|
||||
static void file_transfer_message_rcs_to_external_body_client(void) {
|
||||
if (transport_supported(LinphoneTransportTls)) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatMessage* message;
|
||||
LinphoneChatMessageCbs *cbs;
|
||||
|
|
@ -732,13 +731,19 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
size_t file_size;
|
||||
char *send_filepath = bc_tester_res("images/nowebcamCIF.jpg");
|
||||
char *receive_filepath = bc_tester_file("receive_file.dump");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new2( "marie_rc", FALSE);
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new2( "pauline_rc", FALSE);
|
||||
// This is done to prevent register to be sent before the custom header is set
|
||||
linphone_core_set_network_reachable(marie->lc, FALSE);
|
||||
linphone_core_set_network_reachable(pauline->lc, FALSE);
|
||||
|
||||
linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_core_manager_start(marie, TRUE);
|
||||
linphone_core_set_network_reachable(marie->lc, TRUE);
|
||||
|
||||
linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml");
|
||||
linphone_core_manager_start(pauline, TRUE);
|
||||
linphone_core_set_network_reachable(pauline->lc, TRUE);
|
||||
|
||||
reset_counters(&marie->stat);
|
||||
reset_counters(&pauline->stat);
|
||||
|
|
|
|||
|
|
@ -262,8 +262,9 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
|
|||
BC_ASSERT_PTR_NOT_NULL(conference = linphone_core_get_conference(marie->lc));
|
||||
if(conference) {
|
||||
MSList *participants = linphone_conference_get_participants(conference);
|
||||
BC_ASSERT_EQUAL(linphone_conference_get_participant_count(conference), linphone_core_get_conference_size(marie->lc), int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_conference_get_participant_count(conference), ms_list_size(participants), int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_conference_get_size(conference), linphone_core_get_conference_size(marie->lc), int, "%d");
|
||||
BC_ASSERT_EQUAL(linphone_conference_get_size(conference), ms_list_size(participants)+(linphone_conference_is_in(conference)?1:0), int, "%d");
|
||||
BC_ASSERT_TRUE(linphone_conference_is_in(conference));
|
||||
ms_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,19 +131,25 @@ static void call_failed_because_of_codecs(void) {
|
|||
}
|
||||
|
||||
|
||||
static void profile_call_base(bool_t avpf1, LinphoneMediaEncryption srtp1,bool_t avpf2, LinphoneMediaEncryption srtp2, bool_t encryption_mandatory, const char *expected_profile) {
|
||||
static void profile_call_base(bool_t avpf1
|
||||
, LinphoneMediaEncryption srtp1
|
||||
, bool_t avpf2
|
||||
, LinphoneMediaEncryption srtp2
|
||||
, bool_t encryption_mandatory
|
||||
, const char *expected_profile
|
||||
, bool_t enable_video) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_tcp_rc");
|
||||
LinphoneProxyConfig *lpc;
|
||||
const LinphoneCallParams *params;
|
||||
|
||||
if (avpf1) {
|
||||
linphone_core_get_default_proxy(marie->lc, &lpc);
|
||||
lpc = linphone_core_get_default_proxy_config(marie->lc);
|
||||
linphone_proxy_config_enable_avpf(lpc, TRUE);
|
||||
linphone_proxy_config_set_avpf_rr_interval(lpc, 3);
|
||||
}
|
||||
if (avpf2) {
|
||||
linphone_core_get_default_proxy(pauline->lc, &lpc);
|
||||
lpc = linphone_core_get_default_proxy_config(pauline->lc);
|
||||
linphone_proxy_config_enable_avpf(lpc, TRUE);
|
||||
linphone_proxy_config_set_avpf_rr_interval(lpc, 3);
|
||||
}
|
||||
|
|
@ -152,6 +158,18 @@ static void profile_call_base(bool_t avpf1, LinphoneMediaEncryption srtp1,bool_t
|
|||
linphone_core_set_media_encryption_mandatory(marie->lc,TRUE);
|
||||
linphone_core_set_media_encryption_mandatory(pauline->lc,TRUE);
|
||||
}
|
||||
|
||||
if (enable_video && linphone_core_video_supported(marie->lc)) {
|
||||
LinphoneVideoPolicy policy;
|
||||
policy.automatically_accept = TRUE;
|
||||
policy.automatically_initiate = TRUE;
|
||||
linphone_core_enable_video_capture(marie->lc, TRUE);
|
||||
linphone_core_enable_video_display(marie->lc, TRUE);
|
||||
linphone_core_set_video_policy(marie->lc,&policy);
|
||||
linphone_core_enable_video_capture(pauline->lc, TRUE);
|
||||
linphone_core_enable_video_display(pauline->lc, TRUE);
|
||||
linphone_core_set_video_policy(pauline->lc,&policy);
|
||||
}
|
||||
|
||||
if (linphone_core_media_encryption_supported(marie->lc, srtp1)) {
|
||||
linphone_core_set_media_encryption(marie->lc, srtp1);
|
||||
|
|
@ -190,90 +208,197 @@ end:
|
|||
linphone_core_manager_destroy(marie);
|
||||
}
|
||||
|
||||
static void profile_call(bool_t avpf1, LinphoneMediaEncryption srtp1, bool_t avpf2, LinphoneMediaEncryption srtp2, const char *expected_profile) {
|
||||
profile_call_base(avpf1, srtp1, avpf2,srtp2,FALSE,expected_profile);
|
||||
static void profile_call(bool_t avpf1, LinphoneMediaEncryption srtp1, bool_t avpf2, LinphoneMediaEncryption srtp2, const char *expected_profile, bool_t enable_video) {
|
||||
profile_call_base(avpf1, srtp1, avpf2,srtp2,FALSE,expected_profile,enable_video);
|
||||
}
|
||||
|
||||
static void avp_to_avp_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionNone, "RTP/AVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionNone, "RTP/AVP", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avp_to_avp_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionNone, "RTP/AVP", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void avp_to_avpf_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionNone, "RTP/AVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionNone, "RTP/AVP",FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avp_to_avpf_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionNone, "RTP/AVP",TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void avp_to_savp_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionSRTP, "RTP/AVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionSRTP, "RTP/AVP", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avp_to_savp_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionSRTP, "RTP/AVP", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void avp_to_savpf_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionSRTP, "RTP/AVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionSRTP, "RTP/AVP", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avp_to_savpf_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionSRTP, "RTP/AVP", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void avpf_to_avp_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionNone, "RTP/AVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionNone, "RTP/AVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avpf_to_avp_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionNone, "RTP/AVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void avpf_to_avpf_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionNone, "RTP/AVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionNone, "RTP/AVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avpf_to_avpf_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionNone, "RTP/AVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void avpf_to_savp_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionSRTP, "RTP/AVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionSRTP, "RTP/AVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avpf_to_savp_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, FALSE, LinphoneMediaEncryptionSRTP, "RTP/AVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void avpf_to_savpf_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionSRTP, "RTP/AVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionSRTP, "RTP/AVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void avpf_to_savpf_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionNone, TRUE, LinphoneMediaEncryptionSRTP, "RTP/AVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savp_to_avp_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionNone, "RTP/SAVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionNone, "RTP/SAVP", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savp_to_avp_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionNone, "RTP/SAVP", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savp_to_avpf_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionNone, "RTP/SAVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionNone, "RTP/SAVP", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savp_to_avpf_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionNone, "RTP/SAVP", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savp_to_savp_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionSRTP, "RTP/SAVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionSRTP, "RTP/SAVP", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savp_to_savp_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionSRTP, "RTP/SAVP", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savp_to_savpf_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionSRTP, "RTP/SAVP");
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionSRTP, "RTP/SAVP", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savp_to_savpf_video_call(void) {
|
||||
profile_call(FALSE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionSRTP, "RTP/SAVP", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_to_avp_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionNone, "RTP/SAVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionNone, "RTP/SAVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_to_avp_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionNone, "RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_to_avpf_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionNone, "RTP/SAVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionNone, "RTP/SAVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_to_avpf_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionNone, "RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_to_savp_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionSRTP, "RTP/SAVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionSRTP, "RTP/SAVPF", FALSE);
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_to_savp_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, FALSE, LinphoneMediaEncryptionSRTP, "RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
static void savpf_to_savpf_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionSRTP, "RTP/SAVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionSRTP, "RTP/SAVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_to_savpf_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionSRTP, TRUE, LinphoneMediaEncryptionSRTP, "RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_dtls_to_savpf_dtls_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionDTLS, "UDP/TLS/RTP/SAVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionDTLS, "UDP/TLS/RTP/SAVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_dtls_to_savpf_dtls_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionDTLS, "UDP/TLS/RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_dtls_to_savpf_dtls_encryption_mandatory_call(void) {
|
||||
profile_call_base(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionDTLS, TRUE, "UDP/TLS/RTP/SAVPF");
|
||||
profile_call_base(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionDTLS, TRUE, "UDP/TLS/RTP/SAVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_dtls_to_savpf_dtls_encryption_mandatory_video_call(void) {
|
||||
profile_call_base(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionDTLS, TRUE, "UDP/TLS/RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_dtls_to_savpf_encryption_mandatory_call(void) {
|
||||
/*profile_call_base(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionSRTP, TRUE, "UDP/TLS/RTP/SAVPF"); not sure of result*/
|
||||
/*profile_call_base(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionSRTP, TRUE, "UDP/TLS/RTP/SAVPF",FALSE); not sure of result*/
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_dtls_to_savpf_encryption_mandatory_video_call(void) {
|
||||
/*profile_call_base(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionSRTP, TRUE, "UDP/TLS/RTP/SAVPF",TRUE); not sure of result*/
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_dtls_to_savpf_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionSRTP, "UDP/TLS/RTP/SAVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionSRTP, "UDP/TLS/RTP/SAVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_dtls_to_savpf_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionSRTP, "UDP/TLS/RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void savpf_dtls_to_avpf_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionNone, "UDP/TLS/RTP/SAVPF");
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionNone, "UDP/TLS/RTP/SAVPF", FALSE);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
static void savpf_dtls_to_avpf_video_call(void) {
|
||||
profile_call(TRUE, LinphoneMediaEncryptionDTLS, TRUE, LinphoneMediaEncryptionNone, "UDP/TLS/RTP/SAVPF", TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
static LinphonePayloadType * configure_core_for_avpf_and_video(LinphoneCore *lc) {
|
||||
|
|
@ -283,7 +408,7 @@ static LinphonePayloadType * configure_core_for_avpf_and_video(LinphoneCore *lc)
|
|||
|
||||
policy.automatically_initiate = TRUE;
|
||||
policy.automatically_accept = TRUE;
|
||||
linphone_core_get_default_proxy(lc, &lpc);
|
||||
lpc = linphone_core_get_default_proxy_config(lc);
|
||||
linphone_proxy_config_enable_avpf(lpc, TRUE);
|
||||
linphone_proxy_config_set_avpf_rr_interval(lpc, 3);
|
||||
linphone_core_set_video_device(lc, "StaticImage: Static picture");
|
||||
|
|
@ -389,6 +514,28 @@ static test_t offeranswer_tests[] = {
|
|||
{ "SAVPF/DTLS to SAVPF encryption mandatory call", savpf_dtls_to_savpf_encryption_mandatory_call},
|
||||
{ "SAVPF/DTLS to AVPF call", savpf_dtls_to_avpf_call},
|
||||
#ifdef VIDEO_ENABLED
|
||||
{ "AVP to AVP video call", avp_to_avp_video_call },
|
||||
{ "AVP to AVPF video call", avp_to_avpf_video_call },
|
||||
{ "AVP to SAVP video call", avp_to_savp_video_call },
|
||||
{ "AVP to SAVPF video call", avp_to_savpf_video_call },
|
||||
{ "AVPF to AVP video call", avpf_to_avp_video_call },
|
||||
{ "AVPF to AVPF video call", avpf_to_avpf_video_call },
|
||||
{ "AVPF to SAVP video call", avpf_to_savp_video_call },
|
||||
{ "AVPF to SAVPF video call", avpf_to_savpf_video_call },
|
||||
{ "SAVP to AVP video call", savp_to_avp_video_call },
|
||||
{ "SAVP to AVPF video call", savp_to_avpf_video_call },
|
||||
{ "SAVP to SAVP video call", savp_to_savp_video_call },
|
||||
{ "SAVP to SAVPF video call", savp_to_savpf_video_call },
|
||||
{ "SAVPF to AVP video call", savpf_to_avp_video_call },
|
||||
{ "SAVPF to AVPF video call", savpf_to_avpf_video_call },
|
||||
{ "SAVPF to SAVP video call", savpf_to_savp_video_call },
|
||||
{ "SAVPF to SAVPF video call", savpf_to_savpf_video_call },
|
||||
{ "SAVPF/DTLS to SAVPF/DTLS video call", savpf_dtls_to_savpf_dtls_video_call},
|
||||
{ "SAVPF/DTLS to SAVPF/DTLS encryption mandatory video call", savpf_dtls_to_savpf_dtls_encryption_mandatory_video_call},
|
||||
{ "SAVPF/DTLS to SAVPF video call", savpf_dtls_to_savpf_video_call},
|
||||
{ "SAVPF/DTLS to SAVPF encryption mandatory video call", savpf_dtls_to_savpf_encryption_mandatory_video_call},
|
||||
{ "SAVPF/DTLS to AVPF call", savpf_dtls_to_avpf_video_call},
|
||||
|
||||
{ "Compatible AVPF features", compatible_avpf_features },
|
||||
{ "Incompatible AVPF features", incompatible_avpf_features },
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue