mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Merge branch 'master' of git://git.linphone.org/linphone into belle-sip
This commit is contained in:
commit
ee49cc9029
70 changed files with 17103 additions and 12201 deletions
27
configure.ac
27
configure.ac
|
|
@ -33,13 +33,12 @@ AM_INIT_AUTOMAKE
|
|||
AC_SUBST([LIBTOOL_DEPS])
|
||||
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
|
||||
AC_SUBST([docdir], [${datadir}/doc])
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_ISC_POSIX
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_C_INLINE
|
||||
AM_PROG_CC_STDC
|
||||
AC_HEADER_STDC
|
||||
AM_PROG_CC_C_O
|
||||
AC_CHECK_PROGS(MD5SUM,[md5sum md5])
|
||||
|
|
@ -85,6 +84,19 @@ IT_PROG_INTLTOOL([0.40], [no-xml])
|
|||
AM_CONDITIONAL(BUILD_TESTS,test x$build_tests != xno)
|
||||
dnl Initialize libtool
|
||||
LT_INIT([win32-dll shared disable-static])
|
||||
dnl Enable library dependencies linking
|
||||
AC_ARG_ENABLE(deplibs-link,
|
||||
[AS_HELP_STRING([--disable-deplibs-link ], [Disable library dependencies linking (might break builds)])],
|
||||
[enable_deplibs_linking="$enableval"],
|
||||
[enable_deplibs_linking="yes"])
|
||||
AC_MSG_NOTICE([Enable library dependencies linking: $enable_interlib_deps])
|
||||
if test "${enable_deplibs_linking}" == "yes"; then
|
||||
link_all_deplibs=yes
|
||||
link_all_deplibs_CXX=yes
|
||||
else
|
||||
link_all_deplibs=no
|
||||
link_all_deplibs_CXX=no
|
||||
fi
|
||||
|
||||
AC_CONFIG_COMMANDS([libtool-hacking],[
|
||||
if test "$mingw_found" = "yes" ; then
|
||||
|
|
@ -370,6 +382,17 @@ fi
|
|||
dnl setup flags for exosip library
|
||||
LP_SETUP_EXOSIP
|
||||
|
||||
dnl check exosip support of DSCP in exosip
|
||||
AC_MSG_CHECKING([for DSCP support in exosip])
|
||||
AC_TRY_COMPILE([#include <eXosip2/eXosip.h>],
|
||||
[int dscp=0;eXosip_set_option(EXOSIP_OPT_SET_DSCP,&dscp);],
|
||||
has_exosip_dscp=yes,has_exosip_dscp=no)
|
||||
AC_MSG_RESULT($has_exosip_dscp)
|
||||
if test "$has_exosip_dscp" = "yes" ; then
|
||||
AC_DEFINE( HAVE_EXOSIP_DSCP, 1, [Define if exosip dscp available] )
|
||||
fi
|
||||
|
||||
|
||||
if test "$console_ui" = "true" ; then
|
||||
dnl check gnu readline
|
||||
LP_CHECK_READLINE
|
||||
|
|
|
|||
|
|
@ -26,11 +26,8 @@ endif
|
|||
|
||||
linphonec_SOURCES=linphonec.c linphonec.h commands.c
|
||||
linphonec_CFLAGS=$(COMMON_CFLAGS) $(CONSOLE_FLAGS)
|
||||
linphonec_LDADD=$(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(ORTP_LIBS) \
|
||||
$(SPEEX_LIBS) \
|
||||
$(OSIP_LIBS) \
|
||||
linphonec_LDADD=$(top_builddir)/coreapi/liblinphone.la \
|
||||
$(READLINE_LIBS) \
|
||||
$(X11_LIBS)
|
||||
|
||||
if BUILD_WIN32
|
||||
|
|
|
|||
|
|
@ -895,22 +895,22 @@ linphonec_prompt_for_auth_final(LinphoneCore *lc)
|
|||
void
|
||||
print_usage (int exit_status)
|
||||
{
|
||||
fprintf (stdout, "\n\
|
||||
usage: linphonec [-c file] [-s sipaddr] [-a] [-V] [-d level ] [-l logfile]\n\
|
||||
linphonec -v\n\
|
||||
\n\
|
||||
-b file specify path of readonly factory configuration file.\n\
|
||||
-c file specify path of configuration file.\n\
|
||||
-d level be verbose. 0 is no output. 6 is all output\n\
|
||||
-l logfile specify the log file for your SIP phone\n\
|
||||
-s sipaddress specify the sip call to do at startup\n\
|
||||
-a enable auto answering for incoming calls\n\
|
||||
-V enable video features globally (disabled by default)\n\
|
||||
-C enable video capture only (disabled by default)\n\
|
||||
-D enable video display only (disabled by default)\n\
|
||||
-S show general state messages (disabled by default)\n\
|
||||
--wid windowid force embedding of video window into provided windowid (disabled by default)\n\
|
||||
-v or --version display version and exits.\n");
|
||||
fprintf (stdout, "\n"
|
||||
"usage: linphonec [-c file] [-s sipaddr] [-a] [-V] [-d level ] [-l logfile]\n"
|
||||
"linphonec -v\n"
|
||||
"\n"
|
||||
" -b file specify path of readonly factory configuration file.\n"
|
||||
" -c file specify path of configuration file.\n"
|
||||
" -d level be verbose. 0 is no output. 6 is all output\n"
|
||||
" -l logfile specify the log file for your SIP phone\n"
|
||||
" -s sipaddress specify the sip call to do at startup\n"
|
||||
" -a enable auto answering for incoming calls\n"
|
||||
" -V enable video features globally (disabled by default)\n"
|
||||
" -C enable video capture only (disabled by default)\n"
|
||||
" -D enable video display only (disabled by default)\n"
|
||||
" -S show general state messages (disabled by default)\n"
|
||||
" --wid windowid force embedding of video window into provided windowid (disabled by default)\n"
|
||||
" -v or --version display version and exits.\n");
|
||||
|
||||
exit(exit_status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ void TunnelManager::addServer(const char *ip, int port,unsigned int udpMirrorPor
|
|||
}
|
||||
|
||||
void TunnelManager::addServer(const char *ip, int port) {
|
||||
if (ip == NULL) {
|
||||
ip = "";
|
||||
ms_warning("Adding tunnel server with empty ip, it will not work!");
|
||||
}
|
||||
mServerAddrs.push_back(ServerAddr(ip,port));
|
||||
if (mTunnelClient) mTunnelClient->addServer(ip,port);
|
||||
}
|
||||
|
|
@ -253,7 +257,7 @@ void TunnelManager::processTunnelEvent(const Event &ev){
|
|||
//force transport to udp
|
||||
LCSipTransports lTransport;
|
||||
|
||||
lTransport.udp_port=15060;
|
||||
lTransport.udp_port=(0xDFFF&random())+1024;
|
||||
lTransport.tcp_port=0;
|
||||
lTransport.tls_port=0;
|
||||
lTransport.dtls_port=0;
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, in
|
|||
sprintf(key,"auth_info_%i",pos);
|
||||
lp_config_clean_section(config,key);
|
||||
|
||||
if (obj==NULL){
|
||||
if (obj==NULL || lp_config_get_int(config, "sip", "store_auth_info", 1) == 0){
|
||||
return;
|
||||
}
|
||||
if (obj->username!=NULL){
|
||||
|
|
|
|||
|
|
@ -344,7 +344,8 @@ static void call_accepted(SalOp *op){
|
|||
linphone_call_set_state(call,LinphoneCallConnected,"Connected");
|
||||
if (call->referer) linphone_core_notify_refer_state(lc,call->referer,call);
|
||||
}
|
||||
if (md && !sal_media_description_empty(md)){
|
||||
if (md && !sal_media_description_empty(md) && !linphone_core_incompatible_security(lc,md)){
|
||||
linphone_call_update_remote_session_id_and_ver(call);
|
||||
if (sal_media_description_has_dir(md,SalStreamSendOnly) ||
|
||||
sal_media_description_has_dir(md,SalStreamInactive)){
|
||||
if (lc->vtable.display_status){
|
||||
|
|
@ -393,7 +394,7 @@ static void call_accepted(SalOp *op){
|
|||
}else{
|
||||
/*send a bye*/
|
||||
ms_error("Incompatible SDP offer received in 200Ok, need to abort the call");
|
||||
linphone_core_abort_call(lc,call,_("Incompatible, check codecs..."));
|
||||
linphone_core_abort_call(lc,call,_("Incompatible, check codecs or security settings..."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -425,6 +426,7 @@ static void call_accept_update(LinphoneCore *lc, LinphoneCall *call){
|
|||
linphone_core_update_ice_from_remote_media_description(call,rmd);
|
||||
linphone_core_update_local_media_description_from_ice(call->localdesc,call->ice_session);
|
||||
}
|
||||
linphone_call_update_remote_session_id_and_ver(call);
|
||||
sal_call_accept(call->op);
|
||||
md=sal_call_get_final_media_description(call->op);
|
||||
if (md && !sal_media_description_empty(md))
|
||||
|
|
|
|||
|
|
@ -20,19 +20,19 @@ package org.linphone.core.tutorials;
|
|||
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -50,7 +50,7 @@ import org.linphone.core.LinphoneCore.RegistrationState;
|
|||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
public class TutorialChatRoom implements LinphoneCoreListener {
|
||||
public class TutorialChatRoom implements LinphoneCoreListener, LinphoneChatMessage.StateListener {
|
||||
private boolean running;
|
||||
private TutorialNotifier TutorialNotifier;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ public class TutorialChatRoom implements LinphoneCoreListener {
|
|||
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {}
|
||||
|
||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {
|
||||
write("Message ["+message+"] received from ["+from.asString()+"]");
|
||||
//Deprecated
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -118,7 +118,8 @@ public class TutorialChatRoom implements LinphoneCoreListener {
|
|||
LinphoneChatRoom chatRoom = lc.createChatRoom(destinationSipAddress);
|
||||
|
||||
// Send message
|
||||
chatRoom.sendMessage("Hello world");
|
||||
LinphoneChatMessage chatMessage = chatRoom.createLinphoneChatMessage("Hello world");
|
||||
chatRoom.sendMessage(chatMessage, this);
|
||||
|
||||
// main loop for receiving notifications and doing background linphonecore work
|
||||
running = true;
|
||||
|
|
@ -153,8 +154,13 @@ public class TutorialChatRoom implements LinphoneCoreListener {
|
|||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
||||
LinphoneChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
write("Message [" + message.getMessage() + "] received from [" + message.getFrom().asString() + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg,
|
||||
org.linphone.core.LinphoneChatMessage.State state) {
|
||||
write("Sent message [" + msg.getMessage() + "] new state is " + state.toString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,60 +31,257 @@
|
|||
#include "private.h"
|
||||
#include "lpconfig.h"
|
||||
|
||||
|
||||
LinphoneTunnel* linphone_core_get_tunnel(LinphoneCore *lc){
|
||||
return lc->tunnel;
|
||||
}
|
||||
|
||||
struct _LinphoneTunnelConfig {
|
||||
char *host;
|
||||
int port;
|
||||
int remote_udp_mirror_port;
|
||||
int delay;
|
||||
};
|
||||
|
||||
LinphoneTunnelConfig *linphone_tunnel_config_new() {
|
||||
LinphoneTunnelConfig *ltc = ms_new0(LinphoneTunnelConfig,1);
|
||||
ltc->remote_udp_mirror_port = 12345;
|
||||
ltc->delay = 1000;
|
||||
return ltc;
|
||||
}
|
||||
|
||||
void linphone_tunnel_config_set_host(LinphoneTunnelConfig *tunnel, const char *host) {
|
||||
if(tunnel->host != NULL) {
|
||||
ms_free(tunnel->host);
|
||||
tunnel->host = NULL;
|
||||
}
|
||||
if(host != NULL && strlen(host)) {
|
||||
tunnel->host = ms_strdup(host);
|
||||
}
|
||||
}
|
||||
|
||||
const char *linphone_tunnel_config_get_host(LinphoneTunnelConfig *tunnel) {
|
||||
return tunnel->host;
|
||||
}
|
||||
|
||||
void linphone_tunnel_config_set_port(LinphoneTunnelConfig *tunnel, int port) {
|
||||
tunnel->port = port;
|
||||
}
|
||||
|
||||
int linphone_tunnel_config_get_port(LinphoneTunnelConfig *tunnel) {
|
||||
return tunnel->port;
|
||||
}
|
||||
|
||||
void linphone_tunnel_config_set_remote_udp_mirror_port(LinphoneTunnelConfig *tunnel, int remote_udp_mirror_port) {
|
||||
tunnel->remote_udp_mirror_port = remote_udp_mirror_port;
|
||||
}
|
||||
|
||||
int linphone_tunnel_config_get_remote_udp_mirror_port(LinphoneTunnelConfig *tunnel) {
|
||||
return tunnel->remote_udp_mirror_port;
|
||||
}
|
||||
|
||||
void linphone_tunnel_config_set_delay(LinphoneTunnelConfig *tunnel, int delay) {
|
||||
tunnel->delay = delay;
|
||||
}
|
||||
|
||||
int linphone_tunnel_config_get_delay(LinphoneTunnelConfig *tunnel) {
|
||||
return tunnel->delay;
|
||||
}
|
||||
|
||||
void linphone_tunnel_config_destroy(LinphoneTunnelConfig *tunnel) {
|
||||
if(tunnel->host != NULL) {
|
||||
ms_free(tunnel->host);
|
||||
}
|
||||
ms_free(tunnel);
|
||||
}
|
||||
|
||||
#ifdef TUNNEL_ENABLED
|
||||
|
||||
static inline belledonnecomm::TunnelManager *bcTunnel(LinphoneTunnel *tunnel){
|
||||
return (belledonnecomm::TunnelManager *)tunnel;
|
||||
}
|
||||
|
||||
static inline _LpConfig *config(LinphoneTunnel *tunnel){
|
||||
return ((belledonnecomm::TunnelManager *)tunnel)->getLinphoneCore()->config;
|
||||
}
|
||||
struct _LinphoneTunnel {
|
||||
belledonnecomm::TunnelManager *manager;
|
||||
MSList *config_list;
|
||||
};
|
||||
|
||||
extern "C" LinphoneTunnel* linphone_core_tunnel_new(LinphoneCore *lc){
|
||||
LinphoneTunnel* tunnel= (LinphoneTunnel*) new belledonnecomm::TunnelManager(lc);
|
||||
LinphoneTunnel* tunnel = ms_new0(LinphoneTunnel, 1);
|
||||
tunnel->manager = new belledonnecomm::TunnelManager(lc);
|
||||
return tunnel;
|
||||
}
|
||||
|
||||
static inline belledonnecomm::TunnelManager *bcTunnel(LinphoneTunnel *tunnel){
|
||||
return tunnel->manager;
|
||||
}
|
||||
|
||||
static inline _LpConfig *config(LinphoneTunnel *tunnel){
|
||||
return tunnel->manager->getLinphoneCore()->config;
|
||||
}
|
||||
|
||||
void linphone_tunnel_destroy(LinphoneTunnel *tunnel){
|
||||
delete bcTunnel(tunnel);
|
||||
delete tunnel->manager;
|
||||
ms_free(tunnel);
|
||||
}
|
||||
|
||||
static void add_server_to_config(LinphoneTunnel *tunnel, const char *host, int port){
|
||||
const char *orig=lp_config_get_string(config(tunnel),"tunnel","server_addresses", NULL);
|
||||
static char *linphone_tunnel_config_to_string(const LinphoneTunnelConfig *tunnel_config) {
|
||||
char *str = NULL;
|
||||
if(tunnel_config->remote_udp_mirror_port != -1) {
|
||||
str = ms_strdup_printf("%s:%d:%d:%d",
|
||||
tunnel_config->host,
|
||||
tunnel_config->port,
|
||||
tunnel_config->remote_udp_mirror_port,
|
||||
tunnel_config->delay);
|
||||
} else {
|
||||
str = ms_strdup_printf("%s:%d",
|
||||
tunnel_config->host,
|
||||
tunnel_config->port);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static LinphoneTunnelConfig *linphone_tunnel_config_from_string(const char *str) {
|
||||
LinphoneTunnelConfig *tunnel_config = NULL;
|
||||
char * dstr = ms_strdup(str);
|
||||
const char *host = NULL;
|
||||
int port = -1;
|
||||
int remote_udp_mirror_port = -1;
|
||||
int delay = -1;
|
||||
int pos = 0;
|
||||
char *pch;
|
||||
pch = strtok(dstr, ":");
|
||||
while(pch != NULL) {
|
||||
switch(pos) {
|
||||
case 0:
|
||||
host = pch;
|
||||
break;
|
||||
case 1:
|
||||
port = atoi(pch);
|
||||
break;
|
||||
case 2:
|
||||
remote_udp_mirror_port = atoi(pch);
|
||||
break;
|
||||
case 3:
|
||||
delay = atoi(pch);
|
||||
break;
|
||||
default:
|
||||
// Abort
|
||||
pos = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
++pos;
|
||||
pch = strtok(NULL, ":");
|
||||
}
|
||||
if(pos >= 2) {
|
||||
tunnel_config = linphone_tunnel_config_new();
|
||||
linphone_tunnel_config_set_host(tunnel_config, host);
|
||||
linphone_tunnel_config_set_port(tunnel_config, port);
|
||||
}
|
||||
if(pos >= 3) {
|
||||
linphone_tunnel_config_set_remote_udp_mirror_port(tunnel_config, remote_udp_mirror_port);
|
||||
}
|
||||
if(pos == 4) {
|
||||
linphone_tunnel_config_set_delay(tunnel_config, delay);
|
||||
}
|
||||
ms_free(dstr);
|
||||
return tunnel_config;
|
||||
}
|
||||
|
||||
|
||||
static void linphone_tunnel_save_config(LinphoneTunnel *tunnel) {
|
||||
MSList *elem = tunnel->config_list;
|
||||
char *tmp = NULL, *old_tmp = NULL, *tc_str = NULL;
|
||||
while(elem != NULL) {
|
||||
LinphoneTunnelConfig *tunnel_config = (LinphoneTunnelConfig *)elem->data;
|
||||
tc_str = linphone_tunnel_config_to_string(tunnel_config);
|
||||
if(tmp != NULL) {
|
||||
old_tmp = tmp;
|
||||
tmp = ms_strdup_printf("%s %s", old_tmp, tc_str);
|
||||
ms_free(old_tmp);
|
||||
ms_free(tc_str);
|
||||
} else {
|
||||
tmp = tc_str;
|
||||
}
|
||||
elem = elem->next;
|
||||
}
|
||||
lp_config_set_string(config(tunnel), "tunnel", "server_addresses", tmp);
|
||||
if(tmp != NULL) {
|
||||
ms_free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void linphone_tunnel_add_server_intern(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config) {
|
||||
if(tunnel_config->remote_udp_mirror_port == -1) {
|
||||
bcTunnel(tunnel)->addServer(tunnel_config->host, tunnel_config->port);
|
||||
} else {
|
||||
bcTunnel(tunnel)->addServer(tunnel_config->host, tunnel_config->port,
|
||||
tunnel_config->remote_udp_mirror_port, tunnel_config->delay);
|
||||
}
|
||||
tunnel->config_list = ms_list_append(tunnel->config_list, tunnel_config);
|
||||
}
|
||||
|
||||
|
||||
static void linphone_tunnel_load_config(LinphoneTunnel *tunnel){
|
||||
const char * confaddress = lp_config_get_string(config(tunnel), "tunnel", "server_addresses", NULL);
|
||||
char *tmp;
|
||||
if (orig){
|
||||
tmp=ms_strdup_printf("%s %s:%i",orig,host,port);
|
||||
}else tmp=ms_strdup_printf("%s:%i",host, port);
|
||||
lp_config_set_string(config(tunnel),"tunnel","server_addresses",tmp);
|
||||
ms_free(tmp);
|
||||
const char *it;
|
||||
LinphoneTunnelConfig *tunnel_config;
|
||||
int adv;
|
||||
if(confaddress != NULL) {
|
||||
tmp = ms_strdup(confaddress);
|
||||
it = confaddress;
|
||||
while(confaddress[0] != '\0') {
|
||||
int ret = sscanf(it,"%s%n", tmp, &adv);
|
||||
if (ret >= 1){
|
||||
it += adv;
|
||||
tunnel_config = linphone_tunnel_config_from_string(tmp);
|
||||
if(tunnel_config != NULL) {
|
||||
linphone_tunnel_add_server_intern(tunnel, tunnel_config);
|
||||
} else {
|
||||
ms_error("Tunnel server address incorrectly specified from config file: %s", tmp);
|
||||
}
|
||||
} else break;
|
||||
}
|
||||
ms_free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port){
|
||||
bcTunnel(tunnel)->addServer(host, port);
|
||||
add_server_to_config(tunnel,host,port);
|
||||
static void linphone_tunnel_refresh_config(LinphoneTunnel *tunnel) {
|
||||
MSList *old_list = tunnel->config_list;
|
||||
tunnel->config_list = NULL;
|
||||
bcTunnel(tunnel)->cleanServers();
|
||||
while(old_list != NULL) {
|
||||
LinphoneTunnelConfig *tunnel_config = (LinphoneTunnelConfig *)old_list->data;
|
||||
linphone_tunnel_add_server_intern(tunnel, tunnel_config);
|
||||
old_list = old_list->next;
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay){
|
||||
bcTunnel(tunnel)->addServer(host, port, remote_udp_mirror, delay);
|
||||
/*FIXME, udp-mirror feature not saved in config*/
|
||||
add_server_to_config(tunnel,host,port);
|
||||
void linphone_tunnel_add_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config) {
|
||||
linphone_tunnel_add_server_intern(tunnel, tunnel_config);
|
||||
linphone_tunnel_save_config(tunnel);
|
||||
}
|
||||
|
||||
char *linphone_tunnel_get_servers(LinphoneTunnel *tunnel){
|
||||
const char *tmp=lp_config_get_string(config(tunnel),"tunnel","server_addresses",NULL);
|
||||
if (tmp) return ms_strdup(tmp);
|
||||
return NULL;
|
||||
void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config) {
|
||||
MSList *elem = ms_list_find(tunnel->config_list, tunnel_config);
|
||||
if(elem != NULL) {
|
||||
tunnel->config_list = ms_list_remove(tunnel->config_list, tunnel_config);
|
||||
linphone_tunnel_config_destroy(tunnel_config);
|
||||
linphone_tunnel_refresh_config(tunnel);
|
||||
linphone_tunnel_save_config(tunnel);
|
||||
}
|
||||
}
|
||||
|
||||
const MSList *linphone_tunnel_get_servers(LinphoneTunnel *tunnel){
|
||||
return tunnel->config_list;
|
||||
}
|
||||
|
||||
void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel){
|
||||
bcTunnel(tunnel)->cleanServers();
|
||||
lp_config_set_string(config(tunnel),"tunnel","server_addresses",NULL);
|
||||
|
||||
/* Free the list */
|
||||
ms_list_for_each(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
|
||||
tunnel->config_list = ms_list_free(tunnel->config_list);
|
||||
|
||||
linphone_tunnel_save_config(tunnel);
|
||||
}
|
||||
|
||||
void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled){
|
||||
|
|
@ -173,28 +370,6 @@ void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel){
|
|||
bcTunnel(tunnel)->autoDetect();
|
||||
}
|
||||
|
||||
static void tunnel_add_servers_from_config(LinphoneTunnel *tunnel, const char* confaddress){
|
||||
char *tmp=(char*)ms_malloc0(strlen(confaddress)+1);
|
||||
const char *it=confaddress;
|
||||
int adv;
|
||||
do{
|
||||
int ret=sscanf(it,"%s%n",tmp,&adv);
|
||||
if (ret>=1){
|
||||
it+=adv;
|
||||
char *port=strchr(tmp,':');
|
||||
if (!port){
|
||||
ms_error("Tunnel server addresses incorrectly specified from config file: %s",it);
|
||||
break;
|
||||
}else{
|
||||
*port='\0';
|
||||
port++;
|
||||
bcTunnel(tunnel)->addServer(tmp, atoi(port));
|
||||
}
|
||||
}else break;
|
||||
}while(1);
|
||||
ms_free(tmp);
|
||||
}
|
||||
|
||||
static void my_ortp_logv(OrtpLogLevel level, const char *fmt, va_list args){
|
||||
ortp_logv(level,fmt,args);
|
||||
}
|
||||
|
|
@ -205,10 +380,8 @@ static void my_ortp_logv(OrtpLogLevel level, const char *fmt, va_list args){
|
|||
*/
|
||||
void linphone_tunnel_configure(LinphoneTunnel *tunnel){
|
||||
bool_t enabled=(bool_t)lp_config_get_int(config(tunnel),"tunnel","enabled",FALSE);
|
||||
const char* addresses=lp_config_get_string(config(tunnel),"tunnel","server_addresses", NULL);
|
||||
linphone_tunnel_enable_logs_with_handler(tunnel,TRUE,my_ortp_logv);
|
||||
if (addresses)
|
||||
tunnel_add_servers_from_config(tunnel,addresses);
|
||||
linphone_tunnel_load_config(tunnel);
|
||||
linphone_tunnel_enable(tunnel, enabled);
|
||||
}
|
||||
|
||||
|
|
@ -220,13 +393,13 @@ void linphone_tunnel_destroy(LinphoneTunnel *tunnel){
|
|||
}
|
||||
|
||||
|
||||
void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port){
|
||||
void linphone_tunnel_add_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config){
|
||||
}
|
||||
|
||||
void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay){
|
||||
void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config){
|
||||
}
|
||||
|
||||
char *linphone_tunnel_get_servers(LinphoneTunnel *tunnel){
|
||||
const MSList *linphone_tunnel_get_servers(LinphoneTunnel *tunnel){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef LINPHONETUNNELMANAGER_H
|
||||
#define LINPHONETUNNELMANAGER_H
|
||||
#ifndef LINPHONETUNNEL_H
|
||||
#define LINPHONETUNNEL_H
|
||||
|
||||
#include "linphonecore.h"
|
||||
|
||||
|
|
@ -48,34 +48,108 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
typedef struct _LinphoneTunnelConfig LinphoneTunnelConfig;
|
||||
|
||||
/**
|
||||
* Add a tunnel server. At least one should be provided to be able to connect.
|
||||
* When several addresses are provided, the tunnel client may try each of them until it gets connected.
|
||||
* @param tunnel object
|
||||
* @param host server ip address
|
||||
* Create a new tunnel configuration
|
||||
*/
|
||||
LinphoneTunnelConfig *linphone_tunnel_config_new();
|
||||
|
||||
/**
|
||||
* Set address of server.
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
* @param host tunnel server ip address
|
||||
*/
|
||||
void linphone_tunnel_config_set_host(LinphoneTunnelConfig *tunnel, const char *host);
|
||||
|
||||
/**
|
||||
* Get address of server.
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
*/
|
||||
const char *linphone_tunnel_config_get_host(LinphoneTunnelConfig *tunnel);
|
||||
|
||||
/**
|
||||
* Set tls port of server.
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
* @param port tunnel server tls port, recommended value is 443
|
||||
*/
|
||||
void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port);
|
||||
void linphone_tunnel_config_set_port(LinphoneTunnelConfig *tunnel, int port);
|
||||
|
||||
/**
|
||||
*Add tunnel server with auto detection capabilities
|
||||
* Get tls port of server.
|
||||
*
|
||||
* @param tunnel object
|
||||
* @param host tunnel server ip address
|
||||
* @param port tunnel server tls port, recommended value is 443
|
||||
* @param remote_udp_mirror_port remote port on the tunnel server side used to test udp reachability
|
||||
* @param tunnel configuration object
|
||||
*/
|
||||
int linphone_tunnel_config_get_port(LinphoneTunnelConfig *tunnel);
|
||||
|
||||
/**
|
||||
* Set the remote port on the tunnel server side used to test udp reachability.
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
* @param remote_udp_mirror_port remote port on the tunnel server side used to test udp reachability, set to -1 to disable the feature
|
||||
*/
|
||||
void linphone_tunnel_config_set_remote_udp_mirror_port(LinphoneTunnelConfig *tunnel, int remote_udp_mirror_port);
|
||||
|
||||
/**
|
||||
* Get the remote port on the tunnel server side used to test udp reachability.
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
*/
|
||||
int linphone_tunnel_config_get_remote_udp_mirror_port(LinphoneTunnelConfig *tunnel);
|
||||
|
||||
/**
|
||||
* Set the udp packet round trip delay in ms for a tunnel configuration.
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
* @param delay udp packet round trip delay in ms considered as acceptable. recommended value is 1000 ms.
|
||||
*/
|
||||
void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror_port, int delay);
|
||||
void linphone_tunnel_config_set_delay(LinphoneTunnelConfig *tunnel, int delay);
|
||||
|
||||
/**
|
||||
* Get the udp packet round trip delay in ms for a tunnel configuration.
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
*/
|
||||
int linphone_tunnel_config_get_delay(LinphoneTunnelConfig *tunnel);
|
||||
|
||||
/**
|
||||
* Destroy a tunnel configuration
|
||||
*
|
||||
* @param tunnel configuration object
|
||||
*/
|
||||
void linphone_tunnel_config_destroy(LinphoneTunnelConfig *tunnel);
|
||||
|
||||
/**
|
||||
* Add tunnel server configuration
|
||||
*
|
||||
* @param tunnel object
|
||||
* @param tunnel_config object
|
||||
*/
|
||||
void linphone_tunnel_add_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config);
|
||||
|
||||
/**
|
||||
* Remove tunnel server configuration
|
||||
*
|
||||
* @param tunnel object
|
||||
* @param tunnel_config object
|
||||
*/
|
||||
void linphone_tunnel_remove_server(LinphoneTunnel *tunnel, LinphoneTunnelConfig *tunnel_config);
|
||||
|
||||
/**
|
||||
* @param tunnel object
|
||||
* returns a string of space separated list of host:port of tunnel server addresses
|
||||
* */
|
||||
char *linphone_tunnel_get_servers(LinphoneTunnel *tunnel);
|
||||
const MSList *linphone_tunnel_get_servers(LinphoneTunnel *tunnel);
|
||||
|
||||
/**
|
||||
* @param tunnel object
|
||||
* Removes all tunnel server address previously entered with addServer()
|
||||
**/
|
||||
void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel);
|
||||
|
||||
/**
|
||||
* Sets whether tunneling of SIP and RTP is required.
|
||||
* @param tunnel object
|
||||
|
|
@ -84,11 +158,13 @@ void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel);
|
|||
*
|
||||
**/
|
||||
void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled);
|
||||
|
||||
/**
|
||||
* @param tunnel object
|
||||
* Returns a boolean indicating whether tunneled operation is enabled.
|
||||
**/
|
||||
bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel);
|
||||
|
||||
/**
|
||||
* @param tunnel object
|
||||
* Forces reconnection to the tunnel server.
|
||||
|
|
@ -97,6 +173,7 @@ bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel);
|
|||
* the lost connection to be closed and new connection to be issued.
|
||||
**/
|
||||
void linphone_tunnel_reconnect(LinphoneTunnel *tunnel);
|
||||
|
||||
/**
|
||||
* Start tunnel need detection.
|
||||
* @param tunnel object
|
||||
|
|
@ -129,8 +206,6 @@ void linphone_tunnel_get_http_proxy(LinphoneTunnel*tunnel,const char **host, int
|
|||
void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd);
|
||||
|
||||
|
||||
void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled);
|
||||
|
||||
/**
|
||||
* @}
|
||||
**/
|
||||
|
|
@ -140,5 +215,5 @@ void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled);
|
|||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
#endif //LINPHONETUNNEL_H
|
||||
|
||||
|
|
|
|||
|
|
@ -1667,18 +1667,20 @@ void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescript
|
|||
new_stream = sal_media_description_find_stream(new_md, SalProtoRtpSavp, SalAudio);
|
||||
if (old_stream && new_stream) {
|
||||
const SalStreamDescription *local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalAudio);
|
||||
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag);
|
||||
if (crypto_idx >= 0) {
|
||||
audio_stream_enable_srtp(call->audiostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key);
|
||||
call->audiostream_encrypted = TRUE;
|
||||
} else {
|
||||
ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag);
|
||||
call->audiostream_encrypted = FALSE;
|
||||
}
|
||||
for (i = 0; i < SAL_CRYPTO_ALGO_MAX; i++) {
|
||||
old_stream->crypto[i].tag = new_stream->crypto[i].tag;
|
||||
old_stream->crypto[i].algo = new_stream->crypto[i].algo;
|
||||
strncpy(old_stream->crypto[i].master_key, new_stream->crypto[i].master_key, sizeof(old_stream->crypto[i].master_key) - 1);
|
||||
if (local_st_desc) {
|
||||
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag);
|
||||
if (crypto_idx >= 0) {
|
||||
audio_stream_enable_srtp(call->audiostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key);
|
||||
call->audiostream_encrypted = TRUE;
|
||||
} else {
|
||||
ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag);
|
||||
call->audiostream_encrypted = FALSE;
|
||||
}
|
||||
for (i = 0; i < SAL_CRYPTO_ALGO_MAX; i++) {
|
||||
old_stream->crypto[i].tag = new_stream->crypto[i].tag;
|
||||
old_stream->crypto[i].algo = new_stream->crypto[i].algo;
|
||||
strncpy(old_stream->crypto[i].master_key, new_stream->crypto[i].master_key, sizeof(old_stream->crypto[i].master_key) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1687,23 +1689,33 @@ void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescript
|
|||
new_stream = sal_media_description_find_stream(new_md, SalProtoRtpSavp, SalVideo);
|
||||
if (old_stream && new_stream) {
|
||||
const SalStreamDescription *local_st_desc = sal_media_description_find_stream(call->localdesc, SalProtoRtpSavp, SalVideo);
|
||||
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag);
|
||||
if (crypto_idx >= 0) {
|
||||
video_stream_enable_strp(call->videostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key);
|
||||
call->videostream_encrypted = TRUE;
|
||||
} else {
|
||||
ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag);
|
||||
call->videostream_encrypted = FALSE;
|
||||
}
|
||||
for (i = 0; i < SAL_CRYPTO_ALGO_MAX; i++) {
|
||||
old_stream->crypto[i].tag = new_stream->crypto[i].tag;
|
||||
old_stream->crypto[i].algo = new_stream->crypto[i].algo;
|
||||
strncpy(old_stream->crypto[i].master_key, new_stream->crypto[i].master_key, sizeof(old_stream->crypto[i].master_key) - 1);
|
||||
if (local_st_desc) {
|
||||
int crypto_idx = find_crypto_index_from_tag(local_st_desc->crypto, new_stream->crypto_local_tag);
|
||||
if (crypto_idx >= 0) {
|
||||
video_stream_enable_strp(call->videostream, new_stream->crypto[0].algo, local_st_desc->crypto[crypto_idx].master_key, new_stream->crypto[0].master_key);
|
||||
call->videostream_encrypted = TRUE;
|
||||
} else {
|
||||
ms_warning("Failed to find local crypto algo with tag: %d", new_stream->crypto_local_tag);
|
||||
call->videostream_encrypted = FALSE;
|
||||
}
|
||||
for (i = 0; i < SAL_CRYPTO_ALGO_MAX; i++) {
|
||||
old_stream->crypto[i].tag = new_stream->crypto[i].tag;
|
||||
old_stream->crypto[i].algo = new_stream->crypto[i].algo;
|
||||
strncpy(old_stream->crypto[i].master_key, new_stream->crypto[i].master_key, sizeof(old_stream->crypto[i].master_key) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void linphone_call_update_remote_session_id_and_ver(LinphoneCall *call) {
|
||||
SalMediaDescription *remote_desc = sal_call_get_remote_media_description(call->op);
|
||||
if (remote_desc) {
|
||||
call->remote_session_id = remote_desc->session_id;
|
||||
call->remote_session_ver = remote_desc->session_ver;
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_call_delete_ice_session(LinphoneCall *call){
|
||||
if (call->ice_session != NULL) {
|
||||
ice_session_destroy(call->ice_session);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ static void linphone_core_run_hooks(LinphoneCore *lc);
|
|||
static void linphone_core_free_hooks(LinphoneCore *lc);
|
||||
|
||||
#include "enum.h"
|
||||
|
||||
const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc);
|
||||
void linphone_core_get_local_ip(LinphoneCore *lc, const char *dest, char *result);
|
||||
static void toggle_video_preview(LinphoneCore *lc, bool_t val);
|
||||
|
|
@ -569,6 +570,7 @@ 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));
|
||||
linphone_core_verify_server_cn(lc,lp_config_get_int(lc->config,"sip","verify_server_cn",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*/
|
||||
|
|
@ -636,7 +638,8 @@ static void sip_config_read(LinphoneCore *lc)
|
|||
lc->sip_conf.ping_with_options=lp_config_get_int(lc->config,"sip","ping_with_options",1);
|
||||
lc->sip_conf.auto_net_state_mon=lp_config_get_int(lc->config,"sip","auto_net_state_mon",1);
|
||||
lc->sip_conf.keepalive_period=lp_config_get_int(lc->config,"sip","keepalive_period",10000);
|
||||
sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
|
||||
lc->sip_conf.tcp_tls_keepalive=lp_config_get_int(lc->config,"sip","tcp_tls_keepalive",0);
|
||||
linphone_core_enable_keep_alive(lc, (lc->sip_conf.keepalive_period > 0));
|
||||
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_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
|
||||
|
|
@ -2579,6 +2582,19 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md){
|
||||
if (linphone_core_is_media_encryption_mandatory(lc) && linphone_core_get_media_encryption(lc)==LinphoneMediaEncryptionSRTP){
|
||||
int i;
|
||||
for(i=0;i<md->nstreams;i++){
|
||||
SalStreamDescription *sd=&md->streams[i];
|
||||
if (sd->proto!=SalProtoRtpSavp){
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
|
||||
char *barmesg;
|
||||
char *tmp;
|
||||
|
|
@ -2590,10 +2606,12 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *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)){
|
||||
sal_call_decline(call->op,SalReasonMedia,NULL);
|
||||
linphone_call_unref(call);
|
||||
return;
|
||||
if (md){
|
||||
if (sal_media_description_empty(md) || linphone_core_incompatible_security(lc,md)){
|
||||
sal_call_decline(call->op,SalReasonMedia,NULL);
|
||||
linphone_call_unref(call);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from_parsed=linphone_address_new(sal_op_get_from(call->op));
|
||||
|
|
@ -2752,6 +2770,7 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call)
|
|||
}
|
||||
linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
|
||||
}
|
||||
linphone_call_update_remote_session_id_and_ver(call);
|
||||
sal_call_set_local_media_description(call->op,call->localdesc);
|
||||
sal_call_accept(call->op);
|
||||
md=sal_call_get_final_media_description(call->op);
|
||||
|
|
@ -2781,6 +2800,8 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call)
|
|||
* @return 0 if sucessful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state).
|
||||
**/
|
||||
int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
|
||||
SalMediaDescription *remote_desc;
|
||||
bool_t keep_sdp_version;
|
||||
#ifdef VIDEO_ENABLED
|
||||
bool_t old_has_video = call->params.has_video;
|
||||
#endif
|
||||
|
|
@ -2789,6 +2810,15 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const
|
|||
linphone_call_state_to_string(call->state));
|
||||
return -1;
|
||||
}
|
||||
remote_desc = sal_call_get_remote_media_description(call->op);
|
||||
keep_sdp_version = lp_config_get_int(lc->config, "sip", "keep_sdp_version", 0);
|
||||
if (keep_sdp_version &&(remote_desc->session_id == call->remote_session_id) && (remote_desc->session_ver == call->remote_session_ver)) {
|
||||
/* Remote has sent an INVITE with the same SDP as before, so send a 200 OK with the same SDP as before. */
|
||||
ms_warning("SDP version has not changed, send same SDP as before.");
|
||||
sal_call_accept(call->op);
|
||||
linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
|
||||
return 0;
|
||||
}
|
||||
if (params==NULL){
|
||||
call->params.has_video=lc->video_policy.automatically_accept || call->current_params.has_video;
|
||||
}else
|
||||
|
|
@ -2802,11 +2832,11 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const
|
|||
ms_warning("Video isn't supported in conference");
|
||||
call->params.has_video = FALSE;
|
||||
}
|
||||
call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op));
|
||||
call->params.has_video &= linphone_core_media_description_contains_video_stream(remote_desc);
|
||||
call->camera_active=call->params.has_video;
|
||||
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));
|
||||
linphone_core_update_ice_from_remote_media_description(call, remote_desc);
|
||||
#ifdef VIDEO_ENABLED
|
||||
if ((call->ice_session != NULL) &&!ice_session_candidates_gathered(call->ice_session)) {
|
||||
if ((call->params.has_video) && (call->params.has_video != old_has_video)) {
|
||||
|
|
@ -2933,6 +2963,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
|
|||
audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard);
|
||||
}
|
||||
|
||||
linphone_call_update_remote_session_id_and_ver(call);
|
||||
sal_call_accept(call->op);
|
||||
if (lc->vtable.display_status!=NULL)
|
||||
lc->vtable.display_status(lc,_("Connected."));
|
||||
|
|
@ -3716,6 +3747,13 @@ void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno){
|
|||
sal_verify_server_certificates(lc->sal,yesno);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether the tls server certificate common name must be verified when connecting to a SIP/TLS server.
|
||||
**/
|
||||
void linphone_core_verify_server_cn(LinphoneCore *lc, bool_t yesno){
|
||||
sal_verify_server_cn(lc->sal,yesno);
|
||||
}
|
||||
|
||||
static void notify_end_of_ring(void *ud, MSFilter *f, unsigned int event, void *arg){
|
||||
LinphoneCore *lc=(LinphoneCore*)ud;
|
||||
lc->preview_finished=1;
|
||||
|
|
@ -5173,6 +5211,7 @@ const char *linphone_error_to_string(LinphoneReason err){
|
|||
*/
|
||||
void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable) {
|
||||
if (enable > 0) {
|
||||
sal_use_tcp_tls_keepalive(lc->sal,lc->sip_conf.tcp_tls_keepalive);
|
||||
sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
|
||||
} else {
|
||||
sal_set_keepalive_period(lc->sal,0);
|
||||
|
|
|
|||
|
|
@ -1209,6 +1209,7 @@ void linphone_core_set_sound_source(LinphoneCore *lc, char source);
|
|||
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_verify_server_cn(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);
|
||||
|
|
@ -1429,7 +1430,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para
|
|||
*/
|
||||
bool_t linphone_core_tunnel_available(void);
|
||||
|
||||
typedef struct LinphoneTunnel LinphoneTunnel;
|
||||
typedef struct _LinphoneTunnel LinphoneTunnel;
|
||||
/**
|
||||
* get tunnel instance if available
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "linphonecore_utils.h"
|
||||
#include <ortp/zrtp.h>
|
||||
|
||||
#ifdef TUNNEL_ENABLED
|
||||
#include "linphone_tunnel.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "mediastreamer2/mediastream.h"
|
||||
|
|
@ -34,6 +31,8 @@ extern "C" {
|
|||
#include "private.h"
|
||||
#include <cpu-features.h>
|
||||
|
||||
#include "lpconfig.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
extern "C" void libmsilbc_init();
|
||||
|
|
@ -1792,6 +1791,9 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getStunServer(JNIEnv
|
|||
}
|
||||
|
||||
//CallParams
|
||||
extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_isLowBandwidthEnabled(JNIEnv *env, jobject thiz, jlong cp) {
|
||||
return (jboolean) linphone_call_params_low_bandwidth_enabled((LinphoneCallParams *)cp);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableLowBandwidth(JNIEnv *env, jobject thiz, jlong cp, jboolean enable) {
|
||||
linphone_call_params_enable_low_bandwidth((LinphoneCallParams *)cp, enable);
|
||||
|
|
@ -2123,8 +2125,14 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAddServerAndMirror
|
|||
jstring jHost, jint port, jint mirror, jint delay) {
|
||||
LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel;
|
||||
if (!tunnel) return;
|
||||
|
||||
const char* cHost=env->GetStringUTFChars(jHost, NULL);
|
||||
linphone_tunnel_add_server_and_mirror(tunnel, cHost, port, mirror, delay);
|
||||
LinphoneTunnelConfig *tunnelconfig = linphone_tunnel_config_new();
|
||||
linphone_tunnel_config_set_host(tunnelconfig, cHost);
|
||||
linphone_tunnel_config_set_port(tunnelconfig, port);
|
||||
linphone_tunnel_config_set_delay(tunnelconfig, delay);
|
||||
linphone_tunnel_config_set_remote_udp_mirror_port(tunnelconfig, mirror);
|
||||
linphone_tunnel_add_server(tunnel, tunnelconfig);
|
||||
env->ReleaseStringUTFChars(jHost, cHost);
|
||||
}
|
||||
|
||||
|
|
@ -2146,7 +2154,6 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelSetHttpProxy(JNIEn
|
|||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelAutoDetect(JNIEnv *env,jobject thiz,jlong pCore) {
|
||||
LinphoneTunnel *tunnel=((LinphoneCore *) pCore)->tunnel; if (!tunnel) return;
|
||||
linphone_tunnel_auto_detect(tunnel);
|
||||
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelCleanServers(JNIEnv *env,jobject thiz,jlong pCore) {
|
||||
|
|
@ -2217,3 +2224,17 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getVersion(JNIEnv* e
|
|||
jstring jvalue =env->NewStringUTF(linphone_core_get_version());
|
||||
return jvalue;
|
||||
}
|
||||
|
||||
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getConfig(JNIEnv *env, jobject thiz, jlong lc) {
|
||||
return (jlong) linphone_core_get_config((LinphoneCore *)lc);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LpConfigImpl_setInt(JNIEnv *env, jobject thiz, jlong lpc,
|
||||
jstring section, jstring key, jint value) {
|
||||
const char *csection = env->GetStringUTFChars(section, NULL);
|
||||
const char *ckey = env->GetStringUTFChars(key, NULL);
|
||||
lp_config_set_int((LpConfig *)lpc, csection, ckey, (int) value);
|
||||
env->ReleaseStringUTFChars(section, csection);
|
||||
env->ReleaseStringUTFChars(key, ckey);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ static bool_t is_first_char(const char *start, const char *pos){
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
LpSection *lp_config_find_section(LpConfig *lpconfig, const char *name){
|
||||
LpSection *lp_config_find_section(const LpConfig *lpconfig, const char *name){
|
||||
LpSection *sec;
|
||||
MSList *elem;
|
||||
/*printf("Looking for section %s\n",name);*/
|
||||
|
|
@ -123,7 +123,7 @@ LpSection *lp_config_find_section(LpConfig *lpconfig, const char *name){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LpItem *lp_section_find_item(LpSection *sec, const char *name){
|
||||
LpItem *lp_section_find_item(const LpSection *sec, const char *name){
|
||||
MSList *elem;
|
||||
LpItem *item;
|
||||
/*printf("Looking for item %s\n",name);*/
|
||||
|
|
@ -260,7 +260,7 @@ void lp_section_remove_item(LpSection *sec, LpItem *item){
|
|||
lp_item_destroy(item);
|
||||
}
|
||||
|
||||
const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const char *key, const char *default_string){
|
||||
const char *lp_config_get_string(const LpConfig *lpconfig, const char *section, const char *key, const char *default_string){
|
||||
LpSection *sec;
|
||||
LpItem *item;
|
||||
sec=lp_config_find_section(lpconfig,section);
|
||||
|
|
@ -271,7 +271,7 @@ const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const
|
|||
return default_string;
|
||||
}
|
||||
|
||||
bool_t lp_config_get_range(LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max) {
|
||||
bool_t lp_config_get_range(const LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max) {
|
||||
const char *str = lp_config_get_string(lpconfig, section, key, NULL);
|
||||
if (str != NULL) {
|
||||
char *minusptr = strchr(str, '-');
|
||||
|
|
@ -290,7 +290,7 @@ bool_t lp_config_get_range(LpConfig *lpconfig, const char *section, const char *
|
|||
}
|
||||
}
|
||||
|
||||
int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value){
|
||||
int lp_config_get_int(const LpConfig *lpconfig,const char *section, const char *key, int default_value){
|
||||
const char *str=lp_config_get_string(lpconfig,section,key,NULL);
|
||||
if (str!=NULL) {
|
||||
int ret=0;
|
||||
|
|
@ -302,7 +302,7 @@ int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, i
|
|||
else return default_value;
|
||||
}
|
||||
|
||||
int64_t lp_config_get_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t default_value){
|
||||
int64_t lp_config_get_int64(const LpConfig *lpconfig,const char *section, const char *key, int64_t default_value){
|
||||
const char *str=lp_config_get_string(lpconfig,section,key,NULL);
|
||||
if (str!=NULL) {
|
||||
#ifdef WIN32
|
||||
|
|
@ -314,7 +314,7 @@ int64_t lp_config_get_int64(LpConfig *lpconfig,const char *section, const char *
|
|||
else return default_value;
|
||||
}
|
||||
|
||||
float lp_config_get_float(LpConfig *lpconfig,const char *section, const char *key, float default_value){
|
||||
float lp_config_get_float(const LpConfig *lpconfig,const char *section, const char *key, float default_value){
|
||||
const char *str=lp_config_get_string(lpconfig,section,key,NULL);
|
||||
float ret=default_value;
|
||||
if (str==NULL) return default_value;
|
||||
|
|
@ -404,11 +404,32 @@ int lp_config_sync(LpConfig *lpconfig){
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lp_config_has_section(LpConfig *lpconfig, const char *section){
|
||||
int lp_config_has_section(const LpConfig *lpconfig, const char *section){
|
||||
if (lp_config_find_section(lpconfig,section)!=NULL) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void lp_config_for_each_section(const LpConfig *lpconfig, void (*callback)(const char *section, void *ctx), void *ctx) {
|
||||
LpSection *sec;
|
||||
MSList *elem;
|
||||
for (elem=lpconfig->sections;elem!=NULL;elem=ms_list_next(elem)){
|
||||
sec=(LpSection*)elem->data;
|
||||
callback(sec->name, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
void lp_config_for_each_entry(const LpConfig *lpconfig, const char *section, void (*callback)(const char *entry, void *ctx), void *ctx) {
|
||||
LpItem *item;
|
||||
MSList *elem;
|
||||
LpSection *sec=lp_config_find_section(lpconfig,section);
|
||||
if (sec!=NULL){
|
||||
for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){
|
||||
item=(LpItem*)elem->data;
|
||||
callback(item->key, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lp_config_clean_section(LpConfig *lpconfig, const char *section){
|
||||
LpSection *sec=lp_config_find_section(lpconfig,section);
|
||||
if (sec!=NULL){
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ int lp_config_read_file(LpConfig *lpconfig, const char *filename);
|
|||
* @ingroup misc
|
||||
* The default value string is returned if the config item isn't found.
|
||||
**/
|
||||
const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const char *key, const char *default_string);
|
||||
const char *lp_config_get_string(const LpConfig *lpconfig, const char *section, const char *key, const char *default_string);
|
||||
int lp_config_read_file(LpConfig *lpconfig, const char *filename);
|
||||
/**
|
||||
* Retrieves a configuration item as a range, given its section, key, and default min and max values.
|
||||
|
|
@ -82,14 +82,14 @@ int lp_config_read_file(LpConfig *lpconfig, const char *filename);
|
|||
* @return TRUE if the value is successfully parsed as a range, FALSE otherwise.
|
||||
* If FALSE is returned, min and max are filled respectively with default_min and default_max values.
|
||||
*/
|
||||
bool_t lp_config_get_range(LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max);
|
||||
bool_t lp_config_get_range(const LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max);
|
||||
/**
|
||||
* Retrieves a configuration item as an integer, given its section, key, and default value.
|
||||
*
|
||||
* @ingroup misc
|
||||
* The default integer value is returned if the config item isn't found.
|
||||
**/
|
||||
int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value);
|
||||
int lp_config_get_int(const LpConfig *lpconfig,const char *section, const char *key, int default_value);
|
||||
|
||||
/**
|
||||
* Retrieves a configuration item as a 64 bit integer, given its section, key, and default value.
|
||||
|
|
@ -97,7 +97,7 @@ int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, i
|
|||
* @ingroup misc
|
||||
* The default integer value is returned if the config item isn't found.
|
||||
**/
|
||||
int64_t lp_config_get_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t default_value);
|
||||
int64_t lp_config_get_int64(const LpConfig *lpconfig,const char *section, const char *key, int64_t default_value);
|
||||
|
||||
|
||||
int lp_config_read_file(LpConfig *lpconfig, const char *filename);
|
||||
|
|
@ -107,7 +107,7 @@ int lp_config_read_file(LpConfig *lpconfig, const char *filename);
|
|||
* @ingroup misc
|
||||
* The default float value is returned if the config item isn't found.
|
||||
**/
|
||||
float lp_config_get_float(LpConfig *lpconfig,const char *section, const char *key, float default_value);
|
||||
float lp_config_get_float(const LpConfig *lpconfig,const char *section, const char *key, float default_value);
|
||||
/**
|
||||
* Sets a string config item
|
||||
*
|
||||
|
|
@ -158,13 +158,26 @@ int lp_config_sync(LpConfig *lpconfig);
|
|||
*
|
||||
* @ingroup misc
|
||||
**/
|
||||
int lp_config_has_section(LpConfig *lpconfig, const char *section);
|
||||
int lp_config_has_section(const LpConfig *lpconfig, const char *section);
|
||||
/**
|
||||
* Removes every pair of key,value in a section and remove the section.
|
||||
*
|
||||
* @ingroup misc
|
||||
**/
|
||||
void lp_config_clean_section(LpConfig *lpconfig, const char *section);
|
||||
/**
|
||||
* Call a function for each section present in the configuration.
|
||||
*
|
||||
* @ingroup misc
|
||||
**/
|
||||
void lp_config_for_each_section(const LpConfig *lpconfig, void (*callback)(const char *section, void *ctx), void *ctx);
|
||||
/**
|
||||
* Call a function for each entry present in a section configuration.
|
||||
*
|
||||
* @ingroup misc
|
||||
**/
|
||||
void lp_config_for_each_entry(const LpConfig *lpconfig, const char *section, void (*callback)(const char *entry, void *ctx), void *ctx);
|
||||
|
||||
/*tells whether uncommited (with lp_config_sync()) modifications exist*/
|
||||
int lp_config_needs_commit(const LpConfig *lpconfig);
|
||||
void lp_config_destroy(LpConfig *cfg);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ AC_ARG_ENABLE(strict,
|
|||
[wall_werror=yes]
|
||||
)
|
||||
|
||||
dnl AC_CONFIG_HEADER([config.h])
|
||||
dnl AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
|
|
|||
|
|
@ -148,6 +148,8 @@ struct _LinphoneCall
|
|||
IceSession *ice_session;
|
||||
LinphoneChatMessage* pending_message;
|
||||
int ping_time;
|
||||
unsigned int remote_session_id;
|
||||
unsigned int remote_session_ver;
|
||||
bool_t refer_pending;
|
||||
bool_t media_pending;
|
||||
bool_t audio_muted;
|
||||
|
|
@ -293,6 +295,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call);
|
|||
void linphone_call_delete_ice_session(LinphoneCall *call);
|
||||
void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call);
|
||||
void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md);
|
||||
void linphone_call_update_remote_session_id_and_ver(LinphoneCall *call);
|
||||
|
||||
const char * linphone_core_get_identity(LinphoneCore *lc);
|
||||
const char * linphone_core_get_route(LinphoneCore *lc);
|
||||
|
|
@ -306,6 +309,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call);
|
|||
int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call);
|
||||
void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call);
|
||||
void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call);
|
||||
bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md);
|
||||
extern SalCallbacks linphone_sal_callbacks;
|
||||
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error);
|
||||
bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
|
||||
|
|
@ -402,6 +406,7 @@ typedef struct sip_config
|
|||
bool_t register_only_when_network_is_up;
|
||||
bool_t ping_with_options;
|
||||
bool_t auto_net_state_mon;
|
||||
bool_t tcp_tls_keepalive;
|
||||
} sip_config_t;
|
||||
|
||||
typedef struct rtp_config
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ static bool_t payload_type_equals(const PayloadType *p1, const PayloadType *p2){
|
|||
if (strcmp(p1->mime_type,p2->mime_type)!=0) return FALSE;
|
||||
if (p1->clock_rate!=p2->clock_rate) return FALSE;
|
||||
if (p1->channels!=p2->channels) return FALSE;
|
||||
if (payload_type_get_number(p1) != payload_type_get_number(p2)) return FALSE;
|
||||
/*
|
||||
Do not compare fmtp right now: they are modified internally when the call is started
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@ ortp_socket_t sal_get_socket(Sal *ctx);
|
|||
void sal_set_user_agent(Sal *ctx, const char *user_agent);
|
||||
/*keepalive period in ms*/
|
||||
void sal_set_keepalive_period(Sal *ctx,unsigned int value);
|
||||
void sal_use_tcp_tls_keepalive(Sal *ctx, bool_t enabled);
|
||||
/**
|
||||
* returns keepalive period in ms
|
||||
* 0 desactiaved
|
||||
|
|
@ -378,6 +379,7 @@ 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);
|
||||
void sal_verify_server_cn(Sal *ctx, bool_t verify);
|
||||
|
||||
int sal_iterate(Sal *sal);
|
||||
MSList * sal_get_pending_auths(Sal *sal);
|
||||
|
|
|
|||
|
|
@ -282,6 +282,7 @@ Sal * sal_init(){
|
|||
sal->reuse_authorization=FALSE;
|
||||
sal->rootCa = 0;
|
||||
sal->verify_server_certs=TRUE;
|
||||
sal->verify_server_cn=TRUE;
|
||||
sal->expire_old_contact=FALSE;
|
||||
sal->add_dates=FALSE;
|
||||
sal->dscp=-1;
|
||||
|
|
@ -378,12 +379,17 @@ static void set_tls_options(Sal *ctx){
|
|||
#ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE
|
||||
eXosip_tls_verify_certificate(ctx->verify_server_certs);
|
||||
#endif
|
||||
#ifdef HAVE_EXOSIP_TLS_VERIFY_CN
|
||||
eXosip_tls_verify_cn(ctx->verify_server_cn);
|
||||
#endif
|
||||
}
|
||||
|
||||
void sal_set_dscp(Sal *ctx, int dscp){
|
||||
ctx->dscp=dscp;
|
||||
#ifdef HAVE_EXOSIP_DSCP
|
||||
if (dscp!=-1)
|
||||
eXosip_set_option(EXOSIP_OPT_SET_DSCP,&ctx->dscp);
|
||||
#endif
|
||||
}
|
||||
|
||||
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure){
|
||||
|
|
@ -391,16 +397,17 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i
|
|||
bool_t ipv6;
|
||||
int proto=IPPROTO_UDP;
|
||||
int keepalive = ctx->keepalive_period;
|
||||
|
||||
|
||||
ctx->transport = tr;
|
||||
switch (tr) {
|
||||
case SalTransportUDP:
|
||||
proto=IPPROTO_UDP;
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &keepalive);
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &keepalive);
|
||||
break;
|
||||
case SalTransportTCP:
|
||||
case SalTransportTLS:
|
||||
proto= IPPROTO_TCP;
|
||||
keepalive=-1;
|
||||
if (!ctx->tcp_tls_keepalive) keepalive=-1;
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE,&keepalive);
|
||||
set_tls_options(ctx);
|
||||
break;
|
||||
|
|
@ -497,6 +504,13 @@ void sal_verify_server_certificates(Sal *ctx, bool_t verify){
|
|||
#endif
|
||||
}
|
||||
|
||||
void sal_verify_server_cn(Sal *ctx, bool_t verify){
|
||||
ctx->verify_server_cn=verify;
|
||||
#ifdef HAVE_EXOSIP_TLS_VERIFY_CN
|
||||
eXosip_tls_verify_cn(verify);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int extract_received_rport(osip_message_t *msg, const char **received, int *rportval,SalTransport* transport){
|
||||
osip_via_t *via=NULL;
|
||||
osip_generic_param_t *param=NULL;
|
||||
|
|
@ -936,8 +950,13 @@ int sal_call_terminate(SalOp *h){
|
|||
}
|
||||
|
||||
void sal_op_authenticate(SalOp *h, const SalAuthInfo *info){
|
||||
if (h->terminated) return;
|
||||
if (h->pending_auth){
|
||||
bool_t terminating=FALSE;
|
||||
if (h->pending_auth && strcmp(h->pending_auth->request->sip_method,"BYE")==0) {
|
||||
terminating=TRUE;
|
||||
}
|
||||
if (h->terminated && !terminating) return;
|
||||
|
||||
if (h->pending_auth){
|
||||
push_auth_to_exosip(info);
|
||||
|
||||
/*FIXME exosip does not take into account this update register message*/
|
||||
|
|
@ -2494,9 +2513,24 @@ void sal_address_destroy(SalAddress *u){
|
|||
osip_from_free((osip_from_t*)u);
|
||||
}
|
||||
|
||||
void sal_use_tcp_tls_keepalive(Sal *ctx, bool_t enabled) {
|
||||
ctx->tcp_tls_keepalive = enabled;
|
||||
}
|
||||
|
||||
void sal_set_keepalive_period(Sal *ctx,unsigned int value) {
|
||||
ctx->keepalive_period=value;
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value);
|
||||
switch (ctx->transport) {
|
||||
case SalTransportUDP:
|
||||
ctx->keepalive_period = value;
|
||||
break;
|
||||
case SalTransportTCP:
|
||||
case SalTransportTLS:
|
||||
if (ctx->tcp_tls_keepalive) ctx->keepalive_period = value;
|
||||
else ctx->keepalive_period = -1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &ctx->keepalive_period);
|
||||
}
|
||||
unsigned int sal_get_keepalive_period(Sal *ctx) {
|
||||
return ctx->keepalive_period;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ int sdp_to_media_description(sdp_message_t *sdp, SalMediaDescription *desc);
|
|||
|
||||
struct Sal{
|
||||
SalCallbacks callbacks;
|
||||
SalTransport transport;
|
||||
MSList *calls; /*MSList of SalOp */
|
||||
MSList *registers;/*MSList of SalOp */
|
||||
MSList *out_subscribes;/*MSList of SalOp */
|
||||
|
|
@ -48,8 +49,10 @@ struct Sal{
|
|||
bool_t use_101;
|
||||
bool_t reuse_authorization;
|
||||
bool_t verify_server_certs;
|
||||
bool_t verify_server_cn;
|
||||
bool_t expire_old_contact;
|
||||
bool_t add_dates;
|
||||
bool_t tcp_tls_keepalive;
|
||||
};
|
||||
|
||||
struct SalOp{
|
||||
|
|
|
|||
|
|
@ -209,108 +209,108 @@ static void mk_presence_body (const SalPresenceStatus online_status, const char
|
|||
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"online\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\" priority=\"0.800000\">\n"
|
||||
"<status status=\"open\" />\n"
|
||||
"<msnsubstatus substatus=\"online\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status == SalPresenceBusy ||
|
||||
online_status == SalPresenceDonotdisturb)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"busy\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\" priority=\"0.800000\">\n"
|
||||
"<status status=\"inuse\" />\n"
|
||||
"<msnsubstatus substatus=\"busy\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"berightback\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\" priority=\"0.800000\">\n"
|
||||
"<status status=\"open\" />\n"
|
||||
"<msnsubstatus substatus=\"berightback\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status == SalPresenceAway ||
|
||||
online_status == SalPresenceMoved)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"away\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\" priority=\"0.800000\">\n"
|
||||
"<status status=\"open\" />\n"
|
||||
"<msnsubstatus substatus=\"away\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"onthephone\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\" priority=\"0.800000\">\n"
|
||||
"<status status=\"inuse\" />\n"
|
||||
"<msnsubstatus substatus=\"onthephone\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"outtolunch\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\" priority=\"0.800000\">\n"
|
||||
"<status status=\"open\" />\n"
|
||||
"<msnsubstatus substatus=\"outtolunch\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\" priority=\"0.800000\">\n\
|
||||
<status status=\"closed\" />\n\
|
||||
<msnsubstatus substatus=\"away\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\" priority=\"0.800000\">\n"
|
||||
"<status status=\"closed\" />\n"
|
||||
"<msnsubstatus substatus=\"away\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -323,108 +323,108 @@ static void mk_presence_body (const SalPresenceStatus online_status, const char
|
|||
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"open\" />\n\
|
||||
<msnsubstatus substatus=\"online\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\">\n"
|
||||
"<status status=\"open\" />\n"
|
||||
"<msnsubstatus substatus=\"online\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status == SalPresenceBusy ||
|
||||
online_status == SalPresenceDonotdisturb)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"busy\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\">\n"
|
||||
"<status status=\"inuse\" />\n"
|
||||
"<msnsubstatus substatus=\"busy\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<msnsubstatus substatus=\"berightback\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\">\n"
|
||||
"<status status=\"inactive\" />\n"
|
||||
"<msnsubstatus substatus=\"berightback\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status == SalPresenceAway ||
|
||||
online_status == SalPresenceMoved)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<msnsubstatus substatus=\"idle\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\">\n"
|
||||
"<status status=\"inactive\" />\n"
|
||||
"<msnsubstatus substatus=\"idle\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inuse\" />\n\
|
||||
<msnsubstatus substatus=\"onthephone\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\">\n"
|
||||
"<status status=\"inuse\" />\n"
|
||||
"<msnsubstatus substatus=\"onthephone\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"inactive\" />\n\
|
||||
<msnsubstatus substatus=\"outtolunch\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\">\n"
|
||||
"<status status=\"inactive\" />\n"
|
||||
"<msnsubstatus substatus=\"outtolunch\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n\
|
||||
<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n\
|
||||
<presence>\n\
|
||||
<presentity uri=\"%s;method=SUBSCRIBE\" />\n\
|
||||
<atom id=\"%i\">\n\
|
||||
<address uri=\"%s\">\n\
|
||||
<status status=\"closed\" />\n\
|
||||
<msnsubstatus substatus=\"offline\" />\n\
|
||||
</address>\n\
|
||||
</atom>\n\
|
||||
</presence>", contact_info, atom_id, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE presence SYSTEM \"http://schemas.microsoft.com/2002/09/sip/presence\">\n"
|
||||
"<presence>\n"
|
||||
"<presentity uri=\"%s;method=SUBSCRIBE\" />\n"
|
||||
"<atom id=\"%i\">\n"
|
||||
"<address uri=\"%s\">\n"
|
||||
"<status status=\"closed\" />\n"
|
||||
"<msnsubstatus substatus=\"offline\" />\n"
|
||||
"</address>\n"
|
||||
"</atom>\n"
|
||||
"</presence>", contact_info, atom_id, contact_info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -432,118 +432,118 @@ static void mk_presence_body (const SalPresenceStatus online_status, const char
|
|||
|
||||
if (online_status==SalPresenceOnline)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
</presence>",
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" "
|
||||
"xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" "
|
||||
"xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" "
|
||||
"entity=\"%s\">\n"
|
||||
"<tuple id=\"sg89ae\">\n"
|
||||
"<status><basic>open</basic></status>\n"
|
||||
"<contact priority=\"0.8\">%s</contact>\n"
|
||||
"</tuple>\n"
|
||||
"</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status == SalPresenceBusy ||
|
||||
online_status == SalPresenceDonotdisturb)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:busy/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" "
|
||||
"xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" "
|
||||
"xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" "
|
||||
"entity=\"%s\">\n"
|
||||
"<tuple id=\"sg89ae\">\n"
|
||||
"<status><basic>open</basic></status>\n"
|
||||
"<contact priority=\"0.8\">%s</contact>\n"
|
||||
"</tuple>\n"
|
||||
"<dm:person id=\"sg89aep\">\n"
|
||||
"<rpid:activities><rpid:busy/></rpid:activities>\n"
|
||||
"</dm:person>\n"
|
||||
"</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceBerightback)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:in-transit/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" "
|
||||
"xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" "
|
||||
"xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" "
|
||||
"entity=\"%s\">\n"
|
||||
"<tuple id=\"sg89ae\">\n"
|
||||
"<status><basic>open</basic></status>\n"
|
||||
"<contact priority=\"0.8\">%s</contact>\n"
|
||||
"</tuple>\n"
|
||||
"<dm:person id=\"sg89aep\">\n"
|
||||
"<rpid:activities><rpid:in-transit/></rpid:activities>\n"
|
||||
"</dm:person>\n"
|
||||
"</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status == SalPresenceAway ||
|
||||
online_status == SalPresenceMoved)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:away/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" "
|
||||
"xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" "
|
||||
"xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" "
|
||||
"entity=\"%s\">\n"
|
||||
"<tuple id=\"sg89ae\">\n"
|
||||
"<status><basic>open</basic></status>\n"
|
||||
"<contact priority=\"0.8\">%s</contact>\n"
|
||||
"</tuple>\n"
|
||||
"<dm:person id=\"sg89aep\">\n"
|
||||
"<rpid:activities><rpid:away/></rpid:activities>\n"
|
||||
"</dm:person>\n"
|
||||
"</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceOnthephone)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"sg89aep\">\n\
|
||||
<rpid:activities><rpid:on-the-phone/></rpid:activities>\n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" "
|
||||
"xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" "
|
||||
"xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" "
|
||||
"entity=\"%s\">\n"
|
||||
"<tuple id=\"sg89ae\">\n"
|
||||
"<status><basic>open</basic></status>\n"
|
||||
"<contact priority=\"0.8\">%s</contact>\n"
|
||||
"</tuple>\n"
|
||||
"<dm:person id=\"sg89aep\">\n"
|
||||
"<rpid:activities><rpid:on-the-phone/></rpid:activities>\n"
|
||||
"</dm:person>\n"
|
||||
"</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else if (online_status==SalPresenceOuttolunch)
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"7777\">\n\
|
||||
<status><basic>open</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
<dm:person id=\"78787878\">\n\
|
||||
<rpid:activities><rpid:meal/></rpid:activities>\n\
|
||||
<rpid:note>Out to lunch</rpid:note> \n\
|
||||
</dm:person>\n\
|
||||
</presence>",
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" "
|
||||
"xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" "
|
||||
"xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" "
|
||||
"entity=\"%s\">\n"
|
||||
"<tuple id=\"7777\">\n"
|
||||
"<status><basic>open</basic></status>\n"
|
||||
"<contact priority=\"0.8\">%s</contact>\n"
|
||||
"</tuple>\n"
|
||||
"<dm:person id=\"78787878\">\n"
|
||||
"<rpid:activities><rpid:meal/></rpid:activities>\n"
|
||||
"<rpid:note>Out to lunch</rpid:note> \n"
|
||||
"</dm:person>\n"
|
||||
"</presence>",
|
||||
contact_info, contact_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
|
||||
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" \
|
||||
xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" \
|
||||
xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" \
|
||||
entity=\"%s\">\n\
|
||||
<tuple id=\"sg89ae\">\n\
|
||||
<status><basic>closed</basic></status>\n\
|
||||
<contact priority=\"0.8\">%s</contact>\n\
|
||||
</tuple>\n\
|
||||
</presence>\n", contact_info, contact_info);
|
||||
snprintf(buf, buflen, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
"<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" "
|
||||
"xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" "
|
||||
"xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" "
|
||||
"entity=\"%s\">\n"
|
||||
"<tuple id=\"sg89ae\">\n"
|
||||
"<status><basic>closed</basic></status>\n"
|
||||
"<contact priority=\"0.8\">%s</contact>\n"
|
||||
"</tuple>\n"
|
||||
"</presence>\n", contact_info, contact_info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,10 +434,17 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){
|
|||
int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
|
||||
int i,j;
|
||||
const char *mtype,*proto,*rtp_port,*rtp_addr,*number;
|
||||
const char *sess;
|
||||
sdp_bandwidth_t *sbw=NULL;
|
||||
sdp_attribute_t *attr;
|
||||
int nb_ice_candidates;
|
||||
|
||||
/* Get session information. */
|
||||
sess = sdp_message_o_sess_id_get(msg);
|
||||
if (sess) desc->session_id = strtoul(sess, NULL, 10);
|
||||
sess = sdp_message_o_sess_version_get(msg);
|
||||
if (sess) desc->session_ver = strtoul(sess, NULL, 10);
|
||||
|
||||
rtp_addr=sdp_message_c_addr_get (msg, -1, 0);
|
||||
if (rtp_addr)
|
||||
strncpy(desc->addr,rtp_addr,sizeof(desc->addr));
|
||||
|
|
|
|||
|
|
@ -53,10 +53,8 @@ linphone_SOURCES+= \
|
|||
setupwizard.c
|
||||
endif
|
||||
|
||||
linphone_LDADD=$(ORTP_LIBS) \
|
||||
$(MEDIASTREAMER_LIBS) \
|
||||
$(top_builddir)/coreapi/liblinphone.la \
|
||||
$(LIBGTK_LIBS) $(NOTIFY1_LIBS) $(NOTIFY4_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS)
|
||||
linphone_LDADD= $(top_builddir)/coreapi/liblinphone.la \
|
||||
$(LIBGTK_LIBS) $(NOTIFY1_LIBS) $(NOTIFY4_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS)
|
||||
|
||||
|
||||
if BUILD_WIN32
|
||||
|
|
|
|||
253
gtk/chat.c
253
gtk/chat.c
|
|
@ -31,8 +31,10 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
|
|||
int idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"idx"));
|
||||
g_return_if_fail(w!=NULL);
|
||||
gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
|
||||
linphone_gtk_update_chat_picture(FALSE);
|
||||
linphone_gtk_create_chat_picture(FALSE);
|
||||
g_object_set_data(G_OBJECT(friendlist),"chatview",NULL);
|
||||
g_object_set_data(G_OBJECT(w),"from_message",NULL);
|
||||
g_object_set_data(G_OBJECT(w),"cr",NULL);
|
||||
gtk_widget_destroy(w);
|
||||
}
|
||||
|
||||
|
|
@ -40,12 +42,19 @@ GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr,const LinphoneAddress *ur
|
|||
GtkWidget *w=gtk_hbox_new (FALSE,0);
|
||||
GtkWidget *i=create_pixmap ("chat.png");
|
||||
GtkWidget *l;
|
||||
GtkWidget *b=gtk_button_new_with_label("x");
|
||||
GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_CLOSE,GTK_ICON_SIZE_MENU);
|
||||
GtkWidget *b=gtk_button_new();
|
||||
|
||||
gtk_widget_set_size_request(b,20,20);
|
||||
gtk_button_set_image(GTK_BUTTON(b),image);
|
||||
gtk_button_set_relief(GTK_BUTTON(b),GTK_RELIEF_NONE);
|
||||
gtk_widget_set_size_request(b,25,20);
|
||||
g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr);
|
||||
gchar *text=g_strdup_printf("Chat ");
|
||||
l=gtk_label_new (text);
|
||||
|
||||
const char *display=linphone_address_get_display_name(uri);
|
||||
if (display==NULL || display[0]=='\0') {
|
||||
display=linphone_address_get_username(uri);
|
||||
}
|
||||
l=gtk_label_new (display);
|
||||
gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0);
|
||||
gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0);
|
||||
gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0);
|
||||
|
|
@ -53,15 +62,43 @@ GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr,const LinphoneAddress *ur
|
|||
return w;
|
||||
}
|
||||
|
||||
void udpate_tab_chat_header(GtkWidget *chat_view,const LinphoneAddress *uri,LinphoneChatRoom *cr){
|
||||
GtkWidget *main_window=linphone_gtk_get_main_window();
|
||||
GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(main_window,"viewswitch"));
|
||||
GtkWidget *w=gtk_hbox_new (FALSE,0);
|
||||
GtkWidget *i=create_pixmap ("chat.png");
|
||||
GtkWidget *l;
|
||||
GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_CLOSE,GTK_ICON_SIZE_MENU);
|
||||
GtkWidget *b=gtk_button_new();
|
||||
|
||||
gtk_button_set_image(GTK_BUTTON(b),image);
|
||||
gtk_button_set_relief(GTK_BUTTON(b),GTK_RELIEF_NONE);
|
||||
gtk_widget_set_size_request(b,25,20);
|
||||
g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr);
|
||||
|
||||
const char *display=linphone_address_get_display_name(uri);
|
||||
if (display==NULL || display[0]=='\0') {
|
||||
display=linphone_address_get_username(uri);
|
||||
}
|
||||
l=gtk_label_new (display);
|
||||
gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0);
|
||||
gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0);
|
||||
gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0);
|
||||
|
||||
gtk_notebook_set_tab_label(notebook,chat_view,w);
|
||||
gtk_widget_show_all(w);
|
||||
|
||||
}
|
||||
|
||||
void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, const char *message, gboolean me,LinphoneChatRoom *cr){
|
||||
GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"textview"));
|
||||
GtkTextBuffer *buffer=gtk_text_view_get_buffer(text);
|
||||
GtkTextIter iter,begin;
|
||||
GList *l = g_object_get_data(G_OBJECT(w),"list");
|
||||
GtkTextIter iter,begin,end;
|
||||
gtk_text_buffer_get_start_iter(buffer,&begin);
|
||||
int off;
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
off=gtk_text_iter_get_offset(&iter);
|
||||
GList *list=g_object_get_data(G_OBJECT(w),"list");
|
||||
|
||||
if(g_strcmp0((char *)g_object_get_data(G_OBJECT(w),"from_message"),linphone_address_as_string(from))!=0){
|
||||
gtk_text_buffer_get_iter_at_offset(buffer,&iter,off);
|
||||
|
|
@ -69,44 +106,41 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from, const cha
|
|||
if (display==NULL || display[0]=='\0') {
|
||||
display=linphone_address_get_username(from);
|
||||
}
|
||||
gtk_text_buffer_insert(buffer,&iter,display,-1);
|
||||
//gtk_text_buffer_apply_tag_by_name(b,"bold",&begin,&iter);
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
gtk_text_buffer_insert(buffer,&iter,":",-1);
|
||||
gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,display,-1,"bold",me ? "left" : "left",NULL);
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
gtk_text_buffer_insert(buffer,&iter,"\n",-1);
|
||||
g_object_set_data(G_OBJECT(w),"from_message",linphone_address_as_string(from));
|
||||
}
|
||||
|
||||
//gtk_text_buffer_apply_tag_by_name(b,me ? "green" : "blue" ,&begin,&iter);
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
gtk_text_buffer_get_iter_at_offset(buffer,&begin,off);
|
||||
if(me){
|
||||
l=g_list_append(l,GINT_TO_POINTER(gtk_text_iter_get_offset(&iter)));
|
||||
g_object_set_data(G_OBJECT(w),"list",l);
|
||||
}
|
||||
gtk_text_buffer_insert(buffer,&iter,"\t",-1);
|
||||
gtk_text_buffer_insert(buffer,&iter,message,-1);
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,message,-1,me ? "left" : "left",NULL);
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
gtk_text_buffer_insert(buffer,&iter,"\n",-1);
|
||||
|
||||
GtkTextMark *mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE);
|
||||
gtk_text_view_scroll_mark_onscreen(text,mark);
|
||||
//gtk_text_buffer_get_end_iter(b,&iter);
|
||||
//gtk_text_iter_forward_to_line_end(&iter);
|
||||
//gtk_text_view_scroll_to_iter(v,&iter,0,TRUE,1.0,1.0);
|
||||
gtk_text_buffer_get_bounds (buffer, &begin, &iter);
|
||||
|
||||
gtk_text_buffer_get_bounds (buffer, &begin, &end);
|
||||
GHashTable *hash=(GHashTable *)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"history");
|
||||
if(me){
|
||||
g_hash_table_insert(hash,linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr)),
|
||||
(gpointer)gtk_text_buffer_get_text(buffer,&begin,&iter,FALSE));
|
||||
(gpointer)gtk_text_buffer_get_text(buffer,&begin,&end,FALSE));
|
||||
} else {
|
||||
|
||||
g_hash_table_insert(hash,linphone_address_as_string_uri_only(from),
|
||||
(gpointer)gtk_text_buffer_get_text(buffer,&begin,&iter,FALSE));
|
||||
(gpointer)gtk_text_buffer_get_text(buffer,&begin,&end,FALSE));
|
||||
}
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_main_window()),"history",hash);
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_main_window()),"history",hash);
|
||||
|
||||
if(me){
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
list=g_list_append(list,GINT_TO_POINTER(gtk_text_iter_get_line(&iter)));
|
||||
gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Message in progress.. ",-1,
|
||||
"italic","right","small","font_grey",NULL);
|
||||
gtk_text_buffer_get_end_iter(buffer,&iter);
|
||||
gtk_text_buffer_insert(buffer,&iter,"\n",-1);
|
||||
g_object_set_data(G_OBJECT(w),"list",list);
|
||||
}
|
||||
|
||||
GtkTextMark *mark=gtk_text_buffer_create_mark(buffer,NULL,&iter,FALSE);
|
||||
gtk_text_view_scroll_mark_onscreen(text,mark);
|
||||
}
|
||||
|
||||
const LinphoneAddress* linphone_gtk_get_used_identity(){
|
||||
|
|
@ -120,67 +154,79 @@ const LinphoneAddress* linphone_gtk_get_used_identity(){
|
|||
|
||||
/* function in dev for displaying ack*/
|
||||
void update_chat_state_message(LinphoneChatMessageState state){
|
||||
/*GdkPixbuf *pixbuf;
|
||||
|
||||
switch (state) {
|
||||
case LinphoneChatMessageStateInProgress:
|
||||
pixbuf=create_pixbuf("chat_message_in_progress.png");
|
||||
break;
|
||||
case LinphoneChatMessageStateDelivered:
|
||||
pixbuf=create_pixbuf("chat_message_delivered.png");
|
||||
break;
|
||||
case LinphoneChatMessageStateNotDelivered:
|
||||
pixbuf=create_pixbuf("chat_message_not_delivered.png");
|
||||
break;
|
||||
default : pixbuf=NULL;
|
||||
}
|
||||
|
||||
GtkWidget *main_window=linphone_gtk_get_main_window();
|
||||
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
|
||||
GtkWidget *page=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
|
||||
GList *list=g_object_get_data(G_OBJECT(page),"list");
|
||||
|
||||
if(page!=NULL){
|
||||
GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(page,"textview"));
|
||||
GtkTextBuffer *b=gtk_text_view_get_buffer(text);
|
||||
GtkTextIter iter;
|
||||
GList *l = g_object_get_data(G_OBJECT(page),"list");
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
gtk_text_buffer_get_iter_at_offset(b,&iter,GPOINTER_TO_INT(g_list_nth_data(l,0)));
|
||||
fprintf(stdout,"offset check %i \n",GPOINTER_TO_INT(g_list_nth_data(l,0)));
|
||||
l=g_list_remove(l,g_list_nth_data(l,0));
|
||||
gtk_text_buffer_insert_pixbuf(b,&iter,pixbuf);
|
||||
GtkTextIter end;
|
||||
GtkTextIter start;
|
||||
|
||||
//gtk_text_buffer_get_end_iter(b,&iter);
|
||||
//gtk_text_buffer_insert_pixbuf(b,&iter,pixbuf);
|
||||
//gtk_text_buffer_get_end_iter(b,&iter);
|
||||
//gtk_text_buffer_insert(b,&iter,"\n",-1);
|
||||
g_object_set_data(G_OBJECT(page),"list",l);
|
||||
} else {
|
||||
fprintf(stdout,"NULLLL\n");
|
||||
}*/
|
||||
gtk_text_buffer_get_iter_at_line(b,&iter,
|
||||
GPOINTER_TO_INT(g_list_nth_data(list,0)));
|
||||
if(gtk_text_iter_get_chars_in_line(&iter) >0) {
|
||||
gtk_text_buffer_get_iter_at_line_offset(b,&start,
|
||||
GPOINTER_TO_INT(g_list_nth_data(list,0)),
|
||||
gtk_text_iter_get_chars_in_line(&iter)-1);
|
||||
}else {
|
||||
gtk_text_buffer_get_iter_at_line_offset(b,&start,
|
||||
GPOINTER_TO_INT(g_list_nth_data(list,0)),0);
|
||||
}
|
||||
gtk_text_buffer_get_iter_at_line_offset(b,&end,
|
||||
GPOINTER_TO_INT(g_list_nth_data(list,0)),0);
|
||||
gtk_text_buffer_delete(b,&start,&end);
|
||||
gtk_text_buffer_get_iter_at_line(b,&iter,GPOINTER_TO_INT(g_list_nth_data(list,0)));
|
||||
gchar *result;
|
||||
switch (state) {
|
||||
case LinphoneChatMessageStateInProgress:
|
||||
result="Message in progress.. ";
|
||||
break;
|
||||
case LinphoneChatMessageStateDelivered:
|
||||
result="Message delivered ";
|
||||
break;
|
||||
case LinphoneChatMessageStateNotDelivered:
|
||||
result="Message not delivered ";
|
||||
break;
|
||||
default : result="Message in progress.. ";
|
||||
}
|
||||
|
||||
GDateTime *dt=g_date_time_new_now_local();
|
||||
char *time=g_date_time_format(dt,"%k:%M");
|
||||
gchar result2[80];
|
||||
sprintf(result2,"%s %s",result,time);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name(b,&iter,result2,-1,
|
||||
"italic","right","small","font_grey",NULL);
|
||||
list=g_list_remove(list,g_list_nth_data(list,0));
|
||||
g_object_set_data(G_OBJECT(page),"list",list);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_chat_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *user_pointer){
|
||||
g_message("chat message state is %s",linphone_chat_message_state_to_string(state));
|
||||
update_chat_state_message(state);
|
||||
update_chat_state_message(state);
|
||||
}
|
||||
|
||||
void linphone_gtk_send_text(LinphoneChatRoom *cr){
|
||||
void linphone_gtk_send_text(){
|
||||
GtkWidget *main_window=linphone_gtk_get_main_window();
|
||||
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
|
||||
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
|
||||
GtkWidget *entry=linphone_gtk_get_widget(w,"text_entry");
|
||||
const gchar *entered;
|
||||
|
||||
LinphoneChatRoom *cr=g_object_get_data(G_OBJECT(w),"cr");
|
||||
entered=gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
if (strlen(entered)>0) {
|
||||
LinphoneChatMessage *msg;
|
||||
linphone_gtk_push_text(w,
|
||||
linphone_gtk_get_used_identity(),
|
||||
entered,TRUE,g_object_get_data(G_OBJECT(w),"cr"));
|
||||
msg=linphone_chat_room_create_message(cr,entered);
|
||||
entered,TRUE,cr);
|
||||
msg=linphone_chat_room_create_message(cr,entered);
|
||||
linphone_chat_room_send_message2(cr,msg,on_chat_state_changed,NULL);
|
||||
gtk_entry_set_text(GTK_ENTRY(entry),"");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,21 +236,27 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
|
|||
GHashTable *hash=g_object_get_data(G_OBJECT(main_window),"history");
|
||||
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
|
||||
GtkWidget *text=linphone_gtk_get_widget(chat_view,"textview");
|
||||
GdkColor color;
|
||||
int idx;
|
||||
|
||||
|
||||
color.red = 32512;
|
||||
color.green = 32512;
|
||||
color.blue = 32512;
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW(text),GTK_WRAP_WORD);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW(text),FALSE);
|
||||
gtk_notebook_append_page (notebook,chat_view,create_tab_chat_header(cr,with));
|
||||
idx = gtk_notebook_page_num(notebook, chat_view);
|
||||
gtk_notebook_set_current_page(notebook, idx);
|
||||
gtk_widget_show(chat_view);
|
||||
|
||||
GList *l = NULL;
|
||||
|
||||
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
|
||||
g_object_set_data(G_OBJECT(chat_view),"idx",GINT_TO_POINTER(idx));
|
||||
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
|
||||
g_object_set_data(G_OBJECT(chat_view),"from_chatroom",linphone_address_as_string_uri_only(with));
|
||||
g_object_set_data(G_OBJECT(chat_view),"list",l);
|
||||
g_object_set_data(G_OBJECT(chat_view),"from_chatroom",(gpointer) with);
|
||||
|
||||
GList *list=NULL;
|
||||
g_object_set_data(G_OBJECT(chat_view),"list",list);
|
||||
|
||||
gchar *buf=g_hash_table_lookup(hash,linphone_address_as_string_uri_only(with));
|
||||
if(buf != NULL){
|
||||
|
|
@ -214,16 +266,28 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
|
|||
GtkTextBuffer *text_buffer;
|
||||
text_buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
|
||||
gtk_text_buffer_get_bounds(text_buffer, &start, &end);
|
||||
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
|
||||
gtk_text_buffer_delete (text_buffer, &start, &end);
|
||||
gtk_text_buffer_insert(text_buffer,&start,buf,-1);
|
||||
}
|
||||
|
||||
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
|
||||
"right","justification", GTK_JUSTIFY_RIGHT,NULL);
|
||||
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
|
||||
"left","justification", GTK_JUSTIFY_LEFT,NULL);
|
||||
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
|
||||
"bold","weight", PANGO_WEIGHT_BOLD,NULL);
|
||||
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
|
||||
"italic","style", PANGO_STYLE_ITALIC,NULL);
|
||||
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
|
||||
"small","size",9*PANGO_SCALE,NULL);
|
||||
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
|
||||
"font_grey","foreground-gdk",&color,NULL);
|
||||
|
||||
GtkWidget *button = linphone_gtk_get_widget(chat_view,"send");
|
||||
g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,cr);
|
||||
g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,NULL);
|
||||
|
||||
GtkWidget *entry = linphone_gtk_get_widget(chat_view,"text_entry");
|
||||
g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,cr);
|
||||
g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,NULL);
|
||||
|
||||
return chat_view;
|
||||
}
|
||||
|
|
@ -234,13 +298,11 @@ LinphoneChatRoom * linphone_gtk_create_chatroom(const LinphoneAddress *with){
|
|||
return cr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,GtkWidget *chat_view){
|
||||
GtkWidget *main_window=linphone_gtk_get_main_window ();
|
||||
GHashTable *hash=g_object_get_data(G_OBJECT(main_window),"history");
|
||||
if(g_strcmp0((char *)g_object_get_data(G_OBJECT(chat_view),"from_chatroom"),
|
||||
linphone_address_as_string_uri_only(uri))!=0)
|
||||
LinphoneAddress *from=(LinphoneAddress *)g_object_get_data(G_OBJECT(chat_view),"from_chatroom");
|
||||
if(g_strcmp0(linphone_address_as_string(from),linphone_address_as_string(uri))!=0)
|
||||
{
|
||||
GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
|
||||
GtkTextIter start;
|
||||
|
|
@ -252,17 +314,16 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
|
|||
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
|
||||
gtk_text_buffer_delete (text_buffer, &start, &end);
|
||||
if(buf!=NULL){
|
||||
gtk_text_buffer_insert(text_buffer,&start,buf,-1);
|
||||
} else {
|
||||
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
|
||||
GtkWidget *entry = linphone_gtk_get_widget(chat_view,"text_entry");
|
||||
g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,cr);
|
||||
gtk_text_buffer_insert_with_tags_by_name(text_buffer,&start,buf,-1,"font_grey",NULL);
|
||||
GtkTextMark *mark=gtk_text_buffer_create_mark(text_buffer, NULL, &start, FALSE);
|
||||
gtk_text_view_scroll_to_mark(text_view,mark, 0, FALSE, 0, 0);
|
||||
}
|
||||
|
||||
GtkWidget *button = linphone_gtk_get_widget(chat_view,"send");
|
||||
g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,cr);
|
||||
}
|
||||
|
||||
g_object_set_data(G_OBJECT(chat_view),"from_chatroom",linphone_address_as_string_uri_only(uri));
|
||||
udpate_tab_chat_header(chat_view,uri,cr);
|
||||
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
|
||||
g_object_set_data(G_OBJECT(chat_view),"from_chatroom",(gpointer) uri);
|
||||
g_object_set_data(G_OBJECT(chat_view),"from_message",linphone_address_as_string_uri_only(uri));
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(main_window,"contact_list")),"chatview",(gpointer)chat_view);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -281,6 +342,8 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const
|
|||
GtkWidget *main_window=linphone_gtk_get_main_window();
|
||||
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
|
||||
GtkWidget *w;
|
||||
GDateTime *dt=g_date_time_new_now_local();
|
||||
char *time=g_date_time_format(dt,"%k:%M");
|
||||
|
||||
w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
|
||||
if(w!=NULL){
|
||||
|
|
@ -288,16 +351,23 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const
|
|||
} else {
|
||||
w=linphone_gtk_init_chatroom(room,from);
|
||||
g_object_set_data(G_OBJECT(friendlist),"chatview",(gpointer)w);
|
||||
g_object_set_data(G_OBJECT(friendlist),"from",(gpointer)from);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_GTK_OSX
|
||||
const char *display=linphone_address_get_display_name(from);
|
||||
if (display==NULL || display[0]=='\0') {
|
||||
display=linphone_address_get_username(from);
|
||||
}
|
||||
|
||||
#ifdef HAVE_GTK_OSXs
|
||||
/* Notified when a new message is sent */
|
||||
linphone_gtk_status_icon_set_blinking(TRUE);
|
||||
#else
|
||||
if(!gtk_window_is_active(GTK_WINDOW(main_window))){
|
||||
if(!GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"is_notified"))){
|
||||
linphone_gtk_notify(NULL,message);
|
||||
gchar result2[80];
|
||||
sprintf(result2,"%s \n %s sent at %s",message,display,time);
|
||||
linphone_gtk_notify(NULL,result2);
|
||||
g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(TRUE));
|
||||
} else {
|
||||
g_object_set_data(G_OBJECT(w),"is_notified",GINT_TO_POINTER(FALSE));
|
||||
|
|
@ -305,8 +375,7 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const
|
|||
}
|
||||
#endif
|
||||
linphone_gtk_push_text(w,from,message,FALSE,room);
|
||||
//linphone_gtk_update_chat_picture(TRUE);
|
||||
linphone_gtk_update_chat_picture();
|
||||
//gtk_window_present(GTK_WINDOW(w));
|
||||
/*gtk_window_set_urgency_hint(GTK_WINDOW(w),TRUE);*/
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ void linphone_gtk_set_in_conference(LinphoneCall *call){
|
|||
if(conf_frame==NULL){
|
||||
conf_frame=linphone_gtk_create_widget("main","conf_frame");
|
||||
GtkWidget *button_conf=linphone_gtk_get_widget(conf_frame,"terminate_conf");
|
||||
GtkWidget *image=create_pixmap("stopcall-red.png");
|
||||
GtkWidget *image=create_pixmap("stopcall-small.png");
|
||||
gtk_button_set_image(GTK_BUTTON(button_conf),image);
|
||||
g_signal_connect_swapped(G_OBJECT(button_conf),"clicked",(GCallback)linphone_gtk_terminate_call,NULL);
|
||||
g_object_set_data(G_OBJECT(mw),"conf_frame",(gpointer)conf_frame);
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ static void linphone_gtk_call_selected(GtkTreeView *treeview){
|
|||
"start_call"));
|
||||
}
|
||||
|
||||
void linphone_gtk_update_chat_picture(gboolean active){
|
||||
void linphone_gtk_create_chat_picture(gboolean active){
|
||||
GtkTreeIter iter;
|
||||
GtkWidget *w = linphone_gtk_get_main_window();
|
||||
GtkWidget *friendlist=linphone_gtk_get_widget(w,"contact_list");
|
||||
|
|
@ -187,6 +187,33 @@ void linphone_gtk_update_chat_picture(gboolean active){
|
|||
}
|
||||
}
|
||||
|
||||
void linphone_gtk_update_chat_picture(){
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store=NULL;
|
||||
GtkWidget *w = linphone_gtk_get_main_window();
|
||||
GtkWidget *friendlist=linphone_gtk_get_widget(w,"contact_list");
|
||||
GtkTreeModel *model=gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
|
||||
GtkWidget *chat_view=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
|
||||
LinphoneFriend *lf=NULL;
|
||||
LinphoneAddress *uri=(LinphoneAddress *)g_object_get_data(G_OBJECT(friendlist),"from");
|
||||
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)));
|
||||
if (gtk_tree_model_get_iter_first(model,&iter)) {
|
||||
do{
|
||||
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
|
||||
if(chat_view!=NULL){
|
||||
if(uri !=NULL) {
|
||||
if(g_strcmp0(linphone_address_as_string(linphone_friend_get_address(lf)),
|
||||
linphone_address_as_string(uri))==0){
|
||||
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
|
||||
} else {
|
||||
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_chat_picture(),-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}while(gtk_tree_model_iter_next(model,&iter));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean grab_focus(GtkWidget *w){
|
||||
gtk_widget_grab_focus(w);
|
||||
return FALSE;
|
||||
|
|
@ -207,16 +234,14 @@ void linphone_gtk_chat_selected(GtkWidget *item){
|
|||
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(item)));
|
||||
if (gtk_tree_selection_get_selected (select, &model, &iter)){
|
||||
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(w,"viewswitch");
|
||||
gtk_tree_model_get(model,&iter,FRIEND_CHATROOM,&cr,-1);
|
||||
const LinphoneAddress *uri;
|
||||
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
|
||||
uri=linphone_friend_get_address(lf);
|
||||
if(cr == NULL){
|
||||
cr=linphone_gtk_create_chatroom(uri);
|
||||
gtk_list_store_set(store,&iter, FRIEND_CHATROOM,cr,-1);
|
||||
gtk_list_store_set(store,&iter, FRIEND_CHAT_CONVERSATION,NULL,-1);
|
||||
}
|
||||
page=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
|
||||
g_object_set_data(G_OBJECT(friendlist),"from",(gpointer)uri);
|
||||
if(page==NULL){
|
||||
page=linphone_gtk_init_chatroom(cr,uri);
|
||||
g_object_set_data(G_OBJECT(friendlist),"chatview",(gpointer)page);
|
||||
|
|
@ -224,7 +249,7 @@ void linphone_gtk_chat_selected(GtkWidget *item){
|
|||
linphone_gtk_load_chatroom(cr,uri,page);
|
||||
}
|
||||
gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,page));
|
||||
linphone_gtk_update_chat_picture(FALSE);
|
||||
linphone_gtk_create_chat_picture(FALSE);
|
||||
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(page,"text_entry"));
|
||||
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
|
||||
}
|
||||
|
|
@ -621,10 +646,10 @@ void linphone_gtk_show_friends(void){
|
|||
GtkListStore *store=NULL;
|
||||
GtkTreeIter iter;
|
||||
const MSList *itf;
|
||||
GtkWidget *filter=linphone_gtk_get_widget(mw,"search_bar");
|
||||
//GtkWidget *filter=linphone_gtk_get_widget(mw,"search_bar");
|
||||
LinphoneCore *core=linphone_gtk_get_core();
|
||||
const gchar *search=NULL;
|
||||
gboolean lookup=FALSE;
|
||||
//const gchar *search=NULL;
|
||||
//gboolean lookup=FALSE;
|
||||
MSList *sorted;
|
||||
|
||||
linphone_gtk_show_directory_search();
|
||||
|
|
@ -636,10 +661,10 @@ void linphone_gtk_show_friends(void){
|
|||
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)));
|
||||
gtk_list_store_clear(store);
|
||||
|
||||
search=gtk_entry_get_text(GTK_ENTRY(filter));
|
||||
if (search==NULL || search[0]=='\0')
|
||||
lookup=FALSE;
|
||||
else lookup=TRUE;
|
||||
//search=gtk_entry_get_text(GTK_ENTRY(filter));
|
||||
//if (search==NULL || search[0]=='\0')
|
||||
// lookup=FALSE;
|
||||
//else lookup=TRUE;
|
||||
|
||||
sorted=sort_friend_list(linphone_core_get_friend_list(core));
|
||||
|
||||
|
|
@ -650,12 +675,12 @@ void linphone_gtk_show_friends(void){
|
|||
const char *name=linphone_address_get_display_name(f_uri);
|
||||
const char *display=name;
|
||||
char *escaped=NULL;
|
||||
if (lookup){
|
||||
/*if (lookup){
|
||||
if (strstr(uri,search)==NULL){
|
||||
ms_free(uri);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//BuddyInfo *bi;
|
||||
gboolean send_subscribe=linphone_friend_get_send_subscribe(lf);
|
||||
if (name==NULL || name[0]=='\0') {
|
||||
|
|
@ -672,6 +697,7 @@ void linphone_gtk_show_friends(void){
|
|||
escaped=g_markup_escape_text(uri,-1);
|
||||
gtk_list_store_set(store,&iter,FRIEND_SIP_ADDRESS,escaped,-1);
|
||||
g_free(escaped);
|
||||
linphone_gtk_update_chat_picture();
|
||||
//bi=linphone_friend_get_info(lf);
|
||||
/*if (bi!=NULL && bi->image_data!=NULL){
|
||||
GdkPixbuf *pbuf=
|
||||
|
|
@ -893,7 +919,7 @@ static gint tree_view_get_cell_from_pos(GtkTreeView *view, guint x, guint y){
|
|||
for (node = columns; node != NULL && col == NULL; node = node->next){
|
||||
GtkTreeViewColumn *checkcol = (GtkTreeViewColumn*) node->data;
|
||||
gtk_tree_view_column_cell_get_size(checkcol,NULL,NULL,NULL,NULL,&height);
|
||||
if (x >= colx && x < (colx + checkcol->width) && y < height*coly){
|
||||
if (x >= colx && x < (colx + checkcol->width) && y < (height+2)*coly){
|
||||
col = checkcol;
|
||||
gint num = get_col_number_from_tree_view_column(col);
|
||||
return num;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ LinphoneCall *linphone_gtk_get_currently_displayed_call(gboolean *is_conf){
|
|||
|
||||
static GtkWidget *make_tab_header(int number){
|
||||
GtkWidget *w=gtk_hbox_new (FALSE,0);
|
||||
GtkWidget *i=create_pixmap ("status-green.png");
|
||||
GtkWidget *i=create_pixmap ("startcall-small.png");
|
||||
GtkWidget *l;
|
||||
gchar *text=g_strdup_printf(_("Call #%i"),number);
|
||||
l=gtk_label_new (text);
|
||||
|
|
@ -84,7 +84,7 @@ void update_tab_header(LinphoneCall *call,gboolean pause){
|
|||
if(pause){
|
||||
i=gtk_image_new_from_stock(GTK_STOCK_MEDIA_PAUSE,GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
} else {
|
||||
i=create_pixmap ("status-green.png");
|
||||
i=create_pixmap ("startcall-small.png");
|
||||
}
|
||||
GtkWidget *l;
|
||||
gchar *text=g_strdup_printf(_("Call #%i"),call_index);
|
||||
|
|
@ -107,7 +107,7 @@ static void linphone_gtk_in_call_set_animation_image(GtkWidget *callview, const
|
|||
}
|
||||
image=create_pixmap(image_name);
|
||||
}else
|
||||
image=gtk_image_new_from_stock(image_name,GTK_ICON_SIZE_DIALOG);
|
||||
image=gtk_image_new_from_stock(image_name,GTK_ICON_SIZE_DND);
|
||||
if (elem)
|
||||
gtk_widget_destroy((GtkWidget*)elem->data);
|
||||
gtk_widget_show(image);
|
||||
|
|
@ -337,7 +337,7 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){
|
|||
gtk_widget_hide(conf);
|
||||
|
||||
GtkWidget *button=linphone_gtk_get_widget(call_view,"terminate_call");
|
||||
GtkWidget *image=create_pixmap("stopcall-red.png");
|
||||
GtkWidget *image=create_pixmap("stopcall-small.png");
|
||||
gtk_button_set_label(GTK_BUTTON(button),_("Hang up"));
|
||||
gtk_button_set_image(GTK_BUTTON(button),image);
|
||||
gtk_widget_show(image);
|
||||
|
|
@ -363,7 +363,7 @@ void linphone_gtk_update_video_button(LinphoneCall *call){
|
|||
button=linphone_gtk_get_widget(call_view,"video_button");
|
||||
|
||||
gtk_button_set_image(GTK_BUTTON(button),
|
||||
gtk_image_new_from_stock(has_video ? GTK_STOCK_REMOVE : GTK_STOCK_ADD,GTK_ICON_SIZE_BUTTON));
|
||||
gtk_image_new_from_stock(has_video ? GTK_STOCK_REMOVE : GTK_STOCK_ADD,GTK_ICON_SIZE_BUTTON));
|
||||
g_object_set_data(G_OBJECT(button),"adding_video",GINT_TO_POINTER(!has_video));
|
||||
if (!linphone_core_video_supported(linphone_call_get_core(call))){
|
||||
gtk_widget_set_sensitive(button,FALSE);
|
||||
|
|
@ -373,7 +373,11 @@ void linphone_gtk_update_video_button(LinphoneCall *call){
|
|||
g_signal_connect(G_OBJECT(button),"clicked",(GCallback)video_button_clicked,call);
|
||||
g_object_set_data(G_OBJECT(button),"signal_connected",GINT_TO_POINTER(1));
|
||||
}
|
||||
GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"conf_frame");
|
||||
gtk_widget_set_sensitive(button,linphone_call_get_state(call)==LinphoneCallStreamsRunning);
|
||||
if(conf_frame!=NULL){
|
||||
gtk_widget_set_sensitive(button,FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_gtk_remove_in_call_view(LinphoneCall *call){
|
||||
|
|
@ -447,12 +451,12 @@ void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call){
|
|||
display_peer_name_in_label(callee,linphone_call_get_remote_address (call));
|
||||
|
||||
answer_button=linphone_gtk_get_widget(callview,"accept_call");
|
||||
image=create_pixmap (linphone_gtk_get_ui_config("start_call_icon","startcall-green.png"));
|
||||
image=create_pixmap (linphone_gtk_get_ui_config("start_call_icon","startcall-small.png"));
|
||||
gtk_button_set_label(GTK_BUTTON(answer_button),_("Answer"));
|
||||
gtk_button_set_image(GTK_BUTTON(answer_button),image);
|
||||
gtk_widget_show(image);
|
||||
|
||||
image=create_pixmap (linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png"));
|
||||
image=create_pixmap (linphone_gtk_get_ui_config("stop_call_icon","stopcall-small.png"));
|
||||
gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(callview,"decline_call")),image);
|
||||
gtk_widget_show(image);
|
||||
|
||||
|
|
@ -636,7 +640,6 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
|
|||
|
||||
gtk_widget_set_visible(linphone_gtk_get_widget(callview,"buttons_panel"),!in_conf);
|
||||
|
||||
|
||||
gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel"));
|
||||
gtk_label_set_markup(GTK_LABEL(status),in_conf ? _("In conference") : _("<b>In call</b>"));
|
||||
|
||||
|
|
@ -648,7 +651,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
|
|||
update_tab_header(call,FALSE);
|
||||
linphone_gtk_enable_mute_button(
|
||||
GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),TRUE);
|
||||
gtk_widget_show_all(linphone_gtk_get_widget(callview,"buttons_panel"));
|
||||
|
||||
if (taskid==0){
|
||||
taskid=g_timeout_add(250,(GSourceFunc)linphone_gtk_in_call_view_refresh,call);
|
||||
g_object_set_data(G_OBJECT(callview),"taskid",GINT_TO_POINTER(taskid));
|
||||
|
|
@ -659,6 +662,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
|
|||
linphone_gtk_set_in_conference(call);
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(callview,"incall_mute"),FALSE);
|
||||
}
|
||||
gtk_widget_show_all(linphone_gtk_get_widget(callview,"buttons_panel"));
|
||||
if (call_stats) show_used_codecs(call_stats,call);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,13 @@ GtkWidget*create_pixmap(const gchar *filename);
|
|||
GtkWidget *_gtk_image_new_from_memory_at_scale(const void *data, gint len, gint w, gint h, gboolean preserve_ratio);
|
||||
GdkPixbuf *_gdk_pixbuf_new_from_memory_at_scale(const void *data, gint len, gint w, gint h, gboolean preserve_ratio);
|
||||
|
||||
void linphone_gtk_destroy_window(GtkWidget *window);
|
||||
GtkWidget *linphone_gtk_create_window(const char *window_name);
|
||||
GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char *name);
|
||||
GtkWidget *linphone_gtk_create_widget(const char *filename, const char *widget_name);
|
||||
GtkWidget * linphone_gtk_create_assistant(void);
|
||||
|
||||
void linphone_gtk_show_assistant(void);
|
||||
void linphone_gtk_close_assistant(void);
|
||||
|
||||
LinphoneCore *linphone_gtk_get_core(void);
|
||||
GtkWidget *linphone_gtk_get_main_window();
|
||||
|
|
@ -104,9 +107,10 @@ void linphone_gtk_status_icon_set_blinking(gboolean val);
|
|||
void linphone_gtk_notify(LinphoneCall *call, const char *msg);
|
||||
LinphoneChatRoom *linphone_gtk_start_chat(GtkTreeView* t);
|
||||
void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,GtkWidget *chat_view);
|
||||
void linphone_gtk_send_text(LinphoneChatRoom *cr);
|
||||
void linphone_gtk_send_text();
|
||||
GtkWidget * linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *with);
|
||||
void linphone_gtk_update_chat_picture(gboolean active);
|
||||
void linphone_gtk_create_chat_picture(gboolean active);
|
||||
void linphone_gtk_update_chat_picture();
|
||||
void linphone_gtk_chat_set_conversation(const LinphoneAddress *uri,gchar *conversation);
|
||||
gchar * linphone_gtk_chat_get_conversation(const LinphoneAddress *uri);
|
||||
|
||||
|
|
|
|||
69
gtk/main.c
69
gtk/main.c
|
|
@ -50,7 +50,6 @@ const char *this_program_ident_string="linphone_ident_string=" LINPHONE_VERSION;
|
|||
|
||||
static LinphoneCore *the_core=NULL;
|
||||
static GtkWidget *the_ui=NULL;
|
||||
GtkWidget *the_wizard=NULL;
|
||||
|
||||
static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState rs, const char *msg);
|
||||
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid);
|
||||
|
|
@ -238,6 +237,7 @@ static void linphone_gtk_init_liblinphone(const char *config_file,
|
|||
vtable.transfer_state_changed=linphone_gtk_transfer_state_changed;
|
||||
|
||||
the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL);
|
||||
//lp_config_set_int(linphone_core_get_config(the_core), "sip", "store_auth_info", 0);
|
||||
linphone_core_set_user_agent(the_core,"Linphone", LINPHONE_VERSION);
|
||||
linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL);
|
||||
linphone_core_set_zrtp_secrets_file(the_core,secrets_file);
|
||||
|
|
@ -257,6 +257,11 @@ GtkWidget *linphone_gtk_get_main_window(){
|
|||
return the_ui;
|
||||
}
|
||||
|
||||
void linphone_gtk_destroy_main_window() {
|
||||
linphone_gtk_destroy_window(the_ui);
|
||||
the_ui = NULL;
|
||||
}
|
||||
|
||||
static void linphone_gtk_configure_window(GtkWidget *w, const char *window_name){
|
||||
static const char *icon_path=NULL;
|
||||
static const char *hiddens=NULL;
|
||||
|
|
@ -295,6 +300,12 @@ static int get_ui_file(const char *name, char *path, int pathsize){
|
|||
return 0;
|
||||
}
|
||||
|
||||
void linphone_gtk_destroy_window(GtkWidget *widget) {
|
||||
GtkBuilder* builder = g_object_get_data(G_OBJECT(widget), "builder");
|
||||
gtk_widget_destroy(widget);
|
||||
g_object_unref (G_OBJECT (builder));
|
||||
}
|
||||
|
||||
GtkWidget *linphone_gtk_create_window(const char *window_name){
|
||||
GError* error = NULL;
|
||||
GtkBuilder* builder = gtk_builder_new ();
|
||||
|
|
@ -313,7 +324,7 @@ GtkWidget *linphone_gtk_create_window(const char *window_name){
|
|||
g_error("Could not retrieve '%s' window from xml file",window_name);
|
||||
return NULL;
|
||||
}
|
||||
g_object_set_data(G_OBJECT(w),"builder",builder);
|
||||
g_object_set_data(G_OBJECT(w), "builder",builder);
|
||||
gtk_builder_connect_signals(builder,w);
|
||||
linphone_gtk_configure_window(w,window_name);
|
||||
return w;
|
||||
|
|
@ -724,9 +735,14 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
|
|||
gtk_widget_set_visible(button,add_call);
|
||||
|
||||
//gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),stop_active);
|
||||
|
||||
linphone_gtk_enable_transfer_button(lc,call_list_size>1);
|
||||
linphone_gtk_enable_conference_button(lc,call_list_size>1);
|
||||
GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(mw),"conf_frame");
|
||||
if(conf_frame==NULL){
|
||||
linphone_gtk_enable_transfer_button(lc,call_list_size>1);
|
||||
linphone_gtk_enable_conference_button(lc,call_list_size>1);
|
||||
} else {
|
||||
linphone_gtk_enable_transfer_button(lc,FALSE);
|
||||
linphone_gtk_enable_conference_button(lc,FALSE);
|
||||
}
|
||||
update_video_title();
|
||||
if (call) linphone_gtk_update_video_button(call);
|
||||
}
|
||||
|
|
@ -1427,7 +1443,7 @@ void linphone_gtk_load_identities(void){
|
|||
}
|
||||
|
||||
static void linphone_gtk_dtmf_pressed(GtkButton *button){
|
||||
const char *label=gtk_button_get_label(button);
|
||||
const char *label=(char *)g_object_get_data(G_OBJECT(button),"label");
|
||||
GtkWidget *uri_bar=linphone_gtk_get_widget(gtk_widget_get_toplevel(GTK_WIDGET(button)),"uribar");
|
||||
int pos=-1;
|
||||
gtk_editable_insert_text(GTK_EDITABLE(uri_bar),label,1,&pos);
|
||||
|
|
@ -1497,7 +1513,7 @@ static void linphone_gtk_configure_main_window(){
|
|||
home=linphone_gtk_get_ui_config("home","http://www.linphone.org");
|
||||
start_call_icon=linphone_gtk_get_ui_config("start_call_icon","startcall-green.png");
|
||||
add_call_icon=linphone_gtk_get_ui_config("add_call_icon","addcall-green.png");
|
||||
//stop_call_icon=linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png");
|
||||
//stop_call_icon=linphone_gtk_get_ui_config("stop_call_icon","stopcall-small.png");
|
||||
search_icon=linphone_gtk_get_ui_config("directory_search_icon",NULL);
|
||||
update_check_menu=linphone_gtk_get_ui_config_int("update_check_menu",0);
|
||||
buttons_have_borders=linphone_gtk_get_ui_config_int("buttons_border",1);
|
||||
|
|
@ -1611,6 +1627,28 @@ static gboolean on_window_state_event(GtkWidget *w, GdkEventWindowState *event){
|
|||
}
|
||||
#endif
|
||||
|
||||
void linphone_gtk_init_dtmf_table(GtkWidget *mw){
|
||||
GtkWidget *dtmf_table=linphone_gtk_get_widget(mw,"dtmf_table");
|
||||
gtk_widget_set_direction(dtmf_table, GTK_TEXT_DIR_LTR);
|
||||
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_A")),"label","A");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_B")),"label","B");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_C")),"label","C");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_D")),"label","D");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_1")),"label","1");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_2")),"label","2");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_3")),"label","3");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_4")),"label","4");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_5")),"label","5");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_6")),"label","6");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_7")),"label","7");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_8")),"label","8");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_9")),"label","9");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_0")),"label","0");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_#")),"label","#");
|
||||
g_object_set_data(G_OBJECT(linphone_gtk_get_widget(mw,"dtmf_*")),"label","*");
|
||||
|
||||
}
|
||||
|
||||
static void linphone_gtk_init_main_window(){
|
||||
GtkWidget *main_window;
|
||||
|
|
@ -1624,7 +1662,8 @@ static void linphone_gtk_init_main_window(){
|
|||
linphone_gtk_connect_digits();
|
||||
main_window=linphone_gtk_get_main_window();
|
||||
linphone_gtk_call_log_update(main_window);
|
||||
|
||||
|
||||
linphone_gtk_init_dtmf_table(main_window);
|
||||
linphone_gtk_update_call_buttons (NULL);
|
||||
g_object_set_data(G_OBJECT(main_window),"is_conf",GINT_TO_POINTER(FALSE));
|
||||
/*prevent the main window from being destroyed by a user click on WM controls, instead we hide it*/
|
||||
|
|
@ -1703,21 +1742,15 @@ static void linphone_gtk_check_soundcards(){
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef BUILD_WIZARD
|
||||
// Display the account wizard
|
||||
void linphone_gtk_display_wizard() {
|
||||
if (the_wizard == NULL || !gtk_widget_get_visible(the_wizard)) { // Only one instance of the wizard at the same time
|
||||
the_wizard = linphone_gtk_create_assistant();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void linphone_gtk_quit(void){
|
||||
static gboolean quit_done=FALSE;
|
||||
if (!quit_done){
|
||||
quit_done=TRUE;
|
||||
linphone_gtk_unmonitor_usb();
|
||||
g_source_remove_by_user_data(linphone_gtk_get_core());
|
||||
#ifdef BUILD_WIZARD
|
||||
linphone_gtk_close_assistant();
|
||||
#endif
|
||||
linphone_gtk_uninit_instance();
|
||||
linphone_gtk_destroy_log_window();
|
||||
linphone_core_destroy(the_core);
|
||||
|
|
@ -1869,7 +1902,7 @@ int main(int argc, char *argv[]){
|
|||
#ifdef BUILD_WIZARD
|
||||
// Veryfing if at least one sip account is configured. If not, show wizard
|
||||
if (linphone_core_get_proxy_config_list(linphone_gtk_get_core()) == NULL) {
|
||||
linphone_gtk_display_wizard();
|
||||
linphone_gtk_show_assistant();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
75
gtk/main.ui
75
gtk/main.ui
|
|
@ -113,6 +113,7 @@
|
|||
<object class="GtkTextView" id="textview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="border_width">4</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -386,29 +387,30 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="spk_audiolevel">
|
||||
<property name="width_request">90</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="incall_spk_icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-size">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="spk_audiolevel">
|
||||
<property name="width_request">90</property>
|
||||
<property name="height_request">10</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">1</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
|
|
@ -416,7 +418,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
|
@ -480,6 +482,7 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="hold_call">
|
||||
<property name="label" translatable="yes">Pause</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
|
|
@ -497,7 +500,6 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">half</property>
|
||||
<signal name="clicked" handler="linphone_gtk_mute_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
@ -596,14 +598,15 @@
|
|||
<child>
|
||||
<object class="GtkProgressBar" id="quality_indicator">
|
||||
<property name="width_request">90</property>
|
||||
<property name="height_request">10</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="tooltip_text" translatable="yes">Call quality rating</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
|
@ -832,7 +835,7 @@
|
|||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">image12</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="linphone_gtk_display_wizard" swapped="no"/>
|
||||
<signal name="activate" handler="linphone_gtk_show_assistant" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -944,9 +947,6 @@
|
|||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
@ -963,30 +963,23 @@
|
|||
<object class="GtkVBox" id="vbox12">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">4</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="search_bar">
|
||||
<object class="GtkLabel" id="contact">
|
||||
<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="invisible_char">●</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<signal name="changed" handler="linphone_gtk_show_friends" swapped="no"/>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Contacts</property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">4</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">3</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1000,7 +993,7 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="enable_search">False</property>
|
||||
<property name="search_column">0</property>
|
||||
<property name="search_column">1</property>
|
||||
<signal name="button-press-event" handler="linphone_gtk_contact_list_button_pressed" swapped="no"/>
|
||||
<signal name="cursor-changed" handler="linphone_gtk_contact_clicked" swapped="no"/>
|
||||
<signal name="row-activated" handler="linphone_gtk_contact_activated" swapped="no"/>
|
||||
|
|
@ -1011,7 +1004,7 @@
|
|||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -1073,7 +1066,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -216,10 +216,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="mtu_set">
|
||||
<property name="label" translatable="yes">Set Maximum Transmission Unit:</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_mtu_set" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -256,10 +256,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="dtmf_sipinfo">
|
||||
<property name="label" translatable="yes">Send DTMFs as SIP info</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_use_sip_info_dtmf_toggled" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -272,11 +272,11 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="ipv6_enabled">
|
||||
<property name="label" translatable="yes">Use IPv6 instead of IPv4</property>
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_ipv6_toggled" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -324,7 +324,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">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="n_rows">6</property>
|
||||
<property name="n_rows">7</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="proto_combo">
|
||||
|
|
@ -364,7 +364,7 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -380,30 +380,20 @@
|
|||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tunnel_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Tunnel</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="tunnel_edit_button">
|
||||
<property name="label">gtk-edit</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_edit_tunnel" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -439,25 +429,25 @@
|
|||
<property name="label" translatable="yes">DSCP fields</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="dscp_edit_button">
|
||||
<property name="label">gtk-edit</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_dscp_edit" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -506,10 +496,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="fixed_audio_port">
|
||||
<property name="label" translatable="yes">Fixed</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_fixed_audio_port_toggle" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -573,10 +563,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="fixed_video_port">
|
||||
<property name="label" translatable="yes">Fixed</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_fixed_video_port_toggle" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -594,6 +584,33 @@
|
|||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tunnel_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Tunnel</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="media_encryption_mandatory">
|
||||
<property name="label" translatable="yes">Media encryption is mandatory</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_set_media_encryption_mandatory" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -628,10 +645,10 @@
|
|||
<child>
|
||||
<object class="GtkRadioButton" id="no_nat">
|
||||
<property name="label" translatable="yes">Direct connection to the Internet</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_no_firewall_toggled" swapped="no"/>
|
||||
|
|
@ -649,10 +666,10 @@
|
|||
<child>
|
||||
<object class="GtkRadioButton" id="use_nat_address">
|
||||
<property name="label" translatable="yes">Behind NAT / Firewall (specify gateway IP below)</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">no_nat</property>
|
||||
|
|
@ -717,10 +734,10 @@
|
|||
<child>
|
||||
<object class="GtkRadioButton" id="use_stun">
|
||||
<property name="label" translatable="yes">Behind NAT / Firewall (use STUN to resolve)</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">no_nat</property>
|
||||
<signal name="toggled" handler="linphone_gtk_use_stun_toggled" swapped="no"/>
|
||||
|
|
@ -734,10 +751,10 @@
|
|||
<child>
|
||||
<object class="GtkRadioButton" id="use_ice">
|
||||
<property name="label" translatable="yes">Behind NAT / Firewall (use ICE)</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">no_nat</property>
|
||||
<signal name="toggled" handler="linphone_gtk_use_ice_toggled" swapped="no"/>
|
||||
|
|
@ -875,9 +892,6 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="n_rows">6</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="ring_sound_box">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -899,11 +913,11 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="play_ring">
|
||||
<property name="label">gtk-media-play</property>
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_play_ring_file" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -1076,10 +1090,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="echo_cancelation">
|
||||
<property name="label" translatable="yes">Enable echo cancellation</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_echo_cancelation_toggled" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -1090,6 +1104,9 @@
|
|||
<property name="bottom_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -1425,11 +1442,11 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="wizard">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_display_wizard" swapped="no"/>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_show_assistant" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox5">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -1472,11 +1489,11 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_proxy">
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_add_proxy" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox14">
|
||||
|
|
@ -1520,11 +1537,11 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="edit_proxy">
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_edit_proxy" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox16">
|
||||
|
|
@ -1568,11 +1585,11 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="remove_proxy">
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_remove_proxy" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox7">
|
||||
|
|
@ -1661,11 +1678,11 @@
|
|||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="erase_passwords">
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_clear_passwords" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox18">
|
||||
|
|
@ -1847,11 +1864,11 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="button4">
|
||||
<property name="label">gtk-go-up</property>
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_up" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -1864,11 +1881,11 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="up_codec">
|
||||
<property name="label">gtk-go-down</property>
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_down" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -1880,11 +1897,11 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="enable_codec">
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_enable" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox8">
|
||||
|
|
@ -1928,11 +1945,11 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="disable_codec">
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_codec_disable" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox9">
|
||||
|
|
@ -2095,10 +2112,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="adaptive_rate_control">
|
||||
<property name="label" translatable="yes">Enable adaptive rate control</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_adaptive_rate_control_toggled" swapped="no"/>
|
||||
|
|
@ -2124,7 +2141,7 @@
|
|||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"/>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -2250,10 +2267,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="ui_level">
|
||||
<property name="label" translatable="yes">Show advanced settings</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="linphone_gtk_ui_level_toggled" swapped="no"/>
|
||||
</object>
|
||||
|
|
@ -2330,11 +2347,11 @@
|
|||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button5">
|
||||
<property name="use_action_appearance">False</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="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="linphone_gtk_parameters_closed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox3">
|
||||
|
|
|
|||
|
|
@ -772,6 +772,7 @@ static LangCodes supported_langs[]={
|
|||
{ "zh_CN" , N_("Chinese") },
|
||||
{ "zh_TW" , N_("Traditional Chinese") },
|
||||
{ "nb_NO" , N_("Norwegian") },
|
||||
{ "he" , N_("Hebrew") },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
|
|
@ -879,19 +880,35 @@ void linphone_gtk_ui_level_toggled(GtkWidget *w) {
|
|||
linphone_gtk_ui_level_adapt(top);
|
||||
}
|
||||
|
||||
static void linphone_gtk_set_media_encryption_mandatory_sensitive(GtkWidget *propbox, gboolean val){
|
||||
GtkWidget *w=linphone_gtk_get_widget(propbox,"media_encryption_mandatory");
|
||||
gtk_widget_set_sensitive(w,val);
|
||||
}
|
||||
|
||||
static void linphone_gtk_media_encryption_changed(GtkWidget *combo){
|
||||
char *selected=gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
GtkWidget *toplevel=gtk_widget_get_toplevel(combo);
|
||||
if (selected!=NULL){
|
||||
if (strcasecmp(selected,"SRTP")==0)
|
||||
if (strcasecmp(selected,"SRTP")==0){
|
||||
linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionSRTP);
|
||||
else if (strcasecmp(selected,"ZRTP")==0)
|
||||
linphone_gtk_set_media_encryption_mandatory_sensitive(toplevel,TRUE);
|
||||
}else if (strcasecmp(selected,"ZRTP")==0){
|
||||
linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionZRTP);
|
||||
else linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionNone);
|
||||
linphone_gtk_set_media_encryption_mandatory_sensitive(toplevel,FALSE);
|
||||
}
|
||||
else {
|
||||
linphone_core_set_media_encryption(lc,LinphoneMediaEncryptionNone);
|
||||
linphone_gtk_set_media_encryption_mandatory_sensitive(toplevel,FALSE);
|
||||
}
|
||||
g_free(selected);
|
||||
}else g_warning("gtk_combo_box_get_active_text() returned NULL");
|
||||
}
|
||||
|
||||
void linphone_gtk_set_media_encryption_mandatory(GtkWidget *button){
|
||||
linphone_core_set_media_encryption_mandatory(linphone_gtk_get_core(),gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)));
|
||||
}
|
||||
|
||||
static void linphone_gtk_show_media_encryption(GtkWidget *pb){
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
GtkWidget *combo=linphone_gtk_get_widget(pb,"media_encryption_combo");
|
||||
|
|
@ -927,21 +944,30 @@ static void linphone_gtk_show_media_encryption(GtkWidget *pb){
|
|||
/*hide this setting*/
|
||||
gtk_widget_hide(combo);
|
||||
gtk_widget_hide(linphone_gtk_get_widget(pb,"media_encryption_label"));
|
||||
gtk_widget_hide(linphone_gtk_get_widget(pb,"media_encryption_mandatory"));
|
||||
}else{
|
||||
LinphoneMediaEncryption menc=linphone_core_get_media_encryption(lc);
|
||||
switch(menc){
|
||||
case LinphoneMediaEncryptionNone:
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
|
||||
linphone_gtk_set_media_encryption_mandatory_sensitive(pb,FALSE);
|
||||
break;
|
||||
case LinphoneMediaEncryptionSRTP:
|
||||
if (srtp_id!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),srtp_id);
|
||||
if (srtp_id!=-1) {
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),srtp_id);
|
||||
linphone_gtk_set_media_encryption_mandatory_sensitive(pb,TRUE);
|
||||
}
|
||||
break;
|
||||
case LinphoneMediaEncryptionZRTP:
|
||||
if (zrtp_id!=-1) gtk_combo_box_set_active(GTK_COMBO_BOX(combo),zrtp_id);
|
||||
if (zrtp_id!=-1) {
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),zrtp_id);
|
||||
linphone_gtk_set_media_encryption_mandatory_sensitive(pb,FALSE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
g_signal_connect(G_OBJECT(combo),"changed",(GCallback)linphone_gtk_media_encryption_changed,NULL);
|
||||
}
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"media_encryption_mandatory")),linphone_core_is_media_encryption_mandatory(lc));
|
||||
g_object_unref(G_OBJECT(model));
|
||||
}
|
||||
|
||||
|
|
@ -1151,44 +1177,22 @@ void linphone_gtk_edit_tunnel_closed(GtkWidget *button){
|
|||
gtk_widget_destroy(pb);
|
||||
}
|
||||
|
||||
|
||||
static void tunnel_get_server_host_and_port(LinphoneTunnel *tunnel, char *host, int size, int *port){
|
||||
char *colon;
|
||||
char *addresses;
|
||||
char *str1;
|
||||
char *address;
|
||||
const char* configured_addresses;
|
||||
|
||||
configured_addresses=linphone_tunnel_get_servers(tunnel);
|
||||
|
||||
if (configured_addresses==NULL){
|
||||
host[0]=0;
|
||||
*port=0;
|
||||
return;
|
||||
}
|
||||
addresses=ms_strdup(configured_addresses);
|
||||
str1=addresses;
|
||||
address=strtok(str1," "); // Not thread safe
|
||||
if (!address) return;
|
||||
colon=strchr(address, ':');
|
||||
if (!colon) return;
|
||||
*colon++='\0';
|
||||
*port=atoi(colon);
|
||||
strncpy(host,address,size);
|
||||
ms_free(addresses);
|
||||
}
|
||||
|
||||
|
||||
void linphone_gtk_edit_tunnel(GtkButton *button){
|
||||
GtkWidget *w=linphone_gtk_create_window("tunnel_config");
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
LinphoneTunnel *tunnel=linphone_core_get_tunnel(lc);
|
||||
char host[128]={'\0'};
|
||||
const MSList *configs;
|
||||
const char *host = NULL;
|
||||
int port=0;
|
||||
|
||||
if (!tunnel) return;
|
||||
|
||||
tunnel_get_server_host_and_port(tunnel, host, sizeof(host), &port);
|
||||
configs = linphone_tunnel_get_servers(tunnel);
|
||||
if(configs != NULL) {
|
||||
LinphoneTunnelConfig *ltc = (LinphoneTunnelConfig *)configs->data;
|
||||
host = linphone_tunnel_config_get_host(ltc);
|
||||
port = linphone_tunnel_config_get_port(ltc);
|
||||
}
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"host")),host);
|
||||
if (port==0) port=443;
|
||||
|
|
@ -1221,6 +1225,7 @@ void linphone_gtk_tunnel_ok(GtkButton *button){
|
|||
GtkWidget *w=gtk_widget_get_toplevel(GTK_WIDGET(button));
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
LinphoneTunnel *tunnel=linphone_core_get_tunnel(lc);
|
||||
LinphoneTunnelConfig *config=linphone_tunnel_config_new();
|
||||
|
||||
gint port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(w,"port")));
|
||||
gboolean enabled=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"radio_enable")));
|
||||
|
|
@ -1234,7 +1239,9 @@ void linphone_gtk_tunnel_ok(GtkButton *button){
|
|||
if (host && *host=='\0') host=NULL;
|
||||
if (http_port==0) http_port=8080;
|
||||
linphone_tunnel_clean_servers(tunnel);
|
||||
linphone_tunnel_add_server(tunnel,host,port);
|
||||
linphone_tunnel_config_set_host(config, host);
|
||||
linphone_tunnel_config_set_port(config, port);
|
||||
linphone_tunnel_add_server(tunnel, config);
|
||||
linphone_tunnel_enable(tunnel,enabled);
|
||||
linphone_tunnel_set_http_proxy(tunnel,http_host,http_port,username,password);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ static LinphoneAccountCreator *linphone_gtk_assistant_get_creator(GtkWidget*w);
|
|||
static const int PASSWORD_MIN_SIZE = 6;
|
||||
static const int LOGIN_MIN_SIZE = 4;
|
||||
|
||||
static GtkWidget *the_assistant=NULL;
|
||||
static GdkPixbuf *ok;
|
||||
static GdkPixbuf *notok;
|
||||
|
||||
|
|
@ -400,7 +401,7 @@ static int is_account_validated(GtkWidget *page) {
|
|||
}
|
||||
|
||||
static void linphone_gtk_assistant_closed(GtkWidget *w){
|
||||
gtk_widget_destroy(w);
|
||||
linphone_gtk_close_assistant();
|
||||
}
|
||||
|
||||
static void linphone_gtk_assistant_prepare(GtkWidget *assistant, GtkWidget *page){
|
||||
|
|
@ -531,8 +532,17 @@ static LinphoneAccountCreator *linphone_gtk_assistant_get_creator(GtkWidget*w){
|
|||
return (LinphoneAccountCreator*)g_object_get_data(G_OBJECT(w),"creator");
|
||||
}
|
||||
|
||||
GtkWidget * linphone_gtk_create_assistant(void){
|
||||
GtkWidget *w=gtk_assistant_new();
|
||||
void linphone_gtk_close_assistant(void){
|
||||
if(the_assistant==NULL)
|
||||
return;
|
||||
gtk_widget_destroy(the_assistant);
|
||||
the_assistant = NULL;
|
||||
}
|
||||
|
||||
void linphone_gtk_show_assistant(void){
|
||||
if(the_assistant!=NULL)
|
||||
return;
|
||||
GtkWidget *w=the_assistant=gtk_assistant_new();
|
||||
gtk_window_set_resizable (GTK_WINDOW(w), FALSE);
|
||||
|
||||
ok = create_pixbuf(linphone_gtk_get_ui_config("ok","ok.png"));
|
||||
|
|
@ -597,7 +607,5 @@ GtkWidget * linphone_gtk_create_assistant(void){
|
|||
g_signal_connect(G_OBJECT(w),"prepare",(GCallback)linphone_gtk_assistant_prepare,NULL);
|
||||
|
||||
gtk_widget_show(w);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,4 +65,11 @@ public interface LinphoneCallParams {
|
|||
* that it is achievable by the codec selected after SDP handshake. Video is automatically disabled.
|
||||
**/
|
||||
void enableLowBandwidth(boolean enable);
|
||||
|
||||
/**
|
||||
* Use to know if this call has been configured in low bandwidth mode.
|
||||
* <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
|
||||
*/
|
||||
boolean isLowBandwidthEnabled();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -876,4 +876,10 @@ public interface LinphoneCore {
|
|||
* Enable/Disable the use of inband DTMFs
|
||||
*/
|
||||
void setUseRfc2833ForDtmfs(boolean use);
|
||||
|
||||
/**
|
||||
* @return returns LpConfig object to read/write to the config file: usefull if you wish to extend
|
||||
* the config file with your own sections
|
||||
*/
|
||||
LpConfig getConfig();
|
||||
}
|
||||
|
|
|
|||
48
java/common/org/linphone/core/LpConfig.java
Normal file
48
java/common/org/linphone/core/LpConfig.java
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
LPConfig.java
|
||||
Copyright (C) 2013 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
|
||||
/**
|
||||
* The LpConfig object is used to manipulate a configuration file.
|
||||
*
|
||||
* <pre>
|
||||
* The format of the configuration file is a .ini like format:
|
||||
* - sections are defined in []
|
||||
* - each section contains a sequence of key=value pairs.
|
||||
*
|
||||
* Example:
|
||||
* [sound]
|
||||
* echocanceler=1
|
||||
* playback_dev=ALSA: Default device
|
||||
*
|
||||
* [video]
|
||||
* enabled=1
|
||||
* </pre>
|
||||
* }
|
||||
* @author Guillaume Beraudo
|
||||
*/
|
||||
public interface LpConfig {
|
||||
|
||||
/**
|
||||
* Sets an integer config item
|
||||
* @param key
|
||||
*/
|
||||
void setInt(String section, String key, int value);
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams {
|
|||
private native long getUsedVideoCodec(long nativePtr);
|
||||
private native void destroy(long nativePtr);
|
||||
private native void enableLowBandwidth(long nativePtr, boolean enable);
|
||||
private native boolean isLowBandwidthEnabled(long nativePtr);
|
||||
|
||||
public boolean getVideoEnabled() {
|
||||
return getVideoEnabled(nativePtr);
|
||||
|
|
@ -83,4 +84,8 @@ public class LinphoneCallParamsImpl implements LinphoneCallParams {
|
|||
public void enableLowBandwidth(boolean enable) {
|
||||
enableLowBandwidth(nativePtr, enable);
|
||||
}
|
||||
|
||||
public boolean isLowBandwidthEnabled() {
|
||||
return isLowBandwidthEnabled(nativePtr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ package org.linphone.core;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.linphone.CpuUtils;
|
||||
import org.linphone.mediastream.Version;
|
||||
|
||||
import android.util.Log;
|
||||
|
|
@ -43,6 +43,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
|||
loadOptionalLibrary("avutil");
|
||||
loadOptionalLibrary("swscale");
|
||||
loadOptionalLibrary("avcore");
|
||||
|
||||
System.loadLibrary("neon");
|
||||
|
||||
if (!hasNeonInCpuFeatures()) {
|
||||
boolean noNeonLibrariesLoaded = loadOptionalLibrary("avcodecnoneon");
|
||||
|
|
@ -151,28 +153,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
|
|||
|
||||
public static boolean hasNeonInCpuFeatures()
|
||||
{
|
||||
ProcessBuilder cmd;
|
||||
boolean result = false;
|
||||
|
||||
try {
|
||||
String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
|
||||
cmd = new ProcessBuilder(args);
|
||||
|
||||
Process process = cmd.start();
|
||||
InputStream in = process.getInputStream();
|
||||
byte[] re = new byte[1024];
|
||||
while(in.read(re) != -1){
|
||||
String line = new String(re);
|
||||
if (line.contains("Features")) {
|
||||
result = line.contains("neon");
|
||||
break;
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
} catch(IOException ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
CpuUtils cpu = new CpuUtils();
|
||||
return cpu.isCpuNeon();
|
||||
}
|
||||
|
||||
public static boolean isArmv7()
|
||||
|
|
|
|||
|
|
@ -866,4 +866,10 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public void setUseRfc2833ForDtmfs(boolean use) {
|
||||
setUseRfc2833ForDtmfs(nativePtr, use);
|
||||
}
|
||||
|
||||
private native long getConfig(long ptr);
|
||||
public LpConfig getConfig() {
|
||||
long configPtr=getConfig(nativePtr);
|
||||
return new LpConfigImpl(configPtr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
36
java/impl/org/linphone/core/LpConfigImpl.java
Normal file
36
java/impl/org/linphone/core/LpConfigImpl.java
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
LPConfigImpl.java
|
||||
Copyright (C) 2013 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
|
||||
|
||||
class LpConfigImpl implements LpConfig {
|
||||
|
||||
private final long nativePtr;
|
||||
|
||||
public LpConfigImpl(long ptr) {
|
||||
nativePtr=ptr;
|
||||
}
|
||||
|
||||
private native void setInt(long ptr, String section, String key, int value);
|
||||
public void setInt(String section, String key, int value) {
|
||||
setInt(nativePtr, section, key, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -40,6 +40,10 @@ AC_CHECK_LIB([eXosip2],[eXosip_tls_verify_certificate],
|
|||
[AC_DEFINE([HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE],[1],[Defined when eXosip_tls_verify_certificate is available])],
|
||||
[AC_MSG_WARN([Could not find eXosip_tls_verify_certificate in eXosip2 !])],
|
||||
[-losipparser2 -losip2 ])
|
||||
AC_CHECK_LIB([eXosip2],[eXosip_tls_verify_cn],
|
||||
[AC_DEFINE([HAVE_EXOSIP_TLS_VERIFY_CN],[1],[Defined when eXosip_tls_verify_certificate is available])],
|
||||
[AC_MSG_WARN([Could not find eXosip_tls_verify_cn in eXosip2 !])],
|
||||
[-losipparser2 -losip2 ])
|
||||
AC_CHECK_LIB([eXosip2],[eXosip_trylock],
|
||||
[AC_DEFINE([HAVE_EXOSIP_TRYLOCK],[1],[Defined when eXosip_get_socket is available])],
|
||||
[],
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 256e4eca87c06865d0ff186d05b4ca03f9394701
|
||||
Subproject commit 3a231efb89305d775ab39a6866ee981a891aed7e
|
||||
2
oRTP
2
oRTP
|
|
@ -1 +1 @@
|
|||
Subproject commit b1590514c98d33e5464d46317fdeaec52f778de7
|
||||
Subproject commit 20abeb39e1edae0f72080f7998410e9b16b9da05
|
||||
|
|
@ -11,10 +11,10 @@ status-orange.png \
|
|||
status-red.png \
|
||||
status-offline.png \
|
||||
call.png \
|
||||
chat.png \
|
||||
chat.png active_chat.png\
|
||||
chat_message_inprogress.png chat_message_delivered.png chat_message_not_delivered.png\
|
||||
contact-orange.png dialer-orange.png history-orange.png\
|
||||
startcall-green.png stopcall-red.png addcall-green.png linphone.icns \
|
||||
startcall-green.png startcall-small.png stopcall-red.png stopcall-small.png addcall-green.png linphone.icns \
|
||||
contact_starred.png contact_unstarred.png \
|
||||
speaker.png \
|
||||
ok.png \
|
||||
|
|
|
|||
BIN
pixmaps/startcall-small.png
Normal file
BIN
pixmaps/startcall-small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 5.6 KiB |
BIN
pixmaps/stopcall-small.png
Normal file
BIN
pixmaps/stopcall-small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
|
|
@ -1,49 +1,49 @@
|
|||
|
||||
gtk/p2pwizard.ui
|
||||
mediastreamer2/src/alaw.c
|
||||
mediastreamer2/src/alsa.c
|
||||
mediastreamer2/src/aqsnd.c
|
||||
mediastreamer2/src/audiomixer.c
|
||||
mediastreamer2/src/chanadapt.c
|
||||
mediastreamer2/src/drawdib-display.c
|
||||
mediastreamer2/src/dtmfgen.c
|
||||
mediastreamer2/src/equalizer.c
|
||||
mediastreamer2/src/extdisplay.c
|
||||
mediastreamer2/src/gsm.c
|
||||
mediastreamer2/src/ice.c
|
||||
mediastreamer2/src/itc.c
|
||||
mediastreamer2/src/genericplc.c
|
||||
mediastreamer2/src/macsnd.c
|
||||
mediastreamer2/src/msandroid.cpp
|
||||
mediastreamer2/src/msandroidvideo.cpp
|
||||
mediastreamer2/src/msconf.c
|
||||
mediastreamer2/src/msdscap-mingw.cc
|
||||
mediastreamer2/src/msfileplayer.c
|
||||
mediastreamer2/src/msfilerec.c
|
||||
mediastreamer2/src/msfilerec_win.c
|
||||
mediastreamer2/src/msiounit.c
|
||||
mediastreamer2/src/msjoin.c
|
||||
mediastreamer2/src/msresample.c
|
||||
mediastreamer2/src/msrtp.c
|
||||
mediastreamer2/src/msspeex.c
|
||||
mediastreamer2/src/msv4l.c
|
||||
mediastreamer2/src/msv4l2.c
|
||||
mediastreamer2/src/msvolume.c
|
||||
mediastreamer2/src/nowebcam.c
|
||||
mediastreamer2/src/pixconv.c
|
||||
mediastreamer2/src/sizeconv.c
|
||||
mediastreamer2/src/speexec.c
|
||||
mediastreamer2/src/tee.c
|
||||
mediastreamer2/src/theora.c
|
||||
mediastreamer2/src/ulaw.c
|
||||
mediastreamer2/src/videodec.c
|
||||
mediastreamer2/src/videoenc.c
|
||||
mediastreamer2/src/videoout.c
|
||||
mediastreamer2/src/void.c
|
||||
mediastreamer2/src/wincevideods.c
|
||||
mediastreamer2/src/winvideo.c
|
||||
mediastreamer2/src/winvideo2.c
|
||||
mediastreamer2/src/winvideods.c
|
||||
mediastreamer2/src/x11video.c
|
||||
mediastreamer2/src/vp8.c
|
||||
|
||||
mediastreamer2/src/android/androidsound_depr.cpp
|
||||
mediastreamer2/src/android/androidvideo.cpp
|
||||
mediastreamer2/src/audiofilters/alaw.c
|
||||
mediastreamer2/src/audiofilters/alsa.c
|
||||
mediastreamer2/src/audiofilters/aqsnd.c
|
||||
mediastreamer2/src/audiofilters/audiomixer.c
|
||||
mediastreamer2/src/audiofilters/chanadapt.c
|
||||
mediastreamer2/src/audiofilters/dtmfgen.c
|
||||
mediastreamer2/src/audiofilters/equalizer.c
|
||||
mediastreamer2/src/audiofilters/gsm.c
|
||||
mediastreamer2/src/audiofilters/genericplc.c
|
||||
mediastreamer2/src/audiofilters/macsnd.c
|
||||
mediastreamer2/src/audiofilters/msconf.c
|
||||
mediastreamer2/src/audiofilters/msfileplayer.c
|
||||
mediastreamer2/src/audiofilters/msfilerec.c
|
||||
mediastreamer2/src/audiofilters/msfilerec_win.c
|
||||
mediastreamer2/src/audiofilters/msiounit.m
|
||||
mediastreamer2/src/audiofilters/msresample.c
|
||||
mediastreamer2/src/audiofilters/msspeex.c
|
||||
mediastreamer2/src/audiofilters/msvolume.c
|
||||
mediastreamer2/src/audiofilters/oss.c
|
||||
mediastreamer2/src/audiofilters/speexec.c
|
||||
mediastreamer2/src/audiofilters/ulaw.c
|
||||
mediastreamer2/src/audiofilters/webrtc_aec.c
|
||||
mediastreamer2/src/otherfilters/itc.c
|
||||
mediastreamer2/src/otherfilters/join.c
|
||||
mediastreamer2/src/otherfilters/msrtp.c
|
||||
mediastreamer2/src/otherfilters/tee.c
|
||||
mediastreamer2/src/otherfilters/void.c
|
||||
mediastreamer2/src/videofilters/drawdib-display.c
|
||||
mediastreamer2/src/videofilters/extdisplay.c
|
||||
mediastreamer2/src/videofilters/msdscap-mingw.cc
|
||||
mediastreamer2/src/videofilters/msv4l.c
|
||||
mediastreamer2/src/videofilters/msv4l2.c
|
||||
mediastreamer2/src/videofilters/nowebcam.c
|
||||
mediastreamer2/src/videofilters/pixconv.c
|
||||
mediastreamer2/src/videofilters/sizeconv.c
|
||||
mediastreamer2/src/videofilters/theora.c
|
||||
mediastreamer2/src/videofilters/videodec.c
|
||||
mediastreamer2/src/videofilters/videoenc.c
|
||||
mediastreamer2/src/videofilters/videoout.c
|
||||
mediastreamer2/src/videofilters/vp8.c
|
||||
mediastreamer2/src/videofilters/wincevideods.c
|
||||
mediastreamer2/src/videofilters/winvideo.c
|
||||
mediastreamer2/src/videofilters/winvideods.c
|
||||
mediastreamer2/src/videofilters/winvideo2.c
|
||||
mediastreamer2/src/videofilters/x11video.c
|
||||
mediastreamer2/src/voip/ice.c
|
||||
|
|
|
|||
1618
po/nb_NO.po
1618
po/nb_NO.po
File diff suppressed because it is too large
Load diff
1583
po/pt_BR.po
1583
po/pt_BR.po
File diff suppressed because it is too large
Load diff
1682
po/zh_CN.po
1682
po/zh_CN.po
File diff suppressed because it is too large
Load diff
1609
po/zh_TW.po
1609
po/zh_TW.po
File diff suppressed because it is too large
Load diff
|
|
@ -13,29 +13,46 @@ COMMON_CFLAGS=\
|
|||
|
||||
if BUILD_TOOLS
|
||||
|
||||
lib_LTLIBRARIES=libxml2lpc.la
|
||||
lib_LTLIBRARIES=libxml2lpc.la liblpc2xml.la
|
||||
|
||||
libxml2lpc_la_SOURCES=\
|
||||
xml2lpc.c \
|
||||
xml2lpc.h
|
||||
|
||||
liblpc2xml_la_SOURCES=\
|
||||
lpc2xml.c \
|
||||
lpc2xml.h
|
||||
|
||||
libxml2lpc_la_CFLAGS=$(COMMON_CFLAGS)
|
||||
libxml2lpc_la_LIBADD=\
|
||||
$(top_builddir)/coreapi/liblinphone.la \
|
||||
$(LIBXML2_LIBS)
|
||||
|
||||
libxml2lpc_la_LDFLAGS=-no-undefined
|
||||
liblpc2xml_la_CFLAGS=$(COMMON_CFLAGS)
|
||||
liblpc2xml_la_LIBADD=\
|
||||
$(top_builddir)/coreapi/liblinphone.la \
|
||||
$(LIBXML2_LIBS)
|
||||
|
||||
bin_PROGRAMS=xml2lpc_test
|
||||
libxml2lpc_la_LDFLAGS=-no-undefined
|
||||
liblpc2xml_la_LDFLAGS=-no-undefined
|
||||
|
||||
bin_PROGRAMS=xml2lpc_test lpc2xml_test
|
||||
|
||||
xml2lpc_test_SOURCES=\
|
||||
xml2lpc_test.c
|
||||
|
||||
lpc2xml_test_SOURCES=\
|
||||
lpc2xml_test.c
|
||||
|
||||
xml2lpc_test_CFLAGS=$(COMMON_CFLAGS)
|
||||
xml2lpc_test_LDADD=\
|
||||
$(top_builddir)/coreapi/liblinphone.la \
|
||||
libxml2lpc.la
|
||||
|
||||
lpc2xml_test_CFLAGS=$(COMMON_CFLAGS)
|
||||
lpc2xml_test_LDADD=\
|
||||
$(top_builddir)/coreapi/liblinphone.la \
|
||||
liblpc2xml.la
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
|||
237
tools/lpc2xml.c
Normal file
237
tools/lpc2xml.c
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
linphone
|
||||
Copyright (C) 2012 Belledonne Communications SARL
|
||||
Yann DIORCET (yann.diorcet@linphone.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "lpc2xml.h"
|
||||
#include <string.h>
|
||||
#include <libxml/xmlsave.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#define LPC2XML_BZ 2048
|
||||
|
||||
struct _lpc2xml_context {
|
||||
const LpConfig *lpc;
|
||||
lpc2xml_function cbf;
|
||||
void *ctx;
|
||||
|
||||
xmlDoc *doc;
|
||||
char errorBuffer[LPC2XML_BZ];
|
||||
char warningBuffer[LPC2XML_BZ];
|
||||
};
|
||||
|
||||
|
||||
lpc2xml_context* lpc2xml_context_new(lpc2xml_function cbf, void *ctx) {
|
||||
lpc2xml_context *xmlCtx = (lpc2xml_context*)malloc(sizeof(lpc2xml_context));
|
||||
if(xmlCtx != NULL) {
|
||||
xmlCtx->lpc = NULL;
|
||||
xmlCtx->cbf = cbf;
|
||||
xmlCtx->ctx = ctx;
|
||||
|
||||
xmlCtx->doc = NULL;
|
||||
xmlCtx->errorBuffer[0]='\0';
|
||||
xmlCtx->warningBuffer[0]='\0';
|
||||
}
|
||||
return xmlCtx;
|
||||
}
|
||||
|
||||
void lpc2xml_context_destroy(lpc2xml_context *ctx) {
|
||||
if(ctx->doc != NULL) {
|
||||
xmlFreeDoc(ctx->doc);
|
||||
ctx->doc = NULL;
|
||||
}
|
||||
free(ctx);
|
||||
}
|
||||
/*
|
||||
static void lpc2xml_context_clear_logs(lpc2xml_context *ctx) {
|
||||
ctx->errorBuffer[0]='\0';
|
||||
ctx->warningBuffer[0]='\0';
|
||||
}*/
|
||||
|
||||
static void lpc2xml_log(lpc2xml_context *xmlCtx, int level, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
if(xmlCtx->cbf != NULL) {
|
||||
xmlCtx->cbf((xmlCtx)->ctx, level, fmt, args);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static int processEntry(const char *section, const char *entry, xmlNode *node, lpc2xml_context *ctx) {
|
||||
const char *content = lp_config_get_string(ctx->lpc, section, entry, NULL);
|
||||
if(content == NULL) {
|
||||
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Issue when reading the lpc");
|
||||
return -1;
|
||||
}
|
||||
xmlNodeSetContent(node, (const xmlChar *) content);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct __processSectionCtx {
|
||||
int ret;
|
||||
const char *section;
|
||||
xmlNode *node;
|
||||
lpc2xml_context *ctx;
|
||||
};
|
||||
|
||||
static void processSection_cb(const char *entry, struct __processSectionCtx *ctx) {
|
||||
if(ctx->ret == 0) {
|
||||
xmlNode *node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"entry", NULL);
|
||||
if(node == NULL) {
|
||||
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Can't create \"entry\" element");
|
||||
ctx->ret = -1;
|
||||
return;
|
||||
}
|
||||
xmlAttr *name_attr = xmlSetProp(node, (const xmlChar *)"name", (const xmlChar *)entry);
|
||||
if(name_attr == NULL) {
|
||||
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Can't create name attribute for \"entry\" element");
|
||||
ctx->ret = -1;
|
||||
return;
|
||||
}
|
||||
ctx->ret = processEntry(ctx->section, entry, node, ctx->ctx);
|
||||
}
|
||||
}
|
||||
|
||||
static int processSection(const char *section, xmlNode *node, lpc2xml_context *ctx) {
|
||||
struct __processSectionCtx pc_ctx = {0, section, node, ctx};
|
||||
lp_config_for_each_entry(ctx->lpc, section, (void (*)(const char *, void *))processSection_cb, (void*)&pc_ctx);
|
||||
return pc_ctx.ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct __processConfigCtx {
|
||||
int ret;
|
||||
xmlNode *node;
|
||||
lpc2xml_context *ctx;
|
||||
};
|
||||
|
||||
static void processConfig_cb(const char *section, struct __processConfigCtx *ctx) {
|
||||
if(ctx->ret == 0) {
|
||||
xmlNode *node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"section", NULL);
|
||||
if(node == NULL) {
|
||||
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Can't create \"section\" element");
|
||||
ctx->ret = -1;
|
||||
return;
|
||||
}
|
||||
xmlAttr *name_attr = xmlSetProp(node, (const xmlChar *)"name", (const xmlChar *)section);
|
||||
if(name_attr == NULL) {
|
||||
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Can't create name attribute for \"section\" element");
|
||||
ctx->ret = -1;
|
||||
return;
|
||||
}
|
||||
ctx->ret = processSection(section, node, ctx->ctx);
|
||||
}
|
||||
}
|
||||
|
||||
static int processConfig(xmlNode *node, lpc2xml_context *ctx) {
|
||||
struct __processConfigCtx pc_ctx = {0, node, ctx};
|
||||
lp_config_for_each_section(ctx->lpc, (void (*)(const char *, void *))processConfig_cb, (void*)&pc_ctx);
|
||||
return pc_ctx.ret;
|
||||
}
|
||||
|
||||
static int processDoc(xmlDoc *doc, lpc2xml_context *ctx) {
|
||||
int ret = 0;
|
||||
xmlNode *root_node = xmlNewNode(NULL, (const xmlChar *)"config");
|
||||
if(root_node == NULL) {
|
||||
lpc2xml_log(ctx, LPC2XML_ERROR, "Can't create \"config\" element");
|
||||
return -1;
|
||||
}
|
||||
xmlNs *lpc_ns = xmlNewNs(root_node, (const xmlChar *)"http://www.linphone.org/xsds/lpconfig.xsd", NULL);
|
||||
if(lpc_ns == NULL) {
|
||||
lpc2xml_log(ctx, LPC2XML_WARNING, "Can't create lpc namespace");
|
||||
} else {
|
||||
xmlSetNs(root_node, lpc_ns);
|
||||
}
|
||||
xmlNs *xsi_ns = xmlNewNs(root_node, (const xmlChar *)"http://www.w3.org/2001/XMLSchema-instance", (const xmlChar *)"xsi");
|
||||
if(lpc_ns == NULL) {
|
||||
lpc2xml_log(ctx, LPC2XML_WARNING, "Can't create xsi namespace");
|
||||
}
|
||||
xmlAttr *schemaLocation = xmlNewNsProp(root_node, xsi_ns, (const xmlChar *)"schemaLocation", (const xmlChar *)"http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd");
|
||||
if(schemaLocation == NULL) {
|
||||
lpc2xml_log(ctx, LPC2XML_WARNING, "Can't create schemaLocation");
|
||||
}
|
||||
ret = processConfig(root_node, ctx);
|
||||
xmlDocSetRootElement(doc, root_node);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int internal_convert_lpc2xml(lpc2xml_context *ctx) {
|
||||
int ret = 0;
|
||||
lpc2xml_log(ctx, LPC2XML_DEBUG, "Generation started");
|
||||
if(ctx->doc != NULL) {
|
||||
xmlFreeDoc(ctx->doc);
|
||||
ctx->doc = NULL;
|
||||
}
|
||||
xmlDoc *doc = xmlNewDoc((const xmlChar *)"1.0");
|
||||
ret = processDoc(doc, ctx);
|
||||
if(ret == 0) {
|
||||
ctx->doc = doc;
|
||||
} else {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
lpc2xml_log(ctx, LPC2XML_DEBUG, "Generation ended ret:%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lpc2xml_set_lpc(lpc2xml_context* context, const LpConfig *lpc) {
|
||||
context->lpc = lpc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lpc2xml_convert_file(lpc2xml_context* context, const char *filename) {
|
||||
int ret = 0;
|
||||
xmlSaveCtxtPtr save_ctx = xmlSaveToFilename(filename, "UTF-8", XML_SAVE_FORMAT);
|
||||
ret = internal_convert_lpc2xml(context);
|
||||
if(ret == 0) {
|
||||
ret = xmlSaveDoc(save_ctx, context->doc);
|
||||
}
|
||||
xmlSaveClose(save_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lpc2xml_convert_fd(lpc2xml_context* context, int fd) {
|
||||
int ret = 0;
|
||||
xmlSaveCtxtPtr save_ctx = xmlSaveToFd(fd, "UTF-8", XML_SAVE_FORMAT);
|
||||
ret = internal_convert_lpc2xml(context);
|
||||
if(ret == 0) {
|
||||
ret = xmlSaveDoc(save_ctx, context->doc);
|
||||
}
|
||||
xmlSaveClose(save_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lpc2xml_convert_string(lpc2xml_context* context, char **content) {
|
||||
int ret = 0;
|
||||
xmlBufferPtr buffer = xmlBufferCreate();
|
||||
xmlSaveCtxtPtr save_ctx = xmlSaveToBuffer(buffer, "UTF-8", XML_SAVE_FORMAT);
|
||||
internal_convert_lpc2xml(context);
|
||||
if(ret == 0) {
|
||||
ret = xmlSaveDoc(save_ctx, context->doc);
|
||||
}
|
||||
xmlSaveClose(save_ctx);
|
||||
if(ret == 0) {
|
||||
#if LIBXML_VERSION >= 20800
|
||||
*content = (char *)xmlBufferDetach(buffer);
|
||||
#else
|
||||
*content = strdup((const char *)xmlBufferContent(buffer));
|
||||
#endif
|
||||
}
|
||||
xmlBufferFree(buffer);
|
||||
return ret;
|
||||
}
|
||||
46
tools/lpc2xml.h
Normal file
46
tools/lpc2xml.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
linphone
|
||||
Copyright (C) 2012 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef LPC2XML_H_
|
||||
#define LPC2XML_H_
|
||||
|
||||
#include "lpconfig.h"
|
||||
|
||||
typedef struct _lpc2xml_context lpc2xml_context;
|
||||
|
||||
typedef enum _lpc2xml_log_level {
|
||||
LPC2XML_DEBUG = 0,
|
||||
LPC2XML_MESSAGE,
|
||||
LPC2XML_WARNING,
|
||||
LPC2XML_ERROR
|
||||
} lpc2xml_log_level;
|
||||
|
||||
typedef void(*lpc2xml_function)(void *ctx, lpc2xml_log_level level, const char *fmt, va_list list);
|
||||
|
||||
lpc2xml_context* lpc2xml_context_new(lpc2xml_function cbf, void *ctx);
|
||||
void lpc2xml_context_destroy(lpc2xml_context*);
|
||||
|
||||
int lpc2xml_set_lpc(lpc2xml_context* context, const LpConfig *lpc);
|
||||
|
||||
int lpc2xml_convert_file(lpc2xml_context* context, const char *filename);
|
||||
int lpc2xml_convert_fd(lpc2xml_context* context, int fd);
|
||||
int lpc2xml_convert_string(lpc2xml_context* context, char **content);
|
||||
|
||||
|
||||
#endif //LPC2XML_H_
|
||||
67
tools/lpc2xml_test.c
Normal file
67
tools/lpc2xml_test.c
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
linphone
|
||||
Copyright (C) 2012 Belledonne Communications SARL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "lpc2xml.h"
|
||||
|
||||
void cb_function(void *ctx, lpc2xml_log_level level, const char *msg, va_list list) {
|
||||
const char *header = "";
|
||||
switch(level) {
|
||||
case LPC2XML_DEBUG:
|
||||
header = "DEBUG";
|
||||
break;
|
||||
case LPC2XML_MESSAGE:
|
||||
header = "MESSAGE";
|
||||
break;
|
||||
case LPC2XML_WARNING:
|
||||
header = "WARNING";
|
||||
break;
|
||||
case LPC2XML_ERROR:
|
||||
header = "ERROR";
|
||||
break;
|
||||
}
|
||||
fprintf(stdout, "%s - ", header);
|
||||
vfprintf(stdout, msg, list);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
void show_usage(int argc, char *argv[]) {
|
||||
fprintf(stderr, "usage %s convert <lpc_file> <xml_file>\n",
|
||||
argv[0]);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if(argc != 4) {
|
||||
show_usage(argc, argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
lpc2xml_context *ctx = lpc2xml_context_new(cb_function, NULL);
|
||||
LpConfig *lpc = lp_config_new(argv[2]);
|
||||
lpc2xml_set_lpc(ctx, lpc);
|
||||
if(strcmp("convert", argv[1]) == 0) {
|
||||
lpc2xml_convert_file(ctx, argv[3]);
|
||||
} else {
|
||||
show_usage(argc, argv);
|
||||
}
|
||||
lp_config_destroy(lpc);
|
||||
lpc2xml_context_destroy(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ static void xml2lpc_log(xml2lpc_context *xmlCtx, int level, const char *fmt, ...
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) {
|
||||
static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) {
|
||||
xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx;
|
||||
int sl = strlen(xmlCtx->errorBuffer);
|
||||
va_list args;
|
||||
|
|
@ -87,7 +87,7 @@ static void xml2lpc_genericxml_error(void *ctx, const char *fmt, ...) {
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
static void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) {
|
||||
static void xml2lpc_genericxml_warning(void *ctx, const char *fmt, ...) {
|
||||
xml2lpc_context *xmlCtx = (xml2lpc_context *)ctx;
|
||||
int sl = strlen(xmlCtx->warningBuffer);
|
||||
va_list args;
|
||||
|
|
@ -214,11 +214,11 @@ static int processDoc(xmlNode *node, xml2lpc_context *ctx) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int internal_convert_xml2lpc(xmlDoc *doc, xml2lpc_context *ctx) {
|
||||
static int internal_convert_xml2lpc(xml2lpc_context *ctx) {
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "Parse started");
|
||||
xmlNode *rootNode = xmlDocGetRootElement(doc);
|
||||
xmlNode *rootNode = xmlDocGetRootElement(ctx->doc);
|
||||
//dumpNodes(0, rootNode, cbf, ctx);
|
||||
int ret = processDoc(rootNode, ctx);
|
||||
int ret = processDoc(rootNode, ctx);
|
||||
xml2lpc_log(ctx, XML2LPC_DEBUG, "Parse ended ret:%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -230,10 +230,10 @@ int xml2lpc_validate(xml2lpc_context *xmlCtx) {
|
|||
validCtx = xmlSchemaNewValidCtxt(xmlSchemaParse(parserCtx));
|
||||
xmlSchemaSetValidErrors(validCtx, xml2lpc_genericxml_error, xml2lpc_genericxml_warning, xmlCtx);
|
||||
int ret = xmlSchemaValidateDoc(validCtx, xmlCtx->doc);
|
||||
if(ret >0) {
|
||||
if(ret > 0) {
|
||||
xml2lpc_log(xmlCtx, XML2LPC_WARNING, "%s", xmlCtx->warningBuffer);
|
||||
xml2lpc_log(xmlCtx, XML2LPC_ERROR, "%s", xmlCtx->errorBuffer);
|
||||
} else {
|
||||
} else if(ret < 0) {
|
||||
xml2lpc_log(xmlCtx, XML2LPC_ERROR, "Internal error");
|
||||
}
|
||||
xmlSchemaFreeValidCtxt(validCtx);
|
||||
|
|
@ -243,7 +243,7 @@ int xml2lpc_validate(xml2lpc_context *xmlCtx) {
|
|||
int xml2lpc_convert(xml2lpc_context *xmlCtx, LpConfig *lpc) {
|
||||
xml2lpc_context_clear_logs(xmlCtx);
|
||||
xmlCtx->lpc = lpc;
|
||||
return internal_convert_xml2lpc(xmlCtx->doc, xmlCtx);
|
||||
return internal_convert_xml2lpc(xmlCtx);
|
||||
}
|
||||
|
||||
int xml2lpc_set_xml_file(xml2lpc_context* xmlCtx, const char *filename) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue