Commit 804d4893 authored by jehan's avatar jehan
Browse files

Merge branch 'master' of git.savannah.nongnu.org:/srv/git/linphone

parents c27049a0 c828efa7
......@@ -3,13 +3,20 @@
# let make re-run automake upon need
ACLOCAL_AMFLAGS = -I m4 $(ACLOCAL_MACOS_FLAGS)
if EXTERNAL_MEDIASTREAMER
MS2_DIR=
else
MS2_DIR=mediastreamer2
endif
if EXTERNAL_ORTP
ORTP_DIR =
ORTP_DIR=
else
ORTP_DIR = oRTP
ORTP_DIR=oRTP
endif
SUBDIRS = m4 pixmaps po $(ORTP_DIR) mediastreamer2\
SUBDIRS = m4 pixmaps po $(ORTP_DIR) $(MS2_DIR) \
coreapi console gtk share scripts
......
dnl Process this file with autoconf to produce a configure script.
AC_INIT([linphone],[3.3.99.3],[linphone-developers@nongnu.org])
AC_INIT([linphone],[3.3.99.4],[linphone-developers@nongnu.org])
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([coreapi/linphonecore.c])
dnl Source packaging numbers
......@@ -28,7 +29,8 @@ AC_SUBST(LINPHONE_VERSION)
AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION A full featured audio/video sip phone.])
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
AM_INIT_AUTOMAKE([tar-ustar])
AM_INIT_AUTOMAKE
AC_SUBST([LIBTOOL_DEPS])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
AC_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
......@@ -67,7 +69,8 @@ AC_SUBST(CONSOLE_FLAGS)
AC_SUBST(GUI_FLAGS)
dnl localization tools
ifdef([IT_PROG_INTLTOOL],[IT_PROG_INTLTOOL],[AC_PROG_INTLTOOL])
IT_PROG_INTLTOOL([0.40], [no-xml])
dnl Initialize libtool
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
......@@ -374,15 +377,40 @@ fi
AC_SUBST(STRICT_OPTIONS)
AC_CONFIG_SUBDIRS( mediastreamer2 )
top_srcdir=`dirname $0`
AC_ARG_ENABLE([external-mediastreamer],
[AS_HELP_STRING([--enable-external-mediastreamer],[Use external mediastreamer library])],,
[enable_external_mediastreamer=no])
AS_CASE($enable_external_mediastreamer,
[yes],[
PKG_CHECK_MODULES([MEDIASTREAMER], [mediastreamer])
MS2_VERSION=`$PKG_CONFIG --modversion mediastreamer`
AM_CONDITIONAL(EXTERNAL_MEDIASTREAMER, [true])],
[no],[
AC_CONFIG_SUBDIRS( mediastreamer2 )
MEDIASTREAMER_DIR=${top_srcdir}/mediastreamer2
MEDIASTREAMER_CFLAGS="-I\$(top_srcdir)/mediastreamer2/include"
MEDIASTREAMER_LIBS="\$(top_builddir)/mediastreamer2/src/libmediastreamer.la"
dnl need to temporary change quotes to allow square brackets
changequote(<<, >>)
MS2_VERSION=`grep -e '^.C_INIT(' $MEDIASTREAMER_DIR/configure.ac | sed -e 's:\([^(]\+\)(\[mediastreamer\],\[\(.*\)\]):\2:g'`
changequote([, ])
AM_CONDITIONAL(EXTERNAL_MEDIASTREAMER, [false])],
[AC_MSG_ERROR([bad value '${enable_external_mediastreamer}' for --enable-external-mediastreamer])])
AC_SUBST(MEDIASTREAMER_CFLAGS)
AC_SUBST(MEDIASTREAMER_LIBS)
AC_SUBST([MS2_VERSION])
dnl check for db2html (docbook) to generate html user manual
AC_CHECK_PROG(have_sgmltools,sgmltools, yes, no)
AM_CONDITIONAL(ENABLE_MANUAL, test x$have_sgmltools$build_manual = xyesyes )
dnl for external use of linphone libs
LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone "
LINPHONE_LIBS="-L${libdir} -llinphone"
LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone"
LINPHONE_LIBS="-L${libdir} -llinphone"
if test x$mingw_found = xyes ; then
LINPHONE_LIBS="$LINPHONE_LIBS $OSIP_LIBS"
......@@ -390,7 +418,6 @@ fi
AC_SUBST(LINPHONE_CFLAGS)
AC_SUBST(LINPHONE_LIBS)
AC_DEFINE_UNQUOTED(LINPHONE_VERSION,"$PACKAGE_VERSION",[Linphone's version number])
AC_DEFINE_UNQUOTED(LINPHONE_PLUGINS_DIR, "${package_prefix}/lib/liblinphone/plugins" ,[path of liblinphone plugins, not mediastreamer2 plugins])
......@@ -406,7 +433,8 @@ AC_ARG_ENABLE(external-ortp,
esac],[external_ortp=false])
if test "$external_ortp" = 'true'; then
LP_CHECK_ORTP
PKG_CHECK_MODULES([ORTP], [ortp])
ORTP_VERSION=`$PKG_CONFIG --modversion ortp`
else
AC_CONFIG_SUBDIRS( oRTP )
ORTP_CFLAGS="-I\$(top_srcdir)/oRTP/include"
......@@ -414,22 +442,16 @@ else
if test x$ac_cv_c_bigendian = xyes ; then
ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
fi
changequote(<<, >>)
ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
changequote([, ])
fi
AC_SUBST(ORTP_CFLAGS)
AC_SUBST(ORTP_LIBS)
AC_SUBST([ORTP_VERSION])
AM_CONDITIONAL(EXTERNAL_ORTP, [test "$external_ortp" = 'true'])
dnl Packaging: Pick oRTP version from ${top_srcdir}/oRTP/configure.ac
dnl Feel free to propose an alternative & cleaner version...
top_srcdir=`dirname $0`
changequote(, )dnl
ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
MS2_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/mediastreamer2/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
changequote([, ])dnl
AC_SUBST([ORTP_VERSION])
AC_SUBST([MS2_VERSION])
dnl ##################################################
dnl # Check for doxygen
dnl ##################################################
......@@ -441,7 +463,7 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
AC_OUTPUT([
Makefile
m4/Makefile
po/Makefile.in
po/Makefile.in
pixmaps/Makefile
coreapi/Makefile
coreapi/help/Makefile
......
......@@ -9,9 +9,7 @@ INCLUDES = \
-I$(top_srcdir)/coreapi\
$(ORTP_CFLAGS) \
-I$(top_srcdir)/exosip \
-I$(top_srcdir)/mediastreamer2/include
$(MEDIASTREAMER_CFLAGS)
bin_PROGRAMS = linphonec linphonecsh
......@@ -22,7 +20,7 @@ endif
linphonec_SOURCES = linphonec.c linphonec.h commands.c
linphonec_CFLAGS=$(COMMON_CFLAGS) $(CONSOLE_FLAGS)
linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) \
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
$(MEDIASTREAMER_LIBS) \
$(ORTP_LIBS) \
$(SPEEX_LIBS) \
$(OSIP_LIBS)
......@@ -41,7 +39,7 @@ sipomatic_CFLAGS= $(COMMON_CFLAGS) $(CONSOLE_FLAGS)
sipomatic_LDADD= $(INTLLIBS) \
$(top_builddir)/coreapi/liblinphone.la \
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
$(MEDIASTREAMER_LIBS) \
$(ORTP_LIBS) \
$(SPEEX_LIBS) \
$(OSIP_LIBS)
......
......@@ -89,8 +89,13 @@ 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);
#ifdef VIDEO_ENABLED
static int lpc_cmd_camera(LinphoneCore *lc, char *args);
static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
#endif
static int lpc_cmd_states(LinphoneCore *lc, char *args);
static int lpc_cmd_identify(LinphoneCore *lc, char *args);
static int lpc_cmd_ringback(LinphoneCore *lc, char *args);
/* Command handler helpers */
static void linphonec_proxy_add(LinphoneCore *lc);
......@@ -136,9 +141,12 @@ static LPC_COMMAND commands[] = {
"'help <command>'\t: displays specific help for command.\n"
"'help advanced'\t: shows advanced commands.\n"
},
{ "call", lpc_cmd_call, "Call a SIP uri",
"'call <sip-url>' \t: initiate a call to the specified destination.\n"
"'call show' \t: show all the current calls with their id and status.\n"
{ "call", lpc_cmd_call, "Call a SIP uri or number",
#ifdef VIDEO_ENABLED
"'call <sip-url or number> [--audio-only]' \t: initiate a call to the specified destination.\n"
#else
"'call <sip-url or number>' \t: initiate a call to the specified destination.\n"
#endif
},
{ "calls", lpc_cmd_calls, "Show all the current calls with their id and status.",
NULL
......@@ -163,6 +171,11 @@ static LPC_COMMAND commands[] = {
"'resume <call id>' : hold off the call with given id\n"},
{ "mute", lpc_cmd_mute_mic,
"Mute microphone and suspend voice transmission."},
#ifdef VIDEO_ENABLED
{ "camera", lpc_cmd_camera, "Send camera output for current call.",
"'camera on'\t: allow sending of local camera video to remote end.\n"
"'camera off'\t: disable sending of local camera's video to remote end.\n"},
#endif
{ "unmute", lpc_cmd_unmute_mic,
"Unmute microphone and resume voice transmission."},
{ "duration", lpc_cmd_duration, "Print duration in seconds of the last call.", NULL },
......@@ -255,12 +268,14 @@ static LPC_COMMAND advanced_commands[] = {
"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."},
#ifdef VIDEO_ENABLED
{ "vwindow", lpc_cmd_video_window, "Control video display window",
"'vwindow show': shows video window\n"
"'vwindow hide': hides video window\n"
"'vwindow pos <x> <y>': Moves video window to x,y pixel coordinates\n"
"'vwindow size <width> <height>': Resizes video window"
},
#endif
{ "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions",
"'states global': shows global state of liblinphone \n"
"'states calls': shows state of calls\n"
......@@ -284,6 +299,14 @@ static LPC_COMMAND advanced_commands[] = {
"'staticpic set' : Set path to picture that should be used.\n"
"'staticpic fps' : Get/set frames per seconds for picture emission.\n"
},
{ "identify", lpc_cmd_identify, "Returns the user-agent string of far end",
"'identify' \t: returns remote user-agent string for current call.\n"
"'identify <id>' \t: returns remote user-agent string for call with supplied id.\n"
},
{ "ringback", lpc_cmd_ringback, "Specifies a ringback tone to be played to remote end during incoming calls",
"'ringback <path of mono .wav file>'\t: Specifies a ringback tone to be played to remote end during incoming calls\n"
"'ringback disable'\t: Disable playing of ringback tone to callers\n"
},
{ NULL,NULL,NULL,NULL}
};
......@@ -503,12 +526,19 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
}
{
LinphoneCall *call;
LinphoneCallParams *cp=linphone_core_create_default_call_parameters (lc);
char *opt;
if ( linphone_core_in_call(lc) )
{
linphonec_out("Terminate or hold on the current call first.\n");
return 1;
}
if ( NULL == (call=linphone_core_invite(lc, args)) )
opt=strstr(args,"--audio-only");
if (opt){
opt[0]='\0';
linphone_call_params_enable_video (cp,FALSE);
}
if ( NULL == (call=linphone_core_invite_with_params(lc, args,cp)) )
{
linphonec_out("Error from linphone_core_invite.\n");
}
......@@ -516,6 +546,7 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
{
snprintf(callee_name,sizeof(callee_name),"%s",args);
}
linphone_call_params_destroy(cp);
}
return 1;
}
......@@ -624,7 +655,7 @@ static int
lpc_cmd_terminate(LinphoneCore *lc, char *args)
{
if (linphone_core_get_calls(lc)==NULL){
linphonec_out("No active calls");
linphonec_out("No active calls\n");
return 1;
}
if (!args)
......@@ -645,7 +676,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
LinphoneCall *call=linphonec_get_call(id);
if (call){
if (linphone_core_terminate_call(lc,call)==-1){
linphonec_out("Could not stop the call with id %li",id);
linphonec_out("Could not stop the call with id %li\n",id);
}
}else return 0;
return 1;
......@@ -1636,7 +1667,6 @@ linphonec_proxy_remove(LinphoneCore *lc, int index)
}
linphone_core_remove_proxy_config(lc,cfg);
linphonec_out("Proxy %s removed.\n", cfg->reg_proxy);
linphone_proxy_config_destroy(cfg);
}
static int
......@@ -2166,11 +2196,11 @@ static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args)
return 1;
}
#ifdef VIDEO_ENABLED
static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
char subcommand[64];
int a,b;
int err;
#ifdef VIDEO_ENABLED
err=sscanf(args,"%s %i %i",subcommand,&a,&b);
if (err>=1){
if (strcmp(subcommand,"pos")==0){
......@@ -2191,11 +2221,10 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
lpc_video_params.refresh=TRUE;
}else return 0;
}
#else
linphonec_out("Sorry, this version of linphonec wasn't compiled with video support.");
#endif
return 1;
}
#endif
static void lpc_display_global_state(LinphoneCore *lc){
linphonec_out("Global liblinphone state\n%s\n",
......@@ -2261,6 +2290,90 @@ static int lpc_cmd_states(LinphoneCore *lc, char *args){
return 0;
}
#ifdef VIDEO_ENABLED
static int lpc_cmd_camera(LinphoneCore *lc, char *args){
LinphoneCall *call=linphone_core_get_current_call(lc);
bool_t activated=FALSE;
if (linphone_core_video_enabled (lc)==FALSE){
linphonec_out("Video is disabled, re-run linphonec with -V option.");
return 1;
}
if (args){
if (strcmp(args,"on")==0)
activated=TRUE;
else if (strcmp(args,"off")==0)
activated=FALSE;
else
return 0;
}
if (call==NULL){
if (args){
linphonec_camera_enabled=activated;
}
if (linphonec_camera_enabled){
linphonec_out("Camera is enabled. Video stream will be setup immediately for outgoing and incoming calls.\n");
}else{
linphonec_out("Camera is disabled. Calls will be established with audio-only, with the possibility to later add video using 'camera on'.\n");
}
}else{
const LinphoneCallParams *cp=linphone_call_get_current_params (call);
if (args){
linphone_call_enable_camera(call,activated);
if ((activated && !linphone_call_params_video_enabled (cp))){
/*update the call to add the video stream*/
LinphoneCallParams *ncp=linphone_call_params_copy(cp);
linphone_call_params_enable_video(ncp,TRUE);
linphone_core_update_call(lc,call,ncp);
linphone_call_params_destroy (ncp);
linphonec_out("Trying to bring up video stream...\n");
}
}
if (linphone_call_camera_enabled (call))
linphonec_out("Camera is allowed for current call.\n");
else linphonec_out("Camera is dis-allowed for current call.\n");
}
return 1;
}
#endif
static int lpc_cmd_identify(LinphoneCore *lc, char *args){
LinphoneCall *call;
const char *remote_ua;
if (args==NULL){
call=linphone_core_get_current_call(lc);
if (call==NULL) {
linphonec_out("There is currently running call. Specify call id.\n");
return 0;
}
}else{
call=linphonec_get_call(atoi(args));
if (call==NULL){
return 0;
}
}
remote_ua=linphone_call_get_remote_user_agent(call);
if (remote_ua){
linphonec_out("Remote user agent string is: %s\n",remote_ua);
}
return 1;
}
static int lpc_cmd_ringback(LinphoneCore *lc, char *args){
if (!args) return 0;
if (strcmp(args,"disable")==0){
linphone_core_set_remote_ringback_tone(lc,NULL);
linphonec_out("Disabling ringback tone.\n");
return 1;
}
linphone_core_set_remote_ringback_tone (lc,args);
linphonec_out("Using %s as ringback tone to be played to callers.",args);
return 1;
}
/***************************************************************************
*
* Command table management funx
......
......@@ -173,6 +173,8 @@ static bool_t pipe_reader_run=FALSE;
static ortp_pipe_t server_sock;
#endif /*_WIN32_WCE*/
bool_t linphonec_camera_enabled=TRUE;
extern VideoParams lpc_video_params;
......@@ -313,6 +315,13 @@ linphonec_new_unknown_subscriber(LinphoneCore *lc, LinphoneFriend *lf,
}
static void linphonec_call_updated(LinphoneCall *call){
const LinphoneCallParams *cp=linphone_call_get_current_params(call);
if (!linphone_call_camera_enabled (call) && linphone_call_params_video_enabled (cp)){
linphonec_out("Far end requests to share video.\nType 'camera on' if you agree.");
}
}
static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){
char *from=linphone_call_get_remote_address_as_string(call);
long id=(long)linphone_call_get_user_pointer (call);
......@@ -337,6 +346,7 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L
break;
case LinphoneCallIncomingReceived:
linphonec_call_identify(call);
linphone_call_enable_camera (call,linphonec_camera_enabled);
id=(long)linphone_call_get_user_pointer (call);
linphonec_set_caller(from);
if ( auto_answer) {
......@@ -347,6 +357,9 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L
case LinphoneCallOutgoingInit:
linphonec_call_identify(call);
break;
case LinphoneCallUpdatedByRemote:
linphonec_call_updated(call);
break;
default:
break;
}
......@@ -734,7 +747,7 @@ linphonec_finish(int exit_status)
{
fclose (mylogfile);
}
printf("\n");
exit(exit_status);
}
......
......@@ -121,6 +121,8 @@ void linphonec_set_caller(const char *caller);
LinphoneCall *linphonec_get_call(long id);
void linphonec_call_identify(LinphoneCall* call);
extern bool_t linphonec_camera_enabled;
#endif /* def LINPHONEC_H */
/****************************************************************************
......
......@@ -10,7 +10,7 @@ linphone_include_HEADERS=linphonecore.h linphonecore_utils.h ../config.h lpconfi
INCLUDES = \
-I$(top_srcdir)\
-I$(top_srcdir)/mediastreamer2/include
$(MEDIASTREAMER_CFLAGS)
lib_LTLIBRARIES=liblinphone.la
......@@ -42,7 +42,7 @@ liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined
liblinphone_la_LIBADD= \
$(EXOSIP_LIBS) \
$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
$(MEDIASTREAMER_LIBS) \
$(ORTP_LIBS)
if BUILD_WIN32
......@@ -53,11 +53,14 @@ noinst_PROGRAMS=test_lsd
test_lsd_SOURCES=test_lsd.c
test_lsd_LDADD=liblinphone.la
test_lsd_LDADD=liblinphone.la \
$(MEDIASTREAMER_LIBS) \
$(ORTP_LIBS)
AM_CFLAGS=$(STRICT_OPTIONS) -DIN_LINPHONE \
$(ORTP_CFLAGS) \
$(OSIP_CFLAGS) \
$(MEDIASTREAMER_CFLAGS) \
$(EXOSIP_CFLAGS) \
-DENABLE_TRACE \
-DLOG_DOMAIN=\"LinphoneCore\" \
......
......@@ -129,6 +129,29 @@ char *linphone_address_as_string_uri_only(const LinphoneAddress *u){
return sal_address_as_string_uri_only(u);
}
static bool_t strings_equals(const char *s1, const char *s2){
if (s1==NULL && s2==NULL) return TRUE;
if (s1!=NULL && s2!=NULL && strcmp(s1,s2)==0) return TRUE;
return FALSE;
}
/**
* Compare two LinphoneAddress ignoring tags and headers, basically just domain, username, and port.
* Returns TRUE if they are equal.
**/
bool_t linphone_address_weak_compare(const LinphoneAddress *a1, const LinphoneAddress *a2){
const char *u1,*u2;
const char *h1,*h2;
int p1,p2;
u1=linphone_address_get_username(a1);
u2=linphone_address_get_username(a2);
p1=linphone_address_get_port_int(a1);
p2=linphone_address_get_port_int(a2);
h1=linphone_address_get_domain(a1);
h2=linphone_address_get_domain(a2);
return strings_equals(u1,u2) && strings_equals(h1,h2) && p1==p2;
}
/**
* Destroys a LinphoneAddress object.
**/
......@@ -139,6 +162,7 @@ void linphone_address_destroy(LinphoneAddress *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);
}
......
......@@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphonecore.h"
#include "private.h"
#include "mediastreamer2/mediastream.h"
#include "lpconfig.h"
static void register_failure(SalOp *op, SalError error, SalReason reason, const char *details);
static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){
if (lc->ringstream!=NULL){
......@@ -33,6 +35,18 @@ static void linphone_connect_incoming(LinphoneCore *lc, LinphoneCall *call){
linphone_call_start_media_streams(call);
}
static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){
MSList *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall*)elem->data;
if (linphone_address_weak_compare(call->log->from,from) &&
linphone_address_weak_compare(call->log->to, to)){
return TRUE;
}
}
return FALSE;
}
static void call_received(SalOp *h){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
char *barmesg;
......@@ -40,7 +54,9 @@ static void call_received(SalOp *h){
const char *from,*to;
char *tmp;
LinphoneAddress *from_parsed;
LinphoneAddress *from_addr, *to_addr;
const char * early_media=linphone_core_get_remote_ringback_tone (lc);
/* first check if we can answer successfully to this invite */
if (lc->presence_mode==LinphoneStatusBusy ||
lc->presence_mode==LinphoneStatusOffline ||
......@@ -64,9 +80,18 @@ static void call_received(SalOp *h){
}
from=sal_op_get_from(h);
to=sal_op_get_to(h);
from_addr=linphone_address_new(from);
to_addr=linphone_address_new(to);
if (is_duplicate_call(lc,from_addr,to_addr)){
ms_warning("Receiving duplicated call, refusing this one.");
sal_call_decline(h,SalReasonBusy,NULL);
linphone_address_destroy(from_addr);
linphone_address_destroy(to_addr);
return;
}
call=linphone_call_new_incoming(lc,linphone_address_new(from),linphone_address_new(to),h);
call=linphone_call_new_incoming(lc,from_addr,to_addr,h);
sal_call_set_local_media_description(h,call->localdesc);
call->resultdesc=sal_call_get_final_media_description(h);
if (call->resultdesc)
......@@ -76,14 +101,11 @@ static void call_received(SalOp *h){
linphone_call_unref(call);
return;
}
/* the call is acceptable so we can now add it to our list */
if(linphone_core_add_call(lc,call)!= 0)
{
ms_warning("we cannot handle anymore call\n");
sal_call_decline(h,SalReasonMedia,NULL);
linphone_call_unref(call);
return;
}
linphone_core_add_call(lc,call);
from_parsed=linphone_address_new(sal_op_get_from(h));
linphone_address_clean(from_parsed);
tmp=linphone_address_as_string(from_parsed);
......@@ -115,9 +137,12 @@ static void call_received(SalOp *h){
}else{
/*TODO : play a tone within the context of the current call */
}
sal_call_notify_ringing(h);
sal_call_notify_ringing(h,early_media!=NULL);
#if !(__IPHONE_OS_VERSION_MIN_REQUIRED >= 40000)