forked from mirrors/linphone-iphone
Merge remote-tracking branch 'master/master'
This commit is contained in:
commit
c9315f4a3f
42 changed files with 742 additions and 276 deletions
1
NEWS
1
NEWS
|
|
@ -8,6 +8,7 @@ linphone-3.8.0 -- Date to be defined
|
|||
* Support for RTP/AVPF (RFCxxxx) for video streams, allowing fast transmission error recovery with VP8 codec only.
|
||||
* API enhancements, most objects can be ref-counted.
|
||||
* Call video recording feature, in mkv format (H264 streams only for the moment)
|
||||
* Support of SRTP by using packages from GNU/Linux distributions
|
||||
|
||||
linphone-3.7.0 -- February 20th, 2014
|
||||
Application level improvements:
|
||||
|
|
|
|||
7
README
7
README
|
|
@ -39,12 +39,7 @@ libglew1.6-dev libv4l-dev libxml2-dev
|
|||
|
||||
+ for optional library
|
||||
$ sudo apt-get install libreadline-dev libgsm1-dev libtheora-dev \
|
||||
libsoup2.4-dev libsqlite3-dev libupnp4-dev
|
||||
|
||||
+ Install srtp (optional) for call encryption :
|
||||
$ git clone git://git.linphone.org/srtp.git
|
||||
$ cd srtp && autoconf && ./configure && make
|
||||
$ sudo make install
|
||||
libsoup2.4-dev libsqlite3-dev libupnp4-dev libsrtp-dev
|
||||
|
||||
+ Install zrtp (optional), for unbreakable call encryption
|
||||
$ git clone git://git.linphone.org:bzrtp
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
* Xcode (download from apple or using appstore application)
|
||||
* [Java SE](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or openJDK
|
||||
This is required to generate a C sourcefile from SIP grammar using [antlr3](http://www.antlr3.org/) generator.
|
||||
* [HomeBrew](http://brew.sh) or [Macports](http://www.macports.org/).
|
||||
* [XQuartz](https://xquartz.macosforge.org) for GTK version.
|
||||
* [HomeBrew](http://brew.sh) or [Macports](http://www.macports.org/).
|
||||
|
||||
### Dependencies
|
||||
|
||||
|
|
|
|||
2
TODO
2
TODO
|
|
@ -3,7 +3,7 @@ hot stuff:
|
|||
|
||||
* ice support
|
||||
* run a user given command upon incoming calls
|
||||
* SIP/TLS and SRTP
|
||||
* SIP/TLS
|
||||
|
||||
low priority:
|
||||
-------------
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ common_SRC_FILES := \
|
|||
player_tester.c \
|
||||
dtmf_tester.c \
|
||||
accountmanager.c \
|
||||
offeranswer_tester.c
|
||||
offeranswer_tester.c \
|
||||
multicast_call_tester.c
|
||||
|
||||
common_C_INCLUDES += \
|
||||
$(LOCAL_PATH) \
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <ws2tcpip.h>
|
||||
|
|
@ -125,11 +126,36 @@ static void print_usage(void){
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
static char *argv_to_line(int argc, char *argv[]) {
|
||||
int i;
|
||||
int line_length;
|
||||
char *line;
|
||||
|
||||
assert( argc>=0 );
|
||||
|
||||
if(argc == 0) return NULL;
|
||||
|
||||
line_length = strlen(argv[0]);
|
||||
for(i=1; i<argc; i++) {
|
||||
line_length += strlen(argv[i]) + 1;
|
||||
}
|
||||
|
||||
line = ortp_malloc0((line_length +1) * sizeof(char));
|
||||
strcat(line, argv[0]);
|
||||
for(i=1; i<argc; i++) {
|
||||
strcat(line, " ");
|
||||
strcat(line, argv[i]);
|
||||
}
|
||||
return line;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MAX_ARGS 10
|
||||
|
||||
#ifndef WIN32
|
||||
static void spawn_linphonec(int argc, char *argv[]){
|
||||
char * args[10];
|
||||
char * args[MAX_ARGS];
|
||||
int i,j;
|
||||
pid_t pid;
|
||||
j=0;
|
||||
|
|
@ -178,13 +204,21 @@ static void spawn_linphonec(int argc, char *argv[]){
|
|||
PROCESS_INFORMATION pinfo;
|
||||
STARTUPINFO si;
|
||||
BOOL ret;
|
||||
const char *cmd = "linphoned.exe --pipe -c NUL";
|
||||
char *args_in_line = argv_to_line(argc, argv);
|
||||
char *cmd_with_args;
|
||||
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
ZeroMemory( &pinfo, sizeof(pinfo) );
|
||||
|
||||
|
||||
ret=CreateProcess(NULL,"linphoned.exe --pipe -c NUL",
|
||||
if(args_in_line) {
|
||||
cmd_with_args = ortp_strdup_printf("%s %s", cmd, args_in_line);
|
||||
} else {
|
||||
cmd_with_args = ortp_strdup(cmd);
|
||||
}
|
||||
|
||||
ret=CreateProcess(NULL, cmd_with_args,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
|
|
@ -193,8 +227,12 @@ static void spawn_linphonec(int argc, char *argv[]){
|
|||
NULL,
|
||||
&si,
|
||||
&pinfo);
|
||||
|
||||
if(args_in_line) ortp_free(args_in_line);
|
||||
ortp_free(cmd_with_args);
|
||||
|
||||
if (!ret){
|
||||
fprintf(stderr,"Spawning of linphonec.exe failed.\n");
|
||||
fprintf(stderr,"Spawning of linphoned.exe failed.\n");
|
||||
}else{
|
||||
WaitForInputIdle(pinfo.hProcess,1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1135,6 +1135,16 @@ void sal_cancel_timer(Sal *sal, belle_sip_source_t *timer) {
|
|||
belle_sip_main_loop_t *ml = belle_sip_stack_get_main_loop(sal->stack);
|
||||
belle_sip_main_loop_remove_source(ml, timer);
|
||||
}
|
||||
|
||||
unsigned long sal_begin_background_task(const char *name, void (*max_time_reached)(void *), void *data){
|
||||
return belle_sip_begin_background_task(name, max_time_reached, data);
|
||||
}
|
||||
|
||||
void sal_end_background_task(unsigned long id){
|
||||
belle_sip_end_background_task(id);
|
||||
}
|
||||
|
||||
|
||||
void sal_enable_sip_update_method(Sal *ctx,bool_t value) {
|
||||
ctx->enable_sip_update=value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ static void register_refresher_listener (belle_sip_refresher_t* refresher
|
|||
op->auth_info=sal_auth_info_create((belle_sip_auth_event_t*)(belle_sip_refresher_get_auth_events(refresher)->data));
|
||||
}
|
||||
sal_error_info_set(&op->error_info,SalReasonUnknown,status_code,reason_phrase,NULL);
|
||||
if (status_code>=200){
|
||||
sal_op_assign_recv_headers(op,(belle_sip_message_t*)response);
|
||||
}
|
||||
if(status_code == 200) {
|
||||
/*check service route rfc3608*/
|
||||
belle_sip_header_service_route_t* service_route;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,42 @@ SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params) {
|
|||
return SalProtoRtpAvp;
|
||||
}
|
||||
|
||||
SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir) {
|
||||
switch (cpdir) {
|
||||
case LinphoneMediaDirectionInactive:
|
||||
return SalStreamInactive;
|
||||
case LinphoneMediaDirectionSendOnly:
|
||||
return SalStreamSendOnly;
|
||||
case LinphoneMediaDirectionRecvOnly:
|
||||
return SalStreamRecvOnly;
|
||||
case LinphoneMediaDirectionSendRecv:
|
||||
return SalStreamSendRecv;
|
||||
}
|
||||
return SalStreamSendRecv;
|
||||
}
|
||||
|
||||
LinphoneMediaDirection media_direction_from_sal_stream_dir(SalStreamDir dir){
|
||||
switch (dir) {
|
||||
case SalStreamInactive:
|
||||
return LinphoneMediaDirectionInactive;
|
||||
case SalStreamSendOnly:
|
||||
return LinphoneMediaDirectionSendOnly;
|
||||
case SalStreamRecvOnly:
|
||||
return LinphoneMediaDirectionRecvOnly;
|
||||
case SalStreamSendRecv:
|
||||
return LinphoneMediaDirectionSendRecv;
|
||||
}
|
||||
return LinphoneMediaDirectionSendRecv;
|
||||
}
|
||||
|
||||
SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params) {
|
||||
return sal_dir_from_call_params_dir(linphone_call_params_get_audio_direction(params));
|
||||
}
|
||||
|
||||
SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params) {
|
||||
return sal_dir_from_call_params_dir(linphone_call_params_get_video_direction(params));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Public functions *
|
||||
|
|
@ -69,6 +105,8 @@ void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t en
|
|||
|
||||
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled){
|
||||
cp->has_video=enabled;
|
||||
if (enabled && cp->video_dir==LinphoneMediaDirectionInactive)
|
||||
cp->video_dir=LinphoneMediaDirectionSendRecv;
|
||||
}
|
||||
|
||||
const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name){
|
||||
|
|
@ -159,19 +197,19 @@ bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp){
|
|||
return cp->has_video;
|
||||
}
|
||||
|
||||
LinphoneCallParamsMediaDirection linphone_call_params_get_audio_direction(const LinphoneCallParams *cp) {
|
||||
LinphoneMediaDirection linphone_call_params_get_audio_direction(const LinphoneCallParams *cp) {
|
||||
return cp->audio_dir;
|
||||
}
|
||||
|
||||
LinphoneCallParamsMediaDirection linphone_call_params_get_video_direction(const LinphoneCallParams *cp) {
|
||||
LinphoneMediaDirection linphone_call_params_get_video_direction(const LinphoneCallParams *cp) {
|
||||
return cp->video_dir;
|
||||
}
|
||||
|
||||
void linphone_call_params_set_audio_direction(LinphoneCallParams *cp,LinphoneCallParamsMediaDirection dir) {
|
||||
void linphone_call_params_set_audio_direction(LinphoneCallParams *cp,LinphoneMediaDirection dir) {
|
||||
cp->audio_dir=dir;
|
||||
}
|
||||
|
||||
void linphone_call_params_set_video_direction(LinphoneCallParams *cp,LinphoneCallParamsMediaDirection dir) {
|
||||
void linphone_call_params_set_video_direction(LinphoneCallParams *cp,LinphoneMediaDirection dir) {
|
||||
cp->video_dir=dir;
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +245,10 @@ static void _linphone_call_params_destroy(LinphoneCallParams *cp){
|
|||
}
|
||||
|
||||
LinphoneCallParams * linphone_call_params_new(void) {
|
||||
return belle_sip_object_new(LinphoneCallParams);
|
||||
LinphoneCallParams *cp=belle_sip_object_new(LinphoneCallParams);
|
||||
cp->audio_dir=LinphoneMediaDirectionSendRecv;
|
||||
cp->video_dir=LinphoneMediaDirectionSendRecv;
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* DEPRECATED */
|
||||
|
|
|
|||
|
|
@ -33,17 +33,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
/**
|
||||
* Indicates for a given media the stream direction
|
||||
* */
|
||||
enum _LinphoneCallParamsMediaDirection {
|
||||
LinphoneCallParamsMediaDirectionInactive, /** No active media not supported yet*/
|
||||
LinphoneCallParamsMediaDirectionSendOnly, /** Send only mode*/
|
||||
LinphoneCallParamsMediaDirectionRecvOnly, /** recv only mode*/
|
||||
LinphoneCallParamsMediaDirectionSendRecv, /*send receive mode not supported yet*/
|
||||
enum _LinphoneMediaDirection {
|
||||
LinphoneMediaDirectionInactive, /** No active media not supported yet*/
|
||||
LinphoneMediaDirectionSendOnly, /** Send only mode*/
|
||||
LinphoneMediaDirectionRecvOnly, /** recv only mode*/
|
||||
LinphoneMediaDirectionSendRecv, /*send receive mode not supported yet*/
|
||||
|
||||
};
|
||||
/**
|
||||
* Typedef for enum
|
||||
**/
|
||||
typedef enum _LinphoneCallParamsMediaDirection LinphoneCallParamsMediaDirection;
|
||||
typedef enum _LinphoneMediaDirection LinphoneMediaDirection;
|
||||
|
||||
/**
|
||||
* Private structure definition for LinphoneCallParams.
|
||||
|
|
@ -266,28 +266,28 @@ LINPHONE_PUBLIC bool_t linphone_call_params_video_enabled(const LinphoneCallPara
|
|||
* @param[in] cl LinphoneCallParams object
|
||||
* @return The audio stream direction associated with the call params.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneCallParamsMediaDirection linphone_call_params_get_audio_direction(const LinphoneCallParams *cp);
|
||||
LINPHONE_PUBLIC LinphoneMediaDirection linphone_call_params_get_audio_direction(const LinphoneCallParams *cp);
|
||||
|
||||
/**
|
||||
* Get the video stream direction.
|
||||
* @param[in] cl LinphoneCallParams object
|
||||
* @return The video stream direction associated with the call params.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneCallParamsMediaDirection linphone_call_params_get_video_direction(const LinphoneCallParams *cp);
|
||||
LINPHONE_PUBLIC LinphoneMediaDirection linphone_call_params_get_video_direction(const LinphoneCallParams *cp);
|
||||
|
||||
/**
|
||||
* Set the audio stream direction. Only relevant for multicast
|
||||
* @param[in] cl LinphoneCallParams object
|
||||
* @param[in] The audio stream direction associated with this call params.
|
||||
**/
|
||||
/*LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);*/
|
||||
LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams *cp, LinphoneMediaDirection dir);
|
||||
|
||||
/**
|
||||
* Set the video stream direction. Only relevant for multicast
|
||||
* @param[in] cl LinphoneCallParams object
|
||||
* @param[in] The video stream direction associated with this call params.
|
||||
**/
|
||||
/*LINPHONE_PUBLIC void linphone_call_params_set_video_direction(LinphoneCallParams *cp, LinphoneCallParamsMediaDirection dir);*/
|
||||
LINPHONE_PUBLIC void linphone_call_params_set_video_direction(LinphoneCallParams *cp, LinphoneMediaDirection dir);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -120,7 +120,9 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
|
|||
bool_t all_muted=FALSE;
|
||||
bool_t send_ringbacktone=FALSE;
|
||||
|
||||
linphone_core_stop_ringing(lc);
|
||||
if (!((call->state == LinphoneCallIncomingEarlyMedia) && (linphone_core_get_ring_during_incoming_early_media(lc)))) {
|
||||
linphone_core_stop_ringing(lc);
|
||||
}
|
||||
if (!new_md) {
|
||||
ms_error("linphone_core_update_streams() called with null media description");
|
||||
return;
|
||||
|
|
@ -232,17 +234,13 @@ static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const L
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static bool_t already_a_call_pending(LinphoneCore *lc){
|
||||
static bool_t already_an_outgoing_call_pending(LinphoneCore *lc){
|
||||
MSList *elem;
|
||||
for(elem=lc->calls;elem!=NULL;elem=elem->next){
|
||||
LinphoneCall *call=(LinphoneCall*)elem->data;
|
||||
if (call->state==LinphoneCallIncomingReceived
|
||||
|| call->state==LinphoneCallIncomingEarlyMedia
|
||||
|| call->state==LinphoneCallOutgoingInit
|
||||
if (call->state==LinphoneCallOutgoingInit
|
||||
|| call->state==LinphoneCallOutgoingProgress
|
||||
|| call->state==LinphoneCallOutgoingEarlyMedia
|
||||
|| call->state==LinphoneCallOutgoingRinging
|
||||
|| call->state==LinphoneCallIdle){ /*case of an incoming call for which ICE candidate gathering is pending.*/
|
||||
|| call->state==LinphoneCallOutgoingRinging){
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -312,8 +310,8 @@ static void call_received(SalOp *h){
|
|||
from_addr=linphone_address_new(sal_op_get_from(h));
|
||||
to_addr=linphone_address_new(sal_op_get_to(h));
|
||||
|
||||
if ((already_a_call_with_remote_address(lc,from_addr) && prevent_colliding_calls) || already_a_call_pending(lc)){
|
||||
ms_warning("Receiving another call while one is ringing or initiated, refusing this one with busy message.");
|
||||
if ((already_a_call_with_remote_address(lc,from_addr) && prevent_colliding_calls) || already_an_outgoing_call_pending(lc)){
|
||||
ms_warning("Receiving a call while one is initiated, refusing this one with busy message.");
|
||||
sal_call_decline(h,SalReasonBusy,NULL);
|
||||
sal_op_release(h);
|
||||
linphone_address_destroy(from_addr);
|
||||
|
|
@ -338,6 +336,8 @@ static void call_received(SalOp *h){
|
|||
linphone_core_add_call(lc,call);
|
||||
linphone_call_ref(call); /*prevent the call from being destroyed while we are notifying, if the user declines within the state callback */
|
||||
|
||||
call->bg_task_id=sal_begin_background_task("liblinphone call notification", NULL, NULL);
|
||||
|
||||
if ((linphone_core_get_firewall_policy(lc) == LinphonePolicyUseIce) && (call->ice_session != NULL)) {
|
||||
/* Defer ringing until the end of the ICE candidates gathering process. */
|
||||
ms_message("Defer ringing to gather ICE candidates");
|
||||
|
|
|
|||
|
|
@ -612,6 +612,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
|
|||
md->streams[0].rtp_port=call->media_ports[0].rtp_port;
|
||||
md->streams[0].rtcp_port=call->media_ports[0].rtcp_port;
|
||||
md->streams[0].proto=get_proto_from_call_params(call->params);
|
||||
md->streams[0].dir=get_audio_dir_from_call_params(call->params);
|
||||
md->streams[0].type=SalAudio;
|
||||
if (call->params->down_ptime)
|
||||
md->streams[0].ptime=call->params->down_ptime;
|
||||
|
|
@ -640,6 +641,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
|
|||
md->streams[1].rtp_port=call->media_ports[1].rtp_port;
|
||||
md->streams[1].rtcp_port=call->media_ports[1].rtcp_port;
|
||||
md->streams[1].proto=md->streams[0].proto;
|
||||
md->streams[1].dir=get_video_dir_from_call_params(call->params);
|
||||
md->streams[1].type=SalVideo;
|
||||
codec_hints.bandwidth_limit=0;
|
||||
codec_hints.max_codecs=-1;
|
||||
|
|
@ -1382,6 +1384,7 @@ void linphone_call_unref(LinphoneCall *obj){
|
|||
* Returns current parameters associated to the call.
|
||||
**/
|
||||
const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
|
||||
SalMediaDescription *md=call->resultdesc;
|
||||
#ifdef VIDEO_ENABLED
|
||||
VideoStream *vstream;
|
||||
#endif
|
||||
|
|
@ -1417,6 +1420,12 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
|
|||
} else {
|
||||
call->current_params->avpf_rr_interval = 0;
|
||||
}
|
||||
if (md){
|
||||
SalStreamDescription *sd=sal_media_description_find_best_stream(md,SalAudio);
|
||||
call->current_params->audio_dir=sd ? media_direction_from_sal_stream_dir(sd->dir) : LinphoneMediaDirectionInactive;
|
||||
sd=sal_media_description_find_best_stream(md,SalVideo);
|
||||
call->current_params->video_dir=sd ? media_direction_from_sal_stream_dir(sd->dir) : LinphoneMediaDirectionInactive;
|
||||
}
|
||||
|
||||
return call->current_params;
|
||||
}
|
||||
|
|
@ -2175,6 +2184,8 @@ static int get_video_bw(LinphoneCall *call, const SalMediaDescription *md, const
|
|||
else if (md->bandwidth>0) {
|
||||
/*case where b=AS is given globally, not per stream*/
|
||||
remote_bw=get_remaining_bandwidth_for_video(md->bandwidth,call->audio_bw);
|
||||
} else {
|
||||
remote_bw = lp_config_get_int(call->core->config, "net", "default_max_bandwidth", 1500);
|
||||
}
|
||||
bw=get_min_bandwidth(get_remaining_bandwidth_for_video(linphone_core_get_upload_bandwidth(call->core),call->audio_bw),remote_bw);
|
||||
return bw;
|
||||
|
|
@ -2752,10 +2763,6 @@ 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]);
|
||||
rtp_session_unregister_event_queue(call->audiostream->ms.sessions.rtp_session,call->audiostream_app_evq);
|
||||
ortp_ev_queue_flush(call->audiostream_app_evq);
|
||||
ortp_ev_queue_destroy(call->audiostream_app_evq);
|
||||
call->audiostream_app_evq=NULL;
|
||||
|
||||
if (call->audiostream->ec){
|
||||
const char *state_str=NULL;
|
||||
|
|
@ -2771,6 +2778,10 @@ static void linphone_call_stop_audio_stream(LinphoneCall *call) {
|
|||
linphone_call_remove_from_conf(call);
|
||||
}
|
||||
audio_stream_stop(call->audiostream);
|
||||
rtp_session_unregister_event_queue(call->sessions[0].rtp_session, call->audiostream_app_evq);
|
||||
ortp_ev_queue_flush(call->audiostream_app_evq);
|
||||
ortp_ev_queue_destroy(call->audiostream_app_evq);
|
||||
call->audiostream_app_evq=NULL;
|
||||
call->audiostream=NULL;
|
||||
call->current_params->audio_codec = NULL;
|
||||
}
|
||||
|
|
@ -2781,13 +2792,13 @@ static void linphone_call_stop_video_stream(LinphoneCall *call) {
|
|||
if (call->videostream!=NULL){
|
||||
linphone_reporting_update_media_info(call, LINPHONE_CALL_STATS_VIDEO);
|
||||
media_stream_reclaim_sessions(&call->videostream->ms,&call->sessions[1]);
|
||||
rtp_session_unregister_event_queue(call->videostream->ms.sessions.rtp_session,call->videostream_app_evq);
|
||||
ortp_ev_queue_flush(call->videostream_app_evq);
|
||||
ortp_ev_queue_destroy(call->videostream_app_evq);
|
||||
call->videostream_app_evq=NULL;
|
||||
linphone_call_log_fill_stats(call->log,(MediaStream*)call->videostream);
|
||||
video_stream_stop(call->videostream);
|
||||
call->videostream=NULL;
|
||||
rtp_session_unregister_event_queue(call->sessions[1].rtp_session, call->videostream_app_evq);
|
||||
ortp_ev_queue_flush(call->videostream_app_evq);
|
||||
ortp_ev_queue_destroy(call->videostream_app_evq);
|
||||
call->videostream_app_evq=NULL;
|
||||
call->current_params->video_codec = NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -153,8 +153,14 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin
|
|||
return linphone_call_get_remote_address(call);
|
||||
}
|
||||
|
||||
static void linphone_core_log_collection_handler(OrtpLogLevel level, const char *fmt, va_list args);
|
||||
|
||||
void linphone_core_set_log_handler(OrtpLogFunc logfunc) {
|
||||
ortp_set_log_handler(logfunc);
|
||||
if (ortp_logv_out == linphone_core_log_collection_handler) {
|
||||
ms_message("There is already a log collection handler, keep it");
|
||||
liblinphone_log_func = logfunc;
|
||||
} else
|
||||
ortp_set_log_handler(logfunc);
|
||||
}
|
||||
|
||||
void linphone_core_set_log_file(FILE *file) {
|
||||
|
|
@ -645,7 +651,7 @@ void linphone_core_enable_logs(FILE *file){
|
|||
**/
|
||||
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){
|
||||
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
|
||||
ortp_set_log_handler(logfunc);
|
||||
linphone_core_set_log_handler(logfunc);
|
||||
sal_enable_logs();
|
||||
}
|
||||
|
||||
|
|
@ -1009,7 +1015,7 @@ static PayloadType * find_payload(const MSList *default_list, const char *mime_t
|
|||
PayloadType *candidate=NULL;
|
||||
PayloadType *it;
|
||||
const MSList *elem;
|
||||
|
||||
|
||||
for(elem=default_list;elem!=NULL;elem=elem->next){
|
||||
it=(PayloadType*)elem->data;
|
||||
if (it!=NULL && strcasecmp(mime_type,it->mime_type)==0
|
||||
|
|
@ -1075,6 +1081,7 @@ static bool_t get_codec(LinphoneCore *lc, SalStreamType type, int index, Payload
|
|||
pt->mime_type=ortp_strdup(mime);
|
||||
pt->clock_rate=rate;
|
||||
pt->channels=channels;
|
||||
payload_type_set_number(pt,-1); /*dynamic assignment*/
|
||||
payload_type_set_recv_fmtp(pt,fmtp);
|
||||
*default_list=ms_list_append(*default_list, pt);
|
||||
}
|
||||
|
|
@ -1089,7 +1096,7 @@ static bool_t get_codec(LinphoneCore *lc, SalStreamType type, int index, Payload
|
|||
static MSList *add_missing_codecs(const MSList *default_list, MSList *l){
|
||||
const MSList *elem;
|
||||
MSList *newlist;
|
||||
|
||||
|
||||
for(elem=default_list; elem!=NULL; elem=elem->next){
|
||||
MSList *elem2=ms_list_find(l,elem->data);
|
||||
if (!elem2){
|
||||
|
|
@ -1127,10 +1134,10 @@ static void codecs_config_read(LinphoneCore *lc)
|
|||
PayloadType *pt;
|
||||
MSList *audio_codecs=NULL;
|
||||
MSList *video_codecs=NULL;
|
||||
|
||||
|
||||
lc->codecs_conf.dyn_pt=96;
|
||||
lc->codecs_conf.telephone_event_pt=lp_config_get_int(lc->config,"misc","telephone_event_pt",101);
|
||||
|
||||
|
||||
for (i=0;get_codec(lc,SalAudio,i,&pt);i++){
|
||||
if (pt){
|
||||
audio_codecs=codec_append_if_new(audio_codecs, pt);
|
||||
|
|
@ -1427,8 +1434,8 @@ static void linphone_core_register_payload_type(LinphoneCore *lc, const PayloadT
|
|||
and the payload type number will be determined dynamically later, at call time.*/
|
||||
payload_type_set_number(pt,
|
||||
(number=rtp_profile_find_payload_number(&av_profile, pt->mime_type, pt->clock_rate, pt->channels))
|
||||
);
|
||||
ms_message("Codec %s/%i fmtp=[%s] number=%i, enabled=%i) added to default capabilities.", pt->mime_type, pt->clock_rate,
|
||||
);
|
||||
ms_message("Codec %s/%i fmtp=[%s] number=%i, enabled=%i) added to default capabilities.", pt->mime_type, pt->clock_rate,
|
||||
pt->recv_fmtp ? pt->recv_fmtp : "", number, (int)payload_type_enabled(pt));
|
||||
*codec_list=ms_list_append(*codec_list,pt);
|
||||
}
|
||||
|
|
@ -1550,7 +1557,7 @@ static void linphone_core_register_default_codecs(LinphoneCore *lc){
|
|||
linphone_core_register_payload_type(lc,&payload_type_speex_nb,"vbr=on",TRUE);
|
||||
linphone_core_register_payload_type(lc,&payload_type_pcmu8000,NULL,TRUE);
|
||||
linphone_core_register_payload_type(lc,&payload_type_pcma8000,NULL,TRUE);
|
||||
|
||||
|
||||
/*other audio codecs, not enabled by default, in order of preference*/
|
||||
linphone_core_register_payload_type(lc,&payload_type_gsm,NULL,FALSE);
|
||||
linphone_core_register_payload_type(lc,&payload_type_g722,NULL,FALSE);
|
||||
|
|
@ -1586,8 +1593,8 @@ static void linphone_core_register_default_codecs(LinphoneCore *lc){
|
|||
linphone_core_register_payload_type(lc,&payload_type_aal2_g726_24,NULL,FALSE);
|
||||
linphone_core_register_payload_type(lc,&payload_type_aal2_g726_32,NULL,FALSE);
|
||||
linphone_core_register_payload_type(lc,&payload_type_aal2_g726_40,NULL,FALSE);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
/*default enabled video codecs, in order of preference*/
|
||||
|
|
@ -1616,9 +1623,9 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
|
|||
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
|
||||
ortp_init();
|
||||
linphone_core_activate_log_serialization_if_needed();
|
||||
|
||||
|
||||
ms_init();
|
||||
|
||||
|
||||
linphone_core_register_default_codecs(lc);
|
||||
/* create a mediastreamer2 event queue and set it as global */
|
||||
/* This allows to run event's callback in linphone_core_iterate() */
|
||||
|
|
@ -3258,7 +3265,6 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
|
|||
char *tmp;
|
||||
LinphoneAddress *from_parsed;
|
||||
bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE);
|
||||
const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc);
|
||||
|
||||
from_parsed=linphone_address_new(sal_op_get_from(call->op));
|
||||
linphone_address_clean(from_parsed);
|
||||
|
|
@ -3293,12 +3299,18 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
|
|||
}
|
||||
|
||||
linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call");
|
||||
/*from now on, the application is aware of the call and supposed to take background task or already submitted notification to the user.
|
||||
We can then drop our background task.*/
|
||||
if (call->bg_task_id!=0) {
|
||||
sal_end_background_task(call->bg_task_id);
|
||||
call->bg_task_id=0;
|
||||
}
|
||||
|
||||
if (call->state==LinphoneCallIncomingReceived){
|
||||
/*try to be best-effort in giving real local or routable contact address for 100Rel case*/
|
||||
linphone_call_set_contact_op(call);
|
||||
|
||||
if (propose_early_media || ringback_tone!=NULL){
|
||||
if (propose_early_media){
|
||||
linphone_core_accept_early_media(lc,call);
|
||||
}else sal_call_notify_ringing(call->op,FALSE);
|
||||
|
||||
|
|
@ -3582,7 +3594,7 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons
|
|||
return 0;
|
||||
}
|
||||
if (params==NULL){
|
||||
call->params->has_video=lc->video_policy.automatically_accept || call->current_params->has_video;
|
||||
linphone_call_params_enable_video(call->params, lc->video_policy.automatically_accept || call->current_params->has_video);
|
||||
}else
|
||||
linphone_call_set_new_params(call,params);
|
||||
|
||||
|
|
@ -4411,15 +4423,13 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap){
|
|||
}
|
||||
}
|
||||
if (sndcard==NULL) {
|
||||
/* get a card that has read+write capabilities */
|
||||
sndcard=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get());
|
||||
/* otherwise refine to the first card having the right capability*/
|
||||
if (sndcard==NULL){
|
||||
const MSList *elem=ms_snd_card_manager_get_list(ms_snd_card_manager_get());
|
||||
for(;elem!=NULL;elem=elem->next){
|
||||
sndcard=(MSSndCard*)elem->data;
|
||||
if (ms_snd_card_get_capabilities(sndcard) & cap) break;
|
||||
}
|
||||
if ((cap & MS_SND_CARD_CAP_CAPTURE) && (cap & MS_SND_CARD_CAP_PLAYBACK)){
|
||||
sndcard=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get());
|
||||
}else if (cap & MS_SND_CARD_CAP_CAPTURE){
|
||||
sndcard=ms_snd_card_manager_get_default_capture_card(ms_snd_card_manager_get());
|
||||
}
|
||||
else if (cap & MS_SND_CARD_CAP_PLAYBACK){
|
||||
sndcard=ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
|
||||
}
|
||||
if (sndcard==NULL){/*looks like a bug! take the first one !*/
|
||||
const MSList *elem=ms_snd_card_manager_get_list(ms_snd_card_manager_get());
|
||||
|
|
@ -6090,7 +6100,7 @@ void sip_config_uninit(LinphoneCore *lc)
|
|||
if (i>=20) ms_warning("Cannot complete unregistration, giving up");
|
||||
}
|
||||
config->proxies=ms_list_free_with_data(config->proxies,(void (*)(void*)) _linphone_proxy_config_release);
|
||||
|
||||
|
||||
config->deleted_proxies=ms_list_free_with_data(config->deleted_proxies,(void (*)(void*)) _linphone_proxy_config_release);
|
||||
|
||||
/*no longuer need to write proxy config if not changedlinphone_proxy_config_write_to_config_file(lc->config,NULL,i);*/ /*mark the end */
|
||||
|
|
@ -6502,9 +6512,6 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a ring back tone to be played to far end during incoming calls.
|
||||
**/
|
||||
void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){
|
||||
if (lc->sound_conf.ringback_tone){
|
||||
ms_free(lc->sound_conf.ringback_tone);
|
||||
|
|
@ -6514,13 +6521,18 @@ void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){
|
|||
lc->sound_conf.ringback_tone=ms_strdup(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ring back tone played to far end during incoming calls.
|
||||
**/
|
||||
const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc){
|
||||
return lc->sound_conf.ringback_tone;
|
||||
}
|
||||
|
||||
void linphone_core_set_ring_during_incoming_early_media(LinphoneCore *lc, bool_t enable) {
|
||||
lp_config_set_int(lc->config, "sound", "ring_during_incoming_early_media", (int)enable);
|
||||
}
|
||||
|
||||
bool_t linphone_core_get_ring_during_incoming_early_media(const LinphoneCore *lc) {
|
||||
return (bool_t)lp_config_get_int(lc->config, "sound", "ring_during_incoming_early_media", 0);
|
||||
}
|
||||
|
||||
LinphonePayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) {
|
||||
LinphonePayloadType* result = find_payload_type_from_list(type, rate, channels, linphone_core_get_audio_codecs(lc));
|
||||
if (result) {
|
||||
|
|
@ -6902,8 +6914,8 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para
|
|||
params->in_conference=FALSE;
|
||||
params->privacy=LinphonePrivacyDefault;
|
||||
params->avpf_enabled=FALSE;
|
||||
params->audio_dir=LinphoneCallParamsMediaDirectionSendRecv;
|
||||
params->video_dir=LinphoneCallParamsMediaDirectionSendRecv;
|
||||
params->audio_dir=LinphoneMediaDirectionSendRecv;
|
||||
params->video_dir=LinphoneMediaDirectionSendRecv;
|
||||
params->real_early_media=lp_config_get_int(lc->config,"misc","real_early_media",FALSE);
|
||||
}
|
||||
|
||||
|
|
@ -7125,7 +7137,7 @@ void linphone_core_v_table_destroy(LinphoneCoreVTable* table) {
|
|||
LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCore *lc) {
|
||||
return lc->current_vtable;
|
||||
}
|
||||
|
||||
|
||||
#define NOTIFY_IF_EXIST(function_name) \
|
||||
MSList* iterator; \
|
||||
ms_message ("Linphone core [%p] notifying [%s]",lc,#function_name);\
|
||||
|
|
|
|||
|
|
@ -1148,6 +1148,21 @@ LINPHONE_PUBLIC LinphoneAVPFMode linphone_proxy_config_get_avpf_mode(const Linph
|
|||
**/
|
||||
LINPHONE_PUBLIC void linphone_proxy_config_set_avpf_mode(LinphoneProxyConfig *cfg, LinphoneAVPFMode mode);
|
||||
|
||||
/**
|
||||
* Obtain the value of a header sent by the server in last answer to REGISTER.
|
||||
* @param cfg the proxy config object
|
||||
* @param header_name the header name for which to fetch corresponding value
|
||||
* @return the value of the queried header.
|
||||
**/
|
||||
LINPHONE_PUBLIC const char *linphone_proxy_config_get_custom_header(LinphoneProxyConfig *cfg, const char *header_name);
|
||||
|
||||
/**
|
||||
* Set the value of a custom header sent to the server in REGISTERs request.
|
||||
* @param cfg the proxy config object
|
||||
* @param header_name the header name
|
||||
* @param header_value the header's value
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_proxy_config_set_custom_header(LinphoneProxyConfig *cfg, const char *header_name, const char *header_value);
|
||||
/**
|
||||
* @}
|
||||
**/
|
||||
|
|
@ -2657,9 +2672,36 @@ LINPHONE_PUBLIC const char *linphone_core_get_root_ca(LinphoneCore *lc);
|
|||
LINPHONE_PUBLIC void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
|
||||
LINPHONE_PUBLIC const char * linphone_core_get_ringback(const LinphoneCore *lc);
|
||||
|
||||
LINPHONE_PUBLIC void linphone_core_set_remote_ringback_tone(LinphoneCore *lc,const char *);
|
||||
/**
|
||||
* Specify a ring back tone to be played to far end during incoming calls.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] ring The path to the ring back tone to be played.
|
||||
* @ingroup media_parameters
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *ring);
|
||||
|
||||
/**
|
||||
* Get the ring back tone played to far end during incoming calls.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @ingroup media_parameters
|
||||
**/
|
||||
LINPHONE_PUBLIC const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc);
|
||||
|
||||
/**
|
||||
* Enable or disable the ring play during an incoming early media call.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] enable A boolean value telling whether to enable ringing during an incoming early media call.
|
||||
* @ingroup media_parameters
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_core_set_ring_during_incoming_early_media(LinphoneCore *lc, bool_t enable);
|
||||
|
||||
/**
|
||||
* Tells whether the ring play is enabled during an incoming early media call.
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @ingroup media_paramaters
|
||||
*/
|
||||
LINPHONE_PUBLIC bool_t linphone_core_get_ring_during_incoming_early_media(const LinphoneCore *lc);
|
||||
|
||||
LINPHONE_PUBLIC int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
|
||||
LINPHONE_PUBLIC int linphone_core_play_local(LinphoneCore *lc, const char *audiofile);
|
||||
LINPHONE_PUBLIC void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
|
||||
|
|
|
|||
|
|
@ -60,9 +60,6 @@ extern "C" void libmswebrtc_init();
|
|||
#include <belle-sip/wakelock.h>
|
||||
#endif /*ANDROID*/
|
||||
|
||||
/*force linking of ms_audio_diff symbol because the tester requires it.*/
|
||||
static void *audiodiff=(void*)&ms_audio_diff;
|
||||
|
||||
#define RETURN_USER_DATA_OBJECT(javaclass, funcprefix, cobj) \
|
||||
{ \
|
||||
jclass jUserDataObjectClass; \
|
||||
|
|
@ -161,6 +158,21 @@ extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setDebugMode(JNIE
|
|||
linphone_core_disable_logs();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_enableLogCollection(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jboolean enable) {
|
||||
linphone_core_enable_log_collection(enable ? LinphoneLogCollectionEnabledWithoutPreviousLogHandler : LinphoneLogCollectionDisabled);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreFactoryImpl_setLogCollectionPath(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jstring jpath) {
|
||||
|
||||
const char* path = env->GetStringUTFChars(jpath, NULL);
|
||||
linphone_core_set_log_collection_path(path);
|
||||
env->ReleaseStringUTFChars(jpath, path);
|
||||
}
|
||||
// LinphoneCore
|
||||
|
||||
/*
|
||||
|
|
@ -620,6 +632,10 @@ public:
|
|||
,lcData->core
|
||||
,env->CallStaticObjectMethod(lcData->globalStateClass,lcData->globalStateFromIntId,(jint)gstate),
|
||||
msg);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
if (msg) {
|
||||
env->DeleteLocalRef(msg);
|
||||
}
|
||||
|
|
@ -641,6 +657,10 @@ public:
|
|||
,(jproxy=getProxy(env,proxy,lcData->core))
|
||||
,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,(jint)state),
|
||||
msg);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
if (msg) {
|
||||
env->DeleteLocalRef(msg);
|
||||
}
|
||||
|
|
@ -663,6 +683,10 @@ public:
|
|||
,(jcall=getCall(env,call))
|
||||
,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)state),
|
||||
msg);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
if (state==LinphoneCallReleased) {
|
||||
linphone_call_set_user_pointer(call,NULL);
|
||||
env->DeleteGlobalRef(jcall);
|
||||
|
|
@ -686,6 +710,10 @@ public:
|
|||
,getCall(env,call)
|
||||
,encrypted
|
||||
,authentication_token ? env->NewStringUTF(authentication_token) : NULL);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void notify_presence_received(LinphoneCore *lc, LinphoneFriend *my_friend) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -700,6 +728,10 @@ public:
|
|||
,lcData->notifyPresenceReceivedId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend));
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *my_friend, const char* url) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -715,6 +747,10 @@ public:
|
|||
,lcData->core
|
||||
,env->NewObject(lcData->friendClass,lcData->friendCtrId,(jlong)my_friend)
|
||||
,url ? env->NewStringUTF(url) : NULL);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -730,6 +766,10 @@ public:
|
|||
,lcData->core
|
||||
,getCall(env,call)
|
||||
,dtmf);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -746,6 +786,10 @@ public:
|
|||
,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room)
|
||||
,env->NewObject(lcData->addressClass,lcData->addressCtrId,(jlong)from)
|
||||
,message ? env->NewStringUTF(message) : NULL);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -763,6 +807,10 @@ public:
|
|||
,lcData->core
|
||||
,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room)
|
||||
,(jmsg = getChatMessage(env, msg)));
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -777,6 +825,10 @@ public:
|
|||
,lcData->isComposingReceivedId
|
||||
,lcData->core
|
||||
,env->NewObject(lcData->chatRoomClass,lcData->chatRoomCtrId,(jlong)room));
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void ecCalibrationStatus(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms, void *data) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -822,6 +874,10 @@ public:
|
|||
else
|
||||
env->CallVoidMethod(callobj, lcData->callSetVideoStatsId, statsobj);
|
||||
env->CallVoidMethod(lcData->listener, lcData->callStatsUpdatedId, lcData->core, callobj, statsobj);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void transferStateChanged(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState remote_call_state){
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -839,6 +895,10 @@ public:
|
|||
,(jcall=getCall(env,call))
|
||||
,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)remote_call_state)
|
||||
);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void infoReceived(LinphoneCore *lc, LinphoneCall*call, const LinphoneInfoMessage *info){
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -856,6 +916,10 @@ public:
|
|||
,getCall(env,call)
|
||||
,env->NewObject(lcData->infoMessageClass,lcData->infoMessageCtor,(jlong)copy_info)
|
||||
);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void subscriptionStateChanged(LinphoneCore *lc, LinphoneEvent *ev, LinphoneSubscriptionState state){
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -876,6 +940,10 @@ public:
|
|||
,jevent
|
||||
,jstate
|
||||
);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
if (state==LinphoneSubscriptionTerminated){
|
||||
/*loose the java reference */
|
||||
linphone_event_set_user_data(ev,NULL);
|
||||
|
|
@ -901,6 +969,10 @@ public:
|
|||
,jevent
|
||||
,jstate
|
||||
);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void notifyReceived(LinphoneCore *lc, LinphoneEvent *ev, const char *evname, const LinphoneContent *content){
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -920,6 +992,10 @@ public:
|
|||
,env->NewStringUTF(evname)
|
||||
,content ? create_java_linphone_content(env,content) : NULL
|
||||
);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
|
||||
static void configuringStatus(LinphoneCore *lc, LinphoneConfiguringState status, const char *message) {
|
||||
|
|
@ -1009,6 +1085,10 @@ public:
|
|||
,lcData->core
|
||||
,(jlong)offset
|
||||
,(jlong)total);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
}
|
||||
static void logCollectionUploadStateChange(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info) {
|
||||
JNIEnv *env = 0;
|
||||
|
|
@ -1025,6 +1105,10 @@ public:
|
|||
,lcData->core
|
||||
,env->CallStaticObjectMethod(lcData->logCollectionUploadStateClass,lcData->logCollectionUploadStateFromIntId,(jint)state),
|
||||
msg);
|
||||
if (env->ExceptionCheck()) {
|
||||
ms_error("Listener %p raised an exception",lcData->listener);
|
||||
env->ExceptionClear();
|
||||
}
|
||||
if (msg) {
|
||||
env->DeleteLocalRef(msg);
|
||||
}
|
||||
|
|
@ -1111,22 +1195,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeListener(JNIEnv* e
|
|||
//env->DeleteGlobalRef(listener);
|
||||
}
|
||||
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_uploadLogCollection(JNIEnv* env, jobject thiz, jlong lc) {
|
||||
LinphoneCore *core = (LinphoneCore*)lc;
|
||||
linphone_core_upload_log_collection(core);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableLogCollection(JNIEnv* env, jclass cls, jboolean enable) {
|
||||
linphone_core_enable_log_collection(enable ? LinphoneLogCollectionEnabledWithoutPreviousLogHandler : LinphoneLogCollectionDisabled);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setLogCollectionPath(JNIEnv* env, jclass cls, jstring jpath) {
|
||||
const char* path = env->GetStringUTFChars(jpath, NULL);
|
||||
linphone_core_set_log_collection_path(path);
|
||||
env->ReleaseStringUTFChars(jpath, path);
|
||||
}
|
||||
|
||||
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_migrateToMultiTransport(JNIEnv* env
|
||||
,jobject thiz
|
||||
,jlong lc) {
|
||||
|
|
@ -1156,6 +1229,18 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setChatDatabasePath(JNIE
|
|||
env->ReleaseStringUTFChars(jpath, path);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact2(JNIEnv* env, jobject thiz, jlong lc, jstring jcontact) {
|
||||
const char* contact = env->GetStringUTFChars(jcontact, NULL);
|
||||
linphone_core_set_primary_contact((LinphoneCore*)lc, contact);
|
||||
env->ReleaseStringUTFChars(jcontact, contact);
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getPrimaryContact(JNIEnv* env, jobject thiz, jlong lc) {
|
||||
LinphoneAddress* identity = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc);
|
||||
return identity ? env->NewStringUTF(linphone_address_as_string(identity)) : NULL;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject thiz, jlong lc, jstring jdisplayname, jstring jusername) {
|
||||
const char* displayname = jdisplayname ? env->GetStringUTFChars(jdisplayname, NULL) : NULL;
|
||||
const char* username = jusername ? env->GetStringUTFChars(jusername, NULL) : NULL;
|
||||
|
|
@ -5631,9 +5716,9 @@ extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoMulticas
|
|||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
extern "C" jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getAudioMulticastAddr
|
||||
(JNIEnv *, jobject, jlong) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_getAudioMulticastAddr not implemented yet");
|
||||
return NULL;
|
||||
(JNIEnv *env , jobject, jlong ptr) {
|
||||
const char *tmp=linphone_core_get_audio_multicast_addr((LinphoneCore*)ptr);
|
||||
return tmp ? env->NewStringUTF(tmp) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5642,9 +5727,9 @@ extern "C" jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getAudioMulti
|
|||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
extern "C" jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getVideoMulticastAddr
|
||||
(JNIEnv *, jobject, jlong) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_getVideoMulticastAddr not implemented yet");
|
||||
return NULL;
|
||||
(JNIEnv * env, jobject, jlong ptr) {
|
||||
const char *tmp=linphone_core_get_video_multicast_addr((LinphoneCore*)ptr);
|
||||
return tmp ? env->NewStringUTF(tmp) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5653,9 +5738,8 @@ extern "C" jstring JNICALL Java_org_linphone_core_LinphoneCoreImpl_getVideoMulti
|
|||
* Signature: (JI)I
|
||||
*/
|
||||
extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioMulticastTtl
|
||||
(JNIEnv *, jobject, jlong, jint) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_setAudioMulticastTtl not implemented yet");
|
||||
return -1;
|
||||
(JNIEnv *, jobject, jlong ptr, jint value) {
|
||||
return linphone_core_set_audio_multicast_ttl((LinphoneCore*)ptr,value);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5664,9 +5748,8 @@ extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setAudioMulticas
|
|||
* Signature: (JI)I
|
||||
*/
|
||||
extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoMulticastTtl
|
||||
(JNIEnv *, jobject, jlong, jint) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_setVideoMulticastTtl not implemented yet");
|
||||
return -1;
|
||||
(JNIEnv *, jobject, jlong ptr, jint value) {
|
||||
return linphone_core_set_video_multicast_ttl((LinphoneCore*)ptr,value);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5675,9 +5758,8 @@ extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_setVideoMulticas
|
|||
* Signature: (J)I
|
||||
*/
|
||||
extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getAudioMulticastTtl
|
||||
(JNIEnv *, jobject, jlong) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_getAudioMulticastTtl not implemented yet");
|
||||
return -1;
|
||||
(JNIEnv *, jobject, jlong ptr) {
|
||||
return linphone_core_get_audio_multicast_ttl((LinphoneCore*)ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5686,9 +5768,8 @@ extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getAudioMulticas
|
|||
* Signature: (J)I
|
||||
*/
|
||||
extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getVideoMulticastTtl
|
||||
(JNIEnv *, jobject, jlong) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_getVideoMulticastTtl not implemented yet");
|
||||
return -1;
|
||||
(JNIEnv *, jobject, jlong ptr) {
|
||||
return linphone_core_get_video_multicast_ttl((LinphoneCore*)ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5697,8 +5778,8 @@ extern "C" jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getVideoMulticas
|
|||
* Signature: (JZ)V
|
||||
*/
|
||||
extern "C" void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableAudioMulticast
|
||||
(JNIEnv *, jobject, jlong, jboolean) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_enableAudioMulticast not implemented yet");
|
||||
(JNIEnv *, jobject, jlong ptr, jboolean yesno) {
|
||||
return linphone_core_enable_audio_multicast((LinphoneCore*)ptr,yesno);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5707,9 +5788,8 @@ extern "C" void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableAudioMulti
|
|||
* Signature: (J)Z
|
||||
*/
|
||||
extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_audioMulticastEnabled
|
||||
(JNIEnv *, jobject, jlong) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_audioMulticastEnabled not implemented yet");
|
||||
return false;
|
||||
(JNIEnv *, jobject, jlong ptr) {
|
||||
return linphone_core_audio_multicast_enabled((LinphoneCore*)ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5718,8 +5798,8 @@ extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_audioMultica
|
|||
* Signature: (JZ)V
|
||||
*/
|
||||
extern "C" void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableVideoMulticast
|
||||
(JNIEnv *, jobject, jlong, jboolean) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_enableVideoMulticast not implemented yet");
|
||||
(JNIEnv *, jobject, jlong ptr, jboolean yesno) {
|
||||
return linphone_core_enable_video_multicast((LinphoneCore*)ptr,yesno);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5728,9 +5808,8 @@ extern "C" void JNICALL Java_org_linphone_core_LinphoneCoreImpl_enableVideoMulti
|
|||
* Signature: (J)Z
|
||||
*/
|
||||
extern "C" jboolean JNICALL Java_org_linphone_core_LinphoneCoreImpl_videoMulticastEnabled
|
||||
(JNIEnv *, jobject, jlong) {
|
||||
ms_error("Java_org_linphone_core_LinphoneCoreImpl_videoMulticastEnabled not implemented yet");
|
||||
return false;
|
||||
(JNIEnv *, jobject, jlong ptr) {
|
||||
return linphone_core_video_multicast_enabled((LinphoneCore*)ptr);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ struct _LinphoneCallParams{
|
|||
bool_t no_user_consent;/*when set to TRUE an UPDATE request will be used instead of reINVITE*/
|
||||
uint16_t avpf_rr_interval; /*in milliseconds*/
|
||||
LinphonePrivacyMask privacy;
|
||||
LinphoneCallParamsMediaDirection audio_dir;
|
||||
LinphoneCallParamsMediaDirection video_dir;
|
||||
LinphoneMediaDirection audio_dir;
|
||||
LinphoneMediaDirection video_dir;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -257,6 +257,7 @@ struct _LinphoneCall{
|
|||
LinphoneCall *transfer_target;/*if this call received a transfer request, then transfer_target points to the new call created to the refer target */
|
||||
int localdesc_changed;/*not a boolean, contains a mask representing changes*/
|
||||
LinphonePlayer *player;
|
||||
unsigned long bg_task_id; /*used to prevent device to suspend app while a call is received in background*/
|
||||
|
||||
char *dtmf_sequence; /*DTMF sequence needed to be sent using #dtmfs_timer*/
|
||||
belle_sip_source_t *dtmfs_timer; /*DTMF timer needed to send a DTMF sequence*/
|
||||
|
|
@ -298,6 +299,8 @@ LinphonePlayer *linphone_call_build_player(LinphoneCall*call);
|
|||
|
||||
LinphoneCallParams * linphone_call_params_new(void);
|
||||
SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params);
|
||||
SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params);
|
||||
SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params);
|
||||
|
||||
void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);
|
||||
|
||||
|
|
@ -476,6 +479,7 @@ struct _LinphoneProxyConfig
|
|||
int expires;
|
||||
int publish_expires;
|
||||
SalOp *op;
|
||||
SalCustomHeader *sent_headers;
|
||||
char *type;
|
||||
struct _SipSetupContext *ssctx;
|
||||
int auth_failures;
|
||||
|
|
@ -1101,6 +1105,9 @@ void linphone_core_notify_log_collection_upload_progress_indication(LinphoneCore
|
|||
void set_mic_gain_db(AudioStream *st, float gain);
|
||||
void set_playback_gain_db(AudioStream *st, float gain);
|
||||
|
||||
LinphoneMediaDirection media_direction_from_sal_stream_dir(SalStreamDir dir);
|
||||
SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir);
|
||||
|
||||
#ifdef ANDROID
|
||||
void linphone_core_wifi_lock_acquire(LinphoneCore *lc);
|
||||
void linphone_core_wifi_lock_release(LinphoneCore *lc);
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ void _linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
|
|||
if (obj->contact_uri_params) ms_free(obj->contact_uri_params);
|
||||
if (obj->saved_proxy!=NULL) linphone_address_destroy(obj->saved_proxy);
|
||||
if (obj->saved_identity!=NULL) linphone_address_destroy(obj->saved_identity);
|
||||
if (obj->sent_headers!=NULL) sal_custom_header_free(obj->sent_headers);
|
||||
_linphone_proxy_config_release_ops(obj);
|
||||
}
|
||||
|
||||
|
|
@ -467,7 +468,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
|
|||
sal_op_release(obj->op);
|
||||
obj->op=sal_op_new(obj->lc->sal);
|
||||
|
||||
linphone_configure_op(obj->lc, obj->op, to, NULL, FALSE);
|
||||
linphone_configure_op(obj->lc, obj->op, to, obj->sent_headers, FALSE);
|
||||
linphone_address_destroy(to);
|
||||
|
||||
if ((contact=guess_contact_for_register(obj))) {
|
||||
|
|
@ -1147,6 +1148,17 @@ struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig
|
|||
return obj->lc;
|
||||
}
|
||||
|
||||
const char *linphone_proxy_config_get_custom_header(LinphoneProxyConfig *cfg, const char *header_name){
|
||||
const SalCustomHeader *ch;
|
||||
if (!cfg->op) return NULL;
|
||||
ch = sal_op_get_recv_custom_header(cfg->op);
|
||||
return sal_custom_header_find(ch, header_name);
|
||||
}
|
||||
|
||||
void linphone_proxy_config_set_custom_header(LinphoneProxyConfig *cfg, const char *header_name, const char *header_value){
|
||||
cfg->sent_headers=sal_custom_header_append(cfg->sent_headers, header_name, header_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a proxy configuration.
|
||||
* This will start registration on the proxy, if registration is enabled.
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ static FILE *linphone_gtk_log_init()
|
|||
|
||||
static void linphone_gtk_log_file(OrtpLogLevel lev, const char *msg)
|
||||
{
|
||||
time_t now;
|
||||
FILE *outlog;
|
||||
|
||||
outlog = linphone_gtk_log_init();
|
||||
|
|
@ -176,12 +175,11 @@ static void linphone_gtk_log_file(OrtpLogLevel lev, const char *msg)
|
|||
logfile_date_format in the GtkUi section of the config file,
|
||||
but it defaults to something compact, but yet readable. */
|
||||
const char *lname="undef";
|
||||
char date[256];
|
||||
|
||||
/* Convert level constant to text */
|
||||
switch(lev){
|
||||
case ORTP_DEBUG:
|
||||
lname="debug";
|
||||
lname="debug ";
|
||||
break;
|
||||
case ORTP_MESSAGE:
|
||||
lname="message";
|
||||
|
|
@ -190,23 +188,16 @@ static void linphone_gtk_log_file(OrtpLogLevel lev, const char *msg)
|
|||
lname="warning";
|
||||
break;
|
||||
case ORTP_ERROR:
|
||||
lname="error";
|
||||
lname="error ";
|
||||
break;
|
||||
case ORTP_FATAL:
|
||||
lname="fatal";
|
||||
lname="fatal ";
|
||||
break;
|
||||
default:
|
||||
lname="undef";
|
||||
lname="undef ";
|
||||
break;
|
||||
}
|
||||
/* Get current time and format it properly */
|
||||
now = time(NULL);
|
||||
strftime(date, sizeof(date), dateformat, localtime(&now));
|
||||
/* Now print out the message to the logfile. We don't flush,
|
||||
maybe we should do to ensure that we have all the messages in
|
||||
case of a crash (which is one of the main reasons we have a
|
||||
log facility in the first place). */
|
||||
fprintf(outlog, "[%s] [%s] %s\n", date, lname, msg);
|
||||
fprintf(outlog, "[%s] %s\n", lname, msg);
|
||||
fflush(outlog);
|
||||
}
|
||||
}
|
||||
|
|
@ -335,13 +326,24 @@ gboolean linphone_gtk_check_logs(){
|
|||
* Called from any linphone thread.
|
||||
*/
|
||||
void linphone_gtk_log_push(OrtpLogLevel lev, const char *fmt, va_list args){
|
||||
gchar *msg=g_strdup_vprintf(fmt,args);
|
||||
LinphoneGtkLog *lgl=g_new(LinphoneGtkLog,1);
|
||||
gchar *msg=g_strdup_vprintf(fmt,args);
|
||||
gchar *dated_msg;
|
||||
struct timeval tp;
|
||||
struct tm *lt;
|
||||
time_t tt;
|
||||
|
||||
ortp_gettimeofday(&tp, NULL);
|
||||
tt = (time_t)tp.tv_sec;
|
||||
lt = localtime((const time_t*)&tt);
|
||||
dated_msg=g_strdup_printf("%i-%.2i-%.2i %.2i:%.2i:%.2i:%.3i %s",
|
||||
1900 + lt->tm_year, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, (int)(tp.tv_usec / 1000), msg);
|
||||
g_free(msg);
|
||||
lgl->lev=lev;
|
||||
lgl->msg=msg;
|
||||
lgl->msg=dated_msg;
|
||||
linphone_gtk_log_file(lev, dated_msg);
|
||||
g_static_mutex_lock(&log_mutex);
|
||||
log_queue=g_list_append(log_queue,lgl);
|
||||
linphone_gtk_log_file(lev, msg);
|
||||
g_static_mutex_unlock(&log_mutex);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -811,4 +811,10 @@ int sal_lines_get_value(const char *data, const char *key, char *value, size_t v
|
|||
|
||||
belle_sip_stack_t *sal_get_belle_sip_stack(Sal *sal);
|
||||
char* sal_op_get_public_uri(SalOp *sal);
|
||||
|
||||
unsigned long sal_begin_background_task(const char *name, void (*max_time_reached)(void *), void *data);
|
||||
void sal_end_background_task(unsigned long id);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1576,6 +1576,16 @@ public interface LinphoneCore {
|
|||
**/
|
||||
void setMicrophoneGain(float gain);
|
||||
|
||||
/**
|
||||
* Set address to use if no LinphoneProxyConfig configured
|
||||
*/
|
||||
void setPrimaryContact(String address);
|
||||
|
||||
/**
|
||||
* Returns the address used if no LinphoneProxyConfig configured
|
||||
*/
|
||||
String getPrimaryContact();
|
||||
|
||||
/**
|
||||
* Set username and display name to use if no LinphoneProxyConfig configured
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -109,7 +109,18 @@ abstract public class LinphoneCoreFactory {
|
|||
* @param enable true to enable debug mode, false to disable it
|
||||
* @param tag Tag which prefixes each log message.
|
||||
*/
|
||||
abstract public void setDebugMode(boolean enable, String tag);
|
||||
abstract public void setDebugMode(boolean enable, String tag);
|
||||
|
||||
/**
|
||||
* Enable the linphone core log collection to upload logs on a server.
|
||||
*/
|
||||
abstract public void enableLogCollection(boolean enable);
|
||||
|
||||
/**
|
||||
* Set the path where the log files will be written for log collection.
|
||||
* @param path The path where the log files will be written.
|
||||
*/
|
||||
abstract public void setLogCollectionPath(String path);
|
||||
|
||||
abstract public void setLogHandler(LinphoneLogHandler handler);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,13 @@ public final class VideoSize {
|
|||
public static final int CIF = 1;
|
||||
public static final int HVGA = 2;
|
||||
public static final int QVGA = 3;
|
||||
public static final VideoSize VIDEO_SIZE_QCIF = new VideoSize(176,144);
|
||||
public static final VideoSize VIDEO_SIZE_CIF = new VideoSize(352,288);
|
||||
public static final VideoSize VIDEO_SIZE_QVGA = new VideoSize(320,240);
|
||||
public static final VideoSize VIDEO_SIZE_HVGA = new VideoSize(320,480);
|
||||
public static final VideoSize VIDEO_SIZE_VGA = new VideoSize(640,480);
|
||||
public static final VideoSize VIDEO_SIZE_720P = new VideoSize(1280,720);
|
||||
public static final VideoSize VIDEO_SIZE_1020P = new VideoSize(1920,1080);
|
||||
|
||||
public int width;
|
||||
public int height;
|
||||
|
|
@ -36,6 +43,7 @@ public final class VideoSize {
|
|||
this.height = height;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final VideoSize createStandard(int code, boolean inverted) {
|
||||
switch (code) {
|
||||
case QCIF:
|
||||
|
|
|
|||
|
|
@ -127,6 +127,12 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
|||
public LinphoneFriend createLinphoneFriend() {
|
||||
return createLinphoneFriend(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public native void enableLogCollection(boolean enable);
|
||||
|
||||
@Override
|
||||
public native void setLogCollectionPath(String path);
|
||||
|
||||
public static boolean isArmv7()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import android.net.wifi.WifiManager;
|
|||
import android.net.wifi.WifiManager.MulticastLock;
|
||||
import android.net.wifi.WifiManager.WifiLock;
|
||||
|
||||
public class LinphoneCoreImpl implements LinphoneCore {
|
||||
class LinphoneCoreImpl implements LinphoneCore {
|
||||
|
||||
private final LinphoneCoreListener mListener; //to make sure to keep a reference on this object
|
||||
protected long nativePtr = 0;
|
||||
|
|
@ -150,6 +150,8 @@ public class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native void setVideoPortRange(long nativePtr, int minPort, int maxPort);
|
||||
private native void setIncomingTimeout(long nativePtr, int timeout);
|
||||
private native void setInCallTimeout(long nativePtr, int timeout);
|
||||
private native void setPrimaryContact2(long nativePtr, String contact);
|
||||
private native String getPrimaryContact(long nativePtr);
|
||||
private native void setPrimaryContact(long nativePtr, String displayName, String username);
|
||||
private native String getPrimaryContactUsername(long nativePtr);
|
||||
private native String getPrimaryContactDisplayName(long nativePtr);
|
||||
|
|
@ -977,6 +979,14 @@ public class LinphoneCoreImpl implements LinphoneCore {
|
|||
setMicrophoneGain(nativePtr, gain);
|
||||
}
|
||||
|
||||
public synchronized void setPrimaryContact(String address) {
|
||||
setPrimaryContact2(nativePtr, address);
|
||||
}
|
||||
|
||||
public synchronized String getPrimaryContact() {
|
||||
return getPrimaryContact(nativePtr);
|
||||
}
|
||||
|
||||
public synchronized void setPrimaryContact(String displayName, String username) {
|
||||
setPrimaryContact(nativePtr, displayName, username);
|
||||
}
|
||||
|
|
@ -1343,17 +1353,6 @@ public class LinphoneCoreImpl implements LinphoneCore {
|
|||
uploadLogCollection(nativePtr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the linphone core log collection to upload logs on a server.
|
||||
*/
|
||||
public native static void enableLogCollection(boolean enable);
|
||||
|
||||
/**
|
||||
* Set the path where the log files will be written for log collection.
|
||||
* @param path The path where the log files will be written.
|
||||
*/
|
||||
public native static void setLogCollectionPath(String path);
|
||||
|
||||
private native void setPreferredFramerate(long nativePtr, float fps);
|
||||
@Override
|
||||
public void setPreferredFramerate(float fps) {
|
||||
|
|
@ -1381,12 +1380,12 @@ public class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native String getAudioMulticastAddr(long ptr);
|
||||
@Override
|
||||
public String getAudioMulticastAddr() {
|
||||
return getAudioMulticastAddr() ;
|
||||
return getAudioMulticastAddr(nativePtr) ;
|
||||
}
|
||||
private native String getVideoMulticastAddr(long ptr);
|
||||
@Override
|
||||
public String getVideoMulticastAddr() {
|
||||
return getVideoMulticastAddr();
|
||||
return getVideoMulticastAddr(nativePtr);
|
||||
}
|
||||
private native int setAudioMulticastTtl(long ptr,int ttl);
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 034131e3b566438df8445ca7f97c19f3c3774f28
|
||||
Subproject commit 3948581385b9521c17a54c05c05d613add95e631
|
||||
2
oRTP
2
oRTP
|
|
@ -1 +1 @@
|
|||
Subproject commit 327cec466a5d39e716664325ae6d604e228b3fed
|
||||
Subproject commit 7822737d9cce52a956594d9466cb6419595ed7a8
|
||||
|
|
@ -31,6 +31,7 @@ set(SOURCE_FILES
|
|||
liblinphone_tester.c
|
||||
log_collection_tester.c
|
||||
message_tester.c
|
||||
multicast_call_tester.c
|
||||
offeranswer_tester.c
|
||||
player_tester.c
|
||||
presence_tester.c
|
||||
|
|
|
|||
|
|
@ -194,7 +194,9 @@ LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyC
|
|||
create_account=TRUE;
|
||||
m->accounts=ms_list_append(m->accounts,account);
|
||||
}
|
||||
tmp=linphone_address_as_string(account->modified_identity);
|
||||
/*modify the username of the identity of the proxy config*/
|
||||
linphone_address_set_username(id_addr, linphone_address_get_username(account->modified_identity));
|
||||
tmp=linphone_address_as_string(id_addr);
|
||||
linphone_proxy_config_set_identity(cfg,tmp);
|
||||
ms_free(tmp);
|
||||
|
||||
|
|
|
|||
|
|
@ -1110,7 +1110,7 @@ static void call_with_custom_headers(void) {
|
|||
pauline_remote_contact_header = ms_strdup(linphone_call_params_get_custom_header(linphone_call_get_remote_params(call_pauline), "Contact"));
|
||||
|
||||
marie_remote_contact = ms_strdup(linphone_call_get_remote_contact(call_marie));
|
||||
marie_remote_contact_header = ms_strdup(linphone_call_params_get_custom_header(marie_remote_params, "Contact"));
|
||||
marie_remote_contact_header = ms_strdup(linphone_call_params_get_custom_header(linphone_call_get_remote_params(call_marie), "Contact"));
|
||||
|
||||
CU_ASSERT_PTR_NOT_NULL(pauline_remote_contact);
|
||||
CU_ASSERT_PTR_NOT_NULL(pauline_remote_contact_header);
|
||||
|
|
@ -2096,8 +2096,6 @@ static void call_with_file_player(void) {
|
|||
LinphonePlayer *player;
|
||||
char hellopath[256];
|
||||
char *recordpath = create_filepath(liblinphone_tester_writable_dir_prefix, "record", "wav");
|
||||
double similar;
|
||||
const double threshold = 0.9;
|
||||
|
||||
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
|
||||
unlink(recordpath);
|
||||
|
|
@ -2129,16 +2127,22 @@ static void call_with_file_player(void) {
|
|||
linphone_core_terminate_all_calls(marie->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));
|
||||
#ifndef __arm__
|
||||
CU_ASSERT_TRUE(ms_audio_diff(hellopath,recordpath,&similar,NULL,NULL)==0);
|
||||
CU_ASSERT_TRUE(similar>threshold);
|
||||
CU_ASSERT_TRUE(similar<=1.0);
|
||||
if(similar > threshold && similar <=1.0) {
|
||||
remove(recordpath);
|
||||
/*cannot run on iphone simulator because locks main loop beyond permitted time (should run
|
||||
on another thread) */
|
||||
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
|
||||
{
|
||||
double similar;
|
||||
const double threshold = 0.9;
|
||||
CU_ASSERT_TRUE(ms_audio_diff(hellopath,recordpath,&similar,NULL,NULL)==0);
|
||||
CU_ASSERT_TRUE(similar>threshold);
|
||||
CU_ASSERT_TRUE(similar<=1.0);
|
||||
if(similar > threshold && similar <=1.0) {
|
||||
remove(recordpath);
|
||||
}
|
||||
}
|
||||
#else
|
||||
remove(recordpath);
|
||||
#endif
|
||||
#endif
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
ms_free(recordpath);
|
||||
|
|
@ -2201,7 +2205,7 @@ static void call_with_mkv_file_player(void) {
|
|||
linphone_core_terminate_all_calls(marie->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));
|
||||
#ifndef __arm__
|
||||
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
|
||||
CU_ASSERT_TRUE(ms_audio_diff(hellowav,recordpath,&similar,NULL,NULL)==0);
|
||||
CU_ASSERT_TRUE(similar>threshold);
|
||||
CU_ASSERT_TRUE(similar<=1.0);
|
||||
|
|
@ -3447,9 +3451,9 @@ static void call_with_paused_no_sdp_on_resume() {
|
|||
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
|
||||
|
||||
ms_message("== Call paused, marie call: %p ==", call_marie);
|
||||
|
||||
|
||||
linphone_core_enable_sdp_200_ack(marie->lc,TRUE);
|
||||
|
||||
|
||||
linphone_core_resume_call(marie->lc,call_marie);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
|
||||
|
|
@ -3478,13 +3482,13 @@ static void call_with_generic_cn(void) {
|
|||
LinphoneCall *pauline_call;
|
||||
char *audio_file_with_silence=ms_strdup_printf("%s/%s",liblinphone_tester_file_prefix,"sounds/ahbahouaismaisbon.wav");
|
||||
char *recorded_file=ms_strdup_printf("%s/%s",liblinphone_tester_writable_dir_prefix,"result.wav");
|
||||
|
||||
|
||||
belle_sip_object_enable_leak_detector(TRUE);
|
||||
begin=belle_sip_object_get_object_count();
|
||||
|
||||
marie = linphone_core_manager_new( "marie_rc");
|
||||
pauline = linphone_core_manager_new( "pauline_rc");
|
||||
|
||||
|
||||
remove(recorded_file);
|
||||
|
||||
linphone_core_use_files(marie->lc,TRUE);
|
||||
|
|
@ -3501,11 +3505,12 @@ static void call_with_generic_cn(void) {
|
|||
const rtp_stats_t *rtps;
|
||||
struct stat stbuf;
|
||||
int err;
|
||||
|
||||
|
||||
wait_for_until(marie->lc, pauline->lc, NULL, 0, 8000);
|
||||
rtps=rtp_session_get_stats(pauline_call->audiostream->ms.sessions.rtp_session);
|
||||
CU_ASSERT_TRUE(rtps->packet_recv<=300 && rtps->packet_recv>=200);
|
||||
CU_ASSERT_EQUAL((err=stat(recorded_file,&stbuf)), 0);
|
||||
err=stat(recorded_file,&stbuf);
|
||||
CU_ASSERT_EQUAL(err, 0);
|
||||
if (err==0){
|
||||
CU_ASSERT_TRUE(stbuf.st_size>120000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -680,6 +680,22 @@ static void call_with_ipv6(void) {
|
|||
CU_ASSERT_TRUE(call(marie,pauline));
|
||||
pauline_call=linphone_core_get_current_call(pauline->lc);
|
||||
CU_ASSERT_PTR_NOT_NULL(pauline_call);
|
||||
if (pauline_call){
|
||||
/*check that the remote contact is IPv6*/
|
||||
const char *contact=linphone_call_get_remote_contact(pauline_call);
|
||||
LinphoneAddress *ct_addr;
|
||||
|
||||
CU_ASSERT_PTR_NOT_NULL(contact);
|
||||
if (contact){
|
||||
ct_addr=linphone_address_new(contact);
|
||||
CU_ASSERT_PTR_NOT_NULL(ct_addr);
|
||||
if (ct_addr){
|
||||
CU_ASSERT_TRUE(strchr(linphone_address_get_domain(ct_addr),':')!=NULL);
|
||||
}
|
||||
linphone_address_destroy(ct_addr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
liblinphone_tester_check_rtcp(marie,pauline);
|
||||
end_call(marie,pauline);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ static JNIEnv *current_env = NULL;
|
|||
static jobject current_obj = 0;
|
||||
static const char* LogDomain = "liblinphone_tester";
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
||||
void linphone_android_log_handler(int prio, const char *fmt, va_list args) {
|
||||
char str[4096];
|
||||
char *current;
|
||||
|
|
@ -172,8 +174,11 @@ int main (int argc, char *argv[])
|
|||
FILE* log_file=NULL;
|
||||
|
||||
#ifdef HAVE_GTK
|
||||
gdk_threads_init();
|
||||
gtk_init(&argc, &argv);
|
||||
#if !GLIB_CHECK_VERSION(2,32,0) // backward compatibility with Debian 6 and CentOS 6
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
gdk_threads_init();
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID)
|
||||
|
|
|
|||
|
|
@ -239,6 +239,8 @@ typedef struct _stats {
|
|||
int number_of_rtcp_sent;
|
||||
int number_of_rtcp_received;
|
||||
|
||||
int number_of_video_windows_created;
|
||||
|
||||
}stats;
|
||||
|
||||
typedef struct _LinphoneCoreManager {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha
|
|||
}
|
||||
if(res == -1) goto fail;
|
||||
|
||||
CU_ASSERT_EQUAL((res = linphone_player_start(player)), 0);
|
||||
res = linphone_player_start(player);
|
||||
CU_ASSERT_EQUAL(res, 0);
|
||||
if(res == -1) goto fail;
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, 13000));
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ static void presence_information(void) {
|
|||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
#define USE_PRESENCE_SERVER 1
|
||||
#define USE_PRESENCE_SERVER 0
|
||||
|
||||
#if USE_PRESENCE_SERVER
|
||||
static void test_subscribe_notify_publish(void) {
|
||||
|
|
|
|||
|
|
@ -190,6 +190,25 @@ static void simple_register(){
|
|||
linphone_core_manager_destroy(lcm);
|
||||
}
|
||||
|
||||
static void register_with_custom_headers(void){
|
||||
LinphoneCoreManager *marie=linphone_core_manager_new("marie_rc");
|
||||
LinphoneProxyConfig *cfg=linphone_core_get_default_proxy_config(marie->lc);
|
||||
int initial_register_ok=marie->stat.number_of_LinphoneRegistrationOk;
|
||||
const char *value;
|
||||
|
||||
linphone_core_set_network_reachable(marie->lc, FALSE);
|
||||
linphone_proxy_config_set_custom_header(cfg, "ah-bah-ouais", "...mais bon.");
|
||||
/*unfortunately it is difficult to programmatically check that sent custom headers are actually sent.
|
||||
* A server development would be required here.*/
|
||||
|
||||
linphone_core_set_network_reachable(marie->lc, TRUE);
|
||||
wait_for(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk,initial_register_ok+1);
|
||||
value=linphone_proxy_config_get_custom_header(cfg, "Server");
|
||||
CU_ASSERT_PTR_NOT_NULL(value);
|
||||
if (value) CU_ASSERT_TRUE(strstr(value, "Flexisip")!=NULL);
|
||||
linphone_core_manager_destroy(marie);
|
||||
}
|
||||
|
||||
static void simple_unregister(){
|
||||
LinphoneCoreManager* lcm = create_lcm();
|
||||
stats* counters = &lcm->stat;
|
||||
|
|
@ -814,6 +833,7 @@ test_t register_tests[] = {
|
|||
{ "Simple register", simple_register },
|
||||
{ "Simple register unregister", simple_unregister },
|
||||
{ "TCP register", simple_tcp_register },
|
||||
{ "Register with custom headers", register_with_custom_headers },
|
||||
{ "TCP register compatibility mode", simple_tcp_register_compatibility_mode },
|
||||
{ "TLS register", simple_tls_register },
|
||||
{ "TLS register with alt. name certificate", tls_alt_name_register },
|
||||
|
|
|
|||
|
|
@ -491,8 +491,12 @@ static void test_complete_message_handler(const CU_pTest pTest,
|
|||
|
||||
|
||||
static void test_all_tests_complete_message_handler(const CU_pFailureRecord pFailure) {
|
||||
if (liblinphone_tester_use_log_file) ms_warning("\n\n %s",CU_get_run_results_string());
|
||||
liblinphone_tester_fprintf(stdout,"\n\n %s",CU_get_run_results_string());
|
||||
char * results = CU_get_run_results_string();
|
||||
if (liblinphone_tester_use_log_file) {
|
||||
ms_warning("\n\n %s", results);
|
||||
}
|
||||
liblinphone_tester_fprintf(stdout,"\n\n %s",results);
|
||||
ms_free(results);
|
||||
}
|
||||
|
||||
static void test_suite_init_failure_message_handler(const CU_pSuite pSuite) {
|
||||
|
|
@ -556,7 +560,7 @@ int liblinphone_tester_run_tests(const char *suite_name, const char *test_name)
|
|||
CU_pTest test=CU_get_test_by_name(test_name, suite);
|
||||
if (!test) {
|
||||
ms_error("Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name);
|
||||
// do not use suite_name here, since this method is case sentisitive
|
||||
// do not use suite_name here, since this method is case sensitive
|
||||
liblinphone_tester_list_suite_tests(suite->pName);
|
||||
return -2;
|
||||
} else {
|
||||
|
|
@ -610,7 +614,7 @@ int liblinphone_tester_fprintf(FILE * stream, const char * format, ...) {
|
|||
#else
|
||||
/*used by liblinphone tester to retrieve suite list*/
|
||||
result = 0;
|
||||
cunit_android_trace_handler(stream, format, args);
|
||||
cunit_android_trace_handler(stream == stderr, format, args);
|
||||
#endif
|
||||
va_end(args);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -51,13 +51,20 @@ static unsigned long get_native_handle(GdkWindow *gdkw) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static GtkWidget *create_video_window(LinphoneCall *call) {
|
||||
static GtkWidget *create_video_window(LinphoneCall *call, LinphoneCallState cstate) {
|
||||
GtkWidget *video_window;
|
||||
GdkDisplay *display;
|
||||
GdkColor color;
|
||||
MSVideoSize vsize = MS_VIDEO_SIZE_CIF;
|
||||
|
||||
const char *cstate_str;
|
||||
char *title;
|
||||
stats* counters = get_stats(call->core);
|
||||
|
||||
cstate_str = linphone_call_state_to_string(cstate);
|
||||
title = g_strdup_printf("%s", cstate_str);
|
||||
video_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(video_window), title);
|
||||
g_free(title);
|
||||
gtk_window_resize(GTK_WINDOW(video_window), vsize.width, vsize.height);
|
||||
gdk_color_parse("black", &color);
|
||||
gtk_widget_modify_bg(video_window, GTK_STATE_NORMAL, &color);
|
||||
|
|
@ -69,13 +76,14 @@ static GtkWidget *create_video_window(LinphoneCall *call) {
|
|||
display = gdk_drawable_get_display(gtk_widget_get_window(video_window));
|
||||
#endif
|
||||
gdk_display_flush(display);
|
||||
counters->number_of_video_windows_created++;
|
||||
return video_window;
|
||||
}
|
||||
|
||||
static void show_video_window(LinphoneCall *call) {
|
||||
static void show_video_window(LinphoneCall *call, LinphoneCallState cstate) {
|
||||
GtkWidget *video_window = (GtkWidget *)linphone_call_get_user_data(call);
|
||||
if (video_window == NULL) {
|
||||
video_window = create_video_window(call);
|
||||
video_window = create_video_window(call, cstate);
|
||||
linphone_call_set_user_data(call, video_window);
|
||||
linphone_call_set_native_video_window_id(call, get_native_handle(gtk_widget_get_window(video_window)));
|
||||
}
|
||||
|
|
@ -92,8 +100,10 @@ static void hide_video_video(LinphoneCall *call) {
|
|||
|
||||
static void video_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) {
|
||||
switch (cstate) {
|
||||
case LinphoneCallIncomingEarlyMedia:
|
||||
case LinphoneCallOutgoingEarlyMedia:
|
||||
case LinphoneCallConnected:
|
||||
show_video_window(call);
|
||||
show_video_window(call, cstate);
|
||||
break;
|
||||
case LinphoneCallEnd:
|
||||
hide_video_video(call);
|
||||
|
|
@ -103,18 +113,47 @@ static void video_call_state_changed(LinphoneCore *lc, LinphoneCall *call, Linph
|
|||
}
|
||||
}
|
||||
|
||||
static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCoreManager* callee_mgr, const LinphoneCallParams *caller_params, const LinphoneCallParams *callee_params) {
|
||||
static void early_media_video_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) {
|
||||
LinphoneCallParams *params;
|
||||
|
||||
video_call_state_changed(lc, call, cstate, msg);
|
||||
switch (cstate) {
|
||||
case LinphoneCallIncomingReceived:
|
||||
params = linphone_core_create_default_call_parameters(lc);
|
||||
linphone_call_params_enable_video(params, TRUE);
|
||||
linphone_call_params_set_audio_direction(params, LinphoneMediaDirectionSendOnly);
|
||||
linphone_call_params_set_video_direction(params, LinphoneMediaDirectionRecvOnly);
|
||||
linphone_core_accept_early_media_with_params(lc, call, params);
|
||||
linphone_call_params_unref(params);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool_t wait_for_three_cores(LinphoneCore *lc1, LinphoneCore *lc2, LinphoneCore *lc3, int timeout) {
|
||||
MSList *lcs = NULL;
|
||||
bool_t result;
|
||||
int dummy = 0;
|
||||
if (lc1) lcs = ms_list_append(lcs, lc1);
|
||||
if (lc2) lcs = ms_list_append(lcs, lc2);
|
||||
if (lc3) lcs = ms_list_append(lcs, lc3);
|
||||
result = wait_for_list(lcs, &dummy, 1, timeout);
|
||||
ms_list_free(lcs);
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCoreManager* callee_mgr, const LinphoneCallParams *caller_params, const LinphoneCallParams *callee_params, bool_t automatically_accept) {
|
||||
int retry = 0;
|
||||
stats initial_caller = caller_mgr->stat;
|
||||
stats initial_callee = callee_mgr->stat;
|
||||
bool_t result = FALSE;
|
||||
bool_t result = TRUE;
|
||||
bool_t did_received_call;
|
||||
|
||||
CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc, callee_mgr->identity, caller_params));
|
||||
did_received_call = wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, initial_callee.number_of_LinphoneCallIncomingReceived + 1);
|
||||
if (!did_received_call) return 0;
|
||||
|
||||
CU_ASSERT_TRUE(linphone_core_inc_invite_pending(callee_mgr->lc));
|
||||
CU_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress, initial_caller.number_of_LinphoneCallOutgoingProgress + 1);
|
||||
|
||||
while (caller_mgr->stat.number_of_LinphoneCallOutgoingRinging != (initial_caller.number_of_LinphoneCallOutgoingRinging + 1)
|
||||
|
|
@ -133,65 +172,168 @@ static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCo
|
|||
return 0;
|
||||
}
|
||||
|
||||
linphone_core_accept_call_with_params(callee_mgr->lc, linphone_core_get_current_call(callee_mgr->lc), callee_params);
|
||||
if (automatically_accept == TRUE) {
|
||||
linphone_core_accept_call_with_params(callee_mgr->lc, linphone_core_get_current_call(callee_mgr->lc), callee_params);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
|
||||
CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
|
||||
result = wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_caller.number_of_LinphoneCallStreamsRunning + 1)
|
||||
&& wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_callee.number_of_LinphoneCallStreamsRunning + 1);
|
||||
CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
|
||||
CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
|
||||
result = wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_caller.number_of_LinphoneCallStreamsRunning + 1)
|
||||
&& wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_callee.number_of_LinphoneCallStreamsRunning + 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static LinphoneCallParams * _configure_for_video(LinphoneCoreManager *manager, LinphoneCoreCallStateChangedCb cb) {
|
||||
LinphoneCallParams *params;
|
||||
LinphoneCoreVTable *vtable = linphone_core_v_table_new();
|
||||
vtable->call_state_changed = cb;
|
||||
linphone_core_add_listener(manager->lc, vtable);
|
||||
linphone_core_set_video_device(manager->lc, "StaticImage: Static picture");
|
||||
linphone_core_enable_video_capture(manager->lc, TRUE);
|
||||
linphone_core_enable_video_display(manager->lc, TRUE);
|
||||
params = linphone_core_create_default_call_parameters(manager->lc);
|
||||
linphone_call_params_enable_video(params, TRUE);
|
||||
disable_all_video_codecs_except_one(manager->lc, "VP8");
|
||||
return params;
|
||||
}
|
||||
|
||||
static LinphoneCallParams * configure_for_video(LinphoneCoreManager *manager) {
|
||||
return _configure_for_video(manager, video_call_state_changed);
|
||||
}
|
||||
|
||||
static LinphoneCallParams * configure_for_early_media_video_sending(LinphoneCoreManager *manager) {
|
||||
LinphoneCallParams *params = _configure_for_video(manager, video_call_state_changed);
|
||||
linphone_call_params_enable_early_media_sending(params, TRUE);
|
||||
return params;
|
||||
}
|
||||
|
||||
static LinphoneCallParams * configure_for_early_media_video_receiving(LinphoneCoreManager *manager) {
|
||||
return _configure_for_video(manager, early_media_video_call_state_changed);
|
||||
}
|
||||
|
||||
|
||||
static void early_media_video_during_video_call_test(void) {
|
||||
LinphoneCoreManager *marie;
|
||||
LinphoneCoreManager *pauline;
|
||||
LinphoneCoreManager *laure;
|
||||
LinphoneCallParams *marie_params;
|
||||
LinphoneCallParams *pauline_params;
|
||||
LinphoneCoreVTable *marie_vtable;
|
||||
LinphoneCoreVTable *pauline_vtable;
|
||||
int dummy = 0;
|
||||
LinphoneCallParams *laure_params;
|
||||
|
||||
marie = linphone_core_manager_new( "marie_rc");
|
||||
pauline = linphone_core_manager_new( "pauline_rc");
|
||||
marie_vtable = linphone_core_v_table_new();
|
||||
marie_vtable->call_state_changed = video_call_state_changed;
|
||||
linphone_core_add_listener(marie->lc, marie_vtable);
|
||||
linphone_core_set_video_device(marie->lc, "StaticImage: Static picture");
|
||||
//linphone_core_set_video_device(marie->lc, "V4L2: /dev/video0");
|
||||
linphone_core_enable_video_capture(marie->lc, TRUE);
|
||||
linphone_core_enable_video_display(marie->lc, TRUE);
|
||||
linphone_core_set_avpf_mode(marie->lc, LinphoneAVPFEnabled);
|
||||
marie_params = linphone_core_create_default_call_parameters(marie->lc);
|
||||
linphone_call_params_enable_video(marie_params, TRUE);
|
||||
disable_all_video_codecs_except_one(marie->lc, "VP8");
|
||||
pauline_vtable = linphone_core_v_table_new();
|
||||
pauline_vtable->call_state_changed = video_call_state_changed;
|
||||
linphone_core_add_listener(pauline->lc, pauline_vtable);
|
||||
linphone_core_set_video_device(pauline->lc, "StaticImage: Static picture");
|
||||
linphone_core_enable_video_capture(pauline->lc, TRUE);
|
||||
linphone_core_enable_video_display(pauline->lc, TRUE);
|
||||
pauline_params = linphone_core_create_default_call_parameters(pauline->lc);
|
||||
linphone_call_params_enable_video(pauline_params, TRUE);
|
||||
disable_all_video_codecs_except_one(pauline->lc, "VP8");
|
||||
|
||||
CU_ASSERT_TRUE(video_call_with_params(marie, pauline, marie_params, pauline_params));
|
||||
marie = linphone_core_manager_new("marie_rc");
|
||||
pauline = linphone_core_manager_new("pauline_rc");
|
||||
laure = linphone_core_manager_new("laure_rc");
|
||||
marie_params = configure_for_early_media_video_receiving(marie);
|
||||
pauline_params = configure_for_video(pauline);
|
||||
laure_params = configure_for_early_media_video_sending(laure);
|
||||
|
||||
/* Wait for 3s. */
|
||||
wait_for_until(marie->lc, pauline->lc, &dummy, 1, 3000);
|
||||
/* Normal automatically accepted video call from marie to pauline. */
|
||||
CU_ASSERT_TRUE(video_call_with_params(marie, pauline, marie_params, pauline_params, TRUE));
|
||||
|
||||
/* Wait for 2s. */
|
||||
wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000);
|
||||
|
||||
/* Early media video call from laure to marie. */
|
||||
CU_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE));
|
||||
|
||||
/* Wait for 2s. */
|
||||
wait_for_three_cores(marie->lc, pauline->lc, laure->lc, 2000);
|
||||
|
||||
linphone_core_terminate_all_calls(marie->lc);
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1));
|
||||
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2);
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1);
|
||||
CU_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1);
|
||||
|
||||
linphone_call_params_unref(marie_params);
|
||||
linphone_call_params_unref(pauline_params);
|
||||
linphone_call_params_unref(laure_params);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(laure);
|
||||
}
|
||||
|
||||
static void two_incoming_early_media_video_calls_test(void) {
|
||||
char *ringback_path;
|
||||
LinphoneCoreManager *marie;
|
||||
LinphoneCoreManager *pauline;
|
||||
LinphoneCoreManager *laure;
|
||||
LinphoneCallParams *marie_params;
|
||||
LinphoneCallParams *pauline_params;
|
||||
LinphoneCallParams *laure_params;
|
||||
LinphoneCall *call;
|
||||
const MSList *calls_list;
|
||||
|
||||
marie = linphone_core_manager_new("marie_rc");
|
||||
pauline = linphone_core_manager_new("pauline_rc");
|
||||
laure = linphone_core_manager_new("laure_rc");
|
||||
marie_params = configure_for_early_media_video_receiving(marie);
|
||||
pauline_params = configure_for_early_media_video_sending(pauline);
|
||||
laure_params = configure_for_early_media_video_sending(laure);
|
||||
|
||||
/* Configure early media audio to play ring during early-media and send remote ring back tone. */
|
||||
linphone_core_set_ring_during_incoming_early_media(marie->lc, TRUE);
|
||||
ringback_path = ms_strdup_printf("%s/sounds/ringback.wav", liblinphone_tester_file_prefix);
|
||||
linphone_core_set_remote_ringback_tone(marie->lc, ringback_path);
|
||||
ms_free(ringback_path);
|
||||
|
||||
/* Early media video call from pauline to marie. */
|
||||
CU_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE));
|
||||
|
||||
/* Wait for 2s. */
|
||||
wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000);
|
||||
|
||||
/* Early media video call from laure to marie. */
|
||||
CU_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE));
|
||||
|
||||
/* Wait for 2s. */
|
||||
wait_for_three_cores(marie->lc, pauline->lc, laure->lc, 2000);
|
||||
|
||||
CU_ASSERT_EQUAL(linphone_core_get_calls_nb(marie->lc), 2);
|
||||
if (linphone_core_get_calls_nb(marie->lc) == 2) {
|
||||
calls_list = linphone_core_get_calls(marie->lc);
|
||||
call = (LinphoneCall *)ms_list_nth_data(calls_list, 0);
|
||||
CU_ASSERT_PTR_NOT_NULL(call);
|
||||
if (call != NULL) {
|
||||
LinphoneCallParams *params = linphone_call_params_copy(linphone_call_get_current_params(call));
|
||||
linphone_call_params_set_audio_direction(params, LinphoneMediaDirectionSendRecv);
|
||||
linphone_call_params_set_video_direction(params, LinphoneMediaDirectionSendRecv);
|
||||
linphone_core_accept_call_with_params(marie->lc, call, params);
|
||||
|
||||
/* Wait for 5s. */
|
||||
wait_for_three_cores(marie->lc, pauline->lc, laure->lc, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
linphone_core_terminate_all_calls(marie->lc);
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1));
|
||||
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2);
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1);
|
||||
CU_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1);
|
||||
|
||||
linphone_call_params_unref(marie_params);
|
||||
linphone_call_params_unref(pauline_params);
|
||||
linphone_call_params_unref(laure_params);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(laure);
|
||||
}
|
||||
|
||||
test_t video_tests[] = {
|
||||
{ "Early-media video during video call", early_media_video_during_video_call_test }
|
||||
{ "Early-media video during video call", early_media_video_during_video_call_test },
|
||||
{ "Two incoming early-media video calls", two_incoming_early_media_video_calls_test }
|
||||
};
|
||||
|
||||
test_suite_t video_test_suite = {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import logging
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
import weakref
|
||||
|
||||
|
||||
test_domain = "sipopen.example.org"
|
||||
|
|
@ -93,13 +94,13 @@ class AccountManager:
|
|||
@classmethod
|
||||
def account_created_on_server_cb(cls, lc, cfg, state, message):
|
||||
if state == linphone.RegistrationState.Ok:
|
||||
lc.user_data.created = True
|
||||
lc.user_data().created = True
|
||||
elif state == linphone.RegistrationState.Cleared:
|
||||
lc.user_data.done = True
|
||||
lc.user_data().done = True
|
||||
|
||||
@classmethod
|
||||
def account_created_auth_requested_cb(cls, lc, realm, username, domain):
|
||||
lc.user_data.auth_requested = True
|
||||
lc.user_data().auth_requested = True
|
||||
|
||||
def check_account(self, cfg):
|
||||
create_account = False
|
||||
|
|
@ -142,7 +143,7 @@ class AccountManager:
|
|||
cfg.server_addr = server_addr.as_string()
|
||||
cfg.expires = 3600
|
||||
lc.add_proxy_config(cfg)
|
||||
if AccountManager.wait_for_until(lc, None, lambda lc: lc.user_data.auth_requested == True, 10000) != True:
|
||||
if AccountManager.wait_for_until(lc, None, lambda lc: lc.user_data().auth_requested == True, 10000) != True:
|
||||
linphonetester_logger.critical("[TESTER] Account for {identity} could not be created on server.".format(identity=refcfg.identity))
|
||||
sys.exit(-1)
|
||||
cfg.edit()
|
||||
|
|
@ -150,11 +151,11 @@ class AccountManager:
|
|||
cfg.done()
|
||||
ai = linphone.AuthInfo.new(account.modified_identity.username, None, account.password, None, None, account.modified_identity.domain)
|
||||
lc.add_auth_info(ai)
|
||||
if AccountManager.wait_for_until(lc, None, lambda lc: lc.user_data.created == True, 3000) != True:
|
||||
if AccountManager.wait_for_until(lc, None, lambda lc: lc.user_data().created == True, 3000) != True:
|
||||
linphonetester_logger.critical("[TESTER] Account for {identity} is not working on server.".format(identity=refcfg.identity))
|
||||
sys.exit(-1)
|
||||
lc.remove_proxy_config(cfg)
|
||||
if AccountManager.wait_for_until(lc, None, lambda lc: lc.user_data.done == True, 3000) != True:
|
||||
if AccountManager.wait_for_until(lc, None, lambda lc: lc.user_data().done == True, 3000) != True:
|
||||
linphonetester_logger.critical("[TESTER] Account creation could not clean the registration context.")
|
||||
sys.exit(-1)
|
||||
|
||||
|
|
@ -287,7 +288,7 @@ class CoreManager:
|
|||
lc.ring = os.path.join(resources_path, 'sounds', 'oldphone.wav')
|
||||
lc.ringback = os.path.join(resources_path, 'sounds', 'ringback.wav')
|
||||
lc.static_picture = os.path.join(resources_path, 'images', 'nowebcamCIF.jpg')
|
||||
lc.user_data = user_data
|
||||
lc.user_data = weakref.ref(user_data)
|
||||
return lc
|
||||
|
||||
@classmethod
|
||||
|
|
@ -389,7 +390,7 @@ class CoreManager:
|
|||
|
||||
@classmethod
|
||||
def registration_state_changed(cls, lc, cfg, state, message):
|
||||
manager = lc.user_data
|
||||
manager = lc.user_data()
|
||||
linphonetester_logger.info("[TESTER] New registration state {state} for user id [{identity}] at proxy [{addr}]".format(
|
||||
state=linphone.RegistrationState.string(state), identity=cfg.identity, addr=cfg.server_addr))
|
||||
if state == linphone.RegistrationState.None:
|
||||
|
|
@ -407,14 +408,14 @@ class CoreManager:
|
|||
|
||||
@classmethod
|
||||
def auth_info_requested(cls, lc, realm, username, domain):
|
||||
manager = lc.user_data
|
||||
manager = lc.user_data()
|
||||
linphonetester_logger.info("[TESTER] Auth info requested for user id [{username}] at realm [{realm}]".format(
|
||||
username=username, realm=realm))
|
||||
manager.stats.number_of_auth_info_requested +=1
|
||||
|
||||
@classmethod
|
||||
def call_state_changed(cls, lc, call, state, msg):
|
||||
manager = lc.user_data
|
||||
manager = lc.user_data()
|
||||
to_address = call.call_log.to_address.as_string()
|
||||
from_address = call.call_log.from_address.as_string()
|
||||
direction = "Outgoing"
|
||||
|
|
@ -463,7 +464,7 @@ class CoreManager:
|
|||
|
||||
@classmethod
|
||||
def message_received(cls, lc, room, message):
|
||||
manager = lc.user_data
|
||||
manager = lc.user_data()
|
||||
from_str = message.from_address.as_string()
|
||||
text_str = message.text
|
||||
external_body_url = message.external_body_url
|
||||
|
|
@ -478,7 +479,7 @@ class CoreManager:
|
|||
|
||||
@classmethod
|
||||
def new_subscription_requested(cls, lc, lf, url):
|
||||
manager = lc.user_data
|
||||
manager = lc.user_data()
|
||||
linphonetester_logger.info("[TESTER] New subscription request: from [{from_str}], url [{url}]".format(
|
||||
from_str=lf.address.as_string(), url=url))
|
||||
manager.stats.number_of_NewSubscriptionRequest += 1
|
||||
|
|
@ -486,7 +487,7 @@ class CoreManager:
|
|||
|
||||
@classmethod
|
||||
def notify_presence_received(cls, lc, lf):
|
||||
manager = lc.user_data
|
||||
manager = lc.user_data()
|
||||
linphonetester_logger.info("[TESTER] New notify request: from [{from_str}]".format(
|
||||
from_str=lf.address.as_string()))
|
||||
manager.stats.number_of_NotifyReceived += 1
|
||||
|
|
@ -600,9 +601,6 @@ class CoreManager:
|
|||
self.identity = linphone.Address.new(self.lc.default_proxy_config.identity)
|
||||
self.identity.clean()
|
||||
|
||||
def stop(self):
|
||||
self.lc = None
|
||||
|
||||
def enable_audio_codec(self, mime, rate):
|
||||
codecs = self.lc.audio_codecs
|
||||
for codec in codecs:
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ class TestCall:
|
|||
out_call_log = pauline.lc.call_logs[0]
|
||||
assert out_call_log is not None
|
||||
assert_equals(out_call_log.status, linphone.CallStatus.Aborted)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_declined_call(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
@ -40,8 +38,6 @@ class TestCall:
|
|||
assert_equals(pauline.stats.number_of_LinphoneCallEnd, 1)
|
||||
assert_equals(in_call.reason, linphone.Reason.Declined)
|
||||
assert_equals(out_call.reason, linphone.Reason.Declined)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_cancelled_call(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
@ -53,8 +49,6 @@ class TestCall:
|
|||
assert_equals(pauline.stats.number_of_LinphoneCallEnd, 1)
|
||||
assert_equals(marie.stats.number_of_LinphoneCallIncomingReceived, 0)
|
||||
assert_equals(CoreManager.wait_for(pauline, marie, lambda pauline, marie: pauline.stats.number_of_LinphoneCallReleased == 1), True)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_early_cancelled_call(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
@ -72,8 +66,6 @@ class TestCall:
|
|||
# Now the CANCEL should have been sent and the the call at marie's side should terminate
|
||||
assert_equals(CoreManager.wait_for(pauline, marie, lambda pauline, marie: marie.stats.number_of_LinphoneCallEnd == 1), True)
|
||||
assert_equals(CoreManager.wait_for(pauline, marie, lambda pauline, marie: pauline.stats.number_of_LinphoneCallReleased == 1), True)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_cancelled_ringing_call(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
@ -84,8 +76,6 @@ class TestCall:
|
|||
assert_equals(CoreManager.wait_for(pauline, marie, lambda pauline, marie: (pauline.stats.number_of_LinphoneCallReleased == 1) and (marie.stats.number_of_LinphoneCallReleased == 1)), True)
|
||||
assert_equals(marie.stats.number_of_LinphoneCallEnd, 1)
|
||||
assert_equals(pauline.stats.number_of_LinphoneCallEnd, 1)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_call_failed_because_of_codecs(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
@ -100,8 +90,6 @@ class TestCall:
|
|||
assert_equals(out_call.reason, linphone.Reason.NotAcceptable)
|
||||
assert_equals(marie.stats.number_of_LinphoneCallIncomingReceived, 0)
|
||||
assert_equals(marie.stats.number_of_LinphoneCallReleased, 0)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_simple_call(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
@ -109,5 +97,3 @@ class TestCall:
|
|||
assert_equals(CoreManager.call(pauline, marie), True)
|
||||
#liblinphone_tester_check_rtcp(marie,pauline);
|
||||
CoreManager.end_call(marie, pauline)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class TestMessage:
|
|||
|
||||
@classmethod
|
||||
def msg_state_changed(cls, msg, state):
|
||||
stats = msg.chat_room.core.user_data.stats
|
||||
stats = msg.chat_room.core.user_data().stats
|
||||
linphonetester_logger.info("[TESTER] Message [{text}] [{state}]".format(text=msg.text, state=linphone.ChatMessageState.string(state)))
|
||||
if state == linphone.ChatMessageState.Delivered:
|
||||
stats.number_of_LinphoneMessageDelivered += 1
|
||||
|
|
@ -27,7 +27,7 @@ class TestMessage:
|
|||
|
||||
@classmethod
|
||||
def file_transfer_progress_indication(cls, msg, content, offset, total):
|
||||
stats = msg.chat_room.core.user_data.stats
|
||||
stats = msg.chat_room.core.user_data().stats
|
||||
progress = int((offset * 100) / total)
|
||||
direction = 'received'
|
||||
tofrom = 'from'
|
||||
|
|
@ -57,7 +57,7 @@ class TestMessage:
|
|||
@classmethod
|
||||
def file_transfer_recv(cls, msg, content, buf):
|
||||
receive_filepath = msg.user_data
|
||||
stats = msg.chat_room.core.user_data.stats
|
||||
stats = msg.chat_room.core.user_data().stats
|
||||
if buf.empty: # Transfer complete
|
||||
stats.number_of_LinphoneMessageExtBodyReceived += 1
|
||||
else: # Store content
|
||||
|
|
@ -77,7 +77,7 @@ class TestMessage:
|
|||
|
||||
@classmethod
|
||||
def memory_file_transfer_recv(cls, msg, content, buf):
|
||||
stats = msg.chat_room.core.user_data.stats
|
||||
stats = msg.chat_room.core.user_data().stats
|
||||
if buf.empty: # Transfer complete
|
||||
stats.number_of_LinphoneMessageExtBodyReceived += 1
|
||||
else: # Store content
|
||||
|
|
@ -98,8 +98,6 @@ class TestMessage:
|
|||
chat_room.send_chat_message(msg)
|
||||
assert_equals(CoreManager.wait_for(pauline, marie, lambda pauline, marie: marie.stats.number_of_LinphoneMessageReceived == 1), True)
|
||||
assert marie.lc.get_chat_room(pauline.identity) is not None
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_text_message_within_dialog(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
@ -112,8 +110,6 @@ class TestMessage:
|
|||
chat_room.send_chat_message(msg)
|
||||
assert_equals(CoreManager.wait_for(pauline, marie, lambda pauline, marie: marie.stats.number_of_LinphoneMessageReceived == 1), True)
|
||||
assert marie.lc.get_chat_room(pauline.identity) is not None
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
||||
def test_file_transfer_message(self):
|
||||
marie = CoreManager('marie_rc')
|
||||
|
|
|
|||
|
|
@ -35,5 +35,3 @@ class TestPresence:
|
|||
marie = PresenceCoreManager('marie')
|
||||
pauline = PresenceCoreManager('pauline')
|
||||
assert_equals(self.subscribe_to_callee_presence(marie, pauline), True)
|
||||
marie.stop()
|
||||
pauline.stop()
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ class RegisterCoreManager(CoreManager):
|
|||
|
||||
def register_with_refresh(self, refresh, domain, route, late_auth_info = False, transport = linphone.SipTransports(5070, 5070, 5071, 0), expected_final_state = linphone.RegistrationState.Ok):
|
||||
self.register_with_refresh_base(refresh, domain, route, late_auth_info, expected_final_state = expected_final_state)
|
||||
self.stop()
|
||||
# Not testable as the callbacks can not be called once the core destruction has started
|
||||
#assert_equals(self.stats.number_of_LinphoneRegistrationCleared, 1)
|
||||
|
||||
|
|
@ -174,14 +173,12 @@ class TestRegister:
|
|||
assert_equals(cm.stats.number_of_auth_info_requested, 1)
|
||||
|
||||
def test_multiple_accounts(self):
|
||||
cm = CoreManager('multi_account_rc', False)
|
||||
assert_equals(CoreManager.wait_for(cm, cm, lambda cm1, cm2: cm1.stats.number_of_LinphoneRegistrationOk == len(cm.lc.proxy_config_list)), True)
|
||||
CoreManager('multi_account_rc', True)
|
||||
|
||||
def test_transport_change(self):
|
||||
cm = CoreManager('multi_account_rc', False)
|
||||
cm = CoreManager('multi_account_rc', True)
|
||||
number_of_udp_proxies = reduce(lambda x, y: x + int(y.transport == "udp"), cm.lc.proxy_config_list, 0)
|
||||
total_number_of_proxies = len(cm.lc.proxy_config_list)
|
||||
assert_equals(CoreManager.wait_for(cm, cm, lambda cm1, cm2: cm1.stats.number_of_LinphoneRegistrationOk == total_number_of_proxies), True)
|
||||
register_ok = cm.stats.number_of_LinphoneRegistrationOk
|
||||
# Keep only UDP
|
||||
tr = linphone.SipTransports(0, 0, 0, 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue