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

Conflicts:
	tester/message_tester.c
This commit is contained in:
Margaux Clerc 2014-07-11 14:45:10 +02:00
commit e6eb8008fa
54 changed files with 7282 additions and 4912 deletions

1
.gitignore vendored
View file

@ -72,3 +72,4 @@ tools/lpc2xml_test
tools/xml2lpc_test
coreapi/help/filetransfer
tester/receive_file.dump
tester/tmp.db

View file

@ -205,7 +205,7 @@ endif
ifeq ($(BUILD_OPENH264),1)
LOCAL_STATIC_LIBRARIES += \
libmsopenh264 \
libwels
libopenh264
endif
endif

View file

@ -54,7 +54,7 @@
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\belle-sip\include;$(ProjectDir)..\..\oRTP\include;$(ProjectDir)..\..\mediastreamer2\include;$(ProjectDIr)..\..\..\tunnel\include;$(ProjectDir)..\..\coreapi;$(ProjectDir)..\..\include;$(SolutionDir)$(Platform)\$(Configuration)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__STDC_CONSTANT_MACROS;_CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;_USRDLL;WINDOW_NATIVE;_TRUE_TIME;IN_LINPHONE;USE_BELLESIP;TUNNEL_ENABLED;VIDEO_ENABLED;LINPHONE_PACKAGE_NAME="linphone";LINPHONE_VERSION="Devel";LIBLINPHONE_EXPORTS;LINPHONE_PLUGINS_DIR="";UNICODE;_XKEYCHECK_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__STDC_CONSTANT_MACROS;_CRT_SECURE_NO_WARNINGS;WIN32;_WINDOWS;_USRDLL;WINDOW_NATIVE;_TRUE_TIME;IN_LINPHONE;USE_BELLESIP;TUNNEL_ENABLED;VIDEO_ENABLED;LINPHONE_PACKAGE_NAME="linphone";LINPHONE_VERSION="Devel";LIBLINPHONE_EXPORTS;LINPHONE_PLUGINS_DIR=".";UNICODE;_XKEYCHECK_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>

View file

