提交 861bd209 authored 作者: Brian West's avatar Brian West

ZRTP Support please download your SDK from http://www.zfone.com and use…

 ZRTP Support please download your SDK from http://www.zfone.com and use build/buildzrtp.sh to build the lib. 

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13406 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 ece57ca1
......@@ -198,6 +198,10 @@ libfreeswitch_la_SOURCES += src/switch_odbc.c
libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
endif
if ENABLE_ZRTP
libfreeswitch_la_LDFLAGS += -lzrtp -lbn
endif
bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
src/include/switch_swigable_cpp.h: src/include/switch_cpp.h
......
#!/bin/sh
tar zxf libzrtp-0.81.514.tar.gz
cd libzrtp-0.81.514
patch -p1 < ../patches/zrtp_bnlib_pic.diff
cd projects/gnu/
./configure CFLAGS="-fPIC"
make
make install
......@@ -264,6 +264,21 @@ if test "${enable_debug}" = "yes"; then
fi
AC_ARG_ENABLE(zrtp,
[AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
if test "x$enable_zrtp" = "xyes" ; then
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L/usr/local/lib -lbn -lpthread"
AC_CHECK_LIB(zrtp, zrtp_init, [has_zrtp="yes"], [has_zrtp="no"])
LIBS=$saved_LIBS
if test "x$has_zrtp" = "xno"; then
AC_ERROR([Cannot locate zrtp libraries])
fi
APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP)
fi
AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"])
AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
AC_ARG_ENABLE(core-odbc-support,
......
--- libzrtp-0.81.514.orig/third_party/bnlib/cfg.debug 2009-03-22 08:26:34.000000000 -0500
+++ libzrtp-0.81.514.patched/third_party/bnlib/cfg.debug 2009-05-20 11:42:52.000000000 -0500
@@ -1 +1 @@
-./configure CFLAGS="-O0 -g3"
+./configure CFLAGS="-O0 -g3 -fPIC"
......@@ -496,7 +496,9 @@ typedef enum {
SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19),
SWITCH_RTP_FLAG_FLUSH = (1 << 20),
SWITCH_RTP_FLAG_AUTOFLUSH = (1 << 21),
SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22)
SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22),
SWITCH_ZRTP_FLAG_SECURE_SEND = (1 << 23),
SWITCH_ZRTP_FLAG_SECURE_RECV = (1 << 24)
} switch_rtp_flag_enum_t;
typedef uint32_t switch_rtp_flag_t;
......
......@@ -36,6 +36,7 @@
#include <switch.h>
#include <switch_stun.h>
#include <switch_version.h>
#include "private/switch_core_pvt.h"
#ifndef WIN32
......@@ -1026,6 +1027,48 @@ SWITCH_DECLARE(uint32_t) switch_core_default_dtmf_duration(uint32_t duration)
return runtime.default_dtmf_duration;
}
static void switch_core_set_serial(void)
{
char buf[13] = "";
char path[256];
int fd = -1, write_fd = -1;
ssize_t bytes = 0;
switch_snprintf(path, sizeof(path), "%s%sfreeswitch.serial", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR);
if ((fd = open(path, O_RDONLY, 0)) < 0) {
char *ip = switch_core_get_variable("local_ip_v4");
uint32_t ipi = 0;
switch_byte_t *byte;
int i = 0;
switch_inet_pton(AF_INET, ip, &ipi);
byte = (switch_byte_t *) &ipi;
for(i = 0; i < 8; i += 2) {
switch_snprintf(buf + i, sizeof(buf) - i, "%0.2x", *byte);
byte++;
}
switch_stun_random_string(buf + 8, 4, "0123456789abcdef");
if ((write_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) >= 0) {
bytes = write(write_fd, buf, sizeof(buf));
close(write_fd);
write_fd = -1;
}
} else {
bytes = read(fd, buf, sizeof(buf));
close(fd);
fd = -1;
}
switch_core_set_variable("switch_serial", buf);
}
SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
{
switch_uuid_t uuid;
......@@ -1084,12 +1127,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime.flags = flags;
runtime.sps_total = 30;
switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
switch_core_set_variable("local_ip_v4", guess_ip);
switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET6);
switch_core_set_variable("local_ip_v6", guess_ip);
switch_core_set_variable("base_dir", SWITCH_GLOBAL_dirs.base_dir);
switch_core_set_serial();
switch_event_init(runtime.memory_pool);
......@@ -1253,6 +1298,10 @@ static void switch_load_core_config(const char *file)
switch_rtp_set_start_port((switch_port_t) atoi(val));
} else if (!strcasecmp(var, "rtp-end-port") && !switch_strlen_zero(val)) {
switch_rtp_set_end_port((switch_port_t) atoi(val));
#ifdef ENABLE_ZRTP
} else if (!strcasecmp(var, "rtp-enable-zrtp")) {
switch_core_set_variable("zrtp_enabled", val);
#endif
}
}
}
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论