Merge branch 'master' of git.linphone.org:linphone into dev_python

This commit is contained in:
Ghislain MARY 2014-07-15 14:21:59 +02:00
commit c463401839
11 changed files with 198 additions and 25 deletions

View file

@ -132,7 +132,9 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
char *content_type=belle_sip_strdup_printf("%s/%s", msg->file_transfer_information->type, msg->file_transfer_information->subtype);
/* create a user body handler to take care of the file */
belle_sip_user_body_handler_t *first_part_bh=belle_sip_user_body_handler_new(msg->file_transfer_information->size+linphone_chat_message_compute_filepart_header_size(msg->file_transfer_information->name, content_type), NULL, NULL, linphone_chat_message_file_transfer_on_send_body, msg);
size_t body_size = msg->file_transfer_information->size+linphone_chat_message_compute_filepart_header_size(msg->file_transfer_information->name, content_type);
belle_sip_user_body_handler_t *first_part_bh=belle_sip_user_body_handler_new(body_size,NULL,NULL,linphone_chat_message_file_transfer_on_send_body,msg);
/* insert it in a multipart body handler which will manage the boundaries of multipart message */
belle_sip_multipart_body_handler_t *bh=belle_sip_multipart_body_handler_new(linphone_chat_message_file_transfer_on_progress, msg, (belle_sip_body_handler_t *)first_part_bh);
@ -959,10 +961,33 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
lc->vtable.file_transfer_received(lc, chatMsg, chatMsg->file_transfer_information, (char *)buffer, size);
}
return;
/* feed the callback with the received data */
}
static LinphoneContent* linphone_chat_create_file_transfer_information_from_headers(const belle_sip_message_t* message ){
LinphoneContent *content = ms_malloc0(sizeof(LinphoneContent));
belle_sip_header_content_length_t* content_length_hdr = BELLE_SIP_HEADER_CONTENT_LENGTH(belle_sip_message_get_header(message, "Content-Length"));
belle_sip_header_content_type_t* content_type_hdr = BELLE_SIP_HEADER_CONTENT_TYPE(belle_sip_message_get_header(message, "Content-Type"));
const char* type = NULL,*subtype = NULL;
content->name = ms_strdup("");
if( content_type_hdr ){
type = belle_sip_header_content_type_get_type(content_type_hdr);
subtype = belle_sip_header_content_type_get_subtype(content_type_hdr);
ms_message("Extracted content type %s / %s from header", type?type:"", subtype?subtype:"");
if( type ) content->type = ms_strdup(type);
if( subtype ) content->type = ms_strdup(subtype);
}
if( content_length_hdr ){
content->size = belle_sip_header_content_length_get_content_length(content_length_hdr);
ms_message("Extracted content length %i from header", (int)content->size);
}
return content;
}
static void linphone_chat_process_response_headers_from_get_file(void *data, const belle_http_response_event_t *event){
@ -970,9 +995,21 @@ static void linphone_chat_process_response_headers_from_get_file(void *data, con
/*we are receiving a response, set a specific body handler to acquire the response.
* if not done, belle-sip will create a memory body handler, the default*/
LinphoneChatMessage *message=(LinphoneChatMessage *)belle_sip_object_data_get(BELLE_SIP_OBJECT(event->request),"message");
belle_sip_message_t* response = BELLE_SIP_MESSAGE(event->response);
size_t body_size = 0;
if( message->file_transfer_information == NULL ){
ms_warning("No file transfer information for message %p: creating...", message);
message->file_transfer_information = linphone_chat_create_file_transfer_information_from_headers(response);
}
if( message->file_transfer_information ){
body_size = message->file_transfer_information->size;
}
belle_sip_message_set_body_handler(
(belle_sip_message_t*)event->response,
(belle_sip_body_handler_t*)belle_sip_user_body_handler_new(message->file_transfer_information->size, linphone_chat_message_file_transfer_on_progress,on_recv_body,NULL,message)
(belle_sip_body_handler_t*)belle_sip_user_body_handler_new(body_size, linphone_chat_message_file_transfer_on_progress,on_recv_body,NULL,message)
);
}
}

View file

