Merge branch 'master' into dev_bzrtp

This commit is contained in:
Johan Pascal 2014-04-14 22:04:30 +02:00
commit 2522605b79
41 changed files with 537 additions and 325 deletions

View file

@ -680,6 +680,39 @@ AC_SUBST(STRICT_OPTIONS)
top_srcdir=`dirname $0`
AC_ARG_ENABLE(external-ortp,
[AS_HELP_STRING([--enable-external-ortp], [Use external oRTP library])],
[case "${enableval}" in
yes) external_ortp=true ;;
no) external_ortp=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-external-ortp) ;;
esac],
[external_ortp=false]
)
if test "$external_ortp" = 'true'; then
PKG_CHECK_MODULES([ORTP], [ortp >= 0.23.0])
ORTP_VERSION=`$PKG_CONFIG --modversion ortp`
else
AC_CONFIG_SUBDIRS( oRTP )
ORTP_CFLAGS="-I\$(top_srcdir)/oRTP/include"
ORTP_LIBS="\$(top_builddir)/oRTP/src/libortp.la"
if test x$ac_cv_c_bigendian = xyes ; then
ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
fi
if test x$ntptimestamp = xtrue ; then
ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP"
fi
ORTP_DIR=oRTP
changequote(<<, >>)
ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
changequote([, ])
fi
AC_SUBST(ORTP_CFLAGS)
AC_SUBST(ORTP_LIBS)
AC_SUBST([ORTP_VERSION])
AC_SUBST([ORTP_DIR])
AC_ARG_ENABLE([external-mediastreamer],
[AS_HELP_STRING([--enable-external-mediastreamer],[Use external mediastreamer library])],,
[enable_external_mediastreamer=no]
@ -778,38 +811,7 @@ AC_DEFINE_UNQUOTED(LINPHONE_PLUGINS_DIR, "${package_prefix}/lib/liblinphone/plug
LINPHONE_PLUGINS_DIR="${package_prefix}/lib/liblinphone/plugins"
AC_SUBST(LINPHONE_PLUGINS_DIR)
AC_ARG_ENABLE(external-ortp,
[AS_HELP_STRING([--enable-external-ortp], [Use external oRTP library])],
[case "${enableval}" in
yes) external_ortp=true ;;
no) external_ortp=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-external-ortp) ;;
esac],
[external_ortp=false]
)
if test "$external_ortp" = 'true'; then
PKG_CHECK_MODULES([ORTP], [ortp >= 0.23.0])
ORTP_VERSION=`$PKG_CONFIG --modversion ortp`
else
AC_CONFIG_SUBDIRS( oRTP )
ORTP_CFLAGS="-I\$(top_srcdir)/oRTP/include"
ORTP_LIBS="\$(top_builddir)/oRTP/src/libortp.la"
if test x$ac_cv_c_bigendian = xyes ; then
ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
fi
if test x$ntptimestamp = xtrue ; then
ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP"
fi
ORTP_DIR=oRTP
changequote(<<, >>)
ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
changequote([, ])
fi
AC_SUBST(ORTP_CFLAGS)
AC_SUBST(ORTP_LIBS)
AC_SUBST([ORTP_VERSION])
AC_SUBST([ORTP_DIR])
AC_ARG_ENABLE(tutorials,
[AS_HELP_STRING([--disable-tutorials], [Disable compilation of tutorials])],

View file

@ -914,7 +914,7 @@ print_usage (int exit_status)
" -l logfile specify the log file for your SIP phone\n"
" -s sipaddress specify the sip call to do at startup\n"
" -a enable auto answering for incoming calls\n"
" --real-early-media enable sending early media using real audio/video (beware of privacy issue)\n"
" --real-early-media enable sending early media using real audio/video (beware of privacy issue)\n"
" -V enable video features globally (disabled by default)\n"
" -C enable video capture only (disabled by default)\n"
" -D enable video display only (disabled by default)\n"
@ -1238,7 +1238,7 @@ linphonec_parse_cmdline(int argc, char **argv)
{
auto_answer = TRUE;
}
else if (strncmp ("--real-early-media", argv[arg_num], 2) == 0)
else if (strncmp ("--real-early-media", argv[arg_num], strlen("--real-early-media")) == 0)
{
real_early_media_sending = TRUE;
}

View file

@ -130,8 +130,7 @@ void sal_process_incoming_message(SalOp *op,const belle_sip_request_event_t *eve
belle_sip_object_unref(address);
belle_sip_free(from);
} else {
ms_error("Unsupported MESSAGE with content type [%s/%s]",belle_sip_header_content_type_get_type(content_type)
,belle_sip_header_content_type_get_subtype(content_type));
ms_error("Unsupported MESSAGE (content-type not recognized)");
resp = belle_sip_response_create_from_request(req,415);
add_message_accept((belle_sip_message_t*)resp);
belle_sip_server_transaction_send_response(server_transaction,resp);

View file

@ -24,18 +24,20 @@ static void publish_refresher_listener (belle_sip_refresher_t* refresher
,unsigned int status_code
,const char* reason_phrase) {
SalOp* op = (SalOp*)user_pointer;
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->refresher);
belle_sip_request_t* last_publish=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(last_publish_trans));
belle_sip_response_t *response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(last_publish_trans));
/*belle_sip_response_t* response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher)));*/
ms_message("Publish refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase?reason_phrase:"none",sal_op_get_proxy(op));
if (status_code==412){
/*resubmit the request after removing the SIP-If-Match*/
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->refresher);
belle_sip_request_t* last_publish=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(last_publish_trans));
belle_sip_message_remove_header((belle_sip_message_t*)last_publish,"SIP-If-Match");
belle_sip_refresher_refresh(op->refresher,BELLE_SIP_REFRESHER_REUSE_EXPIRES);
}else if (status_code==0){
op->base.root->callbacks.on_expire(op);
}else if (status_code>=200){
sal_error_info_set(&op->error_info,SalReasonUnknown,status_code,reason_phrase,NULL);
sal_op_assign_recv_headers(op,(belle_sip_message_t*)response);
op->base.root->callbacks.on_publish_response(op);
}
}
@ -104,7 +106,9 @@ int sal_publish(SalOp *op, const char *from, const char *to, const char *eventna
}
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Event",eventname));
sal_op_add_body(op,BELLE_SIP_MESSAGE(req),body);
return sal_op_send_and_create_refresher(op,req,expires,publish_refresher_listener);
if (expires!=-1)
return sal_op_send_and_create_refresher(op,req,expires,publish_refresher_listener);
else return sal_op_send_request(op,req);
} else {
/*update status*/
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->refresher);

View file

@ -146,17 +146,20 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
if ( stream->proto == SalProtoRtpSavp ) {
/* add crypto lines */
for ( j=0; j<SAL_CRYPTO_ALGO_MAX; j++ ) {
const char *enc_name=NULL;
switch ( stream->crypto[j].algo ) {
case AES_128_SHA1_80:
snprintf ( buffer, sizeof ( buffer ), "%d %s inline:%s",
stream->crypto[j].tag, "AES_CM_128_HMAC_SHA1_80", stream->crypto[j].master_key );
belle_sdp_media_description_add_attribute ( media_desc,belle_sdp_attribute_create ( "crypto",buffer ) );
enc_name="AES_CM_128_HMAC_SHA1_80";
break;
case AES_128_SHA1_32:
snprintf ( buffer, sizeof ( buffer ), "%d %s inline:%s",
stream->crypto[j].tag, "AES_CM_128_HMAC_SHA1_32", stream->crypto[j].master_key );
belle_sdp_media_description_add_attribute ( media_desc,belle_sdp_attribute_create ( "crypto",buffer ) );
enc_name="AES_CM_128_HMAC_SHA1_32";
break;
case AES_256_SHA1_32:
enc_name="AES_CM_256_HMAC_SHA1_32";
break;
case AES_256_SHA1_80:
enc_name="AES_CM_256_HMAC_SHA1_32";
break;
case AES_128_NO_AUTH:
ms_warning ( "Unsupported crypto suite: AES_128_NO_AUTH" );
@ -168,6 +171,11 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session
j = SAL_CRYPTO_ALGO_MAX;
/* no break */
}
if (enc_name){
snprintf ( buffer, sizeof ( buffer )-1, "%d %s inline:%s",
stream->crypto[j].tag, enc_name, stream->crypto[j].master_key );
belle_sdp_media_description_add_attribute ( media_desc,belle_sdp_attribute_create ( "crypto",buffer ) );
}
}
}
switch ( stream->dir ) {
@ -342,11 +350,15 @@ static void sdp_parse_media_crypto_parameters(belle_sdp_media_description_t *med
tmp,
tmp2 );
if ( nb == 3 ) {
if ( keywordcmp ( "AES_CM_128_HMAC_SHA1_80",tmp ) == 0 )
if ( keywordcmp ( "AES_CM_128_HMAC_SHA1_80",tmp ) == 0 ){
stream->crypto[valid_count].algo = AES_128_SHA1_80;
else if ( keywordcmp ( "AES_CM_128_HMAC_SHA1_32",tmp ) == 0 )
}else if ( keywordcmp ( "AES_CM_128_HMAC_SHA1_32",tmp ) == 0 ){
stream->crypto[valid_count].algo = AES_128_SHA1_32;
else {
}else if ( keywordcmp ( "AES_CM_256_HMAC_SHA1_32",tmp ) == 0 ){
stream->crypto[valid_count].algo = AES_256_SHA1_32;
}else if ( keywordcmp ( "AES_CM_256_HMAC_SHA1_80",tmp ) == 0 ){
stream->crypto[valid_count].algo = AES_256_SHA1_80;
}else {
ms_warning ( "Failed to parse crypto-algo: '%s'", tmp );
stream->crypto[valid_count].algo = 0;
}

View file

@ -1052,6 +1052,7 @@ static void info_received(SalOp *op, const SalBody *body){
static void subscribe_response(SalOp *op, SalSubscribeStatus status){
LinphoneEvent *lev=(LinphoneEvent*)sal_op_get_user_pointer(op);
const SalErrorInfo *ei=sal_op_get_error_info(op);
if (lev==NULL) return;
@ -1060,7 +1061,10 @@ static void subscribe_response(SalOp *op, SalSubscribeStatus status){
}else if (status==SalSubscribePending){
linphone_event_set_state(lev,LinphoneSubscriptionPending);
}else{
linphone_event_set_state(lev,LinphoneSubscriptionError);
if (lev->subscription_state==LinphoneSubscriptionActive && ei->reason==SalReasonIOError){
linphone_event_set_state(lev,LinphoneSubscriptionOutgoingProgress);
}
else linphone_event_set_state(lev,LinphoneSubscriptionError);
}
}
@ -1111,9 +1115,12 @@ static void on_publish_response(SalOp* op){
linphone_event_set_publish_state(lev,LinphonePublishOk);
else
linphone_event_set_publish_state(lev,LinphonePublishCleared);
}else{
linphone_event_set_publish_state(lev,LinphonePublishError);
if (lev->publish_state==LinphonePublishOk){
linphone_event_set_publish_state(lev,LinphonePublishProgress);
}else{
linphone_event_set_publish_state(lev,LinphonePublishError);
}
}
}

View file

@ -34,6 +34,18 @@
#define COMPOSING_DEFAULT_REFRESH_TIMEOUT 60
#define COMPOSING_DEFAULT_REMOTE_REFRESH_TIMEOUT 120
static void _linphone_chat_message_destroy(LinphoneChatMessage* msg);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessage);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatMessage,belle_sip_object_t,
(belle_sip_object_destroy_t)_linphone_chat_message_destroy,
NULL, // clone
NULL, // marshal
FALSE
);
/**
* @addtogroup chatroom
* @{
@ -491,7 +503,7 @@ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr)
* @return a new #LinphoneChatMessage
*/
LinphoneChatMessage* linphone_chat_room_create_message(LinphoneChatRoom *cr, const char* message) {
LinphoneChatMessage* msg = ms_new0(LinphoneChatMessage,1);
LinphoneChatMessage* msg = belle_sip_object_new(LinphoneChatMessage);
msg->chat_room=(LinphoneChatRoom*)cr;
msg->message=message?ms_strdup(message):NULL;
msg->is_read=TRUE;
@ -514,7 +526,7 @@ LinphoneChatMessage* linphone_chat_room_create_message_2(
LinphoneChatMessageState state, time_t time, bool_t is_read, bool_t is_incoming) {
LinphoneCore *lc=linphone_chat_room_get_lc(cr);
LinphoneChatMessage* msg = ms_new0(LinphoneChatMessage,1);
LinphoneChatMessage* msg = belle_sip_object_new(LinphoneChatMessage);
msg->chat_room=(LinphoneChatRoom*)cr;
msg->message=message?ms_strdup(message):NULL;
msg->external_body_url=external_body_url?ms_strdup(external_body_url):NULL;
@ -888,14 +900,40 @@ LinphoneChatMessage* linphone_chat_message_clone(const LinphoneChatMessage* msg)
/**
* Destroys a LinphoneChatMessage.
**/
void linphone_chat_message_destroy(LinphoneChatMessage* msg) {
void linphone_chat_message_destroy(LinphoneChatMessage* msg){
belle_sip_object_unref(msg);
}
/**
* Destroys a LinphoneChatMessage.
**/
static void _linphone_chat_message_destroy(LinphoneChatMessage* msg) {
if (msg->op) sal_op_release(msg->op);
if (msg->message) ms_free(msg->message);
if (msg->external_body_url) ms_free(msg->external_body_url);
if (msg->from) linphone_address_destroy(msg->from);
if (msg->to) linphone_address_destroy(msg->to);
if (msg->custom_headers) sal_custom_header_free(msg->custom_headers);
ms_free(msg);
}
/**
* Acquire a reference to the chat message.
* @param msg the chat message
* @return the same chat message
**/
LinphoneChatMessage * linphone_chat_message_ref(LinphoneChatMessage *msg){
belle_sip_object_ref(msg);
return msg;
}
/**
* Release reference to the chat message.
* @param msg the chat message.
**/
void linphone_chat_message_unref(LinphoneChatMessage *msg){
belle_sip_object_unref(msg);
}
/**

View file

@ -234,7 +234,10 @@ static int _linphone_event_send_publish(LinphoneEvent *lev, const LinphoneConten
ms_error("linphone_event_update_publish(): this is not a PUBLISH event.");
return -1;
}
if (lev->send_custom_headers){
sal_op_set_sent_custom_header(lev->op,lev->send_custom_headers);
lev->send_custom_headers=NULL;
}else sal_op_set_sent_custom_header(lev->op,NULL);
err=sal_publish(lev->op,NULL,NULL,lev->name,lev->expires,sal_body_from_content(&salbody,body));
if (err==0){
linphone_event_set_publish_state(lev,LinphonePublishProgress);
@ -292,7 +295,7 @@ void linphone_event_terminate(LinphoneEvent *lev){
}
if (lev->publish_state!=LinphonePublishNone){
if (lev->publish_state==LinphonePublishOk){
if (lev->publish_state==LinphonePublishOk && lev->expires!=-1){
sal_publish(lev->op,NULL,NULL,NULL,0,NULL);
}else sal_op_stop_refreshing(lev->op);
linphone_event_set_publish_state(lev,LinphonePublishCleared);

View file

@ -52,7 +52,7 @@ typedef enum _LinphoneSubscriptionDir LinphoneSubscriptionDir;
**/
enum _LinphoneSubscriptionState{
LinphoneSubscriptionNone, /**< Initial state, should not be used.**/
LinphoneSubscriptionOutgoingInit, /**<An outgoing subcription was created*/
LinphoneSubscriptionOutgoingProgress, /**<An outgoing subcription was sent*/
LinphoneSubscriptionIncomingReceived, /**<An incoming subcription is received*/
LinphoneSubscriptionPending, /**<Subscription is pending, waiting for user approval*/
LinphoneSubscriptionActive, /**<Subscription is accepted.*/
@ -63,6 +63,7 @@ enum _LinphoneSubscriptionState{
/*typo compatibility*/
#define LinphoneSubscriptionOutoingInit LinphoneSubscriptionOutgoingInit
#define LinphoneSubscriptionOutgoingInit LinphoneSubscriptionOutgoingProgress
/**
* Typedef for subscription state enum.
**/
@ -169,7 +170,7 @@ LINPHONE_PUBLIC int linphone_event_notify(LinphoneEvent *lev, const LinphoneCont
* @param lc the #LinphoneCore
* @param resource the resource uri for the event
* @param event the event name
* @param expires the lifetime of the publication
* @param expires the lifetime of event being published, -1 if no associated duration, in which case it will not be refreshed.
* @param body the actual published data
* @return the LinphoneEvent holding the context of the publish.
**/
@ -182,7 +183,7 @@ LINPHONE_PUBLIC LinphoneEvent *linphone_core_publish(LinphoneCore *lc, const Lin
* @param lc the #LinphoneCore
* @param resource the resource uri for the event
* @param event the event name
* @param expires the lifetime of the publication
* @param expires the lifetime of event being published, -1 if no associated duration, in which case it will not be refreshed.
* @return the LinphoneEvent holding the context of the publish.
**/
LINPHONE_PUBLIC LinphoneEvent *linphone_core_create_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires);

View file

@ -97,7 +97,6 @@ public class TutorialBuddyStatus implements LinphoneCoreListener {
}
public void show(LinphoneCore lc) {}
public void byeReceived(LinphoneCore lc, String from) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
public void displayStatus(LinphoneCore lc, String message) {}
public void displayMessage(LinphoneCore lc, String message) {}
public void displayWarning(LinphoneCore lc, String message) {}
@ -294,5 +293,12 @@ public class TutorialBuddyStatus implements LinphoneCoreListener {
}
@Override
public void authInfoRequested(LinphoneCore lc, String realm,
String username, String Domain) {
// TODO Auto-generated method stub
}
}

View file

@ -73,7 +73,7 @@ public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessa
public void show(LinphoneCore lc) {}
public void byeReceived(LinphoneCore lc, String from) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username, String domain) {}
public void displayStatus(LinphoneCore lc, String message) {}
public void displayMessage(LinphoneCore lc, String message) {}
public void displayWarning(LinphoneCore lc, String message) {}

View file

@ -67,7 +67,7 @@ public class TutorialHelloWorld implements LinphoneCoreListener {
public void show(LinphoneCore lc) {}
public void byeReceived(LinphoneCore lc, String from) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username, String domain) {}
public void displayStatus(LinphoneCore lc, String message) {}
public void displayMessage(LinphoneCore lc, String message) {}
public void displayWarning(LinphoneCore lc, String message) {}

View file

@ -78,7 +78,7 @@ public class TutorialRegistration implements LinphoneCoreListener {
public void show(LinphoneCore lc) {}
public void byeReceived(LinphoneCore lc, String from) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username) {}
public void authInfoRequested(LinphoneCore lc, String realm, String username, String domain) {}
public void displayStatus(LinphoneCore lc, String message) {}
public void displayMessage(LinphoneCore lc, String message) {}
public void displayWarning(LinphoneCore lc, String message) {}

View file

@ -1873,11 +1873,8 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, stream->crypto_local_tag);
if (crypto_idx >= 0) {
audio_stream_enable_srtp(
call->audiostream,
stream->crypto[0].algo,
local_st_desc->crypto[crypto_idx].master_key,
stream->crypto[0].master_key);
media_stream_set_srtp_recv_key(&call->audiostream->ms,stream->crypto[0].algo,stream->crypto[0].master_key);
media_stream_set_srtp_send_key(&call->audiostream->ms,stream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key);
call->audiostream_encrypted=TRUE;
} else {
ms_warning("Failed to find local crypto algo with tag: %d", stream->crypto_local_tag);
@ -1996,13 +1993,13 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
}
if (!is_inactive){
if (vstream->proto == SalProtoRtpSavp) {
video_stream_enable_strp(
call->videostream,
vstream->crypto[0].algo,
local_st_desc->crypto[0].master_key,
vstream->crypto[0].master_key
);
call->videostream_encrypted=TRUE;
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, vstream->crypto_local_tag);
if (crypto_idx >= 0) {
media_stream_set_srtp_recv_key(&call->videostream->ms,vstream->crypto[0].algo,vstream->crypto[0].master_key);
media_stream_set_srtp_send_key(&call->videostream->ms,vstream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key);
call->videostream_encrypted=TRUE;
}else call->videostream_encrypted=FALSE;
}else{
call->videostream_encrypted=FALSE;
}
@ -2105,42 +2102,43 @@ void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call){
#endif
}
static bool_t update_stream_crypto_params(LinphoneCall *call, const SalStreamDescription *local_st_desc, SalStreamDescription *old_stream, SalStreamDescription *new_stream, MediaStream *ms){
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag);
if (crypto_idx >= 0) {
if (call->localdesc_changed & SAL_MEDIA_DESCRIPTION_CRYPTO_CHANGED)
media_stream_set_srtp_send_key(ms,new_stream->crypto[0].algo,local_st_desc->crypto[crypto_idx].master_key);
if (strcmp(old_stream->crypto[0].master_key,new_stream->crypto[0].master_key)!=0){
media_stream_set_srtp_recv_key(ms,new_stream->crypto[0].algo,new_stream->crypto[0].master_key);
}
return TRUE;
} else {
ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag);
}
return FALSE;
}
void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md) {
SalStreamDescription *old_stream;
SalStreamDescription *new_stream;
const SalStreamDescription *local_st_desc;
local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalAudio);
old_stream = sal_media_description_find_stream(old_md, SalProtoRtpSavp, SalAudio);
new_stream = sal_media_description_find_stream(new_md, SalProtoRtpSavp, SalAudio);
if (old_stream && new_stream) {
const SalStreamDescription *local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalAudio);
if (local_st_desc) {
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag);
if (crypto_idx >= 0) {
audio_stream_enable_srtp(call->audiostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key);
call->audiostream_encrypted = TRUE;
} else {
ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag);
call->audiostream_encrypted = FALSE;
}
}
}
if (call->audiostream && local_st_desc && old_stream && new_stream &&
update_stream_crypto_params(call,local_st_desc,old_stream,new_stream,&call->audiostream->ms)){
call->audiostream_encrypted = TRUE;
}else call->audiostream_encrypted = FALSE;
#ifdef VIDEO_ENABLED
local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalVideo);
old_stream = sal_media_description_find_stream(old_md, SalProtoRtpSavp, SalVideo);
new_stream = sal_media_description_find_stream(new_md, SalProtoRtpSavp, SalVideo);
if (old_stream && new_stream) {
const SalStreamDescription *local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalVideo);
if (local_st_desc) {
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag);
if (crypto_idx >= 0) {
video_stream_enable_strp(call->videostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key);
call->videostream_encrypted = TRUE;
} else {
ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag);
call->videostream_encrypted = FALSE;
}
}
if (call->videostream && local_st_desc && old_stream && new_stream &&
update_stream_crypto_params(call,local_st_desc,old_stream,new_stream,&call->videostream->ms)){
call->videostream_encrypted = TRUE;
}
call->videostream_encrypted = FALSE;
#endif
}
@ -2226,6 +2224,11 @@ void linphone_call_stop_video_stream(LinphoneCall *call) {
#endif
}
static void unset_rtp_profile(LinphoneCall *call, int i){
if (call->sessions[i].rtp_session)
rtp_session_set_profile(call->sessions[i].rtp_session,&av_profile);
}
void linphone_call_stop_media_streams(LinphoneCall *call){
if (call->audiostream || call->videostream) {
linphone_call_stop_audio_stream(call);
@ -2239,10 +2242,12 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
if (call->audio_profile){
rtp_profile_destroy(call->audio_profile);
call->audio_profile=NULL;
unset_rtp_profile(call,0);
}
if (call->video_profile){
rtp_profile_destroy(call->video_profile);
call->video_profile=NULL;
unset_rtp_profile(call,1);
}
}

View file

@ -2262,7 +2262,15 @@ void linphone_core_iterate(LinphoneCore *lc){
if (lc->ringstream && lc->ringstream_autorelease && lc->dmfs_playing_start_time!=0
&& (curtime-lc->dmfs_playing_start_time)>5){
linphone_core_stop_dtmf_stream(lc);
MSPlayerState state;
bool_t stop=TRUE;
if (lc->ringstream->source && ms_filter_call_method(lc->ringstream->source,MS_PLAYER_GET_STATE,&state)==0){
if (state==MSPlayerPlaying) stop=FALSE;
}
if (stop) {
ms_message("Releasing inactive tone player.");
linphone_core_stop_dtmf_stream(lc);
}
}
sal_iterate(lc->sal);
@ -4412,7 +4420,9 @@ void linphone_core_verify_server_cn(LinphoneCore *lc, bool_t yesno){
static void notify_end_of_ring(void *ud, MSFilter *f, unsigned int event, void *arg){
LinphoneCore *lc=(LinphoneCore*)ud;
lc->preview_finished=1;
if (event==MS_PLAYER_EOF){
lc->preview_finished=1;
}
}
int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata)
@ -6380,6 +6390,7 @@ const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc){
case LinphoneMediaEncryptionNone:
return "LinphoneMediaEncryptionNone";
}
ms_error("Invalid LinphoneMediaEncryption value %i",(int)menc);
return "INVALID";
}
@ -6389,7 +6400,7 @@ const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc){
bool_t linphone_core_media_encryption_supported(const LinphoneCore *lc, LinphoneMediaEncryption menc){
switch(menc){
case LinphoneMediaEncryptionSRTP:
return ortp_srtp_supported();
return media_stream_srtp_supported();
case LinphoneMediaEncryptionZRTP:
return ortp_zrtp_available();
case LinphoneMediaEncryptionNone:
@ -6402,7 +6413,7 @@ int linphone_core_set_media_encryption(LinphoneCore *lc, LinphoneMediaEncryption
const char *type="none";
int ret=0;
if (menc == LinphoneMediaEncryptionSRTP){
if (!ortp_srtp_supported()){
if (!media_stream_srtp_supported()){
ms_warning("SRTP not supported by library.");
type="none";
ret=-1;

View file

@ -1067,6 +1067,8 @@ LINPHONE_PUBLIC unsigned int linphone_chat_message_store(LinphoneChatMessage *ms
LINPHONE_PUBLIC const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState state);
LINPHONE_PUBLIC LinphoneChatMessageState linphone_chat_message_get_state(const LinphoneChatMessage* message);
LINPHONE_PUBLIC LinphoneChatMessage* linphone_chat_message_clone(const LinphoneChatMessage* message);
LINPHONE_PUBLIC LinphoneChatMessage * linphone_chat_message_ref(LinphoneChatMessage *msg);
LINPHONE_PUBLIC void linphone_chat_message_unref(LinphoneChatMessage *msg);
LINPHONE_PUBLIC void linphone_chat_message_destroy(LinphoneChatMessage* msg);
LINPHONE_PUBLIC void linphone_chat_message_set_from(LinphoneChatMessage* message, const LinphoneAddress* from);
LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_message_get_from(const LinphoneChatMessage* message);

View file

@ -224,6 +224,8 @@ public:
/*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/
newSubscriptionRequestId = env->GetMethodID(listenerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V");
authInfoRequestedId = env->GetMethodID(listenerClass,"authInfoRequested","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
/*void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf);*/
notifyPresenceReceivedId = env->GetMethodID(listenerClass,"notifyPresenceReceived","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;)V");
@ -245,7 +247,7 @@ public:
proxyClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneProxyConfigImpl"));
proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(J)V");
proxyCtrId = env->GetMethodID(proxyClass,"<init>", "(Lorg/linphone/core/LinphoneCoreImpl;J)V");
callClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCallImpl"));
callCtrId = env->GetMethodID(callClass,"<init>", "(J)V");
@ -325,6 +327,7 @@ public:
jmethodID transferStateId;
jmethodID infoReceivedId;
jmethodID subscriptionStateId;
jmethodID authInfoRequestedId;
jmethodID publishStateId;
jmethodID notifyRecvId;
@ -413,7 +416,19 @@ public:
}
static void authInfoRequested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) {
JNIEnv *env = 0;
jint result = jvm->AttachCurrentThread(&env,NULL);
if (result != 0) {
ms_error("cannot attach VM");
return;
}
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
env->CallVoidMethod(lcData->listener,
lcData->authInfoRequestedId,
lcData->core,
realm ? env->NewStringUTF(realm):NULL,
username ? env->NewStringUTF(username) : NULL,
domain ? env->NewStringUTF(domain) : NULL);
}
static void globalStateChange(LinphoneCore *lc, LinphoneGlobalState gstate,const char* message) {
JNIEnv *env = 0;
@ -440,7 +455,7 @@ public:
env->CallVoidMethod(lcData->listener
,lcData->registrationStateId
,lcData->core
,env->NewObject(lcData->proxyClass,lcData->proxyCtrId,(jlong)proxy)
,env->NewObject(lcData->proxyClass,lcData->proxyCtrId,lcData->core,(jlong)proxy)
,env->CallStaticObjectMethod(lcData->registrationStateClass,lcData->registrationStateFromIntId,(jint)state),
message ? env->NewStringUTF(message) : NULL);
}
@ -2432,13 +2447,6 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_destroy(JNIEnv* env
linphone_chat_room_destroy((LinphoneChatRoom*)ptr);
}
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_setUserData(JNIEnv* env
,jobject thiz
,jlong ptr) {
jobject ud = env->NewGlobalRef(thiz);
linphone_chat_message_set_user_data((LinphoneChatMessage*)ptr,(void*) ud);
}
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_store(JNIEnv* env
,jobject thiz
,jlong ptr) {
@ -2539,6 +2547,12 @@ extern "C" jint Java_org_linphone_core_LinphoneChatMessageImpl_getStorageId(JNIE
return (jint) linphone_chat_message_get_storage_id((LinphoneChatMessage*)ptr);
}
extern "C" void Java_org_linphone_core_LinphoneChatMessageImpl_unref(JNIEnv* env
,jobject thiz
,jlong ptr) {
linphone_chat_message_unref((LinphoneChatMessage*)ptr);
}
extern "C" jlongArray Java_org_linphone_core_LinphoneCoreImpl_getChatRooms(JNIEnv* env
,jobject thiz
,jlong ptr) {
@ -2577,26 +2591,32 @@ static void chat_room_impl_callback(LinphoneChatMessage* msg, LinphoneChatMessag
jobject listener = (jobject) ud;
jclass clazz = (jclass) env->GetObjectClass(listener);
jmethodID method = env->GetMethodID(clazz, "onLinphoneChatMessageStateChanged","(Lorg/linphone/core/LinphoneChatMessage;Lorg/linphone/core/LinphoneChatMessage$State;)V");
jobject jmessage=(jobject)linphone_chat_message_get_user_data(msg);
LinphoneCore *lc = linphone_chat_room_get_lc(linphone_chat_message_get_chat_room(msg));
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc);
env->CallVoidMethod(
listener,
method,
(jobject)linphone_chat_message_get_user_data(msg),
jmessage,
env->CallStaticObjectMethod(lcData->chatMessageStateClass,lcData->chatMessageStateFromIntId,(jint)state));
if (state == LinphoneChatMessageStateDelivered || state == LinphoneChatMessageStateNotDelivered) {
env->DeleteGlobalRef(listener);
env->DeleteGlobalRef(jmessage);
linphone_chat_message_set_user_data(msg,NULL);
}
}
extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage2(JNIEnv* env
,jobject thiz
,jlong ptr
,jlong jmessage
,jlong chatroom_ptr
,jobject message
,jlong messagePtr
,jobject jlistener) {
jobject listener = env->NewGlobalRef(jlistener);
linphone_chat_room_send_message2((LinphoneChatRoom*)ptr, (LinphoneChatMessage*)jmessage, chat_room_impl_callback, (void*)listener);
message = env->NewGlobalRef(message);
linphone_chat_message_ref((LinphoneChatMessage*)messagePtr);
linphone_chat_message_set_user_data((LinphoneChatMessage*)messagePtr, message);
linphone_chat_room_send_message2((LinphoneChatRoom*)chatroom_ptr, (LinphoneChatMessage*)messagePtr, chat_room_impl_callback, (void*)listener);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv* env

View file

@ -177,101 +177,107 @@ LpItem *lp_section_find_item(const LpSection *sec, const char *name){
return NULL;
}
void lp_config_parse(LpConfig *lpconfig, FILE *file){
char tmp[MAX_LEN]= {'\0'};
LpSection *cur=NULL;
static LpSection* lp_config_parse_line(LpConfig* lpconfig, const char* line, LpSection* cur) {
LpSectionParam *params = NULL;
char *pos1,*pos2;
int nbs;
char secname[MAX_LEN];
char key[MAX_LEN];
char value[MAX_LEN];
static char secname[MAX_LEN];
static char key[MAX_LEN];
static char value[MAX_LEN];
LpItem *item;
pos1=strchr(line,'[');
if (pos1!=NULL && is_first_char(line,pos1) ){
pos2=strchr(pos1,']');
if (pos2!=NULL){
secname[0]='\0';
/* found section */
*pos2='\0';
nbs = sscanf(pos1+1, "%s", secname);
if (nbs >= 1) {
if (strlen(secname) > 0) {
cur = lp_config_find_section (lpconfig,secname);
if (cur == NULL) {
cur = lp_section_new(secname);
lp_config_add_section(lpconfig, cur);
}
if (pos2 > pos1 + 1 + strlen(secname)) {
/* found at least one section param */
pos2 = pos1 + 1 + strlen(secname) + 1; // Remove the white space after the secname
pos1 = strchr(pos2, '=');
while (pos1 != NULL) {
/* for each section param */
key[0] = '\0';
value[0] = '\0';
*pos1 = ' ';
if (sscanf(pos2, "%s %s", key, value) == 2) {
params = lp_section_param_new(key, value);
lp_config_add_section_param(cur, params);
pos2 += strlen(key) + strlen(value) + 2; // Remove the = sign + the white space after each param
pos1 = strchr(pos2, '=');
} else {
ms_warning("parse section params error !");
pos1 = NULL;
}
}
}
}
} else {
ms_warning("parse error!");
}
}
}else {
pos1=strchr(line,'=');
if (pos1!=NULL){
key[0]='\0';
*pos1='\0';
if (sscanf(line,"%s",key)>0){
pos1++;
pos2=strchr(pos1,'\r');
if (pos2==NULL)
pos2=strchr(pos1,'\n');
if (pos2==NULL) pos2=pos1+strlen(pos1);
else {
*pos2='\0'; /*replace the '\n' */
}
/* remove ending white spaces */
for (; pos2>pos1 && pos2[-1]==' ';pos2--) pos2[-1]='\0';
if (pos2-pos1>=0){
/* found a pair key,value */
if (cur!=NULL){
item=lp_section_find_item(cur,key);
if (item==NULL){
lp_section_add_item(cur,lp_item_new(key,pos1));
}else{
ortp_free(item->value);
item->value=ortp_strdup(pos1);
}
/*ms_message("Found %s=%s",key,pos1);*/
}else{
ms_warning("found key,item but no sections");
}
}
}
}
}
return cur;
}
void lp_config_parse(LpConfig *lpconfig, FILE *file){
char tmp[MAX_LEN]= {'\0'};
LpSection* current_section = NULL;
if (file==NULL) return;
while(fgets(tmp,MAX_LEN,file)!=NULL){
tmp[sizeof(tmp) -1] = '\0';
pos1=strchr(tmp,'[');
if (pos1!=NULL && is_first_char(tmp,pos1) ){
pos2=strchr(pos1,']');
if (pos2!=NULL){
secname[0]='\0';
/* found section */
*pos2='\0';
nbs = sscanf(pos1+1, "%s", secname);
if (nbs >= 1) {
if (strlen(secname) > 0) {
cur = lp_config_find_section (lpconfig,secname);
if (cur == NULL) {
cur = lp_section_new(secname);
lp_config_add_section(lpconfig, cur);
}
if (pos2 > pos1 + 1 + strlen(secname)) {
/* found at least one section param */
pos2 = pos1 + 1 + strlen(secname) + 1; // Remove the white space after the secname
pos1 = strchr(pos2, '=');
while (pos1 != NULL) {
/* for each section param */
key[0] = '\0';
value[0] = '\0';
*pos1 = ' ';
if (sscanf(pos2, "%s %s", key, value) == 2) {
params = lp_section_param_new(key, value);
lp_config_add_section_param(cur, params);
pos2 += strlen(key) + strlen(value) + 2; // Remove the = sign + the white space after each param
pos1 = strchr(pos2, '=');
} else {
ms_warning("parse section params error !");
pos1 = NULL;
}
}
}
}
} else {
ms_warning("parse error!");
}
}
}else {
pos1=strchr(tmp,'=');
if (pos1!=NULL){
key[0]='\0';
*pos1='\0';
if (sscanf(tmp,"%s",key)>0){
pos1++;
pos2=strchr(pos1,'\r');
if (pos2==NULL)
pos2=strchr(pos1,'\n');
if (pos2==NULL) pos2=pos1+strlen(pos1);
else {
*pos2='\0'; /*replace the '\n' */
}
/* remove ending white spaces */
for (; pos2>pos1 && pos2[-1]==' ';pos2--) pos2[-1]='\0';
if (pos2-pos1>=0){
/* found a pair key,value */
if (cur!=NULL){
item=lp_section_find_item(cur,key);
if (item==NULL){
lp_section_add_item(cur,lp_item_new(key,pos1));
}else{
ortp_free(item->value);
item->value=ortp_strdup(pos1);
}
/*ms_message("Found %s=%s",key,pos1);*/
}else{
ms_warning("found key,item but no sections");
}
}
}
}
}
current_section = lp_config_parse_line(lpconfig, tmp, current_section);
}
}
@ -279,9 +285,27 @@ LpConfig * lp_config_new(const char *filename){
return lp_config_new_with_factory(filename, NULL);
}
LpConfig * lp_config_new_from_buffer(const char *buffer){
LpConfig* conf = lp_new0(LpConfig,1);
LpSection* current_section = NULL;
char* ptr = ms_strdup(buffer);
char* strtok_storage = NULL;
char* line = strtok_r(ptr, "\n", &strtok_storage);
while( line != NULL ){
current_section = lp_config_parse_line(conf,line,current_section);
line = strtok_r(NULL, "\n", &strtok_storage);
}
ms_free(ptr);
return conf;
}
LpConfig *lp_config_new_with_factory(const char *config_filename, const char *factory_config_filename) {
LpConfig *lpconfig=lp_new0(LpConfig,1);
if (config_filename!=NULL){
ms_message("Using (r/w) config information from %s", config_filename);
lpconfig->filename=ortp_strdup(config_filename);
@ -547,7 +571,7 @@ int lp_config_get_default_int(const LpConfig *lpconfig, const char *section, con
char default_section[MAX_LEN];
strcpy(default_section, section);
strcat(default_section, DEFAULT_VALUES_SUFFIX);
return lp_config_get_int(lpconfig, default_section, key, default_value);
}
@ -555,7 +579,7 @@ int64_t lp_config_get_default_int64(const LpConfig *lpconfig, const char *sectio
char default_section[MAX_LEN];
strcpy(default_section, section);
strcat(default_section, DEFAULT_VALUES_SUFFIX);
return lp_config_get_int64(lpconfig, default_section, key, default_value);
}
@ -563,7 +587,7 @@ float lp_config_get_default_float(const LpConfig *lpconfig, const char *section,
char default_section[MAX_LEN];
strcpy(default_section, section);
strcat(default_section, DEFAULT_VALUES_SUFFIX);
return lp_config_get_float(lpconfig, default_section, key, default_value);
}
@ -571,6 +595,6 @@ const char* lp_config_get_default_string(const LpConfig *lpconfig, const char *s
char default_section[MAX_LEN];
strcpy(default_section, section);
strcat(default_section, DEFAULT_VALUES_SUFFIX);
return lp_config_get_string(lpconfig, default_section, key, default_value);
}

View file

@ -21,7 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef LPCONFIG_H
#define LPCONFIG_H
#include <mediastreamer2/mscommon.h>
@ -33,7 +33,7 @@
/**
* The LpConfig object is used to manipulate a configuration file.
*
*
* @ingroup misc
* The format of the configuration file is a .ini like format:
* - sections are defined in []
@ -64,6 +64,16 @@ extern "C" {
*/
LINPHONE_PUBLIC LpConfig * lp_config_new(const char *filename);
/**
* Instantiates a LpConfig object from a user provided buffer.
*
* @ingroup misc
* @param buffer the buffer from which the lpconfig will be retrieved. We expect the buffer to be null-terminated.
* @see lp_config_new_with_factory
* @see lp_config_new
*/
LINPHONE_PUBLIC LpConfig * lp_config_new_from_buffer(const char *buffer);
/**
* Instantiates a LpConfig object from a user config file and a factory config file.
*
@ -88,7 +98,7 @@ LINPHONE_PUBLIC int lp_config_read_file(LpConfig *lpconfig, const char *filename
/**
* Retrieves a configuration item as a string, given its section, key, and default value.
*
*
* @ingroup misc
* The default value string is returned if the config item isn't found.
**/
@ -105,7 +115,7 @@ LINPHONE_PUBLIC bool_t lp_config_get_range(const LpConfig *lpconfig, const char
/**
* Retrieves a configuration item as an integer, given its section, key, and default value.
*
*
* @ingroup misc
* The default integer value is returned if the config item isn't found.
**/
@ -113,7 +123,7 @@ LINPHONE_PUBLIC int lp_config_get_int(const LpConfig *lpconfig,const char *secti
/**
* Retrieves a configuration item as a 64 bit integer, given its section, key, and default value.
*
*
* @ingroup misc
* The default integer value is returned if the config item isn't found.
**/
@ -121,14 +131,14 @@ LINPHONE_PUBLIC int64_t lp_config_get_int64(const LpConfig *lpconfig,const char
/**
* Retrieves a configuration item as a float, given its section, key, and default value.
*
*
* @ingroup misc
* The default float value is returned if the config item isn't found.
**/
LINPHONE_PUBLIC float lp_config_get_float(const LpConfig *lpconfig,const char *section, const char *key, float default_value);
/**
* Sets a string config item
* Sets a string config item
*
* @ingroup misc
**/
@ -167,11 +177,11 @@ LINPHONE_PUBLIC void lp_config_set_int64(LpConfig *lpconfig,const char *section,
*
* @ingroup misc
**/
LINPHONE_PUBLIC void lp_config_set_float(LpConfig *lpconfig,const char *section, const char *key, float value);
LINPHONE_PUBLIC void lp_config_set_float(LpConfig *lpconfig,const char *section, const char *key, float value);
/**
* Writes the config file to disk.
*
*
* @ingroup misc
**/
LINPHONE_PUBLIC int lp_config_sync(LpConfig *lpconfig);
@ -211,7 +221,7 @@ LINPHONE_PUBLIC void lp_config_destroy(LpConfig *cfg);
/**
* Retrieves a default configuration item as an integer, given its section, key, and default value.
*
*
* @ingroup misc
* The default integer value is returned if the config item isn't found.
**/
@ -219,7 +229,7 @@ LINPHONE_PUBLIC int lp_config_get_default_int(const LpConfig *lpconfig, const ch
/**
* Retrieves a default configuration item as a 64 bit integer, given its section, key, and default value.
*
*
* @ingroup misc
* The default integer value is returned if the config item isn't found.
**/
@ -227,7 +237,7 @@ LINPHONE_PUBLIC int64_t lp_config_get_default_int64(const LpConfig *lpconfig, co
/**
* Retrieves a default configuration item as a float, given its section, key, and default value.
*
*
* @ingroup misc
* The default float value is returned if the config item isn't found.
**/
@ -235,7 +245,7 @@ LINPHONE_PUBLIC float lp_config_get_default_float(const LpConfig *lpconfig, cons
/**
* Retrieves a default configuration item as a string, given its section, key, and default value.
*
*
* @ingroup misc
* The default value string is returned if the config item isn't found.
**/
@ -243,12 +253,12 @@ LINPHONE_PUBLIC const char* lp_config_get_default_string(const LpConfig *lpconfi
/**
* Retrieves a section parameter item as a string, given its section and key.
*
*
* @ingroup misc
* The default value string is returned if the config item isn't found.
**/
LINPHONE_PUBLIC const char* lp_config_get_section_param_string(const LpConfig *lpconfig, const char *section, const char *key, const char *default_value);
#ifdef __cplusplus
}
#endif

View file

@ -132,6 +132,7 @@ typedef enum _LinphoneChatMessageDir{
} LinphoneChatMessageDir;
struct _LinphoneChatMessage {
belle_sip_object_t base;
LinphoneChatRoom* chat_room;
LinphoneChatMessageDir dir;
char* message;
@ -149,6 +150,8 @@ struct _LinphoneChatMessage {
SalOp *op;
};
BELLE_SIP_DECLARE_VPTR(LinphoneChatMessage);
typedef struct StunCandidate{
char addr[64];
int port;
@ -862,7 +865,8 @@ BELLE_SIP_DECLARE_TYPES_BEGIN(linphone,10000)
BELLE_SIP_TYPE_ID(LinphoneContactSearch),
BELLE_SIP_TYPE_ID(LinphoneContactProvider),
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),
BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch)
BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch),
BELLE_SIP_TYPE_ID(LinphoneChatMessage)
BELLE_SIP_DECLARE_TYPES_END

View file

@ -270,6 +270,9 @@ void linphone_proxy_config_edit(LinphoneProxyConfig *obj){
if (obj->state == LinphoneRegistrationOk
|| obj->state == LinphoneRegistrationProgress) {
sal_unregister(obj->op);
} else {
/*stop refresher*/
if (obj->op) sal_op_stop_refreshing(obj->op);
}
}
}
@ -351,6 +354,9 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
linphone_proxy_config_set_state(obj,LinphoneRegistrationFailed,"Registration failed");
}
ms_free(proxy_string);
} else {
/*stop refresher, just in case*/
if (obj->op) sal_op_stop_refreshing(obj->op);
}
}
@ -359,7 +365,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
* This is useful if for example you resuming from suspend, thus IP address may have changed.
**/
void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj){
if (obj->reg_sendregister && obj->op){
if (obj->reg_sendregister && obj->op && obj->state!=LinphoneRegistrationProgress){
if (sal_register_refresh(obj->op,obj->expires) == 0) {
linphone_proxy_config_set_state(obj,LinphoneRegistrationProgress, "Refresh registration");
}
@ -1320,15 +1326,16 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
LinphoneCore *lc=cfg->lc;
bool_t update_friends=FALSE;
if (linphone_core_should_subscribe_friends_only_when_registered(lc)){
update_friends=(state==LinphoneRegistrationOk && cfg->state!=LinphoneRegistrationOk)
|| (state!=LinphoneRegistrationOk && cfg->state==LinphoneRegistrationOk);
}
ms_message("Proxy config [%p] for identity [%s] moving from state [%s] to [%s]" , cfg,
if (cfg->state!=state || state==LinphoneRegistrationOk) { /*allow multiple notification of LinphoneRegistrationOk for refreshing*/
ms_message("Proxy config [%p] for identity [%s] moving from state [%s] to [%s]" , cfg,
linphone_proxy_config_get_identity(cfg),
linphone_registration_state_to_string(cfg->state),
linphone_registration_state_to_string(state));
if (cfg->state!=state || state==LinphoneRegistrationOk) { /*allow multiple notification of LinphoneRegistrationOk for refreshing*/
if (linphone_core_should_subscribe_friends_only_when_registered(lc)){
update_friends=(state==LinphoneRegistrationOk && cfg->state!=LinphoneRegistrationOk)
|| (state!=LinphoneRegistrationOk && cfg->state==LinphoneRegistrationOk);
}
cfg->state=state;
if (update_friends){

View file

@ -62,10 +62,15 @@ static int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char*
fseek(f, 0, SEEK_SET);
char* provisioning = ms_malloc(fsize + 1);
fread(provisioning, fsize, 1, f);
if (fread(provisioning, fsize, 1, f)==0){
ms_error("Could not read xml provisioning file from %s",file_path);
status=-1;
}else{
linphone_remote_provisioning_apply(lc, provisioning);
status = 0;
}
ms_free(provisioning);
fclose(f);
linphone_remote_provisioning_apply(lc, provisioning);
status = 0;
} else {
ms_error("Couldn't open file %s for provisioning", file_path);
}

View file

@ -698,19 +698,19 @@ int linphone_core_update_upnp_audio_video(LinphoneCall *call, bool_t audio, bool
* Audio part
*/
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtp,
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->audio_port:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[0].rtp_port:0, UPNP_CALL_RETRY_DELAY);
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtcp,
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->audio_port+1:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[0].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
/*
* Video part
*/
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtp,
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->video_port:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[1].rtp_port:0, UPNP_CALL_RETRY_DELAY);
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtcp,
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->video_port+1:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[1].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
}
ms_mutex_unlock(&lupnp->mutex);

View file

@ -293,7 +293,10 @@ void linphone_gtk_call_log_update(GtkWidget *w){
#endif
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),addr);
if(lf != NULL){
display=linphone_address_get_display_name(linphone_friend_get_address(lf));
if ((display=linphone_address_get_display_name(linphone_friend_get_address(lf)))) {
/*update display name from friend*/
linphone_address_set_display_name(la,display);
}
} else {
display=linphone_address_get_display_name(la);
}
@ -302,9 +305,8 @@ void linphone_gtk_call_log_update(GtkWidget *w){
if (display==NULL){
display=linphone_address_get_domain (la);
}
} else {
linphone_address_set_display_name(la,display);
}
if (linphone_call_log_get_quality(cl)!=-1){
snprintf(quality,sizeof(quality),"%.1f",linphone_call_log_get_quality(cl));
}else snprintf(quality,sizeof(quality)-1,"%s",_("n/a"));

View file

@ -166,12 +166,12 @@ typedef struct SalIceRemoteCandidate {
#define SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN 256
#define SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN 256
#define SAL_SRTP_KEY_SIZE 41
/*sufficient for 256bit keys encoded in base 64*/
#define SAL_SRTP_KEY_SIZE 64
typedef struct SalSrtpCryptoAlgo {
unsigned int tag;
enum ortp_srtp_crypto_suite_t algo;
/* 41= 40 max(key_length for all algo) + '\0' */
char master_key[SAL_SRTP_KEY_SIZE];
} SalSrtpCryptoAlgo;

View file

@ -52,11 +52,6 @@ public interface LinphoneChatMessage {
}
}
long getNativePtr();
Object getUserData();
void setUserData();
/**
* get text associated to this LinphoneChatMessage

View file

@ -28,7 +28,7 @@ import org.linphone.core.LinphoneCore.RemoteProvisioningState;
public interface LinphoneCoreListener {
/**< Ask the application some authentication information
* @return */
void authInfoRequested(LinphoneCore lc,String realm,String username);
void authInfoRequested(LinphoneCore lc, String realm, String username, String Domain);
/** General State notification
* @param state LinphoneCore.State

View file

@ -8,7 +8,7 @@ public enum SubscriptionState {
/**
* An outgoing subcription was created.
*/
OutoingInit(1),
OutoingProgress(1),
/**
* An incoming subcription is received.
*/
@ -41,7 +41,7 @@ public enum SubscriptionState {
static protected SubscriptionState fromInt(int value) throws LinphoneCoreException{
switch(value){
case 0: return None;
case 1: return OutoingInit;
case 1: return OutoingProgress;
case 2: return IncomingReceived;
case 3: return Pending;
case 4: return Active;

View file

@ -2,7 +2,6 @@ package org.linphone.core;
public class LinphoneChatMessageImpl implements LinphoneChatMessage {
protected final long nativePtr;
private native void setUserData(long ptr);
private native String getText(long ptr);
private native long getPeerAddress(long ptr);
private native String getExternalBodyUrl(long ptr);
@ -14,27 +13,16 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage {
private native boolean isOutgoing(long ptr);
private native void store(long ptr);
private native int getStorageId(long ptr);
private native void unref(long ptr);
protected LinphoneChatMessageImpl(long aNativePtr) {
nativePtr = aNativePtr;
setUserData();
}
public long getNativePtr() {
return nativePtr;
}
@Override
public Object getUserData() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setUserData() {
setUserData(nativePtr);
}
@Override
public String getText() {
return getText(nativePtr);
@ -97,12 +85,15 @@ public class LinphoneChatMessageImpl implements LinphoneChatMessage {
private native int getReason(long ptr);
public Reason getReason() {
return Reason.fromInt(getReason(nativePtr));
}
private native long getErrorInfo(long nativePtr);
@Override
public ErrorInfo getErrorInfo() {
return new ErrorInfoImpl(getErrorInfo(nativePtr));
}
public Reason getReason() {
return Reason.fromInt(getReason(nativePtr));
}
private native long getErrorInfo(long nativePtr);
@Override
public ErrorInfo getErrorInfo() {
return new ErrorInfoImpl(getErrorInfo(nativePtr));
}
protected void finalize(){
unref(nativePtr);
}
}

View file

@ -26,7 +26,7 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
private native long createLinphoneChatMessage(long ptr, String message);
private native long getPeerAddress(long ptr);
private native void sendMessage(long ptr, String message);
private native void sendMessage2(long ptr, long message, StateListener listener);
private native void sendMessage2(long ptr, Object msg, long messagePtr, StateListener listener);
private native long[] getHistory(long ptr, int limit);
private native void destroy(long ptr);
private native int getUnreadMessagesCount(long ptr);
@ -54,7 +54,7 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
@Override
public void sendMessage(LinphoneChatMessage message, StateListener listener) {
sendMessage2(nativePtr, message.getNativePtr(), listener);
sendMessage2(nativePtr, message, ((LinphoneChatMessageImpl)message).getNativePtr(), listener);
}
@Override
@ -104,12 +104,12 @@ class LinphoneChatRoomImpl implements LinphoneChatRoom {
public void deleteMessage(LinphoneChatMessage message) {
if (message != null)
deleteMessage(nativePtr, message.getNativePtr());
deleteMessage(nativePtr, ((LinphoneChatMessageImpl)message).getNativePtr());
}
public void updateUrl(LinphoneChatMessage message) {
if (message != null)
updateUrl(nativePtr, message.getNativePtr());
updateUrl(nativePtr, ((LinphoneChatMessageImpl)message).getNativePtr());
}
@Override

View file

@ -192,7 +192,7 @@ class LinphoneCoreImpl implements LinphoneCore {
isValid();
long lNativePtr = getDefaultProxyConfig(nativePtr);
if (lNativePtr!=0) {
return new LinphoneProxyConfigImpl(lNativePtr);
return new LinphoneProxyConfigImpl(this,lNativePtr);
} else {
return null;
}
@ -218,10 +218,12 @@ class LinphoneCoreImpl implements LinphoneCore {
if (addProxyConfig(proxyCfg,nativePtr,((LinphoneProxyConfigImpl)proxyCfg).nativePtr) !=0) {
throw new LinphoneCoreException("bad proxy config");
}
((LinphoneProxyConfigImpl)proxyCfg).mCore=this;
}
public synchronized void removeProxyConfig(LinphoneProxyConfig proxyCfg) {
isValid();
removeProxyConfig(nativePtr, ((LinphoneProxyConfigImpl)proxyCfg).nativePtr);
((LinphoneProxyConfigImpl)proxyCfg).mCore=null;
}
public synchronized void clearAuthInfos() {
isValid();
@ -517,7 +519,7 @@ class LinphoneCoreImpl implements LinphoneCore {
LinphoneProxyConfig[] proxies = new LinphoneProxyConfig[typesPtr.length];
for (int i=0; i < proxies.length; i++) {
proxies[i] = new LinphoneProxyConfigImpl(typesPtr[i]);
proxies[i] = new LinphoneProxyConfigImpl(this,typesPtr[i]);
}
return proxies;
@ -1137,7 +1139,7 @@ class LinphoneCoreImpl implements LinphoneCore {
}
@Override
public synchronized LinphoneProxyConfig createProxyConfig() {
return new LinphoneProxyConfigImpl(createProxyConfig(nativePtr));
return new LinphoneProxyConfigImpl(this,createProxyConfig(nativePtr));
}
@Override
public synchronized void setCallErrorTone(Reason reason, String path) {

View file

@ -27,6 +27,7 @@ import org.linphone.core.LinphoneCore.RegistrationState;
class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
protected final long nativePtr;
protected LinphoneCoreImpl mCore;
private native int getState(long nativePtr);
private native void setExpires(long nativePtr, int delay);
@ -41,9 +42,10 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
enableRegister(enableRegister);
ownPtr=true;
}
protected LinphoneProxyConfigImpl(long aNativePtr) {
protected LinphoneProxyConfigImpl(LinphoneCoreImpl core, long aNativePtr) {
nativePtr = aNativePtr;
ownPtr=false;
mCore=core;
}
protected void finalize() throws Throwable {
//Log.e(LinphoneService.TAG,"fixme, should release underlying proxy config");
@ -90,11 +92,17 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
}
public void done() {
done(nativePtr);
Object mutex=mCore!=null ? mCore : this;
synchronized(mutex){
done(nativePtr);
}
}
public LinphoneProxyConfig edit() {
edit(nativePtr);
Object mutex=mCore!=null ? mCore : this;
synchronized(mutex){
edit(nativePtr);
}
return this;
}

View file

@ -2,8 +2,6 @@
./bin/libspeex-1.dll
./bin/libspeexdsp-1.dll
./bin/avutil-51.dll
./bin/libeay32.dll
./bin/ssleay32.dll
./bin/libbellesip-0.dll
./bin/libantlr3c.dll
./lib/libpolarssl.dll
@ -17,5 +15,5 @@
./bin/libgnutls-26.dll
./bin/libtasn1-3.dll
./bin/libsqlite3-0.dll
./bin/zrtpcppcore.dll
./bin/libopus-0.dll
./bin/libbzrtp-0.dll

@ -1 +1 @@
Subproject commit da5d1de606699162f48751f006d9219321069545
Subproject commit 13d0cee33672690daca1a7252c9f3a7022da95bd

2
oRTP

@ -1 +1 @@
Subproject commit f71c3aa0dec5267bc78d22d33282661dc8795be5
Subproject commit 209d1bbe764d4639860bf5f075ebf404d08e8dde

View file

@ -355,7 +355,7 @@ static void call_with_dns_time_out(void) {
linphone_core_set_sip_transports(marie->lc,&transport);
linphone_core_iterate(marie->lc);
sal_set_dns_timeout(marie->lc->sal,0);
linphone_core_invite(marie->lc,"sip:toto@toto.com");
linphone_core_invite(marie->lc,"\"t\x8et\x8e\" sip:toto@toto.com"); /*just to use non ascii values*/
for(i=0;i<10;i++){
ms_usleep(200000);
linphone_core_iterate(marie->lc);
@ -1155,6 +1155,7 @@ static void encrypted_call(LinphoneMediaEncryption mode) {
CU_ASSERT_STRING_EQUAL(linphone_call_get_authentication_token(linphone_core_get_current_call(pauline->lc))
,linphone_call_get_authentication_token(linphone_core_get_current_call(marie->lc)));
}
liblinphone_tester_check_rtcp(pauline,marie);
/*just to sleep*/
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
@ -1165,13 +1166,14 @@ static void encrypted_call(LinphoneMediaEncryption mode) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void srtp_call(LinphoneMediaEncryptionSRTP) {
static void srtp_call() {
encrypted_call(LinphoneMediaEncryptionSRTP);
}
/*
* futur work
static void zrtp_call(LinphoneMediaEncryptionSRTP) {
* future work
static void zrtp_call() {
encrypted_call(LinphoneMediaEncryptionZRTP);
}*/

View file

@ -97,7 +97,11 @@ void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, Linphon
stats* counters = get_stats(lc);
switch(state){
case LinphonePublishProgress: counters->number_of_LinphonePublishProgress++; break;
case LinphonePublishOk: counters->number_of_LinphonePublishOk++; break;
case LinphonePublishOk:
/*make sure custom header access API is working*/
CU_ASSERT_PTR_NOT_NULL(linphone_event_get_custom_header(ev,"From"));
counters->number_of_LinphonePublishOk++;
break;
case LinphonePublishError: counters->number_of_LinphonePublishError++; break;
case LinphonePublishExpiring: counters->number_of_LinphonePublishExpiring++; break;
case LinphonePublishCleared: counters->number_of_LinphonePublishCleared++;break;
@ -284,7 +288,7 @@ static void subscribe_test_manually_refreshed(void){
subscribe_test_with_args(TRUE,ManualRefresh);
}
static void publish_test_with_args(bool_t refresh){
static void publish_test_with_args(bool_t refresh, int expires){
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneContent content={0};
@ -300,24 +304,26 @@ static void publish_test_with_args(bool_t refresh){
lp_config_set_int(marie->lc->config,"sip","refresh_generic_publish",refresh);
lev=linphone_core_publish(marie->lc,pauline->identity,"dodo",5,&content);
lev=linphone_core_create_publish(marie->lc,pauline->identity,"dodo",expires);
linphone_event_add_custom_header(lev,"CustomHeader","someValue");
linphone_event_send_publish(lev,&content);
linphone_event_ref(lev);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
if (!refresh){
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishExpiring,1,5000));
linphone_event_update_publish(lev,&content);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
}else{
}
linphone_event_terminate(lev);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishCleared,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishCleared,1,3000));
linphone_event_unref(lev);
@ -326,11 +332,15 @@ static void publish_test_with_args(bool_t refresh){
}
static void publish_test(){
publish_test_with_args(TRUE);
publish_test_with_args(TRUE,5);
}
static void publish_no_auto_test(){
publish_test_with_args(FALSE);
publish_test_with_args(FALSE,5);
}
static void publish_without_expires(){
publish_test_with_args(TRUE,-1);
}
test_t event_tests[] = {
@ -341,6 +351,7 @@ test_t event_tests[] = {
{ "Subscribe manually refreshed", subscribe_test_manually_refreshed },
{ "Subscribe terminated by notifier", subscribe_test_terminated_by_notifier },
{ "Publish", publish_test },
{ "Publish without expires", publish_without_expires },
{ "Publish without automatic refresh",publish_no_auto_test }
};

View file

@ -43,8 +43,8 @@ void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMess
counters = get_stats(lc);
counters->number_of_LinphoneMessageReceived++;
if (linphone_chat_message_get_external_body_url(message)) {
counters->number_of_LinphoneMessageExtBodyReceived++;
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_external_body_url(message),message_external_body_url);
counters->number_of_LinphoneMessageExtBodyReceived++;
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_external_body_url(message),message_external_body_url);
}
}

View file

@ -332,8 +332,7 @@ static void authenticated_register_with_wrong_late_credentials(){
linphone_core_manager_destroy(mgr);
}
static void authenticated_register_with_wrong_credentials_with_params(const char* user_agent) {
LinphoneCoreManager *mgr;
static void authenticated_register_with_wrong_credentials_with_params_base(const char* user_agent,LinphoneCoreManager *mgr) {
stats* counters;
LCSipTransports transport = {5070,5070,0,5071};
LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,"wrong passwd",NULL,auth_domain,NULL); /*create authentication structure from identity*/
@ -341,8 +340,6 @@ static void authenticated_register_with_wrong_credentials_with_params(const char
sprintf(route,"sip:%s",test_route);
mgr=linphone_core_manager_new(NULL);
mgr->lc->vtable.auth_info_requested=auth_info_requested2;
sal_set_refresher_retry_after(mgr->lc->sal,500);
@ -372,11 +369,33 @@ static void authenticated_register_with_wrong_credentials_with_params(const char
}
}
}
static void authenticated_register_with_wrong_credentials_with_params(const char* user_agent) {
LinphoneCoreManager *mgr = linphone_core_manager_new(NULL);
authenticated_register_with_wrong_credentials_with_params_base(user_agent,mgr);
linphone_core_manager_destroy(mgr);
}
static void authenticated_register_with_wrong_credentials() {
authenticated_register_with_wrong_credentials_with_params(NULL);
}
static void authenticated_register_with_wrong_credentials_2() {
LinphoneCoreManager *mgr = linphone_core_manager_new(NULL);
stats* counters = get_stats(mgr->lc);
int current_in_progress;
LinphoneProxyConfig* proxy;
authenticated_register_with_wrong_credentials_with_params_base(NULL,mgr);
linphone_core_get_default_proxy(mgr->lc,&proxy);
/*Make sure registration attempts are stopped*/
linphone_proxy_config_edit(proxy);
linphone_proxy_config_enable_register(proxy,FALSE);
linphone_proxy_config_done(proxy);
current_in_progress=counters->number_of_LinphoneRegistrationProgress;
CU_ASSERT_FALSE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationProgress,current_in_progress+1));
linphone_core_manager_destroy(mgr);
}
static void authenticated_register_with_wrong_credentials_without_403() {
authenticated_register_with_wrong_credentials_with_params("tester-no-403");
}
@ -548,11 +567,17 @@ static void io_recv_error_without_active_register(){
for (proxys=ms_list_copy(linphone_core_get_proxy_config_list(lc));proxys!=NULL;proxys=proxys->next) {
LinphoneProxyConfig* proxy_cfg=(LinphoneProxyConfig*)proxys->data;
linphone_proxy_config_edit(proxy_cfg);
}
ms_list_free(proxys);
/*wait for unregistrations*/
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/));
for (proxys=ms_list_copy(linphone_core_get_proxy_config_list(lc));proxys!=NULL;proxys=proxys->next) {
LinphoneProxyConfig* proxy_cfg=(LinphoneProxyConfig*)proxys->data;
linphone_proxy_config_enable_register(proxy_cfg,FALSE);
linphone_proxy_config_done(proxy_cfg);
}
ms_list_free(proxys);
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/));
sal_set_recv_error(lc->sal, 0);
@ -655,6 +680,7 @@ test_t register_tests[] = {
{ "Ha1 authenticated register", ha1_authenticated_register },
{ "Digest auth without initial credentials", authenticated_register_with_no_initial_credentials },
{ "Digest auth with wrong credentials", authenticated_register_with_wrong_credentials },
{ "Digest auth with wrong credentials, check if registration attempts are stopped", authenticated_register_with_wrong_credentials_2 },
{ "Digest auth with wrong credentials without 403", authenticated_register_with_wrong_credentials_without_403},
{ "Authenticated register with wrong late credentials", authenticated_register_with_wrong_late_credentials},
{ "Authenticated register with late credentials", authenticated_register_with_late_credentials },

View file

@ -1,19 +1,19 @@
/*
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
@ -72,7 +72,7 @@ static void linphone_interpret_url_test()
LinphoneCore* lc;
const char* sips_address = "sips:margaux@sip.linphone.org";
LinphoneAddress* address;
memset ( &v_table,0,sizeof ( v_table ) );
lc = linphone_core_new ( &v_table,NULL,NULL,NULL );
CU_ASSERT_PTR_NOT_NULL_FATAL ( lc );
@ -89,12 +89,29 @@ static void linphone_interpret_url_test()
linphone_core_destroy ( lc );
}
static void linphone_lpconfig_from_buffer(){
static const char* buffer = "[buffer]\ntest=ok";
static const char* buffer_linebreaks = "[buffer_linebreaks]\n\n\n\r\n\n\r\ntest=ok";
LpConfig* conf;
conf = lp_config_new_from_buffer(buffer);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer","test",""),"ok");
lp_config_destroy(conf);
conf = lp_config_new_from_buffer(buffer_linebreaks);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer_linebreaks","test",""),"ok");
lp_config_destroy(conf);
}
test_t setup_tests[] = {
{ "Linphone Address", linphone_address_test },
{ "Linphone core init/uninit", core_init_test },
{ "Linphone random transport port",core_sip_transport_test},
{ "Linphone interpret url", linphone_interpret_url_test }
{ "Linphone interpret url", linphone_interpret_url_test },
{ "LPConfig from buffer", linphone_lpconfig_from_buffer }
};
test_suite_t setup_test_suite = {

View file

@ -216,7 +216,7 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_f
proxy_count=0;
if (proxy_count)
wait_for_until(mgr->lc,NULL,&mgr->stat.number_of_LinphoneRegistrationOk,proxy_count,3000*proxy_count);
wait_for_until(mgr->lc,NULL,&mgr->stat.number_of_LinphoneRegistrationOk,proxy_count,5000*proxy_count);
CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationOk,proxy_count);
enable_codec(mgr->lc,"PCMU",8000);