Merge branch 'master' into dev_multicall

Conflicts:
	console/commands.c
	coreapi/linphonecore.c
	coreapi/linphonecore.h
This commit is contained in:
Simon Morlat 2010-06-17 12:35:47 +02:00
commit 722ab2d99d
16 changed files with 418 additions and 83 deletions

8
NEWS
View file

@ -1,3 +1,11 @@
linphone-3.3.1 -- June 3, 2010
* fix bugs when carrying non ascii displaynames in SIP messages
* fix crash when codecs are incompatible
* fix bug with streams not restarted in case of reinvites
Requires:
mediastreamer2-2.5.0
ortp-0.16.3
linphone-3.3.0 -- May 19, 2010
* liblinphone is ported to iphoneOS and Google Android
* Internal refactoring of liblinphone (code factorisation, encapsulation

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([linphone],[3.3.0],[linphone-developers@nongnu.org])
AC_INIT([linphone],[3.3.1],[linphone-developers@nongnu.org])
AC_CANONICAL_SYSTEM
dnl Source packaging numbers

View file

@ -80,6 +80,9 @@ static int lpc_cmd_codec(LinphoneCore *lc, char *args);
static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args);
static int lpc_cmd_pause(LinphoneCore *lc, char *args);
static int lpc_cmd_resume(LinphoneCore *lc, char *args);
static int lpc_cmd_mute_mic(LinphoneCore *lc, char *args);
static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args);
static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args);
/* Command handler helpers */
static void linphonec_proxy_add(LinphoneCore *lc);
@ -221,19 +224,27 @@ LPC_COMMAND commands[] = {
"'speak <voice name> <sentence>' : speak a text using the specified espeak voice.\n"
"Example for english voice: 'speak default Hello my friend !'"
},
{ "codec", lpc_cmd_codec, "Codec configuration",
"'codec list' : list codecs\n"
"'codec enable <index>' : enable available codec\n"
"'codec disable <index>' : disable codecs" },
{ "ec", lpc_cmd_echocancellation, "Echo cancellation",
"'ec on [<delay>] [<tail>] [<framesize>]' : turn EC on with given delay, tail length and framesize\n"
"'ec off' : turn echo cancellation (EC) off\n"
"'ec show' : show EC status" },
{ "pause", lpc_cmd_pause, "pause a call",
"'pause' : pause the current call\n"},
{ "resume", lpc_cmd_resume, "resume a call",
"'resume' : resume the unique call\n"
"'resume <sip:XXX@XXX.XXX.XXX.XXX>' : hold off the call with cid <cid>\n"},
{ "codec", lpc_cmd_codec, "Codec configuration",
"'codec list' : list codecs\n"
"'codec enable <index>' : enable available codec\n"
"'codec disable <index>' : disable codecs" },
{ "ec", lpc_cmd_echocancellation, "Echo cancellation",
"'ec on [<delay>] [<tail>] [<framesize>]' : turn EC on with given delay, tail length and framesize\n"
"'ec off' : turn echo cancellation (EC) off\n"
"'ec show' : show EC status" },
{ "pause", lpc_cmd_pause, "pause a call",
"'pause' : pause the current call\n"},
{ "resume", lpc_cmd_resume, "resume a call",
"'resume' : resume the unique call\n"
"'resume <sip:XXX@XXX.XXX.XXX.XXX>' : hold off the call with cid <cid>\n"},
{ "mute", lpc_cmd_mute_mic,
"Mute microphone and suspend voice transmission."},
{ "unmute", lpc_cmd_unmute_mic,
"Unmute microphone and resume voice transmission."},
{ "nortp-on-audio-mute", lpc_cmd_rtp_no_xmit_on_audio_mute,
"Set the rtp_no_xmit_on_audio_mute configuration parameter",
" If set to 1 then rtp transmission will be muted when\n"
" audio is muted , otherwise rtp is always sent."},
{ (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL }
};
@ -1770,9 +1781,11 @@ static int lpc_cmd_status(LinphoneCore *lc, char *args)
linphonec_out("hook=offhook\n");
break;
case GSTATE_CALL_OUT_CONNECTED:
linphonec_out("Call out, hook=%s duration=%i\n", linphonec_get_callee(),
linphone_core_get_current_call_duration(lc));
break;
linphonec_out("Call out, hook=%s duration=%i, muted=%s rtp-xmit-muted=%s\n", linphonec_get_callee(),
linphone_core_get_current_call_duration(lc),
lc->audio_muted ? "yes" : "no",
linphone_core_is_rtp_muted(lc) ? "yes" : "no");
break;
case GSTATE_CALL_IN_CONNECTED:
linphonec_out("hook=answered duration=%i\n" ,
linphone_core_get_current_call_duration(lc));
@ -1984,6 +1997,38 @@ static int lpc_cmd_echocancellation(LinphoneCore *lc, char *args){
return 1;
}
static int lpc_cmd_mute_mic(LinphoneCore *lc, char *args)
{
linphone_core_mute_mic(lc, 1);
return 1;
}
static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){
linphone_core_mute_mic(lc, 0);
return 1;
}
static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args)
{
bool_t rtp_xmit_off=FALSE;
char *status;
gstate_t call_state=linphone_core_get_state(lc,GSTATE_GROUP_CALL);
if(args){
if(strstr(args,"1"))rtp_xmit_off=TRUE;
if(call_state == GSTATE_CALL_IDLE)
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_xmit_off);
else
linphonec_out("nortp-on-audio-mute: call in progress - cannot change state\n");
}
rtp_xmit_off=linphone_core_get_rtp_no_xmit_on_audio_mute(lc);
if(rtp_xmit_off)status="off";
else status="on";
linphonec_out("rtp transmit %s when audio muted\n",status);
return 1;
}
/***************************************************************************
*
* Command table management funx

View file

@ -136,5 +136,11 @@ void linphone_address_destroy(LinphoneAddress *u){
sal_address_destroy(u);
}
int linphone_address_get_port_int(const LinphoneAddress *u) {
return sal_address_get_port_int(u);
}
const char* linphone_address_get_port(const LinphoneAddress *u) {
return sal_address_get_port(u);
}
/** @} */