@ -863,6 +863,10 @@ AM_CONDITIONAL([BUILD_CUNIT_TESTS], [test x$found_cunit = xyes && test x$tests_e
if test "$found_cunit" = "no" ; then
AC_MSG_WARN([Could not find cunit framework, tests are not compiled.])
else
AC_CHECK_LIB(cunit,CU_get_suite,[
AC_DEFINE(HAVE_CU_GET_SUITE,1,[defined when CU_get_suite is available])
],[foo=bar],[$CUNIT_LIBS])
AC_CHECK_LIB(cunit,CU_curses_run_tests,[
AC_DEFINE(HAVE_CU_CURSES,1,[defined when CU_curses_run_tests is available])
],[foo=bar],[$CUNIT_LIBS])

View file

@ -97,6 +97,7 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args);
static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
static int lpc_cmd_preview_window(LinphoneCore *lc, char *args);
static int lpc_cmd_snapshot(LinphoneCore *lc, char *args);
static int lpc_cmd_preview_snapshot(LinphoneCore *lc, char *args);
static int lpc_cmd_vfureq(LinphoneCore *lc, char *arg);
#endif
static int lpc_cmd_states(LinphoneCore *lc, char *args);
@ -312,6 +313,9 @@ static LPC_COMMAND advanced_commands[] = {
{ "snapshot", lpc_cmd_snapshot, "Take a snapshot of currently received video stream",
"'snapshot <file path>': take a snapshot and records it in jpeg format into the supplied path\n"
},
{ "preview-snapshot", lpc_cmd_preview_snapshot, "Take a snapshot of currently captured video stream",
"'preview-snapshot <file path>': take a snapshot and records it in jpeg format into the supplied path\n"
},
{ "vfureq", lpc_cmd_vfureq, "Request the other side to send VFU for the current call"},
#endif
{ "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions",
@ -2438,7 +2442,7 @@ static void lpc_display_call_states(LinphoneCore *lc){
for(;elem!=NULL;elem=elem->next){
const char *flag;
call=(LinphoneCall*)elem->data;
bool_t in_conference=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
bool_t in_conference=linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call));
tmp=linphone_call_get_remote_address_as_string (call);
flag=in_conference ? "conferencing" : "";
flag=linphone_call_has_transfer_pending(call) ? "transfer pending" : flag;
@ -2548,6 +2552,17 @@ static int lpc_cmd_snapshot(LinphoneCore *lc, char *args){
return 1;
}
static int lpc_cmd_preview_snapshot(LinphoneCore *lc, char *args){
LinphoneCall *call;
if (!args) return 0;
call=linphone_core_get_current_call(lc);
if (call!=NULL){
linphone_call_take_preview_snapshot(call,args);
linphonec_out("Taking video preview snapshot in file %s\n", args);
}else linphonec_out("There is no active call.\n");
return 1;
}
static int lpc_cmd_vfureq(LinphoneCore *lc, char *arg){
LinphoneCall *call;
call=linphone_core_get_current_call(lc);

View file

@ -131,7 +131,7 @@ test_numbers_LDADD=liblinphone.la $(liblinphone_la_LIBADD)
endif
AM_CPPFLAGS=\
-I$(top_srcdir) -I$(top_srcdir)/include
-I$(top_srcdir) -I$(top_srcdir)/include -I$(builddir)
AM_CFLAGS=\
$(STRICT_OPTIONS) -DIN_LINPHONE \
@ -168,19 +168,21 @@ make_gitversion_h:
echo "*** PACKAGE_VERSION and git tag differ. Please put them identical."; \
exit 1; \
fi ; \
$(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(GITDESCRIBE)\"" > $(GITVERSION_FILE_TMP) ; \
$(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(GITDESCRIBE)\"" > $(builddir)/$(GITVERSION_FILE_TMP) ; \
elif test "$(GITREVISION)" != "" ; then \
$(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(LINPHONE_VERSION)_$(GITREVISION)\"" > $(GITVERSION_FILE_TMP) ; \
$(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(LINPHONE_VERSION)_$(GITREVISION)\"" > $(builddir)/$(GITVERSION_FILE_TMP) ; \
else \
$(ECHO) -n "" > $(builddir)/$(GITVERSION_FILE_TMP) ; \
fi ; \
else \
$(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \
$(ECHO) -n "" > $(builddir)/$(GITVERSION_FILE_TMP) ; \
fi
if test ! -f $(srcdir)/$(GITVERSION_FILE) ; then \
cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
if ! test -f $(builddir)/$(GITVERSION_FILE) ; then \
cp -f $(builddir)/$(GITVERSION_FILE_TMP) $(builddir)/$(GITVERSION_FILE) ; \
fi
if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \
cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
if test "`cat $(builddir)/$(GITVERSION_FILE_TMP)`" != "`cat $(builddir)/$(GITVERSION_FILE)`" ; then \
cp -f $(builddir)/$(GITVERSION_FILE_TMP) $(builddir)/$(GITVERSION_FILE) ; \
fi
rm -f $(GITVERSION_FILE_TMP) ;
rm -f $(builddir)/$(GITVERSION_FILE_TMP) ;
$(GITVERSION_FILE): make_gitversion_h

View file

@ -31,20 +31,6 @@
* @{
**/
/**
* Create a LinphoneAuthInfo object with supplied information.
* The object can be created empty, that is with all arguments set to NULL.
* Username, userid, password, realm and domain can be set later using specific methods.
* At the end, username and passwd (or ha1) are required.
* @param username the username that needs to be authenticated
* @param userid the userid used for authenticating (use NULL if you don't know what it is)
* @param passwd the password in clear text
* @param ha1 the ha1-encrypted password if password is not given in clear text.
* @param realm the authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don't use this parameter.
* @param domain the SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.
* @return a #LinphoneAuthInfo. linphone_auth_info_destroy() must be used to destroy it when no longer needed. The LinphoneCore makes a copy of LinphoneAuthInfo
* passed through linphone_core_add_auth_info().
**/
LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain){
LinphoneAuthInfo *obj=ms_new0(LinphoneAuthInfo,1);
if (username!=NULL && (strlen(username)>0) ) obj->username=ms_strdup(username);
@ -67,16 +53,10 @@ LinphoneAuthInfo *linphone_auth_info_clone(const LinphoneAuthInfo *ai){
return obj;
}
/**
* Returns username.
**/
const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i){
return i->username;
}
/**
* Returns password.
**/
const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i){
return i->passwd;
}
@ -97,9 +77,6 @@ const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *i){
return i->ha1;
}
/**
* Sets the password.
**/
void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd){
if (info->passwd!=NULL) {
ms_free(info->passwd);
@ -108,9 +85,6 @@ void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd){
if (passwd!=NULL && (strlen(passwd)>0)) info->passwd=ms_strdup(passwd);
}
/**
* Sets the username.
**/
void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username){
if (info->username){
ms_free(info->username);
@ -119,9 +93,6 @@ void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *usernam
if (username && strlen(username)>0) info->username=ms_strdup(username);
}
/**
* Sets userid.
**/
void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid){
if (info->userid){
ms_free(info->userid);
@ -130,9 +101,6 @@ void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid){
if (userid && strlen(userid)>0) info->userid=ms_strdup(userid);
}
/**
* Set realm.
**/
void linphone_auth_info_set_realm(LinphoneAuthInfo *info, const char *realm){
if (info->realm){
ms_free(info->realm);
@ -141,10 +109,6 @@ void linphone_auth_info_set_realm(LinphoneAuthInfo *info, const char *realm){
if (realm && strlen(realm)>0) info->realm=ms_strdup(realm);
}
/**
* Set domain for which this authentication is valid. This should not be necessary because realm is supposed to be unique and sufficient.
* However, many SIP servers don't set realm correctly, then domain has to be used to distinguish between several SIP account bearing the same username.
**/
void linphone_auth_info_set_domain(LinphoneAuthInfo *info, const char *domain){
if (info->domain){
ms_free(info->domain);
@ -153,9 +117,6 @@ void linphone_auth_info_set_domain(LinphoneAuthInfo *info, const char *domain){
if (domain && strlen(domain)>0) info->domain=ms_strdup(domain);
}
/**
* Sets ha1.
**/
void linphone_auth_info_set_ha1(LinphoneAuthInfo *info, const char *ha1){
if (info->ha1){
ms_free(info->ha1);

View file

@ -220,6 +220,7 @@ static bool_t already_a_call_pending(LinphoneCore *lc){
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
if (call->state==LinphoneCallIncomingReceived
|| call->state==LinphoneCallIncomingEarlyMedia
|| call->state==LinphoneCallOutgoingInit
|| call->state==LinphoneCallOutgoingProgress
|| call->state==LinphoneCallOutgoingEarlyMedia

View file

@ -162,7 +162,9 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
char *content_type=belle_sip_strdup_printf("%s/%s", msg->file_transfer_information->type, msg->file_transfer_information->subtype);
/* create a user body handler to take care of the file */
belle_sip_user_body_handler_t *first_part_bh=belle_sip_user_body_handler_new(msg->file_transfer_information->size+linphone_chat_message_compute_filepart_header_size(msg->file_transfer_information->name, content_type), NULL, NULL, linphone_chat_message_file_transfer_on_send_body, msg);
size_t body_size = msg->file_transfer_information->size+linphone_chat_message_compute_filepart_header_size(msg->file_transfer_information->name, content_type);
belle_sip_user_body_handler_t *first_part_bh=belle_sip_user_body_handler_new(body_size,NULL,NULL,linphone_chat_message_file_transfer_on_send_body,msg);
/* insert it in a multipart body handler which will manage the boundaries of multipart message */
belle_sip_multipart_body_handler_t *bh=belle_sip_multipart_body_handler_new(linphone_chat_message_file_transfer_on_progress, msg, (belle_sip_body_handler_t *)first_part_bh);
@ -283,9 +285,9 @@ bool_t linphone_core_chat_enabled(const LinphoneCore *lc){
}
/**
* Returns an array of chat rooms
* Returns an list of chat rooms
* @param lc #LinphoneCore object
* @return An array of #LinpĥoneChatRoom
* @return A list of #LinphoneChatRoom
**/
MSList* linphone_core_get_chat_rooms(LinphoneCore *lc) {
return lc->chatrooms;
@ -1062,10 +1064,33 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
}
}
return;
/* feed the callback with the received data */
}
static LinphoneContent* linphone_chat_create_file_transfer_information_from_headers(const belle_sip_message_t* message ){
LinphoneContent *content = ms_malloc0(sizeof(LinphoneContent));
belle_sip_header_content_length_t* content_length_hdr = BELLE_SIP_HEADER_CONTENT_LENGTH(belle_sip_message_get_header(message, "Content-Length"));
belle_sip_header_content_type_t* content_type_hdr = BELLE_SIP_HEADER_CONTENT_TYPE(belle_sip_message_get_header(message, "Content-Type"));
const char* type = NULL,*subtype = NULL;
content->name = ms_strdup("");
if( content_type_hdr ){
type = belle_sip_header_content_type_get_type(content_type_hdr);
subtype = belle_sip_header_content_type_get_subtype(content_type_hdr);
ms_message("Extracted content type %s / %s from header", type?type:"", subtype?subtype:"");
if( type ) content->type = ms_strdup(type);
if( subtype ) content->type = ms_strdup(subtype);
}
if( content_length_hdr ){
content->size = belle_sip_header_content_length_get_content_length(content_length_hdr);
ms_message("Extracted content length %i from header", (int)content->size);
}
return content;
}
static void linphone_chat_process_response_headers_from_get_file(void *data, const belle_http_response_event_t *event){
@ -1073,9 +1098,21 @@ static void linphone_chat_process_response_headers_from_get_file(void *data, con
/*we are receiving a response, set a specific body handler to acquire the response.
* if not done, belle-sip will create a memory body handler, the default*/
LinphoneChatMessage *message=(LinphoneChatMessage *)belle_sip_object_data_get(BELLE_SIP_OBJECT(event->request),"message");
belle_sip_message_t* response = BELLE_SIP_MESSAGE(event->response);
size_t body_size = 0;
if( message->file_transfer_information == NULL ){
ms_warning("No file transfer information for message %p: creating...", message);
message->file_transfer_information = linphone_chat_create_file_transfer_information_from_headers(response);
}
if( message->file_transfer_information ){
body_size = message->file_transfer_information->size;
}
belle_sip_message_set_body_handler(
(belle_sip_message_t*)event->response,
(belle_sip_body_handler_t*)belle_sip_user_body_handler_new(message->file_transfer_information->size, linphone_chat_message_file_transfer_on_progress,on_recv_body,NULL,message)
(belle_sip_body_handler_t*)belle_sip_user_body_handler_new(body_size, linphone_chat_message_file_transfer_on_progress,on_recv_body,NULL,message)
);
}
}

View file

@ -561,7 +561,7 @@ static void port_config_set(LinphoneCall *call, int stream_index, int min_port,
static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){
int min_port, max_port;
ms_message("New LinphoneCall [%p] initialized (LinphoneCore version: %s)",call,linphone_core_get_version());
call->magic=linphone_call_magic;
call->refcnt=1;
call->state=LinphoneCallIdle;
@ -1035,6 +1035,8 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
if (vstream != NULL) {
call->current_params.sent_vsize = video_stream_get_sent_video_size(vstream);
call->current_params.recv_vsize = video_stream_get_received_video_size(vstream);
call->current_params.sent_fps = video_stream_get_sent_framerate(vstream);
call->current_params.received_fps = video_stream_get_received_framerate(vstream);
}
#endif
@ -1276,17 +1278,24 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
/**
* Request remote side to send us a Video Fast Update.
**/
void linphone_call_send_vfu_request(LinphoneCall *call)
{
void linphone_call_send_vfu_request(LinphoneCall *call) {
#ifdef VIDEO_ENABLED
if (LinphoneCallStreamsRunning == linphone_call_get_state(call))
sal_call_send_vfu_request(call->op);
if (call->core->sip_conf.vfu_with_info) {
if (LinphoneCallStreamsRunning == linphone_call_get_state(call))
sal_call_send_vfu_request(call->op);
} else {
ms_message("vfu request using sip disabled from config [sip,vfu_with_info]");
}
#endif
}
/**
* Take a photo of currently received video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
@ -1299,6 +1308,24 @@ int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
return -1;
}
/**
* Take a photo of currently captured video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL && call->videostream->local_jpegwriter!=NULL){
return ms_filter_call_method(call->videostream->local_jpegwriter,MS_JPEG_WRITER_TAKE_SNAPSHOT,(void*)file);
}
ms_warning("Cannot take local snapshot: no currently running video stream on this call.");
return -1;
#endif
return -1;
}
/**
* Returns TRUE if camera pictures are allowed to be sent to the remote party.
**/
@ -1336,6 +1363,24 @@ MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParam
return cp->recv_vsize;
}
/**
* Gets the framerate of the video that is sent.
* @param[in] cp The call parameters.
* @return the actual sent framerate in frames per seconds, 0 if not available.
*/
float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp){
return cp->sent_fps;
}
/**
* Gets the framerate of the video that is received.
* @param[in] cp The call paramaters for which to get the received framerate.
* @return the actual received framerate in frames per seconds, 0 if not available.
*/
float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp){
return cp->received_fps;
}
const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *cp) {
return sal_media_proto_to_string(get_proto_from_call_params(cp));
}
@ -1404,7 +1449,7 @@ bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams
/**
* Returns true if the call is part of the locally managed conference.
**/
bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp){
bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams *cp){
return cp->in_conference;
}
@ -1632,6 +1677,7 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
if (call->audiostream != NULL) return;
if (call->sessions[0].rtp_session==NULL){
call->audiostream=audiostream=audio_stream_new(call->media_ports[0].rtp_port,call->media_ports[0].rtcp_port,call->af==AF_INET6);
rtp_session_set_symmetric_rtp(audiostream->ms.sessions.rtp_session,linphone_core_symmetric_rtp_enabled(lc));
}else{
call->audiostream=audio_stream_new_with_sessions(&call->sessions[0]);
}
@ -1692,6 +1738,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){
if (call->sessions[1].rtp_session==NULL){
call->videostream=video_stream_new(call->media_ports[1].rtp_port,call->media_ports[1].rtcp_port, call->af==AF_INET6);
rtp_session_set_symmetric_rtp(call->videostream->ms.sessions.rtp_session,linphone_core_symmetric_rtp_enabled(lc));
}else{
call->videostream=video_stream_new_with_sessions(&call->sessions[1]);
}
@ -1885,6 +1932,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
const LinphoneCallParams *params=&call->params;
*used_pt=-1;
if (desc->type==SalAudio)
bw=get_ideal_audio_bw(call,md,desc);
else if (desc->type==SalVideo)
@ -1911,6 +1959,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
first=FALSE;
}
if (pt->flags & PAYLOAD_TYPE_BITRATE_OVERRIDE){
ms_message("Payload type [%s/%i] has explicit bitrate [%i] kbit/s", pt->mime_type, pt->clock_rate, pt->normal_bitrate/1000);
pt->normal_bitrate=get_min_bandwidth(pt->normal_bitrate,bw*1000);
} else pt->normal_bitrate=bw*1000;
if (desc->ptime>0){
@ -2143,6 +2192,9 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
video_stream_enable_adaptive_bitrate_control(call->videostream,
linphone_core_adaptive_rate_control_enabled(lc));
video_stream_enable_adaptive_jittcomp(call->videostream, linphone_core_video_adaptive_jittcomp_enabled(lc));
if (lc->video_conf.preview_vsize.width!=0)
video_stream_set_preview_size(call->videostream,lc->video_conf.preview_vsize);
video_stream_set_fps(call->videostream,linphone_core_get_preferred_framerate(lc));
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
if (lc->video_window_id!=0)
@ -2227,11 +2279,15 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
use_arc=FALSE;
}
#endif
ms_message("linphone_call_start_media_streams() call=[%p] local upload_bandwidth=[%i] kbit/s; local download_bandwidth=[%i] kbit/s",
call, linphone_core_get_upload_bandwidth(lc),linphone_core_get_download_bandwidth(lc));
if (call->audiostream!=NULL) {
linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc);
}
call->current_params.has_video=FALSE;
if (call->videostream!=NULL) {
if (call->audiostream) audio_stream_link_video(call->audiostream,call->videostream);
linphone_call_start_video_stream(call,cname,all_inputs_muted);
}
@ -2354,7 +2410,7 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, MediaStream *st){
}
}
void linphone_call_stop_audio_stream(LinphoneCall *call) {
static void linphone_call_stop_audio_stream(LinphoneCall *call) {
if (call->audiostream!=NULL) {
linphone_reporting_update_media_info(call, LINPHONE_CALL_STATS_AUDIO);
media_stream_reclaim_sessions(&call->audiostream->ms,&call->sessions[0]);
@ -2382,7 +2438,7 @@ void linphone_call_stop_audio_stream(LinphoneCall *call) {
}
}
void linphone_call_stop_video_stream(LinphoneCall *call) {
static void linphone_call_stop_video_stream(LinphoneCall *call) {
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL){
linphone_reporting_update_media_info(call, LINPHONE_CALL_STATS_VIDEO);
@ -2406,6 +2462,8 @@ static void unset_rtp_profile(LinphoneCall *call, int i){
void linphone_call_stop_media_streams(LinphoneCall *call){
if (call->audiostream || call->videostream) {
if (call->audiostream && call->videostream)
audio_stream_unlink_video(call->audiostream, call->videostream);
linphone_call_stop_audio_stream(call);
linphone_call_stop_video_stream(call);

View file

@ -757,6 +757,8 @@ static void sip_config_read(LinphoneCore *lc)
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
sal_enable_sip_update_method(lc->sal,lp_config_get_int(lc->config,"sip","sip_update",1));
lc->sip_conf.vfu_with_info=lp_config_get_int(lc->config,"sip","vfu_with_info",1);
linphone_core_set_sip_transport_timeout(lc, lp_config_get_int(lc->config, "sip", "transport_timeout", 63000));
}
static void rtp_config_read(LinphoneCore *lc)
@ -999,6 +1001,11 @@ static void video_config_read(LinphoneCore *lc){
linphone_core_set_preferred_video_size_by_name(lc,
lp_config_get_string(lc->config,"video","size","cif"));
linphone_core_set_preview_video_size_by_name(lc,
lp_config_get_string(lc->config,"video","preview_size",NULL));
linphone_core_set_preferred_framerate(lc,lp_config_get_float(lc->config,"video","framerate",0));
#ifdef VIDEO_ENABLED
#if defined(ANDROID) || defined(__ios)
@ -1111,6 +1118,16 @@ void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw){
if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"net","upload_bw",bw);
}
void linphone_core_set_sip_transport_timeout(LinphoneCore *lc, int timeout_ms) {
sal_set_transport_timeout(lc->sal, timeout_ms);
if (linphone_core_ready(lc))
lp_config_set_int(lc->config, "sip", "transport_timeout", timeout_ms);
}
int linphone_core_get_sip_transport_timeout(LinphoneCore *lc) {
return sal_get_transport_timeout(lc->sal);
}
void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable) {
sal_enable_dns_srv(lc->sal, enable);
if (linphone_core_ready(lc))
@ -4803,12 +4820,14 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){
if (val){
if (lc->previewstream==NULL){
const char *display_filter=linphone_core_get_video_display_filter(lc);
MSVideoSize vsize=lc->video_conf.preview_vsize.width!=0 ? lc->video_conf.preview_vsize : lc->video_conf.vsize;
lc->previewstream=video_preview_new();
video_preview_set_size(lc->previewstream,lc->video_conf.vsize);
video_preview_set_size(lc->previewstream,vsize);
if (display_filter)
video_preview_set_display_filter_name(lc->previewstream,display_filter);
if (lc->preview_window_id!=0)
video_preview_set_native_window_id(lc->previewstream,lc->preview_window_id);
video_preview_set_fps(lc->previewstream,linphone_core_get_preferred_framerate(lc));
video_preview_start(lc->previewstream,lc->video_conf.device);
}
}else{
@ -5295,6 +5314,7 @@ const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc){
static MSVideoSize video_size_get_by_name(const char *name){
MSVideoSizeDef *pdef=supported_resolutions;
MSVideoSize null_vsize={0,0};
if (!name) return null_vsize;
for(;pdef->name!=NULL;pdef++){
if (strcasecmp(name,pdef->name)==0){
return pdef->vsize;
@ -5320,6 +5340,13 @@ static bool_t video_size_supported(MSVideoSize vsize){
return FALSE;
}
static void update_preview_size(LinphoneCore *lc, MSVideoSize oldvsize, MSVideoSize vsize){
if (!ms_video_size_equal(oldvsize,vsize) && lc->previewstream!=NULL){
toggle_video_preview(lc,FALSE);
toggle_video_preview(lc,TRUE);
}
}
/**
* Sets the preferred video size.
*
@ -5329,17 +5356,57 @@ static bool_t video_size_supported(MSVideoSize vsize){
**/
void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize){
if (video_size_supported(vsize)){
MSVideoSize oldvsize=lc->video_conf.vsize;
MSVideoSize oldvsize=lc->video_conf.preview_vsize;
if (oldvsize.width==0){
oldvsize=lc->video_conf.vsize;
update_preview_size(lc,oldvsize,vsize);
}
lc->video_conf.vsize=vsize;
if (linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","size",video_size_get_name(vsize));
}
}
/**
* Sets the video size for the captured (preview) video.
* This method is for advanced usage where a video capture must be set independently of the size of the stream actually sent through the call.
* This allows for example to have the preview window with HD resolution even if due to bandwidth constraint the sent video size is small.
* Using this feature increases the CPU consumption, since a rescaling will be done internally.
* @ingroup media_parameters
* @param lc the linphone core
* @param vsize the video resolution choosed for capuring and previewing. It can be (0,0) to not request any specific preview size and let the core optimize the processing.
**/
void linphone_core_set_preview_video_size(LinphoneCore *lc, MSVideoSize vsize){
if (vsize.width==0 && vsize.height==0){
/*special case to reset the forced preview size mode*/
lc->video_conf.preview_vsize=vsize;
if (linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","preview_size",NULL);
return;
}
if (video_size_supported(vsize)){
MSVideoSize oldvsize=lc->video_conf.preview_vsize;
lc->video_conf.preview_vsize=vsize;
if (!ms_video_size_equal(oldvsize,vsize) && lc->previewstream!=NULL){
toggle_video_preview(lc,FALSE);
toggle_video_preview(lc,TRUE);
}
if ( linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","size",video_size_get_name(vsize));
if (linphone_core_ready(lc))
lp_config_set_string(lc->config,"video","preview_size",video_size_get_name(vsize));
}
}
/**
* Sets the preview video size by its name. See linphone_core_set_preview_video_size() for more information about this feature.
*
* @ingroup media_parameters
* Video resolution names are: qcif, svga, cif, vga, 4cif, svga ...
**/
void linphone_core_set_preview_video_size_by_name(LinphoneCore *lc, const char *name){
MSVideoSize vsize=video_size_get_by_name(name);
linphone_core_set_preview_video_size(lc,vsize);
}
/**
* Sets the preferred video size by its name.
*
@ -5364,6 +5431,30 @@ MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc){
return lc->video_conf.vsize;
}
/**
* Set the preferred frame rate for video.
* Based on the available bandwidth constraints and network conditions, the video encoder
* remains free to lower the framerate. There is no warranty that the preferred frame rate be the actual framerate.
* used during a call. Default value is 0, which means "use encoder's default fps value".
* @ingroup media_parameters
* @param lc the LinphoneCore
* @param fps the target frame rate in number of frames per seconds.
**/
void linphone_core_set_preferred_framerate(LinphoneCore *lc, float fps){
lc->video_conf.fps=fps;
if (linphone_core_ready(lc))
lp_config_set_float(lc->config,"video","framerate",fps);
}
/**
* Returns the preferred video framerate, previously set by linphone_core_set_preferred_framerate().
* @param lc the linphone core
* @return frame rate in number of frames per seconds.
**/
float linphone_core_get_preferred_framerate(LinphoneCore *lc){
return lc->video_conf.fps;
}
/**
* Ask the core to stream audio from and to files, instead of using the soundcard.
**/
@ -5950,7 +6041,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
linphone_presence_model_unref(lc->presence_model);
}
linphone_core_free_payload_types(lc);
if (lc->supported_formats) ms_free(lc->supported_formats);
linphone_core_message_storage_close(lc);
ms_exit();
linphone_core_set_state(lc,LinphoneGlobalOff,"Off");

View file

@ -120,7 +120,6 @@ typedef enum _LinphoneTransportType LinphoneTransportType;
* return NULL.
*
* @ingroup linphone_address
* @var LinphoneAddress
*/
typedef struct SalAddress LinphoneAddress;
@ -221,7 +220,7 @@ LINPHONE_PUBLIC const char *linphone_error_info_get_details(const LinphoneErrorI
LINPHONE_PUBLIC int linphone_error_info_get_protocol_code(const LinphoneErrorInfo *ei);
/* linphone dictionary */
LINPHONE_PUBLIC LinphoneDictionary* linphone_dictionary_new();
LINPHONE_PUBLIC LinphoneDictionary* linphone_dictionary_new(void);
LinphoneDictionary * linphone_dictionary_clone(const LinphoneDictionary* src);
LinphoneDictionary * linphone_dictionary_ref(LinphoneDictionary* obj);
void linphone_dictionary_unref(LinphoneDictionary* obj);
@ -391,7 +390,8 @@ LINPHONE_PUBLIC LinphoneMediaEncryption linphone_call_params_get_media_encryptio
LINPHONE_PUBLIC void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, LinphoneMediaEncryption e);
LINPHONE_PUBLIC void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
LINPHONE_PUBLIC bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp);
#define linphone_call_params_local_conference_mode linphone_call_params_get_local_conference_mode /* Deprecated */
LINPHONE_PUBLIC bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
LINPHONE_PUBLIC void linphone_call_params_destroy(LinphoneCallParams *cp);
LINPHONE_PUBLIC bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp);
@ -433,6 +433,21 @@ LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_sent_video_size(const Linph
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp);
/**
* Gets the framerate of the video that is sent.
* @param[in] cp The call parameters.
* @return the actual sent framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp);
/**
* Gets the framerate of the video that is received.
* @param[in] cp The call paramaters for which to get the received framerate.
* @return the actual received framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp);
/**
* Gets the RTP profile being used.
* @param[in] cp #LinphoneCallParams object
@ -691,6 +706,7 @@ LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_remote_params(Linph
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
LINPHONE_PUBLIC int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
LINPHONE_PUBLIC LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
LINPHONE_PUBLIC const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
@ -1053,7 +1069,8 @@ void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
struct _LinphoneAuthInfo;
/**
* @ingroup authentication
* @addtogroup authentication
* @{
* Object holding authentication information.
*
* @note The object's fields should not be accessed directly. Prefer using
@ -1078,33 +1095,131 @@ struct _LinphoneAuthInfo;
**/
typedef struct _LinphoneAuthInfo LinphoneAuthInfo;
/**
* Creates a #LinphoneAuthInfo object with supplied information.
* The object can be created empty, that is with all arguments set to NULL.
* Username, userid, password, realm and domain can be set later using specific methods.
* At the end, username and passwd (or ha1) are required.
* @param username The username that needs to be authenticated
* @param userid The userid used for authenticating (use NULL if you don't know what it is)
* @param passwd The password in clear text
* @param ha1 The ha1-encrypted password if password is not given in clear text.
* @param realm The authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don't use this parameter.
* @param domain The SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.
* @return A #LinphoneAuthInfo object. linphone_auth_info_destroy() must be used to destroy it when no longer needed. The LinphoneCore makes a copy of LinphoneAuthInfo
* passed through linphone_core_add_auth_info().
**/
LINPHONE_PUBLIC LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
const char *passwd, const char *ha1,const char *realm, const char *domain);
const char *passwd, const char *ha1,const char *realm, const char *domain);
/**
* @addtogroup authentication
* Instanciate a new auth info with values from source
* @param source auth info object to be cloned
* @return newly created auth info
* Instantiates a new auth info with values from source.
* @param[in] source The #LinphoneAuthInfo object to be cloned
* @return The newly created #LinphoneAuthInfo object.
*/
LINPHONE_PUBLIC LinphoneAuthInfo *linphone_auth_info_clone(const LinphoneAuthInfo* source);
/**
* Sets the password.
* @param[in] info The #LinphoneAuthInfo object
* @param[in] passwd The password.
**/
LINPHONE_PUBLIC void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
/**
* Sets the username.
* @param[in] info The #LinphoneAuthInfo object
* @param[in] username The username.
**/
LINPHONE_PUBLIC void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
/**
* Sets the userid.
* @param[in] info The #LinphoneAuthInfo object
* @param[in] userid The userid.
**/
LINPHONE_PUBLIC void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
/**
* Sets the realm.
* @param[in] info The #LinphoneAuthInfo object
* @param[in] realm The realm.
**/
LINPHONE_PUBLIC void linphone_auth_info_set_realm(LinphoneAuthInfo *info, const char *realm);
/**
* Sets the domain for which this authentication is valid.
* @param[in] info The #LinphoneAuthInfo object
* @param[in] domain The domain.
* This should not be necessary because realm is supposed to be unique and sufficient.
* However, many SIP servers don't set realm correctly, then domain has to be used to distinguish between several SIP account bearing the same username.
**/
LINPHONE_PUBLIC void linphone_auth_info_set_domain(LinphoneAuthInfo *info, const char *domain);
/**
* Sets the ha1.
* @param[in] info The #LinphoneAuthInfo object
* @param[in] ha1 The ha1.
**/
LINPHONE_PUBLIC void linphone_auth_info_set_ha1(LinphoneAuthInfo *info, const char *ha1);
LINPHONE_PUBLIC const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_realm(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_domain(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *i);
/**
* Gets the username.
*
* @param[in] info The #LinphoneAuthInfo object
* @return The username.
*/
LINPHONE_PUBLIC const char *linphone_auth_info_get_username(const LinphoneAuthInfo *info);
/**
* Gets the password.
*
* @param[in] info The #LinphoneAuthInfo object
* @return The password.
*/
LINPHONE_PUBLIC const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *info);
/**
* Gets the userid.
*
* @param[in] info The #LinphoneAuthInfo object
* @return The userid.
*/
LINPHONE_PUBLIC const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *info);
/**
* Gets the realm.
*
* @param[in] info The #LinphoneAuthInfo object
* @return The realm.
*/
LINPHONE_PUBLIC const char *linphone_auth_info_get_realm(const LinphoneAuthInfo *info);
/**
* Gets the domain.
*
* @param[in] info The #LinphoneAuthInfo object
* @return The domain.
*/
LINPHONE_PUBLIC const char *linphone_auth_info_get_domain(const LinphoneAuthInfo *info);
/**
* Gets the ha1.
*
* @param[in] info The #LinphoneAuthInfo object
* @return The ha1.
*/
LINPHONE_PUBLIC const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *info);
/* you don't need those function*/
LINPHONE_PUBLIC void linphone_auth_info_destroy(LinphoneAuthInfo *info);
LINPHONE_PUBLIC LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos);
/**
* @}
*/
struct _LinphoneChatRoom;
/**
@ -1700,6 +1815,22 @@ LINPHONE_PUBLIC void linphone_core_set_upload_ptime(LinphoneCore *lc, int ptime)
LINPHONE_PUBLIC int linphone_core_get_upload_ptime(LinphoneCore *lc);
/**
* Set the SIP transport timeout.
* @param[in] lc #LinphoneCore object.
* @param[in] timeout_ms The SIP transport timeout in milliseconds.
* @ingroup media_parameters
*/
void linphone_core_set_sip_transport_timeout(LinphoneCore *lc, int timeout_ms);
/**
* Get the SIP transport timeout.
* @param[in] lc #LinphoneCore object.
* @return The SIP transport timeout in milliseconds.
* @ingroup media_parameters
*/
int linphone_core_get_sip_transport_timeout(LinphoneCore *lc);
/**
* Enable or disable DNS SRV resolution.
* @param[in] lc #LinphoneCore object.
@ -1968,7 +2099,7 @@ LINPHONE_PUBLIC const char * linphone_core_get_stun_server(const LinphoneCore *l
*
* @return true if uPnP is available otherwise return false.
*/
LINPHONE_PUBLIC bool_t linphone_core_upnp_available();
LINPHONE_PUBLIC bool_t linphone_core_upnp_available(void);
/**
* @ingroup network_parameters
@ -2231,9 +2362,12 @@ typedef struct MSVideoSizeDef{
/* returns a zero terminated table of MSVideoSizeDef*/
LINPHONE_PUBLIC const MSVideoSizeDef *linphone_core_get_supported_video_sizes(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize);
LINPHONE_PUBLIC void linphone_core_set_preview_video_size(LinphoneCore *lc, MSVideoSize vsize);
LINPHONE_PUBLIC void linphone_core_set_preview_video_size_by_name(LinphoneCore *lc, const char *name);
LINPHONE_PUBLIC MSVideoSize linphone_core_get_preferred_video_size(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_preferred_video_size_by_name(LinphoneCore *lc, const char *name);
LINPHONE_PUBLIC void linphone_core_set_preferred_framerate(LinphoneCore *lc, float fps);
LINPHONE_PUBLIC float linphone_core_get_preferred_framerate(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
LINPHONE_PUBLIC bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);
@ -2511,7 +2645,12 @@ LINPHONE_PUBLIC void linphone_core_init_default_params(LinphoneCore*lc, Linphone
*/
LINPHONE_PUBLIC bool_t linphone_core_tunnel_available(void);
/**
* Linphone tunnel object.
* @ingroup tunnel
*/
typedef struct _LinphoneTunnel LinphoneTunnel;
/**
* get tunnel instance if available
*/
@ -2615,6 +2754,14 @@ LINPHONE_PUBLIC void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id,
* */
LINPHONE_PUBLIC void linphone_core_set_file_transfer_server(LinphoneCore *core, const char * server_url);
/**
* Returns a null terminated table of strings containing the file format extension supported for call recording.
* @param core the core
* @return the supported formats, typically 'wav' and 'mkv'
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const char ** linphone_core_get_supported_file_formats(LinphoneCore *core);
#ifdef __cplusplus
}
#endif

View file

@ -77,6 +77,23 @@ extern "C" void libmswebrtc_init();
}
#define RETURN_PROXY_CONFIG_USER_DATA_OBJECT(javaclass, funcprefix, cobj) \
{ \
jclass jUserDataObjectClass; \
jmethodID jUserDataObjectCtor; \
jobject jUserDataObj; \
jUserDataObj = (jobject)funcprefix ## _get_user_data(cobj); \
if (jUserDataObj == NULL) { \
jUserDataObjectClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/" javaclass)); \
jUserDataObjectCtor = env->GetMethodID(jUserDataObjectClass,"<init>", "(J)V"); \
jUserDataObj = env->NewObject(jUserDataObjectClass, jUserDataObjectCtor,(jlong) cobj); \
jUserDataObj = env->NewGlobalRef(jUserDataObj); \
funcprefix ## _set_user_data(cobj, jUserDataObj); \
env->DeleteGlobalRef(jUserDataObjectClass); \
} \
return jUserDataObj; \
}
static JavaVM *jvm=0;
static const char* LogDomain = "Linphone";
@ -880,24 +897,32 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDefaultProxyConfig( J
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getDefaultProxyConfig( JNIEnv* env
,jobject thiz
,jlong lc) {
LinphoneProxyConfig *config=0;
linphone_core_get_default_proxy((LinphoneCore*)lc,&config);
return (jlong)config;
}
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigList(JNIEnv* env, jobject thiz, jlong lc) {
static jobject getOrCreateProxy(JNIEnv* env,LinphoneProxyConfig* proxy){
RETURN_PROXY_CONFIG_USER_DATA_OBJECT("LinphoneProxyConfigImpl", linphone_proxy_config, proxy);
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneCoreImpl_getProxyConfigList(JNIEnv* env, jobject thiz, jlong lc) {
const MSList* proxies = linphone_core_get_proxy_config_list((LinphoneCore*)lc);
int proxyCount = ms_list_size(proxies);
jlongArray jProxies = env->NewLongArray(proxyCount);
jlong *jInternalArray = env->GetLongArrayElements(jProxies, NULL);
jclass cls = env->FindClass("java/lang/Object");
jobjectArray jProxies = env->NewObjectArray(proxyCount,cls,NULL);
for (int i = 0; i < proxyCount; i++ ) {
jInternalArray[i] = (unsigned long) (proxies->data);
LinphoneProxyConfig* proxy = (LinphoneProxyConfig*)proxies->data;
jobject jproxy = getOrCreateProxy(env,proxy);
if(jproxy != NULL){
env->SetObjectArrayElement(jProxies, i, jproxy);
} else {
return NULL;
}
proxies = proxies->next;
}
env->ReleaseLongArrayElements(jProxies, jInternalArray, 0);
return jProxies;
}
@ -1457,12 +1482,11 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_needsEchoCalibration
const char *card=linphone_core_get_capture_device((LinphoneCore*)lc);
sndcard=ms_snd_card_manager_get_card(m,card);
if (sndcard == NULL){
ms_error("Could not get soundcard.");
ms_error("Could not get soundcard %s", card);
return TRUE;
}
if (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) return FALSE;
if (ms_snd_card_get_minimal_latency(sndcard)==0) return TRUE;
return FALSE;
return TRUE;
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryption(JNIEnv* env
@ -2789,7 +2813,7 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_getVideoEnable
}
extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_localConferenceMode(JNIEnv *env, jobject thiz, jlong lcp){
return (jboolean)linphone_call_params_local_conference_mode((LinphoneCallParams*)lcp);
return (jboolean)linphone_call_params_get_local_conference_mode((LinphoneCallParams*)lcp);
}
extern "C" jstring Java_org_linphone_core_LinphoneCallParamsImpl_getCustomHeader(JNIEnv *env, jobject thiz, jlong lcp, jstring jheader_name){
@ -2969,6 +2993,37 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getAvpfRRI
return (jint)linphone_proxy_config_get_avpf_rr_interval((LinphoneProxyConfig *)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_enableQualityReporting(JNIEnv *env, jobject thiz, jlong ptr, jboolean enable) {
linphone_proxy_config_enable_quality_reporting((LinphoneProxyConfig *)ptr, (bool)enable);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_quality_reportingEnabled(JNIEnv *env, jobject thiz, jlong ptr) {
return linphone_proxy_config_quality_reporting_enabled((LinphoneProxyConfig *)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setQualityReportingInterval(JNIEnv *env, jobject thiz, jlong ptr, jint interval) {
linphone_proxy_config_set_quality_reporting_interval((LinphoneProxyConfig *)ptr, (uint8_t)interval);
}
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQualityReportingInterval(JNIEnv *env, jobject thiz, jlong ptr) {
return (jint)linphone_proxy_config_get_quality_reporting_interval((LinphoneProxyConfig *)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setQualityReportingCollector(JNIEnv *env, jobject thiz, jlong ptr, jstring jcollector) {
if (jcollector){
const char *collector=env->GetStringUTFChars(jcollector, NULL);
linphone_proxy_config_set_quality_reporting_collector((LinphoneProxyConfig *)ptr, collector);
env->ReleaseStringUTFChars(jcollector,collector);
}
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQualityReportingCollector(JNIEnv *env, jobject thiz, jlong ptr) {
jstring jvalue = env->NewStringUTF(linphone_proxy_config_get_quality_reporting_collector((LinphoneProxyConfig *)ptr));
return jvalue;
}
extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) {
return (jint)linphone_call_get_duration((LinphoneCall *) ptr);
}

View file

@ -119,7 +119,7 @@ typedef struct _LinphoneFriend LinphoneFriend;
* Contructor
* @return a new empty #LinphoneFriend
*/
LINPHONE_PUBLIC LinphoneFriend * linphone_friend_new();
LINPHONE_PUBLIC LinphoneFriend * linphone_friend_new(void);
/**
* Contructor same as linphone_friend_new() + linphone_friend_set_address()

View file

@ -1522,3 +1522,23 @@ const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc){
lc->rtp_conf.srtp_suites=result;
return result;
}
const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){
static const char *mkv="mkv";
static const char *wav="wav";
if (core->supported_formats==NULL){
core->supported_formats=ms_malloc0(3*sizeof(char*));
core->supported_formats[0]=wav;
if (ms_factory_lookup_filter_by_id(ms_factory_get_fallback(),MS_MKV_RECORDER_ID)){
core->supported_formats[1]=mkv;
}
}
return core->supported_formats;
}
bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc){
return lp_config_get_int(lc->config,"rtp","symmetric",1);
}

View file

@ -87,6 +87,7 @@ struct _LinphoneCallParams{
PayloadType *video_codec; /*video codec currently in use */
MSVideoSize sent_vsize; /* Size of the video currently being sent */
MSVideoSize recv_vsize; /* Size of the video currently being received */
float received_fps,sent_fps;
int down_bw;
int up_bw;
int down_ptime;
@ -375,8 +376,6 @@ void linphone_call_init_video_stream(LinphoneCall *call);
void linphone_call_init_media_streams(LinphoneCall *call);
void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone);
void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call);
void linphone_call_stop_audio_stream(LinphoneCall *call);
void linphone_call_stop_video_stream(LinphoneCall *call);
void linphone_call_stop_media_streams(LinphoneCall *call);
void linphone_call_delete_ice_session(LinphoneCall *call);
void linphone_call_delete_upnp_session(LinphoneCall *call);
@ -384,6 +383,7 @@ void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call);
void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md);
void linphone_call_update_remote_session_id_and_ver(LinphoneCall *call);
const char * linphone_core_get_identity(LinphoneCore *lc);
void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose);
@ -399,6 +399,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call);
bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md);
extern SalCallbacks linphone_sal_callbacks;
bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc);
LinphoneCall * is_a_linphone_call(void *user_pointer);
LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer);
@ -523,6 +524,7 @@ typedef struct sip_config
bool_t ping_with_options;
bool_t auto_net_state_mon;
bool_t tcp_tls_keepalive;
bool_t vfu_with_info; /*use to enable vfu request using sip info*/
} sip_config_t;
typedef struct rtp_config
@ -591,6 +593,8 @@ typedef struct video_config{
struct _MSWebCam *device;
const char **cams;
MSVideoSize vsize;
MSVideoSize preview_vsize; /*is 0,0 if no forced preview size is set, in which case vsize field above is used.*/
float fps;
bool_t capture;
bool_t show_local;
bool_t display;
@ -728,6 +732,7 @@ struct _LinphoneCore
LinphoneReason chat_deny_code;
bool_t lime;
char *file_transfer_server;
const char **supported_formats;
};

View file

@ -275,13 +275,13 @@ int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route)
bool_t linphone_proxy_config_check(LinphoneCore *lc, LinphoneProxyConfig *obj){
if (obj->reg_proxy==NULL){
if (lc->vtable.display_warning)
if (lc && lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("The sip proxy address you entered is invalid, it must start with \"sip:\""
" followed by a hostname."));
return FALSE;
}
if (obj->reg_identity==NULL){
if (lc->vtable.display_warning)
if (lc && lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("The sip identity you entered is invalid.\nIt should look like "
"sip:username@proxydomain, such as sip:alice@example.net"));
return FALSE;
@ -411,7 +411,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
LinphoneAddress* proxy=linphone_address_new(obj->reg_proxy);
char* proxy_string;
LinphoneAddress *contact;
ms_message("LinphoneProxyConfig [%p] about to register (LinphoneCore version: %s)",obj,linphone_core_get_version());
proxy_string=linphone_address_as_string_uri_only(proxy);
linphone_address_destroy(proxy);
if (obj->op)
@ -1116,6 +1116,9 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
linphone_proxy_config_enable_register(cfg,FALSE);
linphone_proxy_config_done(cfg);
linphone_proxy_config_update(cfg); /*so that it has an effect*/
/*as cfg no longer in proxies, unregister will never be issued*/
_linphone_proxy_config_unregister(cfg);
}
if (lc->default_proxy==cfg){
lc->default_proxy=NULL;

View file

@ -110,33 +110,32 @@ static void belle_request_process_auth_requested(void *ctx, belle_sip_auth_event
}
int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char *remote_provisioning_uri) {
const char* file_path = strstr(remote_provisioning_uri, "file://");
if( file_path == remote_provisioning_uri ){
// We allow for 'local remote-provisioning' in case the file is to be opened from the hard drive
file_path += strlen("file://");
belle_generic_uri_t *uri=belle_generic_uri_parse(remote_provisioning_uri);
const char* scheme = uri ? belle_generic_uri_get_scheme(uri) : NULL;
if( scheme && (strcmp(scheme,"file") == 0) ){
// We allow for 'local remote-provisioning' in case the file is to be opened from the hard drive.
const char* file_path = remote_provisioning_uri + strlen("file://"); // skip scheme
return linphone_remote_provisioning_load_file(lc, file_path);
} else {
belle_generic_uri_t *uri=belle_generic_uri_parse(remote_provisioning_uri);
} else if( scheme && strncmp(scheme, "http", 4) == 0 ) {
belle_http_request_listener_callbacks_t belle_request_listener={0};
belle_http_request_listener_t *listener;
belle_http_request_t *request;
belle_request_listener.process_response=belle_request_process_response_event;
belle_request_listener.process_auth_requested=belle_request_process_auth_requested;
belle_request_listener.process_io_error=belle_request_process_io_error;
belle_request_listener.process_timeout=belle_request_process_timeout;
listener = belle_http_request_listener_create_from_callbacks(&belle_request_listener, lc);
if (uri==NULL) {
belle_sip_error("Invalid provisioning URI [%s]",remote_provisioning_uri);
return -1;
}
listener = belle_http_request_listener_create_from_callbacks(&belle_request_listener, lc);
request=belle_http_request_create("GET",uri, NULL);
belle_http_provider_send_request(lc->http_provider, request, listener);
return 0;
return belle_http_provider_send_request(lc->http_provider, request, listener);
} else {
ms_error("Invalid provisioning URI [%s] (missing scheme?)",remote_provisioning_uri);
return -1;
}
}

View file

@ -117,7 +117,7 @@ typedef struct _SipSetup SipSetup;
extern "C"{
#endif
BuddyInfo *buddy_info_new();
BuddyInfo *buddy_info_new(void);
void buddy_info_free(BuddyInfo *info);
void buddy_lookup_request_set_key(BuddyLookupRequest *req, const char *key);

View file

@ -256,10 +256,11 @@ static void _refresh_call_stats(GtkWidget *callstats, LinphoneCall *call){
const LinphoneCallStats *vs=linphone_call_get_video_stats(call);
const char *audio_media_connectivity = _("Direct or through server");
const char *video_media_connectivity = _("Direct or through server");
gboolean has_video=linphone_call_params_video_enabled(linphone_call_get_current_params(call));
MSVideoSize size_received = linphone_call_params_get_received_video_size(linphone_call_get_current_params(call));
MSVideoSize size_sent = linphone_call_params_get_sent_video_size(linphone_call_get_current_params(call));
const char *rtp_profile = linphone_call_params_get_rtp_profile(linphone_call_get_current_params(call));
const LinphoneCallParams *curparams=linphone_call_get_current_params(call);
gboolean has_video=linphone_call_params_video_enabled(curparams);
MSVideoSize size_received = linphone_call_params_get_received_video_size(curparams);
MSVideoSize size_sent = linphone_call_params_get_sent_video_size(curparams);
const char *rtp_profile = linphone_call_params_get_rtp_profile(curparams);
gchar *tmp = g_strdup_printf("%s", rtp_profile);
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"rtp_profile")),tmp);
g_free(tmp);
@ -268,8 +269,10 @@ static void _refresh_call_stats(GtkWidget *callstats, LinphoneCall *call){
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"audio_bandwidth_usage")),tmp);
g_free(tmp);
if (has_video){
gchar *size_r=g_strdup_printf(_("%ix%i"),size_received.width,size_received.height);
gchar *size_s=g_strdup_printf(_("%ix%i"),size_sent.width,size_sent.height);
gchar *size_r=g_strdup_printf(_("%ix%i @ %f fps"),size_received.width,size_received.height,
linphone_call_params_get_received_framerate(curparams));
gchar *size_s=g_strdup_printf(_("%ix%i @ %f fps"),size_sent.width,size_sent.height,
linphone_call_params_get_sent_framerate(curparams));
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_size_recv")),size_r);
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(callstats,"video_size_sent")),size_s);
@ -442,7 +445,7 @@ void linphone_gtk_remove_in_call_view(LinphoneCall *call){
GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer (call);
GtkWidget *main_window=linphone_gtk_get_main_window ();
GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch");
gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
gboolean in_conf=linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call));
int idx;
g_return_if_fail(w!=NULL);
idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w);
@ -684,7 +687,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri");
GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration");
guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid"));
gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
gboolean in_conf=linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call));
GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(callview),"call_stats");
display_peer_name_in_label(callee,linphone_call_get_remote_address (call));
@ -753,7 +756,7 @@ void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_m
if(callview==NULL) return;
GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status");
guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid"));
gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
gboolean in_conf=linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call));
if (status==NULL) return;
if (error_msg==NULL)