@ -756,6 +756,7 @@ static void sip_config_read(LinphoneCore *lc)
sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
sal_enable_sip_update_method(lc->sal,lp_config_get_int(lc->config,"sip","sip_update",1));
lc->sip_conf.vfu_with_info=lp_config_get_int(lc->config,"sip","vfu_with_info",1);
linphone_core_set_sip_transport_timeout(lc, lp_config_get_int(lc->config, "sip", "transport_timeout", 63000));
}
static void rtp_config_read(LinphoneCore *lc)
@ -1115,6 +1116,16 @@ void linphone_core_set_upload_bandwidth(LinphoneCore *lc, int bw){
if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"net","upload_bw",bw);
}
void linphone_core_set_sip_transport_timeout(LinphoneCore *lc, int timeout_ms) {
sal_set_transport_timeout(lc->sal, timeout_ms);
if (linphone_core_ready(lc))
lp_config_set_int(lc->config, "sip", "transport_timeout", timeout_ms);
}
int linphone_core_get_sip_transport_timeout(LinphoneCore *lc) {
return sal_get_transport_timeout(lc->sal);
}
void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable) {
sal_enable_dns_srv(lc->sal, enable);
if (linphone_core_ready(lc))

View file

@ -1811,6 +1811,22 @@ LINPHONE_PUBLIC void linphone_core_set_upload_ptime(LinphoneCore *lc, int ptime)
LINPHONE_PUBLIC int linphone_core_get_upload_ptime(LinphoneCore *lc);
/**
* Set the SIP transport timeout.
* @param[in] lc #LinphoneCore object.
* @param[in] timeout_ms The SIP transport timeout in milliseconds.
* @ingroup media_parameters
*/
void linphone_core_set_sip_transport_timeout(LinphoneCore *lc, int timeout_ms);
/**
* Get the SIP transport timeout.
* @param[in] lc #LinphoneCore object.
* @return The SIP transport timeout in milliseconds.
* @ingroup media_parameters
*/
int linphone_core_get_sip_transport_timeout(LinphoneCore *lc);
/**
* Enable or disable DNS SRV resolution.
* @param[in] lc #LinphoneCore object.

View file

@ -1482,12 +1482,11 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_needsEchoCalibration
const char *card=linphone_core_get_capture_device((LinphoneCore*)lc);
sndcard=ms_snd_card_manager_get_card(m,card);
if (sndcard == NULL){
ms_error("Could not get soundcard.");
ms_error("Could not get soundcard %s", card);
return TRUE;
}
if (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER) return FALSE;
if (ms_snd_card_get_minimal_latency(sndcard)==0) return TRUE;
return FALSE;
return TRUE;
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getMediaEncryption(JNIEnv* env
@ -2994,6 +2993,37 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getAvpfRRI
return (jint)linphone_proxy_config_get_avpf_rr_interval((LinphoneProxyConfig *)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_enableQualityReporting(JNIEnv *env, jobject thiz, jlong ptr, jboolean enable) {
linphone_proxy_config_enable_quality_reporting((LinphoneProxyConfig *)ptr, (bool)enable);
}
JNIEXPORT jboolean JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_quality_reportingEnabled(JNIEnv *env, jobject thiz, jlong ptr) {
return linphone_proxy_config_quality_reporting_enabled((LinphoneProxyConfig *)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setQualityReportingInterval(JNIEnv *env, jobject thiz, jlong ptr, jint interval) {
linphone_proxy_config_set_quality_reporting_interval((LinphoneProxyConfig *)ptr, (uint8_t)interval);
}
JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQualityReportingInterval(JNIEnv *env, jobject thiz, jlong ptr) {
return (jint)linphone_proxy_config_get_quality_reporting_interval((LinphoneProxyConfig *)ptr);
}
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_setQualityReportingCollector(JNIEnv *env, jobject thiz, jlong ptr, jstring jcollector) {
if (jcollector){
const char *collector=env->GetStringUTFChars(jcollector, NULL);
linphone_proxy_config_set_quality_reporting_collector((LinphoneProxyConfig *)ptr, collector);
env->ReleaseStringUTFChars(jcollector,collector);
}
}
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneProxyConfigImpl_getQualityReportingCollector(JNIEnv *env, jobject thiz, jlong ptr) {
jstring jvalue = env->NewStringUTF(linphone_proxy_config_get_quality_reporting_collector((LinphoneProxyConfig *)ptr));
return jvalue;
}
extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) {
return (jint)linphone_call_get_duration((LinphoneCall *) ptr);
}

View file

@ -752,7 +752,7 @@ LINPHONE_PUBLIC void linphone_presence_model_set_user_data(LinphonePresenceModel
* @param[in] model The #LinphonePresenceModel object for which to get the user data.
* @return A pointer to the user data.
*/
LINPHONE_PUBLIC void * linphone_presence_model_get_user_data(LinphonePresenceModel *model);
LINPHONE_PUBLIC void * linphone_presence_model_get_user_data(const LinphonePresenceModel *model);
/**
* Increase the reference count of the #LinphonePresenceService object.
@ -780,7 +780,7 @@ LINPHONE_PUBLIC void linphone_presence_service_set_user_data(LinphonePresenceSer
* @param[in] service The #LinphonePresenceService object for which to get the user data.
* @return A pointer to the user data.
*/
LINPHONE_PUBLIC void * linphone_presence_service_get_user_data(LinphonePresenceService *service);
LINPHONE_PUBLIC void * linphone_presence_service_get_user_data(const LinphonePresenceService *service);
/**
* Increase the reference count of the #LinphonePresencePerson object.
@ -808,7 +808,7 @@ LINPHONE_PUBLIC void linphone_presence_person_set_user_data(LinphonePresencePers
* @param[in] person The #LinphonePresencePerson object for which to get the user data.
* @return A pointer to the user data.
*/
LINPHONE_PUBLIC void * linphone_presence_person_get_user_data(LinphonePresencePerson *person);
LINPHONE_PUBLIC void * linphone_presence_person_get_user_data(const LinphonePresencePerson *person);
/**
* Increase the reference count of the #LinphonePresenceActivity object.
@ -836,7 +836,7 @@ LINPHONE_PUBLIC void linphone_presence_activity_set_user_data(LinphonePresenceAc
* @param[in] activity The #LinphonePresenceActivity object for which to get the user data.
* @return A pointer to the user data.
*/
LINPHONE_PUBLIC void * linphone_presence_activity_get_user_data(LinphonePresenceActivity *activity);
LINPHONE_PUBLIC void * linphone_presence_activity_get_user_data(const LinphonePresenceActivity *activity);
/**
* Increase the reference count of the #LinphonePresenceNote object.
@ -864,7 +864,7 @@ LINPHONE_PUBLIC void linphone_presence_note_set_user_data(LinphonePresenceNote *
* @param[in] note The #LinphonePresenceNote object for which to get the user data.
* @return A pointer to the user data.
*/
LINPHONE_PUBLIC void * linphone_presence_note_get_user_data(LinphonePresenceNote *note);
LINPHONE_PUBLIC void * linphone_presence_note_get_user_data(const LinphonePresenceNote *note);
/*****************************************************************************

View file

@ -1043,7 +1043,7 @@ void linphone_presence_model_set_user_data(LinphonePresenceModel *model, void *u
model->user_data = user_data;
}
void * linphone_presence_model_get_user_data(LinphonePresenceModel *model) {
void * linphone_presence_model_get_user_data(const LinphonePresenceModel *model) {
return model->user_data;
}
@ -1065,7 +1065,7 @@ void linphone_presence_service_set_user_data(LinphonePresenceService *service, v
service->user_data = user_data;
}
void * linphone_presence_service_get_user_data(LinphonePresenceService *service) {
void * linphone_presence_service_get_user_data(const LinphonePresenceService *service) {
return service->user_data;
}
@ -1087,7 +1087,7 @@ void linphone_presence_person_set_user_data(LinphonePresencePerson *person, void
person->user_data = user_data;
}
void * linphone_presence_person_get_user_data(LinphonePresencePerson *person) {
void * linphone_presence_person_get_user_data(const LinphonePresencePerson *person) {
return person->user_data;
}
@ -1109,7 +1109,7 @@ void linphone_presence_activity_set_user_data(LinphonePresenceActivity *activity
activity->user_data = user_data;
}
void * linphone_presence_activity_get_user_data(LinphonePresenceActivity *activity) {
void * linphone_presence_activity_get_user_data(const LinphonePresenceActivity *activity) {
return activity->user_data;
}
@ -1131,7 +1131,7 @@ void linphone_presence_note_set_user_data(LinphonePresenceNote *note, void *user
note->user_data = user_data;
}
void * linphone_presence_note_get_user_data(LinphonePresenceNote *note) {
void * linphone_presence_note_get_user_data(const LinphonePresenceNote *note) {
return note->user_data;
}

View file

@ -275,13 +275,13 @@ int linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route)
bool_t linphone_proxy_config_check(LinphoneCore *lc, LinphoneProxyConfig *obj){
if (obj->reg_proxy==NULL){
if (lc->vtable.display_warning)
if (lc && lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("The sip proxy address you entered is invalid, it must start with \"sip:\""
" followed by a hostname."));
return FALSE;
}
if (obj->reg_identity==NULL){
if (lc->vtable.display_warning)
if (lc && lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("The sip identity you entered is invalid.\nIt should look like "
"sip:username@proxydomain, such as sip:alice@example.net"));
return FALSE;

View file

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

View file

@ -304,4 +304,44 @@ class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
public ErrorInfo getErrorInfo() {
return new ErrorInfoImpl(getErrorInfo(nativePtr));
}
private native void enableQualityReporting(long nativePtr, boolean enable);
@Override
public void enableQualityReporting(boolean enable) {
isValid();
enableQualityReporting(nativePtr, enable);
}
private native boolean qualityReportingEnabled(long nativePtr);
@Override
public boolean qualityReportingEnabled() {
isValid();
return avpfEnabled(nativePtr);
}
private native void setQualityReportingInterval(long nativePtr, int interval);
@Override
public void setQualityReportingInterval(int interval) {
isValid();
setQualityReportingInterval(nativePtr, interval);
}
private native int getQualityReportingInterval(long nativePtr);
@Override
public int getQualityReportingInterval() {
isValid();
return getQualityReportingInterval(nativePtr);
}
private native void setQualityReportingCollector(long nativePtr, String collector);
@Override
public void setQualityReportingCollector(String collector) {
isValid();
setQualityReportingCollector(nativePtr, collector);
}
private native String getQualityReportingCollector(long nativePtr);
@Override
public String getQualityReportingCollector() {
isValid();
return getQualityReportingCollector(nativePtr);
}
}

@ -1 +1 @@
Subproject commit 6155d6437712ac049be34b73ddc51a85d62c9f9b
Subproject commit b40af312e90b6c91bbee360f430ed87fa26119e9

View file

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