TT#52651 config options for forwarding option

Change-Id: Ieaa2ee0e55a0c531158174bc6a534738a64dbee6
changes/29/27229/5
Richard Fuchs 6 years ago
parent 06d61cd3dd
commit 1bc38e4201

@ -11,3 +11,4 @@ codeclib.c
resample.c
str.c
fix_frame_channel_layout.h
socket.c

@ -1,6 +1,6 @@
TARGET= rtpengine-recording
CFLAGS= -g -Wall -pthread -I. -I../lib/
CFLAGS= -g -Wall -pthread -I. -I../lib/ -I../kernel-module/
CFLAGS+= -std=c99
CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE
CFLAGS+= $(shell pkg-config --cflags glib-2.0)
@ -26,7 +26,7 @@ LDLIBS+= $(shell pkg-config --libs openssl)
SRCS= epoll.c garbage.c inotify.c main.c metafile.c stream.c recaux.c packet.c \
decoder.c output.c mix.c db.c log.c forward.c tag.c
LIBSRCS= loglib.c auxlib.c rtplib.c codeclib.c resample.c str.c
LIBSRCS= loglib.c auxlib.c rtplib.c codeclib.c resample.c str.c socket.c
OBJS= $(SRCS:.c=.o) $(LIBSRCS:.c=.o)
include ../lib/common.Makefile

@ -9,6 +9,7 @@
#include <stdlib.h>
#define dbg(fmt, ...) ilog(LOG_DEBUG, "[%s:%i] " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#define __C_DBG(x...) ilog(LOG_DEBUG, x)
void __ilog(int prio, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));

@ -24,6 +24,7 @@
#include "output.h"
#include "forward.h"
#include "codeclib.h"
#include "socket.h"
@ -42,6 +43,9 @@ const char *c_mysql_host,
*c_mysql_db;
int c_mysql_port;
const char *forward_to = NULL;
static const char *tcp_send_to = NULL;
endpoint_t tcp_send_to_ep;
int tcp_resample = 8000;
static GQueue threads = G_QUEUE_INIT; // only accessed from main thread
@ -153,20 +157,27 @@ static void options(int *argc, char ***argv) {
{ "mysql-user", 0, 0, G_OPTION_ARG_STRING, &c_mysql_user, "MySQL connection credentials", "USERNAME" },
{ "mysql-pass", 0, 0, G_OPTION_ARG_STRING, &c_mysql_pass, "MySQL connection credentials", "PASSWORD" },
{ "mysql-db", 0, 0, G_OPTION_ARG_STRING, &c_mysql_db, "MySQL database name", "STRING" },
{ "forward-to", 0, 0, G_OPTION_ARG_STRING, &forward_to, "Where to forward to (unix socket)", "PATH" },
{ "forward-to", 0, 0, G_OPTION_ARG_STRING, &forward_to, "Where to forward to (unix socket)", "PATH" },
{ "tcp-send-to", 0, 0, G_OPTION_ARG_STRING, &tcp_send_to, "Where to send to (TCP destination)", "IP:PORT" },
{ "tcp-resample", 0, 0, G_OPTION_ARG_INT, &tcp_resample, "Sampling rate for TCP PCM output", "INT" },
{ NULL, }
};
config_load(argc, argv, e, " - rtpengine recording daemon",
"/etc/rtpengine/rtpengine-recording.conf", "rtpengine-recording", &rtpe_common_config);
if (tcp_send_to) {
if (endpoint_parse_any_getaddrinfo_full(&tcp_send_to_ep, tcp_send_to))
die("Failed to parse 'tcp-send-to' option");
}
if (!strcmp(output_format, "none")) {
output_enabled = 0;
if (output_mixed || output_single)
die("Output is disabled, but output-mixed or output-single is set");
if (!forward_to) {
if (!forward_to && !tcp_send_to_ep.address.family) {
//the daemon has no function
die("Both output and packet forwarding are disabled");
die("Both output and forwarding are disabled");
}
} else if (!output_mixed && !output_single)
output_mixed = output_single = 1;

@ -3,6 +3,7 @@
#include "auxlib.h"
#include "socket.h"
enum output_storage_enum {
@ -25,6 +26,8 @@ extern const char *c_mysql_host,
*c_mysql_db;
extern int c_mysql_port;
extern const char *forward_to;
extern endpoint_t tcp_send_to_ep;
extern int tcp_resample;
extern volatile int shutdown_flag;

Loading…
Cancel
Save