Merge remote-tracking branch 'linphone/master'

This commit is contained in:
Simon Morlat 2012-12-04 10:37:09 +01:00
commit 48fd03b536
23 changed files with 799 additions and 156 deletions

View file

@ -28,7 +28,7 @@ You need:
- Install zrtpcpp (optional), for unbreakable call encryption
$ port install cmake
$ git clone git://git.linphone.org/zrtpcpp.git
$ cd zrtpcpp && cmake -Denable_ccrtp=false . && make
$ cd zrtpcpp && cmake -Denable-ccrtp=false . && make
$ sudo make install
- Install gtk. It is recommended to use the quartz backend for better integration.

View file

@ -117,6 +117,9 @@ make_gitversion_h:
else \
$(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \
fi
if test ! -f $(srcdir)/$(GITVERSION_FILE) ; then \
cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
fi
if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \
cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
fi

View file

@ -779,14 +779,35 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){
}
}
static void text_received(Sal *sal, const char *from, const char *msg){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal);
linphone_core_message_received(lc,from,msg,NULL);
static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){
MSList *elem=lc->last_recv_msg_ids;
MSList *tail=NULL;
int i;
bool_t is_duplicate=FALSE;
for(i=0;elem!=NULL;elem=elem->next,i++){
if (strcmp((const char*)elem->data,msg_id)==0){
is_duplicate=TRUE;
}
tail=elem;
}
if (!is_duplicate){
lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id));
}
if (i>=10){
ms_free(tail->data);
lc->last_recv_msg_ids=ms_list_remove_link(lc->last_recv_msg_ids,tail);
}
return is_duplicate;
}
void message_external_body_received(Sal *sal, const char *from, const char *url) {
static void text_received(Sal *sal, const SalMessage *msg){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal);
linphone_core_message_received(lc,from,NULL,url);
if (is_duplicate_msg(lc,msg->message_id)==FALSE){
linphone_core_message_received(lc,msg->from,msg->text,msg->url);
}
}
static void notify(SalOp *op, const char *from, const char *msg){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer (op);
@ -902,7 +923,6 @@ SalCallbacks linphone_sal_callbacks={
dtmf_received,
refer_received,
text_received,
message_external_body_received,
text_delivery_update,
notify,
notify_presence,

View file

@ -28,6 +28,12 @@
#include "mediastreamer2/msvolume.h"
/**
* @addtogroup conferencing
* @{
**/
static int convert_conference_to_call(LinphoneCore *lc);
static void conference_check_init(LinphoneConference *ctx, int samplerate){
@ -131,6 +137,11 @@ static void add_local_endpoint(LinphoneConference *conf,LinphoneCore *lc){
}
/**
* Returns the sound volume (mic input) of the local participant of the conference.
* @param lc the linphone core
* @returns the measured input volume expressed in dbm0.
**/
float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){
LinphoneConference *conf=&lc->conf_ctx;
AudioStream *st=conf->local_participant;
@ -143,6 +154,16 @@ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){
return LINPHONE_VOLUME_DB_LOWEST;
}
/**
* Merge a call into a conference.
* @param lc the linphone core
* @param call an established call, either in LinphoneCallStreamsRunning or LinphoneCallPaused state.
*
* If this is the first call that enters the conference, the virtual conference will be created automatically.
* If the local user was actively part of the call (ie not in paused state), then the local user is automatically entered into the conference.
*
* @returns 0 if successful, -1 otherwise.
**/
int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){
LinphoneCallParams params;
LinphoneConference *conf=&lc->conf_ctx;
@ -229,7 +250,18 @@ static int convert_conference_to_call(LinphoneCore *lc){
return err;
}
/**
* Remove a call from the conference.
* @param lc the linphone core
* @param call a call that has been previously merged into the conference.
*
* After removing the remote participant belonging to the supplied call, the call becomes a normal call in paused state.
* If one single remote participant is left alone in the conference after the removal, then it is
* automatically removed from the conference and put into a simple call, like before entering the conference.
* The conference's resources are then automatically destroyed.
*
* @returns 0 if successful, -1 otherwise.
**/
int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){
char * str=linphone_call_get_remote_address_as_string(call);
ms_message("Removing call %s from the conference", str);
@ -249,10 +281,21 @@ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){
return err;
}
/**
* Indicates whether the local participant is part of the conference.
* @param lc the linphone core
* @returns TRUE if the local participant is in the conference, FALSE otherwise.
**/
bool_t linphone_core_is_in_conference(const LinphoneCore *lc){
return lc->conf_ctx.local_participant!=NULL;
}
/**
* Moves the local participant out of the conference.
* @param lc the linphone core
* When the local participant is out of the conference, the remote participants can continue to talk normally.
* @returns 0 if successful, -1 otherwise.
**/
int linphone_core_leave_conference(LinphoneCore *lc){
LinphoneConference *conf=&lc->conf_ctx;
if (linphone_core_is_in_conference(lc))
@ -260,7 +303,17 @@ int linphone_core_leave_conference(LinphoneCore *lc){
return 0;
}
/**
* Moves the local participant inside the conference.
* @param lc the linphone core
*
* Makes the local participant to join the conference.
* Typically, the local participant is by default always part of the conference when joining an active call into a conference.
* However, by calling linphone_core_leave_conference() and linphone_core_enter_conference() the application can decide to temporarily
* move out and in the local participant from the conference.
*
* @returns 0 if successful, -1 otherwise
**/
int linphone_core_enter_conference(LinphoneCore *lc){
if (linphone_core_sound_resources_locked(lc)) {
return -1;
@ -273,6 +326,14 @@ int linphone_core_enter_conference(LinphoneCore *lc){
return 0;
}
/**
* Add all calls into a conference.
* @param lc the linphone core
*
* Merge all established calls (either in LinphoneCallStreamsRunning or LinphoneCallPaused) into a conference.
*
* @returns 0 if successful, -1 otherwise
**/
int linphone_core_add_all_to_conference(LinphoneCore *lc) {
MSList *calls=lc->calls;
while (calls) {
@ -286,6 +347,14 @@ int linphone_core_add_all_to_conference(LinphoneCore *lc) {
return 0;
}
/**
* Terminates the conference and the calls associated with it.
* @param lc the linphone core
*
* All the calls that were merged to the conference are terminated, and the conference resources are destroyed.
*
* @returns 0 if successful, -1 otherwise
**/
int linphone_core_terminate_conference(LinphoneCore *lc) {
MSList *calls=lc->calls;
while (calls) {
@ -298,9 +367,23 @@ int linphone_core_terminate_conference(LinphoneCore *lc) {
return 0;
}
/**
* Returns the number of participants to the conference, including the local participant.
* @param lc the linphone core
*
* Typically, after merging two calls into the conference, there is total of 3 participants:
* the local participant (or local user), and two remote participants that were the destinations of the two previously establised calls.
*
* @returns the number of participants to the conference
**/
int linphone_core_get_conference_size(LinphoneCore *lc) {
if (lc->conf_ctx.conf == NULL) {
return 0;
}
return ms_audio_conference_get_size(lc->conf_ctx.conf);
}
/**
* @}
**/

View file

@ -195,6 +195,27 @@ void text_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddre
* This api is useful for manipulating SIP addresses ('from' or 'to' headers).
**/
/**
* @defgroup conferencing Making an audio conference.
* This API allows to create a conference entirely managed by the client. No server capabilities are required.
* The way such conference is created is by doing the following:<br>
* The application shall makes "normal" calls to several destinations (using linphone_core_invite() ), one after another.
* While initiating the second call, the first one is automatically paused.
* Then, once the second call is established, the application has the possibility to merge the two calls to form a conference where each participant
* (the local participant, the remote destination of the first call, the remote destination of the second call) can talk together.
* This must be done by adding the two calls to the conference using \link linphone_call_add_to_conference() \endlink
*
* Once merged into a conference the LinphoneCall objects representing the calls that were established remain unchanged, except that
* they are tagged as part of the conference (see \link linphone_call_is_in_conference() \endlink ). The calls in a conference are in the LinphoneCallStreamsRunning state.
*
* Only a single conference can be created: the purpose of this feature is to allow the local user to create, take part and manage the conference.
* This API is not designed to create a conference server application.
*
* Up to 10 calls can be merged into the conference, however depending on the CPU usage required for doing the encoding/decoding of the streams of each participants,
* the effective limit can be lower.
*
**/
/**
* @defgroup misc Miscenalleous: logs, version strings, config storage
**/

View file

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "private.h"
#include <ortp/event.h>
#include <ortp/b64.h>
#include <math.h>
#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/msvolume.h"
@ -208,22 +208,21 @@ static void update_media_description_from_stun(SalMediaDescription *md, const St
}
static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, LinphoneCall *call, unsigned int session_id, unsigned int session_ver){
void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call){
MSList *l;
PayloadType *pt;
SalMediaDescription *old_md=call->localdesc;
int i;
const char *me=linphone_core_get_identity(lc);
LinphoneAddress *addr=linphone_address_new(me);
const char *username=linphone_address_get_username (addr);
SalMediaDescription *md=sal_media_description_new();
bool_t keep_srtp_keys=lp_config_get_int(lc->config,"sip","keep_srtp_keys",0);
if (call->ping_time>0) {
linphone_core_adapt_to_network(lc,call->ping_time,&call->params);
}
linphone_core_adapt_to_network(lc,call->ping_time,&call->params);
md->session_id=session_id;
md->session_ver=session_ver;
md->session_id=(old_md ? old_md->session_id : (rand() & 0xfff));
md->session_ver=(old_md ? (old_md->session_ver+1) : (rand() & 0xfff));
md->nstreams=1;
strncpy(md->addr,call->localip,sizeof(md->addr));
strncpy(md->username,username,sizeof(md->username));
@ -248,8 +247,6 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event"));
l=ms_list_append(l,pt);
md->streams[0].payloads=l;
if (call->params.has_video){
md->nstreams++;
@ -263,15 +260,22 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
for(i=0; i<md->nstreams; i++) {
if (md->streams[i].proto == SalProtoRtpSavp) {
md->streams[i].crypto[0].tag = 1;
md->streams[i].crypto[0].algo = AES_128_SHA1_80;
if (!generate_b64_crypto_key(30, md->streams[i].crypto[0].master_key))
md->streams[i].crypto[0].algo = 0;
md->streams[i].crypto[1].tag = 2;
md->streams[i].crypto[1].algo = AES_128_SHA1_32;
if (!generate_b64_crypto_key(30, md->streams[i].crypto[1].master_key))
md->streams[i].crypto[1].algo = 0;
md->streams[i].crypto[2].algo = 0;
if (keep_srtp_keys && old_md && old_md->streams[i].proto==SalProtoRtpSavp){
int j;
for(j=0;j<SAL_CRYPTO_ALGO_MAX;++j){
memcpy(&md->streams[i].crypto[j],&old_md->streams[i].crypto[j],sizeof(SalSrtpCryptoAlgo));
}
}else{
md->streams[i].crypto[0].tag = 1;
md->streams[i].crypto[0].algo = AES_128_SHA1_80;
if (!generate_b64_crypto_key(30, md->streams[i].crypto[0].master_key))
md->streams[i].crypto[0].algo = 0;
md->streams[i].crypto[1].tag = 2;
md->streams[i].crypto[1].algo = AES_128_SHA1_32;
if (!generate_b64_crypto_key(30, md->streams[i].crypto[1].master_key))
md->streams[i].crypto[1].algo = 0;
md->streams[i].crypto[2].algo = 0;
}
}
}
update_media_description_from_stun(md,&call->ac,&call->vc);
@ -280,22 +284,8 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
linphone_core_update_ice_state_in_call_stats(call);
}
linphone_address_destroy(addr);
return md;
}
void update_local_media_description(LinphoneCore *lc, LinphoneCall *call){
SalMediaDescription *md=call->localdesc;
if (md== NULL) {
call->localdesc = create_local_media_description(lc,call);
} else {
call->localdesc = _create_local_media_description(lc,call,md->session_id,md->session_ver+1);
sal_media_description_unref(md);
}
}
SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call){
unsigned int id=rand() & 0xfff;
return _create_local_media_description(lc,call,id,id);
call->localdesc=md;
if (old_md) sal_media_description_unref(old_md);
}
static int find_port_offset(LinphoneCore *lc, SalStreamType type){
@ -754,6 +744,11 @@ const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){
}else if (vsd){
cp->has_video=is_video_active(vsd);
}
if (!cp->has_video){
if (md->bandwidth>0 && md->bandwidth<=linphone_core_get_edge_bw(call->core)){
cp->low_bandwidth=TRUE;
}
}
return cp;
}
}
@ -933,9 +928,31 @@ const PayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallP
return cp->video_codec;
}
/**
* @ingroup call_control
* Use to know if this call has been configured in low bandwidth mode.
* This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file.
* An application that would have reliable way to know network capacity may not use activate_edge_workarounds=1 but instead manually configure
* low bandwidth mode with linphone_call_params_enable_low_bandwidth().
* <br> When enabled, this param may transform a call request with video in audio only mode.
* @return TRUE if low bandwidth has been configured/detected
*/
bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) {
return cp->low_bandwidth;
}
/**
* @ingroup call_control
* Indicate low bandwith mode.
* Configuring a call to low bandwidth mode will result in the core to activate several settings for the call in order to ensure that bitrate usage
* is lowered to the minimum possible. Typically, ptime (packetization time) will be increased, audio codec's output bitrate will be targetted to 20kbit/s provided
* that it is achievable by the codec selected after SDP handshake. Video is automatically disabled.
*
**/
void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled){
cp->low_bandwidth=enabled;
}
/**
* Returns whether video is enabled.
**/
@ -1026,11 +1043,11 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u
ms_warning("Case is MS_VIDEO_DECODER_DECODING_ERRORS");
linphone_call_send_vfu_request(call);
break;
case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED:
ms_message("First video frame decoded successfully");
if (call->nextVideoFrameDecoded._func != NULL)
call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data);
break;
case MS_VIDEO_DECODER_FIRST_IMAGE_DECODED:
ms_message("First video frame decoded successfully");
if (call->nextVideoFrameDecoded._func != NULL)
call->nextVideoFrameDecoded._func(call, call->nextVideoFrameDecoded._user_data);
break;
default:
ms_warning("Unhandled event %i", event_id);
break;
@ -1039,10 +1056,10 @@ static void video_stream_event_cb(void *user_pointer, const MSFilter *f, const u
#endif
void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data) {
call->nextVideoFrameDecoded._func = cb;
call->nextVideoFrameDecoded._user_data = user_data;
call->nextVideoFrameDecoded._func = cb;
call->nextVideoFrameDecoded._user_data = user_data;
#ifdef VIDEO_ENABLED
ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION);
ms_filter_call_method_noarg(call->videostream->decoder, MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION);
#endif
}
@ -1189,7 +1206,7 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
}
void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted){
float mic_gain=lp_config_get_float(lc->config,"sound","mic_gain",1);
float mic_gain=lc->sound_conf.soft_mic_lev;
float thres = 0;
float recv_gain;
float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05);
@ -1197,7 +1214,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute
int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0);
if (!muted)
audio_stream_set_mic_gain(st,mic_gain);
linphone_core_set_mic_gain_db (lc, mic_gain);
else
audio_stream_set_mic_gain(st,0);
@ -1231,7 +1248,7 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute
}
if (st->volrecv){
/* parameters for a limited noise-gate effect, using echo limiter threshold */
float floorgain = 1/mic_gain;
float floorgain = 1/pow(10,(mic_gain)/10);
int spk_agc=lp_config_get_int(lc->config,"sound","speaker_agc_enabled",0);
ms_filter_call_method(st->volrecv, MS_VOLUME_ENABLE_AGC, &spk_agc);
ms_filter_call_method(st->volrecv,MS_VOLUME_SET_NOISE_GATE_THRESHOLD,&ng_thres);
@ -2089,6 +2106,10 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat
}
}
/**
* Returns true if the call is part of the conference.
* @ingroup conferencing
**/
bool_t linphone_call_is_in_conference(const LinphoneCall *call) {
return call->params.in_conference;
}
@ -2105,7 +2126,7 @@ bool_t linphone_call_is_in_conference(const LinphoneCall *call) {
**/
void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) {
VideoStream* vstream = call->videostream;
if (vstream) {
if (vstream && vstream->output) {
float zoom[3];
if (zoom_factor < 1)

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "lpconfig.h"
#include "private.h"
#include <math.h>
#include <ortp/telephonyevents.h>
#include <ortp/zrtp.h>
#include "mediastreamer2/mediastream.h"
@ -40,9 +41,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "liblinphone_gitversion.h"
#else
#ifndef LIBLINPHONE_GIT_VERSION
#define LIBLINPHONE_GIT_VERSION "unknown"
#endif
#endif
#include "liblinphone_gitversion.h"
/*#define UNSTANDART_GSM_11K 1*/
@ -421,7 +426,6 @@ static void sound_config_read(LinphoneCore *lc)
int tmp;
const char *tmpbuf;
const char *devid;
float gain=0;
#ifdef __linux
/*alsadev let the user use custom alsa device within linphone*/
devid=lp_config_get_string(lc->config,"sound","alsadev",NULL);
@ -493,8 +497,8 @@ static void sound_config_read(LinphoneCore *lc)
linphone_core_enable_agc(lc,
lp_config_get_int(lc->config,"sound","agc",0));
gain=lp_config_get_float(lc->config,"sound","playback_gain_db",0);
linphone_core_set_playback_gain_db (lc,gain);
linphone_core_set_playback_gain_db (lc,lp_config_get_float(lc->config,"sound","playback_gain_db",0));
linphone_core_set_mic_gain_db (lc,lp_config_get_float(lc->config,"sound","mic_gain_db",0));
linphone_core_set_remote_ringback_tone (lc,lp_config_get_string(lc->config,"sound","ringback_tone",NULL));
@ -523,7 +527,7 @@ static void sip_config_read(LinphoneCore *lc)
sal_reuse_authorization(lc->sal, lp_config_get_int(lc->config,"sip","reuse_authorization",0));
sal_expire_old_registration_contacts(lc->sal,lp_config_get_int(lc->config,"sip","expire_old_registration_contacts",0));
tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",0);
tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",1);
linphone_core_set_use_rfc2833_for_dtmf(lc,tmp);
ipv6=lp_config_get_int(lc->config,"sip","use_ipv6",-1);
@ -562,6 +566,8 @@ static void sip_config_read(LinphoneCore *lc)
sal_set_root_ca(lc->sal, lp_config_get_string(lc->config,"sip","root_ca", ROOT_CA_FILE));
#endif
linphone_core_verify_server_certificates(lc,lp_config_get_int(lc->config,"sip","verify_server_certs",TRUE));
/*setting the dscp must be done before starting the transports, otherwise it is not taken into effect*/
sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc));
/*start listening on ports*/
linphone_core_set_sip_transports(lc,&tr);
@ -591,6 +597,9 @@ static void sip_config_read(LinphoneCore *lc)
tmp=lp_config_get_int(lc->config,"sip","inc_timeout",30);
linphone_core_set_inc_timeout(lc,tmp);
tmp=lp_config_get_int(lc->config,"sip","in_call_timeout",0);
linphone_core_set_in_call_timeout(lc,tmp);
/* get proxies config */
for(i=0;; i++){
LinphoneProxyConfig *cfg=linphone_proxy_config_new_from_config_file(lc->config,i);
@ -627,7 +636,6 @@ static void sip_config_read(LinphoneCore *lc)
sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1));
sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc));
sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
}
@ -1192,6 +1200,9 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
sal_set_user_pointer(lc->sal,lc);
sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
lc->network_last_check = 0;
lc->network_last_status = FALSE;
sip_setup_register_all();
sound_config_read(lc);
net_config_read(lc);
@ -1803,24 +1814,22 @@ void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val){
static void monitor_network_state(LinphoneCore *lc, time_t curtime){
static time_t last_check=0;
static bool_t last_status=FALSE;
char result[LINPHONE_IPADDR_SIZE];
bool_t new_status=last_status;
bool_t new_status=lc->network_last_status;
/* only do the network up checking every five seconds */
if (last_check==0 || (curtime-last_check)>=5){
if (lc->network_last_check==0 || (curtime-lc->network_last_check)>=5){
linphone_core_get_local_ip_for(lc->sip_conf.ipv6_enabled ? AF_INET6 : AF_INET,NULL,result);
if (strcmp(result,"::1")!=0 && strcmp(result,"127.0.0.1")!=0){
new_status=TRUE;
}else new_status=FALSE;
last_check=curtime;
if (new_status!=last_status) {
lc->network_last_check=curtime;
if (new_status!=lc->network_last_status) {
if (new_status){
ms_message("New local ip address is %s",result);
}
set_network_reachable(lc,new_status, curtime);
last_status=new_status;
lc->network_last_status=new_status;
}
}
}
@ -1978,6 +1987,7 @@ void linphone_core_iterate(LinphoneCore *lc){
calls= lc->calls;
while(calls!= NULL){
call = (LinphoneCall *)calls->data;
elapsed = curtime-call->start_time;
/* get immediately a reference to next one in case the one
we are going to examine is destroy and removed during
linphone_core_start_invite() */
@ -1994,7 +2004,6 @@ void linphone_core_iterate(LinphoneCore *lc){
linphone_core_start_invite(lc,call);
}
if (call->state==LinphoneCallIncomingReceived){
elapsed=curtime-call->start_time;
ms_message("incoming call ringing for %i seconds",elapsed);
if (elapsed>lc->sip_conf.inc_timeout){
ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout);
@ -2003,6 +2012,10 @@ void linphone_core_iterate(LinphoneCore *lc){
linphone_core_terminate_call(lc,call);
}
}
if (lc->sip_conf.in_call_timeout > 0 && elapsed>lc->sip_conf.in_call_timeout) {
ms_message("in call timeout (%i)",lc->sip_conf.in_call_timeout);
linphone_core_terminate_call(lc,call);
}
}
if (linphone_core_video_preview_enabled(lc)){
@ -2277,7 +2290,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){
linphone_call_init_media_streams(call);
if (lc->ringstream==NULL)
audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard);
call->localdesc=create_local_media_description(lc,call);
linphone_call_make_local_media_description(lc,call);
if (!lc->sip_conf.sdp_200_ack){
call->media_pending=TRUE;
sal_call_set_local_media_description(call->op,call->localdesc);
@ -2539,7 +2552,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
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);
call->localdesc=create_local_media_description(lc,call);
linphone_call_make_local_media_description(lc,call);
sal_call_set_local_media_description(call->op,call->localdesc);
md=sal_call_get_final_media_description(call->op);
if (md && sal_media_description_empty(md)){
@ -2645,7 +2658,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
call->videostream->ice_check_list = NULL;
}
call->params = *params;
update_local_media_description(lc, call);
linphone_call_make_local_media_description(lc, call);
if ((call->ice_session != NULL) && !has_video && call->params.has_video) {
/* Defer call update until the ICE candidates gathering process has finished. */
ms_message("Defer call update to gather ICE candidates");
@ -2756,7 +2769,7 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const
}
call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op));
call->camera_active=call->params.has_video;
update_local_media_description(lc,call);
linphone_call_make_local_media_description(lc,call);
if (call->ice_session != NULL) {
linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op));
#ifdef VIDEO_ENABLED
@ -2872,7 +2885,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
call->params=*params;
call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op));
call->camera_active=call->params.has_video;
update_local_media_description(lc,call);
linphone_call_make_local_media_description(lc,call);
sal_call_set_local_media_description(call->op,call->localdesc);
}
@ -3062,7 +3075,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call)
ms_warning("Cannot pause this call, it is not active.");
return -1;
}
update_local_media_description(lc,call);
linphone_call_make_local_media_description(lc,call);
if (call->ice_session != NULL)
linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
if (sal_media_description_has_dir(call->resultdesc,SalStreamSendRecv)){
@ -3141,7 +3154,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
prevents the participants to hear it while the 200OK comes back.*/
if (call->audiostream) audio_stream_play(call->audiostream, NULL);
update_local_media_description(lc,the_call);
linphone_call_make_local_media_description(lc,the_call);
if (call->ice_session != NULL)
linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
sal_call_set_local_media_description(call->op,call->localdesc);
@ -3195,6 +3208,9 @@ int linphone_core_send_publish(LinphoneCore *lc,
**/
void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds){
lc->sip_conf.inc_timeout=seconds;
if (linphone_core_ready(lc)){
lp_config_set_int(lc->config,"sip","inc_timeout",seconds);
}
}
/**
@ -3207,6 +3223,26 @@ int linphone_core_get_inc_timeout(LinphoneCore *lc){
return lc->sip_conf.inc_timeout;
}
/**
* Set the in call timeout in seconds.
*
* @ingroup call_control
* After this timeout period, the call is automatically hangup.
**/
void linphone_core_set_in_call_timeout(LinphoneCore *lc, int seconds){
lc->sip_conf.in_call_timeout=seconds;
}
/**
* Returns the in call timeout
*
* @ingroup call_control
* See linphone_core_set_in_call_timeout() for details.
**/
int linphone_core_get_in_call_timeout(LinphoneCore *lc){
return lc->sip_conf.in_call_timeout;
}
void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,
const char *contact,
LinphoneOnlineStatus presence_mode)
@ -3275,6 +3311,40 @@ void linphone_core_set_ring_level(LinphoneCore *lc, int level){
if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level);
}
/**
* Allow to control microphone level: gain in db
*
* @ingroup media_parameters
**/
void linphone_core_set_mic_gain_db (LinphoneCore *lc, float gaindb){
float gain=gaindb;
LinphoneCall *call=linphone_core_get_current_call (lc);
AudioStream *st;
lc->sound_conf.soft_mic_lev=gaindb;
if (linphone_core_ready(lc)){
lp_config_set_float(lc->config,"sound","mic_gain_db",lc->sound_conf.soft_mic_lev);
}
if (call==NULL || (st=call->audiostream)==NULL){
ms_message("linphone_core_set_mic_gain_db(): no active call.");
return;
}
if (st->volrecv){
ms_filter_call_method(st->volsend,MS_VOLUME_SET_DB_GAIN,&gain);
}else ms_warning("Could not apply gain: gain control wasn't activated.");
}
/**
* Get microphone gain in db.
*
* @ingroup media_parameters
**/
float linphone_core_get_mic_gain_db(LinphoneCore *lc) {
return lc->sound_conf.soft_mic_lev;
}
/**
* Allow to control play level before entering sound card: gain in db
*
@ -3286,6 +3356,9 @@ void linphone_core_set_playback_gain_db (LinphoneCore *lc, float gaindb){
AudioStream *st;
lc->sound_conf.soft_play_lev=gaindb;
if (linphone_core_ready(lc)){
lp_config_set_float(lc->config,"sound","playback_gain_db",lc->sound_conf.soft_play_lev);
}
if (call==NULL || (st=call->audiostream)==NULL){
ms_message("linphone_core_set_playback_gain_db(): no active call.");
@ -3586,6 +3659,17 @@ void linphone_core_set_root_ca(LinphoneCore *lc,const char *path){
sal_set_root_ca(lc->sal, path);
}
/**
* Gets the path to a file or folder containing trusted root CAs (PEM format)
*
* @param lc The LinphoneCore object
*
* @ingroup media_parameters
**/
const char *linphone_core_get_root_ca(LinphoneCore *lc){
return sal_get_root_ca(lc->sal);
}
/**
* Specify whether the tls server certificate must be verified when connecting to a SIP/TLS server.
**/
@ -3686,7 +3770,7 @@ void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){
}
if (st!=NULL){
audio_stream_set_mic_gain(st,
(val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1));
(val==TRUE) ? 0 : pow(10,lc->sound_conf.soft_mic_lev/10));
if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
audio_stream_mute_rtp(st,val);
}
@ -4050,7 +4134,7 @@ int linphone_core_set_video_device(LinphoneCore *lc, const char *id){
if (id!=NULL){
lc->video_conf.device=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),id);
if (lc->video_conf.device==NULL){
ms_warning("Could not found video device %s",id);
ms_warning("Could not find video device %s",id);
}
}
if (lc->video_conf.device==NULL)
@ -4116,6 +4200,16 @@ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path) {
return 0;
}
const char *linphone_core_get_static_picture(LinphoneCore *lc) {
const char *path=NULL;
#ifdef VIDEO_ENABLED
path=ms_static_image_get_default_image();
#else
ms_warning("Video support not compiled.");
#endif
return path;
}
int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps) {
#ifdef VIDEO_ENABLED
VideoStream *vs = NULL;
@ -4603,6 +4697,7 @@ void sip_config_uninit(LinphoneCore *lc)
lp_config_set_int(lc->config,"sip","guess_hostname",config->guess_hostname);
lp_config_set_string(lc->config,"sip","contact",config->contact);
lp_config_set_int(lc->config,"sip","inc_timeout",config->inc_timeout);
lp_config_set_int(lc->config,"sip","in_call_timeout",config->in_call_timeout);
lp_config_set_int(lc->config,"sip","use_info",config->use_info);
lp_config_set_int(lc->config,"sip","use_rfc2833",config->use_rfc2833);
lp_config_set_int(lc->config,"sip","use_ipv6",config->ipv6_enabled);
@ -4671,6 +4766,8 @@ static void sound_config_uninit(LinphoneCore *lc)
ms_free(config->cards);
lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring);
lp_config_set_float(lc->config,"sound","playback_gain_db",config->soft_play_lev);
lp_config_set_float(lc->config,"sound","mic_gain_db",config->soft_mic_lev);
if (config->local_ring) ms_free(config->local_ring);
if (config->remote_ring) ms_free(config->remote_ring);
@ -4790,6 +4887,9 @@ static void linphone_core_uninit(LinphoneCore *lc)
ms_list_for_each(lc->call_logs,(void (*)(void*))linphone_call_log_destroy);
lc->call_logs=ms_list_free(lc->call_logs);
ms_list_for_each(lc->last_recv_msg_ids,ms_free);
lc->last_recv_msg_ids=ms_list_free(lc->last_recv_msg_ids);
linphone_core_free_payload_types(lc);
ortp_exit();
@ -5106,6 +5206,10 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL;
}
const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc){
return lc->zrtp_secrets_cache;
}
const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri) {
if (uri == NULL) return NULL;
MSList *calls=lc->calls;
@ -5238,8 +5342,10 @@ const char* linphone_core_get_device_identifier(const LinphoneCore *lc) {
**/
void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp){
sal_set_dscp(lc->sal,dscp);
if (linphone_core_ready(lc))
if (linphone_core_ready(lc)){
lp_config_set_int_hex(lc->config,"sip","dscp",dscp);
apply_transports(lc);
}
}
/**

View file

@ -204,14 +204,9 @@ bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams
bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp);
void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
void linphone_call_params_destroy(LinphoneCallParams *cp);
/**
* @ingroup call_control
* Use to know if this call has been configured in low bandwidth mode.
* This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file
* <br> When enabled, this param may transform a call request with video in audio only mode.
* @return TRUE if low bandwidth has been configured/detected
*/
bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp);
void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled);
/**
* Enum describing failure reasons.
* @ingroup initializing
@ -663,13 +658,13 @@ const LinphoneAddress* linphone_chat_room_get_peer_address(LinphoneChatRoom *cr)
*/
void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg);
/**
*LinphoneChatMessageStatus used to notify if message has been succesfully delivered or not
*LinphoneChatMessageState is used to notify if messages have been succesfully delivered or not.
*/
typedef enum _LinphoneChatMessageStates {
LinphoneChatMessageStateIdle, /** initial state*/
LinphoneChatMessageStateInProgress, /*delivery in progress**/
LinphoneChatMessageStateDelivered, /** message succesffully delivered an acknoleged by remote end point*/
LinphoneChatMessageStateNotDelivered /** message was not delivered*/
LinphoneChatMessageStateIdle, /**<initial state*/
LinphoneChatMessageStateInProgress, /**<delivery in progress**/
LinphoneChatMessageStateDelivered, /**<message succesffully delivered an acknoleged by remote end point*/
LinphoneChatMessageStateNotDelivered /**<message was not delivered*/
}LinphoneChatMessageState;
@ -679,20 +674,20 @@ typedef enum _LinphoneChatMessageStates {
const char* linphone_chat_message_state_to_string(const LinphoneChatMessageState state);
/**
* clone a chat message
* Clone a chat message
*@param message #LinphoneChatMessage obj
*@return #LinphoneChatMessage
*/
LinphoneChatMessage* linphone_chat_message_clone(const LinphoneChatMessage* message);
/**
* set origine of the message
* Set origin of the message
*@param message #LinphoneChatMessage obj
*@param from #LinphoneAddress origin of this message (copied)
*/
void linphone_chat_message_set_from(LinphoneChatMessage* message, const LinphoneAddress* from);
/**
* get origine of the message
* Get origin of the message
*@param message #LinphoneChatMessage obj
*@return #LinphoneAddress
*/
@ -701,21 +696,21 @@ LinphoneAddress* linphone_chat_message_get_from(const LinphoneChatMessage* messa
/**
* Linphone message can carry external body as defined by rfc2017
* @param message #LinphoneChatMessage
* @return return external body url null if not present.
* @return external body url or NULL if not present.
*/
const char* linphone_chat_message_get_external_body_url(const LinphoneChatMessage* message);
/**
* Linphone message can carry external body as defined by rfc2017
*
* @param #LinphoneChatMessage
* @param message a LinphoneChatMessage
* @param url ex: access-type=URL; URL="http://www.foo.com/file"
*/
void linphone_chat_message_set_external_body_url(LinphoneChatMessage* message,const char* url);
/**
* get text part of this message
*@return text or NULL if no text.
* Get text part of this message
* @return text or NULL if no text.
*/
const char * linphone_chat_message_get_text(const LinphoneChatMessage* message);
/**
@ -731,15 +726,15 @@ void linphone_chat_message_set_user_data(LinphoneChatMessage* message,void*);
/**
* Call back used to notify message delivery status
*@param msg #LinphoneChatMessage object
*@param status #LinphoneChatMessageStatus
*@param ud us user data
*@param status LinphoneChatMessageState
*@param ud application user data
*/
typedef void (*LinphoneChatMessageStateChangeCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud);
/**
* send a message to peer member of this chat room.
* @param cr #LinphoneChatRoom object
* @param msg #LinphoneChatMessage message to be sent
* @param status_cb #LinphoneChatMessageStatus status call back invoked when to message is delivered or not. May be NULL
* @param status_cb LinphoneChatMessageStateChangeCb status callback invoked when message is delivered or could not be delivered. May be NULL
* @param ud user data for the status cb.
*/
void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangeCb status_cb,void* ud);
@ -1055,8 +1050,8 @@ int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t
* This function searches in audio and video codecs for the given payload type name and clockrate.
* @param lc #LinphoneCore object
* @param type payload mime type (I.E SPEEX, PCMU, VP8)
* @param rate, can be #LINPHONE_FIND_PAYLOAD_IGNORE_RATE
* @param channels, number of channels, can be #LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS
* @param rate can be #LINPHONE_FIND_PAYLOAD_IGNORE_RATE
* @param channels number of channels, can be #LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS
* @return Returns NULL if not found.
*/
PayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) ;
@ -1164,6 +1159,10 @@ void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds);
int linphone_core_get_inc_timeout(LinphoneCore *lc);
void linphone_core_set_in_call_timeout(LinphoneCore *lc, int seconds);
int linphone_core_get_in_call_timeout(LinphoneCore *lc);
void linphone_core_set_stun_server(LinphoneCore *lc, const char *server);
const char * linphone_core_get_stun_server(const LinphoneCore *lc);
@ -1192,9 +1191,11 @@ int linphone_core_get_rec_level(LinphoneCore *lc);
void linphone_core_set_ring_level(LinphoneCore *lc, int level);
void linphone_core_set_play_level(LinphoneCore *lc, int level);
void linphone_core_set_mic_gain_db(LinphoneCore *lc, float level);
float linphone_core_get_mic_gain_db(LinphoneCore *lc);
void linphone_core_set_playback_gain_db(LinphoneCore *lc, float level);
float linphone_core_get_playback_gain_db(LinphoneCore *lc);
void linphone_core_set_rec_level(LinphoneCore *lc, int level);
const char * linphone_core_get_ringer_device(LinphoneCore *lc);
const char * linphone_core_get_playback_device(LinphoneCore *lc);
@ -1208,6 +1209,7 @@ void linphone_core_set_ring(LinphoneCore *lc, const char *path);
const char *linphone_core_get_ring(const LinphoneCore *lc);
void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno);
void linphone_core_set_root_ca(LinphoneCore *lc, const char *path);
const char *linphone_core_get_root_ca(LinphoneCore *lc);
void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
const char * linphone_core_get_ringback(const LinphoneCore *lc);
@ -1276,8 +1278,9 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc);
int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
const char *linphone_core_get_video_device(const LinphoneCore *lc);
/* Set static picture to be used when "Static picture" is the video device */
/* Set and get static picture to be used when "Static picture" is the video device */
int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);
const char *linphone_core_get_static_picture(LinphoneCore *lc);
/* Set and get frame rate for static picture */
int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps);
@ -1381,7 +1384,7 @@ void linphone_core_refresh_registers(LinphoneCore* lc);
/* Path to the file storing secrets cache */
void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file);
const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc);
const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri);

