Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ BUILD_UDP_CONTENTION_FALSE
BUILD_UDP_CONTENTION_TRUE
BUILD_LOG_STAND_FALSE
BUILD_LOG_STAND_TRUE
HAVE_LIBCRYPTO_FALSE
HAVE_LIBCRYPTO_TRUE
BUILD_CRYPTO_FALSE
BUILD_CRYPTO_TRUE
BUILD_ELPERIODIC_FALSE
Expand Down Expand Up @@ -15426,6 +15428,56 @@ fi
fi
fi

# libcrypto (OpenSSL), for --record_callid_hash sha256
ac_fn_c_check_header_compile "$LINENO" "openssl/evp.h" "ac_cv_header_openssl_evp_h" "$ac_includes_default"
if test "x$ac_cv_header_openssl_evp_h" = xyes
then :
found_libcrypto=yes
fi

if test "$found_libcrypto" = yes
then
save_LIBS="${LIBS}"
LIBS="${LIBS} ${LIB_CRYPTO}"
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for EVP_Digest in libcrypto" >&5
printf %s "checking for EVP_Digest in libcrypto... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <openssl/evp.h>

int
main (void)
{

return EVP_Digest("", 0, NULL, NULL, EVP_sha256(), NULL);

;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :

{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf '%s\n' "yes" >&6; }
found_evp_digest=yes

printf '%s\n' "#define HAVE_LIBCRYPTO 1" >>confdefs.h


else case e in #(
e)
{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf '%s\n' "no" >&6; }
;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS="${save_LIBS}"
fi

# libelperiodic
ac_fn_c_check_header_compile "$LINENO" "elperiodic.h" "ac_cv_header_elperiodic_h" "$ac_includes_default"
if test "x$ac_cv_header_elperiodic_h" = xyes
Expand Down Expand Up @@ -16949,6 +17001,14 @@ else
BUILD_CRYPTO_FALSE=
fi

if test "x${found_evp_digest}" = xyes; then
HAVE_LIBCRYPTO_TRUE=
HAVE_LIBCRYPTO_FALSE='#'
else
HAVE_LIBCRYPTO_TRUE='#'
HAVE_LIBCRYPTO_FALSE=
fi

if test "${LIBS_SIPLOG}" = ""; then
BUILD_LOG_STAND_TRUE=
BUILD_LOG_STAND_FALSE='#'
Expand Down Expand Up @@ -17230,6 +17290,10 @@ if test -z "${BUILD_CRYPTO_TRUE}" && test -z "${BUILD_CRYPTO_FALSE}"; then
as_fn_error $? "conditional \"BUILD_CRYPTO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${HAVE_LIBCRYPTO_TRUE}" && test -z "${HAVE_LIBCRYPTO_FALSE}"; then
as_fn_error $? "conditional \"HAVE_LIBCRYPTO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILD_LOG_STAND_TRUE}" && test -z "${BUILD_LOG_STAND_FALSE}"; then
as_fn_error $? "conditional \"BUILD_LOG_STAND\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Expand Down
22 changes: 22 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,27 @@ else
fi
fi

# libcrypto (OpenSSL), for --record_callid_hash sha256
AC_CHECK_HEADER(openssl/evp.h, found_libcrypto=yes)
if test "$found_libcrypto" = yes
then
save_LIBS="${LIBS}"
LIBS="${LIBS} ${LIB_CRYPTO}"
AC_MSG_CHECKING([for EVP_Digest in libcrypto])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <openssl/evp.h>
], [
return EVP_Digest("", 0, NULL, NULL, EVP_sha256(), NULL);
])], [
AC_MSG_RESULT([yes])
found_evp_digest=yes
AC_DEFINE([HAVE_LIBCRYPTO], 1, [Define if you have libcrypto (OpenSSL) installed])
], [
AC_MSG_RESULT([no])
])
LIBS="${save_LIBS}"
fi

# libelperiodic
AC_CHECK_HEADER(elperiodic.h, found_libelperiodic=yes)
if test "$found_libelperiodic" = yes
Expand Down Expand Up @@ -494,6 +515,7 @@ AM_CONDITIONAL(BUILD_MODULES, [test "${ENABLE_MODULE_IF}" = 1])
AM_CONDITIONAL(ENABLE_MODULE_IF, [test "${ENABLE_MODULE_IF}" = 1])
AM_CONDITIONAL(BUILD_ELPERIODIC, [test "${EXTERNAL_ELPERIODIC}" != 1])
AM_CONDITIONAL(BUILD_CRYPTO, [test "${LIBS_SRTP}" != ""])
AM_CONDITIONAL(HAVE_LIBCRYPTO, [test "x${found_evp_digest}" = xyes])
AM_CONDITIONAL(BUILD_LOG_STAND, [test "${LIBS_SIPLOG}" = ""])
AM_CONDITIONAL(BUILD_UDP_CONTENTION, [test "${ENABLE_UDP_CONTENTION}" = 1])
AM_CONDITIONAL(BUILD_OBJCK, [test "${ENABLE_OBJCK}" = 1])
Expand Down
57 changes: 57 additions & 0 deletions doc/manpage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
<arg choice="opt"><option>--bridge_symmetric</option></arg>

<arg choice="opt"><option>--no_resolve</option></arg>
<arg choice="opt"><option>--record_callid_hash</option> <replaceable>method</replaceable></arg>
</cmdsynopsis>

<cmdsynopsis>
Expand Down Expand Up @@ -819,6 +820,62 @@
names.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--record_callid_hash</option>
<replaceable>method</replaceable></term>

<listitem>
<para>Selects how the Call-ID is put into the recording file name
when the name is built from the Call-ID and from-tag (the
<command>R</command> and <command>Rs</command> commands and the
<option>-a</option> option). File names given explicitly with the
<command>C</command> command are not affected. The from-tag is
always used as is. <replaceable>method</replaceable> is one
of:</para>

<variablelist>
<varlistentry>
<term><literal>raw</literal></term>

<listitem>
<para>Use the Call-ID as is (the default). Calls whose
Call-ID contains <quote>/</quote> are not recorded.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><literal>sha256</literal></term>

<listitem>
<para>Use the SHA-256 digest of the Call-ID, written as 64
lowercase hex characters. This is the recommended method
for its security properties. A recording can be found from
a known Call-ID by computing the same digest, for example
with <command>printf '%s' "$CALLID" | sha256sum</command>.
Available only if <command>rtpproxy</command> has been
built with OpenSSL.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><literal>b64url</literal></term>

<listitem>
<para>Use the Call-ID encoded with the URL-safe base64
alphabet (RFC 4648, section 5) without padding. Use it when
the Call-ID has to be recovered from the file name, for
example to index existing recordings. The resulting file
names are case-sensitive.</para>
</listitem>
</varlistentry>
</variablelist>

<para>If <replaceable>method</replaceable> is unknown or is not
available in this build, <command>rtpproxy</command> reports an
error and exits.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