View file

@ -478,19 +478,20 @@ static void sip_config_read(LinphoneCore *lc)
{
char *contact;
const char *tmpstr;
int port;
LCSipTransports tr;
int i,tmp;
int ipv6;
tmp=lp_config_get_int(lc->config,"sip","use_info",0);
linphone_core_set_use_info_for_dtmf(lc,tmp);
if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){
sal_use_session_timers(lc->sal,200);
}
port=lp_config_get_int(lc->config,"sip","use_info",0);
linphone_core_set_use_info_for_dtmf(lc,port);
port=lp_config_get_int(lc->config,"sip","use_rfc2833",0);
linphone_core_set_use_rfc2833_for_dtmf(lc,port);
tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",0);
linphone_core_set_use_rfc2833_for_dtmf(lc,tmp);
ipv6=lp_config_get_int(lc->config,"sip","use_ipv6",-1);
if (ipv6==-1){
@ -501,8 +502,19 @@ static void sip_config_read(LinphoneCore *lc)
}
}
linphone_core_enable_ipv6(lc,ipv6);
port=lp_config_get_int(lc->config,"sip","sip_port",5060);
linphone_core_set_sip_port(lc,port);
memset(&tr,0,sizeof(tr));
if (lp_config_get_int(lc->config,"sip","sip_random_port",0)) {
tr.udp_port=(0xDFF&+random())+1024;
} else {
tr.udp_port=lp_config_get_int(lc->config,"sip","sip_port",5060);
}
if (lp_config_get_int(lc->config,"sip","sip_tcp_random_port",0)) {
tr.tcp_port=(0xDFF&+random())+1024;
} else {
tr.tcp_port=lp_config_get_int(lc->config,"sip","sip_tcp_port",0);
}
/*start listening on ports*/
linphone_core_set_sip_transports(lc,&tr);
tmpstr=lp_config_get_string(lc->config,"sip","contact",NULL);
if (tmpstr==NULL || linphone_core_set_primary_contact(lc,tmpstr)==-1) {
@ -553,6 +565,11 @@ static void sip_config_read(LinphoneCore *lc)
break;
}
}
lc->sip_conf.sdp_200_ack=lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
/*for tuning or test*/
lc->sip_conf.sdp_200_ack=lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
@ -570,6 +587,8 @@ static void rtp_config_read(LinphoneCore *lc)
int port;
int jitt_comp;
int nortp_timeout;
bool_t rtp_no_xmit_on_audio_mute;
port=lp_config_get_int(lc->config,"rtp","audio_rtp_port",7078);
linphone_core_set_audio_port(lc,port);
@ -582,6 +601,8 @@ static void rtp_config_read(LinphoneCore *lc)
jitt_comp=lp_config_get_int(lc->config,"rtp","video_jitt_comp",60);
nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30);
linphone_core_set_nortp_timeout(lc,nortp_timeout);
rtp_no_xmit_on_audio_mute=lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE);
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute);
}
static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, const char *recv_fmtp){
@ -1076,7 +1097,7 @@ static void update_primary_contact(LinphoneCore *lc){
lc->sip_conf.loopback_only=TRUE;
}else lc->sip_conf.loopback_only=FALSE;
linphone_address_set_domain(url,tmp);
linphone_address_set_port_int(url,lc->sip_conf.sip_port);
linphone_address_set_port_int(url,linphone_core_get_sip_port (lc));
guessed=linphone_address_as_string(url);
lc->sip_conf.guessed_contact=guessed;
linphone_address_destroy(url);
@ -1205,6 +1226,10 @@ int linphone_core_get_nortp_timeout(const LinphoneCore *lc){
return lc->rtp_conf.nortp_timeout;
}
bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc){
return lc->rtp_conf.rtp_no_xmit_on_audio_mute;
}
/**
* Sets the nominal audio jitter buffer size in milliseconds.
*
@ -1215,6 +1240,10 @@ void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value)
lc->rtp_conf.audio_jitt_comp=value;
}
void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc,bool_t rtp_no_xmit_on_audio_mute){
lc->rtp_conf.rtp_no_xmit_on_audio_mute=rtp_no_xmit_on_audio_mute;
}
/**
* Sets the UDP port used for audio streaming.
*
@ -1287,11 +1316,13 @@ void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833)
/**
* Returns the UDP port used by SIP.
*
* Deprecated: use linphone_core_get_sip_transports() instead.
* @ingroup network_parameters
**/
int linphone_core_get_sip_port(LinphoneCore *lc)
{
return lc->sip_conf.sip_port;
LCSipTransports *tr=&lc->sip_conf.transports;
return tr->udp_port>0 ? tr->udp_port : tr->tcp_port;
}
static char _ua_name[64]="Linphone";
@ -1323,37 +1354,91 @@ void linphone_core_set_user_agent(const char *name, const char *ver){
strncpy(_ua_version,ver,sizeof(_ua_version));
}
/**
* Sets the UDP port to be used by SIP.
*
* @ingroup network_parameters
**/
int linphone_core_set_sip_port(LinphoneCore *lc,int port)
{
const char *anyaddr;
int err=0;
if (port==lc->sip_conf.sip_port) return 0;
lc->sip_conf.sip_port=port;
static void transport_error(LinphoneCore *lc, const char* transport, int port){
char *msg=ortp_strdup_printf("Could not start %s transport on port %i, maybe this port is already used.",transport,port);
ms_warning(msg);
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,msg);
ms_free(msg);
}
static bool_t transports_unchanged(const LCSipTransports * tr1, const LCSipTransports * tr2){
return
tr2->udp_port==tr1->udp_port &&
tr2->tcp_port==tr1->tcp_port &&
tr2->dtls_port==tr1->dtls_port &&
tr2->tls_port==tr1->tls_port;
}
static int apply_transports(LinphoneCore *lc){
Sal *sal=lc->sal;
const char *anyaddr;
LCSipTransports *tr=&lc->sip_conf.transports;
if (lc->sal==NULL) return -1;
if (lc->sip_conf.ipv6_enabled)
anyaddr="::0";
else
anyaddr="0.0.0.0";
err=sal_listen_port (lc->sal,anyaddr,port, SalTransportDatagram,FALSE);
if (err<0){
char *msg=ortp_strdup_printf("UDP port %i seems already in use ! Cannot initialize.",port);
ms_warning(msg);
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,msg);
ms_free(msg);
return -1;
sal_unlisten_ports (sal);
if (tr->udp_port>0){
if (sal_listen_port (sal,anyaddr,tr->udp_port,SalTransportDatagram,FALSE)!=0){
transport_error(lc,"UDP",tr->udp_port);
return -1;
}
}
if (tr->tcp_port>0){
if (sal_listen_port (sal,anyaddr,tr->tcp_port,SalTransportStream,FALSE)!=0){
transport_error(lc,"TCP",tr->tcp_port);
}
}
apply_user_agent(lc);
return 0;
}
/**
* Sets the ports to be used for each of transport (UDP or TCP)
*
* A zero value port for a given transport means the transport
* is not used.
*
* @ingroup network_parameters
**/
int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports * tr){
if (transports_unchanged(tr,&lc->sip_conf.transports))
return 0;
memcpy(&lc->sip_conf.transports,tr,sizeof(*tr));
if (lc->sal==NULL) return 0;
return apply_transports(lc);
}
/**
* Retrieves the ports used for each transport (udp, tcp).
* A zero value port for a given transport means the transport
* is not used.
* @ingroup network_parameters
**/
int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *tr){
memcpy(tr,&lc->sip_conf.transports,sizeof(*tr));
return 0;
}
/**
* Sets the UDP port to be used by SIP.
*
* Deprecated: use linphone_core_set_sip_transports() instead.
* @ingroup network_parameters
**/
void linphone_core_set_sip_port(LinphoneCore *lc,int port)
{
LCSipTransports tr;
memset(&tr,0,sizeof(tr));
tr.udp_port=port;
linphone_core_set_sip_transports (lc,&tr);
}
/**
* Returns TRUE if IPv6 is enabled.
*
@ -1378,7 +1463,7 @@ void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val){
lc->sip_conf.ipv6_enabled=val;
if (lc->sal){
/* we need to restart eXosip */
linphone_core_set_sip_port(lc, lc->sip_conf.sip_port);
apply_transports(lc);
}
}
}
@ -1435,6 +1520,16 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
static void proxy_update(LinphoneCore *lc){
ms_list_for_each(lc->sip_conf.proxies,(void (*)(void*))&linphone_proxy_config_update);
MSList* list=ms_list_copy(lc->sip_conf.deleted_proxies);
for(;list!=NULL;list=list->next){
LinphoneProxyConfig* cfg = (LinphoneProxyConfig*) list->data;
if (ms_time(NULL) - cfg->deletion_date > 5) {
lc->sip_conf.deleted_proxies =ms_list_remove(lc->sip_conf.deleted_proxies,(void *)cfg);
ms_message("clearing proxy config for [%s]",linphone_proxy_config_get_addr(cfg));
linphone_proxy_config_destroy(cfg);
}
}
ms_list_free(list);
}
static void assign_buddy_info(LinphoneCore *lc, BuddyInfo *info){
@ -1971,6 +2066,13 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
return FALSE;
}
#ifdef TEST_EXT_RENDERER
static void rendercb(void *data, const MSPicture *local, const MSPicture *remote){
ms_message("rendercb, local buffer=%p, remote buffer=%p",
local ? local->planes[0] : NULL, remote? remote->planes[0] : NULL);
}
#endif
void linphone_core_init_media_streams(LinphoneCore *lc, LinphoneCall *call){
#ifdef PRINTF_DEBUG
printf("%s(%d)\n",__FUNCTION__,__LINE__);
@ -2001,8 +2103,12 @@ void linphone_core_init_media_streams(LinphoneCore *lc, LinphoneCall *call){
rtp_session_set_transports(lc->audiostream->session,lc->a_rtp,lc->a_rtcp);
#ifdef VIDEO_ENABLED
if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0)
if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){
lc->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc));
#ifdef TEST_EXT_RENDERER
video_stream_set_render_callback(lc->videostream,rendercb,NULL);
#endif
}
#else
lc->videostream=NULL;
#endif
@ -2047,6 +2153,7 @@ static void post_configure_audio_streams(LinphoneCore *lc){
float gain=lp_config_get_float(lc->config,"sound","mic_gain",-1);
if (gain!=-1)
audio_stream_set_mic_gain(st,gain);
lc->audio_muted=FALSE;
float recv_gain = lc->sound_conf.soft_play_lev;
if (recv_gain != 0) {
linphone_core_set_soft_play_level(lc,recv_gain);
@ -2667,7 +2774,11 @@ void linphone_core_set_ring_level(LinphoneCore *lc, int level){
if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level);
}
/**
* Sets call playback gain in db
*
* @ingroup media_parameters
**/
void linphone_core_set_soft_play_level(LinphoneCore *lc, float level){
float gain=level;
lc->sound_conf.soft_play_lev=level;
@ -2678,11 +2789,17 @@ void linphone_core_set_soft_play_level(LinphoneCore *lc, float level){
ms_filter_call_method(st->volrecv,MS_VOLUME_SET_DB_GAIN,&gain);
}else ms_warning("Could not apply gain: gain control wasn't activated.");
}
/**
* Returns call playback gain in db
*
* @ingroup media_parameters
**/
float linphone_core_get_soft_play_level(LinphoneCore *lc) {
float gain=0;
AudioStream *st=lc->audiostream;
if (st->volrecv){
ms_filter_call_method(st->volrecv,MS_VOLUME_GET,&gain);
ms_filter_call_method(st->volrecv,MS_VOLUME_GET_GAIN_DB,&gain);
}else ms_warning("Could not get gain: gain control wasn't activated.");
return gain;
@ -2993,6 +3110,10 @@ void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){
if (lc->audiostream!=NULL){
audio_stream_set_mic_gain(lc->audiostream,
(val==TRUE) ? 0 : 1.0);
if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
audio_stream_mute_rtp(lc->audiostream,val);
}
lc->audio_muted=val;
}
}
@ -3005,6 +3126,24 @@ bool_t linphone_core_is_mic_muted(LinphoneCore *lc) {
return gain==0;
}
// returns audio mute status for active stream
bool_t linphone_core_is_audio_muted(LinphoneCore *lc){
if( lc->audiostream != NULL )
return (lc->audio_muted);
return FALSE;
}
// returns rtp transmission status for an active stream
// if audio is muted and config parameter rtp_no_xmit_on_audio_mute
// was set on then rtp transmission is also muted
bool_t linphone_core_is_rtp_muted(LinphoneCore *lc){
if( (lc->audiostream != NULL) &&
linphone_core_get_rtp_no_xmit_on_audio_mute(lc)){
return lc->audio_muted;
}
return FALSE;
}
void linphone_core_enable_agc(LinphoneCore *lc, bool_t val){
lc->sound_conf.agc=val;
}
@ -3529,7 +3668,7 @@ void sip_config_uninit(LinphoneCore *lc)
MSList *elem;
int i;
sip_config_t *config=&lc->sip_conf;
lp_config_set_int(lc->config,"sip","sip_port",config->sip_port);
lp_config_set_int(lc->config,"sip","sip_port",config->transports.udp_port);
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);