View file

@ -983,6 +983,9 @@ gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_
char date[64]={0};
time_t curtime=time(NULL);
struct tm loctime;
const char **fmts=linphone_core_get_supported_file_formats(linphone_gtk_get_core());
int i;
const char *ext="wav";
#ifdef WIN32
loctime=*localtime(&curtime);
@ -991,19 +994,26 @@ gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_
#endif
snprintf(date,sizeof(date)-1,"%i%02i%02i-%02i%02i",loctime.tm_year+1900,loctime.tm_mon+1,loctime.tm_mday, loctime.tm_hour, loctime.tm_min);
for (i=0;fmts[i]!=NULL;++i){
if (strcmp(fmts[i],"mkv")==0){
ext="mkv";
break;
}
}
if (address){
id=linphone_address_get_username(address);
if (id==NULL) id=linphone_address_get_domain(address);
}
if (is_conference){
snprintf(filename,sizeof(filename)-1,"%s-conference-%s.wav",
snprintf(filename,sizeof(filename)-1,"%s-conference-%s.%s",
linphone_gtk_get_ui_config("title","Linphone"),
date);
date,ext);
}else{
snprintf(filename,sizeof(filename)-1,"%s-call-%s-%s.wav",
snprintf(filename,sizeof(filename)-1,"%s-call-%s-%s.%s",
linphone_gtk_get_ui_config("title","Linphone"),
date,
id);
id,ext);
}
if (!dir) {
ms_message ("No directory for music, using [%s] instead",dir=getenv("HOME"));
@ -2331,6 +2341,7 @@ core_start:
restart=FALSE;
goto core_start;
}
if (config_file) free(config_file);
#ifndef HAVE_GTK_OSX
/*workaround a bug on win32 that makes status icon still present in the systray even after program exit.*/
if (icon) gtk_status_icon_set_visible(icon,FALSE);