Expand Down
41 changes: 40 additions & 1 deletion rtpproxy.8
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
rtpproxy \- RTP (Real\-time Transport Protocol) Proxy Server
.SH "SYNOPSIS"
.HP \w'\fBrtpproxy\fR\ 'u
\fBrtpproxy\fR [\fB\-?\fR] [\fB\-2\fR] [\fB\-f\fR] [\fB\-v\fR] [\fB\-V\fR] [\fB\-R\fR] [\fB\-l\fR\ \fIaddr1\fR\fI[/addr2]\fR...] [\fB\-l\fR\ \fI[label@]\fR\fIaddress\fR\fI[=advertized_address]\fR...] [\fB\-6\fR\ \fIaddr1\fR\fI[/addr2]\fR...] [\fB\-6\fR\ \fI[label@]\fR\fIaddress\fR\fI[=advertized_address]\fR...] [\fB\-s\fR\ \fIctrl_socket\fR] [\fB\-t\fR\ \fItos\fR] [\fB\-p\fR\ \fIpidfile\fR] [\fB\-T\fR\ \fImax_ttl\fR] [\fB\-\-maxpps\fR\ \fIpps\fR\fI[,rtcp_pps]\fR] [\fB\-\-maxpsize\fR\ \fIsize\fR\fI[,rtcp_size]\fR] [\fB\-r\fR\ \fIrdir\fR\ [\fB\-S\fR\ \fIsdir\fR]] [\fB\-L\fR\ \fInofile_limit\fR] [\fB\-A\fR\ \fIadvaddr1\fR\fI[/advaddr2]\fR] [\fB\-m\fR\ \fImin_port\fR] [\fB\-M\fR\ \fImax_port\fR] [\fB\-u\fR\ \fIuname\fR\fI[:gname]\fR] [\fB\-w\fR\ \fIsock_mode\fR] [\fB\-F\fR] [\fB\-i\fR] [\fB\-n\fR\ \fItimeout_socket\fR] [\fB\-P\fR] [\fB\-a\fR] [\fB\-d\fR\ \fIlog_level\fR\fI[:log_facility]\fR] [\fB\-W\fR\ \fIsetup_ttl\fR] [\fB\-\-force_asymmetric\fR] [\fB\-b\fR] [\fB\-c\fR\ \fIfifo|rr\fR] [\fB\-\-nice\fR\ \fIlevel\fR] [\fB\-D\fR] [\fB\-\-no_redirect\fR] [\fB\-\-config\fR\ \fIconfig_file\fR] [\fB\-\-dso\fR\ \fImodule\fR...] [\fB\-\-bridge_symmetric\fR] [\fB\-\-no_resolve\fR]
\fBrtpproxy\fR [\fB\-?\fR] [\fB\-2\fR] [\fB\-f\fR] [\fB\-v\fR] [\fB\-V\fR] [\fB\-R\fR] [\fB\-l\fR\ \fIaddr1\fR\fI[/addr2]\fR...] [\fB\-l\fR\ \fI[label@]\fR\fIaddress\fR\fI[=advertized_address]\fR...] [\fB\-6\fR\ \fIaddr1\fR\fI[/addr2]\fR...] [\fB\-6\fR\ \fI[label@]\fR\fIaddress\fR\fI[=advertized_address]\fR...] [\fB\-s\fR\ \fIctrl_socket\fR] [\fB\-t\fR\ \fItos\fR] [\fB\-p\fR\ \fIpidfile\fR] [\fB\-T\fR\ \fImax_ttl\fR] [\fB\-\-maxpps\fR\ \fIpps\fR\fI[,rtcp_pps]\fR] [\fB\-\-maxpsize\fR\ \fIsize\fR\fI[,rtcp_size]\fR] [\fB\-r\fR\ \fIrdir\fR\ [\fB\-S\fR\ \fIsdir\fR]] [\fB\-L\fR\ \fInofile_limit\fR] [\fB\-A\fR\ \fIadvaddr1\fR\fI[/advaddr2]\fR] [\fB\-m\fR\ \fImin_port\fR] [\fB\-M\fR\ \fImax_port\fR] [\fB\-u\fR\ \fIuname\fR\fI[:gname]\fR] [\fB\-w\fR\ \fIsock_mode\fR] [\fB\-F\fR] [\fB\-i\fR] [\fB\-n\fR\ \fItimeout_socket\fR] [\fB\-P\fR] [\fB\-a\fR] [\fB\-d\fR\ \fIlog_level\fR\fI[:log_facility]\fR] [\fB\-W\fR\ \fIsetup_ttl\fR] [\fB\-\-force_asymmetric\fR] [\fB\-b\fR] [\fB\-c\fR\ \fIfifo|rr\fR] [\fB\-\-nice\fR\ \fIlevel\fR] [\fB\-D\fR] [\fB\-\-no_redirect\fR] [\fB\-\-config\fR\ \fIconfig_file\fR] [\fB\-\-dso\fR\ \fImodule\fR...] [\fB\-\-bridge_symmetric\fR] [\fB\-\-no_resolve\fR] [\fB\-\-record_callid_hash\fR\ \fImethod\fR]
.HP \w'\fBrtpproxy\fR\ 'u
\fBrtpproxy\fR \fB\-C\fR
.SH "DESCRIPTION"
Expand Down Expand Up @@ -502,6 +502,45 @@ In the bridging mode, do not treat all sessions as asymmetric, which is the defa
.RS 4
Only accept numeric IP addresses, in the command line arguments and in the control commands, instead of resolving host names\&.
.RE
.PP
\fB\-\-record_callid_hash\fR \fImethod\fR
.RS 4
Selects how the Call\-ID is put into the recording file name when the name is built from the Call\-ID and from\-tag (the
\fBR\fR
and
\fBRs\fR
commands and the
\fB\-a\fR
option)\&. File names given explicitly with the
\fBC\fR
command are not affected\&. The from\-tag is always used as is\&.
\fImethod\fR
is one of:
.PP
raw
.RS 4
Use the Call\-ID as is (the default)\&. Calls whose Call\-ID contains "/" are not recorded\&.
.RE
.PP
sha256
.RS 4
Use the SHA\-256 digest of the Call\-ID, written as 64 lowercase hex characters\&. This is the recommended method for its security properties\&. A recording can be found from a known Call\-ID by computing the same digest, for example with
\fBprintf \*(Aq%s\*(Aq "$CALLID" | sha256sum\fR\&. Available only if
\fBrtpproxy\fR
has been built with OpenSSL\&.
.RE
.PP
b64url
.RS 4
Use the Call\-ID encoded with the URL\-safe base64 alphabet (RFC 4648, section 5) without padding\&. Use it when the Call\-ID has to be recovered from the file name, for example to index existing recordings\&. The resulting file names are case\-sensitive\&.
.RE
.sp
If
\fImethod\fR
is unknown or is not available in this build,
\fBrtpproxy\fR
reports an error and exits\&.
.RE
.SH "PRINCIPLES OF OPERATION"
.PP
When the SIP controller receives an INVITE request, it extracts the Call\-ID and from_tag from INVITE\&. The call controller communicates it with the rtpproxy via Unix domain socket or a UDP socket\&. rtpproxy looks for an existing session with the given Call\-ID and from_tag\&.
Expand Down
5 changes: 5 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ BASE_SOURCES=main.c rtp.h rtpp_server.c \
rtpp_network_io.c rtpp_network_io.h rtpp_wi_pkt.c rtpp_wi_pkt.h \
rtpp_timeout_data.c rtpp_timeout_data.h rtpp_locking.h \
rtpp_nofile.c rtpp_nofile.h rtpp_record_adhoc.h \
rtpp_record_util.c rtpp_record_util.h \
$(CMDSRCDIR)/rpcpv1_norecord.c $(CMDSRCDIR)/rpcpv1_norecord.h \
$(CMDSRCDIR)/rpcpv1_ul_subc.c $(CMDSRCDIR)/rpcpv1_ul_subc.h \
$(RTPP_AUTOSRC_SOURCES) rtpp_epoll.c rtpp_str.c rtpp_str.h \
Expand Down Expand Up @@ -222,6 +223,10 @@ endif
endif
librtpproxy_la_LDFLAGS = -static
librtpproxy_la_LIBADD += @LIBS_ELPERIODIC@
if HAVE_LIBCRYPTO
rtpproxy_debug_LDADD += $(LIB_CRYPTO)
librtpproxy_la_LIBADD += $(LIB_CRYPTO)
endif

update_autosrc:
@echo "# Auto-generated by $(srcdir)/Makefile - DO NOT EDIT!" > $(RTPP_AUTOSRC_DIR)/Makefile.ami
Expand Down
Loading
Loading