View file

@ -44,6 +44,15 @@ struct SalOp;
struct _LpConfig;
struct _LCSipTransports{
int udp_port;
int tcp_port;
int dtls_port;
int tls_port;
};
typedef struct _LCSipTransports LCSipTransports;
/**
* Object that represents a SIP address.
*
@ -66,6 +75,15 @@ const char *linphone_address_get_scheme(const LinphoneAddress *u);
const char *linphone_address_get_display_name(const LinphoneAddress* u);
const char *linphone_address_get_username(const LinphoneAddress *u);
const char *linphone_address_get_domain(const LinphoneAddress *u);
/**
* Get port number as an integer value.
*
*/
int linphone_address_get_port_int(const LinphoneAddress *u);
/**
* Get port number, null if not present.
*/
const char* linphone_address_get_port(const LinphoneAddress *u);
void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
void linphone_address_set_username(LinphoneAddress *uri, const char *username);
void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
@ -655,9 +673,13 @@ void linphone_core_set_use_rfc2833_for_dtmf(LinphoneCore *lc,bool_t use_rfc2833)
bool_t linphone_core_get_use_rfc2833_for_dtmf(LinphoneCore *lc);
void linphone_core_set_sip_port(LinphoneCore *lc, int port);
int linphone_core_get_sip_port(LinphoneCore *lc);
int linphone_core_set_sip_port(LinphoneCore *lc,int port);
int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports *transports);
int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports);
ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc);
@ -734,6 +756,12 @@ void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted);
**/
bool_t linphone_core_is_mic_muted(LinphoneCore *lc);
bool_t linphone_core_is_audio_muted(LinphoneCore *lc);
bool_t linphone_core_is_rtp_muted(LinphoneCore *lc);
bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc);
void linphone_core_set_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, bool_t val);
void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,const char *contact,LinphoneOnlineStatus os);
LinphoneOnlineStatus linphone_core_get_presence_info(const LinphoneCore *lc);