View file

@ -66,7 +66,24 @@ abstract public class LinphoneCoreFactory {
* */
abstract public LinphoneAuthInfo createAuthInfo(String username, String userid, String passwd, String ha1, String realm, String domain);
/**
* Create a LinphoneCore object. The LinphoneCore is the root for all liblinphone operations. You need only one per application.
* @param listener listener to receive notifications from the core
* @param userConfig path where to read/write configuration (optional)
* @param factoryConfig path where to read factory configuration (optional)
* @param userdata any kind of application specific data
* @param context an application context, on android this MUST be the android.content.Context object used by the application.
* @return a LinphoneCore object.
* @throws LinphoneCoreException
*/
abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, String userConfig,String factoryConfig,Object userdata, Object context) throws LinphoneCoreException;
/**
* Create a LinphoneCore object. The LinphoneCore is the root for all liblinphone operations. You need only one per application.
* @param listener listener to receive notifications from the core.
* @param context an application context, on android this MUST be the android.content.Context object used by the application.
* @return the LinphoneCore object.
* @throws LinphoneCoreException
*/
abstract public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, Object context) throws LinphoneCoreException;

View file

@ -25,6 +25,9 @@ package org.linphone.core;
*/
public interface LinphoneProxyConfig {
public void setIsDeleted(boolean b);
public boolean getIsDeleted();
/**
*Starts editing a proxy configuration.
*Because proxy configuration must be consistent, applications MUST call {@link #edit()} before doing any attempts to modify proxy configuration (such as identity, proxy address and so on).
@ -169,6 +172,12 @@ public interface LinphoneProxyConfig {
*/
void enableAvpf(boolean enable);
/**
* Whether AVPF is used for calls through this proxy.
* @return
*/
boolean avpfEnabled();
/**
* Set the interval between regular RTCP reports when using AVPF/SAVPF.
* @param interval The interval in seconds (between 0 and 5 seconds).
@ -182,14 +191,45 @@ public interface LinphoneProxyConfig {
int getAvpfRRInterval();
/**
* Whether AVPF is used for calls through this proxy.
* Indicates whether quality reporting must be used for calls using this proxy config.
* @param enable True to enable quality reporting, false to disable it.
*/
void enableQualityReporting(boolean enable);
/**
* Whether quality reporting is used for calls through this proxy.
* @return
*/
boolean avpfEnabled();
boolean qualityReportingEnabled();
/**
* Set the interval between quality interval reports during a call when using quality reporting.
* @param interval The interval in seconds (should be greater than 120 seconds to avoid too much).
*/
void setQualityReportingInterval(int interval);
/**
* Get the interval between quality interval reports during a call when using quality reporting.
* @return The interval in seconds.
*/
int getQualityReportingInterval();
/**
* Set the collector SIP URI to collect reports when using quality reporting.
* @param collector The collector SIP URI which should be configured server side too.
*/
void setQualityReportingCollector(String collector);
/**
* Get the collector SIP URI collecting reports when using quality reporting.
* @return The SIP URI collector address.
*/
String getQualityReportingCollector();
/**
* Set optional contact parameters that will be added to the contact information sent in the registration.
* @param contact_params a string contaning the additional parameters in text form, like "myparam=something;myparam2=something_else"
* @param contact_params a string containing the additional parameters in text form, like "myparam=something;myparam2=something_else"
*
* The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or android push id.
* As an example, the contact address in the SIP register sent will look like <sip:joe@15.128.128.93:50421>;android-push-id=43143-DFE23F-2323-FA2232.
@ -204,7 +244,7 @@ public interface LinphoneProxyConfig {
/**
* Set optional contact parameters that will be added to the contact information sent in the registration, inside the URI.
* @param params a string contaning the additional parameters in text form, like "myparam=something;myparam2=something_else"
* @param params a string containing the additional parameters in text form, like "myparam=something;myparam2=something_else"
*
* The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or apple push id.
* As an example, the contact address in the SIP register sent will look like <sip:joe@15.128.128.93:50421;apple-push-id=43143-DFE23F-2323-FA2232>.
@ -212,7 +252,7 @@ public interface LinphoneProxyConfig {
public void setContactUriParameters(String params);
/**
* Get the contact's uri parameters.
* Get the contact's URI parameters.
* @return
*/
public String getContactUriParameters();

View file

@ -105,7 +105,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private native String getRing(long nativePtr);
private native void setRootCA(long nativePtr, String path);
private native long[] listVideoPayloadTypes(long nativePtr);
private native long[] getProxyConfigList(long nativePtr);
private native LinphoneProxyConfig[] getProxyConfigList(long nativePtr);
private native long[] getAuthInfosList(long nativePtr);
private native long findAuthInfos(long nativePtr, String username, String realm, String domain);
private native long[] listAudioPayloadTypes(long nativePtr);
@ -190,7 +190,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized LinphoneProxyConfig getDefaultProxyConfig() {
isValid();
long lNativePtr = getDefaultProxyConfig(nativePtr);
long lNativePtr = getDefaultProxyConfig(nativePtr);
if (lNativePtr!=0) {
return new LinphoneProxyConfigImpl(this,lNativePtr);
} else {
@ -224,6 +224,7 @@ class LinphoneCoreImpl implements LinphoneCore {
isValid();
removeProxyConfig(nativePtr, ((LinphoneProxyConfigImpl)proxyCfg).nativePtr);
((LinphoneProxyConfigImpl)proxyCfg).mCore=null;
((LinphoneProxyConfigImpl)proxyCfg).deleteNativePtr();
}
public synchronized void clearAuthInfos() {
isValid();
@ -512,17 +513,8 @@ class LinphoneCoreImpl implements LinphoneCore {
setRootCA(nativePtr, path);
}
public synchronized LinphoneProxyConfig[] getProxyConfigList() {
long[] typesPtr = getProxyConfigList(nativePtr);
if (typesPtr == null) return null;
LinphoneProxyConfig[] proxies = new LinphoneProxyConfig[typesPtr.length];
for (int i=0; i < proxies.length; i++) {
proxies[i] = new LinphoneProxyConfigImpl(this,typesPtr[i]);
}
return proxies;
public synchronized LinphoneProxyConfig[] getProxyConfigList() {
return getProxyConfigList(nativePtr);
}
public synchronized PayloadType[] getVideoCodecs() {

View file

@ -15,20 +15,17 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
*/
package org.linphone.core;
import org.linphone.core.LinphoneCore.RegistrationState;
class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
protected final long nativePtr;
protected long nativePtr;
protected LinphoneCoreImpl mCore;
protected boolean isDeleting;
private native int getState(long nativePtr);
private native void setExpires(long nativePtr, int delay);
private native int getExpires(long nativePtr);
@ -39,14 +36,40 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
setIdentity(identity);
setProxy(proxy);
setRoute(route);
setIsDeleted(false);
enableRegister(enableRegister);
ownPtr=true;
}
protected LinphoneProxyConfigImpl(LinphoneCoreImpl core, long aNativePtr) {
protected LinphoneProxyConfigImpl(LinphoneCoreImpl core,long aNativePtr) {
mCore=core;
nativePtr = aNativePtr;
ownPtr=false;
mCore=core;
}
protected LinphoneProxyConfigImpl(long aNativePtr) {
nativePtr = aNativePtr;
ownPtr=false;
}
public boolean getIsDeleted() {
return isDeleting;
}
public void setIsDeleted(boolean b) {
isDeleting = b;
}
private void isValid() {
if (nativePtr == 0) {
throw new RuntimeException("proxy config removed");
}
}
public void deleteNativePtr() {
nativePtr=0;
}
protected void finalize() throws Throwable {
//Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config");
if (ownPtr) delete(nativePtr);
@ -56,42 +79,44 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
private native void edit(long ptr);
private native void done(long ptr);
private native void setIdentity(long ptr,String identity);
private native String getIdentity(long ptr);
private native int setProxy(long ptr,String proxy);
private native String getProxy(long ptr);
private native void enableRegister(long ptr,boolean value);
private native boolean isRegisterEnabled(long ptr);
private native boolean isRegistered(long ptr);
private native void setDialPrefix(long ptr, String prefix);
private native String getDialPrefix(long ptr);
private native String normalizePhoneNumber(long ptr,String number);
private native String getDomain(long ptr);
private native void setDialEscapePlus(long ptr, boolean value);
private native boolean getDialEscapePlus(long ptr);
private native String getRoute(long ptr);
private native int setRoute(long ptr,String uri);
private native void enablePublish(long ptr,boolean enable);
private native boolean publishEnabled(long ptr);
private native void setContactParameters(long ptr, String params);
private native int lookupCCCFromIso(long nativePtr, String iso);
private native int lookupCCCFromE164(long nativePtr, String e164);
public LinphoneProxyConfig enableRegister(boolean value) {
isValid();
enableRegister(nativePtr,value);
return this;
}
public void done() {
isValid();
Object mutex=mCore!=null ? mCore : this;
synchronized(mutex){
done(nativePtr);
@ -99,6 +124,7 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
}
public LinphoneProxyConfig edit() {
isValid();
Object mutex=mCore!=null ? mCore : this;
synchronized(mutex){
edit(nativePtr);
@ -107,141 +133,215 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
}
public void setIdentity(String identity) throws LinphoneCoreException {
isValid();
setIdentity(nativePtr,identity);
}
public void setProxy(String proxyUri) throws LinphoneCoreException {
isValid();
if (setProxy(nativePtr,proxyUri)!=0) {
throw new LinphoneCoreException("Bad proxy address ["+proxyUri+"]");
}
}
public String normalizePhoneNumber(String number) {
isValid();
return normalizePhoneNumber(nativePtr,number);
}
public void setDialPrefix(String prefix) {
isValid();
setDialPrefix(nativePtr, prefix);
}
public String getDialPrefix() {
isValid();
return getDialPrefix(nativePtr);
}
public String getDomain() {
isValid();
return getDomain(nativePtr);
}
public void setDialEscapePlus(boolean value) {
setDialEscapePlus(nativePtr,value);
isValid();
setDialEscapePlus(nativePtr,value);
}
public boolean getDialEscapePlus() {
isValid();
return getDialEscapePlus(nativePtr);
}
public String getIdentity() {
isValid();
return getIdentity(nativePtr);
}
public String getProxy() {
isValid();
return getProxy(nativePtr);
}
public boolean isRegistered() {
isValid();
return isRegistered(nativePtr);
}
public boolean registerEnabled() {
isValid();
return isRegisterEnabled(nativePtr);
}
public String getRoute() {
isValid();
return getRoute(nativePtr);
}
public void setRoute(String routeUri) throws LinphoneCoreException {
isValid();
if (setRoute(nativePtr, routeUri) != 0) {
throw new LinphoneCoreException("cannot set route ["+routeUri+"]");
}
}
public void enablePublish(boolean enable) {
isValid();
enablePublish(nativePtr,enable);
}
public RegistrationState getState() {
isValid();
return RegistrationState.fromInt(getState(nativePtr));
}
public void setExpires(int delay) {
isValid();
setExpires(nativePtr, delay);
}
public int getExpires() {
isValid();
return getExpires(nativePtr);
}
public boolean publishEnabled() {
isValid();
return publishEnabled(nativePtr);
}
@Override
public void setContactParameters(String params) {
isValid();
setContactParameters(nativePtr, params);
}
@Override
public int lookupCCCFromIso(String iso) {
isValid();
return lookupCCCFromIso(nativePtr, iso);
}
@Override
public int lookupCCCFromE164(String e164) {
isValid();
return lookupCCCFromE164(nativePtr, e164);
}
private native int getError(long nativeptr);
@Override
public Reason getError() {
isValid();
return Reason.fromInt(getError(nativePtr));
}
private native void setPrivacy(long nativePtr, int mask);
@Override
public void setPrivacy(int privacy_mask) {
isValid();
setPrivacy(nativePtr,privacy_mask);
}
private native int getPrivacy(long nativePtr);
@Override
public int getPrivacy() {
isValid();
return getPrivacy(nativePtr);
}
private native void enableAvpf(long nativePtr, boolean enable);
@Override
public void enableAvpf(boolean enable) {
isValid();
enableAvpf(nativePtr, enable);
}
private native boolean avpfEnabled(long nativePtr);
@Override
public boolean avpfEnabled() {
isValid();
return avpfEnabled(nativePtr);
}
private native void setAvpfRRInterval(long nativePtr, int interval);
@Override
public void setAvpfRRInterval(int interval) {
isValid();
setAvpfRRInterval(nativePtr, interval);
}
private native int getAvpfRRInterval(long nativePtr);
@Override
public int getAvpfRRInterval() {
isValid();
return getAvpfRRInterval(nativePtr);
}
private native String getContactParameters(long ptr);
@Override
public String getContactParameters() {
isValid();
return getContactParameters(nativePtr);
}
private native void setContactUriParameters(long ptr, String params);
@Override
public void setContactUriParameters(String params) {
isValid();
setContactUriParameters(nativePtr,params);
}
private native String getContactUriParameters(long ptr);
@Override
public String getContactUriParameters() {
isValid();
return getContactUriParameters(nativePtr);
}
private native long getErrorInfo(long nativePtr);
@Override
public ErrorInfo getErrorInfo() {
return new ErrorInfoImpl(getErrorInfo(nativePtr));
}
private native void enableQualityReporting(long nativePtr, boolean enable);
@Override
public void enableQualityReporting(boolean enable) {
isValid();
enableQualityReporting(nativePtr, enable);
}
private native boolean qualityReportingEnabled(long nativePtr);
@Override
public boolean qualityReportingEnabled() {
isValid();
return avpfEnabled(nativePtr);
}
private native void setQualityReportingInterval(long nativePtr, int interval);
@Override
public void setQualityReportingInterval(int interval) {
isValid();
setQualityReportingInterval(nativePtr, interval);
}
private native int getQualityReportingInterval(long nativePtr);
@Override
public int getQualityReportingInterval() {
isValid();
return getQualityReportingInterval(nativePtr);
}
private native void setQualityReportingCollector(long nativePtr, String collector);
@Override
public void setQualityReportingCollector(String collector) {
isValid();
setQualityReportingCollector(nativePtr, collector);
}
private native String getQualityReportingCollector(long nativePtr);
@Override
public String getQualityReportingCollector() {
isValid();
return getQualityReportingCollector(nativePtr);
}
}

@ -1 +1 @@
Subproject commit f466a6e17e4cb62d48d9ab27b2c231a29ca750dd
Subproject commit b40af312e90b6c91bbee360f430ed87fa26119e9

2
oRTP

@ -1 +1 @@
Subproject commit 9d03c3aa1643f1cfae32de4abf04dc84ff3ad175
Subproject commit 99f33a0f510310389c22bf88a39582450be38425

576
po/cs.po

File diff suppressed because it is too large Load diff

574
po/de.po

File diff suppressed because it is too large Load diff

709
po/es.po

File diff suppressed because it is too large Load diff

732
po/fr.po

File diff suppressed because it is too large Load diff

687
po/he.po

File diff suppressed because it is too large Load diff

569
po/hu.po

File diff suppressed because it is too large Load diff

695
po/it.po

File diff suppressed because it is too large Load diff

691
po/ja.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

695
po/nl.po

File diff suppressed because it is too large Load diff

691
po/pl.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

576
po/ru.po

File diff suppressed because it is too large Load diff

565
po/sr.po

File diff suppressed because it is too large Load diff

693
po/sv.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -125,7 +125,8 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
CU_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return;
linphone_call_ref(c1);
linphone_call_ref(c2);
for (i=0; i<24 /*=12s need at least one exchange of SR to maybe 10s*/; i++) {
if (linphone_call_get_audio_stats(c1)->round_trip_delay >0.0
&& linphone_call_get_audio_stats(c2)->round_trip_delay >0.0
@ -145,7 +146,8 @@ void liblinphone_tester_check_rtcp(LinphoneCoreManager* caller, LinphoneCoreMana
if (linphone_call_log_video_enabled(linphone_call_get_call_log(c2))) {
CU_ASSERT_TRUE(linphone_call_get_video_stats(c2)->round_trip_delay>0.0);
}
linphone_call_unref(c1);
linphone_call_unref(c2);
}
bool_t call_with_params(LinphoneCoreManager* caller_mgr
@ -304,6 +306,8 @@ static void call_outbound_with_multiple_proxy() {
// calling marie should go through the second proxy config
CU_ASSERT_TRUE(call(marie, pauline));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
#if 0 /* TODO: activate test when the implementation is ready */
@ -723,6 +727,10 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee
CU_ASSERT_PTR_NOT_NULL(c1);
CU_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return FALSE;
linphone_call_ref(c1);
linphone_call_ref(c2);
CU_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2)));
video_enabled=linphone_call_params_video_enabled(linphone_call_get_current_params(c1));
for (i=0;i<200;i++){
@ -762,7 +770,8 @@ static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee
const LinphoneCallParams* call_param = linphone_call_get_current_params(c2);
CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(callee->lc));
}
linphone_call_unref(c1);
linphone_call_unref(c2);
return video_enabled ? audio_success && video_success : audio_success;
}
@ -919,25 +928,88 @@ static void call_with_custom_headers(void) {
static void call_paused_resumed(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* call_obj;
LinphoneCall* call_pauline;
const rtp_stats_t * stats;
CU_ASSERT_TRUE(call(pauline,marie));
call_obj = linphone_core_get_current_call(pauline->lc);
call_pauline = linphone_core_get_current_call(pauline->lc);
linphone_core_pause_call(pauline->lc,call_obj);
wait_for_until(pauline->lc, marie->lc, NULL, 5, 3000);
linphone_core_pause_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1));
linphone_core_resume_call(pauline->lc,call_obj);
/*stay in pause a little while in order to generate traffic*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
linphone_core_resume_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
/*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000);
/*since RTCP streams are reset when call is paused/resumed, there should be no loss at all*/
stats = rtp_session_get_stats(call_pauline->sessions->rtp_session);
CU_ASSERT_EQUAL(stats->cum_packet_loss, 0);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_paused_resumed_with_loss(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* call_pauline;
const rtp_stats_t * stats;
OrtpNetworkSimulatorParams params={0};
params.enabled=TRUE;
params.loss_rate=25;
CU_ASSERT_TRUE(call(pauline,marie));
call_pauline = linphone_core_get_current_call(pauline->lc);
rtp_session_enable_network_simulation(call_pauline->audiostream->ms.sessions.rtp_session,&params);
rtp_session_enable_network_simulation(call_pauline->videostream->ms.sessions.rtp_session,&params);
wait_for_until(pauline->lc, marie->lc, NULL, 5, 4000);
linphone_core_pause_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1));
/*stay in pause a little while in order to generate traffic*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
linphone_core_resume_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
/*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000);
/*since stats are NOT totally reset during pause, the stats->packet_recv is computed from
the start of call. This test ensures that the loss rate is consistent during the entire call.*/
stats = rtp_session_get_stats(call_pauline->sessions->rtp_session);
CU_ASSERT_TRUE(((stats->cum_packet_loss * 100.f / stats->packet_recv) / params.loss_rate) > .5f);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@ -957,19 +1029,29 @@ static bool_t pause_call_1(LinphoneCoreManager* mgr_1,LinphoneCall* call_1,Linph
static void call_paused_resumed_from_callee(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* call_obj;
LinphoneCall* call_marie;
const rtp_stats_t * stats;
CU_ASSERT_TRUE(call(pauline,marie));
call_obj = linphone_core_get_current_call(marie->lc);
call_marie = linphone_core_get_current_call(marie->lc);
linphone_core_pause_call(marie->lc,call_obj);
linphone_core_pause_call(marie->lc,call_marie);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausedByRemote,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPaused,1));
linphone_core_resume_call(marie->lc,call_obj);
/*stay in pause a little while in order to generate traffic*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
linphone_core_resume_call(marie->lc,call_marie);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
/*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000);
/*since RTCP streams are reset when call is paused/resumed, there should be no loss at all*/
stats = rtp_session_get_stats(call_marie->sessions->rtp_session);
CU_ASSERT_EQUAL(stats->cum_packet_loss, 0);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
@ -980,7 +1062,6 @@ static void call_paused_resumed_from_callee(void) {
linphone_core_manager_destroy(pauline);
}
#ifdef VIDEO_ENABLED
static bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee) {
LinphoneVideoPolicy caller_policy;
@ -989,8 +1070,8 @@ static bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee)
stats initial_caller_stat=caller->stat;
stats initial_callee_stat=callee->stat;
if (linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning
|| linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning ) {
if (!linphone_core_get_current_call(callee->lc) || linphone_call_get_state(linphone_core_get_current_call(callee->lc)) != LinphoneCallStreamsRunning
|| !linphone_core_get_current_call(caller->lc) || linphone_call_get_state(linphone_core_get_current_call(caller->lc)) != LinphoneCallStreamsRunning ) {
ms_warning("bad state for adding video");
return FALSE;
}
@ -1077,23 +1158,36 @@ static void call_with_video_added_random_ports(void) {
linphone_core_manager_destroy(pauline);
}
static void call_with_declined_video(void) {
static void call_with_declined_video_base(bool_t using_policy) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCallParams* callee_params;
LinphoneCallParams* caller_params;
LinphoneCall* marie_call;
LinphoneCall* pauline_call;
LinphoneVideoPolicy marie_policy, pauline_policy;
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, FALSE);
caller_params=linphone_core_create_default_call_parameters(marie->lc);
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(pauline->lc);
linphone_call_params_enable_video(callee_params,FALSE);
if (using_policy) {
pauline_policy.automatically_initiate=TRUE;
pauline_policy.automatically_accept=FALSE;
marie_policy.automatically_initiate=FALSE;
marie_policy.automatically_accept=FALSE;
linphone_core_set_video_policy(marie->lc,&marie_policy);
linphone_core_set_video_policy(pauline->lc,&pauline_policy);
}
caller_params=linphone_core_create_default_call_parameters(pauline->lc);
if (!using_policy)
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(marie->lc);
if (!using_policy)
linphone_call_params_enable_video(callee_params,FALSE);
CU_ASSERT_TRUE(call_with_params(pauline,marie,caller_params,callee_params));
marie_call=linphone_core_get_current_call(marie->lc);
pauline_call=linphone_core_get_current_call(pauline->lc);
@ -1109,22 +1203,41 @@ static void call_with_declined_video(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_with_declined_video(void) {
call_with_declined_video_base(FALSE);
}
static void call_with_declined_video_using_policy(void) {
call_with_declined_video_base(TRUE);
}
static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie) {
static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy) {
LinphoneCallParams* callee_params;
LinphoneCallParams* caller_params;
LinphoneCall* marie_call;
LinphoneCall* pauline_call;
LinphoneVideoPolicy marie_policy, pauline_policy;
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, FALSE);
caller_params=linphone_core_create_default_call_parameters(marie->lc);
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(pauline->lc);
linphone_call_params_enable_video(callee_params,TRUE);
if (using_policy) {
marie_policy.automatically_initiate=FALSE;
marie_policy.automatically_accept=TRUE;
pauline_policy.automatically_initiate=TRUE;
pauline_policy.automatically_accept=FALSE;
linphone_core_set_video_policy(marie->lc,&marie_policy);
linphone_core_set_video_policy(pauline->lc,&pauline_policy);
}
caller_params=linphone_core_create_default_call_parameters(pauline->lc);
if (!using_policy)
linphone_call_params_enable_video(caller_params,TRUE);
callee_params=linphone_core_create_default_call_parameters(marie->lc);
if (!using_policy)
linphone_call_params_enable_video(callee_params,TRUE);
CU_ASSERT_TRUE(call_with_params(pauline,marie,caller_params,callee_params));
marie_call=linphone_core_get_current_call(marie->lc);
pauline_call=linphone_core_get_current_call(pauline->lc);
@ -1152,15 +1265,24 @@ static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* ma
static void video_call(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
video_call_base(marie,pauline);
video_call_base(marie,pauline,FALSE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void video_call_using_policy(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
video_call_base(marie,pauline,TRUE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void video_call_no_sdp(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
linphone_core_enable_sdp_200_ack(pauline->lc,TRUE);
video_call_base(pauline,marie);
video_call_base(pauline,marie,FALSE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@ -2549,6 +2671,7 @@ test_t call_tests[] = {
{ "Call terminated by caller", call_terminated_by_caller },
{ "Call without SDP", call_with_no_sdp},
{ "Call paused resumed", call_paused_resumed },
{ "Call paused resumed with loss", call_paused_resumed_with_loss },
{ "Call paused resumed from callee", call_paused_resumed_from_callee },
{ "SRTP call", srtp_call },
{ "ZRTP call",zrtp_call},
@ -2556,12 +2679,14 @@ test_t call_tests[] = {
{ "SRTP call with declined srtp", call_with_declined_srtp },
#ifdef VIDEO_ENABLED
{ "Simple video call",video_call},
{ "Simple video call using policy",video_call_using_policy},
{ "Video call without SDP",video_call_no_sdp},
{ "SRTP ice video call", srtp_video_ice_call },
{ "ZRTP ice video call", zrtp_video_ice_call },
{ "Call with video added", call_with_video_added },
{ "Call with video added (random ports)", call_with_video_added_random_ports },
{ "Call with video declined",call_with_declined_video},
{ "Call with video declined", call_with_declined_video},
{ "Call with video declined using policy", call_with_declined_video_using_policy},
{ "Call with multiple early media", multiple_early_media },
{ "Call with ICE from video to non-video", call_with_ice_video_to_novideo},
{ "Call with ICE and video added", call_with_ice_video_added },

View file

@ -37,7 +37,7 @@ aliases=localhost sipopen.example.org sip.example.org auth.example.org auth1.exa
# transports=sips:sip.linphone.org:6060;maddr=192.168.0.29
# Default value: sip:*
#transports=sip:192.168.56.101:5060 sips:192.168.56.101:5061
transports=sip:*:5060 sips:*:5061;tls-certificates-dir=/etc/flexisip/tls/certificates/cn sips:*:5062;tls-certificates-dir=/etc/flexisip/tls/certificates/altname sips:*:5063;require-peer-certificate=1
transports=sip:*:5060 sips:*:5061;tls-certificates-dir=/etc/flexisip/tls/certificates/cn sips:*:5062;tls-certificates-dir=/etc/flexisip/tls/certificates/altname sips:*:5063;require-peer-certificate=1 sip:*:5064
# An absolute path of a directory where TLS server certificate and
# private key can be found, concatenated inside an 'agent.pem' file.
# Default value: /etc/flexisip/tls
@ -508,3 +508,30 @@ route=
# Default value: false
rewrite-req-uri=false
[module::Redirect]
enabled=true
filter = (user-agent contains 'redirect') && !(request.uri.params contains 'redirected')
contact= <sip:sipopen.example.org;redirected>
##
## The purpose of the StatisticsCollector module is to collect call
## statistics (RFC 6035) and store them on the server.
##
[module::StatisticsCollector]
# Indicate whether the module is activated.
# Default value: false
enabled=true
# A request/response enters module if the boolean filter evaluates
# to true. Ex: from.uri.domain contains 'sip.linphone.org', from.uri.domain
# in 'a.org b.org c.org', (to.uri.domain in 'a.org b.org c.org')
# && (user-agent == 'Linphone v2')
# Default value:
filter=
# SIP URI of the statistics collector. Note that the messages destinated
# to this address will be deleted by this module and thus not be
# delivered.
# Default value:
collector-address=sip:collector@sip.example.org

View file

@ -124,6 +124,7 @@ typedef struct _stats {
int number_of_LinphoneTransferCallError;
int number_of_LinphoneMessageReceived;
int number_of_LinphoneMessageReceivedWithFile;
int number_of_LinphoneMessageReceivedLegacy;
int number_of_LinphoneMessageExtBodyReceived;
int number_of_LinphoneMessageInProgress;
@ -191,6 +192,7 @@ typedef struct _stats {
int number_of_LinphoneCallEncryptedOn;
int number_of_LinphoneCallEncryptedOff;
LinphoneChatMessage* last_received_chat_message;
}stats;
typedef struct _LinphoneCoreManager {

View file

@ -41,20 +41,22 @@ void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMess
stats* counters;
const char *text=linphone_chat_message_get_text(message);
const char *external_body_url=linphone_chat_message_get_external_body_url(message);
const LinphoneContent *file_transfer_info=linphone_chat_message_get_file_transfer_information(message);
ms_message("Message from [%s] is [%s] , external URL [%s]",from?from:""
,text?text:""
,external_body_url?external_body_url:"");
ms_free(from);
counters = get_stats(lc);
counters->number_of_LinphoneMessageReceived++;
if (file_transfer_info) { /* if we have a file transfer in RCS mode, start the download */
linphone_chat_message_start_file_download(message);
} else if (linphone_chat_message_get_external_body_url(message)) {
if (linphone_chat_message_get_file_transfer_information(message))
counters->number_of_LinphoneMessageReceivedWithFile++;
if (counters->last_received_chat_message) linphone_chat_message_unref(counters->last_received_chat_message);
linphone_chat_message_ref(counters->last_received_chat_message=message);
if (linphone_chat_message_get_external_body_url(message)) {
counters->number_of_LinphoneMessageExtBodyReceived++;
if (message_external_body_url)
if (message_external_body_url) {
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_external_body_url(message),message_external_body_url);
message_external_body_url=NULL;
}
}
}
@ -456,7 +458,7 @@ static void lime_file_transfer_message(void) {
/* create a chatroom on pauline's side */
to = linphone_address_as_string(marie->identity);
chat_room = linphone_core_create_chat_room(pauline->lc,to);
ms_free(to);
/* create a file transfer message */
memset(&content,0,sizeof(content));
content.type="text";
@ -466,7 +468,10 @@ static void lime_file_transfer_message(void) {
message = linphone_chat_room_create_file_transfer_message(chat_room, &content);
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
if (marie->stat.last_received_info_message ) {
linphone_chat_message_start_file_download((const LinphoneChatMessage*)marie->stat.last_received_info_message);
}
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
@ -485,6 +490,8 @@ static void file_transfer_message_io_error(void) {
const char* big_file_content="big file"; /* setting dummy file content to something */
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
/* setting dummy file content to something */
for (i=0;i<sizeof(big_file);i+=strlen(big_file_content))
@ -535,6 +542,9 @@ static void text_message_with_send_error(void) {
char* to = linphone_address_as_string(pauline->identity);
LinphoneChatRoom* chat_room = linphone_core_create_chat_room(marie->lc,to);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
/*simultate a network error*/
sal_set_send_error(marie->lc->sal, -1);
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,marie->lc);
@ -567,6 +577,8 @@ static void text_message_denied(void) {
char* to = linphone_address_as_string(pauline->identity);
LinphoneChatRoom* chat_room = linphone_core_create_chat_room(marie->lc,to);
LinphoneChatMessage* message = linphone_chat_room_create_message(chat_room,"Bli bli bli \n blu");
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
/*pauline doesn't want to be disturbed*/
linphone_core_disable_chat(pauline->lc,LinphoneReasonDoNotDisturb);

View file

@ -1,2 +1,5 @@
[misc]
config-uri=http://smtp.linphone.org/marie_default
[app]
toto=titi

View file

@ -0,0 +1,3 @@
[misc]
config-uri=/tmp/lol

View file

@ -804,6 +804,17 @@ static void tls_wildcard_register(){
linphone_core_destroy(mgr->lc);
}
static void redirect(){
char route[256];
LinphoneCoreManager* lcm;
LCSipTransports transport = {-1,0,0,0};
sprintf(route,"sip:%s:5064",test_route);
lcm = create_lcm();
linphone_core_set_user_agent(lcm->lc,"redirect",NULL);
register_with_refresh_base_2(lcm->lc,FALSE,test_domain,route,FALSE,transport);
linphone_core_manager_destroy(lcm);
}
test_t register_tests[] = {
{ "Simple register", simple_register },
{ "Simple register unregister", simple_unregister },
@ -835,7 +846,8 @@ test_t register_tests[] = {
{ "Io recv error", io_recv_error },
{ "Io recv error with recovery", io_recv_error_retry_immediatly},
{ "Io recv error with late recovery", io_recv_error_late_recovery},
{ "Io recv error without active registration", io_recv_error_without_active_register}
{ "Io recv error without active registration", io_recv_error_without_active_register},
{ "Simple redirect", redirect}
};
test_suite_t register_test_suite = {

View file

@ -77,6 +77,12 @@ static void remote_provisioning_invalid(void) {
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_invalid_uri(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_invalid_uri_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_default_values(void) {
LinphoneProxyConfig *lpc;
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_default_values_rc", FALSE);
@ -84,9 +90,14 @@ static void remote_provisioning_default_values(void) {
lpc = linphone_core_create_proxy_config(marie->lc);
CU_ASSERT_TRUE(lpc->reg_sendregister == TRUE);
CU_ASSERT_TRUE(lpc->expires == 604800);
CU_ASSERT_TRUE(strcmp(lpc->reg_proxy, "<sip:sip.linphone.org:5223;transport=tls>") == 0);
CU_ASSERT_TRUE(strcmp(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>") == 0);
CU_ASSERT_TRUE(strcmp(lpc->reg_identity, "sip:?@sip.linphone.org") == 0);
CU_ASSERT_STRING_EQUAL(lpc->reg_proxy, "<sip:sip.linphone.org:5223;transport=tls>");
CU_ASSERT_STRING_EQUAL(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>");
CU_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org");
{
LpConfig* lp = linphone_core_get_config(marie->lc);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi");
}
linphone_core_manager_destroy(marie);
}
@ -115,7 +126,8 @@ test_t remote_provisioning_tests[] = {
{ "Remote provisioning invalid", remote_provisioning_invalid },
{ "Remote provisioning transient successful", remote_provisioning_transient },
{ "Remote provisioning default values", remote_provisioning_default_values },
{ "Remote provisioning from file", remote_provisioning_file }
{ "Remote provisioning from file", remote_provisioning_file },
{ "Remote provisioning invalid URI", remote_provisioning_invalid_uri }
};
test_suite_t remote_provisioning_test_suite = {

View file

@ -127,6 +127,8 @@ void linphone_proxy_config_address_equal_test() {
void linphone_proxy_config_is_server_config_changed_test() {
LinphoneProxyConfig* proxy_config = linphone_proxy_config_new();
linphone_proxy_config_done(proxy_config); /*test done without edit*/
linphone_proxy_config_set_identity(proxy_config,"sip:toto@titi");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_set_identity(proxy_config,"sips:toto@titi");

View file

@ -387,6 +387,11 @@ int liblinphone_tester_run_tests(const char *suite_name, const char *test_name)
run_test_suite(test_suite[i]);
}
#if !HAVE_CU_GET_SUITE
if( suite_name ){
ms_warning("Tester compiled without CU_get_suite() function, running all tests instead of suite '%s'\n", suite_name);
}
#else
if (suite_name){
CU_pSuite suite;
CU_basic_set_mode(CU_BRM_VERBOSE);
@ -409,7 +414,9 @@ int liblinphone_tester_run_tests(const char *suite_name, const char *test_name)
} else {
CU_basic_run_suite(suite);
}
} else
}
else
#endif
{
#if HAVE_CU_CURSES
if (curses) {