View file

@ -542,6 +542,22 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_delete(JNIEnv* env
delete lcData;
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPrimaryContact(JNIEnv* env, jobject thiz, jlong lc, jstring jdisplayname, jstring jusername) {
const char* displayname = env->GetStringUTFChars(jdisplayname, NULL);
const char* username = env->GetStringUTFChars(jusername, NULL);
LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed((LinphoneCore*)lc);
if (parsed != NULL) {
linphone_address_set_display_name(parsed, displayname);
linphone_address_set_username(parsed, username);
char *contact = linphone_address_as_string(parsed);
linphone_core_set_primary_contact((LinphoneCore*)lc, contact);
}
env->ReleaseStringUTFChars(jdisplayname, displayname);
env->ReleaseStringUTFChars(jusername, username);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_clearProxyConfigs(JNIEnv* env, jobject thiz,jlong lc) {
linphone_core_clear_proxy_config((LinphoneCore*)lc);
}
@ -703,6 +719,13 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isNetworkStateReacha
return (jboolean)linphone_core_is_network_reachable((LinphoneCore*)lc);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setMicrophoneGain(JNIEnv* env
,jobject thiz
,jlong lc
,jfloat gain) {
linphone_core_set_mic_gain_db((LinphoneCore*)lc,gain);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setPlaybackGain( JNIEnv* env
,jobject thiz
,jlong lc
@ -1349,6 +1372,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getSenderInterarr
pt = linphone_call_params_get_used_audio_codec(params);
else
pt = linphone_call_params_get_used_video_codec(params);
if (!pt || (pt->clock_rate == 0))
return (jfloat)0.0;
return (jfloat)((float)report_block_get_interarrival_jitter(srb) / (float)pt->clock_rate);
}
extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverInterarrivalJitter(JNIEnv *env, jobject thiz, jlong stats_ptr, jlong call_ptr) {
@ -1376,6 +1401,8 @@ extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getReceiverIntera
pt = linphone_call_params_get_used_audio_codec(params);
else
pt = linphone_call_params_get_used_video_codec(params);
if (!pt || (pt->clock_rate == 0))
return (jfloat)0.0;
return (jfloat)((float)report_block_get_interarrival_jitter(rrb) / (float)pt->clock_rate);
}
extern "C" jfloat Java_org_linphone_core_LinphoneCallStatsImpl_getRoundTripDelay(JNIEnv *env, jobject thiz, jlong stats_ptr) {
@ -1842,6 +1869,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEn
linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseSipInfoForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){
linphone_core_set_use_info_for_dtmf((LinphoneCore *)lc, (bool) use);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUseRfc2833ForDtmfs(JNIEnv *env, jobject thiz, jlong lc, jboolean use){
linphone_core_set_use_rfc2833_for_dtmf((LinphoneCore *)lc, (bool) use);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadPtime(JNIEnv *env, jobject thiz, jlong lc, jint ptime){
linphone_core_set_download_ptime((LinphoneCore *)lc, (int) ptime);
}
@ -2137,6 +2172,10 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setIncomingTimeout(JNIEn
linphone_core_set_inc_timeout((LinphoneCore *)lc, timeout);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setInCallTimeout(JNIEnv *env, jobject thiz, jlong lc, jint timeout) {
linphone_core_set_in_call_timeout((LinphoneCore *)lc, timeout);
}
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* env,jobject thiz,jlong ptr) {
jstring jvalue =env->NewStringUTF(linphone_core_get_version());
return jvalue;

View file

@ -94,8 +94,14 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook
*@return call country code or -1 if not found
*/
int linphone_dial_plan_lookup_ccc_from_iso(const char* iso);
/**
* @ingroup misc
*Function to get call country code from an e164 number, ex: +33952650121 will return 33
*@param e164 phone number
*@return call country code or -1 if not found
*/
int linphone_dial_plan_lookup_ccc_from_e164(const char* e164);
#ifdef __cplusplus
}
#endif

View file

@ -574,21 +574,31 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
return -1;
}
int linphone_core_get_edge_bw(LinphoneCore *lc){
int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",20);
return edge_bw;
}
int linphone_core_get_edge_ptime(LinphoneCore *lc){
int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100);
return edge_ptime;
}
void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, LinphoneCallParams *params){
if (lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){
if (ping_time_ms>0 && lp_config_get_int(lc->config,"net","activate_edge_workarounds",0)==1){
ms_message("Stun server ping time is %i ms",ping_time_ms);
int threshold=lp_config_get_int(lc->config,"net","edge_ping_time",500);
if (ping_time_ms>threshold){
int edge_ptime=lp_config_get_int(lc->config,"net","edge_ptime",100);
int edge_bw=lp_config_get_int(lc->config,"net","edge_bw",20);
/* we are in a 2G network*/
params->up_bw=params->down_bw=edge_bw;
params->up_ptime=params->down_ptime=edge_ptime;
params->has_video=FALSE;
/* we might be in a 2G network*/
params->low_bandwidth=TRUE;
}/*else use default settings */
}
if (params->low_bandwidth){
params->up_bw=params->down_bw=linphone_core_get_edge_bw(lc);
params->up_ptime=params->down_ptime=linphone_core_get_edge_ptime(lc);
params->has_video=FALSE;
}
}

View file

@ -382,6 +382,7 @@ typedef struct sip_config
MSList *proxies;
MSList *deleted_proxies;
int inc_timeout; /*timeout after an un-answered incoming call is rejected*/
int in_call_timeout; /*timeout after a call is hangup */
unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/
LCSipTransports transports;
bool_t use_info;
@ -436,6 +437,7 @@ typedef struct sound_config
const char **cards;
int latency; /* latency in samples of the current used sound device */
float soft_play_lev; /*playback gain in db.*/
float soft_mic_lev; /*mic gain in db.*/
char rec_lev;
char play_lev;
char ring_lev;
@ -556,12 +558,16 @@ struct _LinphoneCore
bool_t network_reachable;
bool_t use_preview_window;
time_t network_last_check;
bool_t network_last_status;
bool_t ringstream_autorelease;
bool_t pad[3];
int device_rotation;
int max_calls;
LinphoneTunnel *tunnel;
char* device_id;
MSList *last_recv_msg_ids;
};
LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc);
@ -576,10 +582,7 @@ int linphone_core_set_as_current_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_get_calls_nb(const LinphoneCore *lc);
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
SalMediaDescription *create_local_media_description(LinphoneCore *lc, LinphoneCall *call);
void update_local_media_description(LinphoneCore *lc, LinphoneCall *call);
void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call);
void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md);
bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, PayloadType *pt, int bandwidth_limit);
@ -636,7 +639,8 @@ void _linphone_core_codec_config_write(LinphoneCore *lc);
#endif
void call_logs_write_to_config_file(LinphoneCore *lc);
int linphone_core_get_edge_bw(LinphoneCore *lc);
int linphone_core_get_edge_ptime(LinphoneCore *lc);
#ifdef __cplusplus
}