View file

@ -683,6 +683,7 @@ static int get_local_ip_with_getifaddrs(int type, char *address, int size)
if (strchr(address, '%') == NULL) { /*avoid ipv6 link-local addresses */
/*ms_message("getifaddrs() found %s",address);*/
ret++;
break;
}
}
}

View file

@ -203,6 +203,7 @@ struct _LinphoneProxyConfig
bool_t publish;
bool_t dial_escape_plus;
void* user_data;
time_t deletion_date;
};
struct _LinphoneAuthInfo
@ -238,14 +239,16 @@ struct _LinphoneFriend{
bool_t inc_subscribe_pending;
};
typedef struct sip_config
{
char *contact;
char *guessed_contact;
int sip_port;
MSList *proxies;
MSList *deleted_proxies;
int inc_timeout; /*timeout after an un-answered incoming call is rejected*/
unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/
LCSipTransports transports;
bool_t use_info;
bool_t use_rfc2833; /*force RFC2833 to be sent*/
bool_t guess_hostname;
@ -256,7 +259,6 @@ typedef struct sip_config
bool_t register_only_when_network_is_up;
bool_t ping_with_options;
bool_t auto_net_state_mon;
unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/
} sip_config_t;
typedef struct rtp_config
@ -266,6 +268,8 @@ typedef struct rtp_config
int audio_jitt_comp; /*jitter compensation*/
int video_jitt_comp; /*jitter compensation*/
int nortp_timeout;
bool_t rtp_no_xmit_on_audio_mute;
/* stop rtp xmit when audio muted */
}rtp_config_t;
@ -397,6 +401,7 @@ struct _LinphoneCore
bool_t preview_finished;
bool_t auto_net_state_mon;
bool_t network_reachable;
bool_t audio_muted;
};
bool_t linphone_core_can_we_add_call(LinphoneCore *lc);

View file

@ -22,6 +22,7 @@ Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org)
#include "sipsetup.h"
#include "lpconfig.h"
#include "private.h"
#include "mediastreamer2/mediastream.h"
#include <ctype.h>
@ -230,14 +231,45 @@ void linphone_proxy_config_apply(LinphoneProxyConfig *obj,LinphoneCore *lc)
linphone_proxy_config_done(obj);
}
static char *guess_contact_for_register(LinphoneProxyConfig *obj){
LinphoneAddress *proxy=linphone_address_new(obj->reg_proxy);
char *ret=NULL;
const char *host;
if (proxy==NULL) return NULL;
host=linphone_address_get_domain (proxy);
if (host!=NULL){
LinphoneAddress *contact;
char localip[LINPHONE_IPADDR_SIZE];
linphone_core_get_local_ip(obj->lc,host,localip);
contact=linphone_address_new(obj->reg_identity);
linphone_address_set_domain (contact,localip);
linphone_address_set_port_int(contact,linphone_core_get_sip_port(obj->lc));
linphone_address_set_display_name(contact,NULL);
LCSipTransports tr;
linphone_core_get_sip_transports(obj->lc,&tr);
if (tr.udp_port <= 0 && tr.tcp_port>0) {
sal_address_add_param(contact,"transport","tcp");
}
ret=linphone_address_as_string(contact);
linphone_address_destroy(contact);
}
linphone_address_destroy (proxy);
return ret;
}
static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
const char *id_str;
if (obj->reg_identity!=NULL) id_str=obj->reg_identity;
else id_str=linphone_core_get_primary_contact(obj->lc);
if (obj->reg_sendregister){
char *contact;
if (obj->op)
sal_op_release(obj->op);
obj->op=sal_op_new(obj->lc->sal);
contact=guess_contact_for_register(obj);
sal_op_set_contact(obj->op,contact);
ms_free(contact);
sal_op_set_user_pointer(obj->op,obj);
if (!sal_register(obj->op,obj->reg_proxy,obj->reg_identity,obj->expires)) {
gstate_new_state(obj->lc,GSTATE_REG_PENDING,NULL);
@ -474,6 +506,7 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
lc->sip_conf.proxies=ms_list_remove(lc->sip_conf.proxies,(void *)cfg);
/* add to the list of destroyed proxies, so that the possible unREGISTER request can succeed authentication */
lc->sip_conf.deleted_proxies=ms_list_append(lc->sip_conf.deleted_proxies,(void *)cfg);
cfg->deletion_date=ms_time(NULL);
/* this will unREGISTER */
linphone_proxy_config_edit(cfg);
if (lc->default_proxy==cfg){
@ -762,3 +795,4 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {

View file

@ -48,6 +48,9 @@ const char *sal_address_get_display_name(const SalAddress* addr);
char *sal_address_get_display_name_unquoted(const SalAddress *addr);
const char *sal_address_get_username(const SalAddress *addr);
const char *sal_address_get_domain(const SalAddress *addr);
const char * sal_address_get_port(const SalAddress *addr);
int sal_address_get_port_int(const SalAddress *uri);
void sal_address_set_display_name(SalAddress *addr, const char *display_name);
void sal_address_set_username(SalAddress *addr, const char *username);
void sal_address_set_domain(SalAddress *addr, const char *host);
@ -57,7 +60,7 @@ void sal_address_clean(SalAddress *addr);
char *sal_address_as_string(const SalAddress *u);
char *sal_address_as_string_uri_only(const SalAddress *u);
void sal_address_destroy(SalAddress *u);
void sal_address_add_param(SalAddress *u,const char* name,const char* value);
@ -227,6 +230,7 @@ typedef struct SalAuthInfo{
void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs);
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure);
int sal_unlisten_ports(Sal *ctx);
ortp_socket_t sal_get_socket(Sal *ctx);
void sal_set_user_agent(Sal *ctx, const char *user_agent);
/*keepalive period in ms*/

View file

@ -251,6 +251,7 @@ Sal * sal_init(){
}
eXosip_init();
sal=ms_new0(Sal,1);
sal->keepalive_period=30;
return sal;
}
@ -309,15 +310,30 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs){
ctx->callbacks.ping_reply=(SalOnPingReply)unimplemented_stub;
}
int sal_unlisten_ports(Sal *ctx){
if (ctx->running){
eXosip_quit();
eXosip_init();
}
return 0;
}
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure){
int err;
bool_t ipv6;
int proto=IPPROTO_UDP;
if (ctx->running){
eXosip_quit();
eXosip_init();
switch (tr) {
case SalTransportDatagram:
proto=IPPROTO_UDP;
break;
case SalTransportStream:
proto= IPPROTO_TCP;
break;
default:
ms_warning("unexpected proto, using datagram");
}
err=0;
eXosip_set_option(13,&err); /*13=EXOSIP_OPT_SRV_WITH_NAPTR, as it is an enum value, we can't use it unless we are sure of the
version of eXosip, which is not the case*/
@ -325,14 +341,15 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i
ipv6=strchr(addr,':')!=NULL;
eXosip_enable_ipv6(ipv6);
if (tr!=SalTransportDatagram || is_secure){
ms_fatal("SIP over TCP or TLS or DTLS is not supported yet.");
if (is_secure){
ms_fatal("SIP over TLS or DTLS is not supported yet.");
return -1;
}
err=eXosip_listen_addr(proto, addr, port, ipv6 ? PF_INET6 : PF_INET, 0);
#ifdef HAVE_EXOSIP_GET_SOCKET
ms_message("Exosip has socket number %i",eXosip_get_socket(proto));
#endif
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &ctx->keepalive_period);
ctx->running=TRUE;
return err;
}
@ -367,6 +384,12 @@ static int extract_received_rport(osip_message_t *msg, const char **received, in
*received=NULL;
osip_message_get_via(msg,0,&via);
if (!via) return -1;
/* it is useless to do that with tcp since client socket might have a different port
than the server socket.
*/
if (strcasecmp(via->protocol,"tcp")==0) return -1;
if (via->port && via->port[0]!='\0')
*rportval=atoi(via->port);
@ -1750,14 +1773,30 @@ char *sal_address_as_string_uri_only(const SalAddress *u){
osip_free(tmp);
return ret;
}
void sal_address_add_param(SalAddress *u,const char* name,const char* value) {
osip_uri_uparam_add (((osip_from_t*)u)->url,ms_strdup(name),ms_strdup(value));
}
void sal_address_destroy(SalAddress *u){
osip_from_free((osip_from_t*)u);
}
void sal_set_keepalive_period(Sal *ctx,unsigned int value) {
ctx->keepalive_period=value;
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value);
}
const char * sal_address_get_port(const SalAddress *addr) {
const osip_from_t *u=(const osip_from_t*)addr;
return null_if_empty(u->url->port);
}
int sal_address_get_port_int(const SalAddress *uri) {
const char* port = sal_address_get_port(uri);
if (port != NULL) {
return atoi(port);
} else {
return 5060;
}
}
/**
* Send a re-Invite used to hold the current call

View file

@ -38,6 +38,7 @@ struct Sal{
MSList *other_transactions; /*MSList of SalOp */
int running;
int session_expires;
int keepalive_period;
void *up;
};