View file

@ -378,16 +378,261 @@ typedef struct dial_plan{
}dial_plan_t;
/* TODO: fill with information for all countries over the world*/
static dial_plan_t const dial_plans[]={
{"France" ,"FR" , "33" , 9 , "00" },
{"United States" ,"US" , "1" , 10 , "011" },
{"Turkey" ,"TR" , "90" , 10 , "00" },
{"Switzerland" ,"XK" , "41" , 9 , "00" },
{NULL ,NULL,"" , 0 , NULL }
};
static dial_plan_t const dial_plans[]={
{"Afghanistan" ,"AF" , "93" , 9 , "00" },
{"Albania" ,"AL" , "355" , 9 , "00" },
{"Algeria" ,"DZ" , "213" , 9 , "00" },
{"American Samoa" ,"AS" , "1" , 10 , "011" },
{"Andorra" ,"AD" , "376" , 6 , "00" },
{"Angola" ,"AO" , "244" , 9 , "00" },
{"Anguilla" ,"AI" , "1" , 10 , "011" },
{"Antigua and Barbuda" ,"AG" , "1" , 10 , "011" },
{"Argentina" ,"AR" , "54" , 10 , "00" },
{"Armenia" ,"AM" , "374" , 8 , "00" },
{"Aruba" ,"AW" , "297" , 7 , "011" },
{"Australia" ,"AU" , "61" , 9 , "0011"},
{"Austria" ,"AT" , "43" , 10 , "00" },
{"Azerbaijan" ,"AZ" , "994" , 9 , "00" },
{"Bahamas" ,"BS" , "1" , 10 , "011" },
{"Bahrain" ,"BH" , "973" , 8 , "00" },
{"Bangladesh" ,"BD" , "880" , 10 , "00" },
{"Barbados" ,"BB" , "1" , 10 , "011" },
{"Belarus" ,"BY" , "375" , 9 , "00" },
{"Belgium" ,"BE" , "32" , 9 , "00" },
{"Belize" ,"BZ" , "501" , 7 , "00" },
{"Benin" ,"BJ" , "229" , 8 , "00" },
{"Bermuda" ,"BM" , "1" , 10 , "011" },
{"Bhutan" ,"BT" , "975" , 8 , "00" },
{"Bolivia" ,"BO" , "591" , 8 , "00" },
{"Bosnia and Herzegovina" ,"BA" , "387" , 8 , "00" },
{"Botswana" ,"BW" , "267" , 8 , "00" },
{"Brazil" ,"BR" , "55" , 10 , "00" },
{"Brunei Darussalam" ,"BN" , "673" , 7 , "00" },
{"Bulgaria" ,"BG" , "359" , 9 , "00" },
{"Burkina Faso" ,"BF" , "226" , 8 , "00" },
{"Burundi" ,"BI" , "257" , 8 , "011" },
{"Cambodia" ,"KH" , "855" , 9 , "00" },
{"Cameroon" ,"CM" , "237" , 8 , "00" },
{"Canada" ,"CA" , "1" , 10 , "011" },
{"Cape Verde" ,"CV" , "238" , 7 , "00" },
{"Cayman Islands" ,"KY" , "1" , 10 , "011" },
{"Central African Republic" ,"CF" , "236" , 8 , "00" },
{"Chad" ,"TD" , "235" , 8 , "00" },
{"Chile" ,"CL" , "56" , 9 , "00" },
{"China" ,"CN" , "86" , 11 , "00" },
{"Colombia" ,"CO" , "57" , 10 , "00" },
{"Comoros" ,"KM" , "269" , 7 , "00" },
{"Congo" ,"CG" , "242" , 9 , "00" },
{"Congo Democratic Republic" ,"CD" , "243" , 9 , "00" },
{"Cook Islands" ,"CK" , "682" , 5 , "00" },
{"Costa Rica" ,"CR" , "506" , 8 , "00" },
{"C™te d'Ivoire" ,"AD" , "225" , 8 , "00" },
{"Croatia" ,"HR" , "385" , 9 , "00" },
{"Cuba" ,"CU" , "53" , 8 , "119" },
{"Cyprus" ,"CY" , "357" , 8 , "00" },
{"Czech Republic" ,"CZ" , "420" , 9 , "00" },
{"Denmark" ,"DK" , "45" , 8 , "00" },
{"Djibouti" ,"DJ" , "253" , 8 , "00" },
{"Dominica" ,"DM" , "1" , 10 , "011" },
{"Dominican Republic" ,"DO" , "1" , 10 , "011" },
{"Ecuador" ,"EC" , "593" , 9 , "00" },
{"Egypt" ,"EG" , "20" , 10 , "00" },
{"El Salvador" ,"SV" , "503" , 8 , "00" },
{"Equatorial Guinea" ,"GQ" , "240" , 9 , "00" },
{"Eritrea" ,"ER" , "291" , 7 , "00" },
{"Estonia" ,"EE" , "372" , 8 , "00" },
{"Ethiopia" ,"ET" , "251" , 9 , "00" },
{"Falkland Islands" ,"FK" , "500" , 5 , "00" },
{"Faroe Islands" ,"FO" , "298" , 6 , "00" },
{"Fiji" ,"FJ" , "679" , 7 , "00" },
{"Finland" ,"FI" , "358" , 9 , "00" },
{"France" ,"FR" , "33" , 9 , "00" },
{"French Guiana" ,"GF" , "594" , 9 , "00" },
{"French Polynesia" ,"PF" , "689" , 6 , "00" },
{"Gabon" ,"GA" , "241" , 8 , "00" },
{"Gambia" ,"GM" , "220" , 7 , "00" },
{"Georgia" ,"GE" , "995" , 9 , "00" },
{"Germany" ,"DE" , "49" , 11 , "00" },
{"Ghana" ,"GH" , "233" , 9 , "00" },
{"Gibraltar" ,"GI" , "350" , 8 , "00" },
{"Greece" ,"GR" , "30" ,10 , "00" },
{"Greenland" ,"GL" , "299" , 6 , "00" },
{"Grenada" ,"GD" , "1" , 10 , "011" },
{"Guadeloupe" ,"GP" , "590" , 9 , "00" },
{"Guam" ,"GU" , "1" , 10 , "011" },
{"Guatemala" ,"GT" , "502" , 8 , "00" },
{"Guinea" ,"GN" , "224" , 8 , "00" },
{"Guinea-Bissau" ,"GW" , "245" , 7 , "00" },
{"Guyana" ,"GY" , "592" , 7 , "001" },
{"Haiti" ,"HT" , "509" , 8 , "00" },
{"Honduras" ,"HN" , "504" , 8 , "00" },
{"Hong Kong" ,"HK" , "852" , 8 , "001" },
{"Hungary" ,"HU" , "36" , 9 , "00" },
{"Iceland" ,"IS" , "354" , 9 , "00" },
{"India" ,"IN" , "91" , 10 , "00" },
{"Indonesia" ,"ID" , "62" , 10 , "001" },
{"Iran" ,"IR" , "98" , 10 , "00" },
{"Iraq" ,"IQ" , "964" , 10 , "00" },
{"Ireland" ,"IE" , "353" , 9 , "00" },
{"Israel" ,"IL" , "972" , 9 , "00" },
{"Italy" ,"IT" , "39" , 10 , "00" },
{"Jamaica" ,"JM" , "1" , 10 , "011" },
{"Japan" ,"JP" , "81" , 10 , "010" },
{"Jordan" ,"JO" , "962" , 9 , "00" },
{"Kazakhstan" ,"KZ" , "7" , 10 , "00" },
{"Kenya" ,"KE" , "254" , 9 , "000" },
{"Kiribati" ,"KI" , "686" , 5 , "00" },
{"Korea, North" ,"KP" , "850" , 12 , "99" },
{"Korea, South" ,"KR" , "82" , 12 , "001" },
{"Kuwait" ,"KW" , "965" , 8 , "00" },
{"Kyrgyzstan" ,"KG" , "996" , 9 , "00" },
{"Laos" ,"LA" , "856" , 10 , "00" },
{"Latvia" ,"LV" , "371" , 8 , "00" },
{"Lebanon" ,"LB" , "961" , 7 , "00" },
{"Lesotho" ,"LS" , "266" , 8 , "00" },
{"Liberia" ,"LR" , "231" , 8 , "00" },
{"Libya" ,"LY" , "218" , 8 , "00" },
{"Liechtenstein" ,"LI" , "423" , 7 , "00" },
{"Lithuania" ,"LT" , "370" , 8 , "00" },
{"Luxembourg" ,"LU" , "352" , 9 , "00" },
{"Macau" ,"MO" , "853" , 8 , "00" },
{"Macedonia" ,"MK" , "389" , 8 , "00" },
{"Madagascar" ,"MG" , "261" , 9 , "00" },
{"Malawi" ,"MW" , "265" , 9 , "00" },
{"Malaysia" ,"MY" , "60" , 9 , "00" },
{"Maldives" ,"MV" , "960" , 7 , "00" },
{"Mali" ,"ML" , "223" , 8 , "00" },
{"Malta" ,"MT" , "356" , 8 , "00" },
{"Marshall Islands" ,"MH" , "692" , 7 , "011" },
{"Martinique" ,"MQ" , "596" , 9 , "00" },
{"Mauritania" ,"MR" , "222" , 8 , "00" },
{"Mauritius" ,"MU" , "230" , 7 , "00" },
{"Mayotte Island" ,"YT" , "262" , 9 , "00" },
{"Mexico" ,"MX" , "52" , 10 , "00" },
{"Micronesia" ,"FM" , "691" , 7 , "011" },
{"Moldova" ,"MD" , "373" , 8 , "00" },
{"Monaco" ,"MC" , "377" , 8 , "00" },
{"Mongolia" ,"MN" , "976" , 8 , "001" },
{"Montenegro" ,"ME" , "382" , 8 , "00" },
{"Montserrat" ,"MS" , "664" , 10 , "011" },
{"Morocco" ,"MA" , "212" , 9 , "00" },
{"Mozambique" ,"MZ" , "258" , 9 , "00" },
{"Myanmar" ,"MM" , "95" , 8 , "00" },
{"Namibia" ,"NA" , "264" , 9 , "00" },
{"Nauru" ,"NR" , "674" , 7 , "00" },
{"Nepal" ,"NP" , "43" , 10 , "00" },
{"Netherlands" ,"NL" , "31" , 9 , "00" },
{"New Caledonia" ,"NC" , "687" , 6 , "00" },
{"New Zealand" ,"NZ" , "64" , 10 , "00" },
{"Nicaragua" ,"NI" , "505" , 8 , "00" },
{"Niger" ,"NE" , "227" , 8 , "00" },
{"Nigeria" ,"NG" , "234" , 10 , "009" },
{"Niue" ,"NU" , "683" , 4 , "00" },
{"Norfolk Island" ,"NF" , "672" , 5 , "00" },
{"Northern Mariana Islands" ,"MP" , "1" , 10 , "011" },
{"Norway" ,"NO" , "47" , 8 , "00" },
{"Oman" ,"OM" , "968" , 8 , "00" },
{"Pakistan" ,"PK" , "92" , 10 , "00" },
{"Palau" ,"PW" , "680" , 7 , "011" },
{"Palestine" ,"PS" , "970" , 9 , "00" },
{"Panama" ,"PA" , "507" , 8 , "00" },
{"Papua New Guinea" ,"PG" , "675" , 8 , "00" },
{"Paraguay" ,"PY" , "595" , 9 , "00" },
{"Peru" ,"PE" , "51" , 9 , "00" },
{"Philippines" ,"PH" , "63" , 10 , "00" },
{"Poland" ,"PL" , "48" , 9 , "00" },
{"Portugal" ,"PT" , "351" , 9 , "00" },
{"Puerto Rico" ,"PR" , "1" , 10 , "011" },
{"Qatar" ,"QA" , "974" , 8 , "00" },
{"RŽunion Island" ,"RE" , "262" , 9 , "011" },
{"Romania" ,"RO" , "40" , 9 , "00" },
{"Russian Federation" ,"RU" , "7" , 10 , "8" },
{"Rwanda" ,"RW" , "250" , 9 , "00" },
{"Saint Helena" ,"SH" , "290" , 4 , "00" },
{"Saint Kitts and Nevis" ,"KN" , "1" , 10 , "011" },
{"Saint Lucia" ,"LC" , "1" , 10 , "011" },
{"Saint Pierre and Miquelon" ,"PM" , "508" , 6 , "00" },
{"Saint Vincent and the Grenadines","VC" , "1" , 10 , "011" },
{"Samoa" ,"WS" , "685" , 7 , "0" },
{"San Marino" ,"SM" , "378" , 10 , "00" },
{"So TomŽ and Prncipe" ,"ST" , "239" , 7 , "00" },
{"Saudi Arabia" ,"SA" , "966" , 9 , "00" },
{"Senegal" ,"SN" , "221" , 9 , "00" },
{"Serbia" ,"RS" , "381" , 9 , "00" },
{"Seychelles" ,"SC" , "248" , 7 , "00" },
{"Sierra Leone" ,"SL" , "232" , 8 , "00" },
{"Singapore" ,"SG" , "65" , 8 , "001" },
{"Slovakia" ,"SK" , "421" , 9 , "00" },
{"Slovenia" ,"SI" , "386" , 8 , "00" },
{"Solomon Islands" ,"SB" , "677" , 7 , "00" },
{"Somalia" ,"SO" , "252" , 8 , "00" },
{"South Africa" ,"ZA" , "27" , 9 , "00" },
{"Spain" ,"ES" , "34" , 9 , "00" },
{"Sri Lanka" ,"LK" , "94" , 9 , "00" },
{"Sudan" ,"SD" , "249" , 9 , "00" },
{"Suriname" ,"SR" , "597" , 7 , "00" },
{"Swaziland" ,"SZ" , "268" , 8 , "00" },
{"Sweden" ,"SE" , "1" , 9 , "00" },
{"Switzerland" ,"XK" , "41" , 9 , "00" },
{"Syria" ,"SY" , "963" , 9 , "00" },
{"Taiwan" ,"TW" , "886" , 9 , "810" },
{"Tajikistan" ,"TJ" , "992" , 9 , "002" },
{"Tanzania" ,"TZ" , "255" , 9 , "000" },
{"Thailand" ,"TH" , "66" , 9 , "001" },
{"Togo" ,"TG" , "228" , 8 , "00" },
{"Tokelau" ,"TK" , "690" , 4 , "00" },
{"Tonga" ,"TO" , "676" , 5 , "00" },
{"Trinidad and Tobago" ,"TT" , "1" , 10 , "011" },
{"Tunisia" ,"TN" , "216" , 8 , "00" },
{"Turkey" ,"TR" , "90" , 10 , "00" },
{"Turkmenistan" ,"TM" , "993" , 8 , "00" },
{"Turks and Caicos Islands" ,"TC" , "1" , 7 , "0" },
{"Tuvalu" ,"TV" , "688" , 5 , "00" },
{"Uganda" ,"UG" , "256" , 9 , "000" },
{"Ukraine" ,"UA" , "380" , 9 , "00" },
{"United Arab Emirates" ,"AE" , "971" , 9 , "00" },
{"United Kingdom" ,"UK" , "44" , 10 , "00" },
{"United States" ,"US" , "1" , 10 , "011" },
{"Uruguay" ,"UY" , "598" , 8 , "00" },
{"Uzbekistan" ,"UZ" , "998" , 9 , "8" },
{"Vanuatu" ,"VU" , "678" , 7 , "00" },
{"Venezuela" ,"VE" , "58" , 10 , "00" },
{"Vietnam" ,"VN" , "84" , 9 , "00" },
{"Wallis and Futuna" ,"WF" , "681" , 5 , "00" },
{"Yemen" ,"YE" , "967" , 9 , "00" },
{"Zambia" ,"ZM" , "260" , 9 , "00" },
{"Zimbabwe" ,"ZW" , "263" , 9 , "00" },
{NULL ,NULL , "" , 0 , NULL }
};
static dial_plan_t most_common_dialplan={ "generic" ,"", "", 10, "00"};
int linphone_dial_plan_lookup_ccc_from_e164(const char* e164) {
dial_plan_t* dial_plan;
dial_plan_t* elected_dial_plan=NULL;
unsigned int found;
unsigned int i=0;
if (e164[1]=='1') {
/*USA case*/
return 1;
}
do {
found=0;
i++;
for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) {
if (strncmp(dial_plan->ccc,&e164[1],i) == 0) {
elected_dial_plan=dial_plan;
found++;
}
}
} while (found>1 || found==0);
if (found==1) {
return atoi(elected_dial_plan->ccc);
} else {
return -1; /*not found */
}
}
int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) {
dial_plan_t* dial_plan;
for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) {

View file

@ -162,6 +162,10 @@ static bool_t payload_type_equals(const PayloadType *p1, const PayloadType *p2){
return TRUE;
}
static bool_t is_recv_only(PayloadType *p){
return (p->flags & PAYLOAD_TYPE_FLAG_CAN_RECV) && ! (p->flags & PAYLOAD_TYPE_FLAG_CAN_SEND);
}
static bool_t payload_list_equals(const MSList *l1, const MSList *l2){
const MSList *e1,*e2;
for(e1=l1,e2=l2;e1!=NULL && e2!=NULL; e1=e1->next,e2=e2->next){
@ -170,6 +174,12 @@ static bool_t payload_list_equals(const MSList *l1, const MSList *l2){
if (!payload_type_equals(p1,p2))
return FALSE;
}
if (e1!=NULL){
/*skip possible recv-only payloads*/
for(;e1!=NULL && is_recv_only((PayloadType*)e1->data);e1=e1->next){
ms_message("Skipping recv-only payload type...");
}
}
if (e1!=NULL || e2!=NULL){
/*means one list is longer than the other*/
return FALSE;

View file

@ -188,6 +188,13 @@ typedef struct SalMediaDescription{
bool_t ice_completed;
} SalMediaDescription;
typedef struct SalMessage{
const char *from;
const char *text;
const char *url;
const char *message_id;
}SalMessage;
#define SAL_MEDIA_DESCRIPTION_MAX_MESSAGE_ATTRIBUTES 5
SalMediaDescription *sal_media_description_new();
@ -280,8 +287,7 @@ typedef void (*SalOnRegisterFailure)(SalOp *op, SalError error, SalReason reason
typedef void (*SalOnVfuRequest)(SalOp *op);
typedef void (*SalOnDtmfReceived)(SalOp *op, char dtmf);
typedef void (*SalOnRefer)(Sal *sal, SalOp *op, const char *referto);
typedef void (*SalOnTextReceived)(Sal *sal, const char *from, const char *msg);
typedef void (*SalOnMessageExternalBodyReceived)(Sal *sal, const char *from, const char *url);
typedef void (*SalOnTextReceived)(Sal *sal, const SalMessage *msg);
typedef void (*SalOnTextDeliveryUpdate)(SalOp *op, SalTextDeliveryStatus status);
typedef void (*SalOnNotify)(SalOp *op, const char *from, const char *event);
typedef void (*SalOnNotifyRefer)(SalOp *op, SalReferStatus state);
@ -307,7 +313,6 @@ typedef struct SalCallbacks{
SalOnDtmfReceived dtmf_received;
SalOnRefer refer_received;
SalOnTextReceived text_received;
SalOnMessageExternalBodyReceived message_external_body;
SalOnTextDeliveryUpdate text_delivery_update;
SalOnNotify notify;
SalOnNotifyPresence notify_presence;
@ -351,6 +356,7 @@ void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec);
void sal_use_rport(Sal *ctx, bool_t use_rports);
void sal_use_101(Sal *ctx, bool_t use_101);
void sal_set_root_ca(Sal* ctx, const char* rootCa);
const char *sal_get_root_ca(Sal* ctx);
void sal_verify_server_certificates(Sal *ctx, bool_t verify);
int sal_iterate(Sal *sal);

View file

@ -343,8 +343,6 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs){
ctx->callbacks.text_received=(SalOnTextReceived)unimplemented_stub;
if (ctx->callbacks.ping_reply==NULL)
ctx->callbacks.ping_reply=(SalOnPingReply)unimplemented_stub;
if (ctx->callbacks.message_external_body==NULL)
ctx->callbacks.message_external_body=(SalOnMessageExternalBodyReceived)unimplemented_stub;
}
int sal_unlisten_ports(Sal *ctx){
@ -488,6 +486,10 @@ void sal_set_root_ca(Sal* ctx, const char* rootCa) {
set_tls_options(ctx);
}
const char *sal_get_root_ca(Sal* ctx) {
return ctx->rootCa;
}
void sal_verify_server_certificates(Sal *ctx, bool_t verify){
ctx->verify_server_certs=verify;
#ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE
@ -1728,11 +1730,13 @@ static bool_t comes_from_local_if(osip_message_t *msg){
static void text_received(Sal *sal, eXosip_event_t *ev){
osip_body_t *body=NULL;
char *from=NULL,*msg;
char *from=NULL,*msg=NULL;
osip_content_type_t* content_type;
osip_uri_param_t* external_body_url;
char unquoted_external_body_url [256];
int external_body_size=0;
SalMessage salmsg;
char message_id[256]={0};
content_type= osip_message_get_content_type(ev->request);
if (!content_type) {
@ -1744,14 +1748,14 @@ static void text_received(Sal *sal, eXosip_event_t *ev){
&& strcmp(content_type->type, "text")==0
&& content_type->subtype
&& strcmp(content_type->subtype, "plain")==0 ) {
osip_message_get_body(ev->request,0,&body);
if (body==NULL){
ms_error("Could not get text message from SIP body");
return;
}
msg=body->body;
sal->callbacks.text_received(sal,from,msg);
} if (content_type->type
osip_message_get_body(ev->request,0,&body);
if (body==NULL){
ms_error("Could not get text message from SIP body");
osip_free(from);
return;
}
msg=body->body;
}else if (content_type->type
&& strcmp(content_type->type, "message")==0
&& content_type->subtype
&& strcmp(content_type->subtype, "external-body")==0 ) {
@ -1762,11 +1766,18 @@ static void text_received(Sal *sal, eXosip_event_t *ev){
,&external_body_url->gvalue[1]
,external_body_size=MIN(strlen(external_body_url->gvalue)-1,sizeof(unquoted_external_body_url)));
unquoted_external_body_url[external_body_size-1]='\0';
sal->callbacks.message_external_body(sal,from,unquoted_external_body_url);
} else {
ms_warning("Unsupported content type [%s/%s]",content_type->type,content_type->subtype);
osip_free(from);
return;
}
snprintf(message_id,sizeof(message_id)-1,"%s%s",ev->request->call_id->number,ev->request->cseq->number);
salmsg.from=from;
salmsg.text=msg;
salmsg.url=external_body_size>0 ? unquoted_external_body_url : NULL;
salmsg.message_id=message_id;
sal->callbacks.text_received(sal,&salmsg);
osip_free(from);
}
@ -1790,7 +1801,7 @@ static void other_request(Sal *sal, eXosip_event_t *ev){
}else ms_warning("Ignored REFER not coming from this local loopback interface.");
}else if (strncmp(ev->request->sip_method, "UPDATE", 6) == 0){
inc_update(sal,ev);
}else {
}else {
char *tmp=NULL;
size_t msglen=0;
osip_message_to_str(ev->request,&tmp,&msglen);

View file

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphonecore.h"
#include "linphonecore_utils.h"
int main(int argc , char *argv[]){
LinphoneProxyConfig *cfg;
@ -35,6 +36,13 @@ int main(int argc , char *argv[]){
if (argc>3 && strcmp(argv[3],"--escape-plus")==0)
linphone_proxy_config_set_dial_escape_plus(cfg,TRUE);
linphone_proxy_config_normalize_number(cfg,argv[1],normalized_number,sizeof(normalized_number));
printf("Normalized number is %s\n",normalized_number);
/*check extracted ccc*/
if (linphone_dial_plan_lookup_ccc_from_e164(normalized_number) != atoi(linphone_proxy_config_get_dial_prefix(cfg))) {
printf("Error ccc [%i] not correctly parsed\n",linphone_dial_plan_lookup_ccc_from_e164(normalized_number));
} else {
printf("Extracted ccc is [%i] \n",linphone_dial_plan_lookup_ccc_from_e164(normalized_number));
}
return 0;
}

View file

@ -38,7 +38,7 @@ public interface LinphoneCallLog {
/**
* Call success.
*/
public final static CallStatus Sucess = new CallStatus(0,"Sucess");
public final static CallStatus Success = new CallStatus(0,"Sucess");
/**
* Call aborted.
*/

View file

@ -7,8 +7,7 @@ public interface LinphoneChatMessage {
interface StateListener{
void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state);
}
static class State {
@SuppressWarnings("rawtypes")
public static class State {
static private Vector values = new Vector();
private final int mValue;
public final int value() {return mValue;}
@ -31,7 +30,6 @@ public interface LinphoneChatMessage {
*/
public final static State NotDelivered = new State(3,"NotDelivered");
@SuppressWarnings("unchecked")
private State(int value,String stringValue) {
mValue = value;
values.addElement(this);

View file

@ -189,21 +189,21 @@ public interface LinphoneCore {
* Media (RTP) encryption enum-like.
*
*/
static public class MediaEncryption {
static public final class MediaEncryption {
static private Vector values = new Vector();
/**
* None
*/
static public MediaEncryption None = new MediaEncryption(0,"None");
static public final MediaEncryption None = new MediaEncryption(0,"None");
/**
* SRTP
*/
static public MediaEncryption SRTP = new MediaEncryption(1,"SRTP");
static public final MediaEncryption SRTP = new MediaEncryption(1,"SRTP");
/**
* ZRTP
*/
static public MediaEncryption ZRTP = new MediaEncryption(2,"ZRTP");
static public final MediaEncryption ZRTP = new MediaEncryption(2,"ZRTP");
protected final int mValue;
private final String mStringValue;
@ -843,4 +843,27 @@ public interface LinphoneCore {
* automatically declined.
**/
void setIncomingTimeout(int timeout);
/**
* Set the call timeout in seconds.
* Once this time is elapsed (ringing included), the call is automatically hung up.
**/
void setInCallTimeout(int timeout);
void setMicrophoneGain(float gain);
/**
* Set username and display name to use if no LinphoneProxyConfig configured
*/
void setPrimaryContact(String displayName, String username);
/**
* Enable/Disable the use of SIP INFO for DTMFs
*/
void setUseSipInfoForDtmfs(boolean use);
/**
* Enable/Disable the use of inband DTMFs
*/
void setUseRfc2833ForDtmfs(boolean use);
}

View file

@ -115,6 +115,8 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void setAudioPortRange(long nativePtr, int minPort, int maxPort);
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 setPrimaryContact(long nativePtr, String displayName, String username);
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
mListener=listener;
@ -744,7 +746,7 @@ class LinphoneCoreImpl implements LinphoneCore {
@Override
public PayloadType findPayloadType(String mime, int clockRate) {
return null;
return findPayloadType(mime, clockRate, 1);
}
private native void removeFriend(long ptr, long lf);
@ -782,4 +784,28 @@ class LinphoneCoreImpl implements LinphoneCore {
public void setIncomingTimeout(int timeout) {
setIncomingTimeout(nativePtr, timeout);
}
public void setInCallTimeout(int timeout)
{
setInCallTimeout(nativePtr, timeout);
}
private native void setMicrophoneGain(long ptr, float gain);
public void setMicrophoneGain(float gain) {
setMicrophoneGain(nativePtr, gain);
}
public void setPrimaryContact(String displayName, String username) {
setPrimaryContact(nativePtr, displayName, username);
}
private native void setUseSipInfoForDtmfs(long ptr, boolean use);
public void setUseSipInfoForDtmfs(boolean use) {
setUseSipInfoForDtmfs(nativePtr, use);
}
private native void setUseRfc2833ForDtmfs(long ptr, boolean use);
public void setUseRfc2833ForDtmfs(boolean use) {
setUseRfc2833ForDtmfs(nativePtr, use);
}
}

@ -1 +1 @@
Subproject commit 83267230336a64dc4a005b29bf8baccf6a5fd2c2
Subproject commit 243cc4d3da14b68bb7d2919c93475c122995dfc7

2
oRTP

@ -1 +1 @@
Subproject commit ddc4f7d041967305483761fc9c643d3bb290a5f1
Subproject commit 0d318ef477b40f72b5838a836ddccc0e055c0719