View file

@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Sat Nov 8 15:49:12 2008 -->
<?xml version="1.0"?>
<glade-interface>
<!-- interface-requires gtk+ 2.6 -->
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkDialog" id="sip_account">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Linphone - Configure a SIP account</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="window_position">center-on-parent</property>
<property name="icon">linphone2.png</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<widget class="GtkFrame" id="frame15">
@ -29,6 +30,7 @@
<widget class="GtkVBox" id="vbox11">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkTable" id="table6">
<property name="visible">True</property>
@ -40,7 +42,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Your SIP identity:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="justify">right</property>
</widget>
</child>
<child>
@ -49,6 +51,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Looks like sip:&lt;username&gt;@&lt;domain&gt;</property>
<property name="text" translatable="yes">sip:</property>
</widget>
<packing>
<property name="left_attach">1</property>
@ -60,7 +64,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">SIP Proxy address:</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="justify">right</property>
</widget>
<packing>
<property name="top_attach">1</property>
@ -72,6 +76,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Looks like sip:&lt;proxy hostname&gt;</property>
<property name="text" translatable="yes">sip:</property>
</widget>
<packing>
@ -86,7 +91,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Route (optional):</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="justify">right</property>
</widget>
<packing>
<property name="top_attach">2</property>
@ -111,7 +116,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Registration duration (sec):</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="justify">right</property>
</widget>
<packing>
<property name="top_attach">3</property>
@ -133,13 +138,16 @@
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="register">
<property name="label" translatable="yes">Register at startup</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Register at startup</property>
<property name="response_id">0</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</widget>
@ -149,11 +157,11 @@
</child>
<child>
<widget class="GtkCheckButton" id="publish">
<property name="label" translatable="yes">Publish presence information</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Publish presence information</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
@ -185,38 +193,44 @@
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="layout_style">end</property>
<child>
<widget class="GtkButton" id="button6">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="linphone_gtk_proxy_ok"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button7">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="linphone_gtk_proxy_cancel"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</widget>

View file

@ -61,5 +61,5 @@ abstract public class LinphoneCoreFactory {
*/
abstract public void setDebugMode(boolean enable);
//abstract public void setLogHandler(LinphoneLogHandler handler);
abstract public void setLogHandler(LinphoneLogHandler handler);
}

View file

@ -3,6 +3,13 @@ AC_DEFUN([LP_SETUP_EXOSIP],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([LP_CHECK_OSIP2])
case $target_os in
*darwin*)
OSIP_LIBS="$OSIP_LIBS -framework CoreFoundation -framework CFNetwork "
;;
esac
dnl eXosip embeded stuff
EXOSIP_CFLAGS="$OSIP_CFLAGS -DOSIP_MT "
EXOSIP_LIBS="$OSIP_LIBS -leXosip2 "
@ -12,6 +19,8 @@ CPPFLAGS="$OSIP_CFLAGS $CPPFLAGS"
AC_CHECK_HEADER([eXosip2/eXosip.h], ,AC_MSG_ERROR([Could not find eXosip2 headers !]))
CPPFLAGS=$CPPFLAGS_save
dnl check for eXosip2 libs
LDFLAGS_save=$LDFLAGS
LDFLAGS="$OSIP_LIBS $LDFLAGS"

View file

@ -68,5 +68,7 @@ mediastreamer2/src/void.c
mediastreamer2/src/equalizer.c
mediastreamer2/src/msdscap-mingw.cc
mediastreamer2/src/drawdib-display.c
mediastreamer2/src/audiomixer.c
mediastreamer2/src/chanadapt.c
mediastreamer2/src/itc.c